let commit_hash = AWAIT FORK implement-experiment experiment_name fail_path?.
let setup_ok = AWAIT FORK setup-experiment commit_hash.
IF not setup_ok?
GOTO
implement, and pass setup_ok.fail_path to the sub-agent.
AWAIT FORK run-experiment.
AWAIT FORK eval-experiment.
Write the experiment code. IF fail_path is set, read that folder to understand what went wrong with the previous implementation.
Have Codex CLI review code, using gpt-5.4 on xhigh reasoning, in a fresh session.
IF codex did not find medium- or higher-priority issues,
RETURN git commit hash.
Fix all issues that Codex flagged.
Git commit and push.
GOTO review.
Load code at commit_hash onto experiment machine(s).
Run the experiment's smoke test.
IF the smoke test passed,
RETURN ok.
let fail_path = AWAIT FORK "write_failure_folder"
Write a folder that captures as much information as possible about what went wrong. Use a filepath that is unique and searchable later, i.e. it includes
experiment_name,git_repo, machine id(s), and datetime.RETURN filepath of the folder you just wrote.
IF it failed due to a code issue rather than just a machine configuration problem,
RETURN failed, with fail_path.
Try to fix the machine configuration.
IF you were able to fix the machine configuration,
GOTO
pre_flight_checks.
TODO