trail-code is an MCP server that builds a tree-sitter-parsed map of a codebase and stores persistent learnings as markdown files, so coding agents get relevant files and prior context with each prompt. It works from a single npm global install with an init command, and its core code map requires no model or API key.
Project overview
It addresses the repeated cost of coding agents starting each task blind by combining a deterministic, tree-sitter-built code map with reusable team learnings, aiming to cut tool calls, tokens, cost and time while improving correctness.
Project type
MCP · AI Coding
Use cases
Coding & Development
Deployment
Refer to project documentation
License
MIT
Best for
Developers who use coding agents and want the agent to stop re-exploring the codebase and forgetting past session and team decisions.
Teams looking to cut coding-agent tool calls, tokens, cost and time while improving correctness via a persistent code map and learnings.
Key capabilities
Builds a tree-sitter-parsed graph of every file, function and caller, refreshed as code changes, so agents get the right files with each prompt.
Saves what you, your agents and your team work out as markdown learning files in .trail/, reused by later sessions.
Compares branch changes against repo and personal learnings, flagging conflicts before the PR.
Limitations and risks
trail build --deep summaries require an optional model provider (OpenAI-compatible, Anthropic, or gateway) under your own key, so this path involves external calls and a data boundary outside your local machine.
Telemetry is optional; verify its settings if data collection matters for your environment.
Getting started
Install globally with npm install -g @trailhq/trail-code, then run trail init; the README states 'That is the whole setup.'
Evidence and sources
GitHub project description: One shared memory for every coding agent on your team. Claude Code, Cursor and Codex get a map of your code and your team's past decisions, so they pick up where you left off.
README: Without a map, your coding agent starts every task blind. It greps a term, opens a file, follows an import, backs out and tries again
README: The graft map resolved **33 of 50 instances** against cold Claude Code's 27, with 25% fewer tool calls, 23% fewer tokens and 32% less wall-clock time.
README: `trail init` parses your repo with tree-sitter into a map of every file, function and who calls what. No model, no API key.
README: Trail-code keeps what your agent works out as **learnings**, saved from your conversations as you work. The next session starts from what you, your agents and your team already kn…