iteration-control
Manage bounded iteration loops for autonomous implementation — track retries, synthesize failure feedback, and escalate when limits hit
Best use case
iteration-control is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
It is a strong fit for teams already working in Codex.
Manage bounded iteration loops for autonomous implementation — track retries, synthesize failure feedback, and escalate when limits hit
Teams using iteration-control should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/iteration-control/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How iteration-control Compares
| Feature / Agent | iteration-control | Standard Approach |
|---|---|---|
| Platform Support | Codex | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Manage bounded iteration loops for autonomous implementation — track retries, synthesize failure feedback, and escalate when limits hit
Which AI agents support this skill?
This skill is designed for Codex.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Top AI Agents for Productivity
See the top AI agent skills for productivity, workflow automation, operational systems, documentation, and everyday task execution.
SKILL.md Source
# iteration-control
Manages bounded iteration loops for autonomous implementation with escalation.
## Triggers
Alternate expressions and non-obvious activations (primary phrases are matched automatically from the skill description):
- "pause the loop" → loop control signal
- "stop after N cycles" → explicit iteration limit
## Purpose
This skill provides iteration control logic for guided implementation workflows. It tracks retry attempts, synthesizes feedback from failures, and decides whether to retry autonomously or escalate to the user.
Based on MAGIS research finding: Developer-QA iteration loops with bounds improve code quality while preventing infinite loops.
## Behavior
When invoked during a validation loop:
1. **Track iteration state**:
- Current iteration count
- Maximum allowed iterations (default: 3)
- Task identifier
2. **Evaluate validation results**:
- Test results (pass/fail)
- Review results (approve/reject/feedback)
- Error messages and stack traces
3. **Synthesize feedback** (on failure):
- Extract actionable items from test output
- Extract specific issues from review feedback
- Prioritize by severity
4. **Decide action**:
- `proceed`: Validation passed, continue to next task
- `retry`: Validation failed, iteration < max, retry with feedback
- `escalate`: Validation failed, iteration >= max, pause for user
5. **Format escalation** (when needed):
- Summary of attempts made
- Consolidated feedback from all iterations
- Specific question or decision needed from user
## Decision Logic
```
IF test_result == PASS AND review_result == APPROVE:
RETURN { action: "proceed" }
IF current_iteration >= max_iterations:
RETURN {
action: "escalate",
context: summarize_all_attempts(),
question: identify_blocking_issue()
}
IF test_result == FAIL:
RETURN {
action: "retry",
feedback: extract_test_feedback(),
iteration: current_iteration + 1
}
IF review_result == REJECT:
RETURN {
action: "retry",
feedback: extract_review_feedback(),
iteration: current_iteration + 1
}
```
## Input Format
```yaml
iteration_check:
task_id: "task-003"
current_iteration: 2
max_iterations: 3
test_result:
status: "fail" # pass | fail
output: |
FAIL src/auth/login.test.ts
Expected: token to contain userId
Received: undefined
review_result:
status: "pending" # approve | reject | pending
feedback: ""
```
## Output Format
### Proceed
```yaml
decision:
action: "proceed"
task_id: "task-003"
message: "Validation passed. Proceeding to next task."
```
### Retry
```yaml
decision:
action: "retry"
task_id: "task-003"
iteration: 3
feedback:
summary: "Test failed: token missing userId"
actionable_items:
- "Ensure jwt.sign includes userId in payload"
- "Check that user object is populated before token generation"
priority: "high"
```
### Escalate
```yaml
decision:
action: "escalate"
task_id: "task-003"
iteration: 3
context:
attempts_summary: |
Iteration 1: Test failed - undefined token
Iteration 2: Test failed - token missing userId
Iteration 3: Test failed - userId present but wrong format
pattern_detected: "userId format mismatch between token and test expectation"
question: |
After 3 attempts, the test still fails due to userId format.
The token contains: { userId: "123" } (string)
The test expects: { userId: 123 } (number)
Which format should be used?
1. String (update test)
2. Number (update implementation)
```
## Configuration
Default settings (can be overridden per-flow):
```yaml
iteration_control:
max_iterations: 3
auto_retry_on_test_fail: true
auto_retry_on_review_reject: true
escalation_includes_diff: true
feedback_max_length: 500
```
## Integration
Used by `/flow-guided-implementation` to wrap the validation loop:
```
FOR EACH task:
iteration = 0
LOOP:
generate_code()
run_tests() -> test_result
run_review() -> review_result
decision = iteration_control(task, iteration, test_result, review_result)
SWITCH decision.action:
"proceed": BREAK (next task)
"retry": apply_feedback(decision.feedback); iteration++; CONTINUE
"escalate": PAUSE; await_user_input(); CONTINUE or ABORT
```
## Traceability
- @research @.aiwg/research/REF-004-magis-multi-agent-issue-resolution.md
## References
- @.aiwg/working/guided-impl-analysis/SYNTHESIS.md
- @$AIWG_ROOT/agentic/code/addons/aiwg-utils/prompts/reliability/resilience.mdRelated Skills
mission-control
Orchestrate multi-loop background operations via the Mission Control dashboard — start sessions, dispatch missions, monitor, and stop
flow-iteration-dual-track
Orchestrate dual-track iteration with synchronized Discovery (next) and Delivery (current) workflows
flow-change-control
Orchestrate change control workflow with baseline management, impact assessment, CCB review, and communication
aiwg-orchestrate
Route structured artifact work to AIWG workflows via MCP with zero parent context cost
venv-manager
Create, manage, and validate Python virtual environments. Use for project isolation and dependency management.
pytest-runner
Execute Python tests with pytest, supporting fixtures, markers, coverage, and parallel execution. Use for Python test automation.
vitest-runner
Execute JavaScript/TypeScript tests with Vitest, supporting coverage, watch mode, and parallel execution. Use for JS/TS test automation.
eslint-checker
Run ESLint for JavaScript/TypeScript code quality and style enforcement. Use for static analysis and auto-fixing.
repo-analyzer
Analyze GitHub repositories for structure, documentation, dependencies, and contribution patterns. Use for codebase understanding and health assessment.
pr-reviewer
Review GitHub pull requests for code quality, security, and best practices. Use for automated PR feedback and approval workflows.
YouTube Acquisition
yt-dlp patterns for acquiring content from YouTube and video platforms
Quality Filtering
Accept/reject logic and quality scoring heuristics for media content