Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.
TypeScript ai-agentsanthropicclaude-codeclicode-graphcodexcontext-engineeringcursordeveloper-toolsgeminiknowledge-graphllmmcpmcp-serveropen-sourceopenaitree-sitter
title: "Learning replaces: holds ids, and a reading-only turn is a save signal" author: Anirudhkumar-nanonets date: 2026-10-22 branch: feat/note-signals-gate touches: - src/notes/learning-fields.ts - src/notes/notes.ts - src/notes/note-gate.ts - src/claude/shim-template.ts - src/claude/note-signals.ts - src/claude/hooks.ts - src/cli.ts
Decided
replaces:holds the old learning's id (l-…,asLearningIdin src/notes/learning-fields.ts), never its file name.trail note --replaces <file>looks the file up withfindLearningand writes its id. The note gate'srepeatOfand the shared hook (src/claude/shim-template.ts) compare ids too. The hook works out an id-less file's id asl-plus the first 6 hex digits of the sha1 of its name, likelearningId.listNotesreturns every learning. Readers that should skip replaced, held or retired ones wrap it inliveLearnings: findNotes, standingLearnings, the file-open delivery in hooks.ts and the gate's existing list in cli.ts.- The Stop hook keeps an
exploredsignal next to fixed/corrected/undone/chose/shipped. One turn with at leastNOTE_WORTHY_READING(30k) tokens of reading counts: trail'stokens saved ≈ Nlines, plus Read/Grep/Glob results at 4 characters a token. Finding where a feature lives or why a bug happens needs no edit to be worth saving.
Tried and ruled out
- Taking either side of the src/notes/notes.ts merge conflict between #663 and #654. Both added
replaces, one as a file name and one as an id, so the clash was in meaning, not text. - Filtering replaced learnings inside
listNotes.trail checkpasses its own rule toliveLearnings(only a replacement on the base branch hides one), and a filter inlistNoteswould hide learnings before that rule runs.
Watch out
readLearningFieldssilently drops areplaces:value that isn't an id, so a file name there leaves the old learning showing.- Changing src/claude/shim-template.ts changes every repo's committed
.trail/hook.cjs. Those repos (assign) need one more hook commit after the release. - In a fresh worktree here,
npm cifails at tree-sitter-cli's install script, which downloads a binary.npm ci --ignore-scriptsis enough fortscand the tests.