Hook Valid Event Types
Hook event keys in .github/hooks/*.json or VS Code hook config MUST use recognized Copilot event type names. The VS Code Copilot doc lists eight events in PascalCase: SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, SubagentStart, SubagentStop, Stop. Unrecognized event names — including camelCase variants like preToolUse — are silently ignored, so the hook never fires.
Antipatterns
- camelCase variants. Writing
preToolUse,sessionStart, oruserPromptSubmitted— Copilot's event names are uniformly PascalCase, and the camelCase aliases are not recognized. - Cross-agent event names. Using event names from another agent (e.g.,
SessionEndis a Claude/Cursor event, not a Copilot one). - Deprecated event names. Using event names from older versions that have been renamed or removed.
Pass / Fail
Pass
{
"hooks": {
"SessionStart": [{ "type": "command", "command": "echo hook" }]
}
}
Fail
{
"hooks": {
"onToolUse": [{ "type": "command", "command": "echo hook" }]
}
}
Limitations
Checks that at least one recognized Copilot event type is present. Does not detect misspelled event names if a valid one also exists.
