iterate
Autonomous improvement loop for codebase optimization. Automatically modifies, measures, and iterates on code based on a specific goal and mechanical metric.
Introduction
The iterate skill is a sophisticated autonomous agent pattern designed to facilitate iterative code improvement, heavily inspired by Karpathy's autoresearch methodology. It functions as a closed-loop system where the agent is constrained by a clear scope and a single, verifiable mechanical metric. By combining static analysis, git-based version control as memory, and automated verification, it systematically explores potential improvements while shielding the codebase from regressions. This skill is ideal for software engineers dealing with legacy code refactoring, performance tuning, test coverage expansion, or systematic bug hunting, where the definition of success can be quantified through shell commands.
-
Automated iteration cycles: Modify, verify, and decide (keep/discard) based on real-time feedback.
-
Configurable safety: Includes optional guard commands like typecheckers or linting to prevent regressions during the loop.
-
Branch isolation: Automatically handles git branch creation and management to ensure experimentation remains contained.
-
Batched experimentation: Supports batching multiple independent changes per iteration to maximize efficiency and enable bisect-style debugging.
-
Flexible stop conditions: Supports iteration caps, target value attainment, and stagnation thresholds to prevent runaway loops.
-
Prerequisites include a well-defined goal (e.g., improve test coverage to 90%), a clear scope using file globs, and a reliable shell command to output the success metric.
-
The agent functions best when provided with both a primary verification command (the metric) and a secondary guard command (the safety net).
-
Users should define clear stop conditions to ensure the agent does not consume excessive compute or tokens.
-
Recommended for tasks like increasing performance benchmarks, expanding test suites, or automating refactoring based on specific code metrics.
-
Utilizes a 'results.tsv' file to track progression and history, allowing the agent to 'learn' from previous attempts and avoid discarded patterns.
Repository Stats
- Stars
- 17
- Forks
- 1
- Open Issues
- 0
- Language
- Shell
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- May 3, 2026, 06:49 PM