AutoHelix
CLAUDE.md22 starsChanged 4 months agoApache-2.0View on GitHub
AutoHelix is an agent-powered iterative optimization tool. It runs AI agents in a loop — each iteration is isolated in a git worktree, validated, and only merged when it passes. See README.md for user-facing docs. For setting up training/eval (ML benchmark) cells, see docs/ml-experiments.md. Activate the virtual environment before running any commands: If the venv doesn't exist yet: - src/autohelix/harness.py - main iteration loop (start here) - src/autohelix/cli.py - CLI commands (init, run, clear, watch, report) - src/autohelix/config.py - configuration…
- Deletes or force-pushes
- Installs packages
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- workflow-optimizationSkill
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
If the venv doesn't exist yet:
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AutoHelix Development
AutoHelix is an agent-powered iterative optimization tool. It runs AI agents in a loop — each iteration is isolated in a git worktree, validated, and only merged when it passes. See README.md for user-facing docs. For setting up training/eval (ML benchmark) cells, see docs/ml-experiments.md.
Setup
Activate the virtual environment before running any commands:
source .venv/bin/activateIf the venv doesn't exist yet:
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"Project Layout
src/autohelix/harness.py- main iteration loop (start here)src/autohelix/cli.py- CLI commands (init, run, clear, watch, report)src/autohelix/config.py- configuration dataclasses and parsingsrc/autohelix/agents/- agent backends (claudecode, codex, opencode, mock)src/autohelix/sandbox.py- git worktree management and scope enforcementsrc/autohelix/checks.py- constraint and metric executionsrc/autohelix/history.py- iteration history (JSONL)src/autohelix/display.py- live Rich displaysrc/autohelix/prompt_template.py- agent prompt renderingtests/- test suite (pytest)examples/- example projects (sorting, ml-recipe, writing, task-queue, research, workflow-optimization, algotune, posttrain, kernelbench, nested-autohelix)scripts/run_dev_test.sh- quick real-agent test against a bundled example (supports--parallel N)docs/- user-facing documentation (plain markdown)
CLI Commands
autohelix init # Initialize project (creates .autohelix/ and config template)
autohelix run # Start or resume optimization loop
autohelix parallel # Run multiple workers in parallel on the same goal
autohelix clear # Archive state, start fresh
autohelix watch # Live-tail agent output (second terminal)
autohelix hint # Send a hint to the running agent (picked up next iteration)
autohelix report # Agent-written analysis of the runTesting
pytest # run all fast tests
pytest -m slow # run slow tests (requires real agent)
bash scripts/run_dev_test.sh # manual test with real agent (sorting, 1 iteration)
bash scripts/run_dev_test.sh sorting --parallel 2 # exercise `autohelix parallel` with identical workersDocs
User-facing docs are plain markdown in docs/ (see docs/README.md for the index).
Examples Warning
Do not commit optimized example code. Examples should always contain the slow baseline version so users can see the optimization potential. If you run an example and it gets optimized, do NOT commit those changes to the main repo.
Architecture Notes
- Entry points:
autohelix initscaffolds.autohelix/and writes a config template.autohelix runloads config and starts the harness loop. - Iteration isolation: each iteration runs in a git worktree. On acceptance, the worktree branch is merged into main. On rejection, it's discarded.
- Scope enforcement:
revert_out_of_scope()in sandbox.py reverts agent changes outsidescope.editablebefore constraints run. - Notes persist across rejections:
save_notes()copies from worktree to main.autohelix/notes/in afinallyblock.notes/is the sole agent-owned region and the only thing that round-trips;prepare_worktree()seeds worktrees withnotes/plus read-only reference (observations, hints, latest review asreview.md). - Config mismatch: if you switch configs,
runprompts to archive old state automatically. - Parallel runs:
autohelix parallel(seesrc/autohelix/parallel/) runs multiple workers on the same goal, each in its own branch namespace; workers share notes via.autohelix/peer_notes/. - Time limits:
agent.timeout_secondsis a hard kill timeout (no warning to the agent — can cut it off mid-step).budget.iteration_time(claude only) is a strict improvement overtimeout_seconds: it enforces the same hard deadline (min(timeout_seconds, iteration_time)) but also installs Claude Code hooks (PostToolUse/UserPromptSubmit) that inject remaining time into the agent's context via$AUTOHELIX_TIME_LEFT_SCRIPT(which points to<project>/.autohelix/runtime/bin/time_left.sh, copied fromsrc/autohelix/bin/at run start), so the agent can wrap up and write notes before being killed.budget.timecaps total run wall-clock, checked before each iteration starts (doesn't interrupt one in progress). Seeharness.py:_install_time_left().
Gotchas
- Editable install: the package is installed with
pip install -e ., so edits undersrc/autohelix/are live immediately — no reinstall needed. Only re-runpip install -e .ifpyproject.tomldependencies or console-script entry points change. - Agent edits the main repo instead of the worktree: iterations run in a git worktree, but if an editable install (
.pth) or a hardcoded absolute path resolves imports/writes back to the main repo, the iteration is rejected with "Main repo has uncommitted changes." Keep per-iteration writable paths inside the worktree, and put long-lived outputs (models, large artifacts) at a fixed absolute path outside the repo entirely. - Resetting a run is not just
autohelix clear:clearonly archives.autohelix/run state — it does NOT touch code or external outputs. A full reset =clear+git reset --hard <initial-commit>(roll back the agent's per-iteration commits) + delete any outputs written outside the repo (e.g. model checkpoints). Then the tree must be committed-clean orrunrefuses to start. See "Resetting a run" in README.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

