From a2964d7a20b8d9fefafc14ded4b5416dd1d4246e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20=C4=8Culina?= Date: Wed, 25 Mar 2026 14:05:56 -0700 Subject: [PATCH] fix: add Copilot CLI platform detection for sessionStart context injection Copilot CLI v1.0.11 reads `additionalContext` from sessionStart hook output, but the session-start script only emits the Claude Code-specific nested format. Add COPILOT_CLI env var detection so Copilot CLI gets the SDK-standard top-level `additionalContext` while Claude Code continues getting `hookSpecificOutput`. Based on PR #910 by @culinablaz. --- hooks/session-start | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hooks/session-start b/hooks/session-start index 23719358..24604295 100755 --- a/hooks/session-start +++ b/hooks/session-start @@ -35,23 +35,23 @@ warning_escaped=$(escape_for_json "$warning_message") session_context="\nYou have superpowers.\n\n**Below is the full content of your 'superpowers:using-superpowers' skill - your introduction to using skills. For all other skills, use the 'Skill' tool:**\n\n${using_superpowers_escaped}\n\n${warning_escaped}\n" # Output context injection as JSON. -# Cursor hooks expect additional_context. -# Claude Code hooks expect hookSpecificOutput.additionalContext. -# Claude Code reads BOTH fields without deduplication, so we must only -# emit the field consumed by the current platform to avoid double injection. +# Cursor hooks expect additional_context (snake_case). +# Claude Code hooks expect hookSpecificOutput.additionalContext (nested). +# Copilot CLI (v1.0.11+) and others expect additionalContext (top-level, SDK standard). +# Claude Code reads BOTH additional_context and hookSpecificOutput without +# deduplication, so we must emit only the field the current platform consumes. # -# Uses printf instead of heredoc (cat <