Skip to content

Add Autoloop: iterative optimization workflow#257

Open
mrjf wants to merge 7 commits intomainfrom
autoloop-workflow
Open

Add Autoloop: iterative optimization workflow#257
mrjf wants to merge 7 commits intomainfrom
autoloop-workflow

Conversation

@mrjf
Copy link
Contributor

@mrjf mrjf commented Mar 12, 2026

Summary

  • Adds Autoloop, a new agentic workflow inspired by Karpathy's Autoresearch and Claude Code's /loop
  • Runs on a configurable schedule (default: every 6h) to iteratively optimize a target artifact toward a measurable goal
  • Each iteration: proposes a change → evaluates against a metric → accepts (draft PR) or rejects (logs attempt) — a ratchet that only moves forward
  • Ships with a template program.md that users must configure before the loop activates (setup guard via <!-- AUTOLOOP:UNCONFIGURED --> sentinel)
  • Template includes three complete examples (ML training, test coverage, build performance) so users aren't starting from a blank page
  • Tracks all iterations in a monthly experiment log issue with accept/reject status, metrics, and links to PRs/runs

Files added

  • workflows/autoloop.md — workflow definition
  • workflows/autoloop/program.md — installable template for user configuration
  • docs/autoloop.md — documentation
  • README.md — added to Research, Status & Planning section

Test plan

  • Verify gh aw compile succeeds with the new workflow
  • Install in a test repo via gh aw add-wizard and confirm template program.md is copied
  • Run without configuring program.md — should create a setup issue and exit
  • Configure program.md, remove sentinel, run — should execute an iteration
  • Verify experiment log issue is created with correct format

🤖 Generated with Claude Code

mrjf and others added 7 commits March 11, 2026 20:32
Adds an Autoresearch-inspired workflow that 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 (ratchet pattern).

Includes a template program.md with a setup guard sentinel that
prevents the workflow from running until the user configures their
optimization goal, target files, and evaluation command.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 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>
The pre-step runs in Python before the agent starts and checks:
- Which programs are due based on per-program schedule + last_run
- Which are unconfigured (sentinel/placeholders still present)
- Which are paused or plateaued (5+ consecutive rejections)

If no programs are due, the workflow exits with no agent invocation.
This avoids burning agent compute on schedule ticks where nothing
needs to happen.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The gh-aw compiler doesn't allow github.ref_name. Replace with a
generic instruction to use the default branch in the edit URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Since add-wizard only installs the workflow .md file and can't copy
companion files, the pre-step now creates .github/autoloop/programs/
and writes the template example.md on first run if the directory
doesn't exist. Commits and pushes the template so the user can
find and edit it in their repo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
repo-memory is only available inside the agent runtime, not during
the bash pre-step. Split persistence into two layers:

1. .github/autoloop/state.json (committed to repo) — lightweight
   state the pre-step reads: last_run, best_metric, pause flags,
   recent_statuses for plateau detection
2. repo-memory (agent only) — full iteration history, rejected
   approaches, detailed notes

The agent updates and commits state.json at the end of every
iteration so the pre-step can make scheduling decisions cheaply.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The gh-aw compiler treats backticks as reserved characters. Use
chr(96) to construct them at runtime in the Python pre-step so
they don't appear as literals in the workflow source.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant