Remote Control: no path to attach RC to completed headless (-p) sessions - resume requires a prompt, and -p --remote-control is silently ignored

Status Open
Maintainer reply None cached
Activity 0 comments · opened Jul 24, 2026

Use case. I run an orchestration daemon that dispatches headless Claude Code runs (claude -p --output-format stream-json) to work tickets. Each finished run leaves a session with deep context about the work it did. I want a human reviewer to later reopen such a session with Remote Control enabled and ask it questions from claude.ai/code or the mobile app — "talk to the agent that did the work."

What I tried (Claude Code v2.1.216, Windows 11, native claude.exe, claude.ai subscription auth):

  1. claude --resume <uuid> --remote-control "name" on a completed -p session exits after ~6s with:

``
Error: No deferred tool marker found in the resumed session. Either the session was not deferred,
the marker is stale (tool already ran), or it exceeds the tail-scan window.
Provide a prompt to continue the conversation.
``
Reproduced with stdin as PIPE, as DEVNULL, and with an attached (hidden) console with unredirected stdio — so this is not a TTY-detection issue.

  1. claude -p --remote-control "name" "<prompt>" — the flag is accepted but silently ignored: the run completes normally (exit 0), no RC state is recorded in the session file, and a later --resume <uuid> --remote-control fails exactly as above.
  2. Workaround that works: --resume <uuid> --remote-control "name" while writing a prompt to stdin — but this consumes a full API turn on every attach, just to open the session for conversation.

Request — either of these would solve it:

  • A. Let claude --resume <uuid> --remote-control "name" open a completed headless session the same way it opens an interactive one: render the transcript, register Remote Control, wait for input — no prompt required, no turn consumed.
  • B. Honor --remote-control as an opt-in in print mode, so the session records RC state at birth and a later --resume reconnects per the documented behavior ("reconnects to the Remote Control session recorded in that conversation"). Ideally registration-without-listing until first attach, so fleets of headless runs don't flood the session list at claude.ai/code.

The Remote Control docs cover interactive and server modes only; resuming a never-RC'd session into Remote Control is currently neither documented nor possible without spending a turn. Related: #56294 (RC session resume discoverability, closed as not planned).

View original on GitHub ↗