-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
Description
Summary
Copilot CLI hooks cannot inject command output into the LLM context window, unlike Claude Code. This prevents systems like Gas Town from using hooks to load dynamic context (like CLAUDE.md files) into conversations.
Background
Claude Code supports hooks that inject context by:
- Running a command (e.g.,
gt prime) - Capturing its stdout
- Automatically including that output in the session context
Example Claude Code flow:
- Hook runs:
gt prime --hook - Output: Full CLAUDE.md context (markdown)
- Result: Context appears in Claude's system prompt
Problem
Copilot CLI hooks currently:
- ✅ Execute commands
- ✅ Can read stdin (for hook metadata)
- ✅ Support side effects (logging, file writes)
- ❌ Cannot inject stdout into LLM context
When a sessionStart hook runs gt prime --hook, the context is generated and output to stdout, but Copilot CLI discards it instead of injecting it into the conversation.
Impact
- Gas Town and similar systems cannot use hooks to load dynamic role-specific context
- Agents must have static instructions in system prompts instead of dynamic, role-detected context
- Breaks feature parity with Claude Code's hook capabilities
Request
Add support for hook output injection in Copilot CLI:
- Allow hooks to output context that gets prepended to LLM context
- Specify which hooks support output injection (probably
sessionStart,sessionEnd,userPromptSubmitted) - Handle output format (plain text, markdown, JSON, etc.)
Example desired behavior:
{
"version": 1,
"hooks": {
"sessionStart": [
{
"type": "command",
"bash": "gt prime --hook",
"injectOutput": true,
"outputFormat": "markdown"
}
]
}
}Workaround (if no native support)
Hooks could write context to a .github/context.md file and Copilot CLI could automatically read/inject that at session start.