/autonomous-loops
Patterns and architectures for autonomous Claude Code loops — from simple sequential pipelines to RFC-driven multi-agent DAG systems.
$ npx -y skills add affaan-m/everything-claude-code --skill autonomous-loops --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/autonomous-loops
Context preview
The summary Claude sees to decide when to auto-load this skill.
Patterns and architectures for autonomous Claude Code loops — from simple sequential pipelines to RFC-driven multi-agent DAG systems.
SKILL.md
autonomous-loops.SKILL.mdname: autonomous-loops
description: "Patterns and architectures for autonomous Claude Code loops — from simple sequential pipelines to RFC-driven multi-agent DAG systems."
metadata:
origin: ECC
Autonomous Loops Skill
> Compatibility note (v1.8.0): `autonomous-loops` is retained for one release. > The canonical skill name is now `continuous-agent-loop`. New loop guidance > should be authored there, while this skill remains available to avoid > breaking existing workflows.
Patterns, architectures, and reference implementations for running Claude Code autonomously in loops. Covers everything from simple `claude -p` pipelines to full RFC-driven multi-agent DAG orchestration.
When to Use
- Setting up autonomous development workflows that run without human intervention
- Choosing the right loop architecture for your problem (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 to autonomous workflows
Loop Pattern Spectrum
From simplest to most sophisticated:
| Pattern | Complexity | Best For | |---------|-----------|----------| | [Sequential Pipeline](#1-sequential-pipeline-claude--p) | Low | Daily dev steps, scripted workflows | | [NanoClaw REPL](#2-nanoclaw-repl) | Low | Interactive persistent sessions | | [Infinite Agentic Loop](#3-infinite-agentic-loop) | Medium | Parallel content generation, spec-driven work | | [Continuous Claude PR Loop](#4-continuous-claude-pr-loop) | Medium | Multi-day iterative projects with CI gates | | [De-Sloppify Pattern](#5-the-de-sloppify-pattern) | Add-on | Quality cleanup after any Implementer step | | [Ralphinho / RFC-Driven DAG](#6-ralphinho--rfc-driven-dag-orchestration) | High | Large features, multi-unit parallel work with merge queue |
---
1. Sequential Pipeline (`claude -p`)
**The simplest loop.** Break daily development into a sequence of non-interactive `claude -p` calls. Each call is a focused step with a clear prompt.
Core Insight
> If you can't figure out a loop like this, it means you can't even drive the LLM to fix your code in interactive mode.
The `claude -p` flag runs Claude Code non-interactively with a prompt, exits when done. Chain calls to build a pipeline:
#!/bin/bash
# daily-dev.sh — Sequential pipeline for a feature branch
set -e
# Step 1: Implement the feature
claude -p "Read the spec in docs/auth-spec.md. Implement OAuth2 login in src/auth/. Write tests first (TDD). Do NOT create any new documentation files."
# Step 2: De-sloppify (cleanup pass)
claude -p "Review all files changed by the previous commit. Remove any unnecessary type tests, overly defensive checks, or testing of language features (e.g., testing that TypeScript generics work). Keep real business logic tests. Run the test suite after cleanup."
# Step 3: Verify
claude -p "Run the full build, lint, type check, and test suite. Fix any failures. Do not add new features."
# Step 4: Commit
claude -p "Create a conventional commit for all staged changes. Use 'feat: add OAuth2 login flow' as the message."
Key Design Principles
1. **Each step is isolated** — A fresh context window per `claude -p` call means no context bleed between steps. 2. **Order matters** — Steps execute sequentially. Each builds on the filesystem state left by the previous. 3. **Negative instructions are dangerous** — Don't say "don't test type systems." Instead, add a separate cleanup step (see [De-Sloppify Pattern](#5-the-de-sloppify-pattern)). 4. **Exit codes propagate** — `set -e` stops the pipeline on failure.
Variations
**With model routing:**
# Research with Opus (deep reasoning)
claude -p --model opus "Analyze the codebase architecture and write a plan for adding caching..."
# Implement with Sonnet (fast, capable)
claude -p "Implement the caching layer according to the plan in docs/caching-plan.md..."
# Review with Opus (thorough)
claude -p --model opus "Review all changes for security issues, race conditions, and edge cases..."
**With environment context:**
# Pass context via files, not prompt length
echo "Focus areas: auth module, API rate limiting" > .claude-context.md
claude -p "Read .claude-context.md for priorities. Work through them in order."
rm .claude-context.md
**With `--allowedTools` restrictions:**
# Read-only analysis pass
claude -p --allowedTools "Read,Grep,Glob" "Audit this codebase for security vulnerabilities..."
# Write-only implementation pass
claude -p --allowedTools "Read,Write,Edit,Bash" "Implement the fixes from security-audit.md..."
---
2. NanoClaw REPL
**ECC's built-in persistent loop.** A session-aware REPL that calls `claude -p` synchronously with full conversation history.
# Start the default session
node scripts/claw.js
# Named session with skill context
CLAW_SESSION=my-project CLAW_SKILLS=tdd-workflow,security-review node scripts/claw.js
How It Works
1. Loads conversation history from `~/.claude/claw/{session}.md` 2. Each user message is sent to `claude -p` with full history as context 3. Responses are appended to the session file (Markdown-as-database) 4. Sessions persist across restarts
When NanoClaw vs Sequential Pipeline
| Use Case | NanoClaw | Sequential Pipeline | |----------|----------|-------------------| | Interactive exploration | Yes | No | | Scripted automation | No | Yes | | Session persistence | Built-in | Manual | | Context accumulation | Grows per turn | Fresh each step | | CI/CD integration | Poor | Excellent |
See the `/claw` command documentation for full details.
---
3. Infinite Agentic Loop
**A two-prompt system** that orchestrates parallel sub-agents for specification-driven generation. Developed by disler (credit: @disler).
Architecture: Two-Prompt System
PROMPT 1 (Orchestrator) PROMPT 2 (Sub-Agents)
┌─────────
Read more
name: autonomous-loops description: "Patterns and architectures for autonomous Claude Code loops — from simple sequential pipelines to RFC-driven multi-agent DAG systems." metadata: origin: ECC
Autonomous Loops Skill
> Compatibility note (v1.8.0): `autonomous-loops` is retained for one release. > The canonical skill name is now `continuous-agent-loop`. New loop guidance > should be authored there, while this skill remains available to avoid > breaking existing workflows.
Patterns, architectures, and reference implementations for running Claude Code autonomously in loops. Covers everything from simple `claude -p` pipelines to full RFC-driven multi-agent DAG orchestration.
When to Use
- Setting up autonomous development workflows that run without human intervention
- Choosing the right loop architecture for your problem (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 to autonomous workflows
Loop Pattern Spectrum
From simplest to most sophisticated:
| Pattern | Complexity | Best For | |---------|-----------|----------| | [Sequential Pipeline](#1-sequential-pipeline-claude--p) | Low | Daily dev steps, scripted workflows | | [NanoClaw REPL](#2-nanoclaw-repl) | Low | Interactive persistent sessions | | [Infinite Agentic Loop](#3-infinite-agentic-loop) | Medium | Parallel content generation, spec-driven work | | [Continuous Claude PR Loop](#4-continuous-claude-pr-loop) | Medium | Multi-day iterative projects with CI gates | | [De-Sloppify Pattern](#5-the-de-sloppify-pattern) | Add-on | Quality cleanup after any Implementer step | | [Ralphinho / RFC-Driven DAG](#6-ralphinho--rfc-driven-dag-orchestration) | High | Large features, multi-unit parallel work with merge queue |
---
1. Sequential Pipeline (`claude -p`)
**The simplest loop.** Break daily development into a sequence of non-interactive `claude -p` calls. Each call is a focused step with a clear prompt.
Core Insight
> If you can't figure out a loop like this, it means you can't even drive the LLM to fix your code in interactive mode.
The `claude -p` flag runs Claude Code non-interactively with a prompt, exits when done. Chain calls to build a pipeline:
#!/bin/bash # daily-dev.sh — Sequential pipeline for a feature branch set -e # Step 1: Implement the feature claude -p "Read the spec in docs/auth-spec.md. Implement OAuth2 login in src/auth/. Write tests first (TDD). Do NOT create any new documentation files." # Step 2: De-sloppify (cleanup pass) claude -p "Review all files changed by the previous commit. Remove any unnecessary type tests, overly defensive checks, or testing of language features (e.g., testing that TypeScript generics work). Keep real business logic tests. Run the test suite after cleanup." # Step 3: Verify claude -p "Run the full build, lint, type check, and test suite. Fix any failures. Do not add new features." # Step 4: Commit claude -p "Create a conventional commit for all staged changes. Use 'feat: add OAuth2 login flow' as the message."
Key Design Principles
1. **Each step is isolated** — A fresh context window per `claude -p` call means no context bleed between steps. 2. **Order matters** — Steps execute sequentially. Each builds on the filesystem state left by the previous. 3. **Negative instructions are dangerous** — Don't say "don't test type systems." Instead, add a separate cleanup step (see [De-Sloppify Pattern](#5-the-de-sloppify-pattern)). 4. **Exit codes propagate** — `set -e` stops the pipeline on failure.
Variations
**With model routing:**
# Research with Opus (deep reasoning) claude -p --model opus "Analyze the codebase architecture and write a plan for adding caching..." # Implement with Sonnet (fast, capable) claude -p "Implement the caching layer according to the plan in docs/caching-plan.md..." # Review with Opus (thorough) claude -p --model opus "Review all changes for security issues, race conditions, and edge cases..."
**With environment context:**
# Pass context via files, not prompt length echo "Focus areas: auth module, API rate limiting" > .claude-context.md claude -p "Read .claude-context.md for priorities. Work through them in order." rm .claude-context.md
**With `--allowedTools` restrictions:**
# Read-only analysis pass claude -p --allowedTools "Read,Grep,Glob" "Audit this codebase for security vulnerabilities..." # Write-only implementation pass claude -p --allowedTools "Read,Write,Edit,Bash" "Implement the fixes from security-audit.md..."
---
2. NanoClaw REPL
**ECC's built-in persistent loop.** A session-aware REPL that calls `claude -p` synchronously with full conversation history.
# Start the default session node scripts/claw.js # Named session with skill context CLAW_SESSION=my-project CLAW_SKILLS=tdd-workflow,security-review node scripts/claw.js
How It Works
1. Loads conversation history from `~/.claude/claw/{session}.md` 2. Each user message is sent to `claude -p` with full history as context 3. Responses are appended to the session file (Markdown-as-database) 4. Sessions persist across restarts
When NanoClaw vs Sequential Pipeline
| Use Case | NanoClaw | Sequential Pipeline | |----------|----------|-------------------| | Interactive exploration | Yes | No | | Scripted automation | No | Yes | | Session persistence | Built-in | Manual | | Context accumulation | Grows per turn | Fresh each step | | CI/CD integration | Poor | Excellent |
See the `/claw` command documentation for full details.
---
3. Infinite Agentic Loop
**A two-prompt system** that orchestrates parallel sub-agents for specification-driven generation. Developed by disler (credit: @disler).
Architecture: Two-Prompt System
PROMPT 1 (Orchestrator) PROMPT 2 (Sub-Agents) ┌─────────
Your agent can write code, but ECC gives it a coordinated engineering system and toolbox: it plans before it builds, verifies changes with tests, reviews its own work from a fresh context, remembers what matters, and turns repeated wins into reusable skills
Repo: affaan-m/everything-claude-code
Other skills on ecc.
- /everything-claude-code
Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.
Open skill - /accessibility
Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA
Open skill - /agent-architecture-audit
Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for
Open skill - /agent-eval
Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics
Open skill - /agent-harness-construction
Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates.
Open skill - /agent-introspection-debugging
Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports.
Open skill

