autonomous-loops
Skill2 starsChanged 4 months agoApache-2.0View on GitHub
Patterns and architectures for autonomous loops — from simple sequential pipelines to RFC-driven multi-agent DAG systems. Use when setting up autonomous development workflows, choosing the right loop architecture, or building CI/CD-style continuous development pipelines.
- Commits and pushes
13 other projects use a version of this, 9 of them edited.
Adopted by
Most recently taken up by
- templetongroup/radiantedited, first seen Sep 17, 2026
- pekral/cursor-rulestheir own version, first seen Aug 5, 2026
- SamuelNDCE/claude-super-skill-libraryedited, first seen Aug 1, 2026
- thanvish21/hcc-bundletheir own version, first seen Jul 25, 2026
- Jamkris/everything-gemini-codeedited, first seen Apr 27, 2026
- noah-sheldon/ai-dev-kittheir own version, first seen Apr 13, 2026
Used with
Projects with it also use git-workflow.
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.
Microsoft AzureSkillgit-workflow
Squad branching model: dev-first workflow with insiders preview channel
Also in 3 projects that use this
Other versions13 projects use a version of this.
Word for word · 0
None found.
Edited · 9
- loulanyue/awesome-claude-notes★ 27235% same
- tpavanipradeep/everything-claude-code★ 13435% same
- templetongroup/radiant★ 11335% same
- Jamkris/everything-gemini-code★ 8735% same
- Infopibe/everything-claude-code★ 835% same
- ashutoshrathi0909-oss/everything-claude-code★ 135% same
- get-proofpilot/claude-skills-catalog★ 135% same
- SamuelNDCE/claude-super-skill-library★ 135% same
- mryeastcode/ClaudeCode★ 035% same
Wrote their own version · 4
- xu-xiang/everything-claude-code-zh★ 2ksame name
- noah-sheldon/ai-dev-kit★ 13same name
- pekral/cursor-rules★ 10same name
- thanvish21/hcc-bundle★ 0same name
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 repository15 other files it gives its agents.
- api-and-interface-designSkill
- code-review-and-qualitySkill
- code-simplificationSkill
- context-engineeringSkill
- debugging-and-error-recoverySkill
- documentation-and-adrsSkill
- doubt-driven-developmentSkill
- iterative-retrievalSkill
- open-designSkill
- performance-optimizationSkill
- security-and-hardeningSkill
- source-driven-developmentSkill
- test-driven-developmentSkill
- using-agent-skillsSkill
- verification-loopSkill
The file
We split this skill into the rules it gives an agent
6 rules. 4 are common, 2 are distinctive, and 0 are very specific to this project.
4
Common
Most of the 11 edited versions we read keep these.
2
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
- Common: line 127
Don't rely on agents to self-differentiate.
- Distinctive: line 171
Read this file at iteration start and update it at iteration end.
- Distinctive: line 175
When PR checks fail:
- Common: line 189
An add-on pattern for any loop: Add a dedicated cleanup/refactor step after each implementer step.
- Common: line 193
When you ask an LLM to implement with TDD, it takes "write tests" too literally:
- Common: line 201
Instead of constraining the implementer, let it be thorough.
“Common” is measured: kept by at least 6 in 10 of the 11 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
Autonomous Loops
Patterns, architectures, and reference implementations for running autonomous loops. Covers everything from simple sequential 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 | Low | Daily dev steps, scripted workflows |
| Infinite Agentic Loop | Medium | Parallel content generation, spec-driven work |
| Continuous PR Loop | Medium | Multi-day iterative projects with CI gates |
| De-Sloppify Pattern | Add-on | Quality cleanup after any implementer step |
| RFC-Driven DAG | High | Large features, multi-unit parallel work with merge queue |
1. Sequential Pipeline
The simplest loop. Break daily development into a sequence of non-interactive 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.
Chain calls to build a pipeline:
#!/bin/bash
# daily-dev.sh — Sequential pipeline for a feature branch
set -e
# Step 1: Implement the feature
opencode run "Read the spec in docs/auth-spec.md. Implement OAuth2 login in src/auth/. Write tests first (TDD)."
# Step 2: De-sloppify (cleanup pass)
opencode run "Review all files changed by the previous commit. Remove unnecessary type tests, overly defensive checks. Keep real business logic tests."
# Step 3: Verify
opencode run "Run the full build, lint, type check, and test suite. Fix any failures."
# Step 4: Commit
opencode run "Create a conventional commit for all staged changes."Key Design Principles
- Each step is isolated — A fresh context window per call means no context bleed between steps.
- Order matters — Steps execute sequentially. Each builds on the filesystem state left by the previous.
- Negative instructions are dangerous — Don't say "don't test type systems." Instead, add a separate cleanup step.
- Exit codes propagate —
set -estops the pipeline on failure.
2. Infinite Agentic Loop
A two-prompt system that orchestrates parallel sub-agents for specification-driven generation.
Architecture: Two-Prompt System
PROMPT 1 (Orchestrator) PROMPT 2 (Sub-Agents)
┌─────────────────────┐ ┌──────────────────────┐
│ Parse spec file │ │ Receive full context │
│ Scan output dir │ deploys │ Read assigned number │
│ Plan iteration │────────────│ Follow spec exactly │
│ Assign creative dirs │ N agents │ Generate unique output │
│ Manage waves │ │ Save to output dir │
└─────────────────────┘ └──────────────────────┘The Pattern
- Spec Analysis — Orchestrator reads a specification file defining what to generate
- Directory Recon — Scans existing output to find the highest iteration number
- Parallel Deployment — Launches N sub-agents, each with:
- The full spec
- A unique creative direction
- A specific iteration number (no conflicts)
- A snapshot of existing iterations (for uniqueness)
- Wave Management — For infinite mode, deploys waves of 3-5 agents until context is exhausted
Batching Strategy
| Count | Strategy |
| 1-5 | All agents simultaneously |
| 6-20 | Batches of 5 |
| infinite | Waves of 3-5, progressive sophistication |
Key Insight: Uniqueness via Assignment
Don't rely on agents to self-differentiate. The orchestrator assigns each agent a specific creative direction and iteration number.
3. Continuous PR Loop
A production-grade loop that runs code in a continuous loop, creating PRs, waiting for CI, and merging automatically.
Core Loop
┌─────────────────────────────────────────────────────┐
│ CONTINUOUS ITERATION │
│ │
│ 1. Create branch (continuous/iteration-N) │
│ 2. Run implementation with enhanced prompt │
│ 3. (Optional) Reviewer pass │
│ 4. Commit changes │
│ 5. Push + create PR (gh pr create) │
│ 6. Wait for CI checks (poll gh pr checks) │
│ 7. CI failure? → Auto-fix pass │
│ 8. Merge PR (squash/merge/rebase) │
│ 9. Return to main → repeat │
│ │
│ Limit by: --max-runs N | --max-cost $X │
│ --max-duration 2h | completion signal │
└─────────────────────────────────────────────────────┘Cross-Iteration Context: SHARED_TASK_NOTES.md
The critical innovation: a SHARED_TASK_NOTES.md file persists across iterations:
## Progress
- [x] Added tests for auth module (iteration 1)
- [x] Fixed edge case in token refresh (iteration 2)
- [ ] Still need: rate limiting tests, error boundary tests
## Next Steps
- Focus on rate limiting module next
- The mock setup in tests/helpers.ts can be reusedRead this file at iteration start and update it at iteration end. This bridges the context gap between independent invocations.
CI Failure Recovery
When PR checks fail:
- Fetch the failed run ID via
gh run list - Spawn a new implementation run with CI fix context
- Inspect logs via
gh run view, fix code, commit, push - Re-wait for checks (up to retry max)
Completion Signal
Signal "I'm done" by outputting a magic phrase. Three consecutive iterations signaling completion stops the loop.
4. The De-Sloppify Pattern
An add-on pattern for any loop. Add a dedicated cleanup/refactor step after each implementer step.
The Problem
When you ask an LLM to implement with TDD, it takes "write tests" too literally:
- Tests that verify TypeScript's type system works
- Overly defensive runtime checks the type system already guarantees
- Tests for framework behavior rather than business logic
- Excessive error handling that obscures the actual code
The Solution: Separate Pass
Instead of constraining the implementer, let it be thorough. Then add a focused cleanup agent:
# Step 1: Implement (let it be thorough)
opencode run "Implement the feature with full TDD. Be thorough with tests."
# Step 2: De-sloppify (separate context, focused cleanup)
opencode run "Review all changes in the working tree. Remove:
- Tests that verify language/framework behavior rather than business logic
- Redundant type checks that the type system already enforces
- Over-defensive error handling for impossible states
- Console.log statements
- Commented-out code
Keep all business logic tests. Run the test suite after cleanup."Key Insight
Rather than adding negative instructions which have downstream quality effects, add a separate de-sloppify pass. Two focused agents outperform one constrained agent.
5. RFC-Driven DAG Orchestration
The most sophisticated pattern. An RFC-driven, multi-agent pipeline that decomposes a spec into a dependency DAG, runs each unit through a tiered quality pipeline, and lands them via an agent-driven merge queue.
Architecture Overview
RFC/PRD Document
│
▼
DECOMPOSITION (AI)
Break RFC into work units with dependency DAG
│
▼
┌──────────────────────────────────────────────────────┐
│ QUALITY PIPELINES (parallel per unit) │
│ Each unit in its own worktree: │
│ Research → Plan → Implement → Test → Review │
│ (depth varies by complexity tier) │
├──────────────────────────────────────────────────────┤
│ MERGE QUEUE │
│ Rebase onto main → Run tests → Land or evict │
│ Evicted units re-enter with conflict context │
└──────────────────────────────────────────────────────┘Complexity Tiers
| Tier | Pipeline Stages |
| trivial | implement → test |
| small | implement → test → code-review |
| medium | research → plan → implement → test → review → review-fix |
| large | research → plan → implement → test → review → review-fix → final-review |
Key Design Principles
- Deterministic execution — Upfront decomposition locks in parallelism and ordering
- Human review at leverage points — The work plan is the single highest-leverage intervention point
- Separate concerns — Each stage in a separate context window with a separate agent
- Conflict recovery with context — Full eviction context enables intelligent re-runs
- Tier-driven depth — Trivial changes skip research/review; large changes get maximum scrutiny
Choosing the Right Pattern
Decision Matrix
Is the task a single focused change?
├─ Yes → Sequential Pipeline
└─ No → Is there a written spec/RFC?
├─ Yes → Do you need parallel implementation?
│ ├─ Yes → RFC-Driven DAG
│ └─ No → Continuous PR Loop
└─ No → Do you need many variations of the same thing?
├─ Yes → Infinite Agentic Loop
└─ No → Sequential Pipeline with de-sloppifyCombining Patterns
These patterns compose well:
- Sequential Pipeline + De-Sloppify — The most common combination. Every implement step gets a cleanup pass.
- Continuous Loop + De-Sloppify — Add a de-sloppify directive to each iteration.
- Any loop + Verification — Use
verification-loopskill as a gate before commits.
Anti-Patterns
- Infinite loops without exit conditions — Always have a max-runs, max-cost, max-duration, or completion signal.
- No context bridge between iterations — Each call starts fresh. Use
SHARED_TASK_NOTES.mdor filesystem state to bridge context. - Retrying the same failure — If an iteration fails, capture the error context and feed it to the next attempt.
- Negative instructions instead of cleanup passes — Don't say "don't do X." Add a separate pass that removes X.
- All agents in one context window — For complex workflows, separate concerns into different agent processes.
Verification
After applying autonomous-loops:
- The chosen pattern matches the complexity of the task
- Exit conditions are defined (max-runs, max-cost, max-duration, or completion signal)
- Context is bridged between iterations (SHARED_TASK_NOTES.md or equivalent)
- Failure recovery captures error context for the next attempt
- De-sloppify pass is separate from the implementer pass (not negative instructions)
- Verification runs before commits
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.

