Static analysis and codebase graph engine for AI coding agents and CI pipelines.
OpenCypher over SQLite, Semantic Invariant Gates, MCP server, and interactive VS Code topology.
CodeExplorer indexes source files into a local SQLite property graph with zero external database dependencies.
No Neo4j or Docker containers required. Translates OpenCypher 9 AST queries into parameterized SQLite joins and recursive CTEs with indexed B-Tree lookups.
SqliteCompiler.csInspect services across 5 concentric tiers, view C1/C2 project flows, and evaluate or ratchet Semantic Invariant Gates directly from the VS Code sidebar and dock panel.
Cytoscape.js + Webview
Hide intermediate message topics (Kafka, RabbitMQ, SQS) and synthesize direct dashed [SUBSCRIBES (via Topic)] edges between producer and consumer services.
Transitive Edge SynthesisProvide Claude Code, Cursor, Codex, and terminal agents with deterministic call chains, impact analysis, and data lineage via direct CLI commands or local MCP over stdio.
CLI + MCP (stdio JSON-RPC)In-memory AST extraction for C#, Java, Kotlin (Android/KMP), TypeScript, JavaScript, Go, Python, ColdFusion, and T-SQL. Resolves classes, functions, HTTP routes, ORM entities, and CQRS handlers.
Tree-sitter + T-SQL ScriptDom
Optionally enriches graph nodes with business domain tags and intent summaries using embedded llama.cpp (Vulkan GPU / CPU). Caches results by file SHA-256 hash.
Local llama.cpp (Optional)Test real architectural inquiries against the graph database. Fast, declarative, and structured.
// Find all downstream services impacted by OrderPlaced event MATCH (p:Service {name: 'OrderService'})-[r:EMITS]->(e:DomainEvent) MATCH (e)<-[:SUBSCRIBES]-(downstream:Service) OPTIONAL MATCH (downstream)-[:WRITES_TO]->(tbl:Table) RETURN p.name AS Producer, e.name AS EventName, downstream.name AS Consumer, tbl.name AS TargetTable ORDER BY Consumer
| Producer | EventName | Consumer | TargetTable |
|---|---|---|---|
| OrderService | OrderPlacedEvent |
BillingService | invoices |
| OrderService | OrderPlacedEvent |
InventoryService | stock_items |
| OrderService | OrderPlacedEvent |
NotificationHub | null |
| OrderService | OrderPlacedEvent |
ShippingGateway | shipments |
Define architectural rules as declarative OpenCypher queries in YAML. Enforce layer boundaries, block circular dependencies, and baseline existing technical debt in CI pipelines and VS Code.
Gates are organized across 5 hierarchical Scopes (System, Service, Module, Class, Method) and 4 architectural Dimensions (Boundaries, Contract, Rules, Resources), covering multi-service topologies down to AST call arguments.
Identifier: SIG-<Scope>-<Dimension>-<Index3Digits>
Each gate runs an OpenCypher query against the indexed graph: 0 rows returned = PASS; 1 or more rows = VIOLATION. Every match projects source coordinates (file:line:column), offending symbol, target, and remediation guidance.
RETURN file, line, column, symbol, target, message
Violations are fingerprinted by semantic identity and per-file occurrence index rather than volatile line numbers. Formatting code or adding imports above a baselined violation never triggers false positives in pull requests.
SHA256(GateId + FilePath + Symbol + Target + Occurrence)
Architectural rules are categorized by scope hierarchy and structural dimension.
| Scope & Level | Granularity & Graph Entities | Dimension Focus | Example Invariant & Purpose |
|---|---|---|---|
| System (A) | :Service, :Topic, :Database, cross-service RPC |
Boundaries & Topology | Prevent circular distributed event publish/subscribe chains; enforce API gateway single-entry ingress. |
| Service (S) | :Service, :Worker, :App, :CliTool executables |
Resources & Boundaries | Forbid frontend apps or background workers from executing queries directly against foreign service databases. |
| Module (P) | :Project, :Library, compilation units, NuGet / npm packages |
Layer Boundaries | Enforce unidirectional layer hierarchy: Domain and Application core libraries must not reference Infrastructure or UI packages. |
| Class (C) | :Type, classes, interfaces, structs, visitor hierarchies |
Rules & Implementation | Keep AST visitors and compiler passes pure: disallow direct invocation of filesystem (File, Directory) or network I/O. |
| Method (M) | :Function, :Endpoint, constructors, :CallLiteral |
Contract & Rules | Detect hardcoded string literals passed to domain methods; verify public API endpoints return typed DTOs instead of ORM entities. |
Enforce Clean Architecture and bounded context isolation. Prohibit Domain and Core layers from referencing Web, UI, or persistence drivers.
Detect direct and transitive circular references across modules (A ➔ B ➔ A) to preserve an acyclic project dependency graph.
Detect unversioned route changes and direct exposure of internal ORM entity types on public REST or gRPC endpoints.
Catch controller handlers issuing raw SQL queries directly against database tables instead of delegating to repositories or handlers.
Adopt architectural rules in existing codebases without fixing hundreds of legacy violations upfront. Record current violations into SHA-256 baseline snapshots so CI passes existing debt while blocking any newly introduced violation.
.codeexplorer/gates/*.yaml matching forbidden patterns with remediation guidance.ce gate ratchet --update or click Ratchet Baseline in the VS Code Gates panel to freeze existing violations.ce gate check tolerates baselined items ([TOLERATED]) and exits non-zero on new violations ([FAIL]).# Pull Request Architectural Guardrail name: Architectural Invariant Gates on: [pull_request] jobs: verify-architecture: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install CodeExplorer CLI run: curl -fsSL https://raw.githubusercontent.com/vmikhailov/code-explorer/main/cli/scripts/install.sh | bash - name: Scan AST & Compile SQLite Graph run: ce scan - name: Evaluate Semantic Invariant Gates run: ce gate check # Exits with code 1 if PR introduces any unbaselined violations
Separate language-agnostic structural rules from ecosystem-specific package constraints.
.codeexplorer/gates/architectural/*.yaml
Category: Architectural (platform: agnostic) — Structural patterns: layer separation, acyclic project graphs, CQRS handler rules, and AST visitor purity.
.codeexplorer/gates/platform/<platform>/*.yaml
Category: Platform (platform: dotnet | node | go | python) — Ecosystem-specific rules: restricting Microsoft.Data.Sqlite or better-sqlite3 in domain packages.
ce gate check --category architectural --platform dotnet
Filter gate evaluation by category, platform, scope, or severity in polyglot builds.
Verify structural constraints from the terminal, automated agent loops, or the interactive Gates panel in VS Code.
ce gate check --format json
Outputs structured JSON diagnostics with file:line:col and remediation instructions for coding agents.
ce gate ratchet --update -g <gate-id>
Updates baseline snapshots for specific gates via CLI or the VS Code Gates view.
ce gate violations --group-by file
Lists active violations grouped by source file, gate, or category.
Two complementary interfaces to access deterministic codebase ground truth: direct CLI execution for engineers, autonomous agents, and CI pipelines, plus a standard MCP server for desktop IDEs.
Autonomous coding agents (Claude Code, OpenAI Codex, OpenCode, Aider, Hermes) execute ce directly in bash without JSON-RPC overhead or background daemons. Structured JSON and Markdown outputs provide maximum architectural signal in minimum tokens.
ce init [name] — Initialize .codeexplorer/ workspace and SQLite knowledge graph.
ce scan — Parse Tree-sitter ASTs, extract dependencies, and resolve semantic layers.
ce query -n get_architecture_map_workspace -j — Macro topology, databases, and ingress in <1,000 tokens.
ce query -n get_project_entry_points -p <name> — Discover HTTP endpoints, gRPC routes, and event listeners.
ce query -n get_file_outline -f <path> — Low-token AST outline (classes, methods, signatures) without reading full file.
ce query "MATCH (s:Service)-[:CALLS*1..3]->(t) RETURN ..." — Ad-hoc multi-hop OpenCypher call graphs.
ce gate check --format markdown — Pre-commit validation of Semantic Invariant Gates and ratchets in CI.
ce export --format mermaid -o arch.mmd — Export C1/C2 diagrams and event pipelines from graph topology.
# 1. Initialize & index repository $ ce init && ce scan Indexed 48 projects, 1,240 files, 18 databases in 1.4s. # 2. Inspect architecture in <1,000 tokens $ ce query -n get_architecture_map_workspace -j { "projects": ["OrderService", "BillingCore", "AuthGateway"], "databases": ["orders_db", "billing_replica"], "entry_points": ["POST /api/v1/orders", "Topic: order-events"] } # 3. Trace multi-hop blast radius before editing $ ce query "MATCH (t:Type {name: 'IOrderRepo'})<-[:CALLS]-(c) RETURN c.name" [ "OrderController", "BillingListener", "InvoiceWorker" ] # 4. Enforce architectural invariants before commit $ ce gate check ✓ PASS: SIG-P-B-001 Clean Architecture Layer Isolation (0 violations) ✓ PASS: SIG-M-I-001 No Hardcoded Endpoint Literals (0 violations) All 6 Semantic Invariant Gates passed in 11.2ms. Exit code: 0
For desktop IDEs and AI assistants (Claude Code, Cursor, Claude Desktop, Roo Code, Cline), ce mcp exposes 23 architectural tools over zero-network local stdio JSON-RPC pipes.
get_architecture_map — Surface project boundaries, external dependencies, and ingress endpoints.
analyze_code_impact — Calculate downstream blast radius before refactoring types or interfaces.
inspect_data_lineage — Map ORM entities, SQL queries, and callers touching a database table.
execute_cypher_query — Run parameterized OpenCypher queries and saved domain queries.
{
"mcpServers": {
"code-explorer": {
"command": "ce",
"args": ["mcp"],
"env": {
"CE_WORKSPACE": "."
}
}
}
}
34 node labels and 37 relationship types organized across five layers, linking physical source files to cross-service topology.
Single self-contained binaries for macOS, Linux, and Windows. No SDK required.
ce binary directly into your PATH with automatic shell completions.ce.exe and registers in Windows User PATH.~/.local/bin..codeexplorer workspace configuration in current repository.