{"version":"2.1.317","anchor":"nested-session-id-opt-out-env-var-added","canonical_anchor":"nested-session-id-opt-out-env-var-added","heading":"Nested Claude Code sessions stop inheriting the parent's session id","tier":"notice","area":"Sessions","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.317\/e\/nested-session-id-opt-out-env-var-added","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.317","markdown":"### Nested Claude Code sessions stop inheriting the parent's session id\n\nA Claude Code started from inside another no longer takes the parent's session id, and `CLAUDE_CODE_DISABLE_NESTED_SESSION_ID` brings it back\n\n**Unclear.** What a user sees differently when a nested session has no inherited id is not shown.\n\n**What**\n\nA session is one run of Claude Code, with its own id. Claude Code sets `CLAUDE_CODE_CHILD_SESSION` in programs it starts, such as commands run through its Bash tool or hooks. A Claude Code started that way no longer inherits the parent's session id when all of these hold:\n\n- `CLAUDE_CODE_CHILD_SESSION` is set\n\n- a parent session id exists\n\n- there is no `--sdk-url` argument\n\n- the command is not `mcp serve`\n\nSetting `CLAUDE_CODE_DISABLE_NESTED_SESSION_ID` turns this off, so the child inherits the parent's id again.\n\n**Why**\n\nA Claude Code you run from inside another one no longer carries the parent's session id by default. If something you use relied on that id being passed down, the environment variable restores it.\n\n- Area: Sessions\n- Names: `CLAUDE_CODE_CHILD_SESSION`\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 2\/5\n- Scope: individual\n- Heads-up: no"}