Trail-Code
Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.
- 10.7k estrellas
- 949 forks
- 243 issues abiertos
- Lenguaje: TypeScript
- Licencia: MIT
- actualizado
Instalación
git clone https://github.com/trailhq/Trail-Code{
"mcpServers": {
"trail-code": {
"command": "node",
"args": ["/path/to/Trail-Code/dist/index.js"]
}
}
}{
"mcpServers": {
"trail-code": {
"command": "node",
"args": ["/path/to/Trail-Code/dist/index.js"]
}
}
}- Run the command above in your terminal (Claude Code), or paste the JSON config into claude_desktop_config.json (Claude Desktop).
- Replace any <placeholder> values with your API keys or paths.
- Restart Claude. The MCP server and its tools appear automatically.
Clone https://github.com/trailhq/Trail-Code and follow its README for install instructions.
Resumen de MCP Servers
The self-learning context layer for coding agents.
Trail-code gives Claude Code, Cursor, Codex and other coding agents a map of your code, and what your team has learned about it.
| Code map (previously graft) | Learnings | |
|---|---|---|
| What is it? | An index of your code: every function and who calls it, so your agent sees what a change can break | What you, your agents and your team have learned and decided |
| What does it do for your agent? | Takes it straight to the right files | Lets it pick up where you and your team left off |
| Where does it come from? | Your code, read on your machine | Your conversations, as you work |
46% fewer tool calls, 60% less time, and more real issues solved.
| Cold agent | Agent with the graft map | |
|---|---|---|
| Tool calls, 162 runs | baseline | 46% fewer |
| Uncached input tokens, 162 runs | baseline | 42% fewer |
| Time, 162 runs | baseline | 60% less |
| SWE-bench Verified, 50 real issues | 27 solved (54%) | 33 solved (66%) |
npm install -g @trailhq/trail-code && trail initNote
Graft is now Trail-code. Graft lives on as the graft map, and every
graftcommand still works. What's new is learnings. What changed
What changes in your agent
| Without Trail-code | With Trail-code |
|---|---|
| Greps and opens file after file to find the code it needs | Gets the right files and functions with your prompt |
| Re-explores code a teammate already figured out last week | Starts from their learning: what they decided, what they ruled out, what to watch out for |
| Undoes a teammate's decision, because it never knew about it | trail check flags it before the PR, quoting who decided it and why |
| Finds out at merge time that a teammate changed the same code | Says so right after it edits code a teammate's open branch also changes, and whether the two clash |
| Has to be told the same things every session | Starts from what you've told it before: trail init finds what you said more than once in your past sessions |
| You write and update CLAUDE.md by hand | Learnings are saved from your conversations, in files you can read |
Same model, more tasks solved. On SWE-bench Verified (real GitHub issues, graded by the maintainers' own tests), Claude Sonnet 5 solved 33 of 50 issues with the graft map and 27 of 50 without it, using 23% fewer tokens. Details
Cheaper and faster. Across 162 runs of the same agent on the same tasks: 32% lower cost, 42% fewer uncached input tokens, 60% less time, and the same share of correct answers. On PocketBase, 15 real tasks ran 21% cheaper and 14% faster. Details
Contents
Part 1: The graft map, your code
Part 2: Learnings, what you, your agents and your team know
Reference: How the graph gets built · Supported languages · What's in a node · What runs where · Agent integration · CLI · Search & orient · Monorepos · Visualize it · Development
How it works
Trail-code has two parts. Both run on your machine.
The graft map: your code.
trail initparses your repo with tree-sitter into a map of every file, function and who calls what. No model, no API key. It refreshes itself when the code changes, uncommitted edits included. Your agent gets pointers to the matching files and functions with each prompt, and sees what depends on a file right after it edits it.Learnings: what you, your agents and your team know. When a session works something out, or you correct how something is done, your agent saves it as a learning. The next session on that code, yours or a teammate's, starts from it instead of digging again. Learnings about the code are committed with the code; learnings about you stay on your machine. On day one,
trail initstarts you off with what you told Claude more than once in your past sessions, and what reviewers flagged on more than one of the repo's merged PRs.
The graft map tells your agent where things are. Learnings tell it why they are that way, and how the work gets done here.
Quick start
npm install -g @trailhq/trail-code # install the CLI, once
trail init # in your repo: build the graft map, set up .trail/, wire your agentsThat is the whole setup. trail init asks which of your coding agents to wire up, builds the graft map from your code, creates .trail/ for the repo's learnings, and adds a statusline and hooks to Claude Code. It also reads your past Claude Code sessions in the repo, once, for what you told Claude more than once, and saves those as learnings. Your own Claude Code does that reading, in about a minute. Then work the way you always do. No daemon, no server, nothing to babysit: it is all files.
Commit the setup so your teammates get it too. The graft map itself, in graft/, is a local cache like node_modules and is added to .gitignore, so it stays out of the commit:
git add .claude .mcp.json .trail .gitignore .ignore && git commit -m "set up Trail-code"Teammates' Claude Code reads the learnings in .trail/ even before they install anything, and tells them once how to get the rest.
trail init --dry-run shows the agent wiring it would write; trail init --agents claude wires Claude Code alone.
Coming from graft?
Nothing breaks. The code map you know is now called the graft map, and it is one of Trail-code's two parts.
| Before | Now | |
|---|---|---|
| Name | graft | Trail-code |
| The code map | graft | the graft map (same thing) |
| Command | graft | trail (graft still works) |
| Package | @nanonets/graft | @trailhq/trail-code (the old one still works) |
| Learnings | None | New, see Part 2 |
graft and @nanonets/graft run the same code as trail, and print what they always printed.
Already have graft? graft upgrade adds the trail command next to it.
Lo que la gente pregunta sobre Trail-Code
¿Qué es trailhq/Trail-Code?
trailhq/Trail-Code es mcp servers para el ecosistema de Claude AI. Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase. Tiene 10.7k estrellas en GitHub y su última actualización registrada es del 2026-10-23.
¿Cómo se instala Trail-Code?
Puedes instalar Trail-Code clonando el repositorio (https://github.com/trailhq/Trail-Code) o siguiendo las instrucciones del README en GitHub. ClaudeWave también te ofrece bloques de instalación rápida en esta misma página.
¿Es seguro usar trailhq/Trail-Code?
Nuestro agente de seguridad ha analizado trailhq/Trail-Code y le ha asignado un Trust Score de 100/100 (tier: Verified). Revisa el desglose completo de comprobaciones superadas y flags en esta página.
¿Quién mantiene trailhq/Trail-Code?
trailhq/Trail-Code es mantenido por trailhq. La última actividad registrada en GitHub es del 2026-10-23, con 243 issues abiertos.
¿Hay alternativas a Trail-Code?
Sí. En ClaudeWave puedes explorar mcp servers similares en /categories/mcp, ordenados por popularidad o actividad reciente.