autonomous-loop is ralph loop but improved and ported to Codex. stop the early outs, force Codex to work until it's actually done and passes quality gates.
- Install the package:
python3 -m pip install .- Bootstrap this machine once:
autonomous-loop bootstrap- Install repo-local support files into a target repo:
autonomous-loop install-repo --repo /path/to/repo- Verify the result:
autonomous-loop doctor --cwd /path/to/repo- Open Codex in that repo and say:
Use /autonomous-loop for this task.
If Codex was already running when you bootstrapped the machine, restart it once so it picks up the new global hooks and skill.
autonomous-loop now has two setup layers:
- Machine bootstrap:
autonomous-loop bootstrap - Repo install:
autonomous-loop install-repo --repo /path/to/repo
bootstrap writes the machine-level assets under your Codex home:
$CODEX_HOME/hooks.json$CODEX_HOME/skills/autonomous-loop/SKILL.md$CODEX_HOME/autoloop/machine.json
install-repo writes the repo-local assets:
.codex/autoloop.project.json.codex/hooks.json.agents/skills/autonomous-loop/SKILL.md
Pass --force to bootstrap to overwrite existing global hooks and skill files.
install-repo fails closed until machine bootstrap is complete. The repo-local hooks it generates are derived from the verified command path saved during bootstrap.
When you enable the loop, the runtime freezes a contract for the current task. That contract records:
- the objective
- the required tasks
- the evidence each task needs
- the gate profile that decides whether the run can release
Mutable runtime state lives under $CODEX_HOME/autoloop, not inside the target repo. The repo only carries its local policy in .codex/autoloop.project.json plus the repo-local support files installed by install-repo.
At each real Stop hook, the runtime:
- resolves the active repo and session
- validates the saved contract and verification bundle
- re-evaluates deterministic task evidence from the filesystem
- runs the trusted commands referenced by the configured gate profile
- blocks, releases, or hard-stops based on those results
If the contract hash changes unexpectedly, required runtime files are unreadable, or the same blocker repeats too many times, the runtime fails closed.
autonomous-loop request enable --cwd <path> --objective <text> \
[--task-json '<json>'] ... \
[--gate-profile <name>] \
[--max-stop-iterations <n>]
--cwd(required) — repo working directory--objective(required) — task objective--task-json(repeatable, optional) — JSON task definition; may be repeated for multiple tasks--gate-profile(optional) — gate profile name--max-stop-iterations(optional) — maximum stop-hook iterations before hard-stop
autonomous-loop request pause --cwd <path> [--reason <text>]
autonomous-loop request resume --cwd <path> [--reason <text>]
autonomous-loop request disable --cwd <path> [--reason <text>]
autonomous-loop request release --cwd <path> [--reason <text>]
--cwd(required) — repo working directory--reason(optional) — human-readable reason logged with the action
autonomous-loop status --cwd <path> [--session-id <id>]
--cwd(required) — repo working directory--session-id(optional) — inspect a specific session instead of the active one
There are two request paths.
If the Codex environment exposes CODEX_SESSION_ID or CODEX_THREAD_ID, autonomous-loop request enable binds immediately to that live session. The CLI response includes:
activation_mode: "direct-env"session_idsession_id_source
For follow-up actions, request pause, request resume, request disable, and request release use the same immediate path only when that session already has loop state.
If no live session identifier is available, the CLI stores a pending request and returns JSON with a claim_token field whose value looks like:
AUTOLOOP_CLAIM:<nonce>
In that path:
- include the exact token in the next assistant message
- let that turn end normally
- the next real
Stophook claims the request for the live session
Until that stop event happens, autonomous-loop status --cwd "$PWD" can still show the request as pending.
For Node-style repos, install-repo currently:
- requires
package.json - detects the package manager with this precedence:
--package-managerpackage.json.packageManager- lockfiles
- trusts only these script names:
typecheck,lint,test - preserves existing repo-local files unless you pass
--force
Example overrides:
autonomous-loop install-repo --repo /path/to/repo --package-manager npm
autonomous-loop install-repo --repo /path/to/repo --prefer-scripts lint,test--prefer-scripts is a single comma-separated argument.
Current install-repo autodetect scope is Node-style repos with package.json. For non-Node repos, install the repo-local support files you need and write .codex/autoloop.project.json manually.
docs/install.mddocs/examples.mdTROUBLESHOOTING.mddocs/security.mddocs/agent-implementation-brief.md
This project is built around the verified Codex CLI 0.114.0 hook model:
SessionStartandStophooks exist- hooks are discovered from
hooks.json Stopgroups are discovered without a matcher- this controller currently relies on command hooks
The main upstream quirk is that live hook registration belongs in hooks.json, not config.toml.