Today I am excited to showcase NervaPack — an open-source, privacy-first knowledge graph and bi-temporal memory system built for AI coding agents like Claude Code, Cursor, and Windsurf.
The Problem with Standard Code RAG
As software repositories grow, developers and AI agents face a common dilemma: pasting full file dumps into prompts consumes 50,000+ tokens, driving up API costs ($700+/dev/year) while diluting context with irrelevant code. Meanwhile, naive text-chunk RAG breaks language structure — splitting functions across boundary lines and losing track of callers, imports, and doc explanations.
How NervaPack Works
NervaPack takes a developer-native approach. Instead of treating code as arbitrary text chunks, it parses your repository using Tree-sitter AST, building a structural knowledge graph with explicit CALLS, IMPORTS, EXPLAINS, and TOUCHES edges. When queried, K-hop BFS traversal retrieves only the precise 5–15 node neighborhood needed to answer the prompt.
Alongside the code graph, NervaPack introduces a Bi-Temporal Agent Memory engine (backed by SQLite FTS5 and ONNX embeddings). Decisions, facts, and procedures track valid_from, valid_until, and recorded_at timestamps, ensuring agents remember past trade-offs while seamlessly adopting updated architectural guidance.
Key Benchmarks & Features
• 91.2% Token Reduction: Averages 2,459 tokens vs 52,037 tokens for naive RAG (4.5x fewer tokens than Aider). • 96% Recall: Benchmark tested on SWE-bench Lite. • 100% Offline & Privacy-First: 0 KB cloud data. Everything runs locally on your machine. • Sub-200 Token Recall: Loads 30 days of project decision history in ~170 tokens. • Dual MCP Server Suite: 20 tools spanning code graph queries and bi-temporal memory management.
Get Started
$ pip install nervapack
$ cd your-project/
$ nervapack ingest .
$ nervapack query "How does authentication work?"
$ nervapack visualize --enhanced --communitiesFull installation guides, MCP client configuration, command references, and architectural deep-dives are available on the official Read the Docs site.