Skip to content
BENIBIX Learn

--session-id Flag

Also known as claude --session-id, --session-id

It starts a session with an ID you choose.

Think of it like

It is like you pick your own box number. Then you put your bag in that box.

Example

Emma's script makes a UUID, saves it with the job, then runs claude -p with that --session-id. The next day it resumes the same session by the saved ID.

Why it matters

A script can find its own sessions later without reading a list or guessing.

Definition

--session-id starts a session with an ID you choose, not one Claude Code makes up. The ID must be a UUID, a long code of letters and numbers in a fixed shape. A script uses it to know the ID up front, so it can resume or look up that exact session later.

Example code

bash
claude --session-id "550e8400-e29b-41d4-a716-446655440000"
Start a session with a set UUID.
--session-id fixes the ID before the session starts.

Common mistake

Passing a name like fix-login. It must be a UUID. For a name you can read, use --name.

Key takeaways

  1. 1
    You choose it. Up front.
  2. 2
    Must be a UUID. Not a name.
  3. 3
    For scripts. To find it later.

Compare

Learn it properly