| name | autonomous-loops |
| description | Use when building autonomous Claude Code loops. Covers sequential pipelines, RFC-driven multi-agent DAGs, and self-correcting agent architectures. |
| origin | MCC |
Autonomous Loops Skill
DEPRECATED (v1.8.0): The canonical skill is now continuous-agent-loop.
New loop guidance should be authored there. This skill is retained for one
release to avoid breaking existing workflows.
Patterns and reference implementations for running Claude Code autonomously in loops.
When to Use
- Setting up autonomous development workflows without human intervention
- Choosing the right loop architecture (simple vs complex)
- Building CI/CD-style continuous development pipelines
- Running parallel agents with merge coordination
- Implementing context persistence across loop iterations
- Adding quality gates and cleanup passes
Loop Pattern Spectrum
| Pattern | Complexity | Best For |
|---|
| Sequential Pipeline | Low | Daily dev steps, scripted workflows |
| NanoClaw REPL | Low | Interactive persistent sessions |
| Infinite Agentic Loop | Medium | Parallel content generation, spec-driven work |
| Continuous Claude PR Loop | Medium | Multi-day iterative projects with CI gates |
| De-Sloppify Pattern | Add-on | Quality cleanup after any Implementer step |
| Ralphinho / RFC-Driven DAG | High | Large features, multi-unit parallel work with merge queue |
Sequential Pipeline (claude -p)
The simplest loop. Chain claude -p calls into a pipeline:
#!/bin/bash
set -e
claude -p "Read the spec. Implement OAuth2 login. Write tests first (TDD)."
claude -p "Review changes. Remove unnecessary type tests and defensive checks. Run tests."
claude -p "Run full build, lint, type check, test suite. Fix failures."
claude -p "Create a conventional commit."
Key principles: each step is isolated (fresh context), order matters (builds on filesystem state), exit codes propagate (set -e).
NanoClaw REPL
MCC's built-in persistent loop with session history:
node scripts/claw.js
CLAW_SESSION=my-project CLAW_SKILLS=tdd-workflow node scripts/claw.js
Use NanoClaw for interactive exploration; use Sequential Pipeline for scripted automation.
De-Sloppify Pattern
Instead of constraining the Implementer with negative instructions (which degrade quality), add a separate cleanup pass:
claude -p "Implement the feature with full TDD. Be thorough."
claude -p "Review changes. Remove language/framework behavior tests, redundant type checks,
over-defensive error handling, console.log, commented-out code. Keep business logic tests. Run tests."
Two focused agents outperform one constrained agent.
Choosing the Right Pattern
Single focused change?
├─ Yes → Sequential Pipeline or NanoClaw
└─ No → Written spec/RFC?
├─ Yes → Need parallel implementation?
│ ├─ Yes → Ralphinho (DAG orchestration)
│ └─ No → Continuous Claude (iterative PR loop)
└─ No → Need many variations?
├─ Yes → Infinite Agentic Loop
└─ No → Sequential Pipeline + De-Sloppify
Anti-Patterns
- Infinite loops without exit conditions — always have max-runs, max-cost, max-duration, or completion signal
- No context bridge between iterations — use
SHARED_TASK_NOTES.md or filesystem state
- Retrying the same failure — capture error context and feed it forward
- Negative instructions instead of cleanup passes — add a separate de-sloppify step
- All agents in one context window — separate concerns into different processes
- Ignoring file overlap in parallel work — need a merge strategy for shared files
Reference Files
- sequential-pipeline-details.md — model routing, environment context,
--allowedTools restrictions, NanoClaw comparison
- continuous-and-infinite-loops.md — Infinite Agentic Loop architecture, Continuous Claude PR Loop, CI failure recovery, completion signals, configuration flags
- ralphinho-dag-orchestration.md — RFC decomposition, WorkUnit interface, complexity tiers, separate context windows, merge queue eviction, data flow, worktree isolation
References
| Project | Author |
|---|
| Ralphinho | @enitrat |
| Infinite Agentic Loop | @disler |
| Continuous Claude | @AnandChowdhary |
| NanoClaw | MCC (/claw command) |
| Verification Loop | MCC (skills/verification-loop/) |