trailhq / Trail-Code
git clone https://github.com/trailhq/Trail-Code.git
Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.
+47
stars, 24h · #313
+~329
stars, 7 days · #393
+~1.4k
stars, 30 days · #378
11k
★ total · +3% this week
937
forks · 247 open issues
Star history (as recorded here)
LanguageTypeScript
LicenseMIT
Created2026-07-03 (3mo ago)
Last pushtoday
Watchers38
OwnerOrganization
GitHub topics
ai-agentsanthropicclaude-codeclicode-graphcodexcontext-engineeringcursordeveloper-toolsgeminiknowledge-graphllmmcpmcp-serveropen-sourceopenaitree-sitter
Links
- GitHub: github.com/trailhq/Trail-Code
- Homepage: https://trailhq.com/graft
- Releases · Issues · Hacker News mentions
README excerpt
### 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%)** | [code] > [!NOTE] > **Graft is now Trail-code.** Graft lives on as the graft map, and every `graft` command 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 - How it works - Quick start - Part 1: The graft map, your code - Part 2: Learnings, what you, your agents and your team know - Four kinds, three places · One decision, two teammates · A learning is a file · Your agent does the saving - Your team - What stays on your machine - Benchmark · SWE-bench Verified · Tested on popular repos - FAQ - Refere