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..7adda33 100644
--- a/.claude/memory/journal.md
+++ b/.claude/memory/journal.md
@@ -741,3 +741,5 @@ 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.
+- correction: the CLI 2.1.323 validator blocker above is BLK-049, not BLK-046.
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.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a3ef3cd..4c507a4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
- `lib/project-rules.sh` (`extract`, `emit`): the out-path check resolves the rule file's first existing parent physically and refuses (rc 2, `must stay under the project`) a path a symlinked component sends outside the project; 3.0.0 checked `..` lexically only. `emit` goes through the same check and reports `cannot create` or `not written` (no partial file) with rc 2 where it printed `emitted`. An `extract` that wrote the rule but fails to rewrite CLAUDE.md keeps the rule file and the rewritten text in a temp file and names both on stderr with the command to complete or abort; it used to delete both. `/onboard` and `/init-project` keep an existing rule on an rc 2 ending in ` exists` and stop on any other rc 2. Tests: `lib/tests/project-rules.test.sh` T9h (re-asserted), T9z3 to T9z13.
- `lib/memory.sh`: `memory_legacy_status` (the v1 status reader behind `memory.sh upgrade`, `/reconcile`, `/prune-memory`) ends an entry's range at the next heading of another entry of the same prefix, any level, outside a code fence, or at `## Index`: a `### BLK-` entry no longer lends its status to the `## BLK-` entry above, and a trailing `## Index` is no longer read. `memory.sh upgrade` on an entry with no strict status word writes the single word of its v1 `Status`/`Statut` label as the dated upgrade status line; when the `## Index` cell disagrees the body word wins and stderr says `kept body , dropped Index ` (the Index used to win); an Index `superseded`/`deprecated` still wins; a label without exactly one word is refused on a blocker and leaves the Index cell on a decision. Control characters from a v1 line or an Index cell print as `?`. `memory.sh journal` leaves exactly one blank line before a new date heading (a file ending with a blank line got two, one without a final newline got none). Tests: `lib/tests/memory.test.sh` T14l-gap, T15-statut-*, T15-bdr-*, T15-idx-*, T15-ctl-*, T15-trailing-index-not-read.
- `lib/pack-census.sh`: the retired gstack skill check matches `lib/gstack-removed.list` as fixed strings (`grep -qxF`); a pack entry name used to be read as a regex. A profile fragment carrying a top-level key other than `enabledPlugins`, `deniedMcpServers`, `disableClaudeAiConnectors` or `model` is now RED (`unknown top-level key(s) `) in `lib/pack-census-fragments.jq`. Test: `lib/tests/pack-census.test.sh` T13-unknown-key.
+- `settings.json` denies more read and exec forms (28 entries): `awk`/`gawk`/`mawk` with `system (` (space before the paren), `-f` program files, `getline` and `| "` pipe-to-command; `cat` and `rtk read` (plus `*/rtk read` twins) on `.key`, `.pem`, `id_rsa` and `id_ed25519` without a directory prefix. Test: `lib/tests/push-guard.test.sh` T63 locks every row, T62 twins hold. `doctor.sh`: the missing-jq message names every jq hook (`statusline, rtk-rewrite, code-limits and push-guard`).
## [3.0.0] — 2026-11-12
diff --git a/doctor.sh b/doctor.sh
index 1ef011c..d4ae484 100644
--- a/doctor.sh
+++ b/doctor.sh
@@ -252,7 +252,7 @@ fi
if command -v jq &>/dev/null; then
pass "jq $(jq --version 2>/dev/null | sed 's/^jq-//')"
else
- fail "jq not found — statusline & rtk-rewrite hooks require it"
+ fail "jq not found: statusline, rtk-rewrite, code-limits and push-guard hooks require it"
fi
if command -v cargo &>/dev/null; then
diff --git a/lib/tests/push-guard.test.sh b/lib/tests/push-guard.test.sh
index 54383a3..fa84602 100644
--- a/lib/tests/push-guard.test.sh
+++ b/lib/tests/push-guard.test.sh
@@ -455,6 +455,34 @@ Bash(cat * .env*)
Bash(cat * */.env*)
Bash(rtk read * .env*)
Bash(*/rtk read * .env*)
+Bash(awk *system (*)
+Bash(gawk *system(*)
+Bash(gawk *system (*)
+Bash(mawk *system(*)
+Bash(mawk *system (*)
+Bash(awk -f *)
+Bash(awk * -f *)
+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*)
+Bash(cat *id_rsa*)
+Bash(rtk read *id_rsa*)
+Bash(*/rtk read *id_rsa*)
+Bash(cat *id_ed25519*)
+Bash(rtk read *id_ed25519*)
+Bash(*/rtk read *id_ed25519*)
+Bash(gawk -f *)
+Bash(mawk -f *)
+Bash(awk *getline*)
+Bash(awk *| "*)
EOF
check T63-phase2-rules-present "$missing" ""
check T63b-no-root-glob "$(jq -r '(.permissions.ask + .permissions.deny)[]' \
diff --git a/settings.json b/settings.json
index 365b2b0..2a21e7b 100644
--- a/settings.json
+++ b/settings.json
@@ -192,9 +192,16 @@
"Bash(cat */.env.*)",
"Bash(cat */secrets/*)",
"Bash(cat */*.pem)",
+ "Bash(cat *.pem)",
+ "Bash(cat *.pem *)",
"Bash(cat */*.key)",
+ "Bash(cat *.key)",
+ "Bash(cat *.key *)",
"Bash(cat */id_rsa*)",
+ "Bash(cat id_rsa*)",
+ "Bash(cat *id_rsa*)",
"Bash(cat */id_ed25519*)",
+ "Bash(cat *id_ed25519*)",
"Bash(cat */.aws/credentials)",
"Bash(head .env)",
"Bash(head .env.*)",
@@ -354,6 +361,17 @@
"Edit(~/.gitconfig)",
"Edit(~/.config/git/config)",
"Bash(awk *system(*)",
+ "Bash(awk *system (*)",
+ "Bash(gawk *system(*)",
+ "Bash(gawk *system (*)",
+ "Bash(mawk *system(*)",
+ "Bash(mawk *system (*)",
+ "Bash(awk -f *)",
+ "Bash(awk * -f *)",
+ "Bash(gawk -f *)",
+ "Bash(mawk -f *)",
+ "Bash(awk *getline*)",
+ "Bash(awk *| \"*)",
"Bash(head * .env*)",
"Bash(tail * .env*)",
"Bash(head * */.env*)",
@@ -364,8 +382,12 @@
"Bash(*/rtk read * .env*)",
"Bash(rtk read */*.key*)",
"Bash(*/rtk read */*.key*)",
+ "Bash(rtk read *.key*)",
+ "Bash(*/rtk read *.key*)",
"Bash(rtk read */*.pem*)",
"Bash(*/rtk read */*.pem*)",
+ "Bash(rtk read *.pem*)",
+ "Bash(*/rtk read *.pem*)",
"Bash(rtk read */.aws/credentials*)",
"Bash(*/rtk read */.aws/credentials*)",
"Bash(rtk read */.env*)",
@@ -376,6 +398,12 @@
"Bash(*/rtk read */id_ed25519*)",
"Bash(rtk read */id_rsa*)",
"Bash(*/rtk read */id_rsa*)",
+ "Bash(rtk read id_rsa*)",
+ "Bash(*/rtk read id_rsa*)",
+ "Bash(rtk read *id_rsa*)",
+ "Bash(*/rtk read *id_rsa*)",
+ "Bash(rtk read *id_ed25519*)",
+ "Bash(*/rtk read *id_ed25519*)",
"Bash(rtk read */secrets/*)",
"Bash(*/rtk read */secrets/*)",
"Bash(rtk read .env*)",
|