-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the feature or problem you'd like to solve
Currently, the userPromptSubmitted hook fires after the user submits input, but there's no hook that fires when the CLI is waiting for user input. This creates a gap for use cases that need to trigger actions when the agent is ready for interaction.
Proposed solution
Add a new hook type: awaitingUserInput that fires when:
- The CLI is waiting for user input
- The agent has finished generating its response text
- Control is returned to the user
This would complement the existing hooks:
userPromptSubmitted- fires after user hits enterawaitingUserInput(new) - fires when CLI awaits input
The hook should receive JSON input indicating the context:
{
"inputType": "normal" | "ask_user",
"sessionId": "string",
"timestamp": "ISO8601"
}This allows hooks to distinguish between:
- Normal conversation flow (after response generation completes)
- Interactive prompts (when
ask_usertool displays choices/question)
Benefits:
- Enables audio/visual notifications when agent needs attention
- Improves accessibility for users relying on non-visual feedback
- Different handling for normal vs interactive (ask_user) inputs
- Session automation and logging capabilities
Example prompts or workflows
Workflow 1: Audio accessibility notifications
User sets up hook to play audio cues:
- Subtle sound when normal input is ready
- Urgent sound when
ask_userrequires immediate response - Hook distinguishes between these using
inputTypefield
Workflow 2: Window focus management
User sets up hook to automatically focus terminal window when agent awaits input, particularly for ask_user interactions that require immediate decision.
Workflow 3: Session metrics logging
User tracks time spent in different states:
- Response generation time (postToolUse → awaitingUserInput)
- User thinking time (awaitingUserInput → userPromptSubmitted)
- Interactive vs normal input patterns
Workflow 4: IDE integration
IDE extension listens for awaitingUserInput hook to update status bar, show notifications, or adjust UI state when Copilot CLI needs attention.
Workflow 5: Terminal bell notifications
Simple terminal bell when agent is idle and awaiting input, useful for multitasking users who want passive notifications.
Example configuration
{
"version": 1,
"hooks": {
"awaitingUserInput": [
{
"type": "command",
"bash": "./notify-ready.sh",
"cwd": "$HOME/.copilot/hooks",
"timeoutSec": 2
}
]
}
}Example hook script:
#!/bin/bash
INPUT=$(cat)
INPUT_TYPE=$(echo "$INPUT" | jq -r '.inputType')
if [[ "$INPUT_TYPE" == "ask_user" ]]; then
# Play urgent sound for interactive questions
afplay /System/Library/Sounds/Sosumi.aiff &
else
# Play subtle sound for normal input
afplay /System/Library/Sounds/Ping.aiff &
fiAdditional context
- GitHub Copilot CLI: v0.0.395
- OS: macOS
- Related issues: Feature Request: User Level Hooks #1067 (user-level hooks), Feature: Prompt injection hooks for model #1023 (prompt injection)
- Current workaround: None available - cannot detect when response generation completes
The gap this addresses:
- Tool completes → sound plays (via
postToolUsehook) ✅ - Agent generates response text → no hook available ❌
- Input awaited → no hook available ❌