Skip to content

Add model field to Copilot agent hook inputs #301152

@edena-legit

Description

@edena-legit

Feature Request

Problem

VS Code Copilot agent hooks (introduced in v1.109) do not include the active model name in any hook's input payload. The common fields sent to all hooks are:

{
  "timestamp": "...",
  "cwd": "...",
  "sessionId": "...",
  "hookEventName": "...",
  "transcript_path": "..."
}

Event-specific hooks like UserPromptSubmit, PreToolUse, and PostToolUse also lack a model identifier.

Use Case
Security and policy enforcement tools (e.g., extensions that enforce model allow/deny lists) need to know which model is active at hook time in order to:

  • Block disallowed models before a prompt is sent (UserPromptSubmit)
  • Audit which model was used for each tool call (PreToolUse / PostToolUse)
  • Enforce organizational policies that restrict usage to approved models

Without the model name in the hook input, model-based policy enforcement is impossible. Reading transcript_path is a fragile workaround since its format is undocumented.

Claude Code hooks already include a model field in their inputs, so this would bring VS Code hooks to parity.

Proposed Solution
Add a model field to the common hook input fields sent to all hook events:

{
  "timestamp": "...",
  "cwd": "...",
  "sessionId": "...",
  "hookEventName": "...",
  "transcript_path": "...",
  "model": "claude-opus-4-5"
}

Additional Context
Aligns with the Claude Code hooks spec which already includes model in hook inputs
Requested by extension developers building security/compliance tooling on top of VS Code agent hooks

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions