How to use hooks in the GitHub Copilot CLI | demo

GitHub explains how hooks work in the GitHub Copilot CLI, focusing on the agent lifecycle and the specific events where hooks fire so you can customize tool calls and workflow behavior.

Full summary based on transcript

What “hooks” are in Copilot CLI

Hooks are event-driven customization points in the GitHub Copilot CLI that let you run logic at specific moments during an agent session, including around tool invocation.

Understanding the agent lifecycle

The video breaks down the overall lifecycle/loop of a Copilot CLI agent session, framing hooks as events that occur at predictable points in that loop.

How the agent loop works

GitHub walks through the agent loop at a high level to clarify:

Hook events covered

The demo calls out key events you can hook into:

Pre- and post-tool-use hooks

The video highlights how hooks around tool usage can be used to control or shape tool calls, enabling more predictable or customized behavior during the session.

Blocking vs non-blocking hooks

GitHub explains the difference between:

Reference documentation