[DOCS] [Environment variables] CLAUDE_CODE_SESSION_ID not documented in env-vars reference

Resolved 💬 2 comments Opened May 7, 2026 by coygeek Closed May 17, 2026

Documentation Type

Missing documentation (feature not documented)

Documentation Location

https://code.claude.com/docs/en/env-vars

Section/Topic

The environment variables table (alphabetical listing)

Current Documentation

The env-vars reference page lists CLAUDE_CODE_REMOTE_SESSION_ID:

CLAUDE_CODE_REMOTE_SESSION_ID — Set automatically in cloud sessions to the current session's ID. Read this to construct a link back to the session transcript.

No entry exists for CLAUDE_CODE_SESSION_ID. The page documents related session-ID variables but omits this one.

What's Wrong or Missing?

The changelog for v2.1.132 records this addition:

Added CLAUDE_CODE_SESSION_ID environment variable to the Bash tool subprocess environment, matching the session_id passed to hooks

The session_id field is documented in the hooks reference as a common field passed to all hooks:

"session_id" — Current session identifier

However, the env-vars reference page has no entry for CLAUDE_CODE_SESSION_ID, leaving users without a description of its purpose, when it is set, or how it differs from CLAUDE_CODE_REMOTE_SESSION_ID.

Suggested Improvement

Add an entry to the environment variables table for CLAUDE_CODE_SESSION_ID. Suggested description:

Set automatically in Bash tool subprocesses to the current session's identifier, matching the session_id field passed to hooks. Use this to correlate Bash subprocess activity with a specific Claude Code session.

Placement should be near CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS (alphabetically).

Impact

Medium - Makes feature difficult to understand

Additional Context

Changelog source (v2.1.132): https://code.claude.com/docs/en/changelog#2.1.132

Added CLAUDE_CODE_SESSION_ID environment variable to the Bash tool subprocess environment, matching the session_id passed to hooks

Hooks reference — common fields (session_id): https://code.claude.com/docs/en/hooks#common-input-fields

session_id — Current session identifier

Affected Pages:
| Page | Line(s) | Context |
|------|---------|---------|
| https://code.claude.com/docs/en/env-vars | Missing entry | CLAUDE_CODE_SESSION_ID not listed |
| https://code.claude.com/docs/en/changelog | Line 14 | Changelog entry confirming the feature |
| https://code.claude.com/docs/en/hooks | Line 522 | session_id field documented for hooks |

Total scope: 1 page affected (env-vars)

View original on GitHub ↗

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