Trail-Code (trailhq/Trail-Code)

Searching Database…

What is this?Graft maps your codebase into linked markdown files — one node per system, API, or concept — and feeds the matching nodes to coding agents like Claude Code, Cursor, Codex, and Gemini, so they stop re-exploring the repo on every task and run faster, cheaper, and more accurately.
Is Graft a cloud service, or does everything live in my repo?It's a CLI plus an MCP server, and the graph itself is just a folder of markdown files (graft/) inside your repo — a local, regenerable cache like node_modules. No daemon, no database, and nothing to run or maintain by default.
What do I have to do so my coding agent starts using it?Run 'graft init' — it asks which agents to wire up, builds graft/, and drops a statusline and hooks into .claude/ so the graph rides along from your next session. No global install needed ('npx @nanonets/graft init'), and 'graft init --dry-run' previews every file it would touch first.
Do I have to bring my own API key?You need Node 20+. The structural graph (graft build) is pure tree-sitter and never calls a model, so it needs no key; only the plain-English summaries use an LLM, from any provider you pick — OpenAI, Anthropic, OpenRouter, Fireworks, Groq, a LiteLLM proxy, or a local model — under your own key.
Which programming languages can it map?23 languages. Full-fidelity (scope-aware, cross-file call and import resolution) for TypeScript/JavaScript incl. JSX/TSX, Python, Go, Java, Kotlin, PHP, Swift, and R; symbols plus call edges for Rust, C, C++, C#, Ruby, Scala, and more. An opt-in LSP pass (rust-analyzer, clangd, gopls, pyright, tsserver) adds precise edges.
If my team shares a repo, do we each build our own graph?Yes — graft/ is a per-developer local cache and is gitignored automatically. You commit only the small wiring init wrote (.claude/, AGENTS.md, MCP config); each teammate runs graft build once to generate their own graph.
Will the graph go stale while I'm editing code?No — every query first refreshes the graph against your working tree, which is structural and free (~3ms when nothing moved), and it sees uncommitted, unstaged, and staged edits alike. Builds are cached by content hash, so re-running only touches changed files; graft check is a local freshness signal.
What's actually inside one of these graph nodes?A single markdown file: a model-written plain-English summary of what the code does, the 'crux' lines that carry the logic, the exact source files tracked by content hash, and typed [[wikilinks]] to other nodes (depends-on, part-of, uses). Anything you write below the generated block is preserved across regenerations.
How much faster and cheaper does it make agents, really?In the project's 162-run benchmark: 42% fewer tokens, 46% fewer tool calls, 60% lower latency at equal correctness. On SWE-bench Verified (50 instances, same Claude Sonnet 5) it solved 33 vs cold Claude Code's 27, with 23% fewer tokens and 32% less wall-clock time.
What can I do with it beyond wiring up Claude Code?It runs as an MCP server for any MCP-capable agent. The CLI offers graft ask, grep, callers, skeleton, and map for search and orientation, graft viz to visualize the graph, and graft build --deep for per-symbol summaries. Push mode (context up front) favors speed; pull mode traded speed for 98% correctness in their sweep.
Creator
trailhq
Size
76.7 MB
Stars
11.6K
Updated
CommitNov 19
Age
5mo
Commits · 90 Days