Add --session-name flag for naming sessions from the CLI
Summary
There's currently no way to name a session from the command line. /rename only works interactively and can't be invoked by the agent itself. A --session-name flag would allow scripts and launchers to give sessions meaningful names at startup.
Use case
I'm building a multi-agent workflow launcher (ai-gh.sh) that spins up Claude Code sessions in git worktrees, one per GitHub issue. Each session gets a deterministic --session-id UUID, but when I look at my session list they're all unnamed — I have to open each one to figure out which issue it's working on.
Being able to run:
claude --session-id <uuid> --session-name "Issue #42 — claude" "start working on..."
would make session management much easier, especially when running multiple agents in parallel.
Current workarounds
- Manually running
/renameafter each session starts (tedious, defeats automation) - Including
/renamein the prompt (doesn't work — it's a client-side command, not agent-invocable)
Proposal
Add --session-name <name> flag that sets the session's display name at creation time. Should also work with --resume to update the name of an existing session.
---
🤖 Generated by claude · AI-assisted workflow
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗