Add --session-name flag for naming sessions from the CLI

Resolved 💬 3 comments Opened Mar 5, 2026 by obuzek Closed Mar 8, 2026

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 /rename after each session starts (tedious, defeats automation)
  • Including /rename in 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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗