Repository navigation
One learning file per session, or one per PR - #748
Conversation
🌱 graft blast radius3 areas changed → 12 areas can be affected. 70 dependent symbols, depth 2. flowchart TB
A0(("Skills Learning System<br/>19 symbols"))
A1(("Claude Integration<br/>17 symbols"))
A2(("Notes Memory<br/>11 symbols"))
A3(("Repository Discovery<br/>7 symbols"))
A4(("Cloud Workspace Sync<br/>6 symbols"))
AX(("7 smaller areas<br/>10 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 15 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 70 dependent symbols, grouped by areaSkills Learning System — 19 symbols in 19 files
Claude Integration — 17 symbols in 17 files
Notes Memory — 11 symbols in 11 files
Repository Discovery — 7 symbols in 7 files
Cloud Workspace Sync — 6 symbols in 6 files
…10 further symbols not listed. Test signal per changed area — 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.
130 test suites also reference this code130 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. |
The issue: One long Claude session that saves a learning three times leaves three files in
.trail/learnings/, when it should leave one file per session, or one per PR when the session goes on to another PR.Why:
trail notewrote a new file on every save, because it never knew which session was saving or what that session had already written.The fix:
trail noteremembers the file each Claude session wrote on each branch, so a later save adds to that file under the same headings, and a save on a new branch (which a new PR needs) starts a new file.Moves: share of saves that go into the session's existing learning instead of a new file. Measured by the new
intoproperty onnote_savedin PostHog (Metabase db 11,posthog_event_full_view):into = sessionover allnote_saved. Value today: none, nothing measured it before this PR (Metabase checked 2026-11-02).What changed
src/notes/session-learning.ts(new): which file a session wrote is kept on this machine in~/.trail/repos/<repo>/session-learnings.json, keyed bysessionKey(Claude Code'sCLAUDE_CODE_SESSION_ID, else its newest transcript) and scope, with the branch it was written on. Nothing about the session goes in the learning file.addToLearningfolds a later save in under the same##headings and skips lines already there; the title, id and file name stay, costs add up and touches join. Sessions idle for a week are dropped from the map.src/cli.ts:trail noteadds to the session's file when there is one on the same branch, leaves that file out of the repeat check (a second save in one session would otherwise be refused as a repeat of the first), and prints✓ added to the learning this session already saved.--replacesor--always-follow.note_savedgetsinto(new/session), insrc/telemetry/contract.tsandTELEMETRY.md.src/notes/notes.tssaid a learning is never edited after it's written; it now says a later save in the same session adds to it.Tests
test/trail-note-session.test.ts: three saves in one session leave one file with all three in it and the first id; another branch, another session and no session each start a new file; the heading merge.test/trail-note-gate.test.tsclearsCLAUDE_CODE_SESSION_ID, so the repeat-check case doesn't pick up the Claude session of whoever runs the tests.node_modules(noweb-tree-sitter-depththere). Every one of them also fails onorigin/main(a44da3d) run the same way, so nothing new fails, and none are about notes.git checkout -bstarted a second file.trail check
One conflict on
src/cli.ts, a word match with the learning thatreplaces:holds the old learning's id. This change keeps that:--replacesstill writes a new file whosereplaces:is the id, and the repeat check still readsliveLearningsand compares ids.Merge order
#739 also edits next to
note_saved(it addsnote_askedright after it insrc/telemetry/contract.tsandTELEMETRY.md), so the two conflict on those two lines. Merge #739 first; this branch then keeps both sides. #727 merges clean with this one.🤖 Generated with Claude Code