21 autonomous, self-contained "loop" systems that turn Claude Code (or any AI coding agent) into a full audit-and-fix pipeline — with built-in adversarial review, confidence scoring, and safe rollback.
Each loop is a complete, runnable audit-and-fix system in one markdown file — a mission, an execution DAG, a hostile adversarial reviewer, and quantitative exit criteria, all sharing one contract defined in PROTOCOL.md.
- Quick Start
- The Loop Catalog
- Meta-Loops — Loops That Run the Other 15
- How It Works
- Installing as a Claude Code Skill
- Suggested Cadence
- Contributing
- License
Pick a loop, paste its RUN PROMPT into your AI coding agent, done. No install required.
Run LOOP-01 on <your-repo> (scope: <api dir>)
The agent reads the loop file, reads PROTOCOL.md for the shared execution rules, and runs the whole audit end-to-end — handing you back a branch, a findings artifact, and nothing merged without your sign-off.
Three ways to use this repo:
- Copy-paste — open any file in
skills/, copy theRUN PROMPTblock at the bottom, paste it into Claude Code (or ChatGPT, Cursor, Windsurf, etc.) with your target repo. - Install as a skill — each loop's frontmatter is already skill-compatible (see Installing as a Claude Code Skill).
- Clone the whole set —
git clonethis repo and point your agent at theskills/folder for the full catalog.
| # | Loop | Domain | Risk | What it does |
|---|---|---|---|---|
| 01 | Backend & API Hardening | Backend & API Architecture | branch-mutating | AST-driven audit: OWASP API Top 10 (BOLA/BOPLA/SSRF/auth/resource limits), N+1 queries, dead code, logging hygiene. |
| 02 | Frontend & Accessibility | Frontend & Accessibility | branch-mutating | Component/bundle audit plus a live Playwright accessibility-tree interrogation (roles, ARIA, focus traps, contrast) that static scanners miss. |
| 03 | Mobile & Native Hardening | Mobile & Native Platforms | branch-mutating | Dual-layer (JS/Dart + native) audit: bridge traffic, ANR hunters, list virtualization, manifest hardening, keystore/keychain, pinning. |
| 04 | Agent Runtime & Tooling | Agent Runtime & Tooling | read-only→branch | Audits your own agent stack against the OWASP Agentic Top 10: MCP/tool schema strictness, least-privilege agency, prompt-injection surfaces. |
| 05 | Agentic Memory Hardening | Memory & Cognitive Architecture | branch-mutating | Four-tier memory audit (working/episodic/semantic/procedural), tenant isolation, unbounded growth, GDPR erasure UI. |
| 06 | UX/UI Visual Integrity | UX/UI & Human Factors | branch-mutating | Visual regression, stateful UI battery, graceful-degradation checks, memory-transparency panel audit. |
| 07 | Infrastructure & DevOps | Infrastructure, Cloud & DevOps | infra-touching | Docker/K8s/Terraform/secrets/IAM/SBOM/supply-chain audit across your deployment mesh — read+plan, never live-mutates without approval. |
| 08 | CI/CD & Release Engineering | CI/CD & Release Engineering | branch-mutating | Pipeline audit: is CI actually running, caching, test gating, artifact signing, rollback automation, canary/blue-green, feature flags. |
| 09 | Data Layer Integrity | Data Architecture & Persistence | infra-touching | Schema/migration safety, FK/orphan/cascade audit, index coverage, RLS/grant self-escalation sweep, backup restore verification. |
| 10 | AI Security Red-Team | Governance, Compliance & Risk | read-only | Red-teams your own AI stack: prompt injection, RAG/memory/embedding poisoning, model supply chain, jailbreaks, goal drift, reward hacking. |
| 11 | Adversarial Review Engine | Cross-cutting engine | read-only | The debate engine every other loop calls inline: generator vs. hostile reviewer, FREE-MAD default, silent-agreement detection. |
| 12 | Test, Mutation & Chaos | Continuous Evaluation | branch-mutating | Closes coverage gaps, mutation-tests your suite to find tests that don't actually test anything, injects chaos (DB/cache/LLM/MCP failures). |
| 13 | Architectural Drift & Debt | Continuous Evaluation | read-only | Detects layer violations, circular deps, dead APIs/services; scores technical debt 0–100 across six axes, trended over time. |
| 14 | Governance & Telemetry | Runtime Observability | read-only | Audits the autonomous system itself: is it improving, looping, degrading, wasting tokens, or getting less reliable? |
| 15 | Self-Optimization Meta-Loop | Continuous Evaluation | branch-mutating (loops only) | The recursive-improvement loop: failure → root cause → fix → generalized pattern → proposed diff to the loops themselves. Human-gated always. |
Risk classes: read-only never touches your code · branch-mutating works only on an isolated loop branch, never main · infra-touching reads live infrastructure and proposes plans, never applies changes without explicit approval. (Same three classes apply to the meta-loops and integration below.)
LOOP-01 through LOOP-15 each audit one fixed surface. LOOP-16 through LOOP-20 are the five base meta-loops: they take other loops — or a plain-language goal — as their input. LOOP-21 is the first integration loop, composing all five into a full merge lifecycle. Notation below: [NN + NN] = loops feeding in, → = then, ? = branch point.
LOOP-20 — Goal Pipeline is the one to start with — the front door. Hand it a goal in plain English and it plans, checks, and dispatches the other 19 for you. Everything below is a tool LOOP-20 already knows how to reach for.
16 — Fan-Out Orchestrator · branch-mutating
Split one task into independent pieces, run each on its own worker in parallel, no waiting on the slowest one.
16: [01 + 02 + 07] → prove independent → 3 workers run parallel → collect → merge report
Example: backend audit, frontend audit, and infra audit don't touch the same files — run all three at once instead of one after another. Pairs with: any two+ loops with non-overlapping scope · gated by LOOP-20's DAG proof.
17 — Sparring Partners · branch-mutating
Standing attacker vs. defender match on one artifact — keeps something already audited from rotting back to unsafe.
17: breaker=[10] vs builder=[01] → shared findings/fix queue → round N → trend to human
Example: LOOP-10 keeps red-teaming your auth module, LOOP-01 keeps patching what it finds, LOOP-12 regression-tests every builder fix so nothing silently reverts. Pairs with: 10 (breaker's toolkit) + 01/05 (builder's toolkit) + 12 (regression backstop).
18 — The Ratchet · branch-mutating
Change one thing, measure, keep it only if proven better — never batches, never un-welds.
18: [06 + 15] mutate → 11 debate → pass? weld : revert + loop
Example: LOOP-06 finds a UX patch candidate, LOOP-15 generalizes it into one testable change, LOOP-11 adversarially debates whether it's actually an improvement — pass welds it permanently, fail reverts and the ratchet tries a different single change next round. Pairs with: any loop that has one number/patch to tune (06, 08 timeouts, 12 fuzz corpus size) + 11 for the verdict.
19 — Idea Arena · read-only
Diverse candidate ideas, one shared debate-and-mutation arena, one converged idea with a paper trail.
19: idea1=[13 debt] + idea2=[14 drift] + idea3=[10 gap] → arena debate+mutate → converged idea → handoff
Example: three loops each surface a different "what should we fix next" candidate — the arena doesn't just pick one, it merges the strongest parts of all three into one spec, then hands it to LOOP-20 to plan and dispatch. Pairs with: any loops with open findings to seed candidates from + 11 (final gate on the handoff) + 20 (receives it).
20 — Goal Pipeline · read-only→branch · flagship
Plain-language goal in, validated dependency-checked plan out, dispatched into whichever of 01–19 fit.
20: goal="harden API + dedupe code" → decompose → [01] + [13] independent → 16 fan-out → 11 reviews plan → dispatch
Example: one goal implies two unrelated tasks — LOOP-20 proves they don't conflict, hands both to LOOP-16 to run in parallel instead of you manually sequencing them, and keeps re-checking the plan as results come in. Pairs with: everything — this is the loop that decides which of the other 19 to run.
21 — Merge Protocol · branch-mutating · integration
Anchor the real remote trunk, capture a PR and its goals immutably, adversarially simplify it one verified change at a time, prove CI actually ran, merge only with operator approval, then replay the original contract over the entire integrated trunk and open a scoped follow-up PR for real gaps.
21: PR → capture remote+PR+goals → [20 plan + 16/17/19 inspect + 11 debate] → 18 ratchet → 08 gate → approve+merge → whole-trunk replay → follow-up PR
Example: a PR is green on its own diff, but after merge an untouched caller violates the original acceptance criteria — the post-merge replay catches the seam and prepares a narrow, lineage-linked follow-up instead of declaring victory at the merge button. Composes: all five meta-loops (16–20) · hard gates: 08 (real CI liveness), 11 (hostile verdict), 15 (process learning only).
One shared contract in PROTOCOL.md — read it for the full spec:
- 4-step protocol — ingest → scope → execute → adversarial check.
- Confidence blocks — every output scored, risk-rated, with explicit unknowns.
- 13-class failure taxonomy — routes, never just "fails."
- Checkpointed rollback — every mutation on an isolated branch.
- FREE-MAD debate — a hostile reviewer persona before anything ships.
- Quantitative exit criteria —
FAIL-with-artifactbeats silent success.
Each loop's YAML frontmatter (name, description, etc.) is already skill-shaped. To install one:
mkdir -p ~/.claude/skills/loop-backend-api
cp skills/LOOP-01-backend-api.md ~/.claude/skills/loop-backend-api/SKILL.mdRepeat per loop, or copy the whole skills/ folder and adapt the frontmatter name field per file. Once installed, invoke with /loop-backend-api (or your agent's skill-invocation syntax) instead of pasting the RUN PROMPT manually.
A reasonable starting rhythm — tune it to your team:
| Cadence | Loops |
|---|---|
| Weekly sweep | 01 (backend), 02 (frontend), 13 (drift/debt) |
| Pre-release | 08 (CI/CD), 12 (test/mutation/chaos), 06 (UX/UI) |
| Monthly deep audit | 07 (infra), 09 (data layer), 10 (AI security), 05 (memory) |
| Continuous / every N runs | 14 (governance), then 15 (self-optimization) |
New loops, sharper adversarial personas, better exit criteria — all welcome. See CONTRIBUTING.md.
MIT — use it, fork it, ship it.
Built by Aether AI