Repository navigation
Fix trail's save-a-learning prompts - #739
anirudhkumar-nanonets wants to merge 2 commits into
Conversation
🌱 graft blast radius4 areas changed → 11 areas can be affected. 39 dependent symbols, depth 2. flowchart TB
A0(("Hook Initialization<br/>15 symbols"))
A1(("Session Replay<br/>7 symbols"))
A2(("Memory Notes<br/>3 symbols"))
A3(("Cloud Activity<br/>3 symbols"))
A4(("CLI Skills<br/>2 symbols"))
AX(("6 smaller areas<br/>9 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 — 2 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 39 dependent symbols, grouped by areaHook Initialization — 15 symbols in 12 files
Session Replay — 7 symbols in 6 files
Memory Notes — 3 symbols in 3 files
Cloud Activity — 3 symbols in 3 files
CLI Skills — 2 symbols in 2 files
Host Registry — 2 symbols in 2 files
Learning Sessions — 2 symbols in 1 file
Telemetry Tracking — 2 symbols in 2 files
CLI Entry Point — 1 symbol in 1 file
MCP Tools — 1 symbol in 1 file
Trace Dialect — 1 symbol in 1 file
Test signal per changed area — 1 ✓ · 2 ✗ · 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.
116 test suites also reference this code117 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. |
Issue: In Claude Desktop, a user's correction never led to a "save a learning" ask, and after a push the Stop hook said no learning went with the work when one had.
Why: Desktop puts a
<system-reminder>status block before every typed message and the hook'styped()dropped anything starting with<; its advice also sent business reasoning to the repo, and it counted writes outside the repo as code edits.Fix: The hook now reads typed words through the shared transcript filter, knows more "keep it out of the repo" phrasings, says business reasoning goes in
--personal, and ignores writes outside the repo or pushes whose branch already adds a learning.Moves: share of user corrections that end in a saved learning. Measured by the new
note_askedevent in PostHog (Metabase db 11,posthog_event_full_view):kind = correctedwithsavedin (repo,personal) over allkind = corrected. Value today: none, nothing measured it before this PR (Metabase checked 2026-10-29).What changed
typed()usestypedText(src/trace/claude.ts), the filter every other learning path already uses. It strips<system-reminder>and IDE wrappers and keeps the words after them, and it never counts compaction summaries (isCompactSummary, or text starting "This session is being continued"), task notices or other sessions' messages (origin.kindother thanhuman) as typed. A queued message typed while Claude was busy now counts too.ownTextopens "[Artifact comment sent to Claude]" to its quoted comment between the BEGIN/END lines. Before, the whole harness wrapper counted as typed on every learning path.na,need not / needn't go|be,shouldn't go,keep it out of the repo,not in the repo(not when the sentence is a question). Tests cover look-alikes that must stay quiet: "is this not in the repo yet?", "you need not ask…", "nan values…", "naming is fine".format.ts), the trail skill (skill-template.ts) and the corrected and shipped asks now say business, growth, sign-up, pricing or competitor reasoning and internal numbers go in--personal, never the repo, "even if you also keep your own copy" (the answer to why Claude's own memory got the rule and trail didn't). The words test bans "memory" in agent-facing text, hence "your own copy".shellEditreturns no edit when a command starts withcdoutside the repo, or when every full path it names is outside the repo (a scratch PR body via$P, Claude's memory index). A write it can't name from inside the repo still counts. The shipped sign is skipped when the branch's commits already add a.trail/learnings/file (branchAddsLearninginsrc/cloud/diff.ts, next tobranchDiff).note_asked{kind,saved:repo/personal/no}, sent on the stop after an ask (thestop_hook_activestop).askAnsweronly counts it when the last Stop hook feedback is trail's own ask, so another hook's block isn't counted. Listed incontract.ts, its allowed values,TELEMETRY.mdand the pinned event list.Choices made
hook_ms(the Stop hook's only event today) is sent only when learned skills are enabled, and a property onnote_savedalone gives saves without the asks they answer, so no share.contract.ts,TELEMETRY.mdand the pinned event list intest/telemetry-contract.test.tsalso change in Ask once whether a reused learning helped #727 (addslearning_rated);format.tschanges one sentence that Ask once whether a reused learning helped #727/Keep the sources-diff summary to one line #729/Flag learnings that name code that's gone #731 don't touch. A merge keeps both events.trail check
Exits 1 with 4 hits, all word overlaps with unrelated learnings, not conflicts: two about hooks going quiet under a sandboxed
claude -p(matched on "claude", "stop", "hook"), one about the hook shim with a real HOME (matched on "copy"), one aboutreplaces:holding ids (matched on "file name").Tests
test/trail-note-ask.test.ts,test/trace-typed.test.ts,test/telemetry-contract.test.ts,test/trail-words.test.ts,test/claude-stop.test.ts: 61 pass.origin/main(dd0e6cb), the same parser/extraction set from the worktree resolving the main checkout'snode_modules. Nothing new fails.skill-template.tsand the skill fixture keep both this PR's--personallines and Install trail without sudo #734's no-sudo lines. Typecheck is clean, and the tests above pluscli-meta,node-version,claude-shim-resolve,trail-notesandskills-fixturespass (130).🤖 Generated with Claude Code