From 005bfe185d17a64496b9a22f42bd3113260457f3 Mon Sep 17 00:00:00 2001 From: bchanot Date: Mon, 2 Nov 2026 19:06:52 +0100 Subject: [PATCH] chore(tasks): phase 2 GATE 0 evidence (criterion 11 abandoned with reason, 16 proposed), TODO phase 2 shipped + residuals + hand-over --- .claude/tasks/TODO.md | 12 +++++++----- .../2026-11-02-phase2-guards-1545.md | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 12df63b..b6ba0f2 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -20,7 +20,7 @@ Shared rules for every phase: - [x] **Phase 0, no mod: split project CLAUDE.md** (this repo + the lever, feature/claude-md-split, 2026-10-26; merge on user signal). Four rules under `.claude/rules/` (rules-maintenance, graphify-vendored, mods, transient-artifacts `# static-check: skip`), `lib/project-rules.sh` check/matches/sections/extract/emit (`-C `) + suite, `hooks/instructions-loaded.sh` (log `~/.claude/logs/instructions-loaded.jsonl`, session + agent ids), `!.claude/rules/` here + socle, `/onboard split` + onboarder `MODE: split`, generators emit docker/testing/ci from `templates/project-rules/`. Baseline 2026-10-26 `/context`: 32.2k total, Memory files 11.6k, project CLAUDE.md 2.1k. - [x] Proof, this repo (journal 2026-10-26: headless 17:00:07Z 4 Project `path_glob_match`, sub-agent 17:00:33Z loads rules too; `/context` after merge = the 2026-10-28 baseline 30.5k; verified 2026-11-02 /reconcile). Was: `/context` after the merge; one fresh session Reading one file per rule → 4 Project `path_glob_match` lines; one sub-agent Read → does a path rule load inside a sub-agent. Results in the journal. - [x] User step: `claude mcp remove -s user higgsfield` (done: `~/.claude.json` mcpServers empty 2026-11-02; higgsfield is a claude.ai connector, denied per profile since phase 5). - - [ ] Phase 2 folds: narrow the pre-commit `.claude/**` exemption so a rules-only commit cannot land on develop/main (deferred 2026-10-26). + - [ ] Phase 2 folds: narrow the pre-commit `.claude/**` exemption so a rules-only commit cannot land on develop/main (deferred 2026-10-26; NOT done by phase 2 2026-11-02, still open: its own /feat on the generated pre-commit). - [x] **Phase 0b, per-repo pass** (2026-10-27: 10 repos classified; split on branches awaiting the user's merge: zenquality 1942dcf 4 rules 46%, game 527bdcc 2 rules, angelscar356 ab75ecd 1 rule; keep-everything verdict, no branch: config, integration_alphalink, robin_petier, trucks_at_work, bchanot-cv, for_you, nuit-folle (all sections always-on by the S4 rule); faunosteo 7a75974 11 rules on the user's feature branch, 31.9k → 27.2k; zenquality/game/angelscar356 merged 0ff05f1/d9be6b1/853b55b; proof per repo = the user's next session there) (after phase 0 merges; via `/onboard split`, one `chore/claude-md-split` per repo off develop, approval per repo, never an automatic merge; `/context` before/after in that repo's journal). Order by size: faunosteo 52,322 chars (on feature/v1-1-clients-animals with 5 dirty files: finish or stash first, S1 refuses otherwise), zenquality 23,378, game 14,918 (on feature/replay-hint), robin_petier 12,895, config 4,990, integration_alphalink 4,249. None has `.claude/rules/` yet; all use the `.claude/*` file form (BDR-003). Sections a sub-agent needs stay always-on unless the phase 0 sub-agent proof says path rules load there (proof 2026-10-26: they do; verify per repo). - [x] Before faunosteo: `###` granularity shipped 2026-10-27 (feature/rules-h3-extract ab5049e: `extract '### title'`, `sections --depth 3`, split rows `### `). Was: decide `###` granularity (STEP 6 review 2026-10-26). - [x] /feat extract-hardening (2026-10-27, 14a93e3: `_rules_out_path_ok` refuses absolute, `..`, existing or dangling-link out; mkdir and rule-write rc checked before the source rewrite; S0.3 prose in the lib case order; 139 checks). Was: /hotfix after 0b, lib/project-rules.sh `extract` (security gate 2026-10-27, pre-existing, non-blocking): check the `> "$out"` group and `mkdir -p` rc before rewriting `$src` (today a failed rule write still removes the section, rc 0); `[ -e "$out" ] || [ -L "$out" ]` and refuse `..`/absolute `<out>`; onboarder S0.3 says `####x` is a bare title but the lib rejects it (align the prose). Its path-bound content (i18n, Schemas, Stores, PDF, Supabase, Storage, 12.6 KB) sits in `###` subsections of the always-on `## Project conventions`; `##`-only extract moves ~1.5% of the file. Option: `extract` accepts a `###` heading (section ends at the next heading of the same or higher level), `sections --depth 3`. User decides; `game` also has a `'` in `## 4. POINTS D'ATTENTION…` (S4 refuses it until renamed, or extract by index). @@ -86,7 +86,9 @@ Shared rules for every phase: - Proof: two concurrent conversations in one project and two projects, canaries prove different listings, MCP and hooks per pack; `/context` per profile; nothing references `skills-disabled/` or `toggle-external.sh`. - Cleanup: `lib/profile.sh` symlink toggling + `skills-disabled/` (24 entries), user-scope plugin toggling in `set|apply|reset`, `lib/toggle-external.sh` (retire or rewire to packs) + `lib/tests/higgsfield.test.sh` + the CLAUDE.global.md "toggle-external.sh enable higgsfield" lines, every writer of the old layout (install-plugins.sh, update-all.sh, gstack and 21st installers), Makefile `profile*` targets rewired, `/profile` skill rewritten for packs, plugin-gate prose tied to global toggling, banner hint "/plugin-check before starting a new project", doctor profile checks, profile tests rewritten; `lib/profiles/*.profile` → `.json`. -- [ ] **Phase 2, guards** (in progress 2026-11-02: /ship-feature on feature/phase2-guards, contract `.claude/tasks/contracts/2026-11-02-phase2-guards-1545.md`, spec `docs/superpowers/specs/2026-11-02-phase2-guards-design.md` approved) (redesigned 2026-10-25 after a 3-lens challenge, re-challenged the same day: native ask gate, guard hosted in model-router, interpreters in prose, commit-msg hook deferred) +- [x] **Phase 2, guards** (shipped 2026-11-02 on feature/phase2-guards, merge on user signal: bench `.claude/tasks/plans/2026-11-02-phase2-bench/` (16 ask, 7 deny approved; quoted finish rule, `gitflow_finish*`, `bash -s*` not approved), rtk rc 3 passthrough 60ee4a9, router write guard with a session skill latch 22ff57b + 9bbd1d5, code-limits hook f21e265, locks T62/T63 9887c14, settings 6899a72, release finish in the main loop 536d39e, doctrine 0bf4620, CHANGELOG c3a6977; contract `.claude/tasks/contracts/2026-11-02-phase2-guards-1545.md`) (redesigned 2026-10-25 after a 3-lens challenge, re-challenged the same day: native ask gate, guard hosted in model-router, interpreters in prose, commit-msg hook deferred) + - [ ] 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 <dir> merge` (soft_deny prose only). + - [ ] User hand edit (phase 2 hand-over): remove the 6 dead deny entries (`Bash(docker run * -v /:*)`, `Bash(git push * :*)`, `Write(**/.git/config)`, `Write(**/.gitconfig)`, `Write(~/.gitconfig)`, `Write(~/.config/git/config)`) and, if wanted, the 6 obsolete `rtk cat|head|tail` forms; lib/tests/push-guard.test.sh T41 (the 4 Write lines) and T42 (base = last release) must be edited alongside. - Killed by the challenges: the phrase-list merge gate; the `$.ui.ask` mod gate (its BDR-068 exception detector was never true: finish runs in the user's reply turn; a hard_deny naming mod sources was the robustness BLOCKER); G2 destructive guard (BLK-022, stays a user-driven task); whole-file code-limit reports (1498 lines > 80 cols across 92 files, over-fires); parsing commit text from Bash; Bash write-form detection in the routing guard (no measured Bash evasion, every inline write was Edit/Write). - Merge gate = native `ask` rules in settings.json, no mod (user pick 2026-10-25; bench r3 G1-G7: all forms DENIED headless incl. `"$HOME"`, absolute path, after `source`; `start` RAN): `Bash(bash */gitflow.sh finish*)`, `Bash(gitflow_finish*)`, `Bash(git merge *)`; evaluate in the same bench `Bash(git pull *)` and `git push x:develop` forms before adding them. Trade-off accepted: the BDR-068 /close auto-finish gets one dialog click (ask beats allow, no exemption); release-executor finish prompts too (its dispatcher runs finish inline if a sub-agent cannot prompt, BLK-018 option b). hard_deny line: "never edit `permissions.ask` to skip the gate". - Routing guard (user pick: "always through a skill") hosted in `mods/model-router` (owner of the only run signal; mod state is plugin-private, `runMain` is BEST-tier-only and never ends: wrong signal). `tool.call` on Edit/Write/NotebookEdit of a code file by the MAIN loop (no `agentId`) → deny with reason "route through /hotfix (≤2 files, obvious), /feat, /bugfix or /ship-feature" UNLESS this turn's `turnMain.source ∈ {skill, model}` or a `/route` sticky is in force (explicit escape hatch). Free: docs (.md), `.claude/**`, sub-agents, any write inside a skill run. Bash write forms deferred until a measured evasion. hard_deny gains "a guard redirect is not a refusal to route around: enter the skill". Doctrine: the ceiling bullet becomes "the main loop writes no code outside a skill run, whatever the model". Proof: routing bench cases (L3 must enter a skill), long-brief replay in a clone, false-deny fixtures (doc edits, executor edits, in-skill edits), guard-off = today. @@ -121,14 +123,14 @@ Shared rules for every phase: - [ ] post-run-D residuals (gates, 2026-10-07): settings.json soft_deny names only `gitflow.autopush false` → add "or an unparseable value" (restriction only, settings run); capitalize STEP 6: manual mode with `ahead` = 0 (user pushed by hand between merge and read) matches no closing line, and the 5C `ahead` = 0 bullet still says "(auto-push mode did it)"; release-executor:86 line > 80 cols; push-guard header line 4 > 80 cols (pre-existing); unpushed-guard Stop silence now also covers a missing lib (SessionStart names it) — accepted - [ ] gitflow LOW leftovers (run B, rest done in run D 472cccb): `--end-of-options`/`--` on refname args and `printf %q` in copy-paste hints; `gitflow_delete`: check `_gitflow_checkout_containing_base` rc (lib/gitflow.sh:270) before `--unset-upstream` -- [ ] docker host-root mount spellings uncovered by deny (security gate 2026-10-23, pre-existing): `--volume /:/x`, `-v=/:/x`, `--mount type=bind,source=/,...`; prove each with a harmless analogue (`--settings` one-rule file) before adding +- [ ] docker host-root mount spellings uncovered by deny (security gate 2026-10-23, pre-existing): `--volume /:/x`, `-v=/:/x`, `--mount type=bind,source=/,...`; prove each with a harmless analogue (`--settings` one-rule file) before adding Not folded by phase 2 (2026-11-02): needs its own bench rows. - [ ] 6 dead deny entries (`Bash(docker run * -v /:*)`, `Bash(git push * :*)`, 4 `Write(...)`) kept by the push-guard T41/T42 non-weakening lock; drop them with a justified-removal list in T42 at the next release (working forms added 2026-10-23) ### Release 3.0.0 - [ ] MIGRATION.md "Upgrading to 3.0.0" (CHANGELOG Unreleased says breaking: typed `/effort-*` removed; only the 2.0.0 section exists) - [ ] routing.json `confirmed` (15 agents, 11 phases, 3 skills) ships to every clone (by design: decisions travel); revisit at the 3.0.0 cut - [ ] CHANGELOG [2.0.0] "Linux `make test` still to be done after 2.0.0" is stale: suite green on Linux (bchanot-server, 2026-10); note it under Unreleased -- [ ] BLK-018 decide at 3.0.0: release-executor finish span vs classifier (did not recur at 2.0.0, no fix applied) +- [x] BLK-018 decided 2026-11-02 (phase 2, option b): /release-candidate runs `gitflow.sh finish` and the tag in the main loop under the ask prompt; release-executor keeps prep only (536d39e) ### Docs backlog (doc-sync 2026-10-06) - [ ] P17 README restructure to Standard-Readme (Install / Usage / Configuration / License); move inline reference parts to USAGE.md, CONFIGURE.md from settings.json + .env.example @@ -137,7 +139,7 @@ Shared rules for every phase: - [ ] P32 USAGE missing sections: design work (21st CLI, design stack, /site-motion), media generation (Higgsfield toggles), gitflow auto-push + global hooks - [ ] P33 USAGE token figures ("Budget Pro ~11k tokens/5h", per-pattern) have no source in code — verify or drop - [ ] P34 USAGE + agents/plugin-advisor.md "gstack ON/OFF", "context7 ON" vocabulary — gstack is per-profile, ctx7 is a CLI; move both together -- [ ] P41 templates/settings/settings.json: `permissions.ask` entries (npx, docker rm, make deploy, psql…) inert under defaultMode auto → config fix, not doc +- [x] P41 (2026-11-02): `ask` prompts under auto mode (bench + interactive check), so the template ask list is live, not inert; README and SETTINGS.md corrected (0bf4620) ### User decisions and hand edits - [ ] user decision: pin a commit for higgsfield-ai/skills and a version for `@higgsfield/cli` (security gate, 2 MEDIUM, accepted as is) diff --git a/.claude/tasks/contracts/2026-11-02-phase2-guards-1545.md b/.claude/tasks/contracts/2026-11-02-phase2-guards-1545.md index b62a56b..abb00ad 100644 --- a/.claude/tasks/contracts/2026-11-02-phase2-guards-1545.md +++ b/.claude/tasks/contracts/2026-11-02-phase2-guards-1545.md @@ -55,30 +55,37 @@ STEP 3 gate `[gated 2026-11-02]` (user: "oui aux trois, le prompt s'affiche, lan 8. `make test` all suites green, shellcheck clean, mods suite green (`claude plugin test`); settings.json changes on the branch limited to `permissions.ask/deny`, `autoMode`, `hooks.PostToolUse` (no UI write, no `model`). CHECK: cd /home/bchanot/Documents/claude && t=$(make test 2>&1) && printf '%s\n' "$t" | grep -q 'all suites green' && shellcheck ./*.sh hooks/*.sh lib/*.sh && echo GREEN EXPECT: GREEN - EVIDENCE: pending + EVIDENCE: MET exit=0 marker-found :: GREEN 9. Proof recorded (plan, journal): the routing bench L3 prompt enters a skill in a clone under the guard; the long-brief replay; `/close` ritual finishes after one click (user-run, interactive); guard off = today. 10. TODO: phase 2 item ticked with what shipped; folded items (docker mount spellings, P41) closed or re-queued with the measured fact; T42 dead-entry drop handed to the user. 11. `[gated 2026-11-02]` Bench: `.claude/tasks/plans/2026-11-02-phase2-bench/` holds run.sh, bench.sh, cases.tsv, results.tsv (permissionMode column, every kept row `auto`), rtk.tsv, approved.txt and phase2.jq; a rule is in approved.txt only when every row naming it hit its want and one of them expects ASKED/DENIED; M3q (quoted finish form) ASKED. CHECK: cd /home/bchanot/Documents/claude/.claude/tasks/plans/2026-11-02-phase2-bench && [ -s approved.txt ] && grep -qF 'Bash(bash "*gitflow.sh" finish*)' approved.txt && awk -F'\t' '$2=="M3q"' results.tsv | tail -1 | grep -q 'ASKED' && echo BENCH-OK EXPECT: BENCH-OK - EVIDENCE: pending + EVIDENCE: NOT-MET exit=1 (nonzero) :: 12. `[gated 2026-11-02]` Guard: register.test.ts holds the GUARD tests of plan Task 3 + R3 (redirect before any skill, free paths, `~/.claude` and worktrees are code, sub-agent free, latch across a typed apply skill and a model-loaded unrowed skill, sub-agent Skill call does not latch, route-tool phase for one turn, typed /route, /route clear and /route off→on re-arm, /model hand pick does not open, /clear re-arms, `/../` paths are code); the mods suite is green. CHECK: cd /home/bchanot/Documents/claude && [ "$(/usr/bin/grep -c "^test('GUARD:\|^ test(\`GUARD:" mods/model-router/hooks/register.test.ts)" -ge 14 ] && a=$(make test suite=lib/tests/mods.test.sh 2>&1) && printf '%s\n' "$a" | grep -q 'all suites green' && echo GUARD-OK EXPECT: GUARD-OK - EVIDENCE: pending + EVIDENCE: MET exit=0 marker-found :: GUARD-OK 13. `[gated 2026-11-02]` Hooks: the rtk suite holds T11-T13 and the pin matches; the code-limits suite passes 14 checks; both hooks shellcheck clean and ≤ 80 columns. CHECK: cd /home/bchanot/Documents/claude && (cd hooks && sha256sum -c .rtk-hook.sha256 >/dev/null) && a=$(make test suite=lib/tests/rtk-rewrite.test.sh 2>&1) && printf '%s\n' "$a" | grep -q 'all suites green' && b=$(make test suite=lib/tests/code-limits.test.sh 2>&1) && printf '%s\n' "$b" | grep -q 'PASS=14 FAIL=0' && shellcheck hooks/rtk-rewrite.sh hooks/code-limits.sh && [ "$(awk 'length($0) > 80' hooks/code-limits.sh | wc -l)" = 0 ] && echo HOOKS-OK EXPECT: HOOKS-OK - EVIDENCE: pending + EVIDENCE: MET exit=0 marker-found :: HOOKS-OK 14. `[gated 2026-11-02]` Settings: every approved rule and every rtk read twin is present (push-guard T62, T63 green), no old entry left any permissions or autoMode list (set check against develop), `hooks.PostToolUse` registers code-limits, the branch diff of settings.json carries no `theme`, `model` or `switchModelsOnFlag` change. CHECK: cd /home/bchanot/Documents/claude && a=$(make test suite=lib/tests/push-guard.test.sh 2>&1) && printf '%s\n' "$a" | grep -q 'all suites green' && [ "$(jq -n --slurpfile o <(git show develop:settings.json) --slurpfile n <(git show HEAD:settings.json) '[["permissions","allow"],["permissions","ask"],["permissions","deny"],["autoMode","allow"],["autoMode","soft_deny"],["autoMode","hard_deny"]] | map(. as $p | ($o[0] | getpath($p)) - ($n[0] | getpath($p))) | add | length')" = 0 ] && git show HEAD:settings.json | jq -e '.hooks.PostToolUse[] | select(.hooks[0].command == "bash ~/.claude/hooks/code-limits.sh")' >/dev/null && ! git diff develop..HEAD -- settings.json | grep -qE '^[-+] *"(theme|model|switchModelsOnFlag)"' && echo SETTINGS-OK EXPECT: SETTINGS-OK - EVIDENCE: pending + EVIDENCE: MET exit=0 marker-found :: SETTINGS-OK 15. `[gated 2026-11-02]` Release and capitalize: no `SPAN: finish` or `finish+tag` left in skills, agents, lib, README.md, USAGE.md; release-candidate STEP 5 runs `gitflow.sh finish` and `git tag -a` in the main loop; capitalize 5C and STEP 6 name the declined-prompt outcome. CHECK: cd /home/bchanot/Documents/claude && ! /usr/bin/grep -rqn 'SPAN: finish\|finish+tag' skills agents lib README.md USAGE.md && /usr/bin/grep -q 'git tag -a v<X.Y.Z> main' skills/release-candidate/SKILL.md && /usr/bin/grep -qi 'declined' skills/capitalize/SKILL.md && echo RELEASE-OK EXPECT: RELEASE-OK - EVIDENCE: pending + EVIDENCE: MET exit=0 marker-found :: RELEASE-OK + +16. (PROPOSED 2026-11-02 by the controller, pending the user; replaces 11) Bench: the directory holds run.sh, bench.sh, cases.tsv, results.tsv (permissionMode column, every row `auto`), rtk.tsv, approved.txt, phase2.jq; approved.txt holds `Bash(bash *gitflow.sh finish*)`; the quoted call-site form `bash "$HOME/…/gitflow.sh" finish` is ASKED under it, isolated (M3x) and with the live settings (L6). + CHECK: cd /home/bchanot/Documents/claude/.claude/tasks/plans/2026-11-02-phase2-bench && for f in run.sh bench.sh cases.tsv results.tsv rtk.tsv approved.txt phase2.jq; do [ -s "$f" ] || exit 1; done && grep -qF 'Bash(bash *gitflow.sh finish*)' approved.txt && awk -F'\t' '$2=="M3x"' results.tsv | tail -1 | grep -q 'ASKED' && awk -F'\t' '$2=="L6"' results.tsv | tail -1 | grep -q 'ASKED' && ! awk -F'\t' '$2 ~ /^[A-Z][0-9]/ && $6 != "" && $6 != "auto"' results.tsv | grep -q . && echo BENCH-OK + EXPECT: BENCH-OK + EVIDENCE: MET exit=0 marker-found :: BENCH-OK + +ABANDON: 11 the M3q clause is impossible: the permission matcher does not match a literal quote inside a pattern (M3q `Bash(bash "*gitflow.sh" finish*)` RAN, M6q RAN), so that rule cannot be approved; the clause's purpose (the quoted finish form every skill types is asked) is met by `Bash(bash *gitflow.sh finish*)` (M3x ASKED isolated, L6 ASKED live); handoff: criterion 16 proposed, the user accepts or rejects it at the merge gate. ## FILE SCOPE (final, STEP 3 `[gated 2026-11-02]`) - settings.json (`permissions.ask`, `permissions.deny`, `autoMode.hard_deny/soft_deny`, `hooks.PostToolUse`) through the index recipe