diff --git a/.claude/audits/BUGS-FOUND.md b/.claude/audits/BUGS-FOUND.md index 0ad4dae..2859300 100644 --- a/.claude/audits/BUGS-FOUND.md +++ b/.claude/audits/BUGS-FOUND.md @@ -85,3 +85,6 @@ - lib/memory.sh:594-603 `memory_index` — skips a blockers.md that is not a regular file (`[ -f ] || continue`) and does not propagate the awk rc, so `index blocker` exits 0 on a registry it could not read and the session digest prints `- open: none` (SD9b/SD9c pin it). Fix direction: non-regular registry or unparsable `| BLK-` row → non-zero rc, the digest prints `unknown`. Severity: low. Discovered while: /bugfix bugs-found-scripts gates 1+2. Not fixed. - lib/profile-state.jq `clean` strips LF/CR only: ESC and other control chars pass (no terminal sink today); human mode (:67-75) prints values unsanitized (pre-existing). Severity: low. Discovered while: /bugfix bugs-found-scripts security gate. Not fixed. - lib/tests/profile.test.sh:195 T28-nl-id-no-bare-on cannot fail (pre-fix tail is `=off`); the `clean` on pack keys has no biting assertion; lib/tests/session-digest.test.sh:245 comment still says "no digest". Severity: low. Discovered while: /bugfix bugs-found-scripts verifier. Not fixed. + + +- doctor.sh `warn`/`pass`/`fail` print through `echo -e`: jq's `\uXXXX` escapes in the residue diff (:153) come back as raw control bytes (ESC sequences) on the terminal. Source = the user's own tracked settings.json (no trust boundary). Fix direction: `printf '%s\n'` in the shared helpers. Severity: low. Discovered while: /hotfix doctor-skilloverrides-residue security gate. Not fixed. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 143faed..4c8d97d 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -749,3 +749,6 @@ rules: - /bugfix feedback-followups (block H5, 4d follow-ups): post-fix split + 3rd pick retired + one-slot transcript cache + strict labels/state + key-set pins (9f9412a, docs). 3 challenge lenses FATAL on r1 (midnight cutoff, validator rejecting own rows, text-block extraction losing every join); 3 executor rounds (locals, at bound, legacy closed flag). RSS 279.8 → 267.7 MB on 16 records. tsc not done (no compiler, new dep), l: kept (49.7 KB of 4 MiB), image prompts dropped (0 instances). LRN-288. - /bugfix bugs-found-prose (block H6a): 10 prose BUGS-FOUND items closed (77041e5): handover rooting + PROJECT_ROOT line + BDR status filter, plugin-gate quoting/unsafe-root/common-dir/$HOME (+ profile.sh refusal T27), advisor rules, packs vocabulary, graphify labels. 4 rounds; GATE 2 MEDIUM single-quote break-out closed by the unsafe-root rule. D1b and dead-entry items closed; 5 pre-existing findings logged. LRN-154 corrected. - /bugfix bugs-found-scripts (block H6b): 7 BUGS-FOUND script items closed (9045a60): profile-state.jq clean + plugin id shape, digest open none/unknown (+ doctrine line), deny_lost PIPESTATUS, T63 ask/deny split, T7 lock, mktemp guard. Verifier ECARTS(1) (profile.test.sh:123 comment broke shellcheck) → r2 CONFORME, security PASS. Docs 599684c, audits 7c8726b. 3 new LOW in BUGS-FOUND (memory_index rc 0 on unreadable registry). + +## 2026-11-14 +- /hotfix doctor-skilloverrides-residue (block H7): doctor residue check compares {enabledPlugins, skillOverrides} HEAD vs work (9c9a024); doc audit caught MIGRATION step 1 restoring enabledPlugins only → extended to both keys (8dcee03). Security PASS, 1 LOW (echo -e escapes) in BUGS-FOUND. H + I TODO lines closed; LRN-270 bisect files moved to plans/2026-11-14-lrn270-bisect/ for the user. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 7f72967..d703d48 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -13,8 +13,8 @@ Decisions at start (asked once): faunosteo memory v2 on `chore/memory-v2` off de - [x] E (2026-11-13): E1 design hook deleted, BDR-148 (9c038fd, T7c → T8i); E2 Skill routing 311 → 306 lines, bugfix/ship-feature triggers, BDR-149 (3b30153); E4 BLK-022 buried (ce62d2b); rtk `cat|head|tail *.env*` forms benched: `rtk cat|head|tail --help` = coreutils pass-through (rtk 0.50.0), all 6 forms live and kept, T42 list unchanged; E3 `npm -g` 4 deny lines NOT removed: sub-agent dispatch refused by the auto-mode classifier (Undermining Oversight), branch bugfix/npm-global-deny empty, patch handed to the user in the run report (user hand edit, as before the run) - [ ] F faunosteo `chore/memory-v2`: `memory.sh upgrade`, `/context` before/after, /prune-memory there for BDR-080 (noisy) + LRN-080 (promotion); never merged by me - [x] G (2026-11-13): BLK-044 resolved, origin = sshd drop-in OOMScoreAdjust=-1000 inherited; lib/cc.sh raises oom_score_adj to 500 raise-only (6c10d3a, T7-oom, LRN-285); live proof `/proc//oom_score_adj` = 500 needs a fresh `cc` session (user, this session predates the fix) -- [ ] H residuals in order: phase 0 (project-rules.sh emit/extract/`..`), 4a (BLK-038, MIGRATION.md:209), 5 (fragment key allowlist), 2 LOWs (awk, `mkdir -m 700`, `cat x.key`, doctor.sh:255), 4d follow-ups (transcripts per (root, session, agent), image prompts, threshold boundary tests, `tsc`, `l:` one global key), BUGS-FOUND unfixed since 11-09, LRN-270 bisect (user-run), doctor skillOverrides residue; a residual NOT done = justified in the TODO line removal -- [ ] I model-router live checks: W4-B AC9 + parentModel done from transcripts/logs; Fable-out-of-credits + StopFailure closed "not reproducible, reopen on incident" +- [x] H (2026-11-13/14): H1 project-rules 9d5530a, H2 memory.sh d8e62c1 (BLK-038 resolved), H3 pack-census 2fb9a2f, H4a deny rows a43ba1b, H4b safety LOWs 1f107c3, H5 feedback 9f9412a (not done, justified: tsc = no compiler, `l:` 1.2 % of cap, image prompts 0 instances), H6a prose 77041e5, H6b scripts 9045a60, H7 doctor skillOverrides 9c9a024. BLK-049 strict types 08308a6; Fable 5.2 ca1dc9f. LRN-270 bisect handed to user (files in plans/2026-11-14-lrn270-bisect/). New pre-existing LOWs in BUGS-FOUND (not BDR-125). +- [x] I (2026-11-14, from 240 subagent meta files): pins hold (sonnet executors, fable verifier/security 5.1→5.2, opus analyzer); parentModel = not in logs (meta has model + pickedEffortModel only), no unpinned spawn in a demoted turn → not reproducible from logs, reopen when one runs; W4-B AC9 = user step (`/route verbose on`, classifier line is UI-only); Fable-out-of-credits + StopFailure closed "not reproducible, reopen on incident". - [ ] J /reconcile, CHANGELOG (gate 1 at 57 % delivered + each block), 0 BDR-125 line left, EVAL of the run, /close ### Context mod queue (BDR-125): one /ship-feature per phase, order (user 2026-10-25): 0 → 4a → 1 → 5 → 2 → 3 (conditional) → 4b-4d @@ -60,8 +60,8 @@ Open children of the shipped phases (History 2026-11-12), text verbatim. - 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. - [x] push-guard T63 split per kind (9045a60, H6b): 16 ask rows checked in .permissions.ask, 37 deny rows in .permissions.deny; demotion flip red. - 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. + - [x] dev System tools 11.3k vs full 7.7k: bisect handed to user (user rule 2026-11-12, interactive only): 7 files `.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+.json`, run `claude --settings ` then `/context`, compare System tools; a pack worth >1k → new TODO line. Not Claude-runnable (headless defers built-ins, LRN-270). + - [x] doctor residue check covers enabledPlugins + skillOverrides (9c9a024, H7). ### Actionable - [x] BDR-125 obsolescence pass (2026-11-09, /code-clean merged db5bbe5; report `.claude/tasks/plans/2026-11-09-bdr125-obsolescence-clean-1650.md`): D1-D6, G1-G5 and the D3 add-ons done and merged by 2026-11-12; still open below: D1b and the G2 measured passive-cost feature. diff --git a/.claude/tasks/contracts/2026-11-14-doctor-skilloverrides-residue-0010.md b/.claude/tasks/contracts/2026-11-14-doctor-skilloverrides-residue-0010.md new file mode 100644 index 0000000..65ba070 --- /dev/null +++ b/.claude/tasks/contracts/2026-11-14-doctor-skilloverrides-residue-0010.md @@ -0,0 +1,27 @@ +# CONTRACT — doctor-skilloverrides-residue (block H7) +- date: 2026-11-14 | flow: hotfix | branch: bugfix/doctor-skilloverrides-residue (off develop) +- status: active + +## REQUEST (verbatim — IMMUTABLE) +doctor.sh skillOverrides residue (block H7, TODO H line "doctor skillOverrides residue" + TODO:64 follow-up candidate): doctor.sh:145-152 user-scope residue check compares only `jq -S .enabledPlugins` HEAD vs working settings.json; a UI write into user-scope `skillOverrides` dirties tracked settings.json unseen. Fix: compare `jq -S '{enabledPlugins, skillOverrides}'` on both sides (HEAD and work), pass/skip/warn messages name both keys. 1 file, doctor.sh only. + +## CLARIFICATIONS +- [gated 2026-11-14] challenge step skipped: diagnostic-only warn, one jq filter widened on both sides, no control-flow change. + +## ACCEPTANCE CRITERIA +1. Both sides read the two keys; no `.enabledPlugins`-only filter left in the check. + CHECK: cd /home/bchanot/Documents/claude && echo $(grep -c "jq -S '{enabledPlugins, skillOverrides}'" doctor.sh)$(grep -c 'jq -S .enabledPlugins' doctor.sh) + EXPECT: 20 + EVIDENCE: MET exit=0 marker-found :: 20 +2. Messages name both keys. + CHECK: cd /home/bchanot/Documents/claude && grep -c 'enabledPlugins and skillOverrides\|enabledPlugins/skillOverrides' doctor.sh | grep -c '^[2-9]' + EXPECT: 1 + EVIDENCE: MET exit=0 marker-found :: 1 +3. shellcheck clean on doctor.sh. + CHECK: cd /home/bchanot/Documents/claude && shellcheck -x doctor.sh && echo SC-OK + EXPECT: SC-OK + EVIDENCE: MET exit=0 marker-found :: SC-OK +4. make doctor prints the pass line on the clean tree; make test green (manual, bun on PATH). + +## FILE SCOPE +doctor.sh (:145-152). TODO lines → STEP 6. diff --git a/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-design.json b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-design.json new file mode 100644 index 0000000..bb25439 --- /dev/null +++ b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-design.json @@ -0,0 +1,19 @@ +{ + "enabledPlugins": { + "model-router@skills-dir": true, + "pack-design@skills-dir": true, + "pack-scroll3d@skills-dir": false, + "pack-seo@skills-dir": false, + "pack-web-validate@skills-dir": false, + "pack-gstack-dev@skills-dir": true, + "pack-gstack-browser@skills-dir": false, + "pack-gstack-design@skills-dir": false, + "pack-higgsfield@skills-dir": false, + "pack-extras@skills-dir": false, + "ui-ux-pro-max@ui-ux-pro-max-skill": false, + "security-guidance@claude-code-plugins": true, + "pr-review-toolkit@claude-code-plugins": false, + "example-skills@anthropic-agent-skills": false, + "brightdata-plugin@synced": false + } +} diff --git a/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-gstack-browser.json b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-gstack-browser.json new file mode 100644 index 0000000..edb5d8b --- /dev/null +++ b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-gstack-browser.json @@ -0,0 +1,19 @@ +{ + "enabledPlugins": { + "model-router@skills-dir": true, + "pack-design@skills-dir": false, + "pack-scroll3d@skills-dir": false, + "pack-seo@skills-dir": false, + "pack-web-validate@skills-dir": false, + "pack-gstack-dev@skills-dir": true, + "pack-gstack-browser@skills-dir": true, + "pack-gstack-design@skills-dir": false, + "pack-higgsfield@skills-dir": false, + "pack-extras@skills-dir": false, + "ui-ux-pro-max@ui-ux-pro-max-skill": false, + "security-guidance@claude-code-plugins": true, + "pr-review-toolkit@claude-code-plugins": false, + "example-skills@anthropic-agent-skills": false, + "brightdata-plugin@synced": false + } +} diff --git a/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-gstack-design.json b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-gstack-design.json new file mode 100644 index 0000000..ca6111b --- /dev/null +++ b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-gstack-design.json @@ -0,0 +1,19 @@ +{ + "enabledPlugins": { + "model-router@skills-dir": true, + "pack-design@skills-dir": false, + "pack-scroll3d@skills-dir": false, + "pack-seo@skills-dir": false, + "pack-web-validate@skills-dir": false, + "pack-gstack-dev@skills-dir": true, + "pack-gstack-browser@skills-dir": false, + "pack-gstack-design@skills-dir": true, + "pack-higgsfield@skills-dir": false, + "pack-extras@skills-dir": false, + "ui-ux-pro-max@ui-ux-pro-max-skill": false, + "security-guidance@claude-code-plugins": true, + "pr-review-toolkit@claude-code-plugins": false, + "example-skills@anthropic-agent-skills": false, + "brightdata-plugin@synced": false + } +} diff --git a/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-scroll3d.json b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-scroll3d.json new file mode 100644 index 0000000..b64b353 --- /dev/null +++ b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-scroll3d.json @@ -0,0 +1,19 @@ +{ + "enabledPlugins": { + "model-router@skills-dir": true, + "pack-design@skills-dir": false, + "pack-scroll3d@skills-dir": true, + "pack-seo@skills-dir": false, + "pack-web-validate@skills-dir": false, + "pack-gstack-dev@skills-dir": true, + "pack-gstack-browser@skills-dir": false, + "pack-gstack-design@skills-dir": false, + "pack-higgsfield@skills-dir": false, + "pack-extras@skills-dir": false, + "ui-ux-pro-max@ui-ux-pro-max-skill": false, + "security-guidance@claude-code-plugins": true, + "pr-review-toolkit@claude-code-plugins": false, + "example-skills@anthropic-agent-skills": false, + "brightdata-plugin@synced": false + } +} diff --git a/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-seo.json b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-seo.json new file mode 100644 index 0000000..71c402b --- /dev/null +++ b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-seo.json @@ -0,0 +1,19 @@ +{ + "enabledPlugins": { + "model-router@skills-dir": true, + "pack-design@skills-dir": false, + "pack-scroll3d@skills-dir": false, + "pack-seo@skills-dir": true, + "pack-web-validate@skills-dir": false, + "pack-gstack-dev@skills-dir": true, + "pack-gstack-browser@skills-dir": false, + "pack-gstack-design@skills-dir": false, + "pack-higgsfield@skills-dir": false, + "pack-extras@skills-dir": false, + "ui-ux-pro-max@ui-ux-pro-max-skill": false, + "security-guidance@claude-code-plugins": true, + "pr-review-toolkit@claude-code-plugins": false, + "example-skills@anthropic-agent-skills": false, + "brightdata-plugin@synced": false + } +} diff --git a/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-web-validate.json b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-web-validate.json new file mode 100644 index 0000000..77d96e6 --- /dev/null +++ b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+pack-web-validate.json @@ -0,0 +1,19 @@ +{ + "enabledPlugins": { + "model-router@skills-dir": true, + "pack-design@skills-dir": false, + "pack-scroll3d@skills-dir": false, + "pack-seo@skills-dir": false, + "pack-web-validate@skills-dir": true, + "pack-gstack-dev@skills-dir": true, + "pack-gstack-browser@skills-dir": false, + "pack-gstack-design@skills-dir": false, + "pack-higgsfield@skills-dir": false, + "pack-extras@skills-dir": false, + "ui-ux-pro-max@ui-ux-pro-max-skill": false, + "security-guidance@claude-code-plugins": true, + "pr-review-toolkit@claude-code-plugins": false, + "example-skills@anthropic-agent-skills": false, + "brightdata-plugin@synced": false + } +} diff --git a/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+ui-ux-pro-max.json b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+ui-ux-pro-max.json new file mode 100644 index 0000000..59443dc --- /dev/null +++ b/.claude/tasks/plans/2026-11-14-lrn270-bisect/dev+ui-ux-pro-max.json @@ -0,0 +1,19 @@ +{ + "enabledPlugins": { + "model-router@skills-dir": true, + "pack-design@skills-dir": false, + "pack-scroll3d@skills-dir": false, + "pack-seo@skills-dir": false, + "pack-web-validate@skills-dir": false, + "pack-gstack-dev@skills-dir": true, + "pack-gstack-browser@skills-dir": false, + "pack-gstack-design@skills-dir": false, + "pack-higgsfield@skills-dir": false, + "pack-extras@skills-dir": false, + "ui-ux-pro-max@ui-ux-pro-max-skill": true, + "security-guidance@claude-code-plugins": true, + "pr-review-toolkit@claude-code-plugins": false, + "example-skills@anthropic-agent-skills": false, + "brightdata-plugin@synced": false + } +} diff --git a/.claude/tasks/plans/2026-11-14-perl-timeout-group-0030.md b/.claude/tasks/plans/2026-11-14-perl-timeout-group-0030.md new file mode 100644 index 0000000..0e20555 --- /dev/null +++ b/.claude/tasks/plans/2026-11-14-perl-timeout-group-0030.md @@ -0,0 +1,11 @@ +# PLAN — perl-timeout-group (phase 4b-4d residual, GATE 2 LOW 2026-11-13) r1 +Scope: hooks/session-start.sh (:39-47), lib/tests/session-digest.test.sh (SD19 area). + +DIAGNOSIS: `_SS_TMO=(perl -e "alarm shift; exec { \$ARGV[0] } @ARGV" 2)` (fallback when neither timeout nor gtimeout is on PATH, stock macOS). alarm's SIGALRM kills the exec'd process only. A child of memory.sh (background job, subshell) inherits stdout/stderr; the callers capture them (:263 `$(… 2>&1 >/dev/null)` stderr, :320 `rows=$(…)` stdout), so the command substitution waits for EOF until that child exits: the 2 s bound does not hold. timeout(1) has the same single-process limit only without --kill-after... (GNU timeout signals the child only too, but runs it in its own foreground handling; out of scope: timeout/gtimeout paths unchanged). SD19 (`exec sleep 8` stub) passes because the hung process IS the exec'd one. +RELATED MEMORY: none bears (no BLK/LRN on perl alarm or process groups); honors BDR-136 spirit (hooks fail open: digest prints `unknown` on rc 124). + +FIX PLAN: +1. hooks/session-start.sh:45-46: perl runner forks; child `setpgrp(0,0)` then `exec { $ARGV[0] } @ARGV` (exit 127 on exec failure); parent `setpgrp($pid,$pid)` too (closes the race before the child's own call; failure after exec ignored), `$SIG{ALRM}` → `kill 'KILL', -$pid; exit 124`; `alarm $t; waitpid $pid, 0`; exit with the child's status (`$? & 127` → 128+signal, else `$? >> 8`); fork failure → exit 125. Single-quoted perl program (no `\$` escapes). Comment :39-40 updated: "perl forks the command into its own process group and kills the group, so a child holding the pipe dies too." +2. lib/tests/session-digest.test.sh: new SD19b after SD19: memory.sh stub `sleep 8 & exec sleep 8`… no: `( sleep 8 ) &` then `sleep 8` (the background child keeps stdout/stderr open after the main process dies); same no-timeout PATH; assert run < 6 s and the digest shows `- open: unknown (memory.sh index failed)`. Flip: old runner → ≥ 8 s, red. +3. SD19 unchanged (direct hang still bounded). +RISK: low. KILL (not TERM) on the group: the bound is the goal, memory.sh read-only calls hold no lock state worth a graceful stop. Linux/macOS perl both have setpgrp/fork/kill negative pid. diff --git a/CHANGELOG.md b/CHANGELOG.md index d8f736d..f09de2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project - `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`). - Hooks: `hooks/code-limits.sh` keeps its per-session state in a private dir (`mkdir -m 700` without `-p`, else an existing dir is accepted only if it is ours, a directory and mode 700); `hooks/session-start.sh` bounds `memory.sh` and the feedback reminder with `timeout`, else `gtimeout`, else a perl alarm (stock macOS), never unbounded; the gitflow pre-commit hook (generator `lib/gitflow.sh` and both copies) blocks when `git diff --cached` or its filter fails instead of letting the commit through. Tests: `lib/tests/code-limits.test.sh` T16, `lib/tests/session-digest.test.sh` SD19, new `lib/tests/precommit-failclosed.test.sh` PC1-PC4. - `hooks/session-start.sh`: the memory digest prints `- open: none` when no blocker is open and `- open: unknown (memory.sh index failed)` when `memory.sh index blocker` fails or times out. Both cases used to print no blocker line, so a failed read looked like a clean slate. `lib/profile-state.jq` (`profile.sh current --plain`): a newline or CR in a printed value becomes a space, and a plugin id that does not match `\A[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\z` is dropped, so a settings value can no longer forge a `plugin:` line. Tests: `lib/tests/session-digest.test.sh` SD9a-SD9d, SD12; `lib/tests/profile.test.sh` T28. +- doctor.sh: the user-scope residue check compares `enabledPlugins` and `skillOverrides` between HEAD and the working `settings.json` (it compared `enabledPlugins` only), so a UI write into user-scope `skillOverrides` that dirties the tracked file is now reported; the pass and skip lines name both keys. MIGRATION "Profiles and packs" step 1 restores both keys. ## [3.0.0] — 2026-11-12 diff --git a/MIGRATION.md b/MIGRATION.md index 007ea34..e351c48 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -211,9 +211,9 @@ is the only one that removes a real directory (`make plugin` replaces the clone, not the clone itself, so resolve the root first. `git pull --autostash` (a plain `git pull` aborts when `settings.json` is modified locally and the incoming commits touch it; autostash keeps your UI - writes), then restore the user-scope plugins the old `profile.sh` had - toggled. Never `git checkout -- settings.json`: it would drop your UI - writes. + writes), then restore from HEAD the user-scope plugins the old + `profile.sh` had toggled (`enabledPlugins`) and `skillOverrides`. Never + `git checkout -- settings.json`: it would drop your UI writes. ```bash ep= next= @@ -222,11 +222,14 @@ is the only one that removes a real directory (`make plugin` replaces || { echo "no clone root"; false; } \ && git pull --autostash \ && ep="$(mktemp)" \ - && git show HEAD:settings.json | jq -e '.enabledPlugins | objects' \ - > "$ep" \ + && git show HEAD:settings.json \ + | jq -e '{enabledPlugins, skillOverrides} + | select((.enabledPlugins | type) == "object")' > "$ep" \ && next="$(mktemp)" \ - && jq --slurpfile ep "$ep" '.enabledPlugins = $ep[0]' settings.json \ - > "$next" \ + && jq --slurpfile ep "$ep" '.enabledPlugins = $ep[0].enabledPlugins + | if $ep[0].skillOverrides == null then del(.skillOverrides) + else .skillOverrides = $ep[0].skillOverrides end' \ + settings.json > "$next" \ && jq -e . "$next" >/dev/null && [ -s "$next" ] \ && cp "$next" settings.json rm -f "$ep" "$next" @@ -236,10 +239,12 @@ is the only one that removes a real directory (`make plugin` replaces `cp`, which writes through the symlink into the live tracked `settings.json`; a failure prints `no clone root` or stops the chain without closing your shell. `ep= next=` comes first so the final `rm -f` - never removes a file an earlier run named. `jq -e '.enabledPlugins | - objects'` fails when HEAD holds no object (a null would wipe every - plugin). `jq -e .` and `[ -s ]` refuse an invalid or empty result (an - empty file would drop the plugins, the deny rules and the hooks). + never removes a file an earlier run named. The first `jq -e` produces + nothing, and fails, when HEAD's `enabledPlugins` is not an object (a + null would wipe every plugin); a HEAD without `skillOverrides` removes + the key instead of writing a null. `jq -e .` and `[ -s ]` refuse an + invalid or empty result (an empty file would drop the plugins, the deny + rules and the hooks). If the autostash pop conflicts, `settings.json` holds conflict markers: the second `jq` then fails closed and nothing is copied. Resolve the diff --git a/doctor.sh b/doctor.sh index d4ae484..97a7f9d 100644 --- a/doctor.sh +++ b/doctor.sh @@ -142,12 +142,12 @@ fi if grep -Eq 'alias cc=|dtach_claude' "$HOME/.bashrc" 2>/dev/null; then warn "\$HOME/.bashrc still has alias cc= or dtach_claude: remove them, the alias shadows cc()" fi -_ep_head="$(git -C "$REPO" show HEAD:settings.json 2>/dev/null | jq -S .enabledPlugins 2>/dev/null || true)" -_ep_work="$(jq -S .enabledPlugins "$REPO/settings.json" 2>/dev/null || true)" +_ep_head="$(git -C "$REPO" show HEAD:settings.json 2>/dev/null | jq -S '{enabledPlugins, skillOverrides}' 2>/dev/null || true)" +_ep_work="$(jq -S '{enabledPlugins, skillOverrides}' "$REPO/settings.json" 2>/dev/null || true)" if [ -z "$_ep_head" ] || [ -z "$_ep_work" ]; then - warn "enabledPlugins check skipped (jq or git show failed)" + warn "enabledPlugins and skillOverrides check skipped (jq or git show failed)" elif [ "$_ep_head" = "$_ep_work" ]; then - pass "settings.json enabledPlugins matches HEAD (no user-scope residue)" + pass "settings.json enabledPlugins and skillOverrides match HEAD (no user-scope residue)" else warn "user-scope residue: $(diff <(echo "$_ep_head") <(echo "$_ep_work") | grep '^[<>]' | tr -s ' ' | tr '\n' ';'); restore per MIGRATION "Profiles and packs" step 1" fi