diff --git a/.claude/memory/blockers.md b/.claude/memory/blockers.md index 125a747..179c9eb 100644 --- a/.claude/memory/blockers.md +++ b/.claude/memory/blockers.md @@ -424,3 +424,9 @@ rules: - **Real cause**: lib/memory.sh `memory_index` `[ -f "$file" ] || continue` treated present non-regular registry as absent; awk rc of `_mem_index_rows` dropped (fn rc = trailing echo). hooks/session-start.sh `_digest_blockers` skipped unparsable `| BLK-` rows. - **Solution**: 87aecc1. Kind named (strict) → rc 2 + stderr `memory: : not a readable regular file`; no kind (lax, mods/memory register.ts recall) → skip bad registry + stderr, rc 0. Rows captured before print, healthy output byte-identical. Digest prints `- open: unknown (memory.sh index failed)` on unparsable row. Tests SD9b/c re-pinned, SD9f/g/h, T20*. Residuals BUGS-FOUND 07f9a7f. - **Reference**: lib/memory.sh, hooks/session-start.sh, lib/tests/memory.test.sh, lib/tests/session-digest.test.sh + +## BLK-051 — DEGRADED security scan read as clean PASS: readers parsed VERDICT line, DEGRADED prints on TOOL line [resolved] (2026-11-19) +- **Friction**: DEGRADED security scan (semgrep absent) read as clean PASS: checklist + `make plugin` hint never surfaced, hotfix `SECURITY: DEGRADED (checklist only)` unreachable. +- **Real cause**: security-auditor prints `SECURITY — VERDICT: PASS` on DEGRADED scan, DEGRADED only on `TOOL:` line. lib/verify-secure-loop.md, agents/security-auditor.md ORCHESTRATOR PROTOCOL, skills/hotfix/SKILL.md STEP 4 listed `DEGRADED` as VERDICT-line sibling value after terminal `PASS` bullet → never fired. PASS without `TOOL:` line not structural → also read as full scan. Shipped in v3.0.0. +- **Solution**: 9814720. PASS bullet reads `TOOL:` line first; old DEGRADED bullets removed; PASS without `TOOL:` = structural (retry once, escalate). lib/effort-shift.md item 3 names line (LRN-300). loops-light section locks readers + feat/bugfix skip sentence (78/78; 16 FAIL on develop). Residual minors BUGS-FOUND 2026-11-19. +- **Reference**: lib/verify-secure-loop.md, agents/security-auditor.md, skills/hotfix/SKILL.md, lib/effort-shift.md, lib/tests/loops-light.test.sh, BUGS-FOUND:134 diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index ea142de..8aa40a0 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -781,3 +781,6 @@ rules: ## 2026-11-18 - gates.sh hotfix c25a7ea (bugfix/gates-label-timeout): digit label not `N. text` = parse error; 2nd CHECK/EXPECT/EVIDENCE on one criterion = error (indented/bullet/bold labels gave same false MET, advisor caught it); no-criteria die names first parse error; default timeout 120 -> 600. GATE 0 MET 5/5 incl full make test at default, security PASS, 3 challengers SOLID. ABANDON-id aliasing + verify-secure-loop cause list -> TODO. - Advisor run B3 (/ship-feature, 2b7aeb8 51f343f): 12 callers route rides first challenge-plan call + summary Advisor row; feat/bugfix skip end call on strict clean gates (MET, CONFORME, PASS not DEGRADED, first attempt), ADVISOR field; item 3 commit step + reuse names later code commits. 3 lenses + re-challenge (3 MAJOR fixed), opus STEP 6 caught DEGRADED on TOOL line (LRN-300). Gates clean x2. + +## 2026-11-19 +- /bugfix degraded-tool-line 9814720: 3 security readers read DEGRADED off TOOL line (BLK-051), BUGS-FOUND:134 FIXED, TODO:13 done, 2 pre-existing minors logged; CHANGELOG Fixed entry. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 859480b..eafdb34 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -10,7 +10,7 @@ Done history before 2026-10-08 removed 2026-10-23 (git keeps it: `git log -p -- - [x] DONE 2b7aeb8, merged 366f1f6 (docs 575408c, audits 8733669 8f23683, memory 49cc13c) (run B3, /ship-feature feature/advisor-points-b3): route line now "send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due" in the 12 callers. Was: The 12 skills send their reflect route with the challenger dispatch, after the advisor call now (low; moved out of B2 by the user 2026-11-17) - [x] DECIDED user 2026-11-18 "skip when gates clean" (strict), DONE 2b7aeb8 + 51f343f (run B3). Was: Decide: feat/bugfix end-of-run advisor call has no skip (audit-delta/tour skip when no fix was applied); nominal /feat or /bugfix = 2 main-loop advisor calls (plan + end), ~0.6-1.4M uncached tokens late in a session; ship-feature STEP 6 opus review and the end call review the same branch back to back (B2 STEP 6 review, user decision) - [x] After B1 DONE (doc commit + BDR-150 status + LRN-296): README/USAGE/CHANGELOG say "before writing a skill's plan (/feat, /bugfix, /ship-feature)" and list 3 agents → doc-sync; BDR-150 status line -- [ ] loops-light lock on the feat/bugfix skip sentence ("each on its first attempt", "(not DEGRADED)"): B3 contract CHECKs are one-shot (robustness challenger, run B3) +- [x] DONE 9814720 (/bugfix degraded-tool-line, with BUGS-FOUND:134). Was: loops-light lock on the feat/bugfix skip sentence ("each on its first attempt", "(not DEGRADED)"): B3 contract CHECKs are one-shot (robustness challenger, run B3) - [ ] a11y:201, guardrails:278, ship-feature:325, init-project:361 end lines: restate item 3's merge-reuse clause ("reuses the last run's answer, or its skip, and names any code commit made after it"); item 3 loads only via the lib (B3 final review, low) - [ ] Run C /feat: advisor usage section in /memory-feedback (main loop vs sub-agents, model served, input tokens; dedupe usage rows by message.id, model from the `advisor_message` iteration) - [x] Stale citers after A: README/USAGE/CHANGELOG patched, BUGS-FOUND residual superseded + LOW logged, BDR-150 status, LRN-295 (LRN-294 kept: its lesson holds) diff --git a/.claude/tasks/contracts/2026-11-19-degraded-tool-line-0930.md b/.claude/tasks/contracts/2026-11-19-degraded-tool-line-0930.md new file mode 100644 index 0000000..8e34f3a --- /dev/null +++ b/.claude/tasks/contracts/2026-11-19-degraded-tool-line-0930.md @@ -0,0 +1,41 @@ +# CONTRACT — degraded-tool-line +- date: 2026-11-19 | flow: bugfix | branch: bugfix/degraded-tool-line +- status: active + +## REQUEST (verbatim — IMMUTABLE) +Merge et corrige le bug et fais les todo + +Scope of this run (main loop, from the previous turn's report): "le bug" = BUGS-FOUND.md:134 (security-auditor prints `VERDICT: PASS` on a DEGRADED scan, DEGRADED only on its `TOOL:` line; lib/verify-secure-loop.md, agents/security-auditor.md and skills/hotfix/SKILL.md teach DEGRADED as a VERDICT-line value); TODO:13 (loops-light lock on the feat/bugfix skip sentence) folds in as the regression test. TODO:14 and Run C are separate runs. + +## CLARIFICATIONS +Q: fix plan (.claude/tasks/plans/2026-11-19-degraded-tool-line-0930.md, STEP 3 gate with challenge summary) / A: yes [gated 2026-11-19] + +## ACCEPTANCE CRITERIA +1. loops-light carries the new locks and is green: 78 pass, 0 fail. + CHECK: cd /home/bchanot/Documents/claude && bash lib/tests/loops-light.test.sh 2>&1 | tail -1 | grep -qF '78 pass, 0 fail' && echo LOCKS-78 + EXPECT: LOCKS-78 + EVIDENCE: MET exit=0 marker-found :: LOCKS-78 +2. No reader lists DEGRADED as a VERDICT value: the backticked token `DEGRADED` is gone from the three readers. + CHECK: cd /home/bchanot/Documents/claude && ! grep -qF '`DEGRADED`' lib/verify-secure-loop.md agents/security-auditor.md skills/hotfix/SKILL.md && echo OLD-VALUE-GONE + EXPECT: OLD-VALUE-GONE + EVIDENCE: MET exit=0 marker-found :: OLD-VALUE-GONE +3. Each of the three readers' PASS branch reads the TOOL line first and makes a PASS without it a structural failure (joined text). + CHECK: cd /home/bchanot/Documents/claude && n=0; for f in lib/verify-secure-loop.md agents/security-auditor.md skills/hotfix/SKILL.md; do tr '\n' ' ' < "$f" | tr -s ' ' | grep -qF '`PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent) shows there, never on the VERDICT line; a PASS with no `TOOL:` line is a structural failure (below).' && n=$((n+1)); done; [ "$n" -eq 3 ] && echo READERS-3 + EXPECT: READERS-3 + EVIDENCE: MET exit=0 marker-found :: READERS-3 +4. The auditor's and hotfix's structural-failure lists name a PASS with no TOOL line (joined text). + CHECK: cd /home/bchanot/Documents/claude && tr '\n' ' ' < agents/security-auditor.md | tr -s ' ' | grep -qF 'PASS without PROOF or without `TOOL:` line) → retry ONCE fresh' && tr '\n' ' ' < skills/hotfix/SKILL.md | tr -s ' ' | grep -qF 'Structural failure (mute / unparsable / no VERDICT line / PASS with no `TOOL:` line) → treat as a failed gate' && echo STRUCT-2 + EXPECT: STRUCT-2 + EVIDENCE: MET exit=0 marker-found :: STRUCT-2 +5. lib/effort-shift.md § Advisor item 3 names the line DEGRADED prints on, and hotfix's DEGRADED PASS sets its SECURITY field. + CHECK: cd /home/bchanot/Documents/claude && tr '\n' ' ' < lib/effort-shift.md | tr -s ' ' | grep -qF '`skipped (gates clean on first pass)`; DEGRADED shows on the auditor'"'"'s `TOOL:` line. A skipped call discharges' && tr '\n' ' ' < skills/hotfix/SKILL.md | tr -s ' ' | grep -qF 'a DEGRADED PASS sets the summary'"'"'s SECURITY field to `DEGRADED (checklist only)`' && echo EFF-HOT-OK + EXPECT: EFF-HOT-OK + EVIDENCE: MET exit=0 marker-found :: EFF-HOT-OK +6. Full make test green. + CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test &1 | tail -1 + EXPECT: all suites green + EVIDENCE: MET exit=0 marker-found :: all suites green +7. The new locks are red on develop's readers (16 FAIL simulated on a scratch clone before dispatch); no wording changed outside the plan's blocks; new prose lines ≤ 80 columns (manual). + +## FILE SCOPE +lib/verify-secure-loop.md, agents/security-auditor.md, skills/hotfix/SKILL.md, lib/effort-shift.md, lib/tests/loops-light.test.sh diff --git a/.claude/tasks/plans/2026-11-19-degraded-tool-line-0930.md b/.claude/tasks/plans/2026-11-19-degraded-tool-line-0930.md new file mode 100644 index 0000000..9a1d635 --- /dev/null +++ b/.claude/tasks/plans/2026-11-19-degraded-tool-line-0930.md @@ -0,0 +1,190 @@ +# Bugfix plan: DEGRADED read off the wrong line (BUGS-FOUND:134 + TODO:13) + +## DIAGNOSIS +BUG: three gate readers teach DEGRADED as a value of the `SECURITY — VERDICT:` line. +ROOT CAUSE: agents/security-auditor.md OUTPUT (:133-134) prints +`SECURITY — VERDICT: PASS | BLOCK(n) | ERROR()`; DEGRADED appears only on the +`TOOL:` line (`ABSENT (DEGRADED — checklist only; install: make plugin)`). The parse +lists in lib/verify-secure-loop.md:111-128, agents/security-auditor.md:184-192 and +skills/hotfix/SKILL.md:182-183 end their parse at a terminal `PASS` bullet and list +`DEGRADED` as a sibling value of the VERDICT line. A reader parsing the VERDICT line +never sees it: a DEGRADED scan reads as a clean PASS (the hotfix SECURITY summary field, +the feat/bugfix end-of-run skip, the "surface the checklist + recommend make plugin" +step never fires). A PASS with no `TOOL:` line is not named a structural failure, so it +also reads as non-DEGRADED. +EVIDENCE: OUTPUT template vs the three parse lists; B3 STEP 6 opus review. +PRIOR: LRN-300 (a rule keyed on a gate verdict names the line its qualifier prints on) — +applied to the three readers and to lib/effort-shift.md item 3, the canonical skip rule. +The auditor's output format stays unchanged (no parser contract change). +BLAST RADIUS: the three readers + lib/effort-shift.md:124 ("security PASS (not +DEGRADED)" names no line). agents/security-auditor.md STEP 1 (:44-48) already puts +DEGRADED on the `TOOL:` line: untouched. feat/bugfix already name the TOOL line +(51f343f): untouched, now locked. README:84 / USAGE / CHANGELOG cite no parse list: +untouched (doc-sync re-checks). audit-delta:271, tour:156, onboard:549 say "semgrep +ABSENT → DEGRADED" (audit mode, non-blocking): untouched. a11y/guardrails/ship-feature/ +init-project inherit lib/verify-secure-loop.md (their "PASS → STEP n" lines point at it). +Rejected alternative: change the auditor to print `VERDICT: DEGRADED` — breaks every +`PASS | BLOCK(n)` parser and the PROOF rule; the logged fix direction is the reader side. +A DEGRADED BLOCK needs no own sentence: the BLOCK bullet handles every BLOCK. + +## FIX PLAN (exact text; each `old` occurs exactly once in its file) + +1. lib/verify-secure-loop.md — the PASS bullet reads the TOOL line; the old +DEGRADED bullet is deleted. + +### Block vsl-pass-old +``` +- `PASS` → done, proceed to commit. +``` +### Block vsl-pass-new +``` +- `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent) shows + there, never on the VERDICT line; a PASS with no `TOOL:` line is a + structural failure (below). Then done, proceed to commit; a DEGRADED + PASS also surfaces the checklist result + recommends `make plugin` + (the tool's absence never blocks). +``` +### Block vsl-degraded-old +``` +- `DEGRADED` (semgrep absent) → does NOT block on the tool's absence; surface + the checklist result + recommend `make plugin`. A DEGRADED run that still + BLOCKs (grep-caught secret/injection) blocks like any other. +``` +(replaced by nothing: the three lines are removed) + +2. agents/security-auditor.md — same shape. + +### Block aud-pass-old +``` + - `PASS` → proceed (to commit / next step). +``` +### Block aud-pass-new +``` + - `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent) + shows there, never on the VERDICT line; a PASS with no `TOOL:` line + is a structural failure (below). Then proceed (to commit / next + step); a DEGRADED PASS also surfaces the checklist result + + recommends `make plugin` (the tool's absence never blocks). +``` +### Block aud-degraded-old +``` + - `DEGRADED` (semgrep absent) → does NOT block; surface the checklist + result + recommend `make plugin`. A DEGRADED BLOCK (grep-caught + hardcoded secret etc.) blocks like any other. +``` +(removed) + +### Block aud-struct-old +``` + unparsable, crash, PASS without PROOF) → retry ONCE fresh; 2nd + structural failure → human escalation. A mute auditor is never a PASS. +``` +### Block aud-struct-new +``` + unparsable, crash, PASS without PROOF or without `TOOL:` line) → + retry ONCE fresh; 2nd structural failure → human escalation. A mute + auditor is never a PASS. +``` + +3. skills/hotfix/SKILL.md + +### Block hot-pass-old +``` + - `PASS` (or `DEGRADED` with no BLOCK) → proceed to commit. +``` +### Block hot-pass-new +``` + - `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent) + shows there, never on the VERDICT line; a PASS with no `TOOL:` line + is a structural failure (below). Then proceed to commit; a DEGRADED + PASS sets the summary's SECURITY field to `DEGRADED (checklist only)`. +``` +### Block hot-struct-old +``` + - Structural failure (mute / unparsable / no VERDICT line) → treat as a + failed gate: retry ONCE fresh; a 2nd structural failure → revert + + escalate. A mute auditor is never a PASS. +``` +### Block hot-struct-new +``` + - Structural failure (mute / unparsable / no VERDICT line / PASS with + no `TOOL:` line) → treat as a failed gate: retry ONCE fresh; a 2nd + structural failure → revert + escalate. A mute auditor is never a + PASS. +``` + +4. lib/effort-shift.md § Advisor item 3 — name the line (LRN-300). + +### Block eff-old +``` + `skipped (gates clean on first pass)`. A skipped call discharges +``` +### Block eff-new +``` + `skipped (gates clean on first pass)`; DEGRADED shows on the + auditor's `TOOL:` line. A skipped call discharges +``` + +5. lib/tests/loops-light.test.sh — regression locks. Single-line fragments with the +file's own `tf`/`tn` (LRN-093: a clause spanning lines → lock a distinctive single-line +fragment), double quotes with escaped backticks (the file's idiom). The section lives +here, not in security-auditor.test.sh, so one section locks this bug across its five +files (that file's `tn` is ERE: the parenthesised strings would match vacuously there). + +### Block t-vars-old +``` +HSKL="$REPO/skills/hotfix/SKILL.md" +``` +### Block t-vars-new +``` +HSKL="$REPO/skills/hotfix/SKILL.md" +AUD="$REPO/agents/security-auditor.md" +EFF="$REPO/lib/effort-shift.md" +``` +### Block t-locks-old +``` +echo "" +echo "loops-light structure locks: $PASS pass, $FAIL fail" +``` +### Block t-locks-new +``` +echo "── DEGRADED on the TOOL line, feat/bugfix skip (BUGS-FOUND:134) ──" +for f in "$FSK" "$BSK"; do + n=$(basename "$(dirname "$f")") + tf "$n skip not DEGRADED" "$f" "security PASS (not DEGRADED)," + tf "$n skip first attempt" "$f" "each on its first attempt;" + tf "$n skip out of view" "$f" "a verdict no longer in view runs the call." + tf "$n skip names TOOL" "$f" "auditor's \`TOOL:\` line, beside a PASS." +done +tf "effort-shift names TOOL" "$EFF" "auditor's \`TOOL:\` line. A skipped call" +for f in "$INC" "$AUD" "$HSKL"; do + n=$(basename "$(dirname "$f")")/$(basename "$f") + tf "$n PASS reads TOOL" "$f" "\`PASS\` → read the \`TOOL:\` line first" + tf "$n DEGRADED off VERDICT" "$f" "never on the VERDICT line;" + tf "$n no TOOL structural" "$f" "a PASS with no \`TOOL:\` line" + tf "$n structural (below)" "$f" "structural failure (below)" + tn "$n DEGRADED no verdict" "$f" "\`DEGRADED\`" + tn "$n DEGRADED no branch" "$f" "DEGRADED (semgrep absent) →" +done + +echo "" +echo "loops-light structure locks: $PASS pass, $FAIL fail" +``` +The two `tn` catch the old shapes coming back: the backticked `DEGRADED` value and a +`DEGRADED (semgrep absent) →` branch (none of the three files keeps that token after the fix; hotfix's +`DEGRADED (checklist only)` does not match). The paired `tf` on the same file fails on +an unreadable file, which `tn` alone would pass. +Simulated on a scratch clone (locks first, fix second): develop = 16 FAIL (effort-shift +lock + 3 files × 4 reader `tf` + 3 backticked `tn`), the 8 feat/bugfix locks PASS, the +3 `DEGRADED (semgrep absent) →` `tn` PASS (they guard the un-backticked variant, absent +on both sides); fix applied = 78/78 PASS. +Deferred (confirmation pass, logged to BUGS-FOUND at bookkeeping): a DEGRADED BLOCK's +cap STOP does not name the missing semgrep / `make plugin`; DEGRADED is read by word +presence, a garbled `TOOL:` line reads as a full scan (allowlist `semgrep ` would +close it). Both were already true before this fix (the old bullet keyed on the wrong +line). + +6. Bookkeeping (main loop, not executor): BUGS-FOUND:134 FIXED, TODO:13 done. + +RISK: low — prose only, no output format change. New prose lines ≤ 80 cols; the lock +lines follow the test file's existing width (it already has lines past 80).