Repository navigation
trail: teammate install offer and init learnings picker - #611
Conversation
🌱 graft blast radius5 areas changed → 8 areas can be affected. 24 dependent symbols, depth 2. flowchart TB
A0(("Claude Session State<br/>9 symbols"))
A1(("Host Integration<br/>6 symbols"))
A2(("MCP Tool Invocation<br/>3 symbols"))
A3(("Telemetry Tracking<br/>2 symbols"))
A4(("Ask Formatting<br/>1 symbol"))
AX(("3 smaller areas<br/>3 symbols"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0,A1,A2,A3,A4 reached;
classDef tail fill:#EEF2F3,stroke:#9AA4A9,stroke-width:1px,color:#3A4247;
class AX tail;
Who knows this code — 4 people across 13 areas
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no All 24 dependent symbols, grouped by areaClaude Session State — 9 symbols in 7 files
Host Integration — 6 symbols in 6 files
MCP Tool Invocation — 3 symbols in 1 file
Telemetry Tracking — 2 symbols in 2 files
Ask Formatting — 1 symbol in 1 file
Cloud Nudge — 1 symbol in 1 file
Wiring Rewrite — 1 symbol in 1 file
Workspace Ask — 1 symbol in 1 file
Test signal per changed area — 4 ✓ · 1 –Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
29 test suites also reference this code30 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
Moves:
learnings_committed, the number of clones whose committed learnings went up in the last 7 days. The PostHog query is indaily/project.md. I didn't check its value today: this session has no Metabase access. A direct signal for the init half iscold_startevents withoutcome = no_claude, which should drop.All the trail CLI work for 0.22.1 in one PR. #612 and #614 were folded in here.
Teammates who clone without trail
Once a team commits
.trail/, a teammate who hasn't installed trail should be offered it rather than left with silent hooks..trail/learnings/with their authors and tells Claude to read the ones that bear on the task. When one shapes a reply, Claude ends it with a credit line, e.g. "📝 Used Rushabh's learning on the auth refactor: skipped the session-token approach he already ruled out." After that first credit, and only then, it adds once: "Install trail to get this on every task, plus search and checks. Want me to set it up?" Only on a yes does it runnpm install -g @trailhq/trail-codeandtrail init --no-agents. When no learning applies, it says nothing about trail. The shim is plain Node, so this works with nothing installed. The skill says the same for agents that read the skill instead.trail checkflags edits to a teammate's learning. A branch that changes someone else's file in.trail/learnings/gets a finding. The check reads that learning as it was before the branch.ask's savings line, andtrail note's output. The cutoff isTOKEN_CREDIT_FLOORinsrc/notes/notes.ts. Lines with no token count, such as the end oftrail initand the daily uncommitted reminder, say 3x. Both 80k and "3x" are picks: nothing measures them yet.trail init
trail initreads the repo's past Claude sessions by running Claude Code headless, and it only looked forclaudeon PATH. Someone who uses Claude Code only through the VS Code or Cursor extension has noclaudeon PATH, so init skipped their sessions without a word and saved no learnings. Someone on the PA team hit this on airflow-dags.claudeBin()insrc/notes/cold-start.tsnow looks in this order:claudeon PATH~/.local/bin/claude, then~/.claude/local/claudeanthropic.claude-code-*/resources/native-binary/claudeunder~/.vscode,~/.cursor,~/.vscode-insidersor~/.windsurfThe read runs whichever it finds. When there's none, init stays quiet as before.
A failed read never marked the repo as read, so anyone who hit this gets their learnings by running
trail initagain once this ships.Each learning says how many sessions it came from. From rushabh's 13 Oct suggestion for init's opening ("you've corrected claude 6 times about using pnpm, not npm"):
You tick which learnings to keep. The other half of the same suggestion ("you can tick the ones to keep. claude will follow them from the first prompt"). On a terminal, once the read finishes, init shows what it found, all ticked, in the same picker as the agent choice (↑↓ move, space toggle, a all, enter confirm, esc cancel):
Only the ticked ones are saved, and init reports "kept 1 of the 2 things…". Esc saves none and leaves the repo unread, so the next
trail initasks again. A run without a terminal, or with--yes, keeps them all as before, so an agent running init isn't blocked.cold_startalready hadoffered_bucketandpicked_bucket;picked_bucketnow counts what the person kept, andoutcomegainscancelled(inTELEMETRY.md).trail init also reads PR review comments
From rushabh's 13 Oct ask for init's opening, e.g. "PR reviews keep flagging missing error handling in /api". (Was #614.)
gh api graphqlcall fetches review summaries and inline comments on the repo's last 50 merged PRs. It runs only when the repo has a GitHub remote andgh auth tokensucceeds; otherwise it's skipped quietly, the same way init stays quiet when it can't find claude.scrub()runs on every comment before it reaches Claude, and no logins are sent.verify()asplaceQuotes..trail/learnings/, ending with "Flagged in review on N PRs here (fix: unique node ids, UTF-16 read coherence, clearer ambiguous-callers messaging #41, Added Dart & Kotlin support #38), most recently on Oct 10.".trail/learnings/already holds review learnings from a teammate, so the same reviews don't create duplicates. It also runs for repos that move from graft to trail at session start.cold_startgainssource(sessions/reviews) andreviews_bucket, plus the outcomesno_reviewsandno_gh.TELEMETRY.mdand the README's "What stays on your machine" section are updated.Tests
trail-check-learning-edits, the offer cases inclaude-shim-resolve, and the 80k cutoff intrail-cold-startandtrail-prompt-notes.claudeBincases intrail-cold-start: it usesclaudeon PATH, picks the newest extension copy across VS Code and Cursor (2.1.296 over 2.1.289 over 2.1.99), prefers a standalone install, and skips an extension folder without the binary.trail initend to end: the list showstold Claude in 2 sessions:before each title.finishPastReadsaves only what was kept and marks the repo read; cancelling saves nothing and leaves it unread.--version(2.1.289).trail-pr-reviews: comment filtering and scrubbing, keeping only findings on 2+ PRs, end-to-endtrail initwith a fakeghandclaude,ghmissing or signed out, no GitHub remote, and keeping or cancelling review findings.🤖 Generated with Claude Code