How Local Code Knowledge Graphs Work — Inside the Microsecond BEAM Engine

Traditional search tools for LLMs split code files into arbitrary 500-token text chunks. They chop functions in half, lose class boundaries, and miss call relationships across modules. When your AI agent attempts to query a legacy codebase, standard text RAG feeds it fragmented snippets, forcing the model to guess how components connect.

Synapse MCP takes a radically different approach: local, deterministic Abstract Syntax Tree (AST) graph indexing. Built on a concurrent actor runtime, native language parsers across 50+ languages, and a local in-memory graph store backed by persistent local storage, Synapse resolves structural dependencies in microseconds—100% locally on your machine, with zero cloud dependency.

1. The Problem with Standard Code RAG

Standard vector RAG engines slice files by line count. Consider what happens to a 200-line module when sliced by naive line chunkers:

2. Inside Synapse's Local Graph Architecture

Synapse operates directly inside a concurrent actor runtime, taking advantage of lightweight processes and in-memory graph tables for zero-latency concurrent read access.

Step 1: AST-Aware Structural Chunking

Instead of line-slicing, Synapse parses files using language-native AST parsers across 50+ languages. Every function, module, class, trait, and behaviour is extracted into a discrete Chunk struct bound to exact start/end line coordinates and checksums.

Step 2: Microsecond In-Memory Edge Storage

Call edges between chunks are stored in a local in-memory graph table. When an AI agent calls synapse_explore_graph(action: "callers"), Synapse executes a graph lookup in microseconds. There are no disk reads required during active graph traversal.

// Single-turn graph query — all callers returned in microseconds
{
  "tool": "synapse_explore_graph",
  "action": "callers",
  "symbol": "MyModule.my_function/2"
}

Step 3: Virtual Worktree Overlay (VWO) & Sub-50ms Deltas

When you spawn sub-agents in Git worktrees, Synapse does not duplicate the index. Instead, the Virtual Worktree Overlay (VWO) runs git status against the parent indexed commit in <50ms. Modified files shadow the main index, deleted files are suppressed, and unchanged files fall back to the master index transparently.

3. SmartCrusher: Deep Payload Compression

To prevent prompt context window exhaustion, Synapse MCP passes every JSON response through an automatic minification engine called SmartCrusher. SmartCrusher relativises paths, strips null/empty fields, and compresses structural keys (e.g. file_pathfp, start_linesl).

"SmartCrusher reduces response payloads by 30–60% with zero loss of structural information, giving your agent maximum remaining context for writing code."

When an agent scans multiple files for function signatures, it passes format: "outline", which strips function bodies entirely—allowing your AI agent to scan 20+ files in a single turn for a fraction of the token cost.

4. Get Started in 60 Seconds

Synapse MCP runs as a self-contained local stdio/HTTP launcher requiring zero manual database setup. Run one command in your terminal to get started:

npx @myelixlabs/synapse-mcp install

This automatically detects your IDE (Cursor, Windsurf, Claude Code, Antigravity, VS Code, Zed) and registers the required agent rules so your AI model starts leveraging microsecond graph context immediately.

Deploy the Microsecond Graph Engine

Get 100% local, zero-cloud AST knowledge graphs for Cursor, Windsurf, Warp, Claude Code, and Antigravity.

Install Free Edition (npx @myelixlabs/synapse-mcp) → Upgrade to Pro ($19/mo) →