feat(loop): correction-capture self-improvement loop + sed fallback fix (U16/O14 — PR8) - #47
Merged
Merged
Conversation
…6/O14) Implements research option O14 (artifacts/research_ai_coding_frustrations.md Part 3) — the standing correction-capture loop so mid-session corrections stop getting silently repeated instead of retained. - core-directives.md: new "Correction Capture" subsection — a user correction that contradicts standing rules/skills/instructions gets appended as one line to scratchpad/corrections.log; ordinary task instructions are not logged. - land-the-plane/SKILL.md: Handoff section gains a Retro step — map each non-empty log entry to the strongest enforcement rung it can support (rule/skill/hook/CI, same discipline as postmortem's Prevention step), promote via a small PR or filed issue, then remove the processed line. - stop-validator.sh: compact, position-independent reminder block — when scratchpad/corrections.log is non-empty, name the pending count and point at the retro step. Silent when absent or zero-byte. Kept minimal per the note that PR #45 also touches this file. - New scripts/hook-tests.d/40-self-improvement.sh: hermetic harness cases for the 2-line, absent, and zero-byte log states. - CHANGELOG.md (Unreleased/Added) and MIGRATION.md entries. rules-lines budget: 419 -> 423 lines (budget 500; core-directives.md only touched rule file, +4 lines). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Completes O14 (artifacts/research_ai_coding_frustrations.md Part 3 / "The standing iteration loop") alongside the prior mechanics commit. - docs/customization.md: new "Session Learning: Auto-Memory vs. Repo Rules" section — Claude Code's per-user auto-memory is for personal preferences and machine quirks (ride the platform feature, don't rebuild it); team-shared, reviewed, CI-checked guidance belongs in .claude/rules//.claude/skills//.claude/hooks/, and corrections.log promotions land there, never only in memory. Cross-links core-directives.md's Correction Capture convention. - CONTRIBUTING.md: new "Standing self-improvement loop" section extending the eval-first/retirement policies with the full capture -> escalate -> verify -> re-audit cycle, including re-running the failure-taxonomy coverage audit from artifacts/research_ai_coding_frustrations.md at each model-generation bump. - CHANGELOG.md (Unreleased/Added) entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ing follow-through) - sed -E in the no-jq command extraction: the BRE alternation form silently never matched on BSD/macOS sed, so every warning this hook gives was inert whenever jq was absent (task #26; same bug class the U1 rewrite fixed in the push blocker). Hermetic regression cases pin the fallback via GIT_DIR/GIT_WORK_TREE fixtures. - docs/hooks.md stop-validator row now mentions the corrections-log reminder (flagged by the U16 builder as outside its file list). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
U16 — research option O14, the correction-capture self-improvement loop (the research's most time-urgent deferred item), plus a landing follow-through closing task #26. This is the mechanism that makes the framework metabolize its own failures: capture → escalate up the enforcement ladder → verify → re-audit.
What changed
core-directives.md, +4 lines): when a user correction contradicts a standing rule/skill, append one line toscratchpad/corrections.log(date | correction | contradicted surface). Ordinary task instructions are not logged.land-the-plane): a retro step — map each logged correction to the strongest enforcement rung it can support (rule < skill < hook < deny/CI, reusing the postmortem skill's discipline), promote via small PR or issue, clear processed lines. Never silently discard the log.stop-validator.sh, +6 lines): deterministic session-end reminder naming the unprocessed-correction count — with hermetic harness cases (count shown; absent and zero-byte logs stay silent).docs/customization.md): auto-memory (personal, unreviewed) vs repo rules/skills/hooks (team-shared, reviewed, enforced) — promotions land in the repo, never only in memory.CONTRIBUTING.md): the standing loop joined to the existing eval-first/retirement policy — re-run the failure-taxonomy audit at each model-generation bump.branch-pr-discipline.sh's no-jq sed fallback switched tosed -E— the BRE form silently never matched on BSD/macOS, muting all of the hook's warnings whenever jq was absent; regression cases pin it viaGIT_DIR/GIT_WORK_TREEfixtures. Plus the stop-validator docs row the U16 builder flagged.Provenance
mainby the orchestrator (the worker's position-independent stop-validator block survived U2's rewrite with zero conflict); independent gate re-run on the lane tip.test-hooks.shALL GREEN (incl. 4 new self-improvement + 2 new discipline cases);check-invariants.shALL GREEN (rules-lines423/500); CI-equivalent shellcheck clean.Risk tier
low-medium — one new session-end reminder (MIGRATION entry included); everything else is prose conventions and a silent-bug fix. No blocking behavior added.
Test plan
🤖 Generated with Claude Code