Skip to content

Trail-code

A code map and shared learnings that help coding agents like Claude Code find the right files faster.

Stars
11k
Forks
981
Licence
MIT
Language
TypeScript
Last update
4 days ago
Type
Dev tool

What it is

Trail-code is a command-line tool that builds an index of your codebase, mapping files, functions and which code calls what. It also saves notes on decisions and lessons from your work, so coding agents such as Claude Code, Cursor and Codex start with that context instead of searching from scratch. The README says both parts run on your machine.

  • Run trail init in a repo to build a map of files and functions for your agent
  • Have the agent check a planned change against what depends on the code it touches
  • Record a team decision so a later session or teammate's agent does not undo it
  • Check whether a teammate's open branch changes the same code you are editing

Great for

  • Developers who use Claude Code, Cursor, Codex or similar agents on a medium or large repository
  • Teams who want agents to remember past decisions about the same code
  • Developers who want fewer tool calls and lower token use from their agent

Not ideal for

  • People who do not use coding agents, since the main value is in agent integration
  • Projects that need a fully specified, audited benchmark: the performance figures come from the maintainers' own tests and are not independently verified in the README
  • Users on older Node versions, because the README requires Node 22.3 or newer
Step-by-step guide: how to use Trail-codeInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js 22.3 or newer (20.16 is noted as working too)

    Install the CLI globally

    npm install -g @trailhq/trail-code

    Build the map and set up the repo

    trail init
  2. 2

    Run it

    • Install the CLI with npm install -g @trailhq/trail-code
    • In your repo, run trail init
    • Answer which coding agents to wire up when asked
    • Start your agent and work as usual; learnings are saved from your sessions
  3. 3

    Get the most out of it

    • Use trail check before opening a pull request to see if a change conflicts with a recorded decision
    • Commit learnings about the code with the code so teammates get them
    • Read the graft map commands in the CLI section of the README for search and orientation
    • Use trail viz to visualize the graph, as described in the README

Downloads

Strengths

  • Index is built locally with tree-sitter and needs no model or API key, per the README
  • Learnings are saved as readable files in the repo
  • Maintainers report benchmark results with stated run counts, such as 162 runs and 50 SWE-bench issues

Trade-offs

  • Performance claims come from the project's own benchmarks and are not independently checked here
  • Setup wires hooks and a statusline into Claude Code, which some users may not want by default
  • Learnings depend on the agent saving them, so quality depends on the agent and the workflow

How it compares

ProjectStarsTypeLevelUpdatedBest for
Trail-Code (this)11kDev toolbeginner4 days agoDevelopers who use Claude Code, Cursor, Codex or similar agents on a medium or large repository
codebase-memory-mcp48kDev toolintermediate4 days agoDevelopers who use an MCP-capable AI coding agent on a large codebase
ECC295kDev toolintermediate4 days agoDevelopers who already use Claude Code and want a shared workflow for planning, testing and review
agentic-awesome-skills49kDev toolintermediate4 days agoDevelopers using Codex or Claude who want agent-chosen instructions for a project
agents42.1kDev toolbeginner4 days agoDevelopers who already use one of the listed AI coding tools and want ready-made specialist agents
code-review-graph32.6kDev toolbeginner8 days agoDevelopers who use an MCP-compatible AI coding assistant on a large repository

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.