Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
434 changes: 71 additions & 363 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ User-facing docs are plain markdown in `docs/` (see `docs/README.md` for the ind

## Architecture Notes

- Entry points: bare `autohelix` (`cli._entry`, only when stdin and stdout are TTYs, `cli._interactive`; else the help and "Run `autohelix` in a terminal to start." on stderr, exit 2) shows the project (`cli.entry_project`: `runs.find_project`'s folder when it has runs, else the nearest folder up from here with a config, else the git top level; outside a checkout it says so, `_git_problem`, and offers nothing, exit 1): a header (`run_table.entry_header`, drawn before the runs are read), the runs table (`run_table.entry_lines`, `table_lines`, one line per run), one suggested command per run (`run_table.suggestion`), the archived count and the `--help` footer, then one question: with one agent CLI found (`_found_agents`), `cli.entry_question` ("Start Claude Code with AutoHelix?", Enter/q, `menu.confirm`); with several, a menu of them (`cli.ENTRY_TITLE`, `menu.choose`); both drop keys typed before them; q or Esc raises `menu.Quit`, exit 0; Ctrl-C exits 130. It execs one agent session (`_agent_argv`, Claude Code/Codex/OpenCode, never `mock`) with the bundled skill and `cli.first_prompt` (`autohelix/README.md`, the coordinator's notes, when present; runs, configs, the pick, AutoHelix's CLI, Python and docs: `cli.docs_dir`, the package's `autohelix/docs` that pyproject force-includes from docs/, else the checkout's). There is no setup command. `autohelix run [NAME]` finds the config (`config.find_config`: an experiment folder's `autohelix/NAME/config.yaml`, `config.experiment_config`; without NAME the only one, several are named; `config.project_configs`; a folder without `config.yaml`, a dot-folder or a `.yaml` file directly in `autohelix/` isn't a config), creates `.autohelix/` on first use and starts the harness loop.
- Entry points: bare `autohelix` (`cli._entry`, only when stdin and stdout are TTYs, `cli._interactive`; else the help and "Run `autohelix` in a terminal to start." on stderr, exit 2) shows the project (`cli.entry_project`: `runs.find_project`'s folder when it has runs, else the nearest folder up from here with a config, else the git top level; outside a checkout it says so, `_git_problem`, and offers nothing, exit 1): a header (`run_table.entry_header`, drawn before the runs are read), the runs table (`run_table.entry_lines`, `table_lines`, one line per run), one suggested command per run (`run_table.suggestion`), the archived count and the `--help` footer, then one question: with one agent CLI found (`_found_agents`), `cli.entry_question` ("Start Claude Code with AutoHelix?", Enter/q, `menu.confirm`); with several, a menu of them (`cli.ENTRY_TITLE`, `menu.choose`); both drop keys typed before them; q or Esc raises `menu.Quit`, exit 0; Ctrl-C exits 130. It execs one agent session (`_agent_argv`, Claude Code/Codex/OpenCode, never `mock`) with the bundled skill and `cli.first_prompt` (`autohelix/README.md`, the coordinator's notes, when present; runs, configs, the pick, AutoHelix's CLI and docs: `cli.docs_dir`, the package's `autohelix/docs` that pyproject force-includes from docs/, else the checkout's). There is no setup command. `autohelix run [NAME]` finds the config (`config.find_config`: an experiment folder's `autohelix/NAME/config.yaml`, `config.experiment_config`; without NAME the only one, several are named; `config.project_configs`; a folder without `config.yaml`, a dot-folder or a `.yaml` file directly in `autohelix/` isn't a config), creates `.autohelix/` on first use and starts the harness loop.
- Iteration isolation: `iteration.py` runs every phase in its own fresh `workspace.Copy` (agent, checks, each review, stop; baseline and report too): a private folder holding one tree, with its own `.git` borrowing the user's objects via alternates. The harness reads copies only from outside through `Repo` and a harness index kept in a private per-process folder; it never runs git inside a copy after a call used it. The agent copy is frozen to a tree T (pinned at `refs/autohelix-tmp/<id>`); checks run on a fresh copy of T with HEAD at A and T's files verified after every command (checks, stop and report copies are `watched`: fingerprinted for `Copy.changed()`; agent and judge copies aren't); accept commits exactly T on A (`commit-tree`, no hooks), CAS-updates `refs/autohelix/<id>`, and records history in a deferred-SIGINT section. A no-op is accepted without a commit. A rejected attempt's T (also after a failed or timed-out agent call) is kept as `refs/autohelix-rejected/<id>/<n>` (`keep_rejected`; removed by `delete`), and the next agent copy gets the latest rejection's `base..T` (`workspace.diff_args`, independent of the user's git config) as `rejected.patch` (over 2 MiB: none, the prompt's `rejected_diff` names the `git diff`). An attempt whose T equals its base keeps no ref. Run segments land separately on the target branch.
- Evaluation (`harness._evaluate`; user docs in `docs/config.md`): gate commands in list order (first failure rejects; `ask:` entries render to `autohelix ask [flags] -- Q`), then `observe:` entries top to bottom (`review:` entries render to `autohelix review [flags] -- P`); after each entry, the metric gates on its metrics, compared with the last accepted commit-creating record (`checks.metric_reference`). A failed observe entry is recorded and contributes no metrics; a missing gated metric fails. The baseline runs everything and rejects nothing; a missing command metric is a setup error, and so is a gate that can't work (`Harness._unworkable_gate`: a command gate exiting 126/127 unless its first word is a path the agent may write and git doesn't ignore, `_agent_may_write`; an `ask:` gate exiting 2), naming the gate and its last stderr line. Metrics come only from `##autohelix[name=value]` lines on stdout, by name (`checks.parse_structured_metrics`). Unknown top-level keys and old config keys are errors (`config.RENAMED_TOP_LEVEL_KEYS`, `agents.RENAMED_AGENT_KEYS`, `agents.RENAMED_CLIS`, `config.RENAMED_ENTRY_AGENT_KEYS`); agent values are type-checked (`agents.agent_string`, `agents.cli_value`); `agent:` is `cli` (claude-code, codex, opencode; hidden `mock`, whose test knobs are `agent.mock:`), `model`, `effort` (both passed through), `timeout`, `extra_args`, `auto_memory`; a `prompt_template:` is a config error (`prompt_template.template_problem`) when it doesn't parse, names a variable not in `VARIABLES` or the old `.autohelix/` copy paths (`uses_old_layout`), or fails to render against `SAMPLE_RECORDS` after each of their iterations (`_sample_variables`, a temporary folder; docs/phases.md's prompt is rendered from the same sample); one that fails to render in a run still raises naming it. `run --check` is `Harness(check_only=True)`: every refusal before the first write, then `run`'s start notices (`Harness._check_notices`: `runs.new_run_notices` and, landing automatically, `_uncommitted_config` over the files `snapshot_files` would store), then nothing; its OK line names the command with `--import`/`--group`/`--land`. A damaged history line raises `runs.damaged_history` (run, line, what works) from `History.load` and `repair_history` alike (which skip blank lines); readers across runs (`_resumable`, `new_run_notices`) take it as no baseline (`has_baseline(paths, damaged=False)`). Preflight (`checks.preflight_check`, before the baseline; at a later segment's start only its agent part, `checks.agent_issues`) finds every agent the config runs (`Config.agent_commands`: the main agent, each `ask:`/`review:` judge, resolved like `judge.judge_config`) with `agents.command_path` (`$AUTOHELIX_CLAUDE_CODE_CMD` / `_CODEX_CMD` / `_OPENCODE_CMD`, else `claude`/`codex`/`opencode` on PATH; never the config), the backends' own resolver, and warns about a gate/observe/stop command naming an `autohelix/` path that exists in the working tree but not in HEAD (`checks.uncommitted_command_paths`, textual, `./autohelix/` too, so a run ref `autohelix/<id>` stays quiet; `ask:`/`review:` entries skipped: a judge reads `experiment/`; advice `$AUTOHELIX_EXPERIMENT/...`, `$AUTOHELIX_EXPERIMENT` for the folder itself); bare `autohelix` starts `agents.executable`. A set `AUTOHELIX_CLAUDE_CMD` is a `ConfigError` from the one check in `agents.executable` (`variable_problem`'s message), wherever an executable is resolved: a backend resolves its own when created (`create_agent`; so `Harness.__init__`, the report, a judge call), preflight, the entry screen; each command reports it as a config error (`cli._start`, `report`, `ask`/`review` exit 2, the entry screen's warning). `ask`/`review` take `--cli`/`--model`/`--effort` (`cli._judge_options`; `--agent`/`--command` are hidden errors).
- Copy location: copies live outside the project, at `<base>/<dirname>-<hash8>/<run-id>/iter-N-<role>`, where base is `$AUTOHELIX_COPIES_ROOT` or `${XDG_CACHE_HOME:-~/.cache}/autohelix/copies` (`runs.copies_base()`). `runs.claim_copies()` fixes the folder for a process under the run lock (created on first use by `ensure_copies`: private 0700, owned, no symlinks below the base; a shared base must be sticky), base recorded in `runs/<id>/.internal/copies` for observers (`RunPaths.copies`), `GIT_CEILING_DIRECTORIES` set there. Segment end, standalone report and delete remove it; the project's folder stays with a `project.json` record (path, host) so `runs.sweep_copies()`, at the start of every `run`/`resume`, can remove leftovers of killed processes (runs whose lock is free) and other projects' folders whose checkout is gone (same host, over a day old). The root `conftest.py` points the base at a temporary folder for every test, examples included.
Expand Down
Loading
Loading