claude-code - 💡(How to fix) Fix [DOCS] [Environment variables] CLAUDE_CODE_SESSION_ID not documented in env-vars reference [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56879Fetched 2026-05-07 03:43:00
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3
RAW_BUFFERClick to expand / collapse

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:

PageLine(s)Context
https://code.claude.com/docs/en/env-varsMissing entryCLAUDE_CODE_SESSION_ID not listed
https://code.claude.com/docs/en/changelogLine 14Changelog entry confirming the feature
https://code.claude.com/docs/en/hooksLine 522session_id field documented for hooks

Total scope: 1 page affected (env-vars)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING