Agentic Loops
22 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.
Table of Contents
Quick Start
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 the RUN PROMPT block 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 clone this repo and point your agent at the skills/ folder for the full catalog.
The Loop Catalog
The 16 base loops, each auditing one fixed surface. The six that take other
loops as input — LOOP-16 through LOOP-21 — are catalogued in
Meta-Loops below.
| # |
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. |
| 22 |
Website Growth & Simplification Overhaul |
Website Growth, Search Visibility & Generative Discovery |
branch-mutating |
Evidence-first whole-site overhaul: simplify routes/content/UI, repair technical SEO, validate entity truth, test generative retrieval, and protect accessibility, performance, and conversion. |
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.)
Meta-Loops — Loops That Run the Catalog
LOOP-01 through LOOP-15 and LOOP-22 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 |
Kind |
Risk |
Takes as input |
| 16 |
Fan-Out Orchestrator |
meta |
branch-mutating |
Two or more loops with non-overlapping scope |
| 17 |
Sparring Partners |
meta |
branch-mutating |
One breaker loop, one builder loop, one artifact |
| 18 |
The Ratchet |
meta |
branch-mutating |
One loop with a single number or patch to tune |
| 19 |
Idea Arena |
meta |
read-only |
Open findings from any loops, as candidate ideas |
| 20 |
Goal Pipeline |
meta · flagship |
read-only→branch |
A goal in plain English |
| 21 |
Merge Protocol |
integration |
branch-mutating |
A pull request, plus the five meta-loops above |
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 applicable catalog loops 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