New: watch your coding agents work, step by step, on a live board. Try the demo, no account

How to queue a prompt in Codex CLI while it's working

By Jake Marsh, who builds Taskhold. Updated 2026-11-19. Facts about other tools checked 2026-11-19. 6 min read.

Short answer: Type your next prompt while Codex is working and press Tab. Codex queues it and sends it on the next turn; slash commands and ! shell commands queue the same way. Press Enter instead to add the instructions to the turn that's running. From another terminal, codex queue --thread <session> --message "..." queues text for an existing session.

Codex is halfway through a task and you already know what it should do next. You can tell it now without interrupting the turn. Codex has two keys for this, and they do different things: Tab saves the message for the next turn, Enter hands it to the turn in progress.

This guide covers both keys, queued slash and shell commands, the codex queue command for scripts and other terminals, and how the same thing works in Claude Code, where the keys are the other way around. The last section covers a queue that outlives the session: tasks Codex takes one by one and reports on a live board.

Tab queues, Enter steers

Tab queues, Enter steers. From the Codex CLI docs' keyboard shortcuts. Ctrl+C or /exit closes the session.
Key while Codex is workingWhat happensUse it for
TabYour prompt, slash command or shell command waits and runs on the next turnThe next thing to do once this turn is finished
EnterYour text goes into the current turn as new instructionsA correction Codex should act on now, such as "skip the migration, the table already exists"
Esc twice, empty composerOpens your previous message to edit and forks the chat from that pointTaking back an instruction you already sent

From the Codex CLI docs' keyboard shortcuts. Ctrl+C or /exit closes the session.

If you're used to chat apps, watch Enter: while Codex works, Enter changes the turn that's running. Use Tab when the message is about later work.

Queue a slash command or a shell command

Tab also queues commands. Type a slash command such as /review or /status while a turn runs and press Tab, and Codex runs it when the turn ends. Slash completion still works before you queue it. Codex parses a queued command only when it runs, so its menu, or an error from a typo, shows up after the current turn finishes, not when you press Tab.

A line that starts with ! runs as a local shell command under the session's approval and sandbox settings. Queue one with Tab the same way, for example !git status to check the tree after Codex's edits land.

Queue from another terminal or a script: codex queue

codex queue sends a text message to an existing session without opening it. It's useful from a second terminal, a script, or a hook on another machine that talks to the same Codex server.

codex queue --thread <SESSION_ID> --message "Run the remaining checks"

# queue it, then resume the session if it isn't loaded
codex queue --thread my-refactor --message "Now update the docs" --resume
--thread takes a session UUID or an exact session name. Use the UUID when two sessions share a name.
  • Queued messages run on the session's own model, and the command takes text only: no images or files.
  • --resume needs a running local daemon, or a server you pick with --remote (add --remote-auth-token-env if that server wants a token).
  • If Codex can't resume the session, it prints a warning and still exits with success. Check for that warning in scripts instead of relying on the exit code.
  • codex resume continues a previous session by ID, or the most recent one, which is also how you find a session to queue to.

The same thing in Claude Code

Claude Code uses Enter for queueing. Type a message and press Enter while Claude works, and Claude Code queues it instead of interrupting. Queued messages show in gray until Claude starts on them.

  • A message queued while Claude runs tool calls reaches Claude as soon as those calls finish, inside the same turn. Anything still queued when the turn ends goes out by itself, in the order you typed it.
  • Queued commands and ! shell commands wait for the turn to end, then run one at a time.
  • Ctrl+Enter (or Ctrl+X Ctrl+S in terminals that don't report extended keys) sends what you queued right away. It needs Claude Code v2.1.275 or later.
  • Esc interrupts the turn without sending your draft, and Claude Code then sends whatever you had queued.

So the habit that queues in Claude Code steers in Codex. If you switch between the two, Tab is the safe key in Codex.

Queue tasks, not only prompts

A queued prompt lives in one session. Close the terminal or hit a usage limit and it's gone, and nobody else can see it. For work that spans sessions, keep the queue outside the agent.

In Taskhold you add tasks from the web app or your phone, and Codex takes them in order: taskhold_next hands it the next todo (highest priority first, then the oldest, by default; Settings > Agents changes the order), and taskhold_begin plans and starts it. Each step shows on the live board, and a question waits there for your reply instead of in the terminal.

When you finish a task, call taskhold_complete with a summary, then
taskhold_next for the next todo. Report each step with taskhold_complete
{start_next: true}. If you need me, use taskhold_block with one question.
Add to AGENTS.md next to the workflow snippet from the Codex setup page.

Setup is on the Codex page. To work through a queue with nobody at the keyboard, see running coding agents overnight with codex exec.

Share this page:XLinkedInBlueskyHacker News

Answer your coding agents from anywhere.

$12/month or $120/year after the trial. Card up front. Cancel before day 7 and you pay nothing. Every agent you run is included.

Or connect your agent first, no sign-up: add https://taskhold.com/api/mcp as an MCP server. The first time it uses Taskhold, it gives you the trial link.

Questions

How do I queue a prompt in Codex?
Type it while Codex is working and press Tab. Codex sends it at the start of the next turn. Enter would add it to the current turn instead.
What's the difference between Tab and Enter while Codex is working?
Tab queues your message, slash command or shell command for the next turn. Enter injects your text into the turn that's running, so Codex acts on it right away.
Can I queue a message to Codex from a script?
Yes. codex queue --thread <session id or name> --message "..." queues text for an existing session. Add --resume to load the session if it isn't running; that needs a local daemon or a --remote server.
Why did my queued slash command show an error later?
Codex parses queued slash commands when they run, so a typo or a command menu appears after the current turn finishes, not when you press Tab.
How do I queue a message in Claude Code?
Press Enter while Claude is working. Claude Code queues the message and passes it to Claude once the current tool calls finish. Ctrl+Enter sends what you queued right away.

Sources

Related

Updated 2026-11-19. Something wrong or out of date? Email hello@greatwork.company.