You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Programs now live in .github/autoloop/programs/ (one .md file per loop)
- Each program gets its own namespace: metrics, memory, branches, PRs, experiment log
- Programs can specify per-program schedule and timeout via YAML frontmatter
- Slash command supports program targeting: /autoloop training: try X
- Template moved to programs/example.md with instructions to rename
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/autoloop.md
+49-28Lines changed: 49 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
**Iterative optimization agent inspired by [Autoresearch](https://github.com/karpathy/autoresearch) and Claude Code's `/loop`**
6
6
7
-
The [Autoloop workflow](../workflows/autoloop.md?plain=1) runs on a schedule to autonomously improve a target artifact toward a measurable goal. Each iteration proposes a change, evaluates it against a metric, and keeps only improvements.
7
+
The [Autoloop workflow](../workflows/autoloop.md?plain=1) runs on a schedule to autonomously improve target artifacts toward measurable goals. Each iteration proposes a change, evaluates it against a metric, and keeps only improvements. Supports **multiple independent loops** in the same repository.
8
8
9
9
## Installation
10
10
@@ -22,43 +22,58 @@ This walks you through adding the workflow to your repository.
22
22
23
23
```mermaid
24
24
graph LR
25
-
A[Scheduled Run] --> B[Read program.md]
26
-
B --> C[Review History]
27
-
C --> D[Propose Change]
28
-
D --> E[Implement on Branch]
29
-
E --> F[Run Evaluation]
30
-
F --> G{Metric Improved?}
31
-
G -->|Yes| H[Create Draft PR]
32
-
G -->|No| I[Record & Reject]
33
-
H --> J[Update Experiment Log]
34
-
I --> J
25
+
A[Scheduled Run] --> B[Discover Programs]
26
+
B --> C[For Each Program]
27
+
C --> D[Review History]
28
+
D --> E[Propose Change]
29
+
E --> F[Implement on Branch]
30
+
F --> G[Run Evaluation]
31
+
G --> H{Metric Improved?}
32
+
H -->|Yes| I[Create Draft PR]
33
+
H -->|No| J[Record & Reject]
34
+
I --> K[Update Experiment Log]
35
+
J --> K
35
36
```
36
37
37
38
## Getting Started
38
39
39
-
When you install Autoloop, a **template `program.md`** is added to your repo at `.github/autoloop/program.md`. This template has placeholder sections you must fill in — the workflow **will not run** until you do.
40
+
When you install Autoloop, a **template program file** is added at `.github/autoloop/programs/example.md`. This template has placeholder sections you must fill in — the workflow **will not run** until you do.
40
41
41
42
### Setup flow
42
43
43
44
```mermaid
44
45
graph LR
45
-
A[Install Workflow] --> B[Edit program.md]
46
+
A[Install Workflow] --> B[Rename & Edit Program]
46
47
B --> C[Define Goal, Targets, Evaluation]
47
48
C --> D[Remove UNCONFIGURED sentinel]
48
49
D --> E[Commit & Push]
49
50
E --> F[Loop Begins]
50
51
```
51
52
52
53
1.**Install** — `gh aw add-wizard githubnext/agentics/autoloop`
53
-
2.**Edit** — Open `.github/autoloop/program.md` and replace the placeholders with your project's goal, target files, and evaluation command. The template includes three complete examples (ML training, test coverage, build performance) for inspiration.
54
-
3.**Activate** — Remove the `<!-- AUTOLOOP:UNCONFIGURED -->` line at the top of the file.
2.**Rename** — Rename `.github/autoloop/programs/example.md` to something meaningful (e.g., `training.md`, `coverage.md`). The filename becomes the program name.
55
+
3.**Edit** — Replace the placeholders with your project's goal, target files, and evaluation command. The template includes three complete examples for inspiration.
56
+
4.**Activate** — Remove the `<!-- AUTOLOOP:UNCONFIGURED -->` line at the top.
If you forget to edit the template, the first scheduled run will create a GitHub issue reminding you, with a direct link to edit the file.
58
60
61
+
### Adding more loops
62
+
63
+
To run multiple optimization loops in parallel, just add more `.md` files to `.github/autoloop/programs/`:
64
+
65
+
```
66
+
.github/autoloop/programs/
67
+
├── training.md ← optimize model training loss
68
+
├── coverage.md ← maximize test coverage
69
+
└── build-perf.md ← minimize build time
70
+
```
71
+
72
+
Each program runs independently with its own metric tracking, experiment log issue, and PR namespace. Copy the template, fill it in, and push — the next scheduled run picks it up automatically.
73
+
59
74
## Configuration
60
75
61
-
The `program.md` file (at`.github/autoloop/program.md` or repo root) has three sections:
76
+
Each program file in`.github/autoloop/programs/` has three sections:
62
77
63
78
### 1. Goal — What to optimize
64
79
@@ -72,7 +87,7 @@ List the files the agent is allowed to modify. Everything else is off-limits.
72
87
73
88
Provide a command to run and a metric to extract. Specify whether higher or lower is better.
74
89
75
-
### Example program.md
90
+
### Example program file
76
91
77
92
````markdown
78
93
# Autoloop Program
@@ -107,11 +122,13 @@ Edit the workflow's `schedule` field. Examples:
107
122
108
123
After editing, run `gh aw compile` to update the workflow.
109
124
125
+
Note: The schedule applies to the workflow as a whole — all programs iterate on the same schedule. To run programs at different frequencies, you can install the workflow multiple times with different schedules, each pointing to a subset of programs.
126
+
110
127
## Usage
111
128
112
129
### Automatic mode
113
130
114
-
Once `program.md` exists and the workflow is installed, iterations run automatically on schedule. Each run:
131
+
Once at least one configured program exists, iterations run automatically on schedule. Each run processes every configured program:
115
132
116
133
1. Reads the program definition and past history
117
134
2. Proposes a single targeted change
@@ -121,23 +138,26 @@ Once `program.md` exists and the workflow is installed, iterations run automatic
121
138
### Manual trigger
122
139
123
140
```bash
124
-
# Run an iteration now
141
+
# Run all programs now
125
142
gh aw run autoloop
126
143
127
-
# Give specific instructions
128
-
gh aw run autoloop -- "try using cosine annealing for the learning rate schedule"
144
+
# Target a specific program
145
+
gh aw run autoloop -- "training: try using cosine annealing"
146
+
147
+
# If only one program exists, no prefix needed
148
+
gh aw run autoloop -- "try batch size 64 instead of 32"
129
149
```
130
150
131
151
### Slash command
132
152
133
153
Comment on any issue or PR:
134
154
```
135
-
/autoloop try batch size 64 instead of 32
155
+
/autoloop training: try batch size 64 instead of 32
136
156
```
137
157
138
158
## Experiment Tracking
139
159
140
-
All iterations are logged in a monthly GitHub issue titled `[Autoloop] Experiment Log {YYYY-MM}`. The issue tracks:
160
+
Each program gets its own monthly experiment log issue titled `[Autoloop: {program-name}] Experiment Log {YYYY-MM}`. The issue tracks:
141
161
142
162
- Current best metric value
143
163
- Full iteration history with accept/reject status
@@ -148,14 +168,15 @@ All iterations are logged in a monthly GitHub issue titled `[Autoloop] Experimen
148
168
149
169
-**Review draft PRs** — accepted improvements appear as draft PRs for human review
150
170
-**Merge or close** — you decide which optimizations to keep
151
-
-**Adjust the program** — update `program.md` to change the goal, targets, or evaluation
152
-
-**Steer via slash command** — use `/autoloop <instructions>` to direct specific experiments
153
-
-**Pause** — disable the workflow schedule to stop iterations
171
+
-**Adjust programs** — edit any program file to change the goal, targets, or evaluation
172
+
-**Add/remove loops** — add or delete files in `.github/autoloop/programs/`
173
+
-**Steer via slash command** — use `/autoloop {program}: {instructions}` to direct experiments
174
+
-**Pause** — disable the workflow schedule to stop all loops, or add the sentinel back to a single program file to pause just that loop
154
175
155
176
## Security
156
177
157
178
- Runs with read-only GitHub permissions
158
-
- Only modifies files listed in `program.md`'s Target section
179
+
- Only modifies files listed in each program's Target section
159
180
- Never modifies evaluation scripts
160
181
- All changes go through draft PRs requiring human approval
161
182
- Uses "safe outputs" to constrain what the agent can create
Copy file name to clipboardExpand all lines: workflows/autoloop.md
+70-25Lines changed: 70 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,58 +74,102 @@ An iterative optimization agent that proposes changes, evaluates them against a
74
74
Take heed of **instructions**: "${{ steps.sanitized.outputs.text }}"
75
75
76
76
If these are non-empty (not ""), then you have been triggered via `/autoloop <instructions>`. The instructions may be:
77
-
-**A one-off directive**: e.g., `/autoloop try a different approach to the loss function`. Execute it as a single iteration using the program.md context, then report results.
78
-
-**A configuration change**: e.g., `/autoloop set metric to accuracy instead of loss`. Update the relevant program.md section and confirm.
77
+
-**A one-off directive targeting a specific program**: e.g., `/autoloop training: try a different approach to the loss function`. The text before the colon is the program name (matching a file in `.github/autoloop/programs/`). Execute it as a single iteration for that program, then report results.
78
+
-**A general directive**: e.g., `/autoloop try cosine annealing`. If no program name prefix is given and only one program exists, use that one. If multiple exist, ask which program to target.
79
+
-**A configuration change**: e.g., `/autoloop training: set metric to accuracy instead of loss`. Update the relevant program file and confirm.
79
80
80
81
Then exit — do not run the normal loop after completing the instructions.
81
82
83
+
## Multiple Programs
84
+
85
+
Autoloop supports **multiple independent optimization loops** in the same repository. Each loop is defined by a separate markdown file in `.github/autoloop/programs/`. For example:
On each scheduled run, the workflow iterates through **all configured programs** and runs one iteration per program. Programs with the `<!-- AUTOLOOP:UNCONFIGURED -->` sentinel are skipped.
103
+
104
+
### Per-Program Schedule and Timeout
105
+
106
+
Programs can optionally specify their own schedule and timeout in a YAML frontmatter block at the top of the file (after the sentinel, if present):
107
+
108
+
```markdown
109
+
---
110
+
schedule: every 1h
111
+
timeout-minutes: 30
112
+
---
113
+
114
+
# Autoloop Program
115
+
...
116
+
```
117
+
118
+
-**`schedule`**: Controls how often this program runs. On each workflow trigger, check if the program is due based on its schedule and the `last_run` timestamp in memory. If the program's schedule hasn't elapsed since its last run, skip it. If omitted, the program runs on every workflow trigger.
119
+
-**`timeout-minutes`**: Maximum time for this program's iteration. If omitted, the program shares the workflow's overall timeout.
120
+
121
+
This lets you run a fast coverage check every hour while running a slow training loop once a day — all from the same workflow.
122
+
82
123
## Program Definition
83
124
84
-
The user configures the optimization loop by editing **`.github/autoloop/program.md`** — a template file installed alongside this workflow. This file defines three things:
125
+
Each program file in `.github/autoloop/programs/` defines three things:
85
126
86
127
1.**Goal**: What the agent is trying to optimize (natural language description)
87
128
2.**Target**: Which files the agent is allowed to modify
88
129
3.**Evaluation**: How to measure whether a change is an improvement
89
130
131
+
The **program name** is the filename without the `.md` extension (e.g., `training.md` → program name is `training`).
132
+
90
133
### Setup Guard
91
134
92
-
**The workflow will not run until the user has edited the template.**The installed template contains a sentinel line:
135
+
A template program file is installed at `.github/autoloop/programs/example.md`. **Programs will not run until the user has edited them.**Each template contains a sentinel line:
93
136
94
137
```
95
138
<!-- AUTOLOOP:UNCONFIGURED -->
96
139
```
97
140
98
-
At the start of every run, check for this sentinel. If it is present:
141
+
At the start of every run, check each program file for this sentinel. For any program where it is present:
99
142
100
-
1.**Do not run any iterations.**
101
-
2.Create a single GitHub issue (if one doesn't already exist) titled `[Autoloop] Action required: configure your program.md` with:
102
-
- A clear explanation that the workflow is installed but paused until`program.md` is configured.
103
-
- A direct link to the file: `${{ github.server_url }}/${{ github.repository }}/edit/${{ github.ref_name }}/.github/autoloop/program.md`
143
+
1.**Skip that program — do not run any iterations for it.**
144
+
2.If no setup issue exists for that program, create one titled `[Autoloop: {program-name}] Action required: configure your program` with:
145
+
- A clear explanation that this program is installed but paused until configured.
146
+
- A direct link to the file: `${{ github.server_url }}/${{ github.repository }}/edit/${{ github.ref_name }}/.github/autoloop/programs/{program-name}.md`
104
147
- A brief guide: "Open the file, replace the placeholder sections with your project's goal, target files, and evaluation command, then remove the `<!-- AUTOLOOP:UNCONFIGURED -->` line."
105
148
- Two or three example programs for inspiration (ML training, test coverage, build performance).
106
-
3. Exit.
107
149
108
-
If the sentinel is absent, proceed with the iteration loop.
150
+
If **all** programs are unconfigured, exit after creating the setup issues. Otherwise, proceed with the configured programs.
109
151
110
-
### Reading the Program
152
+
### Reading Programs
111
153
112
154
At the start of every run:
113
155
114
-
1. Read `.github/autoloop/program.md` (or `program.md` in the repo root as a fallback).
115
-
2. Check for the `<!-- AUTOLOOP:UNCONFIGURED -->` sentinel — if present, run the **Setup Guard** flow above.
116
-
3. Parse the three sections: Goal, Target, Evaluation.
117
-
4. Validate that all three sections have non-placeholder content. If any section still contains `TODO` or `REPLACE` markers, treat it as unconfigured — create/update the setup issue and exit.
118
-
5. Read the current state of all target files.
119
-
6. Read repo memory for the current best metric value and iteration history.
156
+
1. List all `.md` files in `.github/autoloop/programs/`.
157
+
2. If the directory is empty or doesn't exist, also check for a single `.github/autoloop/program.md` or `program.md` in the repo root as a fallback (for single-program setups).
158
+
3. For each program file:
159
+
a. Check for the `<!-- AUTOLOOP:UNCONFIGURED -->` sentinel — if present, run the **Setup Guard** for that program and skip it.
160
+
b. Parse the three sections: Goal, Target, Evaluation.
161
+
c. Validate that all three sections have non-placeholder content. If any section still contains `TODO` or `REPLACE` markers, treat it as unconfigured — create/update the setup issue for that program and skip it.
162
+
d. Read the current state of all target files.
163
+
e. Read repo memory for that program's metric history (keyed by program name).
120
164
121
165
## Iteration Loop
122
166
123
-
Each run executes **one iteration** of the optimization loop:
167
+
Each run executes **one iteration per configured program**. For each program:
124
168
125
169
### Step 1: Read State
126
170
127
-
1. Read `program.md` to understand the goal, targets, and evaluation method.
128
-
2. Read repo memory to get:
171
+
1. Read the program file to understand the goal, targets, and evaluation method.
172
+
2. Read repo memory (keyed by program name) to get:
129
173
-`best_metric`: The current best metric value (null if first run).
130
174
-`iteration_count`: How many iterations have been completed.
131
175
-`history`: Summary of recent iterations (last 20).
@@ -145,7 +189,7 @@ Each run executes **one iteration** of the optimization loop:
145
189
146
190
### Step 3: Implement
147
191
148
-
1. Create a fresh branch: `autoloop/iteration-<N>-<short-desc>` from the default branch.
192
+
1. Create a fresh branch: `autoloop/{program-name}/iteration-<N>-<short-desc>` from the default branch.
149
193
2. Make the proposed changes to the target files only.
150
194
3.**Respect the program constraints**: do not modify files outside the target list.
151
195
@@ -160,7 +204,7 @@ Each run executes **one iteration** of the optimization loop:
160
204
**If the metric improved** (or this is the first run establishing a baseline):
161
205
1. Record the new `best_metric` in repo memory.
162
206
2. Create a draft PR with:
163
-
- Title: `[Autoloop] Iteration <N>: <short description of change>`
207
+
- Title: `[Autoloop: {program-name}] Iteration <N>: <short description of change>`
164
208
- Body includes: what was changed, why, the old metric, the new metric, and the improvement delta.
165
209
- AI disclosure: `🤖 *This change was proposed and validated by Autoloop.*`
166
210
3. Add an entry to the experiment log issue.
@@ -180,7 +224,7 @@ Each run executes **one iteration** of the optimization loop:
180
224
181
225
## Experiment Log Issue
182
226
183
-
Maintain a single open issue titled `[Autoloop] Experiment Log {YYYY}-{MM}` as a rolling record of all iterations.
227
+
Maintain a single open issue **per program**titled `[Autoloop: {program-name}] Experiment Log {YYYY}-{MM}` as a rolling record of that program's iterations.
184
228
185
229
### Issue Body Format
186
230
@@ -219,10 +263,11 @@ Maintain a single open issue titled `[Autoloop] Experiment Log {YYYY}-{MM}` as a
219
263
220
264
## Memory Schema
221
265
222
-
Store the following in repo memory:
266
+
Store state in repo memory**keyed by program name**. Each program gets its own memory namespace (e.g., `autoloop/training`, `autoloop/coverage`):
0 commit comments