iterate
iterate - AI-Powered Iterative Task Completion
The iterate command automates multi-step task completion using AI agents. It runs an AI agent in a loop, completing one task per iteration until all requirements are met or a maximum iteration count is reached.
Overview
The iterate command implements a “loop until done” pattern:
- Reads task requirements from
requirements.md - Checks current progress from
progress.md - Invokes an AI agent to complete ONE task per iteration
- Agent updates
progress.mdafter each task - Continues looping until finished or max iterations reached
- Reports final status and iteration count
Commands
iterate run
Run the iterative task completion loop.
Syntax:
nmbl iterate [run] [iterations] [options]Arguments:
iterations- Maximum number of iterations (default: 10)
Options:
--agent <name>- AI agent to use:copilot-sdk(default),copilot-cli, orclaude-cli--model <name>- Model to use (agent-specific, use?for interactive selection)--input <path>- Directory containing prompt.md, requirements.md, progress.md--workspace <path>- Directory where agent creates/modifies work files (default:./work/)
Examples:
# Run with defaults (10 iterations, copilot-sdk agent)
nmbl iterate
# Run with explicit iteration count
nmbl iterate run 20
# Use Claude CLI agent
nmbl iterate run --agent claude-cli
# Interactive model selection
nmbl iterate run --model ?
# Specify custom directories
nmbl iterate run --input ./.iterate --workspace ./outputiterate setup
Initialize a workspace with the required markdown files for iteration.
Syntax:
nmbl iterate setup [options]Options:
--dir <path>- Target directory for setup files (default:./.iterate/)--from <file>- Use an existing file as requirements.md--issue <number>- Fetch requirements from a GitHub issue--repo <owner/repo>- GitHub repository for issue (default: current repo)--force- Overwrite existing files
Examples:
# Create .iterate folder with default files
nmbl iterate setup
# Create in custom directory
nmbl iterate setup --dir ./my-tasks
# Use existing requirements file
nmbl iterate setup --from ./specs/feature-spec.md
# Fetch requirements from GitHub issue
nmbl iterate setup --issue 123
# Fetch from specific repository
nmbl iterate setup --issue 456 --repo owner/repo-name
# Overwrite existing files
nmbl iterate setup --forceDirectory Structure
The .iterate Folder
The .iterate folder is the recommended way to organize iteration files:
project/
├── .iterate/
│ ├── prompt.md # Instructions for the AI agent
│ ├── requirements.md # Tasks to complete
│ └── progress.md # Log of completed work (updated by agent)
└── work/ # Workspace where agent creates filesInput Directory vs Workspace
| Concept | Purpose | Default |
|---|---|---|
| Input Directory | Contains configuration files (prompt.md, requirements.md, progress.md) | ./.iterate/ if exists, otherwise current directory |
| Workspace Directory | Where the agent creates and modifies work files | ./work/ |
File Descriptions
| File | Purpose | Modified By |
|---|---|---|
prompt.md | Instructions for the AI agent | You (customize if needed) |
requirements.md | Tasks to complete | You (or via --from/--issue) |
progress.md | Log of completed work | AI agent (appends after each task) |
Supported Agents
| Agent | Description | Requirements |
|---|---|---|
copilot-sdk | GitHub Copilot SDK (default) | GitHub Copilot subscription |
copilot-cli | GitHub Copilot CLI | gh copilot extension installed |
claude-cli | Anthropic Claude CLI | claude CLI installed |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | All requirements completed successfully |
| 1 | Error (missing files, invalid arguments, agent failure) |
| 5 | Max iterations reached without completion |
Workflow Example
# 1. Setup workspace with requirements from a GitHub issue
nmbl iterate setup --issue 42
# 2. (Optional) Review/edit the generated files
code .iterate/requirements.md
# 3. Run the iteration loop
nmbl iterate run 15 --agent copilot-sdk
# 4. Check results in ./work/ directoryTips
- Start with fewer iterations - Use 5-10 iterations initially to verify the agent understands the requirements
- Use specific requirements - Break down tasks into clear, atomic steps in requirements.md
- Review progress.md - Check the progress log to understand what the agent has completed
- Customize prompt.md - Modify the agent instructions for your specific use case
- Use
--model ?- Interactive model selection helps discover available models