Skip to content

[Feature Request] Add --session-name and /session-name for custom session identification #2112

@gwpl

Description

@gwpl

🤖 Beep boop! This issue was co-authored by an AI assistant (that's me!) and a human who's tired of playing "guess the session" roulette 🎰

Problem Description

Currently, Claude Code sessions are only identifiable by auto-generated session IDs and timestamps. When using claude --resume to view previous sessions, it's difficult to identify which session contains the work you're looking for, especially after days or weeks. The auto-generated summaries are helpful but often insufficient for distinguishing between similar coding sessions.

This issue is related to #1407 (session ID retrieval) and #1335 (session identification challenges), but focuses on making sessions human-readable rather than just exposing technical IDs or auto-generated summaries, as users may want to use their own keywords etc.

Proposed Solution

Add the ability to assign custom names/descriptions to sessions for easier identification and retrieval.

1. Command-line flags for new sessions:

# Start a new session with a descriptive name
claude --session-name "refactoring auth system"

# With initial prompt
claude --session-name "fixing payment bug #234" "investigate the stripe webhook issue"

# Alternative flag name (if preferred)
claude --session-comment "working on user dashboard redesign"

2. Interactive command for active sessions:

# During an active session
/session-name refactoring auth system

# Or to update existing name
/session-name updated: auth system + oauth integration

3. Enhanced resume interface:

Current behavior:

$ claude --resume
┌─────┬────────────────────────┬─────────────────────────────────────────┐
│ No. │ Last Update           │ Summary                                 │
├─────┼────────────────────────┼─────────────────────────────────────────┤
│ 1   │ 2025-01-15 14:32:00   │ Working on file editing and bug fixes   │
│ 2   │ 2025-01-15 09:15:00   │ Implementing new features for API       │
│ 3   │ 2025-01-14 16:45:00   │ Debugging test failures                 │
└─────┴────────────────────────┴─────────────────────────────────────────┘

Proposed behavior with session names:

$ claude --resume
┌─────┬────────────────────────┬──────────────────────────────┬─────────────────────────────────────────┐
│ No. │ Last Update           │ Session Name                 │ Summary                                 │
├─────┼────────────────────────┼──────────────────────────────┼─────────────────────────────────────────┤
│ 1   │ 2025-01-15 14:32:00   │ refactoring auth system      │ Working on file editing and bug fixes   │
│ 2   │ 2025-01-15 09:15:00   │ stripe webhook fix           │ Implementing new features for API       │
│ 3   │ 2025-01-14 16:45:00   │ [unnamed]                    │ Debugging test failures                 │
└─────┴────────────────────────┴──────────────────────────────┴─────────────────────────────────────────┘

4. Integration with existing features:

Implementation Considerations

  1. Storage: Session names should be stored alongside existing session metadata
  2. Length limits: Suggest max 100 characters for session names
  3. Special characters: Allow alphanumeric, spaces, dashes, underscores
  4. Backwards compatibility: Sessions without names show as "[unnamed]" or use auto-summary

Benefits

  • Dramatically improves session discoverability
  • Reduces time spent searching for the right session to resume
  • Better project organization for long-running development tasks
  • Complements session ID functionality rather than replacing it

Related Issues

Alternative Approaches Considered

  1. Auto-generating names from first prompt (too limiting)
  2. Using git branch names (not all sessions are git-related)
  3. Mandatory names (would break existing workflows)

Would love feedback on the flag naming (--session-name vs --session-comment vs other options) and whether both CLI flag and interactive command are needed.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions