From 981472033a301037b827c2d0539bdd4386947a02 Mon Sep 17 00:00:00 2001 From: bchanot Date: Thu, 19 Nov 2026 13:49:30 +0100 Subject: [PATCH 1/4] fix(doctrine): security readers take DEGRADED off the TOOL line, not the VERDICT line The auditor prints VERDICT: PASS on a DEGRADED scan, so the three parse lists read it as a clean PASS. The PASS branch now reads the TOOL line first, a PASS without one is structural, and loops-light locks it. --- agents/security-auditor.md | 14 ++++++++------ lib/effort-shift.md | 3 ++- lib/tests/loops-light.test.sh | 21 +++++++++++++++++++++ lib/verify-secure-loop.md | 9 +++++---- skills/hotfix/SKILL.md | 12 ++++++++---- 5 files changed, 44 insertions(+), 15 deletions(-) diff --git a/agents/security-auditor.md b/agents/security-auditor.md index b74b31c..057ee6c 100644 --- a/agents/security-auditor.md +++ b/agents/security-auditor.md @@ -182,14 +182,16 @@ In audit mode, ALSO write this same block (plus per-finding detail) to - Dispatch a FRESH auditor each iteration — no context reuse. Input = mode + scope + (report) + (context), nothing else. - Parse the `SECURITY — VERDICT:` line: - - `PASS` → proceed (to commit / next step). + - `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(n)` → the dev subagent receives the BLOCKING list + the contract path. After the fix: re-verify the REQUEST first (verifier), THEN re-run this gate — in that order. Max 3 security iterations → STOP + human escalation with the BLOCKING table. - - `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. - Structural failure (`ERROR(…)`, missing/duplicated VERDICT line, - unparsable, crash, PASS without PROOF) → retry ONCE fresh; 2nd - structural failure → human escalation. A mute auditor is never a PASS. + unparsable, crash, PASS without PROOF or without `TOOL:` line) → + retry ONCE fresh; 2nd structural failure → human escalation. A mute + auditor is never a PASS. diff --git a/lib/effort-shift.md b/lib/effort-shift.md index 411d38e..72ab595 100644 --- a/lib/effort-shift.md +++ b/lib/effort-shift.md @@ -124,7 +124,8 @@ triggers in CLAUDE.global.md § Workflow): security PASS (not DEGRADED), each on its first attempt (any other verdict, a retry, a loop iteration or a verdict no longer in view runs the call), their summary then reading - `skipped (gates clean on first pass)`. A skipped call discharges + `skipped (gates clean on first pass)`; DEGRADED shows on the + auditor's `TOOL:` line. A skipped call discharges its point and the trigger it covers. In the six flows that run the gates (feat, bugfix, ship-feature, init-project, a11y, guardrails), the main loop first prints the run's diff stat, a fix the answer diff --git a/lib/tests/loops-light.test.sh b/lib/tests/loops-light.test.sh index 9d546de..d676340 100644 --- a/lib/tests/loops-light.test.sh +++ b/lib/tests/loops-light.test.sh @@ -17,6 +17,8 @@ HSK="$REPO/skills/hotfix/SKILL.md" GSK="$REPO/skills/guardrails/SKILL.md" ASK="$REPO/skills/a11y/SKILL.md" HSKL="$REPO/skills/hotfix/SKILL.md" +AUD="$REPO/agents/security-auditor.md" +EFF="$REPO/lib/effort-shift.md" PASS=0; FAIL=0 tf() { # tf