diff --git a/.claude/audits/BUGS-FOUND.md b/.claude/audits/BUGS-FOUND.md index 21a9081..75aa09d 100644 --- a/.claude/audits/BUGS-FOUND.md +++ b/.claude/audits/BUGS-FOUND.md @@ -138,3 +138,6 @@ - A DEGRADED scan that BLOCKs and hits the cap: the STOP/escalation text (lib/verify-secure-loop.md, agents/security-auditor.md) does not name the missing semgrep or `make plugin`, so the human sees a checklist-only BLOCK without the remedy. Severity: low. Discovered while: /bugfix degraded-tool-line STEP 3b. - DEGRADED is read by word presence on the `TOOL:` line: a garbled `TOOL:` line (no `semgrep `, no DEGRADED) reads as a full scan. Fix direction: allowlist `TOOL: semgrep ` as the only full-scan shape, anything else DEGRADED or structural. Severity: low. Discovered while: same. + + +- Run 1 feater: first full `make test` exited `make: *** [Makefile:36: test] Error 1`, suite unknown (only the tail captured); rerun green, GATE 0 + verifier make test green, no stray process after. Possibly a flaky suite or overlap with the scratch-clone `make test` running at the same time (the scratch run's only red was run-reconcile T6c = darwin-skill path absent in a fresh clone, environment). Next red: keep the full log, name the suite. Severity: low. Discovered while: /feat merge-reuse-clause STEP 3. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 8aa40a0..3bfa7f9 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -784,3 +784,4 @@ rules: ## 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. +- /feat x2 merge-reuse (af846d6, 87566e2, feature/advisor-merge-reuse): 6 gate-flow end lines restate effort-shift item 3 merge-reuse clause, loops-light 97; TODO:14 done, 3 follow-ups logged; run 1 GATE 0 ERROR = contract without EVIDENCE: pending (LRN-173 again). diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 7cd6e38..dc15a78 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -11,7 +11,10 @@ Done history before 2026-10-08 removed 2026-10-23 (git keeps it: `git log -p -- - [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 - [x] DONE 9814720, merged 4a8dffb (docs 4bb0a95, audits b120ba5, memory 9f8cf97) (/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) +- [x] DONE af846d6 + 87566e2 (/feat x2, feature/advisor-merge-reuse; user 2026-11-19 "all 6": feat/bugfix too). Was: 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) +- [ ] lib/effort-shift.md § Advisor item 3 reuse clause has no fallback: end-of-run answer absent (advisor absent/error) or out of view at the merge signal → candidate "answer absent or out of view → the merge proposal runs the call" (source, not the sites); the merge happens at the gitflow finish gate (skills/gitflow/SKILL.md:68-89, 0 advisor mentions) where the rule is not loaded (merge-reuse challengers, low) +- [ ] item 3 "names any code commit made after it" has no anchor: ADVISOR field records no HEAD SHA, commits made outside the session are invisible; candidate: record the short SHA with the answer (visible format change, user decision) (merge-reuse robustness challenger, low) +- [ ] end-of-run sites restate the call but not "one end-of-run call per skill run": a fix that goes back through the gates re-enters the end step and may call again (merge-reuse robustness challenger, 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-merge-reuse-clause-1409.md b/.claude/tasks/contracts/2026-11-19-merge-reuse-clause-1409.md new file mode 100644 index 0000000..fd59b31 --- /dev/null +++ b/.claude/tasks/contracts/2026-11-19-merge-reuse-clause-1409.md @@ -0,0 +1,34 @@ +# CONTRACT — merge-reuse-clause (run 1 of 2) +- date: 2026-11-19 | flow: feat | branch: feature/advisor-merge-reuse +- status: active + +## REQUEST (verbatim — IMMUTABLE) +Merge et corrige le bug et fais les todo + +Scope of this run (main loop): TODO:14 — the end-of-run advisor lines in skills/a11y, skills/guardrails, skills/ship-feature, skills/init-project restate lib/effort-shift.md § Advisor item 3's merge-reuse clause, plus a regression lock in lib/tests/loops-light.test.sh. Run 2 (same branch) does feat + bugfix. + +## CLARIFICATIONS +Q: challenge MINORs (lock 1 anchored on "the gates.", lock 3 "commits excepted)." with si re-wrap, $EFF source lock → 91) / A: main loop, internal (no visible wording change) [2026-11-19] +Q: which sites get the clause / A: all 6 (the 4 named + feat + bugfix); /feat 5-file cap → two /feat runs on one branch, this run = the 4 named sites [gated 2026-11-19] + +## ACCEPTANCE CRITERIA +1. loops-light carries 13 new locks (3 per site + the lib source) and is green: 91 pass, 0 fail. + CHECK: cd /home/bchanot/Documents/claude && bash lib/tests/loops-light.test.sh 2>&1 | tail -1 | grep -qF '91 pass, 0 fail' && echo LOCKS-91 + EXPECT: LOCKS-91 + EVIDENCE: MET exit=0 marker-found :: LOCKS-91 +2. Each of the four sites carries the full clause right after its "a fix it drives goes back through the gates." (joined text). + CHECK: cd /home/bchanot/Documents/claude && n=0; for f in a11y guardrails ship-feature init-project; do tr '\n' ' ' < skills/$f/SKILL.md | tr -s ' ' | grep -qF 'goes back through the gates. A later merge proposal reuses this answer and names any code commit made after it (doc and memory commits excepted).' && n=$((n+1)); done; [ "$n" -eq 4 ] && echo SITES-4 + EXPECT: SITES-4 + EVIDENCE: MET exit=0 marker-found :: SITES-4 +3. lib/effort-shift.md item 3 is unchanged (the clause stays single-sourced there). + CHECK: cd /home/bchanot/Documents/claude && git diff --quiet develop -- lib/effort-shift.md && echo EFF-UNCHANGED + EXPECT: EFF-UNCHANGED + EVIDENCE: MET exit=0 marker-found :: EFF-UNCHANGED +4. 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 +5. The new site locks are red on develop's skills (12 FAIL; the lib lock passes on develop simulated on a scratch clone before dispatch); no wording changed outside the plan's blocks; new prose lines ≤ 80 columns (manual). + +## FILE SCOPE +skills/a11y/SKILL.md, skills/guardrails/SKILL.md, skills/ship-feature/SKILL.md, skills/init-project/SKILL.md, lib/tests/loops-light.test.sh diff --git a/.claude/tasks/contracts/2026-11-19-merge-reuse-feat-bugfix-1450.md b/.claude/tasks/contracts/2026-11-19-merge-reuse-feat-bugfix-1450.md new file mode 100644 index 0000000..38d591a --- /dev/null +++ b/.claude/tasks/contracts/2026-11-19-merge-reuse-feat-bugfix-1450.md @@ -0,0 +1,33 @@ +# CONTRACT — merge-reuse-feat-bugfix (run 2 of 2) +- date: 2026-11-19 | flow: feat | branch: feature/advisor-merge-reuse +- status: active + +## REQUEST (verbatim — IMMUTABLE) +Merge et corrige le bug et fais les todo + +Scope of this run (main loop): TODO:14 run 2 — the feat and bugfix end-of-run lines restate lib/effort-shift.md § Advisor item 3's merge-reuse clause with the skip ("reuses the last run's answer, or its skip"), plus loops-light locks. Run 1 = af846d6 (a11y, guardrails, ship-feature, init-project). + +## CLARIFICATIONS +Q: which sites get the clause / A: all 6; feat/bugfix get "reuses the last run's answer, or its skip" (scope question option text) [gated 2026-11-19] + +## ACCEPTANCE CRITERIA +1. loops-light carries 6 new locks (3 per site) and is green: 97 pass, 0 fail. + CHECK: cd /home/bchanot/Documents/claude && bash lib/tests/loops-light.test.sh 2>&1 | tail -1 | grep -qF '97 pass, 0 fail' && echo LOCKS-97 + EXPECT: LOCKS-97 + EVIDENCE: MET exit=0 marker-found :: LOCKS-97 +2. feat and bugfix carry the full clause right after their "a fix it drives goes back through the gates." (joined text). + CHECK: cd /home/bchanot/Documents/claude && n=0; for f in feat bugfix; do tr '\n' ' ' < skills/$f/SKILL.md | tr -s ' ' | grep -qF 'goes back through the gates. A later merge proposal reuses the last run'"'"'s answer, or its skip, and names any code commit made after it (doc and memory commits excepted).' && n=$((n+1)); done; [ "$n" -eq 2 ] && echo SITES-2 + EXPECT: SITES-2 + EVIDENCE: MET exit=0 marker-found :: SITES-2 +3. The 9814720 skip locks and lib/effort-shift.md stay intact: lib unchanged vs develop, and the skip sentence's locked fragments still present in both skills. + CHECK: cd /home/bchanot/Documents/claude && git diff --quiet develop -- lib/effort-shift.md && for f in skills/feat/SKILL.md skills/bugfix/SKILL.md; do grep -qF 'a verdict no longer in view runs the call.' "$f" && grep -qF "auditor's \`TOOL:\` line, beside a PASS." "$f" || exit 1; done && echo SKIP-INTACT + EXPECT: SKIP-INTACT + EVIDENCE: MET exit=0 marker-found :: SKIP-INTACT +4. 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 +5. The 6 new locks are red before the edit (simulated on a scratch clone before dispatch); no wording changed outside the plan's blocks; new prose lines ≤ 80 columns (manual). + +## FILE SCOPE +skills/feat/SKILL.md, skills/bugfix/SKILL.md, lib/tests/loops-light.test.sh diff --git a/.claude/tasks/plans/2026-11-19-merge-reuse-clause-1409.md b/.claude/tasks/plans/2026-11-19-merge-reuse-clause-1409.md new file mode 100644 index 0000000..e6da28b --- /dev/null +++ b/.claude/tasks/plans/2026-11-19-merge-reuse-clause-1409.md @@ -0,0 +1,103 @@ +# Feat plan: merge-reuse clause at the end-of-run sites (TODO:14, run 1 of 2) + +## Why +lib/effort-shift.md § Advisor item 3 (:131-134): "In the six flows that run the gates (...), a later +merge proposal reuses the last run's answer, or its skip, and names any code commit made after it +(doc and memory commits excepted)." The end steps of a11y, guardrails, ship-feature, init-project +cite `lib/effort-shift.md` § Advisor but do not load it (LRN-297): at merge time the reuse rule is +not in front of the main loop, so a merge proposal either re-calls the advisor or reuses a stale +answer without naming the commits made since. User 2026-11-19: all 6 sites; this run = the 4 +TODO:14 names (feat/bugfix next run, same branch; /feat 5-file cap). + +## Disposition +- honors LRN-297 by restating one clause at the acting site, the lib keeps the full rule. +- honors LRN-268 / user "verbatim where it fits": item 3 wording, "the last run's answer, or its + skip" → "this answer" (these four flows have no skip; "this" = the answer just named on the line). +- honors LRN-093: locks are single-line fragments; LRN-296: simulated on a scratch clone. +- honors BDR-100: grep "merge proposal" across skills/lib/agents/README/USAGE/CLAUDE.global → only + lib/effort-shift.md:132 (unchanged, the source); no other citer to patch. +- BDR-150 unchanged (no new call point, no skip). + +## FIX PLAN (exact text; each `old` occurs exactly once in its file) + +1. skills/a11y/SKILL.md and 2. skills/guardrails/SKILL.md — same block in both. +### Block ag-old +``` + goes into the reply as an `Advisor:` line, and a fix it drives goes + back through the gates. +``` +### Block ag-new +``` + goes into the reply as an `Advisor:` line, and a fix it drives goes + back through the gates. A later merge proposal reuses this answer and + names any code commit made after it (doc and memory commits excepted). +``` + +3. skills/ship-feature/SKILL.md and 4. skills/init-project/SKILL.md — same block in both. +### Block si-old +``` +its answer goes with the proposal as an `Advisor:` line, and a fix it +drives goes back through the gates. +``` +### Block si-new +``` +its answer goes with the proposal as an `Advisor:` line, and a fix it +drives goes back through the gates. A later merge proposal reuses this +answer and names any code commit made after it (doc and memory +commits excepted). +``` + +5. lib/tests/loops-light.test.sh +### Block t-vars-old +``` +EFF="$REPO/lib/effort-shift.md" +``` +### Block t-vars-new +``` +EFF="$REPO/lib/effort-shift.md" +SFK="$REPO/skills/ship-feature/SKILL.md" +ISK="$REPO/skills/init-project/SKILL.md" +``` +### Block t-locks-old +``` +echo "" +echo "loops-light structure locks: $PASS pass, $FAIL fail" +``` +### Block t-locks-new +``` +echo "── end-of-run merge reuse at the site (TODO:14, LRN-297) ──" +tf "effort-shift merge reuse" "$EFF" "reuses the last run's answer, or its skip, and names any code commit" +for f in "$ASK" "$GSK" "$SFK" "$ISK"; do + n=$(basename "$(dirname "$f")") + tf "$n merge reuses answer" "$f" "the gates. A later merge proposal reuses this" + tf "$n names later commits" "$f" "names any code commit made after it" + tf "$n doc/memory excepted" "$f" "commits excepted)." +done + +echo "" +echo "loops-light structure locks: $PASS pass, $FAIL fail" +``` +Each fragment sits on one line in both wrap shapes (ag: 3-space indent; si: column 0); lock 1 anchors +the clause right after the gates sentence, lock 3 pins the polarity word, the `$EFF` lock pins the +source (lib/effort-shift.md:133). 78 → 91 pass. + +## Edge cases +- ship-feature/init-project: the finish proposal follows the call in the same step; "later" covers a + finish proposed after more commits land (user defers the go). Same sentence everywhere, no + per-flow variant. +- Prose lines ≤ 80 cols (ag 72/73, si 70/70/62/18). + +## Tests +lib/tests/loops-light.test.sh section above; full make test. +RISK: low — prose only, no rule change (item 3 already binds; the site now restates it). + +## Deferred (challenge MINORs, logged at bookkeeping, not this run) +- item 3 reuse clause has no fallback when the end-of-run answer is absent (advisor absent/error) or out + of view at the merge signal → candidate: "answer absent or out of view → the merge proposal runs the + call" in lib/effort-shift.md item 3 (source, not the sites). +- end sites restate the call but not "one end-of-run call per skill run": a fix that goes back + through the gates may re-enter the end step and call again. +- one branch can carry two end-of-run answers (a11y then guardrails): "this answer" = the latest run's; + "names any code commit made after it" keeps the proposal truthful. +- run 2 (feat:210, bugfix:236) gets its own TODO line when TODO:14 is ticked; the branch is not + merge-ready before run 2 lands. diff --git a/.claude/tasks/plans/2026-11-19-merge-reuse-feat-bugfix-1450.md b/.claude/tasks/plans/2026-11-19-merge-reuse-feat-bugfix-1450.md new file mode 100644 index 0000000..4e03335 --- /dev/null +++ b/.claude/tasks/plans/2026-11-19-merge-reuse-feat-bugfix-1450.md @@ -0,0 +1,97 @@ +# Feat plan: merge-reuse clause at the feat/bugfix end lines (TODO:14, run 2 of 2) + +## Why +Run 1 (af846d6) restated lib/effort-shift.md § Advisor item 3's merge-reuse clause at the a11y, +guardrails, ship-feature and init-project end steps. User 2026-11-19: all 6 sites; feat and bugfix +are the other two gate flows. Their end lines cite `lib/effort-shift.md` § Advisor without loading +it (LRN-297), and leaving them bare is the uneven restatement LRN-297 warns about. Same branch +feature/advisor-merge-reuse (/feat 5-file cap split the 6 sites in two runs). + +## Disposition +- honors LRN-297: one clause read ahead at the run's end (feat/bugfix never propose the merge + themselves; it comes at the user's later "merge it"), the lib keeps the full rule. +- honors LRN-268 / user wording: the scope question offered feat/bugfix "reuses the last run's + answer, or its skip" (they can skip, unlike the four run-1 flows); text = item 3 verbatim. +- honors LRN-093 (single-line lock fragments), LRN-296 (scratch simulation), LRN-298 (lock 1 + anchored on "the gates." = placement after the gates sentence). +- 9814720's eight feat/bugfix skip locks sit on lines this run does not touch: the clause is + appended after the final "through the gates." of each end line. +- BDR-100: "merge proposal" cited only by lib/effort-shift.md:132 and the run-1 sites. + +## FIX PLAN (exact text; each `old` occurs exactly once in its file) + +1. skills/feat/SKILL.md +### Block feat-old +``` +goes into the summary's `ADVISOR` field, and a fix it drives goes back +through the gates. + +Print summary: +``` +### Block feat-new +``` +goes into the summary's `ADVISOR` field, and a fix it drives goes back +through the gates. A later merge proposal reuses the last run's answer, +or its skip, and names any code commit made after it (doc and memory +commits excepted). + +Print summary: +``` + +2. skills/bugfix/SKILL.md +### Block bug-old +``` + goes into the summary's `ADVISOR` field, and a fix it drives goes back + through the gates. +4. Print summary: +``` +### Block bug-new +``` + goes into the summary's `ADVISOR` field, and a fix it drives goes back + through the gates. A later merge proposal reuses the last run's answer, + or its skip, and names any code commit made after it (doc and memory + commits excepted). +4. Print summary: +``` + +3. lib/tests/loops-light.test.sh — extend run 1's section (its loop's lock 1 ends "reuses this", +which does not match the feat/bugfix wording, so the two sites get their own loop). +### Block t-old +``` + tf "$n names later commits" "$f" "names any code commit made after it" + tf "$n doc/memory excepted" "$f" "commits excepted)." +done +``` +### Block t-new +``` + tf "$n names later commits" "$f" "names any code commit made after it (doc and memory" + tf "$n doc/memory excepted" "$f" "commits excepted)." +done +for f in "$FSK" "$BSK"; do + n=$(basename "$(dirname "$f")") + tf "$n merge reuses answer" "$f" "the gates. A later merge proposal reuses the last run's answer," + tf "$n reuse covers skip" "$f" "or its skip, and names any code commit made after it (doc and memory" + tf "$n doc/memory excepted" "$f" "commits excepted)." +done +``` +91 → 97 pass. Each fragment sits on one line in both indents. Lock 2 now reaches "(doc and memory" in +both loops (run 1's loop widened in place, same file, count unchanged) so the exception is pinned. +Each skill block runs through the next line ("Print summary:"), so a second apply finds no `old` +and fails loudly instead of doubling the clause. + +## Edge cases +- New prose widths: feat 71/68/18, bugfix 74/71/21 (≤ 80). +- "the last run's answer" at a feat/bugfix site = this run's answer unless a later gate flow ran on + the same branch; "names any code commit made after it" keeps the proposal truthful either way. + +## Tests +lib/tests/loops-light.test.sh; full make test. +RISK: low — prose only, rule unchanged; behavior changes: a merge after a clean-first-pass feat/bugfix +run reuses the skip instead of re-calling the advisor (the gated trade-off, item 3). + +## Deferred (challenge MINORs, logged at bookkeeping, not this run) +- merge-time gap: the merge proposal happens at the gitflow finish gate (skills/gitflow/SKILL.md + :68-89, 0 advisor mentions); if compaction drops the skill body the reuse rule is not in view. +- "names any code commit made after it" has no anchor: the ADVISOR field records no HEAD SHA, so + commits made outside the session are invisible; candidate: record short SHA with the answer + (visible format change, user's call). diff --git a/lib/tests/loops-light.test.sh b/lib/tests/loops-light.test.sh index d676340..1a7b72b 100644 --- a/lib/tests/loops-light.test.sh +++ b/lib/tests/loops-light.test.sh @@ -19,6 +19,8 @@ ASK="$REPO/skills/a11y/SKILL.md" HSKL="$REPO/skills/hotfix/SKILL.md" AUD="$REPO/agents/security-auditor.md" EFF="$REPO/lib/effort-shift.md" +SFK="$REPO/skills/ship-feature/SKILL.md" +ISK="$REPO/skills/init-project/SKILL.md" PASS=0; FAIL=0 tf() { # tf