Remote Control: no path to attach RC to completed headless (-p) sessions - resume requires a prompt, and -p --remote-control is silently ignored
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):
claude --resume <uuid> --remote-control "name"on a completed-psession 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.
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-controlfails exactly as above.- 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-controlas an opt-in in print mode, so the session records RC state at birth and a later--resumereconnects 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).