環境変数

CLAUDE_CODE_BRIDGE_SESSION_ID

リモートコントロール接続が有効なセッション中のBashツールやフックコマンドのサブプロセスにおいて、自動的に設定されるセッションIDです。

使い方・用途

  • 実行中のスクリプトから対応するclaude.ai/codeのURLセッションへリンクを戻すために使用されます
  • v2.1.199以降で利用可能で、接続終了時に自動的に削除されます
  • クラウドセッションでは、代わりにCLAUDE_CODE_REMOTE_SESSION_IDを参照してください
英語原文(公式ドキュメントより)

Set automatically in Bash tool and hook command subprocesses while the session has an active Remote Control connection, and removed when the connection ends. The value is the session's ID in session_ form, the same identifier that appears in the session's claude.ai/code URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In cloud sessions, read CLAUDE_CODE_REMOTE_SESSION_ID instead

関連ドキュメント