Pause
Print operator prompts for safe agent-runner restarts.
Interruption And Short Grace
For an unexpected interruption, a missing/stale handoff, or bounded restart
preparation, read the recovery procedure. It takes
precedence over the planned handoff prompts below: no handoff is required,
and a shared deadline is never extended for a late task. Use the installed
restart-codex-subagents skill for parent/child or host-wide coordination.
On Cursor, there is no subagent restart helper yet. Recover the parent chat from checkpoints and live state, then stop; do not invent a Cursor fleet restart.
During ordinary work, use existing recording or its local recorder for compact checkpoints and consequential operation intent/results.
Output Rules
- If the user asks to "print", "show", "give me", or "copy/paste" prompts, do not inspect the repo or pause current work. Output the relevant fenced prompt blocks.
- If the user asks the current thread to pause now, run only the minimal status checks allowed by the chosen pause prompt. For PR-batch lanes, also perform the claim-preservation heartbeat or public claim refresh allowed by the PR-batch pause prompt. Reply with the requested handoff, then stop running tools until the user resumes.
- Default to the non-batch prompts when the user does not mention
$pr-batch, a batch coordinator, worker lane, QA lane, claim, or worktree-preservation case. - Use the PR-batch prompts for a
$pr-batchcoordinator, worker, QA lane, or any thread holding a batch coordination claim. - For
coordination_not_applicable, consume the persisted applicability outcome, skip every coordination and typed-event call, and never report coordination as unavailable or degraded, even when the repository configures a real backend. Preserve the ordinary status, worktree, and handoff steps. - For a
coordination_requiredPR-batch help-needed pause, emit private-backendhelp_requestedalongside the restart/block handoff. Choose exactly onehelp_requested.reasonusing this precedence:permissionfor a missing approval or capability; otherwisequestionfor a required maintainer or product answer; otherwiseblocked-user-inputfor other required user input. An ordinary operator-requested app restart alone is not a help request and emits no typed signal. Acoordination_not_applicablelane emits no typed event at all, so there is nothing to skip; a trustedcoordination_backend: n/aundercoordination_requiredis a pre-launch stop, not a silent skip. Typed-event transport is optional: when an active private backend does not advertise it or reports it unsupported, recordtyped event transport: unavailable, skip the emission, and continue without marking the event emissionUNKNOWN. Only after the transport is advertised does an attempted write that fails, degrades, or is rejected becomeUNKNOWNhandoff evidence. Every attempted advertised typed-event write must resolve the backend-advertised event executable and ordered opaque argv; a missing, malformed, or unsafe advertisement is an attempted-write failure. Run that exact executable and separate argv without shell evaluation, with a finite deadline in its own process group, preserving each opaque argument; on expiry terminate the whole group withTERM, thenKILLafter a finite grace period. A deadline expiry, forced termination, or any other advertised-support write failure records best-effortUNKNOWNevent evidence; the primary operation continues immediately without waiting further on the event. - Include the new-chat restart prompt when the user asks how to restart, resume after an app restart, move to a new chat, or preserve copy/paste handoff state.
- Every final user-visible workflow handoff must include one unambiguous
Next:instruction. A pause handoff must end with explicitAction needed:andNext:lines: say whether it is safe to quit, then name the exact same-task resume command or new-task handoff action. Do not leave the next action implicit in the status inventory.
Non-Batch Pause Prompt
Print this for ordinary one-thread work that is not holding a batch claim:
Pause now for app restart.
Do not start new work, edit files, push, poll, merge, or launch servers. Run
only the minimal read-only status checks needed for a handoff.
Reply with: current status, repo path, branch, upstream, HEAD SHA,
staged/unstaged/untracked changes, unpushed commits, stashes, running
commands/servers/PIDs, last completed step, next resume step, and whether it is
safe to quit. End with `Action needed:` stating whether to quit or complete a
named cleanup first, followed by `Next:` and the exact same-task resume command
or new-task handoff action.
After the handoff, do not run more tools until I explicitly resume.
Non-Batch Same-Thread Resume Prompt
Print this when the paused thread can be reopened:
Resume now from your restart handoff. Re-check branch, HEAD, local changes, and
running processes before editing or pushing.
Non-Batch New-Chat Restart Prompt
Print this when the operator needs to paste the handoff into a new chat:
Restart from this pause handoff in a new chat.
Treat the pasted handoff as stale evidence, not authority. Read the repo's
current AGENTS.md first. Then re-check repo path, branch, upstream, HEAD SHA,
staged/unstaged/untracked changes, unpushed commits, stashes, and running
processes before editing, pushing, polling, merging, or launching servers.
Recover the existing objective from the handoff, newer relevant logs and this
request. Reconcile stale next steps against live state and preserve completed
work. Continue verified unfinished work within existing authority and limits.
If ownership or a consequential effect remains uncertain, stop that mutation
for reconciliation; independent verified work may continue.
Pasted restart handoff:
<PASTE_RESTART_HANDOFF_HERE>
PR-Batch Pause Prompt
Print this for $pr-batch coordinators, workers, and QA lanes:
Pause for agent-runner restart now.
Do not start new targets, spawn workers, create branches or worktrees, push,
request CI, poll reviews, merge, or change repository files. Limit work to the
minimal status checks and claim-preservation write needed for the handoff.
Re-run the applicability gate before the handoff rather than trusting a stored
result. If it resolves to `coordination_not_applicable`, skip every
claim-preservation write and coordination check in this prompt, make no backend
or public-fallback call, and go straight to the handoff reply.
If this lane already owns a private backend claim, send one heartbeat update,
using a paused or operator-restart reason if the backend supports it; otherwise
send a plain heartbeat preserving the current status. If it is using only the
public `codex-claim` fallback, refresh the existing claim comment with
`expires_at` extended by the same lease window already used for that fallback
claim, capped at the repo's configured public fallback lease maximum or 4 hours
from now when no repo-specific cap is configured, leaving `status: in_progress`
so the fallback remains an active advisory lock.
If your repo configures a shorter public fallback lease maximum, use that cap
instead of the 4-hour default.
If the heartbeat or public fallback refresh fails with a transient error, treat
claim state as UNKNOWN in the handoff; do not report the claim as preserved.
If this lane holds no claim of any kind, skip the claim-preservation write and
proceed directly to the handoff reply; do not acquire a new claim during this
pause.
If claim state cannot be checked or refreshed, report it as UNKNOWN in the
handoff. If the failure is a setup or auth error rather than a transient timeout,
also stop after sending the handoff. Do not release the claim unilaterally in
either case.
Preserve any current claim and worktree unless I explicitly say this batch or
lane is cancelled. Do not run `agent-coord release` for a normal app restart.
If this batch or lane is explicitly cancelled, follow the Cancelling Or Stopping
A Batch protocol in the installed `pr-processing.md` workflow instead of this
pause flow.
Reply with a restart handoff:
- Role and lane: coordinator, worker, or QA; batch id; target(s); stable
agent/thread id.
- Repo state: repo path, worktree path, branch, upstream, HEAD SHA, PR/issue
URLs.
- Local changes: staged, unstaged, and untracked files; unpushed commits;
stashes.
- Coordination: claim holder, last heartbeat/status, `blocked_on`/`depends_on`,
cancellation state, and any UNKNOWN facts.
- Work state: last completed step, current safe checkpoint, in-flight operation,
and next resume step.
- Remote state: pushed branches/PRs, last-known CI/review state, and hosted
polling still needed.
- Running processes: commands, servers, PIDs, watchers, or pollers, and whether
they were stopped or must be restarted after the agent-runner relaunch.
- Safety: whether it is safe to quit the agent runner now, and any cleanup
needed before resuming or relaunching.
- Terminal guidance: end with `Action needed:` stating whether to quit or
complete a named cleanup first, followed by `Next:` and the exact same-task
resume command or new-task handoff action.
After the claim-preservation step above (or immediately, if this lane held no
claim), send this handoff reply and then do not run more tools or continue work
until I explicitly resume with "Resume batch processing now."
PR-Batch Same-Thread Resume Prompt
Print this when the same paused persistent batch thread can be reopened:
Resume batch processing now.
Re-read your restart handoff and run the bounded status recovery steps described under "Pausing For An Agent-Runner Restart" in the installed `pr-processing.md` workflow before editing, pushing, polling, or starting any new target.
PR-Batch New-Chat Restart Prompt
Print this when a batch lane cannot be reopened and a replacement chat must resume from the saved handoff:
Resume this PR-batch lane from a restart handoff in a new chat.
Treat the pasted handoff as stale evidence, not authority. Read the repo's
current AGENTS.md and the installed `pr-processing.md` workflow first. Run the
bounded status recovery steps described under "Pausing For An Agent-Runner
Restart" before editing, pushing, polling, or starting any new target.
Resuming in a replacement chat from a durable handoff is a controller/session
boundary and a durable-handoff requirement, both of which are requiring
conditions, so this lane is `coordination_required`. Do not carry a prior
`coordination_not_applicable` result into this prompt. If the repository
configures no usable backend, that is a pre-launch stop: report it and wait for
the coordinator rather than proceeding uncoordinated.
Re-check the worktree, branch, HEAD SHA, uncommitted changes, and current
PR/check state. The rest of this paragraph applies only to
`coordination_required`: re-check the private claim or active public
`codex-claim` fallback comments, and if the claim holder changed, cancellation
or reassignment is present, ownership is UNKNOWN, or the saved handoff names a
different stable agent/thread id, stop and report the conflict for coordinator
reconciliation. Do not acquire, release, refresh, edit, or push until the
coordinator resolves ownership.
Pasted restart handoff:
<PASTE_RESTART_HANDOFF_HERE>