Expose CLAUDE_SESSION_ID environment variable
Resolved 💬 3 comments Opened Dec 11, 2025 by bukzor Closed Dec 15, 2025
Summary
Expose the session identifier as an environment variable so Bash commands can create session-scoped resources without race conditions.
Use Case
When multiple Claude Code sessions work in the same repository, they need unique identifiers for:
- Temporary index files (for isolated git operations)
- Lock files
- Session-specific temp directories
Currently there's no reliable way to distinguish sessions from within Bash.
Current State
The session ID already exists—visible in /status output:
Session ID: 8a718ed2-2856-435b-bd9a-63c5b8291b42
Suggested Implementation
export CLAUDE_SESSION_ID=8a718ed2-2856-435b-bd9a-63c5b8291b42
Minimal change: export the existing ID where session environment is initialized.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗