Skip to content

feat(loop): correction-capture self-improvement loop + sed fallback fix (U16/O14 — PR8) - #47

Merged
dralgorhythm merged 3 commits into
mainfrom
claude/hardening-pr8-self-improvement
Jul 24, 2026
Merged

feat(loop): correction-capture self-improvement loop + sed fallback fix (U16/O14 — PR8)#47
dralgorhythm merged 3 commits into
mainfrom
claude/hardening-pr8-self-improvement

Conversation

@dralgorhythm

Copy link
Copy Markdown
Owner

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

  • Capture (core-directives.md, +4 lines): when a user correction contradicts a standing rule/skill, append one line to scratchpad/corrections.log (date | correction | contradicted surface). Ordinary task instructions are not logged.
  • Promote (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.
  • Nudge (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).
  • Guidance (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.
  • Cadence (CONTRIBUTING.md): the standing loop joined to the existing eval-first/retirement policy — re-run the failure-taxonomy audit at each model-generation bump.
  • Follow-through (task Skills portfolio strategy for the 2026 Agent Skills ecosystem (research artifact) #26): branch-pr-discipline.sh's no-jq sed fallback switched to sed -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 via GIT_DIR/GIT_WORK_TREE fixtures. Plus the stop-validator docs row the U16 builder flagged.

Provenance

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

  • corrections.log with 2 entries → stop reminder names the count; absent/empty → silent
  • no-jq stacking warning fires with the fixed sed (fails with the old BRE — regression-proven)
  • rules-lines 419 → 423 of 500

🤖 Generated with Claude Code

dralgorhythm and others added 3 commits July 24, 2026 11:38
…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>
@dralgorhythm
dralgorhythm merged commit 06ccd3e into main Jul 24, 2026
5 checks passed
@dralgorhythm
dralgorhythm deleted the claude/hardening-pr8-self-improvement branch July 24, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant