diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 98c89d7..b01d7b8 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -699,3 +699,4 @@ rules: ## 2026-11-06 - 2026-11-06: machine OOM reboot 2026-11-05 23:55 root-caused: detect_plan `claude config get planType` fork bomb via SessionStart (BLK-043), SD13 fake HOME trigger. /bugfix: 3 lenses → r2 (hotfix off main, worktree), GATE 0 MET, verifier ECARTS(1 SC2016) → CONFORME, security PASS ×2; 49aa2ff. BLK-044 open (oom_score_adj -1000). Merge + Part B pending. +- capitalize pre-compact: 2 learnings (hook never calls claude CLI; worktree ignored symlinks + diff3); TODO BLK-043 merge checked, Part B kept. 4c digest switch committed 4a7ce37. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 8b9a52e..9e22d3f 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -1956,3 +1956,13 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s - **Pattern**: a guard over shell command TEXT is never complete; plan challenges kept finding forms (r1: quote chars used as segment delimiters cut a quoted destination off its option; r2: multi-line quoted scripts split into orphan lines, wrappers hiding carriers, ssh value options, heredoc owner = last command on the line, here-strings read as heredocs, command substitutions cutting argv). Ship narrow: re-tokenize EVERY quoted word holding a blank (no carrier list), run the detector from every watched tool word, refuse unresolvable destinations, and put intent in an `autoMode.soft_deny` line for what text cannot show. - **Context**: extract-guard, feature/extract-guard 2026-11-05. awk traps found by the security gate: `index(substr(txt, i))` per quote/heredoc line = quadratic (1 MB → hook timeout → command RUNS, LRN-196); `RS="\001"` + `all = all $0` drops 0x01 bytes (comment desync); busybox awk slow on per-char appends (cap 64 KiB); the prefilter must run on a de-quoted copy or split tool names skip it. The accepted FP bit its author twice: a memory heredoc quoting a complete extraction command was refused, then the ` ` placeholder too (angle brackets read as redirections) until placeholders were kept as words. - **Apply**: any PreToolUse text guard: prefilter on a de-quoted copy, size cap before parsing, linear tokenizer (forward scans), timed flood tests under gawk + mawk + busybox awk, fail closed only past the prefilter, MISSES in the header + soft_deny as net; text bodies about the guarded command go through Write + --body-file, never a heredoc in the Bash call. + +## LRN-263 — Hooks never invoke the claude CLI; hook-running tests stub it and cap tasks (2026-11-06) +- **Pattern**: hook (or lib a hook calls) never runs `claude` CLI. Removed subcommand (`claude config`) read as prompt → full session → its SessionStart hook re-runs → fork bomb (BLK-043). +- **Context**: `detect_plan` fallback `claude config get planType`, claude 2.1.318; 126 procs, 14 GiB, reboot. +- **Future use**: tests running hooks: PATH stub `claude` (log path expanded at creation, +x, positive control first), run under `systemd-run --user --scope -q -p TasksMax=N`. Grep hooks/lib for `claude ` in review. + +## LRN-264 — Fresh git worktree lacks gitignored symlinks; repo conflicts use diff3 markers (2026-11-06) +- **Pattern**: fresh `git worktree` lacks gitignored symlinks of main tree (`skills/darwin-skill`) → suites reading them go red (run-reconcile T6c): environment, not diff. Recreate link before blaming change. +- **Context**: hotfix worktree 2026-11-06; back-merge conflict used diff3 style. +- **Future use**: worktree setup → mirror ignored symlinks (`git status --ignored`). Conflict resolution here: strip `|||||||` base marker too, not only `<<<<<<<`/`=======`/`>>>>>>>`. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 906be29..211b521 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -120,7 +120,8 @@ Shared rules for every phase: - **4d feedback and promotion.** Plan r1 (draft, not challenged): `.claude/tasks/plans/2026-11-05-memory-feedback-4d-1834.md`. Log read 2026-11-05: 1 real record, no decision possible; it cannot show usefulness or misses alone and transcripts live 7 days. Order: 4d.1 log fields `cands` + `ms` → 4d.2 weekly reader (log × transcripts, labels.tsv) → 4d.3 gate (≥20 prompt + ≥10 tool injections, or 5 weeks) with thresholds fixed now → 4d.4 /prune-memory + BDR-100 promotion, conditional. Starts after the 4c merge; 4 open choices in the plan. - [ ] shortcut: the injection log lives under `l:` store keys (about 28 KiB each, 200 records and 64 KiB at most); `sweepLogs` counts them with the `p:` keys and evicts the oldest log key (by its newest record, never the current root's) once the total nears the engine's 4 MiB store cap; upgrade = one global log key or a smaller per-root cap (`mods/memory/hooks/register.ts`). - [ ] residual: the pre-existing `memory.sh check` call in `hooks/session-start.sh` is not time-bounded (the digest's `memory.sh index blocker` call is); upgrade = wrap it in `timeout 2`. - - [ ] BLK-043 hotfix `49aa2ff` on hotfix/detect-plan-fork-bomb (worktree ../claude-hotfix-wt): merge on user signal (`gitflow finish` → main + develop), then `git worktree remove`; then Part B on this branch: suite-wide `claude` PATH stub + final empty-log check in `lib/tests/session-digest.test.sh` BEFORE SD13/SD14 run again (plan `.claude/tasks/plans/2026-11-06-detect-plan-fork-bomb-0030.md` r2). + - [x] BLK-043 hotfix merged 2026-11-06 (`bd5e661` main, `7e47bea` develop, back-merged into feature/memory-recall `3564e3e`, worktree removed). + - [ ] BLK-043 Part B: suite-wide `claude` PATH stub + final empty-log check in `lib/tests/session-digest.test.sh` (plan `.claude/tasks/plans/2026-11-06-detect-plan-fork-bomb-0030.md` r2). - [ ] shortcut (BLK-043 gate 2 LOWs): `lib/tests/detect-plan.test.sh` unchecked `mktemp -d` (empty WORK → real `claude probe`), `bash -c "source '$LIB'"` interpolation, no `GIT_CEILING_DIRECTORIES` on hook runs; and the memory, graphify-gate, push-guard suites run the hook with no `claude` stub. Upgrade = `|| exit 1` + `command -v claude` assert, positional args, ceiling dir, shared stub helper. - [ ] BLK-044: trace origin of `oom_score_adj=-1000` on claude processes; set `OOMScoreAdjust` on the `cc` scope so a runaway claude dies first. - Proof: recall precision on ≥20 real prompts and ≥10 real errors, target ≥ the 14/22 baseline; digest after a real compaction; redaction test on the ledger; `/context` delta; captured-failure demo: an error from session N recalled in session N+1.