NervaPack¶
Privacy-first, offline knowledge graph for developers
Build token-efficient context for your LLMs without sending code to the cloud.
Why NervaPack?¶
NervaPack solves two fundamental problems with standard Vector RAG:
- Token waste — chunk-based RAG retrieves blobs of text that may only tangentially relate to your query, bloating your context window.
- Privacy risk — sending code to cloud embedding APIs leaks your proprietary logic.
NervaPack runs 100% on your machine. It uses tree-sitter to parse your codebase into a deterministic Abstract Syntax Tree graph, then uses a local Ollama model to draw hard semantic edges between your documentation and your code. Queries traverse this graph with a K-Hop BFS, returning a hyper-targeted, token-efficient context window — no cloud required.
Key Features¶
-
100% Private
All processing happens locally. Your code never leaves your machine. Uses ChromaDB + Ollama for complete privacy.
-
91% Token Savings
Graph-based retrieval reduces tokens by 91% vs naive RAG. Verified through real-world testing. Save on API costs and context window limits.
-
:material-offline: Offline First
Works completely offline with local Ollama models. Optional cloud providers (Claude, OpenAI) available.
-
AST-Based Precision
Deterministic parsing with tree-sitter. No arbitrary text chunks — only real code entities.
-
Incremental Sync
GitPython-powered surgical updates. Only changed files are re-indexed.
-
Rich Visualizations
Interactive HTML graphs with community detection, search, and dependency analysis.
Quick Example¶
# Install (30 seconds)
brew install nervapack
# or: pipx install nervapack
# Build graph (2 minutes)
cd your-project/
nervapack ingest .
# Query (instant results)
nervapack query "How does authentication work?"
# Visualize
nervapack visualize --enhanced --communities
Output: Precise, token-efficient context with savings dashboard:
╭────────────── NervaPack Token Efficiency ──────────────╮
│ Strategy Tokens Visual Relative │
│ Naive RAG (3 files) 12,840 ████████████████ 100% │
│ NervaPack 1,180 █░░░░░░░░░░░░░░░ 9.2% │
│ ──────────────────────────────────────────────────────────│
│ Tokens saved: 11,660 Reduction: 90.8% │
│ Cost saved (GPT-4o $2.50/1M): $0.0292 per query │
│ Cost saved (Claude Sonnet $3/1M): $0.0350 per query │
╰───────────────────────────────────────────────────────────╯
Verified Performance
The 91% token reduction is verified through real-world testing on NervaPack's own codebase. See detailed benchmarks for test methodology and results.
NervaPack vs Standard Vector RAG¶
| Standard Vector RAG | NervaPack | |
|---|---|---|
| Parsing | Arbitrary text chunks | Deterministic AST nodes (class, function, import) |
| Retrieval | Nearest-neighbor blob | K-Hop BFS on structural graph |
| Doc ↔ Code links | None | Hard EXPLAINS edges drawn by local LLM |
| Privacy | Cloud embeddings | 100% local (ChromaDB + Ollama) |
| Incremental sync | Re-index everything | Surgical per-file update via GitPython diff |
| Token savings | No measurement | Built-in dashboard shows exact reduction per query |
| Graph visibility | Black box | Interactive HTML visualization of every node and edge |
Supported Languages¶
Bundled (no extra install): - Python, JavaScript, JSX, TypeScript, TSX
Optional extras:
pip install "nervapack[go]" # Go
pip install "nervapack[rust]" # Rust
pip install "nervapack[java]" # Java
pip install "nervapack[c]" # C / C headers
pip install "nervapack[cpp]" # C++
pip install "nervapack[ruby]" # Ruby
pip install "nervapack[csharp]" # C#
pip install "nervapack[all-languages]" # Everything
Use Cases¶
- Code onboarding — Understand new codebases 10x faster
- Documentation search — Find relevant docs linked to code
- Refactoring analysis — See full dependency impact
- LLM context optimization — 90% smaller prompts, same accuracy
- Dependency auditing — Detect circular dependencies
What's Next?¶
Installation Guide Walk through setup for macOS, Linux, and Windows
Quick Start Tutorial Build your first knowledge graph in 5 minutes
Command Reference Detailed documentation for all 10 CLI commands
Community & Support¶
- GitHub Issues: Report bugs & request features
- PyPI Package: nervapack on PyPI
- License: MIT (free for commercial use)
NervaPack is actively developed and maintained. We welcome contributions!