Feature request: --session-name flag for naming sessions at startup
Problem
When launching Claude Code programmatically (e.g., via terminal multiplexer layouts like Zellij/tmux), there's no way to set a human-readable session name at startup. The only way to name a session is via the /session rename slash command from within an active interactive session, which requires manual user input.
Use Case
I use a shell orchestrator (work) that creates git worktrees and launches Claude instances in Zellij tabs with pre-configured prompts. Each session maps to a specific task (e.g., garments-breadboard, invoicing-schema). Being able to name sessions at launch would make --resume and session management much more useful — currently all sessions show up as unnamed UUIDs unless the user manually renames each one.
Example of how this would be used:
# In a Zellij KDL layout:
pane command="claude" {
args "--session-name" "garments-breadboard" "--dangerously-skip-permissions" "Read .session-prompt.md for your task instructions."
}
Or from the command line:
claude --session-name "invoicing-schema" --resume
Proposed Solution
Add a --session-name <name> CLI flag that sets the session's display name at creation time. This would be the equivalent of running /session rename <name> immediately after startup, but without requiring interactive input.
Alternatives Considered
--append-system-promptwith rename instruction: Claude can't execute slash commands, so this doesn't work.- Wrapper script piping stdin:
/session renameonly works from interactive user input, not piped stdin. - Prompt file instruction: Unreliable — depends on the model choosing to tell the user to rename.
Environment
- Claude Code v1.0.33 (current at time of writing)
- macOS, Zellij 0.43.1
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗