LEAP
LEAP builds skills through two pipelines: Branch A distills a skill from raw data, while Branch B combines multiple skills into one. It is called by the main…
Decision protocol for wiring a verify-then-fix loop around a code-editing LLM agent. The agent edits → runs lint/test → reads the output → fixes → re-runs, bounded by an iteration cap and an escalation rule. Activates whenever a coder agent has a verifiable success criterion
$ npx -y skills add agentsope/SkillAlchemy --skill agentsop-test-fix-loop --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/agentsop-test-fix-loopContext preview
The summary Claude sees to decide when to auto-load this skill.
Decision protocol for wiring a verify-then-fix loop around a code-editing LLM agent. The agent edits → runs lint/test → reads the output → fixes → re-runs, bounded by an iteration cap and an escalation rule. Activates whenever a coder agent has a verifiable success criterion
name: agentsop-test-fix-loop
version: 0.1.0
description: |
Decision protocol for wiring a verify-then-fix loop around a code-editing LLM
agent. The agent edits → runs lint/test → reads the output → fixes → re-runs,
bounded by an iteration cap and an escalation rule. Activates whenever a coder
agent has a verifiable success criterion (exit code, type-checker output,
failing assertion) and the user wants the agent to converge to "green" on its
own. Framework-agnostic — wraps Aider's `--auto-lint`/`--auto-test`, an
OpenHands SWE-Bench loop, a manual LangGraph cycle, or Claude Code's bash
tool just the same.
domain: coder-agent / tool-result-feedback
audience: engineers wiring LLM agents that must converge on a verifiable spec
trigger_keywords:
- "auto-lint"
- "auto-test"
- "test-fix loop"
- "fix until tests pass"
- "verify-then-fix"
- "iterate until green"
- "agent feedback loop"
- "iteration cap"
when_to_use:
- "any code-edit flow with a verifiable success command (pytest, ruff, mypy, eslint, tsc, go test, cargo check)"
- "wrapping a coding agent so it doesn't return until lint+tests are clean"
- "SWE-Bench-style runs (one issue → patch → tests → fix → submit)"
- "CI guardrail where a PR must be green before the agent declares done"
when_not_to_use:
- "the success criterion is subjective ('looks good') — there's no signal to feed back"
- "the verifier takes >5 min and you need the agent interactive — async the loop"
- "human review is the gate (use HITL skill instead)"
- "edits are exploratory / WIP — the loop will fight the user's incomplete code"> One-liner: **The test result IS the next prompt.** Wiring the verifier is > 20% of the work; framing its output as a useful feedback message is 80%.
---
Activate this skill when **any** of the following triggers fire:
automatically", "iterate until green", or invokes `aider --auto-test`, `cline --yes`, or an OpenHands-style headless agent.
failure (pytest, ruff, mypy, eslint, tsc, go test, cargo check, npm run build, make check, …).
*when does the agent return?*
"here's what the verifier said".
**Do not activate** when:
feedback signal worth replaying.
Either async-ify the loop, or run a fast subset (`pytest -x -k changed`) in the loop and gate the slow suite at PR review.
---
The agent's *next turn* is conditioned almost entirely on the message you inject between edit-N and edit-N+1. That message — formatted from `stdout`, `stderr`, `exit_code` — **is the prompt**. The framework labels it "tool result" or "verifier output" but mechanically it is a user-role message the LM consumes verbatim.
⇒ **Framing the feedback dominates the model choice.** A 4000-line raw pytest dump prompts a worse fix than a 30-line "first failing test, traceback, the diff you just applied" digest, *regardless of the model behind it*.
+-----------------+ +-----------------+ +-----------------+ +-----------------+ | 1. Verifier | | 2. Capture | | 3. Format | | 4. Iteration | | command | | (stdout + | | feedback | | bound | | | | stderr + | | message | | | | - pytest -x | | exit_code) | | - first error | | - max N tries | | - ruff check | | - timeout cap | | - last K lines | | - escalate / | | - mypy --strict | | - byte cap | | - drop noise | | commit / skip | | - eslint . | | - kill on hang | | - keep colors=0 | | | +-----------------+ +-----------------+ +-----------------+ +-----------------+
Drop any one of these and the loop fails:
(see Aider's 25k context-drift threshold).
bug `[oh/6357]` is the canonical failure case.
Naively: "let the agent run `pytest` and read the output". This breaks because:
1. The agent doesn't know **which** command to run (project-specific). 2. The agent dumps the **full output** into context every iteration, blowing the 25k threshold by iter 3. 3. The agent has **no termination contract** — it'll keep trying after the test passes "to be safe", or keep trying after 30 failures "to be helpful". 4. The agent makes **edits with no audit trail** — if iter 4 was the right fix, you can't bisect because nothing is committed.
The loop is a contract: *verifier wiring + output capture + feedback framing
| Verifier returns | Interpretation | Next action | |---|---|---| | `exit 0`, no diagnostics | True success | Commit + exit loop | | `exit 0`, warnings | Soft success | Commit + log; optionally surface to user | | `exit != 0`, parseable error | Actionable failure | Format → feed back → next iter | | `exit != 0`, unparseable (e.g. segfault, OOM) | Environment / infra failure | Escalate; do not re-prompt the LM | | Timeout / hang | Likely infinite loop in
Turn people, methods, and experience into installable, reusable agent skills. SkillAlchemy is an open-world agent skill creation system that turns underspecified skill briefs and open-world sources into installable, reusable agent skills.
LEAP builds skills through two pipelines: Branch A distills a skill from raw data, while Branch B combines multiple skills into one. It is called by the main…
Lens — Add a cognitive lens to any problem. It accepts a task description and produces an enhanced description that surfaces hidden dimensions, prerequisites,…
Cross-framework enhancement overlay for choosing a multi-agent topology BEFORE writing any agent. A binary-question rubric — is single-agent + tools enough? do…
SOP for terminal-based, git-native AI pair programming with Aider (git work-tree + tree-sitter repo-map + edit-format + human-in-loop REPL). Use when editing…
Screens biomedical / life-science papers for signs of data fabrication, image manipulation, and statistical anomalies, using the detection techniques distilled…
Universal discipline for any LM-driven loop — agent retries, plan-act-observe, multi-agent handoffs, optimiser passes, test-fix cycles. Encodes the one rule…