Add a /loop recurring prompt command to the Codex TUI
Open 💬 14 comments Opened Mar 24, 2026 by cruzlauroiii
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
Summary
Add a /loop <interval Xm> <message> slash command that queues a user message on a repeating minute-based interval.
Examples:
/loop 3m continue/loop 5m summarize progress
Expected behavior
- Parse strict minute syntax only:
/loop <Xm> <message>. - Queue the message every
Xminutes. - If a turn is already running, queue the next loop message instead of interrupting the active turn.
- Re-running
/loopshould replace the previous schedule. - If a loop-triggered turn determines the work is already fully complete, the loop should remove itself and drop future queued loop messages.
Scope
The behavior should be implemented consistently in both codex-rs/tui and codex-rs/tui_app_server.
Implementation status
A working implementation is available here:
- Fork PR: https://github.com/cruzlauroiii/codex-fork/pull/1
- Compare URL: https://github.com/openai/codex/compare/main...cruzlauroiii:cruzlauroiii/loop-command-auto-cancel?expand=1
Validated locally with:
cargo check -p codex-tui -p codex-tui-app-server
Related issues / duplicates
- #14110
- #8317
14 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Implementation is ready on my fork, but GitHub is denying
CreatePullRequestfor this account when targetingopenai/codex.Prepared branch:
cruzlauroiii/codex-forkcruzlauroiii/loop-command-auto-cancel8b8793ef9f156fb138fedcc13a688c5c1e729f3aCompare URL:
https://github.com/openai/codex/compare/main...cruzlauroiii:cruzlauroiii/loop-command-auto-cancel?expand=1
Validation completed locally:
cargo check -p codex-tui -p codex-tui-app-serverThis implements:
/loop <interval Xm> <message>in both TUI frontendsI could not open an upstream PR from this account due to GitHub permission restrictions, but the implementation is now available as a fork PR here:
cruzlauroiii/loop-command-auto-cancel8b8793ef9f156fb138fedcc13a688c5c1e729f3aThe fork PR body links back to this issue for context.
this would be amazing. Claude code having such a feature is currently the only reason for me keeping my claude subscription without fully switching to codex. My use case is monitoring and automatically recovering long running workflows like ML training runs.
Highly wanted, please!
we need the /loop feature same as claude code.
Please add this feature. This is the only feature for which I am still in claude code.
Please add this feature so I can switch from Claude Code to Codex.
We need this feature.
+1
I need the
/loop 10m repeated taskcommand tooThese three (#15679, #14110, #8317) are really one feature at three altitudes: a
prompt loop in the TUI, a persistent cross-turn orchestrator, and a scheduler
CLI. They'll fight each other unless they sit on a single primitive. The design
pattern that held up in my implementation:
One primitive: a named, persisted, per-thread recurring job. Named (not a
single global schedule) is what makes "re-running replaces it" well-defined and
lets several watchers coexist. Persist it in a small store keyed by thread so it
survives a restart — that one choice covers #8317's persistence requirement and
#14110's "alive between turns" at the same time.
A few decisions that mattered more than expected:
review mode / a side conversation) marks the job pending and retries at the
next safe point — skip-if-busy, no backlog. That single rule is most of
#15679's "queue vs. interrupt" question.
progress/blocked/done). In background/owner mode adonetick lets the job wind itself down;in the main-turn path the runtime instead instructs the model to call the
manage tool to remove it. The same terminal-state machinery is the natural
place for a max-runs guardrail (I don't have a run counter yet).
possible anti-runaway guard.
tick to a background owner that reports status without consuming the main
turn — that second mode is what #14110 is actually after. A lightweight
status-only tick (no LLM call: it just updates state and reschedules) covers
heartbeat / "still watching" checks.
can set up its own follow-up check and later stop it. That's what makes
"supervise a long-running job, wind it down when done" work end to end.
Scope-wise it lands where #15679 already points: the TUI, a small state/storage
layer, and the tool surface — not the TUI alone. What I run is a slash command
plus a dynamic tool rather than a separate scheduler CLI, but the underlying job
model is the same one #8317 would need. Happy to go deeper on any of these
tradeoffs.
+1
A concrete VS Code Remote / CLI use case for this feature:
I was running three local 4-hour network probe variants and asked Codex to check their progress every 30 minutes, diagnose failures, make narrowly scoped test-harness fixes, rerun targeted validation, and stop the loop after all probes completed.
The current workarounds do not preserve the workflow:
A command such as:
would fit well if it:
This is not only a reminder use case: preserving thread context is what allows the scheduled check to safely distinguish product code from test-only code and continue a constrained debugging workflow.