Skip to content

Commit trail's shared setup in Trail-Code - #725

Merged
shhdwi merged 5 commits into
mainfrom
claude/commit-trail-shared-setup-cdff56
Nov 8, 2026
Merged

shhdwi merged 5 commits into
mainfrom
claude/commit-trail-shared-setup-cdff56

Conversation

@anirudhkumar-nanonets

@anirudhkumar-nanonets anirudhkumar-nanonets commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Issue: a teammate who opens Trail-Code in Claude Code without trail is never shown the team's learnings, and 14 more learnings sat uncommitted on one laptop.
Why: .gitignore kept .claude/settings.json out of git and .trail/hook.cjs was never committed, so nothing runs at session start for someone without trail.
Fix: commit trail's shared setup (the hook, its one SessionStart entry, .trail's README and ignore file) plus the 6 learnings safe for a public repo, and drop the graft helpers trail init already deletes.

Moves: learnings_committed with first_look = 'false', last 7 days (Metabase db 11, posthog_event_full_view): 4,284 events from 551 installs on 29 Oct (22–29 Oct). Each Trail-Code clone with trail fires one more after pulling this (7 more learnings: 28 on main on 3 Nov, 35 with this PR).

What's in it

  • .claude/settings.json (new, tracked): one SessionStart entry for .trail/hook.cjs. Byte-identical to mergeTrailShared({}) on main, so a teammate's trail init writes no diff.
  • .trail/hook.cjs, .trail/README.md, .trail/.gitignore: generated from origin/main (hooksShim(), REPO_TRAIL_README). Regenerated on 2 Nov after Install trail without sudo #734 added the no-sudo line to the shim, so the hook matches what trail init writes on main today. A later PR that changes one of these generators must commit the regenerated file with it.
  • .gitignore: stops ignoring .claude/settings.json; settings.local.json stays personal. The old reason ("regenerated per machine") was true of the pre-0.23 layout, where settings.json held the status line and every hook. Since 0.23 it holds only the shared entry.
  • Removed .claude/helpers/graft-hooks.cjs, graft-statusline.cjs, .claude/skills/graft/SKILL.md: the pre-0.23 layout. trail init deletes them (clearOldLayout), so everyone who ran it had three deletions leaking into git status. Nothing in src, tests or CI reads these copies.
  • 6 learnings: overlap warnings on squash-merged branches; the teammate offer needing committed hook wiring; release path and CodeQL; testing the sign-in nudge headless; the TRAIL_CLOUD flag and what uploads; the publish check failing on conflicts. Plus one new learning from this PR: what's tracked now, and how to check the no-trail session start.

Left out, on purpose

  • 8 learnings, for a public repo: 4 about the private assign repo and its rollout, the 16 Oct user-test results, one with internal usage numbers and a detail about a private repo's files, one with adoption rates by version, and "Trail is decoupled from assign; no web app yet", a standing learning that's out of date since Trail Cloud (Sign in from your coding agent with a one-time code; release 0.27.0 #706, Connect to Trail Cloud at the moments trail is used #708) and would tell every teammate's Claude not to add sign-in links. They stay untracked in the main checkout; they belong in trail note --personal.
  • AGENTS.md, GEMINI.md, .github/copilot-instructions.md: the same 7 KB graft:brain house-rules block from the old brain feature. No current command writes them, links point at the old NanoNets/Graft name, and Claude Code doesn't read them. Learnings carry this now.
  • data/.web-token, data/share-link.txt: not part of trail's setup; not read.

Checked

  • Real claude -p runs in fresh clones, no trail on PATH, empty TRAIL_HOME, --setting-sources project: on main no SessionStart hook runs and Claude says no learnings are in its context; on this branch the hook hands it the 12 newest learnings and Claude lists their paths.
  • trail check (2 Nov, after merging main): no conflicts, 7 worth a look. The Oct 15 one ("every trail init also edits the tracked .claude/settings.json… and those edits leak into unrelated PRs") was about the old layout: the committed file is exactly what init writes now. The rest are about how to run sandboxes or one-off Claude runs, or are this PR's own new learning.
  • npm test with a scratch HOME (2 Nov, after merging main): CI passes on Ubuntu and Windows. Locally, the full run on a heavily loaded laptop had hook timeouts. Re-running the failing files alone left 3 failures (graft-to-trail, hosts-trail, upkeep-hooks), and those same 3 fail on clean origin/main on this machine.

Watch out after merge

git overwrites an ignored file when a pull brings a tracked one to the same path (tried in a scratch repo). On trail ≥ 0.23 a personal .claude/settings.json already holds exactly this entry, so nothing changes. Anyone who kept their own hooks there should move them to settings.local.json first.

Follow-ups

  • Move the 8 left-out learnings to trail note --personal in the main checkout, and replace the stale "decoupled from assign" one.
  • Re-save the init_completed telemetry-timing finding without the adoption numbers, so teammates get the technical part.

Heads-up: once this merges, a git pull replaces any personal (ignored) .claude/settings.json with the shared one. Personal settings belong in .claude/settings.local.json.

🤖 Generated with Claude Code

@trailhq-graft

trailhq-graft Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

🌱 graft blast radius

Nothing outside this diff depends on it. 0 areas changed; no indexed dependents at depth 2.

⚠️ 3 deleted files (.claude/helpers/graft-hooks.cjs, .claude/helpers/graft-statusline.cjs, .claude/skills/graft/SKILL.md) — their dependents cannot be computed from a graph built at this commit, since the files are gone from it.
⚠️ 12 changed files not in the graph (.claude/settings.json, .gitignore, .trail/.gitignore, .trail/README.md, .trail/hook.cjs) — no parser claims the extension, or the index predates the file.

graft blast · origin/main...HEAD · depth 2 · 15 changed files

Open the interactive graph → — click an area to see its dependent symbols at file:line.

github-actions Bot added a commit that referenced this pull request Oct 29, 2026
@shhdwi

shhdwi commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

The committed shared hook file, .claude/settings.json and .trail/README.md match byte for byte what trail init writes on main, so a teammate's init leaves no diff.

Before merging:

  1. The three Oct 15 learnings all carry the same ten touches, which have nothing to do with what they say. Six of those paths don't exist (data/.web-token, data/share-link.txt, src/ask/jev-ask.ts, AGENTS.md, GEMINI.md, .github/copilot-instructions.md). With Flag learnings that name code that's gone #731 coming, they'd be flagged stale on every show. Please trim each one to the files it's really about.
  2. These learnings name the private NanoNets/assign repo and an internal endpoint (/api/cli/handoffs/claim). This repo is public, so those details probably need to come out.
  3. Once merged, a pull overwrites anyone's ignored personal .claude/settings.json. That's worth a line in the description.

Each of the three Oct 15 learnings listed the same ten paths, six of which
don't exist. List only the files each one is about. Also drop the name of a
private repo and an internal endpoint, since this repo is public.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shhdwi
shhdwi merged commit dc18f56 into main Nov 8, 2026
16 of 21 checks passed
@shhdwi

shhdwi commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Merged after one fix commit (e1426d4):

  • The three Oct 15 learnings now list only the files each is about (overlap: src/notes/branches.ts, src/notes/edit-overlap.ts; install offer: src/claude/shim-template.ts, src/claude/init.ts; release path: .github/workflows/codeql.yml, scripts/pack-trail.mjs, src/notes/pr-reviews.ts). The six paths that don't exist are gone, so Flag learnings that name code that's gone #731 won't flag them stale.
  • Took out the private repo's name and the internal claim endpoint, since this repo is public. The facts in each learning stay.
  • Added a line to the description: once this lands, a pull replaces a personal (ignored) .claude/settings.json.

Checked every committed file for tokens, keys, internal URLs and personal data: nothing else found. trail check still reads all 33 learnings. CI's first ubuntu runs failed on a GitHub 504 downloading tree-sitter-cli; the rerun passed.

github-actions Bot added a commit that referenced this pull request Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants