From d637b2a399d08b3d6c80e9c7376b36311027f7b6 Mon Sep 17 00:00:00 2001 From: bchanot Date: Fri, 13 Nov 2026 16:47:17 +0100 Subject: [PATCH] chore(memory): BLK-046 (CLI 2.1.323 validator), H4a journal, phase 2 lines closed --- .claude/memory/blockers.md | 5 ++ .claude/memory/journal.md | 1 + .claude/tasks/TODO.md | 6 +-- .../2026-11-13-phase2-deny-lows-1600.md | 46 +++++++++++++++++++ 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 .claude/tasks/contracts/2026-11-13-phase2-deny-lows-1600.md diff --git a/.claude/memory/blockers.md b/.claude/memory/blockers.md index 62bd5c5..c416e64 100644 --- a/.claude/memory/blockers.md +++ b/.claude/memory/blockers.md @@ -412,3 +412,8 @@ rules: - **Friction**: handover-doc-writer STEP 9 said "parse manually", blocker status read from prose of cwd-relative `.claude/memory`. Client §5 could list closed blocker or drop open one (BLK-032..034 class). - **Real cause**: agent prompt bypassed shared readers. `reconcile_blk_open` not reusable as is: v1 branch closes on substring "resolved" (drops `unresolved`); v1 non-word lines (`closed`, prose) leak as open; `###` entries invisible to enumerator. - **Solution**: new `reconcile_blk_classify` (lib/reconcile.sh): strict word v2, `_mem_v1_word` v1, never `## Index`; closed omitted; empty/prose/mixed/`closed`/`###` = unreadable. STEP 9 rooted on PACKAGE root, `no-file` / `reader-unavailable` lines. Fenced SYNTH REPORT, mandatory `MEMORY:` line; orchestrator retries when missing or contradicted by existing blockers.md, relays unreadable IDs + `memory.sh status` remedy in 9.7. Test handover-memory-contract.test.sh HM1-HM3. Commit 93a8e19. Real data: game repo 14 unreadable (v1 `status:` lines left after upgrade). Follow-ups G6-G9 in BUGS-FOUND. + +## BLK-049 — make test red on mods.test.sh after the CLI auto-update to 2.1.323 (plugin validate --strict type-checks the mods) [open] (2026-11-13) +- **Friction**: `make test` red on lib/tests/mods.test.sh since 2026-11-13 16:24: claude CLI auto-updated 2.1.316 → 2.1.323; `claude plugin validate --strict` now type-checks the mods and fails on warnings. +- **Real cause**: mods/memory/hooks/register.test.ts:191,205,2805 TS2339 (unions `{stdout} | "hang"`, `{text} | "hang"`, `store` on `never`: test helpers never narrow the `"hang"` arm); mods/model-router: 13 warnings of the same validator. Pre-existing code, new validator. +- **Solution**: pending: narrow the three test sites (type guard on the `"hang"` arm) and read the 13 model-router warnings (`claude plugin validate --strict mods/model-router`), as its own /bugfix (block H item). Until then every `make test` reports that one suite red; the other 59 suites decide. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 880b883..e6c9055 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -741,3 +741,4 @@ rules: - /bugfix memory-sh-residuals (block H2, phase 4a + BUGS-FOUND memory.sh): one awk legacy reader (positional selector, prefix-derived end, ## Index stop, path-safe), one effective status for upgrade (strict else v1 label, written as dated line), control chars → ?, journal one blank line (d8e62c1, +30 checks, docs 5e7a267 incl. MIGRATION --body-file note). r1 (e) would have reopened resolved blockers: 3 lenses + confirmation. LRN-287; BLK-038 resolved. - /bugfix memory-sh-residuals (block H2, phase 4a + BUGS-FOUND memory.sh): one awk legacy reader (positional selector, prefix-derived end, ## Index stop, path-safe), one effective status for upgrade (strict else v1 label, written as dated line), control chars → ?, journal one blank line (d8e62c1, +30 checks, docs 5e7a267 incl. MIGRATION --body-file note). r1 (e) would have reopened resolved blockers: 3 lenses + confirmation. LRN-287; BLK-038 resolved. - /bugfix pack-census-followups (block H3, phase 5 leftovers): grep -qxF on gstack-removed.list, fragment top-level key allowlist (enabledPlugins, deniedMcpServers, disableClaudeAiConnectors, model; GATE 1 caught model missing from my clarification), T13-unknown-key (2fb9a2f, docs). CAPITALIZE: trivial, no BLK/LRN. +- /bugfix phase2-deny-lows (block H4a): 28 deny rows (awk exec primitives + spacing + -f, key/pem/id_rsa/id_ed25519 root forms, rtk twins) locked by T63, doctor jq message (a43ba1b, docs bc90b88). GATE 2 LOWs folded in round 2. make test red on mods.test.sh: claude CLI auto-updated to 2.1.323 at 16:24 (BLK-046), unrelated. Phase 2 'stated residuals' line = accepted limits of BDR-125 phase 2, closed by justification. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 82b172e..501cc83 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -56,10 +56,8 @@ Open children of the shipped phases (History 2026-11-12), text verbatim. - Phase 4a leftovers: done 2026-11-13. faunosteo upgraded in block F (chore/memory-v2 530af1b, user merges); BLK-038 residuals closed in block H2 (bugfix/memory-sh-residuals d8e62c1: stderr `?` for control chars, fixtures for the upgrade messages, journal one blank line; the real-data replay oracle is replaced by the fixture suite, its scratchpad script is gone); MIGRATION.md `--body-file` absolute-path note added (5e7a267). Remaining raw sinks, not phase-tied: reconcile.sh:141 stdout `${st:0:80}`, `check` "heading shape" line. - Phase 1 leftovers: done 2026-11-13 in block E (E1 design hook deleted, BDR-148; E2 Skill routing lines → descriptions, BDR-149). - Phase 5 leftovers: done 2026-11-13 (block H3, bugfix/pack-census-followups 2fb9a2f): `grep -qxF`, fragment top-level key allowlist (four keys profile.sh reads). -- Phase 2 leftovers: - - [ ] Phase 2 residuals (stated 2026-11-02): Bash write forms are outside the routing guard (the harness auto-mode "prefer Bash" path); a register.ts reload resets the skill latch; `.claude/worktrees/` writes are code; code-limits state dirs stay in TMPDIR; not caught by a static rule: `… | bash -s`, a sourced `gitflow_finish`, `git -C merge` (soft_deny prose only). - - [ ] Phase 2 security gate follow-ups (2026-11-02, non-blocking): MEDIUM `rtk read -n .env` / `rtk read a.txt .env` typed directly pass every static deny (rc 3 → passthrough, no rule) → bench `Bash(rtk read * .env*)`, `Bash(rtk read * */.env*)` + `*/rtk` twins and teach phase2.jq the `* ` shape; LOW code-limits state dir (`mkdir -m 700`, owner check); LOW awk evasions (`system (`, `awk -f`, `gawk`/`mawk`); LOW pre-existing `cat x.key` (no dir prefix) parity gap; doctor.sh:255 jq message should name code-limits and push-guard. MEDIUM rtk read part done 2026-11-06 97c6afc (2 rules, bench R3-R7, LRN-266); the LOWs stay open. - - [ ] rtk deny forms (user 2026-11-12, split from the line above): the 6 `rtk cat|head|tail *.env*` deny forms (`Bash(rtk cat *.env*)`, `Bash(*/rtk cat *.env*)`, head, tail) said obsolete; removing them needs a verified reason per form and reviewed rows in the push-guard T42 justified list, as its own run. +- Phase 2 leftovers: security-gate LOWs done 2026-11-13 (block H4a, bugfix/phase2-deny-lows a43ba1b: awk `system (`/`-f`/`getline`/`| "` + gawk/mawk, `.key`/`.pem`/`id_rsa`/`id_ed25519` root forms + rtk twins, doctor.sh:255 message). The "stated residuals" line (Bash write forms outside the routing guard, latch reset on reload, `.claude/worktrees/` writes, state dirs in TMPDIR, `| bash -s` / sourced `gitflow_finish` / `git -C merge` = soft_deny prose) names ACCEPTED limits of BDR-125 phase 2 (Amendment 7: interpreters and Bash write forms are classifier territory, no static rule), not tasks: removed. rtk `cat|head|tail *.env*` forms: benched 2026-11-13 (`rtk cat|head|tail --help` = coreutils pass-through on rtk 0.50.0), all six kept, T42 untouched. Remaining phase 2 items (code-limits `mkdir -m 700` + owner check, pre-commit allowlist fail-closed, session-start timeout fallback, `_mem_path_safe` wrap) → block H4b. + - [ ] push-guard T63 presence check reads ask+deny (:430): a deny row demoted to ask still passes; split the lookup per kind (GATE 2 LOW 2026-11-13, new). - Context measure leftovers (2026-11-09, LRN-270): - [ ] Open: dev System tools 11.3k vs full 7.7k (interactive) comes from some pack being off, not MCP; unattributable via `/context`. Bisect by toggling one pack at a time interactively if it matters. - [ ] Follow-up candidate (accepted risk): doctor residue check covers `enabledPlugins` only; a UI write into user-scope `skillOverrides` would dirty tracked settings.json unseen. diff --git a/.claude/tasks/contracts/2026-11-13-phase2-deny-lows-1600.md b/.claude/tasks/contracts/2026-11-13-phase2-deny-lows-1600.md new file mode 100644 index 0000000..bc8daf4 --- /dev/null +++ b/.claude/tasks/contracts/2026-11-13-phase2-deny-lows-1600.md @@ -0,0 +1,46 @@ +# CONTRACT — phase2-deny-lows (phase 2 security-gate LOWs, block H4a) +- date: 2026-11-13 | flow: bugfix | branch: bugfix/phase2-deny-lows (off develop) +- status: active + +## REQUEST (verbatim — IMMUTABLE) +Phase 2 security gate follow-ups (2026-11-02, non-blocking): LOW awk evasions (`system (`, `awk -f`, `gawk`/`mawk`); LOW pre-existing `cat x.key` (no dir prefix) parity gap; doctor.sh:255 jq message should name code-limits and push-guard. safety-residuals gate LOWs (2026-11-06): `rtk read -n server.key` / `rtk read id_rsa` at repo root pass (`.key`/`.pem`/`id_*` rtk denies all need `*/`; pre-existing, bench before adding). + +## CLARIFICATIONS +- [gated 2026-11-13, internal] bench = the push-guard suite: every new row joins the T63 "phase2 rules present" list and the T62 twin rule (an `rtk read X*` row needs its `*/rtk read X*` twin). New deny rows: `Bash(awk *system (*)`, `Bash(gawk *system(*)`, `Bash(gawk *system (*)`, `Bash(mawk *system(*)`, `Bash(mawk *system (*)`, `Bash(awk -f *)`, `Bash(awk * -f *)`; no-dir forms `Bash(cat *.key)`, `Bash(cat *.key *)`, `Bash(cat *.pem)`, `Bash(cat *.pem *)`, `Bash(cat id_rsa*)`, `Bash(rtk read *.key*)`, `Bash(*/rtk read *.key*)`, `Bash(rtk read *.pem*)`, `Bash(*/rtk read *.pem*)`, `Bash(rtk read id_rsa*)`, `Bash(*/rtk read id_rsa*)`. Existing `*/` rows stay (removal needs the T42 justified list). +- [gated 2026-11-13, GATE 2 LOWs folded, round 2] 10 more rows, same bench: `Bash(cat *id_rsa*)`, `Bash(rtk read *id_rsa*)`, `Bash(*/rtk read *id_rsa*)` (flag-before parity), `Bash(cat *id_ed25519*)`, `Bash(rtk read *id_ed25519*)`, `Bash(*/rtk read *id_ed25519*)` (the request says `id_*`), `Bash(gawk -f *)`, `Bash(mawk -f *)`, `Bash(awk *getline*)`, `Bash(awk *| "*)` (awk's other exec primitives). Collateral of the `*.key`/`*.pem` root forms (`cat x | jq .api.key`) = the breadth the `*/` rows already have: accepted parity. `python3 -c`/`node -e` stay soft_deny (BDR-125 Amendment 7). T63 ask+deny lookup → TODO line. +- [gated] doctor.sh:255 wording: `jq not found: statusline, rtk-rewrite, code-limits and push-guard hooks require it` (no em dash). + +## ACCEPTANCE CRITERIA +1. The new rows are in `permissions.deny`, JSON valid, no duplicate rows. + CHECK: cd /home/bchanot/Documents/claude && jq -r '.permissions.deny[]' settings.json | grep -cxF -e 'Bash(awk *system (*)' -e 'Bash(gawk *system(*)' -e 'Bash(mawk *system(*)' -e 'Bash(awk -f *)' -e 'Bash(awk * -f *)' -e 'Bash(cat *.key)' -e 'Bash(cat id_rsa*)' -e 'Bash(rtk read *.key*)' -e 'Bash(*/rtk read *.key*)' -e 'Bash(rtk read id_rsa*)' -e 'Bash(*/rtk read id_rsa*)' + EXPECT: 11 + EVIDENCE: MET exit=0 marker-found :: 11 +8. Round-2 rows present. + CHECK: cd /home/bchanot/Documents/claude && jq -r '.permissions.deny[]' settings.json | grep -cxF -e 'Bash(cat *id_rsa*)' -e 'Bash(*/rtk read *id_rsa*)' -e 'Bash(cat *id_ed25519*)' -e 'Bash(rtk read *id_ed25519*)' -e 'Bash(gawk -f *)' -e 'Bash(mawk -f *)' -e 'Bash(awk *getline*)' -e 'Bash(awk *| "*)' + EXPECT: 8 + EVIDENCE: MET exit=0 marker-found :: 8 +2. No duplicate deny row. + CHECK: cd /home/bchanot/Documents/claude && jq -r '.permissions.deny[]' settings.json | sort | uniq -d | wc -l + EXPECT: 0 + EVIDENCE: MET exit=0 marker-found :: 0 +3. push-guard suite green with the rows benched (T63 list extended, T62 twins satisfied). + CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test suite=lib/tests/push-guard.test.sh 2>&1 | tail -1 + EXPECT: all suites green + EVIDENCE: MET exit=0 marker-found :: all suites green +4. T63 list names the new rows (both rounds). + CHECK: cd /home/bchanot/Documents/claude && grep -cF -e 'Bash(awk -f *)' -e 'Bash(cat *.key)' -e 'Bash(rtk read id_rsa*)' -e 'Bash(cat *id_ed25519*)' -e 'Bash(awk *getline*)' lib/tests/push-guard.test.sh + EXPECT: 5 + EVIDENCE: MET exit=0 marker-found :: 5 +5. doctor.sh jq message names code-limits and push-guard. + CHECK: cd /home/bchanot/Documents/claude && grep -c 'jq not found: statusline, rtk-rewrite, code-limits and push-guard hooks require it' doctor.sh + EXPECT: 1 + EVIDENCE: MET exit=0 marker-found :: 1 +6. settings-related suites green: `make test suite=lib/tests/rtk-rewrite.test.sh`, shellcheck -x doctor.sh. + CHECK: cd /home/bchanot/Documents/claude && shellcheck -x doctor.sh && PATH=$HOME/.bun/bin:$PATH make test suite=lib/tests/rtk-rewrite.test.sh 2>&1 | tail -1 + EXPECT: all suites green + EVIDENCE: MET exit=0 marker-found :: all suites green +7. make test green (manual, bun on PATH). + (manual: run 2026-11-13 16:30 → every suite green except lib/tests/mods.test.sh, red since the claude CLI auto-updated to 2.1.323 at 16:24: `plugin validate --strict` now type-checks register.test.ts (3 TS2339 narrowings) and model-router (13 warnings); unrelated to this diff (settings/doctor/push-guard), tracked as its own H item) + +## FILE SCOPE +settings.json (permissions.deny rows only), lib/tests/push-guard.test.sh (T63 list), doctor.sh (:255 one line). docs/SETTINGS.md or README deny inventory → STEP 7. TODO lines → STEP 8.