From harness-anchor
Iterates minimal-fix correction loops for warning/error signals from hooks, lint, type-checkers, and test failures. Stops when verification passes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-anchor:self-correction-loopThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
When your edit produces a warning/error signal, you're in a **correction loop**. This skill is the discipline that keeps the loop productive instead of thrashing.
When your edit produces a warning/error signal, you're in a correction loop. This skill is the discipline that keeps the loop productive instead of thrashing.
You should engage this loop when ANY of these happen after your edit:
PostToolUse hook injected clang-tidy warnings: / lint warnings: / similarBash command you ran returned non-zero exitThis is TDD's RED-GREEN-REFACTOR adapted for correction:
1. CAPTURE the signal
- What is the EXACT error message?
- Which file / line?
- What was my last change?
2. DIAGNOSE root cause (not symptom)
- Read the error carefully — the answer is often in it
- Check if my change broke an invariant elsewhere
- Do NOT guess. If unclear, narrow with prints / smaller test cases
3. MINIMAL FIX
- Smallest possible change that resolves THE specific issue
- No "while I'm here" tangents (that's scope creep — see scope-jump)
- Do NOT mask the error (e.g. catch-and-ignore) without explicit reason
4. RE-VERIFY
- Run the same command that produced the signal
- Observe the new output
- Capture it as evidence
This loop is for surface signals that a quick minimal fix resolves. If a minimal fix doesn't clear the signal within 1–2 iterations — or the failure spans components / needs backward root-cause tracing — switch to superpowers:systematic-debugging (its 4-phase root-cause process). Don't keep thrashing minimal fixes here.
If you've iterated 3 times on the same signal without resolving it, stop and escalate:
superpowers:systematic-debugging for structured root-cause investigation (its budget also caps at 3 fixes → then question the architecture; the two thresholds are intentionally aligned)docs-lookup skill for the specific error class (Context7 → WebSearch fallback)Looping > 5 times is almost always a sign of:
The budget above is the re-run budget — re-running the same failing command. There's a second, sneakier loop: the edit budget.
done_criteria — not your own diff (the classic failure is re-reading your own code, deciding it "looks ok", and continuing). Then either switch to a structurally different approach or escalate to the user.This mirrors LoopDetection middleware ("reconsider the approach after N edits on one file") — break out before the 10th micro-adjustment, not after.
If you can't articulate WHY, your fix is suspicious — even if green. State this uncertainty per anti-hallucination-gates.
Before moving on: if the failure you just fixed is a recurrence (second+ time you've seen
the class), capture it as a golden rule in this same turn — a rough stub via
capturing-golden-rules — not as a mental note for session end. Deferred captures get distorted
or forgotten when context compacts.
// @ts-ignore, --no-verify, deleting failing tests, broadening exception catches. These hide problems; sometimes they're warranted but require explicit user note.harness-anchor hooks are warn-only. They inject additionalContext describing the problem; they don't block your action. That means:
session-handoff.md.planned in feature_list.json and continue current scope.A fresh-context sensor's report — /verify (verification-runner), /test-plan (coverage-analyst), /gc (drift-analyst) — is reviewer feedback from a deliberately context-blind evaluator: it cannot see your intent (that independence is the design). Triage it with superpowers:receiving-code-review rigor — verify each finding against the code, push back on false positives with technical reasoning, act one-at-a-time — rather than blind-applying. This matters most inside /verify --fix: the bounded loop should apply verified findings, not churn on every recommendation. This is not a licence to dismiss the sensor — receiving-code-review is rigorous; you verify, then act.
anti-hallucination-gates — keep claims honest while loopingcapturing-golden-rules — a recurring failure you just fixed becomes a rule in the same turnreceiving-code-review (superpowers) — the discipline for triaging a fresh-context sensor's findings (verify each, push back with reasoning, don't blind-apply)systematic-debugging (superpowers) — for deep debugging beyond surface signalsverification-runner (agent) — for fresh-eyes evaluation of "is this really fixed?"npx claudepluginhub redtropig/harness-anchor --plugin harness-anchorRecursive error-fix loop. Use when a bash command fails with a build/test/typecheck error, when the same class of error appears more than once, or when the harness itself needs a persistent rule so the error does not come back. Detect → root-cause → minimal fix → test → lint/typecheck → persist rule (SKILL.md / AGENTS.md / docs/rules) → audit with evidence. Cross-harness (Claude Code, OpenCode, Codex, Gemini, Agy).
Runs a command repeatedly, fixing errors one at a time until it exits with code 0. Use when build, typecheck, lint, or test is failing.
Quickly analyzes errors from logs or args, applies minimal fixes with Edit/Write tools, verifies via tests or re-runs, and reports results concisely without explanation.