loop-engineering
Skill8 starsChanged 4 months agoMITView on GitHub
Load this when authoring or editing an agent role, subagent, or slash command that needs a self-critique / iterate / converge inner loop. Documents the Refine-Critique-Converge (RCC) pattern used by every role in .agents/roles/. Triggers — "add self-critique", "add RCC loop", "iterate the plan", "loop engineering", "agent should refine", "critique its own output".
36 other projects use a version of this.
Adopted by
Most recently taken up by
- BOSSRNL/Claude-Loop-Engineeringtheir own version, first seen Nov 29, 2026
- douinc/agent-skillstheir own version, first seen Nov 24, 2026
- jggomez/expert-ai-developer-skillstheir own version, first seen Nov 22, 2026
- AshrafDurjoy/genai-shared-patternstheir own version, first seen Nov 16, 2026
- roronoazoroshao369/vibe-coding-ostheir own version, first seen Nov 15, 2026
- vpeetla-ai/venkat-ai-platformtheir own version, first seen Nov 8, 2026
Used with
Projects with it also use aegis-gateway, deploy-vercel-render and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
vpeetla-aiSkillaegis-gateway
Integrate AegisAI gateway before tool side effects (notify, publish, deploy). Use when adding Slack/Telegram/WhatsApp notify, content publish, or any irreversible external action in VAP, AegisLoop, or ai-content-factory.
Also in 6 projects that use this
vpeetla-aiSkilldeploy-vercel-render
Deploy vpeetla-ai demos: Vercel static/Next.js frontends, Render FastAPI backends, env vars, free tier gotchas. Use when shipping demos, fixing deploy failures, or adding render.yaml / vercel.json.
Also in 6 projects that use this
HermeticOrmusSkilllanggraph-orchestration
LangGraph stateful multi-agent graphs with categorical coordination patterns and cyclic workflows. Use when building stateful AI agent systems, implementing multi-agent orchestration with conditional routing, creating cyclic workflows with persistence, or designing graph-based AI pipelines with checkpointing and human-in-the-loop patterns.
Also in 6 projects that use this
junimnjwSkillagentic-engineering
Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing.
Also in 7 projects that use this
- +8 more from vpeetla-ai
Other versions36 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 36
- bojieli/ai-agent-book-projects★ 60ksame name
- bojieli/ai-agent-book★ 60ksame name
- huytieu/COG-second-brain★ 1.3ksame name
- akitaonrails/my-skills★ 324same name
- jggomez/expert-ai-developer-skills★ 33same name
- aiconnai/agentshield★ 21same name
- sxivansx/loop-engineering★ 10same name
- victor-hac-work/loop-engineering-skills★ 5same name
- Mark393295827/graph-engineering-architectures★ 4same name
- aiconnai/engram★ 3same name
26 more not listed
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 repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ai-dev-workflowCopilot instructions
- component-conventionsSkill
- pm-clarifySkill
- pr-prepSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 31 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 70
Every check must be answerable from the artifact alone: If the check requires reading external files, it belongs in a downstream phase's …
- Distinctive: line 82
If a role hits its RCC cap without convergence, the outer loop can still attempt another pass (with a new spec — usually the Verifier's …
- Distinctive: line 101
If you want to track how much RCC is costing you on a branch:
- Distinctive: line 112
If a role is hitting iteration 3 often, its RCC checklist may be too strict (oscillating) or the upstream spec may be too vague (unfixable …
“Common” is measured: kept by at least 6 in 10 of the 31 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Loop Engineering — the RCC pattern
Loop engineering treats iteration as a first-class part of an agent's contract, not an emergent behavior. Every role in this repo uses the same Refine-Critique- Converge (RCC) pattern for its inner loop. This skill is the reference for how to add or modify one.
What RCC is
An agent produces → self-critiques against a phase-specific checklist → refines only the parts flagged CRITICAL → repeats, bounded to 3 iterations. On convergence (no CRITICAL, or no delta from prior iteration, or 3-iteration cap hit) it emits the final artifact plus a compact iteration log.
Why RCC and not "keep iterating"
- Bounded. 3-iteration cap prevents runaway cost. If the agent cannot converge in 3 passes, the problem is upstream (bad spec, missing context) and further iteration will not fix it — hand back to the human.
- Same-context. RCC runs inside the same phase's context window. No new agent is spawned. This is the cheapest form of loop engineering.
- Targeted. Iterations 2 and 3 revise only sections flagged CRITICAL, not the whole artifact. Full rewrites erode the cache and re-introduce bugs.
- Auditable. Each iteration appends a JSONL record with
status: "draft"or"final". You can see the convergence trajectory after the fact.
The template (paste this into a new role)
## Refine-Critique-Converge (RCC) loop
You produce, self-critique, and refine — bounded to 3 iterations.
**Iteration 1** — produce the artifact in the required format.
**Self-critique** — before printing, walk this checklist against your draft.
Any CRITICAL item requires a revision pass.
- CRITICAL: <phase-specific check 1>
- CRITICAL: <phase-specific check 2>
- CRITICAL: <phase-specific check 3>
- RECOMMENDED: <check that's nice-to-have but not blocking>
**Iteration 2** — if any CRITICAL, revise only the affected sections and
re-critique.
**Iteration 3** — final pass. If a CRITICAL remains after 3 iterations, print
the artifact with an "RCC unresolved" note at the top listing open CRITICALs.
Do not loop further — hand off to the human.
Append one JSONL record per iteration to `.agents/memory/<file>.jsonl` via
`.agents/memory/append.sh` (`status: "draft"` for iterations 1-2, `status:
"final"` on the last).Choosing checklist items
The checklist is the entire ballgame — a good checklist makes RCC valuable, a bad one makes it noise. Rules:
- CRITICAL only for correctness-blocking items — things that make the artifact wrong or unshippable. Style preferences do not belong here.
- 3-6 CRITICALs, max. More than that and the agent will oscillate.
- Every check must be answerable from the artifact alone. If the check requires reading external files, it belongs in a downstream phase's check, not RCC.
- Prefer specific over general. "No
anytypes introduced?" beats "Types are correct?" — the former is grep-able, the latter is vibes.
Interaction with the outer FAIL loop
The pipeline has an outer Verifier→Implementer FAIL loop, also capped at 3. RCC is the inner loop.
- RCC iterations do not count against the outer loop cap.
- If a role hits its RCC cap without convergence, the outer loop can still attempt another pass (with a new spec — usually the Verifier's priority list).
- Combined cap: at most 3 outer × 3 RCC = 9 iterations per role per branch. In practice, most work converges in 1-2 outer × 1-2 RCC.
When NOT to add RCC
- Read-only subagents (
repo-explorer,frontend-reviewer,prod-readiness) that produce a single structured output already do a focused pass. Adding RCC would just double their cost. Their "critique" is the downstream role that reads their output. - Bash / tool-running subagents (
test-runner,verifier) — the tool result IS the ground truth. Re-running tests to "self-critique" is not loop engineering, it's just retry. - PM-clarify and other one-shot skills — no artifact to converge on.
Cost telemetry
If you want to track how much RCC is costing you on a branch:
BR="$(git rev-parse --abbrev-ref HEAD)"
for f in .agents/memory/*.jsonl; do
echo "$f:"
grep "\"branch\":\"$BR\"" "$f" 2>/dev/null | \
awk -F'"iteration":' '{split($2, a, ","); print " iteration " a[1]}'
doneIf a role is hitting iteration 3 often, its RCC checklist may be too strict (oscillating) or the upstream spec may be too vague (unfixable in-role).
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.

