---
slug: "trail-code"
name: "Trail-code"
effect: "Builds a tree-sitter code map of your repo and serves it, plus saved team learnings, to coding agents"
category: "devtool"
tier: "rising"
url: "https://trailhq.com/graft"
github: "trailhq/Trail-Code"
pricing: "open-source"
license: "MIT"
tags: ["code-graph", "tree-sitter", "mcp", "context-engineering", "team-memory", "cli"]
platforms: ["claude-code", "cursor", "codex", "gemini-cli", "windsurf", "any-mcp-client"]
install_kind: "cli"
date_added: "2026-10-20"
rank: 11
rising_score: 62
stars: 10476
star_velocity: 96.2
velocity_basis: "since creation"
created_at: "2026-07-03T13:44:21Z"
pushed_at: "2026-10-19T16:29:21Z"
signals_status: "ok"
signals_fetched_at: "2026-10-20T11:40:36.348Z"
page: "https://agenttooldrop.com/tools/trail-code"
---

# Trail-code

Builds a tree-sitter code map of your repo and serves it, plus saved team learnings, to coding agents

Category: Devtools. Tier: new and rising, rank 11 by new and rising score (62 of 100). Pricing: Open source. License: MIT.

Platforms: claude-code, cursor, codex, gemini-cli, windsurf, any-mcp-client.

## Why you would want it

trail init parses your repo with tree-sitter into a map of files, functions and who calls what, with no model or API key, and refreshes it when the code changes. It registers an MCP server with six tools (trail_find_code, trail_file_api, trail_trace_calls, trail_find_all, trail_repo_map, trail_check_freshness), and in Claude Code adds hooks that put matching files into each prompt and show what depends on a file after an edit. Agents can also save decisions as markdown learnings in .trail/learnings/, committed with the code, and trail check compares a branch diff against them.

## Best for

- Giving agents a call graph of a large repo
- Blast-radius checks after edits
- Sharing team decisions through git

## Use it when

You want Claude Code, Cursor, Codex or another MCP agent to find the right code and see what depends on it without repeated grepping. It also fits teams that want agent-saved decisions kept in the repo and checked before a PR.

## Skip it if

trail init writes hooks, a statusline and MCP entries, and by default also edits user-level files such as ~/.claude/settings.json and ~/.codex/config.toml (skip with --no-global). It reads your past Claude Code sessions and, when gh is signed in, review comments on the last 50 merged PRs to seed learnings, and it sends anonymous usage stats unless you run trail telemetry disable; the optional trail build --deep calls the model provider you choose with your own key. The README marks the team workspace, skills and guardrails as coming soon, and the repo is about three months old.

## Editor note

Formerly graft; the old package @nanonets/graft and the graft command still work. No GitHub releases are published; the package is on npm.

## Install

Install the CLI with npm, then run init in your repo:

```sh
npm install -g @trailhq/trail-code   # install the CLI, once
trail init                      # in your repo: build the graft map, set up .trail/, wire your agents
```

Source: https://github.com/trailhq/Trail-Code#quick-start

## Live signals

Fetched 2026-10-20T11:40:36.348Z (status: ok).

- Repository: trailhq/Trail-Code
- Repository created: 2026-07-03
- Stars: 10,476 (GitHub's count; it cannot be authenticated)
- Stars per day, since repo creation: 96.2 (an average over the repo's life, not a growth rate)
- Forks: 921
- Open issues and PRs: 273
- License (GitHub): MIT
- Last push: 2026-10-19
- Latest release: none

## Links

- Website: https://trailhq.com/graft
- GitHub: https://github.com/trailhq/Trail-Code
- Install instructions verified at: https://github.com/trailhq/Trail-Code#quick-start
- Source for this entry: https://github.com/trailhq/Trail-Code#readme
- AgentToolDrop page: https://agenttooldrop.com/tools/trail-code
- Full catalog (JSON): https://agenttooldrop.com/tools.json
