HomeDocumentation

Documentation

How GrapeRoot works

GrapeRoot gives your AI a deep understanding of your codebase before it writes a single line. Less wasted tokens, better answers, lower cost.

100% LocalNo CloudClaude CodeCodexZero ConfigAuto UpdatesmacOS / Linux / Windows

The Problem

Why your AI wastes tokens exploring your codebase

Every time you ask Claude Code or Codex a question about your project, it has to figure out which files are relevant. It does this by making tool calls — reading files one by one, grepping for patterns, exploring directories. On a mid-size project, a single question can trigger 10-20 tool calls before the AI even starts answering.

Each of those tool calls adds overhead. The tool definitions, the system instructions, the back-and-forth — it all compounds. By the time Claude has enough context to answer, it has already burned through thousands of tokens just on exploration.

And it gets worse across turns. Claude does not remember what it explored last time. Next question? Same exploration tax all over again.

GrapeRoot eliminates this exploration tax. It understands your codebase ahead of time and delivers the right context to Claude before it even starts thinking — so every token goes toward actually answering your question.

The Evolution

How we got here

GrapeRoot started as an MCP server that gave Claude access to a code graph through tool calls. Claude would call graph_continue to find relevant files, then graph_read to read them. It worked — Claude found the right files faster than exploring on its own.

But we noticed a problem. Every MCP tool call added protocol overhead — tool definitions, routing instructions, response formatting. Over a multi-turn session, this overhead added up. Claude was spending fewer tokens on exploration but more tokens on the MCP protocol itself.

The insight

The graph already knows which files matter before Claude asks. So instead of giving Claude tools to query the graph, why not just give it the answer upfront?

That led to Pre-Injection — the current architecture. GrapeRoot retrieves the relevant context locally (in milliseconds), packs it into a compact structured summary, and injects it directly into Claude's prompt. Claude gets everything it needs on the first turn. No tool calls, no multi-turn exploration, no protocol overhead.

Without GrapeRoot

1.You ask a question
2.Claude calls grep, Bash, Read
3.Reads 10-20 files to find context
4.More exploration, more tool calls...
5.Finally answers your question

Thousands of tokens wasted on exploration every turn.

With GrapeRoot

1.You ask a question
2.GrapeRoot packs the correct context instantly
3.Claude answers with full context

One pass. Zero exploration overhead. Better answers.

The result: Claude gets richer context in fewer tokens. It answers faster, costs less, and the quality actually improves because it has structured information (function signatures, call graphs, dependencies) instead of raw file contents.

Under the Hood

What GrapeRoot does today

When you run graperoot . (or the shortcuts dgc . / dg .), GrapeRoot builds a dual graph of your project and uses it to deliver precise context. Here is what each layer does.

Code Map

Your project's DNA

A complete graph of your codebase — every file, function, class, and how they connect through imports and calls. Built in seconds, updated incrementally when files change.

  • →Files, functions, classes with line ranges
  • →Import and dependency edges between files
  • →Keyword scoring for semantic file ranking

Context Packer

The intelligence layer

Takes the graph results and compresses them into a compact structured summary with only the relevant context. Claude gets function signatures, parameters, return types, and call relationships — not raw file dumps.

  • →Full function signatures with params and returns
  • →Inline code from the most relevant functions
  • →Key dependency edges and call targets

Session Memory

Gets smarter every turn

A live action graph tracks what has been read, edited, and decided during your session. On follow-up questions, GrapeRoot routes directly to previously-touched files with confidence=high — no retrieval needed. Decisions and context carry over between sessions via hooks.

Turn 1

Context packed from graph. Claude learns your project.

Turn 2+

Memory kicks in. Files from previous turns served instantly.

Next Session

Decisions and context injected at startup. No cold start.

Structured summaries over raw files

Instead of dumping entire files into the prompt, GrapeRoot extracts structured summaries: function names, parameter types, return types, decorators, and internal call graphs. Claude gets the same understanding in a fraction of the tokens.

Code-first packing

When Claude needs to see actual code (not just summaries), GrapeRoot inlines the most relevant function bodies directly. The packer prioritizes code over metadata — up to 45% of the token budget goes to inline code from the top functions per file.

Session Flow

What happens when you run graperoot

From the moment you type graperoot . (or dgc . / dg .) to your AI answering your first question — here is every step.

1
Project scan

GrapeRoot walks your project directory, extracts files, functions, classes, import edges, and builds the dual graph. This takes seconds, even on large projects. Unchanged files are cached.

2
MCP server starts

A lightweight local server starts on a free port (8080-8099). It serves the graph tools and handles context packing. Claude Code or Codex connects automatically.

3
Session hooks installed

GrapeRoot writes hooks into Claude's local settings. These re-inject context when Claude compacts its memory mid-conversation, and log token usage at session end.

4
You ask a question

GrapeRoot retrieves the relevant files from the graph, packs structured summaries and inline code into a compact context pack, and injects it directly into your AI's prompt. This happens in milliseconds.

5
Claude answers with full context

Claude has function signatures, call graphs, and relevant code from the start. No exploration needed. It goes straight to answering your question.

Built-in guardrails

GrapeRoot enforces per-turn read budgets, deduplicates repeated reads, and rate-limits fallback grep calls. Your AI stays efficient without you having to micromanage it.

Cross-Platform

Works everywhere, sets itself up

GrapeRoot runs on macOS, Linux, and Windows. The launcher automatically handles Python discovery, virtual environment creation, and dependency installation — no manual setup required.

macOS

Finds Homebrew Python, Xcode stubs, versioned binaries. Five fallback methods for venv creation.

Linux

Auto-installs missing packages (python3-venv, curl) via apt, yum, dnf, or pacman. Pre-flight checks for Node.js.

Windows

Discovers Python via PATH, py launcher, common install paths, and Conda. Skips the Windows Store stub automatically.

If something goes wrong, GrapeRoot shows clear error messages with specific fix commands for your platform — not cryptic stack traces.

Token Tracking

See what every session costs

GrapeRoot includes a built-in token tracker that runs alongside your AI session. It gives you a live dashboard where you can see exactly how many tokens you are using and what it costs.

You can also ask Claude directly during your session — “how many tokens have I used?” or “what's my cost so far?” — and get an instant answer.

Token tracking is completely passive — it runs in the background without affecting your workflow. The dashboard is just there when you want visibility into your costs.

Updates

Always up to date

To update GrapeRoot and all individual tool launchers at once, run:

graperoot --update

This updates both the core GrapeRoot engine and all tool-specific shortcuts (dgc, dg, etc.) in one command. Updates are pulled from a Cloudflare R2 CDN for speed and reliability. If the remote version is older than your local version, the update is skipped automatically.

GrapeRoot also checks for updates automatically every time you start a session. You never need to worry about running an outdated version — it stays current on its own.

Privacy

All data stays on your machine

Everything GrapeRoot does happens locally on your computer. Your source code is never sent anywhere. The graph, the session memory, the context packs — all stored in <project>/.dual-graph/ on your machine.

Your code never leaves your machine

The server runs on localhost. No file names, no code, and no project data is ever sent externally.

No account required

No sign-up, no API keys, no cloud dashboard. Install and go.

The only outbound calls are an anonymous version check (a single GET request for a version string) and an optional one-time feedback prompt after the first day of use.

FAQ

Frequently asked questions

Quick answers to the things people ask most. If your question isn't here, send us a note.

Getting started

Which AI tools does GrapeRoot work with?
Claude Code, Codex CLI, Cursor, Gemini CLI, GitHub Copilot (VS Code), OpenCode, and Google Antigravity. The same install works across all of them — just run the command for the agent you're using inside your project folder.
How do I install it?
One global install, then run graperoot . on each project. macOS / Linux: curl -sSL …/install.sh | bash. Windows uses irm … | iex. See the install block on the home page for the exact commands.
Do I need to run something every session?
Yes — once per project, per session. Run graperoot . inside your project folder — it will ask you to pick your AI tool from a menu. Or use the shortcuts directly: dgc . (Claude Code), dg . (Codex). That one command starts the local server and connects your AI.

Privacy & local-first

Does my code leave my machine?
No. The graph, session memory, and context packs are stored in .dual-graph/ inside your project. The server runs on localhost — no file names, no source, no project data is ever sent externally.
What does GrapeRoot send out, then?
One anonymous version check (a single GET for a version string) and an optional one-time feedback prompt after the first day of use. That's it. No account, no API key, no telemetry.

Pro & billing

What do I get in Pro?
Up to 1M files per project, crash diagnosis with blast-radius analysis, decision & WHY memory across sessions, GrapeRoot Viz (the live 3D interactive graph), and a live token-reduction dashboard. See the pricing page for the full list.
How does Pro billing work?
Pro is $10 / month, billed via Stripe. Cancel anytime — your local install keeps working on the Free plan. Enterprise is per-seat with a self-hosted or VPC option; talk to sales for a quote.

Maintenance & updates

How are updates delivered?
Run graperoot --update to update everything at once. GrapeRoot also checks for a new version automatically when you start a session and updates in place. You can disable auto-updates with an environment variable if you need a pinned version.
What happens when my files change?
The graph re-syncs incrementally as you edit. Only the touched files are re-indexed, so updates are sub-second on most projects. There's no need to rebuild manually.

How GrapeRoot compares

GrapeRoot vs Repomix
What Repomix does: Packs your entire repository into a single XML/Markdown/JSON file that you manually paste into an AI chat. It supports tree-sitter compression (~70% token reduction), security scanning, and token counting. You re-run the CLI every time your code changes.

Where GrapeRoot differs: Repomix is static and manual — you regenerate a dump, paste it, and hope it fits. Even with compression, a 500-file repo still produces tens of thousands of tokens. GrapeRoot builds a live dependency graph that automatically selects only the 5–15 files relevant to your current question. It re-indexes incrementally on every file save (sub-second), requires no copy-paste, and pre-injects context before the AI starts — so you never pay for files you don't need. Repomix gives the AI everything; GrapeRoot gives it exactly what matters.
GrapeRoot vs Aider's repo map
What Aider does: Uses tree-sitter to extract class/function signatures into a ranked “repo map” (default budget: ~1,024 tokens). A graph-ranking algorithm scores files by dependency connections. The map is regenerated from scratch on every single message and provides symbol signatures only — no function bodies, no cross-file relationships beyond import edges.

Where GrapeRoot differs: GrapeRoot's dual graph stores both structural relationships (imports, call targets, type references) and session-level context (what you asked, what was relevant before). It persists across turns and sessions — not rebuilt per message. When context is needed, GrapeRoot delivers actual function bodies and surrounding code, not just signatures. It also tracks your editing patterns to prioritize recently-touched code. Aider's map tells the AI what exists; GrapeRoot tells it what's relevant and gives it the actual code to work with.
GrapeRoot vs Augment Code
What Augment does: An enterprise platform (SOC 2, ISO 42001) that deploys specialized AI agents across the development lifecycle — triage, authoring, review, testing. Their Context Engine maps structural relationships and claims ~50% token reduction vs. alternatives. Code must be accessible to Augment's servers (cloud, customer-cloud, or on-prem deployment). Pricing requires enterprise sales conversations.

Where GrapeRoot differs: GrapeRoot runs 100% locally — no code ever leaves your machine, no cloud dependency, no vendor lock-in. It's available to individual developers for free, not just enterprise teams. While Augment coordinates multi-agent workflows across SDLC stages, GrapeRoot focuses on one thing and does it exceptionally: delivering the right context to your existing AI tools. In benchmarks, GrapeRoot achieves 50–70% token savings with zero infrastructure setup — just run graperoot . and it works.
GrapeRoot vs Sourcebot
What Sourcebot does: A self-hosted code search platform powered by Zoekt. Supports regex search, boolean filters, cross-repo queries, goto-definition, and “Ask Sourcebot” natural language questions. Your AI agent calls Sourcebot's search API as an MCP tool to find relevant code. Deployed via Docker Compose.

Where GrapeRoot differs: Sourcebot is reactive — your AI must decide to search, formulate a query, make a tool call, wait for results, then decide if it needs more. Each round-trip costs tokens and adds latency. GrapeRoot is proactive — it pre-injects relevant context before the AI even begins thinking about your question. No tool calls, no search queries, no round-trips. The graph already knows which files connect to your question. Sourcebot also requires Docker infrastructure; GrapeRoot is a single CLI command with zero dependencies.
GrapeRoot vs Continue.dev
What Continue does: An open-source coding agent (CLI, VS Code, JetBrains) that uses embedding-based RAG for codebase context. It chunks your files, generates vector embeddings, stores them in a local index, and retrieves the top-k most similar chunks when you use @codebase. The retrieval is purely semantic — cosine similarity between your question and code chunks.

Where GrapeRoot differs: Embedding-based RAG treats every chunk as independent — it has no understanding of how files import each other, which functions call which, or how types flow through your codebase. Two highly related files with different variable names score low on similarity. GrapeRoot's graph captures structural relationships (imports, exports, call chains, type dependencies), so when one file is relevant, its connected files come along automatically. GrapeRoot also persists session memory across conversations and re-indexes incrementally — no re-embedding your entire codebase after edits.
GrapeRoot vs Cline
What Cline does: An autonomous coding agent that explores your codebase by reading files one-by-one via tool calls. It executes bash commands, watches terminal output, and iteratively gathers context by asking to read more files. It supports Plan/Act modes, multi-agent coordination, and works with any LLM. Context is gathered on-demand through exploration.

Where GrapeRoot differs: Cline's exploration approach means your AI burns tokens every turn just figuring out which files to look at — reading directory listings, opening wrong files, backtracking. In a 200-file project, Cline might read 15–30 files across multiple tool calls before finding what it needs. GrapeRoot eliminates this entirely: the graph pre-computes file relationships, so the AI receives exactly the right files in its first message with zero exploration. Same quality results, 50–70% fewer tokens, and no multi-second tool-call chains.
GrapeRoot vs Graphify
What Graphify does: Builds a knowledge graph of your codebase (165+ languages via tree-sitter) and exposes it through MCP tools. Offers token-budgeted subgraphs, community detection (Leiden clustering), semantic search via semble, and a graphify_locate tool that claims 263x fewer tokens than grep+read. Requires explicit graphify_build calls and freshness checks.

Where GrapeRoot differs: Graphify is still reactive — your AI must call graphify_locate or graphify_query as tool calls, paying round-trip latency and output tokens for each query. GrapeRoot pre-injects context before the AI's first response — zero tool calls needed. GrapeRoot also re-indexes automatically on file save (no manual build/freshness commands), maintains persistent session memory across conversations, and tracks editing patterns to weight recently-changed code higher. Graphify gives you tools to ask the graph; GrapeRoot delivers answers from the graph before you even ask.
GrapeRoot vs RTK (Rust Token Killer)
What RTK does: A Rust CLI that filters and compresses shell command output before it reaches the LLM context window. For example, it strips noise from cargo test (97.8% reduction), env (99.3%), and cargo clippy (92.5%). It works as a post-processor on 20+ allowlisted commands and integrates via MCP.

Where GrapeRoot differs: RTK and GrapeRoot solve completely different problems. RTK compresses output after the AI already decided to run a command — it makes results smaller but doesn't prevent unnecessary work. GrapeRoot works upstream: it decides which files are relevant before the AI starts, so unnecessary commands never get executed in the first place. RTK saves tokens on output; GrapeRoot prevents wasted input tokens entirely. They're complementary — you can run both together for maximum savings — but GrapeRoot alone typically delivers 50–70% total session savings by eliminating the exploration loop that generates noisy output in the first place.
GrapeRoot vs Headroom
What Headroom does: A token compression engine (Apache 2.0) that reduces AI agent context by 60–95% by compressing what you send — not deciding what to send. It uses AST-aware code compression, schema-based JSON reduction, and a custom ML model (Kompress-base) trained on agentic traces. Works as a local proxy, MCP server, or headroom wrap claude CLI wrapper. Supports reversible compression (CCR) so originals stay recoverable.

Where GrapeRoot differs: These tools solve different problems and work best together. Headroom is downstream — it compresses whatever context you've already decided to send. GrapeRoot is upstream — it decides which files are even worth reading in the first place. If your agent reads 40 files to answer a question, Headroom makes those 40 files cheaper; GrapeRoot ensures it only needs 8 files to begin with. Headroom has no understanding of cross-file relationships, import graphs, or call chains — it compresses each file independently. GrapeRoot's graph knows how files connect, so the right context arrives before exploration starts. Stack them for maximum savings: GrapeRoot selects → Headroom compresses → lowest possible token spend.
Can I use GrapeRoot alongside these tools?
Yes — GrapeRoot operates at the context layer, which is orthogonal to most of these tools. Use it with RTK (GrapeRoot prevents unnecessary reads, RTK compresses the ones that remain), with Headroom (see your savings in real-time), with Cline or Continue (GrapeRoot pre-seeds the context so they explore less), or with any MCP-compatible tool. GrapeRoot doesn't replace your editor, AI agent, or workflow — it makes all of them more efficient by solving the context problem at the source.

Ready when you are

Install in under a minute.

One global install, then run on any project.

The Team

Built by engineers who felt the pain.

GrapeRoot was born from spending too many tokens watching AI explore codebases it should already understand.

Krishnakant

Krishnakant

Founder

IIT Delhi

Shiv Singh

Shiv Singh

Co-Founder

IIT Delhi

Ask about GrapeRoot

Features, pricing, how it works

Hey! I'm the GrapeRoot Assistant. Ask me anything about GrapeRoot — features, pricing, installation, or how it works.