Find your next open-source project

Search by name, purpose, or keyword, or paste a GitHub URL. Start with / to search agent skills (e.g. /pdf)

trailhq/Trail-Code

Developer ToolsCoding agents

Builds a local code graph and saves team decisions as files so Claude Code, Cursor and Codex start each task with context.

11,650
1,046
TypeScript
MIT
5 months old

What it does

Trail-code is a local context layer for coding agents such as Claude Code, Cursor and Codex. It has two parts. The graft map parses the repository with tree-sitter into a graph of files, functions and callers, so an agent gets pointers to the relevant code and the blast radius of an edit instead of grepping blind. Learnings are short Markdown files recording what you or a teammate decided, ruled out or found risky, committed with the code so the next session starts from it rather than rediscovering it.

The structural map needs no model and no API key; it runs on your machine. An optional deep build adds LLM-written summaries through your own provider key. The project is MIT licensed and the CLI is published as @trailhq/trail-code.

Quick start

You need Node 22.3 or newer (20.16 also works), a repo and a supported agent. Then:

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

trail init builds the graft map, creates .trail/ for repo learnings, and wires the agents you select. For Claude Code it also adds hooks and a statusline. If the team option is chosen, commit the setup so teammates inherit it:

git add .claude .mcp.json .trail .gitignore .ignore && git commit -m "set up Trail-code"

The generated graft/ map is a local cache and is gitignored. trail init --dry-run previews the files that would be written.

Day-to-day use

Agents get matching nodes and learnings on each prompt automatically. When you want to record a decision, ask the agent to "save this as a learning" — it is never saved without your request. Before a PR, trail check compares changed files against repo learnings and quotes the conflicting decision. Without an agent, the CLI works directly, e.g. trail ask "<task>", trail grep "<regex>", trail map, trail callers <symbol> -d 3, and trail viz for a local interactive graph.

Constraints and data handling

  • Supported agents include Claude Code, Cursor, Codex, Gemini CLI, GitHub Copilot, Windsurf and others; any MCP-speaking agent is served through the same MCP server. Claude Code gets the deepest integration.
  • Tree-sitter coverage spans 28 languages plus Vue, Svelte and Astro components; unlisted languages are skipped. Bash call edges and extensionless shell scripts are not supported.
  • trail init reads your past Claude Code transcripts and recent merged-PR review comments once to seed learnings. That reading runs through your own Claude login and counts toward your usage.
  • Wiring removal is not additive: selecting a subset of agents removes Trail-code's wiring for the others, including user-level files unless --no-global is passed.
  • Personal learnings stay in ~/.trail; repo learnings travel via git. Nothing goes to Trail's servers unless you connect the (coming) team workspace.

HotRepo's take

The repo appeared once on the TypeScript daily list on 2026-12-05, at position 10 with 24 new stars, and is not recorded on the all-language daily list. The README makes unusually specific performance claims — 46% fewer tool calls and 60% less time in a 162-run harness, and 33 of 50 SWE-bench Verified issues solved versus 27 — but these are the project's own measurements on its own harness, so they describe the tested setup rather than a guarantee for your codebase. The practical differentiator is the learnings-as-committed-files design: decisions become reviewable artifacts in the PR, not opaque memory inside a tool.

Project source and documentation

Written by AI from the project's public information and HotRepo's records, updated . The project's own docs are the source of truth.

You might also like

  1. Graphicle-AI/graphicleA local code graph plus project memory that serves cited excerpts to coding agents over MCP.Rust356
  2. KenKaiii/gg-frameworkA desktop coding agent and TypeScript framework that connects to existing AI subscriptions and adds local code search.TypeScript191
  3. wshobson/agentsA cross-harness catalog of coding agents, skills and commands so one set of prompts works across Claude Code, Codex, Cursor and others.Python43,061
  4. zeronsh/zeronA local control plane that lets you run, inspect and sync multiple coding agents from one desktop or headless app.Rust3,395
  5. flyhero/antumiA desktop workbench that orchestrates multiple coding agents, tracks quota, and delegates tasks across them while keeping existing CLI logins.TypeScript869