Skip to content
Unofficial community docs. Content pulled on 2026-10-24 from Trail-Code@d205ac3. For the latest, see the official repo.

Integrate with Claude Code

Claude Code gets the deepest setup: hooks, statusline, and learnings with every prompt.

  1. Run init for Claude Code

    Terminal window
    trail init --agents claude

    Claude Code is pre-selected in the regular trail init picker too. --agents claude wires Claude Code alone, with no prompt.

  2. Commit the setup

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

    trail init writes the MCP server into the project’s .mcp.json. Restart Claude Code to load it.

  3. Start a Claude Code session

    From then on, any Claude Code session opened in the repo gets the features below.

  • A live statusline: the graft map’s size, how many learnings the repo has, and a ⚠ N stale warning when the code has moved ahead of the map.
  • Auto-sync: every query brings the graph up to date first, so an answer always describes the code as it is right now, uncommitted edits included. A query refreshes only what it reads; the markdown under graft/ is refreshed by the background rebuild at the end of a turn that touched code. Both are structural and $0; auto-sync never calls the LLM on its own.
  • Context on tap: each prompt pulls in the matching nodes and the learnings left on that code; editing a file surfaces what depends on it (“blast radius”); new sessions start with the repo map and how many learnings there are.
  • Learnings when you ask: say “save this as a learning” and Claude saves one; it never asks to on its own.
  • Overlap with teammates: at session start, and every few minutes, it reads what teammates’ open branches change, skipping any already merged or closed; when Claude edits a function or constant one of them also changes, it reads their change and tells you whether the two clash.

The post-edit hook: editing node-file.ts prints its blast radius (who depends on it) inline, the statusline flips stale → syncing → synced on its own, and the same dependents light up in the viewer
edit a file → blast radius appears inline → graph auto-resyncs → confirmed in the viewer

trail init writes its own skill file, .claude/skills/trail/SKILL.md, and never touches your CLAUDE.md. The committed skill file is also how a teammate without Trail-code installed gets your learnings: it tells their agent where .trail/learnings/ is, to read it before exploring, and to tell them once how to install the rest.

trail init is idempotent and never clobbers your existing .claude/settings.json: it merges its blocks and leaves the rest alone. A statusLine that is not Trail-code’s is left untouched; re-running init refreshes Trail-code’s own helper command if it is already installed.

Pass --no-statusline (or set GRAFT_NO_STATUSLINE=1) to skip installing one at all, since a project-level statusLine would otherwise hide a custom one in ~/.claude/settings.json.

Want the LLM summaries too? Run trail build --deep (with a key) whenever you like; auto-sync will never do it for you. See Enable deep mode.