Ships with octo. Installing the plugin gets this command.
⚡ How it fires
How this command gets triggered: by you, by Claude, or both.
Fires itselfClaude auto-loads it when your prompt matches the work.
You can call itInvoke it directly when you want it.
Slash command/loop
👁️ Context preview
What this command does when you run it.
[advanced] Execute tasks in loops with conditions, iterative improvements until goals are met
📊 Stats
Stars3,869
Forks362
LanguageShell
LicenseMIT
📦 Ships with octo
</> Command definition
loop.md
---command: loop
description: "[advanced] Execute tasks in loops with conditions, iterative improvements until goals are met"
---# Loop - Iterative Execution Skill
**Your first output line MUST be:** `🐙 Octopus Loop Mode`
## Instructions
Read and follow the full skill instructions from:
`${HOME}/.claude-octopus/plugin/.claude/skills/skill-iterative-loop/SKILL.md`
## Quick Usage
Just use natural language:
```
"Loop 5 times auditing, enhancing, testing"
"Keep trying until all tests pass"
"Iterate until performance improves"
```
Or use the explicit command:
```
/octo:loop "run tests and fix issues" --max 5
/octo:loop "optimize performance until < 100ms"
```
## Loop Execution Approach
1. **Define Goal**: Clear success criteria and exit conditions
2. **Set Max Iterations**: Safety limit to prevent infinite loops
3. **Execute**: Run the task/operation
4. **Evaluate**: Check if goal is met or progress made
5. **Loop or Complete**: Continue if needed, stop when done
## What You Get
- **Exit condition**: When to stop ("until tests pass", "until score > X")
- **Progress metric**: How to measure improvement
## Natural Language Examples
```
"Loop 5 times auditing, enhancing, testing the authentication module"
"Keep trying until the deployment succeeds, max 3 attempts"
"Iterate improving the algorithm until performance is under 50ms"
"Run the optimization loop 10 times and track progress"
"Loop around 3 times fixing linting errors until all clear"
```
## Metric Verification Mode
When you specify a `Metric:` command, the loop switches to mechanical metric verification. Each iteration makes ONE atomic change, commits it with an `experiment:` prefix, measures the metric, and automatically reverts if the metric worsens.
### Metric Mode Parameters
- **Metric:** `<shell command>` — must output a number (the value to optimize)
- **Direction:** `higher` or `lower` — whether bigger or smaller numbers are better
- **Guard:** `<shell command>` — must exit 0 for a change to be kept (run after metric)
- **Iterations:** `N` — max iterations (default: unbounded)