--name vs --session-id
People think --name and --session-id are two ways to label a session. They are not the same kind of thing. --name is a label for people: any short text you will remember, shown in the /resume list and the title bar, and you can change it with /rename. --session-id is the session's real ID, and it must be a UUID. A script sets it so it can find that exact session later. Pick --name for yourself and --session-id for a script.
--name Flag
It gives a new session a name you choose.
--name gives a new session a name you choose. The name shows in the /resume list and in the title of your terminal window. Later, claude --resume with that name opens the session again. -n is the short form. To change the name while you work, use /rename.
--session-id Flag
It starts a session with an ID you choose.
--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.
In one line
- --name Flag
- It gives a new session a name you choose.
- --session-id Flag
- It starts a session with an ID you choose.