This repository is a custom Codex fork focused on one enhancement:
- after a turn completes, run an intelligent next-step decision;
- if the result is safely continuable, inject the next turn automatically;
- extend execution from single-turn completion to a longer closed loop.
- Added
notify_next_turnhook directive parsing and next-turn queueing in core. - Added per-session sidecar startup via
notify_next_turn_service. - Added in-session warning visibility for decision reasoning in TUI/CLI.
- Added local scripts:
scripts/autonext_hook.pyscripts/autonext_service.py
- Added optional local turn logging (
out.1) controlled by env switch, off by default.
- Codex finishes one turn.
notify_next_turnhook is triggered.- Hook sends payload to local sidecar decision service.
- Sidecar calls configured model/provider and returns JSON decision.
- If
need_next_turn=true, Codex injects a new user turn in the same session.
cd codex-rs
cargo build -p codex-cli --release
./target/release/codexSet in ~/.codex/config.toml:
notify_next_turn = ["python3", "/ABSOLUTE/PATH/TO/codex/scripts/autonext_hook.py"]
notify_next_turn_service = ["python3", "/ABSOLUTE/PATH/TO/codex/scripts/autonext_service.py"]out.1 writing is disabled by default.
Enable it only when needed:
export next_turn_local_log=1
# or
export NEXT_TURN_LOCAL_LOG=1Optional output filename/path:
export AUTO_NEXT_OUTPUT_FILE=out.1When local logging is enabled, hook writes:
- last assistant output
- decision trace line (
[auto-next] ...)
By default, decision service reads the same provider/model settings from your Codex config and auth.
You can still override provider/model by env vars (see docs/auto_next_turn.md).
docs/auto_next_turn.mddocs/install.mddocs/contributing.md
This repository is licensed under the Apache-2.0 License.