Trail Code logo

Trail Code

Maps repository structure and team learnings so coding agents can find relevant code, understand impact, and retain decisions.

Install Trail Code

Pick your client, then add it in one click or paste the config.

No confirmed install command yet

We only publish a config when the install details come from the project itself — its README, its docs, or a verified owner. We haven’t found those for Trail-Code, and we’d rather show nothing than a guess you’d paste into your client.

Open setup steps on GitHub

Overview

Trail-Code gives Claude Code, Cursor, Codex, Gemini, and other coding agents a local map of a repository plus shared learnings about how the code works. It parses files, functions, and call relationships with tree-sitter, then points agents toward relevant code and affected dependencies. Learnings from agent sessions and team decisions are stored for reuse, with code-related knowledge committed alongside the repository. Use it when agents repeatedly rediscover code structure, lose prior decisions, or need earlier impact context before editing.

Use cases

  • Map a repository before making a cross-file change
  • Find functions and callers related to a coding task
  • Carry team decisions between agent sessions
  • Check edits against recorded implementation decisions
  • Visualize code relationships during repository orientation

Key features

  • Tree-sitter repository indexing
  • Function and caller relationship mapping
  • Automatic refresh for code changes and uncommitted edits
  • Persistent repository and personal learnings
  • Agent hooks and statusline setup
  • Change checks against team decisions

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked Today

Recent health check succeeded.

16/16 checks healthy over the last 10d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 10d ago via OSV.dev

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars11kStargazers on the source repository.
Last commitTodayMost recent push to the default branch.
Directory activity3 viewsConfig copies, upvotes, and views on AllMCPs.

How Trail Code works

What Trail-Code does

Trail-Code adds two forms of repository context to coding-agent workflows. The graft map represents the repository's files, functions, and caller relationships, helping an agent locate the code relevant to a request and see what may be affected by an edit. Learnings preserve decisions, corrections, implementation guidance, and other knowledge gathered during work.

The map and learnings address different questions. The map shows where code is and how it is connected; learnings record why the code has its current shape and how the team works with it. This is useful for repositories where agents repeatedly inspect the same areas or where teammates need to carry decisions between sessions.

How it works

Running trail init parses the repository with tree-sitter and creates the local .trail/ directory. The map is built on the developer's machine without a model or API key, and it refreshes as the code changes, including uncommitted edits. Agents receive pointers to matching files and functions with prompts and can see dependency context after changing a file.

Learnings can be created when an agent works out an approach or a developer corrects its behavior. Knowledge about the code is committed with the repository, while personal learnings remain on the local machine. Initial setup can also extract repeated guidance from earlier Claude Code sessions in the repository and repeated review feedback from merged pull requests.

Agent hooks and statusline integration are configured during initialization for Claude Code. The tool also supports wiring other listed coding agents during setup.

Setup and configuration

Install the CLI globally with npm, then initialize it from the repository root:

Terminal
npm install -g @trailhq/trail-code
trail init

The setup process builds the map, creates .trail/, asks which coding agents to configure, and installs the relevant agent integration. Trail-Code requires Node.js 22.3 or newer; Node.js 20.16 is also supported. If npm cannot write to its global directory, a user-owned npm prefix can be configured instead of relying on sudo.

Tools and capabilities

  • Build and refresh a repository-wide code map.
  • Locate files and functions related to a prompt.
  • Show callers, dependencies, and an edit's impact radius.
  • Save reusable learnings from coding sessions and corrections.
  • Check changes against recorded team decisions with trail check.
  • Search and orient through the repository with trail grep and trail map.
  • Visualize the repository context with trail viz.

Limitations and notes

Both the graft map and learning system run on the developer's machine. The map is derived from repository code, while learnings have different scopes: repository knowledge can be committed, and personal knowledge stays local. Trail-Code is designed for coding-agent workflows rather than as a general-purpose repository browser.

The project was previously called Graft. Existing graft commands continue to work, while Trail-Code adds the learning features. Setup reads prior Claude Code sessions in the repository once to identify repeated guidance, so teams should consider the local session data available to that process.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Trail Code

Trail-Code is an MCP server that connects coding agents to a local map of a repository and its recorded team learnings. Its main capabilities are building and refreshing the graft map, locating relevant files and functions, showing dependency impact, saving learnings, and checking changes against team decisions.

Install Trail-Code globally with npm and run `trail init` inside your repository. The command builds the code map, creates `.trail/`, asks which agents to configure, and installs the available agent integration. Node.js 22.3 or newer is required, with Node.js 20.16 also supported.

Yes, Trail-Code supports Cursor. Run `trail init` in the repository and select the coding agents you want to wire up during setup.

No, building the graft map does not require a model or API key. Trail-Code parses repository code locally with tree-sitter and refreshes the map as the code changes.

Trail-Code saves learnings from agent sessions and developer corrections for later sessions. Code-related learnings can be committed with the repository, while personal learnings remain on the local machine; `trail check` can flag changes that conflict with recorded team decisions.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewTrail Code AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/trail-code?style=directory)](https://allmcps.com/mcp/trail-code)
HTML Embed
<a href="https://allmcps.com/mcp/trail-code"><img src="https://allmcps.com/api/badge/trail-code?style=directory" alt="Trail Code on AllMCPs" /></a>