Open Codex. Start working. Let it pick up after cooldown.
Continuation Layer wraps the official Codex terminal. When an active turn fails at a usage limit, it keeps the session alive, waits for reset, and starts a continuation turn in the same conversation. Leave your terminal open; no need to return just to type “continue.”
v0.3.1: Native quota recovery is fixed and has been observed across a real service reset, with automatic continuation and task completion. See release notes and validation.
You need Linux, Bash, Node.js 20+, flock, and an installed, signed-in Codex CLI with --remote unix://… support. The live integration was checked with Codex CLI 0.154.0.
git clone https://github.com/Hsi431/continuation-layer.git
cd continuation-layer
npm install
node bin/continuity.mjs install-shell
source ~/.bashrcThen open your project and use Codex as usual:
cd /path/to/your/project
codexThe installer adds a reversible function to ~/.bashrc and backs up the original file as ~/.bashrc.before-continuity. Keep this checkout in place: the function points to it. Your original Codex executable and configuration stay in use.
No project initialization, .agent folder, task ID, or overnight mode is needed.
# Start a conversation
codex
# Use Codex's automatic approval reviewer
codex --approve-for-me
# Return to your last conversation with automatic approval review
codex resume --last --approve-for-me
# Choose an exact conversation
codex resume <thread-id>Automatic approval review belongs to Codex and can still require your input. Continuation Layer preserves your model, working directory, sandbox, and approval settings; it does not approve operations for you.
To skip shell installation, run the launcher from this checkout:
node bin/continuity.mjs codexIf continuity is already on your PATH, continuity codex does the same thing. continuity shell is an alias.
Working → usage limit → wait for reset → continue in the same conversation
The supervisor reads structured failure events and account limit data from the official Codex app-server. It uses the service's reset time when available and bounded, estimated retry delays otherwise.
After waiting, it rechecks the limit and verifies that the original conversation is idle before submitting a continuation instruction. That instruction asks Codex to inspect completed work and continue the task you already authorized. Another usage-limit failure returns to waiting, up to 12 automatic continuation attempts.
Your input or cancellation takes precedence over pending recovery. Successful turns, unrelated errors, and account spending blocks do not trigger automatic continuation. Requests for approval or clarification still need to be resolved under your Codex settings.
Keep the computer awake and the terminal open. Closing Codex ends supervision. Sleep pauses execution; after waking, the supervisor rechecks time and conversation state. This is a foreground supervisor, with no automatic restart after shutdown.
From the checkout, in another terminal:
node bin/continuity.mjs sessionsThe output includes each invocation's thread ID, recovery attempts, deadline, and process liveness. Supported terminals also show recovery status in their title.
State lives under ~/.local/state/continuation-layer/everyday/, or the corresponding $XDG_STATE_HOME directory. It contains no prompt or tool transcript. Per-thread locks prevent two supervisors from automatically recovering the same conversation at once. State left by an exited process is diagnostic only; it is never replayed automatically.
- Supervision starts with interactive Codex launched through the installed function or launcher. Already-running sessions cannot be adopted.
- Non-interactive commands such as
codex exec, login, and help pass through to the original executable. - Explicit
--remoteconnections also pass through and are not supervised locally. - The daily integration uses the official TUI and app-server through a private Unix socket. It does not detect cooldown by scraping terminal text.
From the checkout:
node bin/continuity.mjs uninstall-shell
unset -f codexThis removes the managed Bash function. The original Codex executable remains available.
npm test
npm run check
npm run format:check
npm run pack:checkThe native quota regression uses a local HTTP provider and the installed Codex app-server, without paid model requests:
node tests/live-native-quota.mjsThe provider returns an actual HTTP 429. Native Codex enters systemError; the production bridge waits and automatically completes a second turn in the same thread. Only the waiting clock is accelerated; error notifications and thread status are unchanged. This verifies the native failure path, not a naturally elapsed service quota reset.
After updating the checkout, reopen existing supervised Codex sessions once to load the fix. New invocations use it automatically; keep the terminal and supervisor running during cooldown.
The separate TUI integration test uses your Codex login and makes real model requests. Run it against an already trusted scratch directory outside Git, with no .agent directory:
CONTINUITY_LIVE_CWD=/path/to/trusted/scratch node tests/live-everyday.mjsIt injects a quota failure at the test protocol boundary, then requires a real continuation turn to write a proof file and finish. Because the injected failure leaves native thread status idle, it does not cover the native quota systemError regression above.
- Interactive architecture
- Manual smoke checks
- Legacy project workflows:
.agenthandoffs,watch, and manual task commands remain available separately. The old terminal-text wrapper is available ascontinuity legacy-shell.
Licensed under Apache 2.0. An independent project; not affiliated with OpenAI.
