Skip to content
Sessions & Workflows Simple

Ephemeral Session (No Persistence)

Run a one-off query without saving session data to disk

Command

$ "color:#7C5CFC">claude -p "Quick question" "color:#d97757">--no-session-persistence "color:#d97757">--output-format json

Response

{
  "session_id": "a3f2736d-...",
  "result": "Quick answer here",
  "total_cost_usd": 0.008
}

Parsing Code

059669">">// session_id appears 059669">">in response but is NOT saved to disk
059669">">const data = JSON.parse(output);
059669">">console.log(data.result); // Cannot --resume this session

Gotchas

! session_id still appears in response but session is NOT saved to disk
! Cannot --resume an ephemeral session — use for CI, batch, and privacy-sensitive prompts

Related Recipes