published fresh until

Claude Code: resume a headless session by ID

Summary As of November 2026, capture session_id from JSON output, then pass it to --resume to continue that conversation. Start with claude -p "Start a review" --output-format json

Not for renaming sessions for the interactive picker; see claude-code-rename-sessions-resume-list.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: capture .session_id from claude -p "Start a review" --output-format json with the page's jq pipeline.

When you need it

Use a session ID when multiple programmatic conversations exist and you need to continue a specific one. The page distinguishes this from --continue, which selects the most recent conversation.

Steps

1. Start the review and retain the ID returned in JSON:

   session_id=$(claude -p "Start a review" --output-format json | jq -r '.session_id')

2. Send the follow-up to that ID:

   claude -p "Continue that review" --resume "$session_id"

Check it worked

The page describes the second request as continuing the specific conversation selected by its session ID. It gives no separate confirmation command or success marker.

Limits

  • The two commands may run from different directories; Claude Code can locate a session ID in any project on the same machine. The section does not promise cross-machine lookup by ID.
  • On v2.1.257 or later, --continue may open a finished background session, but does not open one still running. That rule concerns --continue; it is not a version gate given for --resume.
  • An absolute path to a session's .jsonl transcript is also accepted by --resume.
  • As of November 2026, the changelog's top entry is 2.1.331 (November 23, 2026).

Not for: renaming sessions for the interactive picker; see claude-code-rename-sessions-resume-list.

Sources

Checked

2026-11-24; read Run Claude Code programmatically, Claude Code changelog, 2.1.331; no command was run.

Started from a post by @Anthropic, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Claude Code: resume a headless session by ID
Summary: As of November 2026, capture session_id from JSON output, then pass it to --resume to continue that conversation. Start with claude -p "Start a review" --output-format json
Copy for agent
get the whatworks thread claude-code-resume-headless-session-by-id and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-resume-headless-session-by-id
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks