copilot-sdk-hooks

Intercept and govern Copilot tool execution and prompts via hook interfaces.

Updated Mar 21, 2026
One-click install
npx skills add https://github.com/kyle-deprow/ai_scaffolding --skill copilot-sdk-hooks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: copilot-sdk-hooks
Source: https://github.com/kyle-deprow/ai_scaffolding/tree/main/skills/copilot-sdk-hooks
Command: npx skills add https://github.com/kyle-deprow/ai_scaffolding --skill copilot-sdk-hooks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Intercept, validate, modify, and audit every step of the Copilot agent's execution through six hook points, enabling safety, compliance, and customization.

Core Features & Use Cases

  • Intercept before tool use for permission and argument control
  • Transform and audit tool results after execution, and log tool calls for compliance
  • Modify user prompts and inject session context to guide the LLM
  • Manage session lifecycle with start/end hooks and error-handling pipelines

Quick Start

Implement the onPreToolUse and onPostToolUse hooks in your Copilot SDK setup to start intercepting and shaping tool calls

Frequently Asked Questions about copilot-sdk-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I intercept Copilot tool execution to add permission controls?

Intercept Copilot tool execution by implementing the onPreToolUse hook, which evaluates tool calls before they run and returns a permissionDecision to allow or block the action. This enables customized safety layers around tool usage.

Can I modify user prompts before they are submitted to the Copilot agent?

Yes, modify user prompts before submission by implementing the onUserPromptSubmitted hook. This allows you to inject additionalContext and transform the prompt to guide the LLM's behavior within your integration.

What is the best way to audit Copilot tool calls for compliance?

The best way to audit Copilot tool calls for compliance is implementing the onPostToolUse hook. This intercepts and logs tool results after execution, allowing you to transform outputs and maintain a compliance record of agent actions.

Does the Copilot SDK support session lifecycle management and error handling?

Yes, Copilot SDK session lifecycle management is supported through onSessionStart and onSessionEnd hooks, while an onErrorOccurred hook provides an error-handling pipeline to catch and manage execution failures across developer integrations.

How do I change the arguments passed to a tool during Copilot agent execution?

Change tool arguments during Copilot agent execution by using the onPreToolUse hook to return modifiedArgs. This return contract allows you to alter the parameters before the tool is actually executed.