{"name":"CLAUDE_CODE_MESSAGING_SOCKET","slug":"claude-code-messaging-socket","family":"env","title":"Environment variables","noun":"environment variable","description":"Set by Claude Code, not by you: in sessions that bind an [inbox socket](\/docs\/en\/cross-session-messaging#the-sessions-inbox-socket), Claude Code exports that socket's path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session's [inbound controls](\/docs\/en\/cross-session-messaging#control-inbound-messages). Settings `env` blocks can't set it. Requires Claude Code v2.1.224 or later","description_source":"docs","described_by":{"doc":"claude-code\/env-vars","title":"Environment variables"},"presence":{"first_seen":"2.1.224","removed_in":null,"in_current_build":true,"newest_mined":"2.1.309","builds":74,"mined_builds":150,"first_cited":{"version":"2.1.224","released_at":"2026-08-07 01:36:32","spans":1}},"aliases":[],"entries":[{"version":"2.1.248","anchor":"peer-address-row-in-the-info-panel","heading":"Peer address row in the info panel","line":"The info panel can show a Peer address row, unavailable unless CLAUDE_CODE_MESSAGING_SOCKET is set.","released_at":"2026-08-27 20:35:36","reason":"named in this entry, found in this entry's text"},{"version":"2.1.224","anchor":"peer-address-shown-in-the-session-info-panel","heading":"Peer address shown in the session info panel","line":"The session info panel now shows your peer socket address when cross-session messaging is on.","released_at":"2026-08-07 01:36:32","reason":"named in this entry, found in this entry's text"},{"version":"2.1.224","anchor":"new-environment-variable-claude-code-messaging-socket","heading":"New environment variable CLAUDE_CODE_MESSAGING_SOCKET","line":"Point CLAUDE_CODE_MESSAGING_SOCKET at a socket path to enable session-to-session messaging and stream-json message replay.","released_at":"2026-08-07 01:36:32","reason":"named in this entry, found in this entry's text"},{"version":"2.1.224","anchor":"local-messaging-socket-where-it-lives-who-can-read-it-and-re","heading":"Local messaging socket: where it lives, who can read it, and refusing to steal a live one","line":"The messaging socket lives under XDG_RUNTIME_DIR with locked-down permissions and refuses to hijack a live one.","released_at":"2026-08-07 01:36:32","reason":"named in this entry, found in this entry's text"},{"version":"2.1.224","anchor":"cross-session-messaging-inbox-now-actually-starts-at-startup","heading":"Cross-session messaging inbox now actually starts at startup","line":"Startup can now actually open the local socket that lets other sessions message you.","released_at":"2026-08-07 01:36:32","reason":"named in this entry, found in this entry's text"}],"entries_total":5,"docs":[{"source":"claude-code","path":"env-vars","title":"Environment variables","documented":true},{"source":"claude-code","path":"cross-session-messaging","title":"Message your other Claude Code sessions","documented":false},{"source":"claude-code","path":"settings","title":"Claude Code settings","documented":false},{"source":"claude-code","path":"settings-reference","title":"All settings","documented":false}],"docs_total":4,"gates":[],"related":[{"name":"CLAUDE_CODE_MESSAGING_TOKEN","slug":"claude-code-messaging-token","description":"Set by Claude Code, not by you: in sessions that bind an [inbox socket](\/docs\/en\/cross-session-messaging#the-sessions-inbox-socket), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{\"type\":\"auth\",\"token\":\"<token>\"}` as its first line to prove it belongs to the session. On native Windows, Claude Code requires this line and closes any connection that doesn't open with a valid one. The [own-child rules](\/docs\/en\/cross-session-messaging#the-sessions-inbox-socket) say when Claude Code consults the token. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can't set it. Requires Claude Code v2.1.228 or later"}],"url":"https:\/\/changelogs.core-directive.com\/reference\/env\/claude-code-messaging-socket","family_url":"https:\/\/changelogs.core-directive.com\/reference\/env.json"}