Run iterative agent loops until success criteria are met. Controlled autonomous iteration.
---
name: Loop
slug: loop
version: 1.0.2
description: Run iterative agent loops until success criteria are met. Controlled autonomous iteration.
changelog: Fixed internal contradiction about Git commits in memory.md
metadata: {"clawdbot":{"emoji":"π","requires":{"bins":[]},"os":["linux","darwin","win32"]}}
---
## Data Storage
```
~/loop/
βββ active.json # Currently running loops
βββ history/ # Completed loop logs
β βββ {loop-id}.json
βββ learnings.md # Cross-loop patterns
```
Create on first use: `mkdir -p ~/loop/history`
## Scope
This skill:
- β
Runs iterative attempts toward defined success criteria
- β
Logs each iteration with learnings
- β
Exits on success, max iterations, or unrecoverable error
- β NEVER makes Git commits automatically
- β NEVER deploys to production
- β NEVER modifies system configuration
- β NEVER runs indefinitely (max 10 iterations hard limit)
## Quick Reference
| Topic | File |
|-------|------|
| Loop examples | `examples.md` |
| Memory between iterations | `memory.md` |
## Core Rules
### 1. Pattern
```
Task + Criteria β Execute β Verify β [Pass? Exit : Retry]
```
### 2. Required Setup
| Element | Required | Example |
|---------|----------|---------|
| Task | Yes | "Fix failing tests" |
| Success criteria | Yes | "All tests pass" |
| Max iterations | Default: 5 | Max: 10 |
| Verify command | Recommended | `npm test` |
### 3. When to Propose
- Task has clear success criteria but uncertain path
- Previous attempt failed but error is fixable
- User says "keep trying until..."
**NOT for:** One-shot tasks, undefined goals, exploratory work
### 4. Each Iteration
1. **Fresh context** β Only carry: task, criteria, count, learnings
2. **Execute** β Attempt the task
3. **Verify** β Check success criteria
4. **Record** β Append to history: what worked, what failed
5. **Decide** β Pass? Exit. Fail? Retry if under limit.
### 5. Stopping Conditions
- β
Success criteria met
- β Max iterations reached
- β οΈ Unrecoverable error (missing dependency, permission denied)
### 6. On Failure
If max reached without success:
- Summarize all attempts
- Identify common failure pattern
- Recommend manual intervention or different approach
### 7. Safety
- Hard limit: 10 iterations maximum
- No destructive actions without explicit per-action approval
- Log everything to ~/loop/history/
don't have the plugin yet? install it then click "run inline in claude" again.