This prompt guides you, a coding agent, to create a new Autoloop program — an optimization loop that runs autonomously on a schedule, proposes changes, evaluates them against a metric, and keeps only improvements.
Autoloop is a GitHub Agentic Workflow that runs iterative optimization loops. Each loop is defined by a program — a directory under .autoloop/programs/, a markdown file in .autoloop/programs/, or a GitHub issue with the autoloop-program label.
.autoloop/programs/<program-name>/
├── program.md ← program definition (Goal, Target, Evaluation)
└── code/ ← code files the agent optimizes
├── initial_program.py
├── evaluator.py
├── config.yaml
└── requirements.txt
.autoloop/programs/<program-name>.md
A repository can have multiple programs running independently. Each gets its own schedule, metric tracking, long-running branch (autoloop/<program-name>), and draft PR.
Before creating a program, understand what's in the repository:
- Read
README.md,AGENTS.md, andCLAUDE.md(if they exist). - Check what build/test/lint commands are available.
- Check for existing programs in
.autoloop/programs/to avoid overlap. - Identify what aspects of the project could benefit from iterative optimization.
Good Autoloop programs have these properties:
- Measurable: There's a numeric metric that can be extracted from a command.
- Incremental: Small changes can move the metric in the right direction.
- Bounded scope: The set of files to modify is well-defined and limited.
- Safe to iterate: A bad change can be rejected without breaking anything.
When creating a program, decide whether it is open-ended or goal-oriented:
- Open-ended: The program runs indefinitely, always seeking further improvement. Use this for research experiments, continuous optimization, or when there is no clear "done" threshold. Omit
target-metricfrom the frontmatter. - Goal-oriented: The program has a finish line — a specific metric value that, once reached, completes the program. Use this for concrete targets like "reach 95% test coverage" or "reduce build time below 30 seconds". Set
target-metricin the frontmatter.
When the agent proposes a new program, it should always clarify which type it is creating and why. If a goal-oriented program's target metric is reached, the program completes automatically: the autoloop-program label is removed, an autoloop-completed label is added (for issue-based programs), and the state file is marked as completed.
Prefer issue-based programs whenever possible. They are the easiest to create, manage, and steer. Only use directory-based or bare markdown programs when there is a clear reason to do so. If it's not clear which layout is best, ask the user before proceeding.
- Use an issue-based program (GitHub issue with
autoloop-programlabel) by default — open an issue, fill in the template, and the workflow picks it up. The issue body uses the same format as a program file. You can steer the program by commenting on the issue. - Use a directory-based program (
.autoloop/programs/<name>/) when the program has its own codebase to experiment on (e.g., algorithm optimization, ML training). - Use a bare markdown program (
.autoloop/programs/<name>.md) when the program modifies existing repository code and you need it checked into the repo (e.g., test coverage, build performance).
The program file (program.md or <name>.md) defines three things:
- Goal: What to optimize (natural language)
- Target: Which files the agent may modify
- Evaluation: Command that outputs a JSON metric
---
schedule: every 6h # Options: every Nh, every Nm, daily, weekly
timeout-minutes: 40 # Optional
target-metric: 0.95 # Optional: halting condition — program completes when this metric is reached
---If target-metric is set, the program is goal-oriented and will stop running once the metric reaches or surpasses the target value. If omitted, the program is open-ended and runs indefinitely.
The evaluation command must print JSON with the metric:
{"metric_name": 42.5}- Run the evaluation command locally and verify JSON output.
- Verify target files exist.
- Ensure no
<!-- AUTOLOOP:UNCONFIGURED -->orREPLACE/TODOplaceholders remain. - Ensure the program name is unique.
- Slash command:
/autoloop <program-name>: <optional instructions> - Workflow dispatch: Trigger from the Actions tab. Use the optional
programinput to run a specific program by name (bypasses scheduling). - CLI:
gh aw run autolooporgh aw run autoloop --inputs program=<program-name>
The quickest way to create a program:
- Open a new issue using the Autoloop Program issue template (or create one manually with the
autoloop-programlabel). - Fill in the Goal, Target, and Evaluation sections — the format is identical to
program.md. - The next scheduled run discovers the issue and includes it in scheduling.
- A status comment is posted/updated on the issue after each run with links and current state.
- Per-run comments are posted with the Actions run link and a summary of what happened.
- Steer the program by adding comments to the issue — the agent reads them before each iteration.