|
| 1 | +# Infinite Agentic Loop |
| 2 | + |
| 3 | +> **Tutorial**: [Infinite Agentic Loop with Claude Code](https://youtu.be/9ipM_vDwflI) |
| 4 | +> **Repo**: https://github.com/disler/infinite-agentic-loop |
| 5 | +> **Author**: [@disler](https://github.com/disler) |
| 6 | +
|
| 7 | +## What It Does |
| 8 | + |
| 9 | +The Infinite Agentic Loop is a **meta-agent orchestrator** that commands parallel AI |
| 10 | +sub-agents to generate endlessly evolving, unique content iterations from a |
| 11 | +specification file. Instead of a single agent writing output sequentially, it deploys |
| 12 | +*waves of parallel agents* — each assigned a distinct creative direction — producing |
| 13 | +diverse, spec-compliant results simultaneously. |
| 14 | + |
| 15 | +## Key Capabilities |
| 16 | + |
| 17 | +- **Four generation modes** via the `/project:infinite` Claude Code slash command: |
| 18 | + - `count = 1` → single iteration |
| 19 | + - `count = 5–20` → batch mode (agents launch simultaneously or in batches of 5) |
| 20 | + - `count = infinite` → continuous wave generation until context limits are reached |
| 21 | +- **Parallel sub-agent coordination** — each agent receives the full spec, a snapshot |
| 22 | + of existing iterations, a unique iteration number, and an assigned creative dimension |
| 23 | + to prevent duplication. |
| 24 | +- **Spec-driven generation** — reads a Markdown specification file (`specs/`) that |
| 25 | + defines content format, naming patterns, quality standards, and evolution strategy. |
| 26 | +- **Directory-aware** — reconnaissance phase reads all existing iterations before each |
| 27 | + wave so no two outputs are the same. |
| 28 | +- **Progressive sophistication** — infinite mode escalates creative complexity wave by |
| 29 | + wave, from functional basics to paradigm-shifting innovations. |
| 30 | +- **Context-budget management** — monitors total context usage and concludes gracefully |
| 31 | + when limits approach. |
| 32 | + |
| 33 | +## Example Usage |
| 34 | + |
| 35 | +```bash |
| 36 | +# Start Claude Code in the repo |
| 37 | +claude |
| 38 | + |
| 39 | +# Single iteration |
| 40 | +/project:infinite specs/invent_new_ui_v3.md src 1 |
| 41 | + |
| 42 | +# Batch of 20 UI components |
| 43 | +/project:infinite specs/invent_new_ui_v3.md src_new 20 |
| 44 | + |
| 45 | +# Infinite mode — keeps generating until context runs out |
| 46 | +/project:infinite specs/invent_new_ui_v3.md infinite_src_new/ infinite |
| 47 | +``` |
| 48 | + |
| 49 | +## Architecture |
| 50 | + |
| 51 | +``` |
| 52 | +.claude/commands/infinite.md ← The orchestrator prompt (this agent's brain) |
| 53 | +specs/ ← Specification files that define what to generate |
| 54 | +src/ src_infinite/ ← Output directories for generated iterations |
| 55 | +CLAUDE.md ← Project context for Claude Code |
| 56 | +``` |
| 57 | + |
| 58 | +The orchestrator runs as a **Claude Code custom slash command**. It dispatches |
| 59 | +sub-agents via the `Task` tool, coordinating parallel execution, managing naming, |
| 60 | +and collecting results — all within a single Claude Code session. |
| 61 | + |
| 62 | +## Why It's Useful |
| 63 | + |
| 64 | +- Demonstrates the **Infinite Agentic Loop pattern** — a reusable architecture for |
| 65 | + any domain (UI components, test cases, docs, code variants, data synthesis). |
| 66 | +- Works out-of-the-box with Claude Code — no external infrastructure needed. |
| 67 | +- Fully spec-driven — swap the spec file to generate anything: write a spec, run the |
| 68 | + loop, get 20 unique outputs in minutes. |
0 commit comments