Repository navigation
Connect to Trail Cloud at the moments trail is used - #708
Conversation
🌱 graft blast radius5 areas changed → 9 areas can be affected. 35 dependent symbols, depth 2. flowchart TB
A0(("Session Management<br/>13 symbols"))
A1(("Host Configuration<br/>8 symbols"))
A2(("Tool Invocation<br/>3 symbols"))
A3(("Installation Process<br/>3 symbols"))
A4(("Note Management<br/>2 symbols"))
AX(("4 smaller areas<br/>6 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 — 3 people across 14 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 35 dependent symbols, grouped by areaSession Management — 13 symbols in 10 files
Host Configuration — 8 symbols in 8 files
Tool Invocation — 3 symbols in 1 file
Installation Process — 3 symbols in 3 files
Note Management — 2 symbols in 2 files
Telemetry Tracking — 2 symbols in 2 files
Upkeep Process — 2 symbols in 2 files
CLI Skills — 1 symbol in 1 file
Learning Sessions — 1 symbol in 1 file
Test signal per changed area — 2 ✓ · 1 ⚠ · 1 ✗ · 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.
76 test suites also reference this code78 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 the code that changed, and the line that reaches it. |
…kspace # Conflicts: # src/cli.ts # src/cloud/workspace-sync.ts
0.28.0 rather than 0.27.1: #708 adds behaviour (learnings before an edit, a check before commit/push/PR, several workspaces per laptop), not just the npx fix. Release notes describe both in plain words. Also: logout --workspace of the last workspace now removes Cursor's workspace entry too, as plain logout does.
… npx sign-in (#709) * fix(login): agents get Trail's tools after a sign-in run through npx; release 0.27.1 `npx -y @trailhq/trail-code login --code` on a laptop without trail wrote Claude Code, Cursor and Codex entries with `"command": "trail"`. Under npx, trail is on PATH only for that process (npx's temporary node_modules/.bin), so trailOnPath() said yes. Agents start with the person's PATH and got no tools. commandOnPath now skips node_modules/.bin folders, so those laptops get the npx launch. Verified end to end: a fresh sandbox laptop with no trail ran the page's prompt in Claude Code, and a new session got all 6 workspace tools. * chore(release): 0.28.0, with Anirudh's #708 0.28.0 rather than 0.27.1: #708 adds behaviour (learnings before an edit, a check before commit/push/PR, several workspaces per laptop), not just the npx fix. Release notes describe both in plain words. Also: logout --workspace of the last workspace now removes Cursor's workspace entry too, as plain logout does. * learning: an agent with no Trail tools on a busy machine isn't proof the sign-in broke * Commit check warns instead of stopping, and runs in Claude Code's hooks As asked: until trail check's matching improves, a conflict before commit/push/PR is a warning. The hook adds additionalContext with no permission decision, so the command runs and Claude reads which learning it goes against. SHIP_CHECK_STOPS turns the once-per-conflict stop back on. Two bugs found testing it in a real Claude Code session: - The check only ran with TRAIL_INVOKED_AS=trail, which Claude Code's hooks never have. It now also runs in a repo wired for trail, as the other hooks decide. - `git -C dir push` and `git -c k=v commit` weren't seen as a commit/push. Verified: a real session committed against a learning; the commit ran and Claude quoted the warning and recommended reverting. --------- Co-authored-by: Shrish Dwivedi <shrish@nanonets.com>
Trail now acts at the moments a session needs it, instead of waiting for Claude to run a trail command, which it often doesn't. In a plain assign session on 2026-10-27, Claude answered with grep and never ran trail, so the sign-in link never showed. A laptop can also link each repo to its own Trail workspace.
Moves:
connect, Trail Cloud sign-in links shown → linked, trail only. It's read in PostHog DB 11:On 2026-10-27 that was 0 nudge links shown in the last 30 days (
mode: nudge). Metabase wasn't reachable when this PR opened, so that figure is from earlier the same day. The link is still off unlessTRAIL_CLOUD=1.Trail at a session's moments
pre-edithook hands Claude the learnings on that file. Until now they arrived after the edit.hooks.tshandlePreEdit,settings-merge.tsgit commit,git push,gh pr createtrail checkand stops the command once per set of conflicts. Claude fixes it, or says why and runs the same command again, which goes through. It's capped at 3.5 s and fails open.pre-bash-check.ts(new),pre-bash.tsoverrode: a check conflict that shipped anyway asks for a replacing learning. Deploy and CI steps that failed then passed (docker, kubectl, terraform, helm) now count as fixes. A check run with a folder flag (go -C backend test,npm --prefix web test) counts too, and the sign was missed without it.note-signals.tstrail askwhen starting from a ticket and after a test fails, and that learnings arrive before an edit.skill-template.tsnudge.tshookNotice,linkedNews,prompt-hook.tsOne repo, one workspace; a laptop can have several
cloud.jsonholds one connection per workspace (atrl_token each). trail-cloud already mints one per handoff, so it needs no server change.otherswhen it writes it back.cloudForRepo). Sync, the activity outbox,recordLookup,recordSkillUse, the MCP connector (by its cwd),teamandstatusall look up the repo's workspace first.trail workspacelists every workspace.workspace add --to <slug>picks one.logout --workspace <slug>drops one.trail checkconflicts on this branch: word matches, not realtrail checkflags 4 lines. Each matches a learning's ruled-out words without doing what the learning ruled out:src/claude/note-signals.ts:83: the check pattern. It doesn't match failing and passing runs by full command string.src/claude/note-signals.ts:318: the overrode sign. It filters nothing out oflistNotes.src/cli.ts:75: an import line.src/cli.ts:2241:logout. It doesn't touch pair reviews or replaced learnings.The new commit check would stop the first commit here for these. That's worth deciding on before release: it could warn instead of stop until the check's matching improves.
Tested
test/trail-workspaces.test.ts: the store, routing, an old-format file, logout of one, and uses per workspace.test/trail-scenario-hooks.test.ts: before-edit wording, the commit check once per conflict set, overrode, deploy fixes, folder-flag checks, and the hook notice.trail-nudge.test.tsupdated for the per-repo link.mainon this machine (graft-to-trail, hosts-trail, upkeep-hooks).apply.goand showed the link. The link connected Acme, and 14 items uploaded.go -C backend testfailed and then passed. The Stop hook asked to save, and Claude said the existing learning already covers it.🤖 Generated with Claude Code