Overview
The--session-id option allows you to specify a custom identifier for your Qwen Code session. This makes it easier to organize, track, and resume specific conversations, especially for long-running projects or specific features.
Syntax
Basic Usage
Create Named Session
feature-authentication instead of a random UUID.
Resume Named Session
a1b2c3d4-e5f6-7890-abcd-ef1234567890!
Benefits
Easy Identification
Organized Workflows
Team Collaboration
CI/CD Integration
Naming Conventions
By Feature
By Bug Number
By Task
By Date
By Project Phase
Use Cases
Feature Development
Bug Fixing
Code Reviews
Learning Sessions
Session Validation
Valid Session IDs
✅ Alphanumeric characters:feature-auth✅ Hyphens:
fix-bug-123✅ Underscores:
feature_oauth✅ UUIDs:
a1b2c3d4-e5f6-7890-abcd-ef1234567890
Invalid Session IDs
❌ Spaces:feature auth (use feature-auth)❌ Special chars:
feature@auth (use feature-auth)❌ Empty string:
"" (must provide ID)
Validation Rules
Combining with Other Options
With Prompts
With YOLO Mode
With Models
With Output Format
Session Persistence
Sessions with custom IDs are stored in:List Your Sessions
Session Metadata
Automation Examples
CI/CD Build Session
Daily Standup
Feature Tracking
Test Session
Best Practices
Use Descriptive Names
Use Descriptive Names
Make session IDs self-explanatory:
Follow Naming Convention
Follow Naming Convention
Be consistent across your team:
Keep IDs Short But Clear
Keep IDs Short But Clear
Balance brevity with clarity:
Include Context
Include Context
Add relevant context to IDs:
Session ID vs Resume
Use —session-id When:
✅ Creating a new session with a specific name✅ You know the name you want to use
✅ Organizing work by feature or task
✅ CI/CD and automation
Use —resume When:
✅ Continuing existing session✅ Don’t remember the exact ID
✅ Want to browse available sessions
Example Workflow
Troubleshooting
Session ID Already Exists
If you use an existing session ID:Invalid Session ID Format
Can’t Find Custom Session
If you can’t find your named session:Advanced Usage
Dynamic Session IDs
Session Templates
Session Namespaces
See Also
--resume Option
Resume previous sessions
--continue Option
Continue most recent session
Session Management
Complete guide to sessions
Workflow Organization
Organizing your AI workflow
