Expose session ID to the model during conversations
Feature Request
Problem: When the model needs to reference the current session (e.g., to generate a claude --resume <session-id> command, or to log a resumable reference in a ticket), it has no way to access the current session ID. The session ID is managed by the CLI client layer but not exposed to the model.
Current workaround: Suggest claude --resume and tell the user to manually pick the session from the list — which is vague and error-prone.
Proposed solution: Expose the session ID to the model, e.g., as an environment variable (CLAUDE_SESSION_ID) or in the system context. This would allow the model to generate exact resume commands like:
claude --resume abc123
Why this matters: Developers frequently pause work mid-conversation — to context-switch, go to a meeting, or pick something up next week. Being able to log an exact resume command in a ticket tracker (Linear, Jira, etc.) or leave it in a commit message creates a seamless "bookmark" back into the conversation with all its accumulated context. Without the session ID, the best the model can do is say "run claude --resume and pick the right one from the list," which is friction that discourages the pattern entirely. With it, the model can write a one-liner into a ticket description that gets you back to exactly where you left off — making long-running, multi-session workflows much more practical.
Use case: User asks Claude to log a Linear ticket for follow-up work next week. Claude writes the ticket description including a precise claude --resume <session-id> command so the developer can pick up the planning conversation later with full context intact.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗