You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/copilot/concepts/agents/cloud-agent/about-cloud-agent.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,9 @@ contentType: concepts
20
20
category:
21
21
- Learn about Copilot
22
22
---
23
-
<!-- expires 2026-04-21 -->
24
-
<!-- When this expires, search all references to {% data variables.copilot.copilot_cloud_agent_tmp %} in docs-internal and replace with {% data variables.copilot.copilot_cloud_agent %} -->
25
-
## Overview of {% data variables.copilot.copilot_cloud_agent_tmp %}
26
-
<!-- end expires 2026-04-21 -->
23
+
24
+
## Overview of {% data variables.copilot.copilot_cloud_agent %}
25
+
27
26
With {% data variables.copilot.copilot_cloud_agent %}, {% data variables.product.prodname_copilot %} can work independently in the background to complete tasks, just like a human developer.
28
27
29
28
{% data variables.copilot.copilot_cloud_agent %} can:
@@ -137,7 +136,7 @@ You can customize {% data variables.copilot.copilot_cloud_agent %} in a number o
137
136
***Custom instructions**: Custom instructions allow you to give {% data variables.product.prodname_copilot_short %} additional context on your project and how to build, test and validate its changes. For more information, see [AUTOTITLE](/copilot/how-tos/configure-custom-instructions/add-repository-instructions).
138
137
***Model Context Protocol (MCP) servers**: MCP servers allow you to give {% data variables.product.prodname_copilot_short %} access to different data sources and tools. For more information, see [AUTOTITLE](/copilot/how-tos/use-copilot-agents/cloud-agent/extend-cloud-agent-with-mcp).
139
138
***{% data variables.copilot.custom_agents_caps_short %}**: {% data variables.copilot.custom_agents_caps_short %} allow you to create different specialized versions of {% data variables.product.prodname_copilot_short %} for different tasks. For example, you could customize {% data variables.product.prodname_copilot_short %} to be an expert frontend engineer following your team's guidelines. For more information, see [AUTOTITLE](/copilot/concepts/agents/cloud-agent/about-custom-agents).
140
-
***Hooks**: Hooks allow you to execute custom shell commands at key points during agent execution, enabling you to add validation, logging, security scanning, or workflow automation. For more information, see [AUTOTITLE](/copilot/concepts/agents/cloud-agent/about-hooks).
139
+
***Hooks**: Hooks allow you to execute custom shell commands at key points during agent execution, enabling you to add validation, logging, security scanning, or workflow automation. For more information, see [AUTOTITLE](/copilot/concepts/agents/hooks).
141
140
***Skills**: Skills allow you to enhance the ability of {% data variables.product.prodname_copilot_short %} to perform specialized tasks with instructions, scripts, and resources. For more information, see [AUTOTITLE](/copilot/concepts/agents/about-agent-skills).
142
141
143
142
## Limitations of {% data variables.copilot.copilot_cloud_agent %}
Copy file name to clipboardExpand all lines: content/copilot/concepts/agents/copilot-cli/about-copilot-cli.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -174,7 +174,7 @@ You can customize {% data variables.copilot.copilot_cli %} in a number of ways:
174
174
***Custom instructions**: Custom instructions allow you to give {% data variables.product.prodname_copilot_short %} additional context on your project and how to build, test and validate its changes. All custom instruction files now combine instead of using priority-based fallbacks. For more information, see [AUTOTITLE](/copilot/how-tos/copilot-cli/customize-copilot/add-custom-instructions).
175
175
***Model Context Protocol (MCP) servers**: MCP servers allow you to give {% data variables.product.prodname_copilot_short %} access to different data sources and tools. For more information, see [AUTOTITLE](/copilot/how-tos/use-copilot-agents/use-copilot-cli#add-an-mcp-server).
176
176
***{% data variables.copilot.custom_agents_caps_short %}**: {% data variables.copilot.custom_agents_caps_short %} allow you to create different specialized versions of {% data variables.product.prodname_copilot_short %} for different tasks. For example, you could customize {% data variables.product.prodname_copilot_short %} to be an expert frontend engineer following your team's guidelines. {% data variables.copilot.copilot_cli %} includes specialized {% data variables.copilot.custom_agents_short %} that it automatically delegates common tasks to. For more information, see [AUTOTITLE](/copilot/how-tos/use-copilot-agents/use-copilot-cli#use-custom-agents).
177
-
***Hooks**: Hooks allow you to execute custom shell commands at key points during agent execution, enabling you to add validation, logging, security scanning, or workflow automation. See [AUTOTITLE](/copilot/concepts/agents/cloud-agent/about-hooks).
177
+
***Hooks**: Hooks allow you to execute custom shell commands at key points during agent execution, enabling you to add validation, logging, security scanning, or workflow automation. See [AUTOTITLE](/copilot/concepts/agents/hooks).
178
178
***Skills**: Skills allow you to enhance the ability of {% data variables.product.prodname_copilot_short %} to perform specialized tasks with instructions, scripts, and resources. For more information, see [AUTOTITLE](/copilot/concepts/agents/about-agent-skills).
179
179
***{% data variables.copilot.copilot_memory %}**: {% data variables.copilot.copilot_memory %} allows {% data variables.product.prodname_copilot_short %} to build a persistent understanding of your repository by storing "memories", which are pieces of information about coding conventions, patterns, and preferences that {% data variables.product.prodname_copilot_short %} deduces as it works. This reduces the need to repeatedly explain context in your prompts and makes future sessions more productive. For more information, see [AUTOTITLE](/copilot/concepts/agents/copilot-memory).
Copy file name to clipboardExpand all lines: content/copilot/concepts/agents/hooks.md
+14-11Lines changed: 14 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,33 +1,34 @@
1
1
---
2
-
title: About hooks
2
+
title: About hooks for {% data variables.product.prodname_copilot %}
3
3
shortTitle: Hooks
4
4
intro: 'Extend and customize {% data variables.product.prodname_copilot %} agent behavior by executing custom shell commands at key points during agent execution.'
5
-
product: '{% data reusables.gated-features.copilot-cloud-agent %}<br><a href="https://github.com/features/copilot/plans?ref_product=copilot&ref_type=purchase&ref_style=button" target="_blank" class="btn btn-primary mt-3 mr-3 no-underline"><span>Sign up for {% data variables.product.prodname_copilot_short %}</span> {% octicon "link-external" height:16 %}</a>'
Hooks enable you to execute custom shell commands at strategic points in an agent's workflow, such as when an agent session starts or ends, or before and after a prompt is entered or a tool is called.
18
+
Hooks are a way of executing custom shell commands at strategic points in an agent's workflow, such as when an agent session starts or ends, when you enter a prompt, or when a tool is called.
18
19
19
20
Hooks receive detailed information about agent actions via JSON input, enabling context-aware automation. For example, you can use hooks to:
20
21
21
22
* Programmatically approve or deny tool executions.
22
-
*Utilize built-in security features like secret scanning to prevent credential leaks.
23
+
*Use built-in security features like secret scanning to prevent credential leaks.
23
24
* Implement custom validation rules and audit logging for compliance.
24
25
25
-
{% data variables.product.prodname_copilot_short %} agents support hooks stored in JSON files in your repository at `.github/hooks/*.json`.
26
-
27
26
Hooks are available for use with:
28
27
29
-
* {% data variables.copilot.copilot_cloud_agent %} on {% data variables.product.github %}
30
-
* {% data variables.copilot.copilot_cli %} in the terminal
28
+
***{% data variables.copilot.copilot_cloud_agent %}** on {% data variables.product.github %}.
29
+
***{% data variables.copilot.copilot_cli %}** in your terminal.
30
+
31
+
You define hooks in JSON files, stored in your repository at `.github/hooks/*.json`. These apply whenever {% data variables.product.prodname_copilot_short %} agents are used in the repository. {% data variables.copilot.copilot_cli_short %} also supports personal hooks that you store in your home directory at `~/.copilot/hooks/*.json`. These apply whenever you use {% data variables.copilot.copilot_cli_short %}.
31
32
32
33
## Types of hooks
33
34
@@ -42,7 +43,7 @@ The following types of hooks are available:
42
43
***subagentStop**: Executed when a subagent completes, before returning results to the parent agent.
43
44
***errorOccurred**: Executed when an error occurs during agent execution. Can be used to log errors for debugging, send notifications, track error patterns, and generate reports.
44
45
45
-
To see a complete reference of hook types with example use cases, best practices, and advanced patterns, see [AUTOTITLE](/copilot/reference/hooks-configuration).
46
+
To see a complete reference of hook types with example use cases, best practices, and advanced patterns, see [AUTOTITLE](/copilot/reference/hooks-reference).
46
47
47
48
## Hook configuration format
48
49
@@ -162,4 +163,6 @@ To ensure security is maintained when using hooks, keep the following considerat
162
163
163
164
## Next steps
164
165
165
-
To start creating hooks, see [AUTOTITLE](/copilot/how-tos/use-copilot-agents/cloud-agent/use-hooks).
166
+
To start creating hooks, see:
167
+
*[AUTOTITLE](/copilot/how-tos/use-copilot-agents/cloud-agent/use-hooks) for {% data variables.copilot.copilot_cloud_agent %}
168
+
*[AUTOTITLE](/copilot/how-tos/copilot-cli/customize-copilot/use-hooks) for {% data variables.copilot.copilot_cli %}
Copy file name to clipboardExpand all lines: content/copilot/get-started/features.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ These features can work autonomously without direct human supervision. However,
45
45
46
46
A command line interface that lets you use {% data variables.product.prodname_copilot_short %} in your terminal. Use the CLI to add features or fix bugs, then create a pull request. Start {% data variables.product.prodname_copilot_short %} working on a task in your terminal, then continue working in the same session on {% data variables.product.prodname_dotcom_the_website %}, or on your mobile. See [AUTOTITLE](/copilot/concepts/agents/about-copilot-cli).
47
47
48
-
### {% data variables.copilot.copilot_cloud_agent_tmp %}
48
+
### {% data variables.copilot.copilot_cloud_agent %}
49
49
50
50
An autonomous AI agent that can research a repository, create an implementation plan, and make code changes on a branch. You can review the diff, iterate, and create a pull request when you're ready. You can also assign a {% data variables.product.github %} issue to {% data variables.product.prodname_copilot_short %} or ask it to open a pull request directly to complete a task. See [AUTOTITLE](/copilot/how-tos/use-copilot-agents/cloud-agent).
Copy file name to clipboardExpand all lines: content/copilot/how-tos/copilot-cli/customize-copilot/use-hooks.md
+80-3Lines changed: 80 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,18 +16,95 @@ docsTeamMetrics:
16
16
17
17
{% data reusables.copilot.cloud-agent.hooks-intro %}
18
18
19
-
## Creating a hook in a repository on {% data variables.product.github %}
19
+
## Prerequisite
20
+
21
+
**For Windows only:** The examples in this article use PowerShell. If you're using Windows, you must have PowerShell 7.0 or later installed and in your PATH. You can check your PowerShell version by running `pwsh --version` in a terminal. To install PowerShell, run `winget install Microsoft.PowerShell` then restart your terminal.
22
+
23
+
## Creating a repository-level hook
24
+
25
+
1. Create a new `NAME.json` file (where `NAME` describes the purpose of the file) in the `.github/hooks/` folder of your repository.
20
26
21
27
{% data reusables.copilot.cloud-agent.create-hooks-instructions %}
22
28
29
+
## Creating a user-level hook
30
+
31
+
User-level hooks are configured just like repository-level hooks, but the hook files are stored locally, below your home directory.
32
+
33
+
The following examples for macOS and Windows show how to configure hooks that will play a sound and display a message box when the CLI finishes responding to a prompt, and when you quit {% data variables.copilot.copilot_cli_short %}. Hooks for Linux would be similar to the macOS example, but would use Linux tools for playing sounds and displaying messages.
34
+
35
+
### User-level example for macOS
36
+
37
+
1. Create a file called `notification-hooks.json` in `~/.copilot/hooks/`.
38
+
39
+
> [!NOTE]
40
+
> If `COPILOT_HOME` is set, create the file in `$COPILOT_HOME/hooks/`.
41
+
42
+
1. Copy and paste the following JSON into the file:
0 commit comments