loop-engineer
Skill8 starsChanged 2 months agoMITView on GitHub
Budget-bounded develop-and-improve loop: design, plan, code, comment, test, review, score, and correct in a loop until a composite quality gate is met or a hard budget/iteration/no-progress stop is hit. Keeps the best cloud model (Fable 5) as orchestrator and judge, uses cheaper cloud tiers (Opus to plan, Sonnet to execute and review) for the actions, and delegates code and comments to the local-coder / local-writer agents over the Bash bridge so the heavy generation is free. Trigger on: /loopdev, 'loop engineering', 'run the improve loop', 'develop this until the score/budget', requests to iterate on code under a cost cap with an automatic quality gate.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- willianbs/skillstheir own version, first seen Jul 18, 2026
- fltman/loop-engineertheir own version, first seen Jun 30, 2026
- Haozhenyu123/project-forgetheir own version, first seen Jun 19, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- fltman/loop-engineer★ 36same name
- Haozhenyu123/project-forge★ 1same name
- willianbs/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/skills/AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- aider-setupSkill
- deliberationSkill
- drawio2tikzSkill
- extract-contributionsSkill
- extract-futureworksSkill
- extract-paper-ideaSkill
- extract-statisticSkill
- form-serviceSkill
- geolocalisationSkill
- latex-hygieneSkill
- loop-engineerSkill
- narrative-cvSkill
- obsidian-cliSkill
- opt-local-stt-vramSkill
- opt-local-vram-llmSkill
- paper2talkSkill
- recommendation-letterSkill
- rt-observeSkill
- scholar-evaluationSkill
- scientific-writingSkill
- scopusSkill
- word2latexSkill
- aider-setupSkill
- deliberationSkill
- drawio2tikzSkill
- extract-contributionsSkill
- extract-futureworksSkill
- extract-paper-ideaSkill
- extract-statisticSkill
- form-serviceSkill
- geolocalisationSkill
- latex-hygieneSkill
- narrative-cvSkill
- obsidian-cliSkill
- opt-local-stt-vramSkill
- opt-local-vram-llmSkill
- paper2talkSkill
- recommendation-letterSkill
- rt-observeSkill
- scholar-evaluationSkill
- scientific-writingSkill
- scopusSkill
- word2latexSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Run one feature through a design -> plan -> code -> comment -> test -> review -> score -> correct loop, repeating the …
- Very specific: line 46
Run tests + review panel - Sonnet runs rtk pytest (deterministic green/red) and the installed reviewers on the diff: /code-review, …
- Very specific: line 126
Audit: - run the scholar-evaluation skill on the draft on a cheap model (Sonnet or
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Loop engineer - budget-bounded develop-and-improve loop
Run one feature through a design -> plan -> code -> comment -> test -> review -> score -> correct loop, repeating the evaluate/correct/rescore sub-cycle until a composite quality gate is met or a hard stop is hit. The point is high-quality code at a fraction of the cloud cost: the best model judges, cheaper tiers act, and the local models generate.
The score contract and the stop rules are in scripts/loop_audit.py (the scorer) and
scripts/loop_engineer.py (the driver). Read references/LOOP.md before a live run - it is
the contract for the pipeline, the model tiering, and the safety gates.
Option contract
/loopdev --budget <max_usd> [--score <min_score>] [--max-iters N] [--patience N] [--no-merge-pr] "<feature request>"--budget(required): hard cost cap in USD. Maps to the Agent SDKmax_budget_usd; the run stops witherror_max_budget_usdwhen hit.--score(default 90): the aggregate threshold inside the composite gate. A literal 100 is opt-in and, because zero findings across the reviewers is asymptotic, will usually stop on budget rather than on score.--max-iters(default 10),--patience(default 2): the iteration cap and the no-progress window.--no-merge-pr: stop at "ready to merge" without opening a PR.
Pipeline (per feature, branch-isolated)
- Design -
brainstormingon Fable 5 (judgment). - Plan -
writing-planson Opus. - Branch
feat/<slug>- a Sonnet subagent with write-capable git (never the local model). - TDD -
test-driven-developmenton Sonnet: write the failing tests for the acceptance criteria first. - Code - the local-coder agent (the resolver's coder-role model over the bridge) implements against the tests.
At task start it consults the vault (GardeFous / Apprentissages for the module, the project
Decisions.md/CodeReview.md) and folds the constraints into the bridge prompt. - Comment / doc - the local-writer agent (the resolver's writer-role model over the bridge). It consults the
vault's
Methodesand prior writing decisions the same way. - Run tests + review panel - Sonnet runs
rtk pytest(deterministic green/red) and the installed reviewers on the diff:/code-review,/security-guidance,pr-review-toolkit(silent-failure-hunter, type-design-analyzer),systematic-debugging. Each emits findings. - Score -
scripts/loop_audit.py(run by local-coder, deterministic) aggregates the findings + test result + betterleaks/pip-audit hook status into per-axis sub-scores, an aggregate 0-100, and the gate booleans; appends to the ledger. - Correct -
writing-plansthenexecuting-planson the findings (Sonnet + local-coder). On error recovery / at the checkpoint, local-coder re-consults the vault so the learning captured last iteration is not repeated.executing-plansitself never reads the vault. - Doc / journal - local-writer is the single vault writer: it captures a project log as
an appended dated section in the project's own
Decisions.md(andCodeReview.md) under10_Projets/<nature>/<projet>/, and any reusable learning as an atomic note under30_Ressources/<Technology>/. There is no daily note. It drafts the note and deposits it in~/.claude/obsidian-outbox/with a first-line directive; theobsidian-outbox-flush.pyhook is the only write path for that new or appended content - it writes through the filesystem and verifies the effect by file size, never a fallback. The one sanctioned exception isvault_consolidate.py --apply --yes, an in-place maintenance edit of links in notes that already exist, run by this same writer through the filesystem and verified by re-reading the file. It also updates/docoutput,PROCESS.md, and memory.local-codernever writes to the vault - it hands any learning to local-writer. Captures also fire at the error/checkpoint (step 9) and gate (step 12), not only here. - Convergence check - the loop wraps steps 7 -> 9 -> 8. Stop on the composite gate, the budget cap, the max-iterations cap, a no-progress plateau, or a security regression.
- Human-gated finish - on a gate pass, local-coder commits + pushes the branch and opens a PR (token permitting); the merge to a protected branch waits for explicit user confirmation.
Vault reads and writes (who does what, when)
- Reads. Steps 1-2 (Design / Plan, on Fable 5 / Opus) consult the vault and bake the
learnings into the plan (orchestrator-mediated). Once the loop is executing, vault reads are
done ONLY by the local agents (steps 5, 6, 9);
executing-plansand the Sonnet review panel do not read. - Writes.
local-writeris the single vault writer: it drafts the note and deposits it in~/.claude/obsidian-outbox/with a first-line directive; theobsidian-outbox-flush.pyhook is the only write path for creating or appending content - it writes through the filesystem and verifies the effect by file size, never a fallback. The one sanctioned exception isvault_consolidate.py --apply --yes, an in-place maintenance edit of existing links, run by this same writer through the filesystem and verified by re-reading the file, never through the Obsidian CLI.local-coderreads only and hands learnings to local-writer. No two agents write concurrently, and no external tool writes the same vault. - Loop closure. A capture always lands first in the outbox, not directly in the vault; the
obsidian-outbox-flush.pyhook only runs at SessionStart and SessionEnd, so within a running session a note written at iteration N would otherwise sit unflushed.local-coder's outbox scan (see its definition) closes that gap by reading pending outbox files directly at the next iteration. The hook writes through the filesystem and verifies the effect by file size, with no dependency on the Obsidian process; the note lands regardless of whether Obsidian is running, and Obsidian will reload it the next time it runs.
See the "Capture de connaissances" and "Lecture du coffre" sections of the global CLAUDE.md.
Stop gate
Composite (default): tests green AND no CRITICAL AND no HIGH AND aggregate >= min_score.
Security is a hard floor: any CRITICAL finding, a betterleaks block, or a CRITICAL pip-audit
CVE fails the gate regardless of the aggregate. Hard stops: budget cap, max iterations,
no-progress plateau, security regression vs the previous iteration.
Reviewers
Installed / first-party only: /code-review, /security-guidance, pr-review-toolkit,
systematic-debugging, plus the betterleaks and pip-audit hooks. tech-debt and
ai-firstify are optional add-ons the user installs deliberately (ai-firstify must be run
audit-only inside the loop so it scores rather than restructures code); they are off by
default.
Authoring loop (ScholarEval-gated variant)
The same loop applies to writing, not just code. Instead of the code reviewers and
loop_audit.py, the score comes from the scholar-evaluation skill (prose quality), and the
actors are the authoring agents. This variant is driven by the authoring-loop agent (run it
by name at the top level of a session). Use it to iterate a review, paper section, thesis
chapter, or reviewer response up to a target ScholarEval score under a budget.
The five steps:
- Define the subject - the topic (new review) or the draft to improve, the target
.tex,min_score(ScholarEval overall), andmax_budget. - Author - dispatch the matching authoring agent (
/litreview/scopus-researcher,latex-writer,/replyreviewer/reviewer-response, etc.) on the best cloud model (Fable 5) to write or revise against the current improvement plan. - Audit - run the
scholar-evaluationskill on the draft on a cheap model (Sonnet or Haiku) to get the ScholarEval overall score and the improvement plan. - Loop - go back to step 2 until the overall reaches
min_score, the spend reachesmax_budget, or the score plateaus. A revision that lowers the score is discarded (keep the previous draft) rather than carried forward. - Memory -
local-writer(Haiku wrapper + the resolver's writer-role model) records what was learned (what raised the score, what plateaued, residual weaknesses) to the project memory.
Differences from the code loop: the gate is the single ScholarEval overall (plus a regression
guard) rather than the multi-axis code score with a security hard floor; the budget is advisory
(the orchestrator tracks /usage and the ledger and stops) unless the run is wrapped in this
skill's SDK driver, which is the way to get a hard max_budget_usd cap. See
.claude/agents/authoring-loop.md for the full pipeline, routing, and session-resilience rules.
Environment and safety
- Standalone Agent SDK program; runs on the user's subscription auth (no gateway, no API key).
- The local models are reached through
ollama_bridge.py(the Ollama HTTP API, notollama run) inside the local-coder / local-writer agents. There is NO fallback tag: the bridge asksmodel_resolver.py, and a resolver that names no qualified model is an explicit stop. Each agent passes its own--role(coder/writer), so the two roles can be served by different tags; without it both get the single overallcurrenttag, which is how the coder side was being served a writer model scoring 0/3 on coder tasks. - State-changing git (merge, branch delete) is never done by the local model; the merge is human-gated.
- Install the SDK in this skill's own
.venvand validaterequirements.txtwithpip-auditbefore use.
Running
Live run (needs claude-agent-sdk + Ollama + the review plugins):
python scripts/loop_engineer.py --loop --budget 2.00 --score 90 "add input validation to X"Control-logic dry run (offline, no SDK/models - drives the guards over precomputed reports):
python scripts/loop_engineer.py --dry-run --budget 1.00 --score 90 --reports r1.json r2.jsonOffline tests:
python scripts/Test/test_loop_audit.py
python scripts/Test/test_loop_guards.pyArtifacts
Written under the run directory (loop-audit-compatible names): PROCESS.md (todo/checkbox
state), loop-run-log.md (per-iteration score + cost), loop-budget.md (spend vs cap).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

