diff --git a/docs/superpowers/plans/2026-11-03-memory-capture.md b/docs/superpowers/plans/2026-11-03-memory-capture.md index 20ca0b4..689cdda 100644 --- a/docs/superpowers/plans/2026-11-03-memory-capture.md +++ b/docs/superpowers/plans/2026-11-03-memory-capture.md @@ -236,3 +236,18 @@ Noise (rob 8, rob 9, corr 8): - NOISE.md (committed) holds counts and the useful/noise shares only. The 30 labelled redacted samples stay in the job temp dir and in the controller's gate message (LRN-124). Docs (rob 13, rob 15, simp 10): Task 8 adds `.claude/tasks/TODO.md` (4b ticked, 4c next) and states: the off switch takes effect at the next session or `/reload-plugins`; the store is the plugin's JSON file under the Claude configuration directory and is deleted to wipe captures; residuals — cross-process writes unverified (last writer wins), non-Bash failures not captured, the lexical superseded reader, 40-hex Gitea tokens kept by design, `Authorization: token …` not caught. + +## R3 CHANGES (confirmation pass: correctness CONCERNS(5), no BLOCKER; these override R2 and the task text) + +- **Span regex (conf 1).** buildIndex matches `` /`([^`\n]+)`/g `` (in-order pairing) and keeps only spans of length ≥ 12 in code. New test IDX8: a line `` `git rm` and later … `fatal: unable to access remote host` `` indexes the error span, not the prose between. +- **Env-prefixed commands (conf 2, conf 13).** The suite segment regex is `/^(?:[A-Za-z_]\w*=\S*\s+)*make\b[^;&|]*\btest\b/`; the commit segment regex takes the same assignment prefix: `/^(?:[A-Za-z_]\w*=\S*\s+)*git(?:\s+-C\s+\S+)?\s+commit\b/`; the message regex reads `-[a-z]*m\s+` (covers `-qm`, `-am`). The `X_TOKEN=abc make test` red-key test stays. +- **`line` redacted before it is picked (conf 3).** failureLine runs on `redact(tail(text, 65536))`; `line`, `key` and `excerpt` all come from that one redacted text. New test: a PEM body as the last line → no body characters in `line`, `key` or the answer. +- **Tool lifecycle (conf 4).** `ensureEnabled` calls `registerTool` every time it reads `enabled: true` (a name registered again is replaced); registration in `session.start` stays as the first attempt. When disabled the tool, if registered, answers `memory capture is off (~/.claude/memory.json)`. The user's interactive check includes a /clear then a `memory_pending` call. +- **Observable live check (conf 5).** Task 9 Step 3 (interactive, user + model): in a scratch repo on a feature branch the MODEL runs `git commit --allow-empty -m "fix: probe"`; the user sends one composer prompt, then a second; the controller greps that session's transcript `~/.claude/projects//.jsonl` for `memory: commit fix: probe` and expects exactly one hit, attached to the first prompt only; then the user types /clear and asks for `memory_pending`: the probe's session is listed `(earlier session)`. +- **rtk trailers (conf 6).** Each line first loses a trailing `\s*\[(?:\+\d+ hidden|full output): rtk recall [0-9a-f]+\]$`; a line left empty is dropped. noise.py counts leftovers with a loose `rtk recall` probe, independent of the strip regex. +- **Letterless lines (conf 7).** The letter test runs on the key with ``, `` and `#` removed; no letter left → the FAILURE IS DROPPED (no fallback to an earlier line). noise.py ports this rule 1:1. +- **One key helper (conf 8).** `suiteKeyOf(command)` returns the redacted, whitespace-normalized command cut to 300 chars; both the red record and the green comparison use it. +- **Answer order (conf 9).** Header, `index:` line, milestones (this session), then current-session NEW failures, current-session known, earlier sessions; the 20 000-char cap applies to the failure list only, ending `… more failure(s) omitted`. +- **commit-changer channel (conf 10).** The data rule names the channel: the body file is written with a quoted heredoc whose delimiter is unique (`MEMCAP_EOF_`), never `echo`/`printf` of captured text; the captured block goes with BOTH commit-changer dispatches (STEP 1 propose and STEP 2 `edit `). +- **st.pending at /clear (conf 11).** The `session.end` hook clears `st.pending` as well as the cached `enabled`. +- **Task 9 headless details (conf 12).** The `-p` prompt tells haiku to run `ToolSearch("select:mcp__memory__memory_pending")` first; the scratch repo session runs with `GITFLOW_NO_PUSH=1` exported in the command that creates the repo (no remote anyway); the run leaves a `p:` key in the user's real store: Task 9 notes it, and the next session's sweep ages it out (3 sessions per project); no store edit by hand.