← Back to Leaderboard
Ttrailhq

trailhq/Trail-Code

Local code graph and Git-shared memory for coding agents, accessible over MCP

Engineering Health (Methodology)
A · 87/100
Maintenance Activity
● Updated yesterday
Latest Release
Rolling commits (main)
Commercial License Check
MIT · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption21/25
Release Cadence11/20
License Clarity20/20
DockerMCPCLILocal AI1 README badge views (30d)
Total Stars
★ 11,599
24h Growth
+15
7d Growth
+83
Forks
1,039

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

trailhq/Trail-Code Star History (2026-07-14 - 2026-12-04) ALL-TIME STAR HISTORY (2026-07 – 2026-12) +11.6k in 143d · avg +81/day 12.2k 6.1k 0 2026-07-14: ★ 12026-07-25: ★ 112026-08-08: ★ 1,3632026-08-22: ★ 4,0082026-09-05: ★ 5,3972026-09-19: ★ 8,4932026-10-03: ★ 9,3512026-10-17: ★ 10,2672026-10-31: ★ 10,9482026-11-09: ★ 11,1442026-11-18: ★ 11,3132026-11-27: ★ 11,5162026-12-04: ★ 11,599 ★ 11.6k 07-14 09-23 12-04

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

Trail-code is a local TypeScript/Node.js CLI with an MCP tool interface and two separate stores. The graft map uses Tree-sitter to extract symbols, imports, and calls into linked Markdown under graft/. A query checks the working tree and rebuilds only what changed, including uncommitted edits. The map is disposable; durable decisions live in repository .trail/ files or personal ~/.trail/ files. A normal checkout needs neither a database nor a background index server.

The manifest includes tree-sitter-wasm and web-tree-sitter, Commander for CLI argument handling, and vscode-jsonrpc plus vscode-languageserver-protocol for optional language-server integration. Claude Code hooks can supply relevant code at prompt time and surface dependents after an edit. MCP clients can instead request targeted symbol and file context on demand. The manifest also includes Anthropic and OpenAI SDKs; the default parsing path does not require a model or API key.

Key Capabilities & Differentiators

Dedicated extractors provide scope-aware cross-file call and import resolution for TypeScript/JavaScript, Python, Go, Java, Kotlin, PHP, Swift, and R. The generic tier can emit symbols and name-matched call edges for languages such as Rust and C++; OCaml, Zig, GLSL, and Bash currently provide symbols without call edges. Vue, Svelte, and Astro script content goes through the TypeScript extractor. trail build --lsp can add more precise edges with language servers such as rust-analyzer, clangd, or gopls; --deep adds model-generated summaries under a configured provider key.

Agents can save corrections and decisions as learnings, and trail check can flag conflicts with recorded decisions before a PR. In a 162-run Claude Sonnet 5 benchmark across two repositories, upfront context cut mean cost from $0.0429 to $0.0292 and latency from 39.8 s to 15.8 s at 93% aggregate correctness, though one corpus lost three points. On-demand queries reached 98% correctness with less of the speed gain. A separate 50-issue SWE-bench Verified run solved 33 issues with the map versus 27 without it.

Trade-offs & Limitations

Compared with grep and a hand-maintained CLAUDE.md, the map reduces repeated navigation across files and lets decision notes be reviewed alongside code. In return, teams maintain agent wiring and need to curate what gets treated as durable guidance. Static edges are useful for narrowing an investigation, not proving impact: name matching can be ambiguous, coverage varies by language, and opt-in LSP resolution adds local dependencies and processing. Use compiler or language-server results and tests when validating a risky refactor.

Upfront context saves retrieval turns but spends prompt budget before the agent knows what it needs. On-demand MCP queries avoid that upfront payload at the cost of more retrieval turns. The benchmark favors different modes on different metrics and is not a workload-independent estimate. Local indexing removes hosted-model cost from the default map, not from the coding agent or optional summaries. Review session-derived learnings before committing them: repository notes are visible to anyone with a clone. Cross-repository team workspaces are planned, not a current substitute for centralized governance.

Hardware & Deployment Guide

The current quick start is npm install -g @trailhq/trail-code, then trail init from the repository. The supplied manifest still lists the legacy @nanonets/graft package and graft binary, with a Node.js engine range of ^20.16.0 || >=22.3.0. The naming transition preserves the old package and command; graft upgrade adds trail. No GitHub release is listed, so there is no release milestone to pin the migration to. Use trail init --dry-run to inspect proposed agent wiring, and --no-global to avoid changes to user-level files. In particular, narrowing --agents can remove Trail-code wiring for clients left off the list.

Commit the intended team configuration and .trail/ learnings, not the generated graft/ cache. Personal mode keeps setup out of Git; the core workflow requires no model key or dedicated GPU. Optional LSP indexing needs a supported server on PATH, while deep summaries need provider credentials. The Dockerfile targets the GitHub App, not routine CLI/MCP setup. It needs Git at runtime to fetch PR refs and separates dependency installation from the project build to avoid invalidating the grammar build layer on source edits.

Index storage: graft/ is a regenerable cache of linked Markdown nodes; queries refresh changed inputs, including uncommitted edits.
Resolution tiers: Language-specific extractors resolve scoped calls and imports; generic extractors use name matching, and some grammars emit symbols only.
Agent integration: Hooks supply prompt-time context and post-edit dependency information where supported; MCP tools provide on-demand lookup.
Memory boundaries: Repository learnings live in .trail/ for sharing via Git, while personal learnings stay in ~/.trail/.
Optional enrichment: trail build --lsp adds language-server-resolved edges; trail build --deep adds provider-generated summaries.
Benchmark trade-off: Across 162 runs on two repositories, push cut mean latency from 39.8 s to 15.8 s at the same 93% aggregate correctness; pull reached 98% with less of the speed gain.
Best For

Teams whose coding agents repeatedly trace cross-file dependencies and rediscover decisions already made in the same repository. Pilot on one representative repo, review the generated configuration and learnings, and compare push and pull on real tasks.

Skip If

Search and a small instruction file already suffice, or your rollout requires a complete compiler-accurate call graph, centralized cross-repository memory today, or no client configuration changes.

Reviewed on 2026-12-02 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

DockerMCPCLILocal AI
npm install -g @trailhq/trail-code && trail init

Comparison vs. Top Coding, Skills & MCP Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
Trail-Code ★11.6k+83TypeScriptMITLocal code graph and Git-shared memory for coding agents, accessible over MCP
graphify156.8k+2.4kPythonApache-2.0Local AST graphs for dependency tracing, with CLI and MCP access.
codebase-memory-mcp49.6k+335CMITA local code graph for tracing code, docs, and infrastructure via MCP.
taste-skill125.3k+2.9kJavaScriptMITAn agent skill for directing company website design and checking builds in a bro

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/trailhq/Trail-Code.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

trailhq/Trail-Code Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about Trail-Code

How does an agent get current code context and shared decisions?

The graft map indexes the local working tree and checks for changes before answering, so it can reflect edits that haven't been committed. Claude Code can receive prompt-time context and post-edit dependency information through hooks; MCP clients can query the map on demand with tools such as trail_find_code and trail_file_api. Repository learnings travel separately through Git.

Does local indexing require a GPU, and how should I size it?

No dedicated GPU or VRAM is required for the default Tree-sitter map. Size the local Node.js process for the amount of source being indexed, and measure the initial build separately from incremental refreshes. Optional LSP indexing adds language-server processes; trail build --deep uses the model provider you configure and can incur API charges. No fixed CPU or RAM sizing figures are available.

Can a company run and redistribute Trail-code under MIT?

The MIT license permits commercial use, modification, and redistribution, subject to retaining the copyright and license notice in copies or substantial portions. The core workflow runs locally without a dedicated Trail backend. Licensing is separate from data governance: review what enters committed .trail/ files, how session-derived notes are produced, and what any optional model provider receives.

When is Trail-code worth adding to grep, an LSP, and a hand-maintained `CLAUDE.md`?

Skip it if search already gets agents to the right files and your instructions rarely change. Trail-code is more useful when agents repeatedly trace callers across files or revisit decisions made in earlier sessions. Use the language server or compiler to validate type-sensitive references: Trail-code's static call graph varies in precision by language, even though optional LSP enrichment can fill some gaps.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining trailhq/Trail-Code? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature trailhq/Trail-Code on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare