A high-performance, 100% offline, self-contained Java codebase intelligence and architectural exploration tool. Scan any Java source repository to extract Abstract Syntax Trees (AST), map dependency and call hierarchies, investigate repository-wide field mutation impacts, identify structural drift, audit Git author churn, and inspect source files with syntax highlighting β all served locally through an interactive cyber-dark web interface.
π Comprehensive Guides & Architecture Blueprints: Browse the Official GitHub Documentation Wiki for in-depth subsystem guides, ADRs, process specifications, and REST API references.
- Official GitHub Documentation Wiki
- Overview & Core Capabilities
- Architecture & Tech Stack
- System Requirements & Zero-Admin Execution
- Build & Quick Start
- Shipping & Deployment Handbook
- Configuration Management (
codelens.conf) - Scanning Engine & Operational Guide
- Workspace Views & Feature Guide
- 1. Header Bar & Project Telemetry
- 2. Left Explorer & Lucene Search Engine
- 3. Interactive Center Workspace Views
- A. Graph Canvas (Graphify Knowledge Graph & Verlet Physics)
- B. Knowledge Base Catalog & Complexity Analysis
- C. Visualizations Suite (3D City, 3D Galaxy, Treemap, Sunburst, DSM, Chord)
- D. On-Demand Code Review & 32-Rule Static Auditor
- E. Git Analytics & Churn Heatmap
- F. Integrated Monaco Source Code Editor
- 4. Right Inspector Panel & Multi-Hop Propagation
- 5. Analyst Notes Engine
- 6. Export Reports Hub (13 Reports & 57 Export Artifacts)
- 7. Background Tasks & Process Manager (11 Engines)
- Critical Path Trace & Execution Analysis
- Semantic Archetypes & Domain Templates
- Impact Investigation & Deep Architectural Workflows
- Data Storage, H2 Compaction & High-Scale Persistence
- Comprehensive REST API Reference
- Keyboard Shortcuts
- Troubleshooting & FAQ
| # | Capability | Description | Technical Engine |
|---|---|---|---|
| 1 | Source AST Indexing | Scans 100% of .java source files, extracting packages, types, methods, fields, modifiers, and line numbers into an embedded database. |
JavaParser 3.25.8 + Embedded H2 Database |
| 2 | Dynamic Call Hierarchies | Computes upstream callers and downstream callees across methods with user-selectable BFS traversal depths (1 to 15 hops / Max). | In-memory JGraphT directed graph + reversed BFS iterator |
| 3 | CodeStory Transaction Narratives | Automatically discovers and synthesizes end-to-end execution flows from entry points down to persistent database mutation sinks into plain-English storylines. | Multi-hop sink tracer + Narrative synthesis engine |
| 4 | "Teach Me" Onboarding Tour | Guided 5-layer architectural tour (Domain Core, Ingestion & Store, Topology & Layouts, Semantic Storylines, Intelligence Reports) with source citations. | Multi-layer tour generator + Step traverser |
| 5 | Field Impact & Mutation Chains | Maps every method reading or writing a field, tracing multi-hop upstream triggers (Field Writers Callers) across the entire repository. |
Custom relationship visitor + caller propagation engine |
| 6 | Structural Integrity Audit | 14 active class-awareness rules auditing AST signature divergences, naming drift, interface contract gaps, and body hash clones. | 14 AST rules + Levenshtein distance + SHA-256 hashing |
| 7 | Behavioral Hotspots Intelligence | Evaluates code risk and technical debt via composite metric |
JGit churn log + AST complexity scorer + Thermal shaders |
| 8 | Interactive DSM with Method Drilldown | Multi-tier Dependency Structure Matrix (Modules Packages Classes Methods). Double-click headers to drill into method invocations with breadcrumbs, DAG acyclicity rating, and CSV/JSON exports. |
Matrix permutation engine + Tarjan cycles + Adjacency exporter |
| 9 | Critical Path Execution Trace | Traces end-to-end execution sequences from controllers through domain services down to persistent entity mutations (Get, Create, Modify) and downstream audit sinks. |
Multi-hop graph search + Risk scoring + Stepper Dock |
| 10 | Grounded AI Architecture Assistant | Context-grounded Q&A and code explanation engine supporting local Ollama models, OpenAI, and deterministic fallback templates. | Dual-provider AI bridge + Prompt grounding |
| 11 | Developer CLI Toolsuite | Headless CLI subcommands (scan, story, trace, what-if/impact, ask, explain, teach-me, pr-story) for terminals and CI/CD. |
Built-in CLI runner + Direct H2/Lucene access |
| 12 | Semantic Archetypes Engine | Classifies methods and types into domain-specific roles (BaNCS ET/BT/TO/TC/Batch, Spring, DDD) with module token substitution ({MODULE}) and custom rules. |
Regex & Prefix token substitution + LocalStorage persistence |
| 13 | Git Blame, Churn & PR Story | Computes commit counts, author blame, churn frequency, and automated Git pull request change narratives comparing base and head refs. | JGit 6.9 engine + Git PR storyline analyzer |
| 14 | Embedded Monaco Code Editor | Jump directly from graph nodes, member lists, or relationship links to precise source code lines with full Java syntax highlighting. | Monaco Editor 0.45 + REST file reader/writer |
| 15 | Reports Hub & Compliance Audits | 14 comprehensive enterprise reports (Change Risk, Circular Dependencies, Dead Code, API Surface, Database Access Flow, Concurrency Audit, Module Coupling, etc.) with 60+ pre-rendered artifacts. | ReportService + REST export endpoints + Standalone HTML templates |
| 16 | Modular Two-JAR Distribution | Lightweight codelens-app.jar (~1.1 MB) referencing pre-extracted codelens-deps.jar (~22 MB) for ~4-second fast rebuilds and seamless enterprise distribution. |
Maven Shade + Class-Path manifest isolation |
| 17 | 125k Classes Scalability Engine | Multi-tier quotient graph rollups, Level-of-Detail (LOD) sub-pixel culling in Treemap/Sunburst/Chord/Graphify, and Sparse DSM matrix grids maintaining sub-100ms API response and 60 FPS UI rendering. | SQL-level aggregation queries + Viewport culling + Sparse DSM payload |
| 18 | Storage Compression & Compaction | LZF compressed H2 page storage with single-transaction chunk commits and MVStore tuning, eliminating leaks and reducing disk footprints by ~95%. | H2 MVStore Compression + HikariCP Transaction Safety |
| 19 | 11-Engine Background Task Manager | Real-time monitoring and lifecycle controls over 11 background engines (AST Ingestion, Delta Watcher, Call Graph, Layout Engine, Module Coupling, Lucene Indexer, Git Churn, DB Sentinel, Stress Tester, Heap Watchdog, and Reports Precomputer). | Dedicated Process Hub + JMX Thresholds + REST lifecycle APIs |
| 20 | 8-Stage Scan & Readiness Engine | Rigorous sequential scan execution (PARSE, INDEX, GRAPH, LAYOUT, MODULES, INTEGRITY, CODESTORY, REPORTS) guaranteeing 100% readiness across all views. |
Sequential orchestrator + Dynamic SSE telemetry |
codelens/
βββ codelens-core/ Domain entities (CodeType, CodeMethod, CodeField, CodeRelationship, GitMeta, etc.)
βββ codelens-parser/ JavaParser AST visitor, directory scanner, incremental delta detector
βββ codelens-analysis/ In-memory call graph BFS, multi-hop field propagation, and 32-rule code reviewer
βββ codelens-storage/ H2 database lifecycle, connection pooling (HikariCP), LZF compaction, Lucene indexer
βββ codelens-git/ JGit repository locator, blame annotator, commit history extractor
βββ codelens-api/ Javalin REST controller, file APIs, scan orchestration, shutdown handler
βββ codelens-web/ Zero-build SPA (HTML5, Vanilla CSS design tokens, Canvas 2D Verlet physics, Three.js, Monaco)
βββ codelens-app/ Fat-JAR bootstrap and entry point (Application.java)
βββ sample-project/ Realistic 5-class algorithmic trading system for demonstration and tests
CodeLens architecture, scanning pipelines, and lifecycles are formally modeled and compiled via Archify:
- π System Architecture: Interactive HTML View | Spec
- π Ingestion Workflow: Interactive HTML View | Spec
- β‘ Execution Sequence: Interactive HTML View | Spec
- π Data Flow Pipeline: Interactive HTML View | Spec
- β±οΈ Server & Ingestion Lifecycle: Interactive HTML View | Spec
See PROJECT_CONTEXT.md for full architectural blueprints, diagrams, and domain modeling.
- AST Parsing (JavaParser 3.25.8): Full Java 17 record, sealed class, and pattern-matching support without needing heavy bytecode compilation, maven builds, or runtime classpath dependencies.
- Data Layer (H2 2.2.224 + Lucene 9.10.0): Zero-setup file-based persistence for SQL relations combined with Apache Lucene for sub-millisecond full-text entity search.
-
High-Speed Bulk Ingestion: Disables and drops secondary B-tree indexes during full scans to maintain
$O(1)$ batch insertion speeds regardless of existing table size, rebuilding indexes and runningANALYZEupon scan completion. - Graph Visualisation (Custom HTML5 Canvas 2D): Fully offline force-directed physics engine using Verlet integration. Zero D3 or external JS bundle overhead.
- 3D Visualizations (Three.js r128): Self-contained WebGL shaders and post-processing bloom/vignette passes for 3D City and 3D Galaxy views.
- HTTP Layer (Javalin 6.1.3 + Jetty 11): Lightweight microframework delivering ultra-fast REST endpoints and static asset serving with embedded WebSockets.
- Target Machine OS: macOS (Intel / Apple Silicon), Linux (Ubuntu, Debian, RHEL, CentOS, Arch), or Windows 10/11
- Java Runtime Environment: JRE / JDK 17+ (
java -version)- macOS:
brew install openjdk@17 - Ubuntu / Debian:
sudo apt install openjdk-17-jre-headless - RHEL / Fedora:
sudo dnf install java-17-openjdk - Windows: Download from Eclipse Temurin
- macOS:
Note
Zero Admin Rights Required (100% User-Space Execution)
- CodeLens never requires Administrator /
sudo/rootpermissions. -
Unprivileged Port: Runs by default on port
7878(any port$>1024$ can be bound without admin privileges). -
Local Data Directory: Writes its embedded H2 database and Lucene index strictly to the local directory (
./codelens-dataor~/.codelens-data) without touching system directories (C:\Program Files,/var,/etc). -
Portable JRE (No installer needed): If you cannot install Java on a locked-down corporate Windows machine, simply extract a
.zipbuild of Eclipse Temurin 17 JRE into any user folder (e.g.C:\Users\You\jre17) and runC:\Users\You\jre17\bin\java.exe -jar codelens.jar.
From the project root:
./mvnw clean package -DskipTestsThis generates an optimized Two-JAR Modular Architecture:
codelens-app/target/codelens-app.jar(~1.1 MB): Contains all application logic, REST endpoints, analysis engines, and web resources. Daily feature updates compile in ~3-4 seconds.codelens-app/target/codelens-deps.jar(~22 MB): Pre-packaged external dependencies (Javalin, Jetty, Jackson, Lucene, JGit, JavaParser, H2, HikariCP, JGraphT). Referenced automatically viaClass-Path: codelens-deps.jar.
java -jar codelens-app/target/codelens-app.jarOnce launched, open your web browser at: http://localhost:7878
# Custom HTTP Port
java -Dcodelens.port=9090 -jar codelens-app/target/codelens-app.jar
# Custom Data & Index Directory
java -Dcodelens.data=/custom/path/codelens-data -jar codelens-app/target/codelens-app.jar
# Production Memory Allocation (for 30k+ file projects)
java -Xms1g -Xmx4g -XX:+UseG1GC -jar codelens-app/target/codelens-app.jarCodeLens can run completely headless from your terminal or CI/CD pipelines without starting the web UI. All subcommands read directly from the embedded H2 database and Lucene index:
# 1. Full Ingestion & Indexing
java -jar codelens-app/target/codelens-app.jar scan ./path/to/java/src
# 2. Transaction Storyline Extraction
java -jar codelens-app/target/codelens-app.jar story [storyId]
# 3. Method Call Trace (Entry Point to Sinks)
java -jar codelens-app/target/codelens-app.jar trace "com.example.OrderController.submitOrder"
# 4. Blast Radius & Field Mutation Impact
java -jar codelens-app/target/codelens-app.jar impact "com.example.Account.balance"
java -jar codelens-app/target/codelens-app.jar what-if "com.example.PaymentService.charge"
# 5. Grounded AI Architecture Assistant
java -jar codelens-app/target/codelens-app.jar ask "Where are payments persisted in this codebase?"
# 6. Entity Purpose & Role Narrative Explanation
java -jar codelens-app/target/codelens-app.jar explain "com.example.OrderService"
# 7. Guided Onboarding Tour (Layers L1-L5)
java -jar codelens-app/target/codelens-app.jar teach-me
# 8. Git Pull Request Change Story Generator
java -jar codelens-app/target/codelens-app.jar pr-story main feature/billing-v2CodeLens offers two distribution options:
- Build the JARs on your development machine:
./mvnw clean package -DskipTests
- Copy the JAR pair:
Copy both
codelens-app.jar(1.1 MB) andcodelens-deps.jar(22 MB) into your deployment directory:Subsequent code updates only require transferring the tinyscp codelens-app/target/codelens-app.jar codelens-app/target/codelens-deps.jar user@remote-machine:/opt/codelens/
codelens-app.jar(1.1 MB)! - Run on target machine (requires Java 17+):
cd /opt/codelens && java -jar codelens-app.jar
- Access
http://localhost:7878in any browser.
If shipping the source repository (or cloning via Git):
- Clone repository:
git clone <repo-url> codelens cd codelens
- Build using the embedded Maven Wrapper (no Maven installation required):
# On macOS / Linux ./mvnw clean package -DskipTests # On Windows PowerShell .\mvnw.cmd clean package -DskipTests
- Run:
java -jar codelens-app/target/codelens-app.jar
To run CodeLens inside an isolated container:
- Build Docker Image:
docker build -t codelens:1.0.0 . - Run container mounting your local source folder and persistent data volume:
docker run -d \ --name codelens \ -p 7878:7878 \ -v codelens_data:/app/data \ -v /path/to/your/java/code:/sources:ro \ codelens:1.0.0
- Scan the mounted code in the web UI by entering
/sourcesas the source path.
To run CodeLens as a background system daemon on Linux servers:
- Copy
codelens-app.jarandcodelens-deps.jarto/opt/codelens/. - Create
/etc/systemd/system/codelens.service:[Unit] Description=CodeLens Java Intelligence Platform After=network.target [Service] Type=simple User=codelens WorkingDirectory=/opt/codelens ExecStart=/usr/bin/java -Xms1g -Xmx4g -XX:+UseG1GC -Dcodelens.port=7878 -Dcodelens.data=/var/lib/codelens -jar /opt/codelens/codelens-app.jar Restart=always RestartSec=5 [Install] WantedBy=multi-user.target
- Enable and start the service:
sudo systemctl daemon-reload sudo systemctl enable --now codelens sudo systemctl status codelens
To run CodeLens automatically at login in the background on macOS:
- Place the JAR at
~/Applications/CodeLens/codelens.jar. - Create
~/Library/LaunchAgents/com.codelens.server.plist:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.codelens.server</string> <key>ProgramArguments</key> <array> <string>/usr/bin/java</string> <string>-Xms512m</string> <string>-Xmx2g</string> <string>-jar</string> <string>/Users/yourusername/Applications/CodeLens/codelens.jar</string> </array> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> <key>StandardOutPath</key> <string>/tmp/codelens.log</string> <key>StandardErrorPath</key> <string>/tmp/codelens-err.log</string> </dict> </plist>
- Load the daemon:
launchctl load ~/Library/LaunchAgents/com.codelens.server.plist
For massive multi-module enterprise monorepos (e.g. 50,000 to 125,000 .java files):
java -Xms2g -Xmx6g \
-XX:+UseG1GC \
-XX:G1ReservePercent=15 \
-XX:InitiatingHeapOccupancyPercent=45 \
-Dcodelens.port=7878 \
-jar codelens.jarCodeLens features a portable, human-readable configuration file format (codelens.conf) that encapsulates deployment settings, UI defaults, physics tuning, static analysis thresholds, POJO filtering, and custom domain archetypes.
When starting up, CodeLens automatically looks for configuration in:
-Dcodelens.config=/path/to/codelens.conf(System property override)--config /path/to/codelens.conf(CLI argument)./codelens.conf(Current working directory)./codelens-data/codelens.conf(Data directory fallback)
# ββ Server & Storage ββ
server.port=7878
storage.dataDir=./codelens-data
scan.defaultPath=./src/main/java
scan.excludePatterns=build, target, dist, .git, .gradle, node_modules
# ββ UI & Appearance ββ
ui.theme=dark # dark | light
ui.packageMode=auto # auto | flatten | nested
ui.defaultTab=graph # graph | knowledge | review | git | source | codebase
ui.tabOrder=["graph","knowledge","review","git","source"]
# ββ Graph Physics & Visuals ββ
graph.nodeBaseRadius=18 # Base node radius in px
graph.repulsion=420 # Verlet repulsion force
graph.springLen=120 # Link distance
graph.damping=0.85 # Velocity damping
graph.showParticles=true # Animated call-flow particles
graph.showMinimap=true # Bottom-right radar minimap
graph.showLabels=true # Entity text labels
graph.showGrid=true # Cyber-grid canvas backdrop
graph.showHulls=true # Package / Community convex hulls
graph.defaultDepth=3 # Initial traversal hop depth (1β15 / Max)
graph.autoFit=true # Auto-center and fit on load
# ββ Macro 3D & 2D Studio ββ
macro.defaultLevel=city3d # city3d | galaxy3d | treemap | sunburst | dsm | chord
macro.defaultGranularity=arch # arch | methods
macro.brightness=1.0 # Scene illumination
macro.showArcs=true # Three.js 3D bezier call arcs
# ββ Code Review Thresholds ββ
review.cyclomaticComplexityThreshold=15 # Flag methods with CC > 15
review.cognitiveComplexityThreshold=15 # Flag methods with cognitive complexity > 15
review.methodLinesThreshold=50 # Flag methods longer than 50 lines
review.classLinesThreshold=500 # Flag classes longer than 500 lines
review.parameterCountThreshold=6 # Flag methods with > 6 parameters
# ββ POJO Classification ββ
pojo.includeStandardAccessors=true # Filter get*, set*, is*, has*
pojo.customPatterns=get*, set*, is*, has*, with*, toString, hashCode, equals
# ββ Custom Archetype Rules (JSON array) ββ
archetypes.rulesJson=[{"id":"rule-bancs-bt","target":"METHOD","pattern":"{MODULE}BT",...}]Tip
Export & Import via Web UI: You can also view, modify, and download codelens.conf or import external configurations directly through the Settings Modal (β Settings in the top header).
CodeLens supports two intelligent scanning modes tailored for initial onboarding vs active development:
- Use Case: First-time repository indexing, major branch switches, or clean rebuilds.
-
Granular 8-Stage Sequential Pipeline:
-
PARSE(2β70%): High-speed parallel AST parsing, type hierarchy extraction, method/field discovery, and batch chunk insertion. -
INDEX(70β76%): Apache Lucene full-text symbol search commit and secondary relational B-tree index rebuild. -
GRAPH(76β82%): In-memory JGraphT call graph vertex indexing and bidirectional call edge resolution, followed by field mutation propagation indexing. -
LAYOUT(82β86%): Sequential precomputation and caching of all 6 sunflower spiral and 3D architectural layouts (ensures zero rendering freeze when opening graph views). -
MODULES(86β90%): Package architecture, afferent/efferent couplings, and Robert C. Martin's instability ratings ($I = C_e / (C_a + C_e)$). -
INTEGRITY(90β93%): Class-aware structural inconsistency detection & integrity audit (14 active rules, AST signature drift, naming divergences). -
CODESTORY(93β96%): Business transaction storylines discovery from controllers to persistent DB sinks, 5-layer guided onboarding tour synthesis, and critical path targets. -
REPORTS(96β99%): Sequential precomputation of all 14 enterprise architecture, debt, quality, and risk snapshots.
-
COMPLETE(100%): 100% readiness across all views, tabs, and interactive engines.
-
- Use Case: Day-to-day development after editing, pulling Git changes, or creating new classes.
- Sequential Pipeline:
- Compares disk file modification timestamps and sizes against indexed metadata via
GET /api/scan/changes. - Identifies exact sets of New, Modified, and Deleted files.
- Purges database records only for changed/deleted files via
deleteBySourceFiles(...). - Parses delta files and merges them using idempotent
MERGE INTO ... KEY(id). - Runs the exact same sequential 8-stage pipeline (Index, Topology, Layouts, Modules, Integrity, CodeStory, Reports) to guarantee 100% readiness across all features.
- Compares disk file modification timestamps and sizes against indexed metadata via
# Trigger an incremental delta rescan via cURL
curl -X POST http://localhost:7878/api/scan/incremental \
-H 'Content-Type: application/json' \
-d '{
"sourcePath": "/path/to/project",
"excludePatterns": ["target", "build", ".mvn", ".git"]
}'CodeLens features a fully non-blocking scan workflow designed so analysts never have to wait idly on a modal screen:
- Dismiss at Any Point: Minimize the central scan modal at any time using the top-right
βbutton, the "Run in Background" button, clicking the backdrop, or pressingEscape. - Live Background Progress:
- Top-Bar Status Badge & Header Progress Bar: Displays live progress percentage (e.g.
94%), animated spinner, and linear gradient fill. - Bottom-Left Footer Status Indicator: Displays the active phase with color-coded status pills (
footer-scan-pill-integrity,footer-scan-pill-codestory, etc.) and real-time step details.
- Top-Bar Status Badge & Header Progress Bar: Displays live progress percentage (e.g.
- Instant Reopen & Post-Scan Navigation:
- Click either the top-bar badge, the header progress bar, or the bottom-left footer status text to bring back the detailed scan dialog at any point.
- Upon completion, the modal provides two dedicated exploration buttons:
π Explore CodeStory: Navigates directly to the interactive Storylines tab.βΆ Explore Graph: Navigates directly to the 2D Graphify Canvas.
As each pipeline step completes, corresponding navigation tabs and analytical modules unlock dynamically without waiting for the entire deep analysis run to finish:
- Stage 1 (
PARSEcomplete): Source Code and Git Analytics unlock immediately so code can be inspected and blame examined. - Stage 2 (
INDEXcomplete): Knowledge Base Catalog, On-Demand Code Review, and Global Full-Text Search unlock. - Stage 3 (
GRAPHcomplete): Call Hierarchy BFS unlocks. - Stage 4 (
LAYOUTcomplete): Interactive 2D Graph and 3D Macro Studio (City & Galaxy) unlock with precomputed sunflower coordinates for immediate 60 FPS rendering. - Stage 5 (
MODULEScomplete): Macro Architecture Studio and Module Coupling Matrices unlock. - Stage 6 (
INTEGRITYcomplete): Structural Integrity & Inconsistency Audits unlock. - Stage 7 (
CODESTORYcomplete): CodeStory Narratives, Storyline Player, and Guided Onboarding Tour unlock. - Stage 8 (
REPORTScomplete): All 14 Intelligence Reports unlock. - Feedback on Locked Features: Clicking any pending tab displays an informational banner stating the exact analysis stage needed for activation.
If a scan was started with an incorrect path or exclude pattern, you can cancel it immediately without corrupting data or leaking database connections:
- Click the Cancel Scan button on the scan modal or floating progress bar.
- Or issue
POST /api/scan/cancel. - The scanner thread safely halts at the current chunk boundary, cleans up active transactions, and restores the UI to idle state.
Configure directory names or globs to ignore non-essential files. Set these via the UI β Settings modal or API:
Default Exclusions:
target, build, .mvn, .git, .gradle, node_modules, bin, out, **/test/**, *Test.java, */generated-sources/*
- Graceful Shutdown: Click Shutdown Server in the β Settings modal or POST to
/api/shutdown. CodeLens cleanly flushes Lucene index writers, commits database transactions, closes HikariCP pools, and exits the process. - Interrupted Scan Recovery: If the server process was terminated abruptly (e.g. system reboot or power outage) while a scan was active, CodeLens automatically detects the interrupted state on restart, marks the scan status as
INTERRUPTED, and provides a one-click Resume Rescan button on the landing page.
CodeLens automatically discovers common namespace roots (e.g. com.company.project.) across all scanned packages and cleans them into human-readable module clusters (e.g. trading.risk β Trading βΊ Risk) without requiring manual prefix configuration. Choose your preferred label style anytime in β Settings:
- Auto-Detect & Clean (Recommended): Groups under smart module roots.
- Abbreviated (
c.e.trading): Compact IDE-style package notation. - Full Qualified Name (FQN): Complete raw Java package strings.
CodeLens provides fine-grained, interactive boundary management so engineers can eliminate external mocks, generated DTOs, or legacy boilerplate from their architectural intelligence:
- Quick Hover Exclude: Hover over any class, interface, enum, record, or package in the Left Explorer tree to reveal the red
Γexclusion trigger. - Right-Click Context Menu: Right-click any entity or package to trigger a dedicated context menu with actions: Exclude Class / Package from Scope, Inspect Entity, and Copy FQN.
- Cascading Purge: When an entity or package is excluded, CodeLens atomically:
- Persists the exclusion rule into the embedded H2
EXCLUDED_SCOPEtable. - Recursively cascades deletions across types, methods, fields, and relationships.
- Purges corresponding documents from the Apache Lucene search index.
- Prunes graph vertices/edges from in-memory Call Graphs, DSM matrices, and Reports.
- Persists the exclusion rule into the embedded H2
- Dedicated Scope Manager Dialog: Click the
π― Scope (N)button in the Left Explorer header to inspect all active exclusions. - Instant Restoration: Restore individual classes or packages with one click (or "Restore All"), automatically re-indexing them into the active graph and database without needing a full rescan.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ⬑ CodeLens [ /path/to/source/dir ] [ Browseβ¦ ] [ Scan βΌ ] [ 3D Studio ] [ Reports Hub ] [ β ] [ β ]β
β [ 124 types ] [ 890 methods ] [ 430 fields ] [ 2,140 rels ] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Source Path Input: Accepts absolute filesystem paths to Java source trees.
- Browse⦠Button: Native directory chooser with automatic Git repository discovery.
- Scan / Rescan Dropdown: One-click triggers for Full Scan and Incremental Delta Scan.
- 3D Studio Button (M): Opens the dedicated Macro 3D Codebase Studio featuring 3D Software City and 3D Star Galaxy.
- Reports Hub Button (R): Opens the comprehensive compliance & quality reports hub with 11 downloadable reports.
- β Settings Modal: Configure Dark/Light themes, exclusion patterns, package display modes, physics parameters, archetype rules, and graceful server shutdown.
- β User Guide Button (?): Opens the interactive 5-tab in-app Feature & User Guide.
- Realtime Entity Counters: Instant counts for Types, Methods, Fields, and Relationships.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β Search classes, methods, fieldsβ¦ (βK) β
β [ All ] [ Class ] [ Iface ] [ Enum ] [ Record ] β
β Explorer [ π― Scope (2) ] [ Collapse ]β
β βΎ com.example.trading [Γ]β
β π· Portfolio [Γ]β
β π· TradeProcessor [Γ]β
β π· RiskEngine [Γ]β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Lucene Search (
βK/Ctrl+K): Sub-millisecond indexed search across all classes, interfaces, enums, records, methods, fields, and signatures. - Kind Filter Chips: Filter the explorer tree to display only Classes, Interfaces, Enums, or Records.
- Scope Manager Button (
π― Scope (N)): View and restore excluded classes and packages. - Hover & Context Menu Exclusion: Click
Γor right-click any item to prune out-of-scope boundaries. - Collapsible Package Tree: Full package hierarchy with instant member navigation.
CodeLens organizes primary codebase intelligence into 5 dedicated workspace screens, accompanied by top-level 3D Studio and Reports Hub:
- Verlet Physics Simulation: Real-time multi-body force simulation calculating Coulomb repulsion, Hooke spring tension, package clustering, and anti-collision.
-
Convex Hull Clustering (
β Clusters): Visualizes architectural modules as colored translucent hulls. -
Behavioral Hotspots Heat Mode (
β¨ Heat/ H): Overlays thermal shaders on nodes based on composite risk$CC \times \log_2(1 + \text{churn}) \times \log_{10}(LOC)$ . - BFS Depth Controls (1β15 hops / Max): Explore transitive callers and callee dependencies.
-
Camera Controls: Auto-fit (F), Zoom In/Out (
+/-), Reset Zoom (0), and Freeze Physics (Space).
- Complete tabular catalog of all scanned types, member variables, and methods.
- Computes Cyclomatic Complexity (CC) scores for every method with color health badges:
- π’ Low Complexity (1β4): Clean, straightforward execution path.
- π‘ Moderate Complexity (5β10): Branching logic requiring thorough unit tests.
- π΄ High Complexity (11+): Heavy nesting; prime candidate for refactoring.
- Filtering by visibility (Public, Protected, Package-private, Private) and archetype roles.
32 deep AST static analysis rules across 6 critical quality categories:
- Correctness: Null pointer hazards, unclosed streams, switch fallthroughs, array reference leaks.
- Concurrency: Non-atomic shared state mutation, unsynchronized collections in multithreaded classes.
-
Exception Safety: Swallowed exceptions, catching
Throwable, throwing raw runtime exceptions. -
Code Smells: God classes, long parameter lists (
$>5$ ), high cyclomatic complexity ($>15$ ). -
API Contracts: Missing interface contracts, broken
equals/hashCodesymmetry. - Architectural Blast Radius: Core utility methods with extreme upstream caller fan-in.
- Top Authors Leaderboard: Contribution metrics, entities touched, and recent commit dates.
- Hot Churn Entities: Ranked bar chart of highest-churn classes and methods.
- Blame Annotations: Detailed author breakdown and last modified timestamps per entity.
- Embedded Microsoft Monaco editor (VS Code engine).
- Jump directly to exact line numbers from graph nodes, member lists, or code review findings.
- Full syntax highlighting, breadcrumb navigation, and in-place editing back to disk.
Accessible anytime via the 3D Studio header button (M) or Visualizations menu:
- ποΈ 3D Software City: Interactive Three.js WebGL urban layout mapping packages to city blocks, classes to skyscrapers, LOC to building height, and complexity or churn to roof colors. Includes Bloom post-processing, camera fly-throughs, and Thermal Heat Mode.
- π 3D Galaxy: Orbital gravitational star system rendering classes as stars orbiting central module suns.
- π Interactive Dependency Structure Matrix (DSM):
- Multi-tier dependency grid (
Modules$\to$ Packages$\to$ Classes$\to$ Methods). - Method-Level Drilldown: Double-click any class header to inspect precise method call invocations, complete with breadcrumb navigation.
- DAG Acyclicity Rating: Calculates strict acyclic ordering and highlights cyclic dependencies in red.
- Adjacency Exports: Download DSM data as CSV or structured JSON.
- Multi-tier dependency grid (
- πΊοΈ Treemap & Sunburst: Hierarchical area partitioners with sub-pixel Level-of-Detail (LOD) culling.
- β Chord Diagram: Radial flows visualizing cross-package coupling.
Click the Reports Hub button in the header (R) to access 11 enterprise architectural and quality reports:
- Change Risk Analysis: Combines blast radius and historical churn into a compound refactoring risk score.
- Circular Dependencies: Identifies recursive call loops and package dependency cycles using Tarjan's strongly connected components algorithm.
- Dead Code & Unused Methods: Detects unreferenced private methods and orphan classes with 0 incoming callers.
- API Surface & Exposure: Inventories public API contracts, exposed interfaces, and external boundaries.
-
Behavioral Hotspots: Quantifies technical debt via
$CC \times \log_2(1 + \text{churn}) \times \log_{10}(LOC)$ . - God Classes & Bloat: Identifies monolithic classes exceeding LOC, field, and method thresholds.
-
Coupling & Cohesion: Analyzes Afferent (
$C_a$ ) and Efferent ($C_e$ ) coupling and Martin instability metrics. - Security & Vulnerability Audit: Surfaces OWASP-relevant patterns (unvalidated input flows, raw SQL concatenation).
- Inheritance Depth: Analyzes deep inheritance hierarchies and class coupling.
-
Exception Flow: Identifies unhandled, swallowed, or broad
catch (Throwable)blocks. - Comprehensive Executive Summary: High-level code health score, aggregate metrics, and prioritized remediation actions.
All reports offer 1-click export to CSV, Standalone Interactive HTML, and Markdown.
- Metadata Card: Displays modifiers, inheritance, implemented interfaces, lines, and Git history.
- Action Triggers:
β¬ Callers: Visualizes upstream callers in the Graph view.β¬ Callees: Visualizes downstream dependencies in the Graph view.β‘ Impact (Direct): Shows immediate readers, writers, and propagators for a field.π Propagation Chain: Traces repository-wide upstream triggers of field mutations.
- Free-text markdown notes attached to any class, interface, method, or field.
- Persisted locally in the H2 database and included in exported reports.
CodeLens automatically precomputes a comprehensive suite of 14 deep architectural, risk, persistence, coupling, and concurrency reports, generating 60+ pre-rendered artifacts in CSV, standalone HTML, Markdown, and JSON stored in ./codelens-data/graph-cache/reports/:
| # | Report Key | Report Title | Focus & Primary Indicators |
|---|---|---|---|
| 1 | architecture |
Architecture & Coupling Report | Robert C. Martin's Package Coupling ( |
| 2 | change-risk |
Change Risk & Blast Radius Matrix | Behavioral Hotspots ( |
| 3 | dead-code |
Dead Code & Reachability Analysis | Private & package-private methods with 0 incoming call edges and orphan subsystems |
| 4 | circular-dependencies |
Circular Dependencies & Tangling | Tarjan strongly connected components / cycles at package and class level |
| 5 | archetype-governance |
Enterprise Archetype Governance | Architectural layer compliance (Controllers |
| 6 | technical-debt |
Technical Debt & SQALE Remediation ROI | SQALE remediation hours, debt ratio, and prioritized refactoring opportunities |
| 7 | executive-summary |
Executive Architectural Scorecard | Unified architectural health grade (AβF) across 5 core dimensional indices |
| 8 | review |
Code Quality & Security Audit | Consolidated list of all 32 AST static rule findings with precise file and line numbers |
| 9 | metrics |
Codebase Inventory & Metrics Census | Comprehensive breakdown of packages, classes, methods, fields, and LOC distributions |
| 10 | api-catalog |
API Surface & REST Endpoint Catalog | REST routes, HTTP verbs (GET, POST, PUT, DELETE), controllers, auth checks, and blast radius |
| 11 | database-access |
Database & Data Access Flow | Persistence integrity score, DAO access points, CRUD distribution, and target tables touched |
| 12 | concurrency-audit |
Concurrency & Thread Safety Audit | Thread safety score/grade, synchronized locks, volatile fields, and mutable shared collections |
| 13 | module-coupling |
Inter-Module Dependency & Stability | Cross-module caller-callee couplings, stability indices, and dependency violation warnings |
| 14 | html-snapshot |
Standalone Offline HTML Snapshot | Bundled single-file offline interactive HTML snapshot for offline review and air-gapped sharing |
Reports precomputation runs in a strict sequential runner (1 through 13) with per-report error isolation, individual execution duration tracking, and formatted ASCII logging banners in the server console:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CODELENS BACKGROUND PROCESS REPORT_BUILD_STARTED β
β Process: [10/13] API Surface & REST Endpoint Catalog β
β Target: api-catalog β
β Details: Computing analysis model and rendering artifacts β
β Timestamp: 2026-10-01 22:19:04.066 Memory: 185MB / 512MB β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
...
[REPORT 10/13] COMPLETED API Surface & REST Endpoint Catalog in 17 ms
Accessible via the top-bar Tasks button or GET /api/processes, the Background Tasks & Process Manager provides real-time telemetry and lifecycle management across all 11 asynchronous engines:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CODELENS BACKGROUND TASK PROCESS HUB β
βββββββββββββββββββββββ¬ββββββββββββββββββββ¬βββββββββββββββ¬ββββββββββββββββ€
β Process ID β Subsystem Name β Role β Control β
βββββββββββββββββββββββΌββββββββββββββββββββΌβββββββββββββββΌββββββββββββββββ€
β scanner β Source Scanner β Parallel AST β [Restart] β
β delta-scanner β Delta Scanner β File Watcher β [Scan Delta] β
β call-graph β Call Graph Engine β JGraphT Topo β [Rebuild] β
β layout-engine β Layout Engine β Sunflower 2D β [Precompute] β
β module-analyzer β Module Touchpoint β Cross-Module β [Recompute] β
β lucene-indexer β Lucene Indexer β Text Search β [Re-index] β
β git-analyzer β Git Churn Engine β JGit Logs β [Analyze] β
β db-watchdog β DB Pool Sentinel β Leak Guard β [Check Health]β
β stress-test β Stress Tester β Benchmarks β [Run Test] β
β heap-watchdog β Memory Sentinel β OOM Sentinel β [Force GC] β
β reports-generator β Reports Generator β 13 Reports β [Regenerate] β
βββββββββββββββββββββββ΄ββββββββββββββββββββ΄βββββββββββββββ΄ββββββββββββββββ
- Live Telemetry: Real-time status (
ACTIVE,IDLE,COMPLETE), active stage, progress percentage, and throughput metrics (e.g.Heap: 142 MB / 512 MB (28%),320 files/sec). - Lifecycle Endpoints: Individual processes can be restarted via
POST /api/processes/:id/restartor cooperatively canceled viaPOST /api/processes/:id/kill. - Memory Sentinel & Circuit Breaker: JMX threshold monitoring and background watchdog that evicts caches at 85% heap usage and trips a circuit breaker at 92% to prevent
OutOfMemoryError.
In large enterprise codebases, critical domain entities (such as Accounts, Loans, Deposits, and Trades) are manipulated through intricate, multi-layered service workflows. Critical Path Analysis automates the end-to-end discovery and interactive visualization of these vital execution sequences.
flowchart LR
Entry["β‘ Entry Point\ne.g. AMBTAccountOpen"] --> Service["Domain Service\ne.g. AccountService"]
Service --> Task["Own / Common Task\ne.g. AMTOVerifyStatus\nAMTCVerifyKYC"]
Task --> Entity["πΎ Persistent Target\ne.g. Account.Modify()"]
Entity --> Sink["π‘οΈ Downstream Sink\ne.g. AuditTrailService.log()"]
CodeLens scans all indexed classes to identify persistent domain entities using:
- The Persistent Contract Triplet: Classes containing
Get(),Create(), andModify()methods. - Persistent Conventions: Classes matching configured prefix patterns (e.g.
PC_*) or enterprise entity annotations (@Entity,@Table). - Strict DTO Separation: Message Objects (
MO_INP_*,MO_OUT_*,MO_*) are strictly categorized as transfer payloads and excluded from being falsely identified as persistent database entities. - Architectural Lifecycle Exemption: Persistence methods
Get(...),Create(), andModify(...)are explicitly shielded from POJO accessor classification, guaranteeing that hydrated entity reads are never misidentified as trivial getters. - Critical Path Filter Immunity: When a Critical Path is active, every node along the execution chain (
ENTRY_POINT,PERSISTENT_TARGET,DOWNSTREAM_SINK,INTERMEDIARY) is granted absolute immunity against POJO suppression, package legend toggling, archetype filtering, and canvas orphan pruning.
When a critical path is loaded, CodeLens presents a non-intrusive floating Stepper Dock docked along the bottom of the canvas:
- Chronological Flow Cards: Each hop along the execution path is rendered as a distinct card with its execution sequence step number, archetype badge, method name, and cyclomatic complexity (CC).
- Synchronized Visual Focus: Clicking any step card (or navigating via the
βΉPrev /βΊNext buttons) smoothly centers and zooms the 2D canvas on that method, highlights incident edges, and pulses execution flow particles with vertical headroom above the bottom dock. - Bidirectional Canvas Interaction: Clicking on any node in the graph automatically highlights and centers its corresponding step card in the stepper dock without destroying the active path topology.
- Collapsible Layout: Click the Collapse button to minimize the dock into a slim 34px status bar, granting a 100% unobstructed view of the graph canvas while retaining step navigation controls.
- Graph State Restoration: Closing the dock or pressing
Escapeinstantly restores the user's prior canvas state and call graph mode.
CodeLens computes multiple candidate execution paths for every persistent class, switchable with zero latency:
| Mode | Path Focus | Description |
|---|---|---|
| Primary | Highest Impact | Top-ranked overall transactional path combining caller depth, complexity, and downstream audit. |
| Mutation | Write & State Change | Focuses strictly on execution sequences leading to entity creation or modification (Create, Modify, {MODULE}BT). |
| Read | Query & Hydration | Read-only inquiry path retrieving entity state (Get, {MODULE}ET, {MODULE}DG). |
| Longest | Deepest Propagation | The longest call chain from an external boundary entry point down to persistence. |
| Max CC | Peak Business Complexity | Traverses methods accumulating the highest cumulative Cyclomatic Complexity ( |
The Stepper Dock header displays real-time telemetry:
- Hops: Number of intermediate method calls along the sequence.
-
$\Sigma$ CC: Cumulative cyclomatic complexity across all methods in the path. - Risk Score: Weighted impact score factoring complexity, mutation types, and audit sinks.
-
Bottlenecks: Automatic flagging of methods with excessive branching (
$CC > 8$ ).
CodeLens elevates traditional graph visualization into an interactive storytelling platform. Rather than navigating an overwhelming hairball of hundreds of thousands of disconnected AST nodes, engineers can explore the codebase as sequential, human-readable transaction storylines.
flowchart LR
subgraph L1["Layer 1: Entry Point"]
Ctrl["REST Controller / Endpoint\ne.g. OrderController.placeOrder()"]
end
subgraph L2["Layer 2: Domain Workflows"]
Svc["Domain Services & Policies\ne.g. PricingEngine.calculate()"]
end
subgraph L3["Layer 3: Mutation Sinks"]
Repo["Database Mutation Target\ne.g. OrderRepository.save()"]
end
subgraph L4["Layer 4: Audit & Events"]
Audit["Downstream Sinks & Events\ne.g. AuditLog.record(), EventBus"]
end
Ctrl --> Svc
Svc --> Repo
Repo --> Audit
- Automated Workflow Synthesis: Scans entry points (
@RestController,@PostMapping,@GetMapping, message consumers) and traces all reachable execution paths down to persistent entities and downstream mutation sinks. - Natural Language Explanations: Translates multi-hop call hierarchies into plain-English narrative summaries explaining the business intent, roles, and potential failure points of the transaction.
- Storyline Player & Stepper Dock:
- Interactive sequence cards showing method names, archetype badges, source line citations, and execution sequence numbers.
- One-click step navigation (
βΉPrevious /βΊNext) that centers and pulses the canvas with particle flow tracers. - Step details show exact input parameters, return types, field mutations, and downstream blast radius.
Designed to take new developers from zero to architectural mastery in minutes, the Teach Me tour organizes repository exploration into 5 progressive layers:
- Layer 1: Domain Core & Entities: Core persistent entities, aggregates, and data models defining the business domain.
- Layer 2: Ingestion & Storage Architecture: Database access objects, repository interfaces, and data persistence contracts.
- Layer 3: Topology & Call Graphs: High-traffic service orchestrators, task executors, and inter-module communication channels.
- Layer 4: Semantic Storylines: Primary user journeys and critical transactions from external API boundaries to database commits.
- Layer 5: Intelligence & Risk Hotspots: Behavioral hotspots, circular dependency hubs, and prioritized technical debt areas.
Each stop on the tour includes a comprehensive explanation, file/line links to the source code in Monaco, and direct visualization in the Graph.
Compare any branch or pull request against a base reference (main or release):
- Summarizes the structural impact of changes instead of just line-by-line diffs.
- Identifies newly added entry points, modified persistent entity contracts, and widened blast radiuses.
- Generates a ready-to-paste Markdown PR architectural summary for code reviews.
CodeLens includes a context-grounded AI conversational assistant accessible via the web drawer or CLI (codelens-app.jar ask "<question>"):
- Local Ollama Integration: Fully air-gapped support for local LLMs (DeepSeek-Coder, Llama 3, Qwen 2.5 Coder) running via Ollama (
http://localhost:11434). - OpenAI Compatible: Connects to OpenAI or any OpenAI-compatible API endpoint with custom API keys and model selections.
- Deterministic Template Fallback: When no LLM is configured or available, CodeLens automatically falls back to an internal deterministic template engine that answers architectural questions using pure static AST facts and graph queries.
Phase 6 of the scan pipeline executes a rigorous Structural Integrity Audit evaluating 14 foundational architectural contracts and class-awareness rules:
| # | Integrity Rule | Contract & Verification Focus | Severity |
|---|---|---|---|
| 1 | DTO Encapsulation | Request/Response Message Objects (MO_*) must never directly access persistence sinks or DAOs |
π΄ High |
| 2 | Repository Isolation | Repositories and DAOs must only be invoked from domain service layers, never directly from controllers | π΄ High |
| 3 | Controller Boundary | API Controllers must not contain raw SQL, business mutation logic, or multiple persistence mutations | π‘ Moderate |
| 4 | Service Layer Integrity | Domain services must implement consistent transaction boundaries and logging sinks | π‘ Moderate |
| 5 | Entity Contract Symmetry | Persistent entities must declare symmetric equals() and hashCode() implementations |
π‘ Moderate |
| 6 | Immutable Value Objects | Classes designated as Value Objects must have final fields and zero public mutation methods | π’ Low |
| 7 | Interface Segregation | Interfaces exceeding 15 method declarations are flagged for separation | π‘ Moderate |
| 8 | Dead Storage Methods | DAO methods with zero incoming call edges across the repository | π’ Low |
| 9 | Signature Divergence | Classes with similar naming but divergent method signatures (Levenshtein distance |
π‘ Moderate |
| 10 | AST Body Clones | Duplicate AST method body hashes across non-inherited class implementations | π‘ Moderate |
| 11 | Exception Swallowing | Catch blocks that catch Exception or Throwable and neither log nor re-throw |
π΄ High |
| 12 | Circular Module Coupling | Tightly coupled packages violating acyclic dependency graph principles | π΄ High |
| 13 | Unsynchronized Mutations | Multithreaded components mutating shared non-thread-safe collection instances | π΄ High |
| 14 | Naming Convention Drift | Classes violating configured domain prefixes or semantic archetype conventions | π’ Low |
CodeLens features a Semantic Archetype Engine that classifies methods and types into meaningful domain roles rather than generic programming language constructs.
In large enterprise codebases (such as TCS BaNCS), naming conventions embed module identifiers into method and class names. CodeLens supports dynamic {MODULE} and {MOD} tokens in archetype rules:
- An archetype rule defined with pattern
{MODULE}BTdynamically matchesAMBTAccountOpenin packagecom.tcs.bancs.AM,LNBTDisbursementincom.tcs.bancs.LN, andTRBTExecuteOrderincom.tcs.bancs.TR. - Module regex token boundary matching (
^[A-Z]{2,4}{SUFFIX}and\.[A-Z]{2,4}{SUFFIX}) eliminates collisions on English words (e.g.MONITORINGorBATCH). - In modern enterprise refactorings, transactions and tasks (
ET,BT,TO,TC) are implemented as domain methods inside orchestrator services rather than standalone boilerplate classes.
CodeLens includes a built-in, out-of-the-box preset for TCS BaNCS Core Banking Architecture:
| Archetype Rule | Pattern | Badge | Category | Color | Description |
|---|---|---|---|---|---|
| Business Transaction | {MODULE}BT |
MUTATE |
MUTATION |
#f59e0b (Amber) |
Mutating transaction methods creating or modifying domain state |
| Elementary Transaction | {MODULE}ET |
FETCH |
READ_ONLY |
#10b981 (Emerald) |
Read-only inquiry methods for high-throughput lookups |
| Own Task | {MODULE}TO |
TASK-OWN |
WORKFLOW |
#0ea5e9 (Sky Blue) |
Internal module workflow validation and calculation steps |
| Common Task | {MODULE}TC |
TASK-COMMON |
SHARED_TASK |
#a855f7 (Purple) |
Shared cross-module workflow steps (KYC, audit, GL posting) |
| Batch Stream | {MODULE}PS |
STREAM |
BATCH |
#8b5cf6 (Violet) |
Batch processing streams and scheduled job runners |
| Batch Pre-Processor | {MODULE}PB |
PRE-BATCH |
PRE_PROCESS |
#3b82f6 (Blue) |
Pre-batch data extraction and validation jobs |
| Batch Post-Processor | {MODULE}PA |
POST-BATCH |
POST_PROCESS |
#ec4899 (Pink) |
Post-batch reconciliation and report generation |
| Archetype Rule | Pattern | Badge | Category | Color | Description |
|---|---|---|---|---|---|
| Message Object | MO_*, MO_INP_*, MO_OUT_* |
MSG-OBJECT |
MESSAGE_DTO |
#14b8a6 (Teal) |
Request/response DTOs and state transfer payloads |
| Persistent Class | Domain entities with Get, Create, Modify |
PERSISTENT |
PERSISTENCE |
#6366f1 (Indigo) |
Core domain database entities (e.g. Account, Loan, OrderEntity) |
| Data Grabber | {MODULE}DG |
GRABBER |
DATA_ACCESS |
#06b6d4 (Cyan) |
Read-only data access objects fetching entity records |
CodeLens also provides ready-to-use presets for standard Java enterprise applications:
- Spring Boot MVC: Classifies
@RestController,@Service,@Repository, and@Configurationbeans with distinct visual badges and layer separation. - Domain-Driven Design (DDD): Identifies Entities, Value Objects, Aggregates, Domain Services, Repositories, and Domain Events.
To prevent boilerplates from cluttering call graphs and complexity calculations, CodeLens includes intelligent POJO detection:
- Standard JavaBean Heuristics: Automatically classifies zero-argument getters and single-argument setters (
getId(),setBalance(v),isActive(),hasPermissions()) while preserving parameterized business methods. - Standard Object Filtering: Filters
equals,hashCode,toString,clone,compareTo, andcanEqualmethods. - Domain Lifecycle Protection: Core persistence methods (
Get,Create,Modify) and Critical Path execution roles (ENTRY_POINT,PERSISTENT_TARGET,DOWNSTREAM_SINK,INTERMEDIARY) are protected against accidental POJO suppression. - Multi-Studio Enforcement: The POJO classifier engine (
isPojo/isPojoAccessor) operates consistently across the 2D Graph, 3D Studio (City & Galaxy), Sunburst, Treemap, Chord, and Dependency Structure Matrix (DSM). - On-the-Fly Toggle: Toggleable instantly via the bottom canvas toolbar button
Hide POJOs.
- Locate target method (e.g.
PaymentGateway.processTransaction). - Click
β¬ Callersin the Right Inspector. - Set Scan Depth Slider to
3or5. - The canvas renders all public API controllers, background schedulers, and services that depend directly or transitively on this method.
- Select any mutable field (e.g.
Account.accountBalance). - Click
π Propagation Chain. - CodeLens traverses:
$$\text{Field} \longleftarrow \text{Direct Writer Methods} \longleftarrow \text{Upstream Calling Triggers}$$ - Color-coded roles:
- π‘ Field (Target state variable)
- π΄ Direct Writer (Methods mutating the variable)
- π΅ Calling Trigger (Upstream entry points invoking the writers)
- π’ Direct Reader (Methods accessing the variable)
All database files and search indices are stored locally in ./codelens-data/:
codelens-data/
βββ codelens_db.mv.db # Compressed Embedded H2 Database (LZF compression, auto-compact)
βββ codelens_db.trace.db # H2 transaction trace log
βββ lucene-index/ # Apache Lucene index directory shards
-
High-Throughput Bulk Ingestion: Drops secondary B-tree indexes and disables undo logging during full scans to achieve constant
$O(1)$ batch insertion speeds regardless of existing table size. -
LZF Page Compression & Compaction: H2 runs with
COMPRESS=TRUEandAUTO_COMPACT_FILL_RATE=50. Post-scan and shutdown triggers executeSHUTDOWN COMPACTto eliminate MVStore dead page fragments, keeping 30k-file repositories under 1β2 GB on disk (instead of 40GB+ uncompacted). -
Leak-Free Connection Management: All database connections operate under strict try-with-resources blocks with explicit
setAutoCommit(false)chunk commits, preventing connection pool exhaustion and HikariCP leak warnings. - Graceful Shutdown & Interrupted Scan Recovery: Process termination or API shutdown requests cleanly flush Lucene index writers and H2 connection pools. Interrupted scans are safely flagged upon startup and can be resumed with a single click.
Tip
Resetting the Database: To completely reset your indexed data, simply delete the ./codelens-data/ folder and initiate a fresh scan from the web interface.
All endpoints return JSON and are accessible locally at http://localhost:7878/api.
POST /api/scanβ Start a background full scan ({"sourcePath": "/path/to/src", "excludePatterns": ["target", "build"]})POST /api/scan/incrementalβ Start an incremental delta scan ({"sourcePath": "/path/to/src", "excludePatterns": [...]})POST /api/scan/cancelβ Cooperatively cancel an active scan in progressGET /api/scan/statusβ Poll current scan progress, phases, entity counts, and statusGET /api/scan/changesβ Inspect detected filesystem changes (new, modified, deleted files)GET /api/scan/browseβ Open native OS directory chooser dialogPOST /api/shutdownβ Gracefully stop the CodeLens server process and flush storageGET /api/statsβ Summary entity counts (types,methods,fields,relationships,inconsistencies)
GET /api/packagesβ Flat list of indexed packagesGET /api/packages/{fqn}/typesβ Types declared in a specific packageGET /api/typesβ List all types (supports?q=query and pagination)GET /api/types/{fqn}β Detail for a type including member fields, methods, and Git telemetry
GET /api/methods/{fqn}β Method details, parameters, lines, and cyclomatic complexityGET /api/methods/{fqn}/graph?depth=3β Call hierarchy graph view (nodes+edges) up todepthhopsGET /api/methods/{fqn}/callers?depth=4β Upstream caller hierarchyGET /api/methods/{fqn}/callees?depth=4β Downstream callee hierarchyGET /api/graph/architecture?scope=module|package|classβ Quotient architecture graph view aggregated at module, package, or class levelGET /api/graph/dsm?scope=module|package|classβ Sparse Dependency Structure Matrix payload with fast cell lookup arrayGET /api/graph/treemap?scope=module|package|classβ Hierarchical treemap payload aggregated by lines of code and complexity
GET /api/reports/statusβ Current precomputation progress, percentage, phase, and cached keysPOST /api/reports/regenerateβ Trigger background sequential precomputation of all 14 reportsGET /api/reports/{reportKey}?format=markdown|html|json|csvβ Retrieve report in requested format- Supported keys:
architecture,change-risk,dead-code,circular-dependencies,archetype-governance,technical-debt,executive-summary,review,metrics,api-catalog,database-access,concurrency-audit,module-coupling,html-snapshot
- Supported keys:
GET /api/reports/download?type={key}&format=markdown|html|csvβ Direct file download endpoint
GET /api/storylinesβ List all discovered transaction storylines with entry points, persistent targets, and step countsGET /api/storyline?id={id}β Detailed storyline execution trace with narrative synthesis, step metadata, and blast radiusGET /api/storyline/what-if?method={fqn}β Hypothetical blast radius simulation and mutation impact for a methodGET /api/storyline/teach-meβ 5-layer guided architectural onboarding tour stopsGET /api/storyline/system-tourβ Complete system walkthrough data with Monaco source line citationsGET /api/git/pr-story?base={baseRef}&head={headRef}β Structural change storyline comparing Git branches or commits
GET /api/ai/ask?q={query}orPOST /api/ai/askβ Context-grounded architectural question answering (Ollama/OpenAI/Deterministic fallback)GET /api/ai/explain?target={fqn}orPOST /api/ai/explainβ Plain-English narrative explanation of class or method responsibilitiesGET /api/ai/configβ Retrieve active AI provider configurationPOST /api/ai/configβ Save AI configuration (providerollama|openai, model, endpoint URL, API key)
GET /api/modules/dependenciesβ Full inter-module dependency matrixGET /api/modules/insightsβ High-level module stability and architectural violation insightsGET /api/modules/{name}/dependenciesβ Focused dependencies for a single module
GET /api/processesβ Live status, stage, progress %, and throughput for all 11 background enginesPOST /api/processes/{id}/restartβ Restart/re-queue engine (scanner,call-graph,layout-engine,module-analyzer,lucene-indexer,git-analyzer,reports-generator, etc.)POST /api/processes/{id}/killβ Cooperatively terminate/cancel active taskGET /api/jvm/metricsβ Live heap usage, pool occupancy, GC stats, and circuit breaker statePOST /api/jvm/gcβ Trigger JVM garbage collectionPOST /api/jvm/trim-memoryβ Force cache eviction, DB compaction, and memory trimmingGET /api/jvm/auto-recoveryβ Current auto-recovery watchdog metrics and statusPOST /api/jvm/auto-recovery/triggerβ Manually trigger auto-recovery sequencePOST /api/jvm/auto-recovery/reset-circuit-breakerβ Reset memory circuit breaker to CLOSEDPOST /api/jvm/auto-recovery/simulateβ Test auto-recovery sentinel by injecting synthetic memory pressureGET /api/jvm/threadsβ Dump live JVM thread stacks, monitors, and lock contentionGET /api/jvm/deadlocksβ Detect active thread deadlocks
GET /api/fields/{fqn}β Field metadata and initializer expressionGET /api/fields/{fqn}/impact?depth=1β Field impact and multi-hop propagation chain (readers,writers,propagators,graph)
GET /api/analysis/persistent-classesβ Discover and rank all persistent domain entities across the repository by risk score, hops, and complexityGET /api/analysis/critical-path?class={classFqn}&mode=primary|mutation|read|longest|max_complexityβ Multi-hop end-to-end critical execution path report with candidate paths, precomputed coordinates, and metricsGET /api/analysis/blast-radius?method={methodFqn}β Calculate downstream blast radius fan-out for a methodGET /api/inconsistenciesβ List of all flagged structural inconsistencies and AST clones across 14 class rulesGET /api/search?q={query}&limit=30β Apache Lucene full-text entity search
POST /api/scope/excludeβ Exclude class or package from the analysisGET /api/scope/excludedβ List all currently excluded scopesPOST /api/scope/restoreβ Restore previously excluded entityPOST /api/scope/clearβ Clear all exclusion rules and restore full codebase scope
GET /api/configβ Retrieve active runtime configuration JSONPOST /api/configβ Update configuration settingsPOST /api/config/resetβ Reset all configuration settings back to defaultsGET /api/config/exportβ Download the activecodelens.conffile
GET /api/files/read?path={filePath}β Read source file contents from diskPOST /api/files/writeβ Save updated file content ({"path": "...", "content": "..."})GET /api/git/summaryβ Top authors leaderboard and hot churn entitiesGET /api/git/meta/{fqn}β Git commit history and blame stats for an entity
GET /api/notes/{entityFqn}β Retrieve analyst notes for an entityPOST /api/notesβ Create or update an analyst note ({"entityFqn": "...", "content": "..."})DELETE /api/notes/{id}β Delete an analyst noteGET /api/readmeβ Retrieve this full comprehensive markdown guide from the server
| Shortcut | Action | Scope |
|---|---|---|
βK / Ctrl+K |
Focus global Lucene entity search | Global |
Esc |
Clear search query / Close active modal dialog / Deselect node | Global |
1 |
Switch to Graph Canvas view | Global |
2 |
Switch to Knowledge Base Catalog view | Global |
3 |
Switch to Code Review & Logic Auditor view | Global |
4 |
Switch to Git Analytics & Churn view | Global |
5 |
Switch to Source Code (Monaco Editor) view | Global |
M |
Open Macro 3D Codebase Studio (City & Galaxy) | Global |
R |
Open Reports Hub (13 Architecture & Quality Reports) | Global |
P |
Open Background Tasks & Process Hub | Global |
? |
Open Feature & User Guide (with About CodeLens) | Global |
\ / | |
Toggle Critical Path Stepper Dock | Global |
[ |
Toggle Left Explorer panel visibility | Global |
] |
Toggle Right Inspector panel visibility | Global |
H |
Toggle Behavioral Hotspots / Git Churn Heat Mode | Graph & 3D City |
Space |
Toggle Force Physics simulation (Freeze / Unfreeze) | Graph Tab |
F |
Fit entire graph to screen (Auto-Zoom & Center) | Graph Tab |
+ / - |
Zoom in / Zoom out on canvas | Graph Tab |
0 |
Reset zoom to 100% | Graph Tab |
- Solution: Run a fresh scan in CodeLens 1.0.6+. The newly implemented LZF page compression and automated post-scan compaction (
SHUTDOWN COMPACT) will shrink the.mv.dbfile from 40GB+ down to 1β2 GB.
- Solution: Increase max heap allocation:
java -Xms2g -Xmx6g -XX:+UseG1GC -jar codelens.jar
- Solution: Pass
-Dcodelens.port=PORTon startup:java -Dcodelens.port=8080 -jar codelens.jar
- Solution: Shut down the server, delete the
./codelens-datadirectory, and restart.
CodeLens β Offline Java Architectural Intelligence
Zero telemetry Β· Zero cloud dependencies Β· 100% Local