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
|`/add-dir PATH`| Add a directory to the allowed list for file access. |
199
+
|`/after [DELAY PROMPT]`, `/after`| Schedule a non-recurring prompt, skill, or schedulable slash command for the current session (for example, `/after 30m remind me the time` or `/after 1h /chronicle standup`). With no arguments the schedule manager is displayed. {% data reusables.copilot.experimental %} |
199
200
|`/agent`| Browse and select from available agents (if any). See [AUTOTITLE](/copilot/concepts/agents/copilot-cli/about-custom-agents). |
200
201
|`/ask QUESTION`| Ask a quick side question without adding to the conversation history. {% data reusables.copilot.experimental %} |
201
202
|`/allow-all [on\|off\|show]`, `/yolo [on\|off\|show]`| Enable all permissions (tools, paths, and URLs). |
@@ -209,8 +210,9 @@ Holding <kbd>↑</kbd> or <kbd>↓</kbd> accelerates scrolling after the first 1
209
210
|`/cwd`, `/cd [PATH]`| Change the working directory or display the current directory. |
210
211
|`/delegate [PROMPT]`| Delegate changes to a remote repository with an AI-generated pull request. See [AUTOTITLE](/copilot/how-tos/copilot-cli/use-copilot-cli/delegate-tasks-to-cca). |
211
212
|`/diff`| Review changes in the current directory; auto-switches to branch diff when the working tree is clean (experimental). |
212
-
|`/downgrade <VERSION>`| Download and restart into a specific CLI version. Available for team accounts. |
213
+
|`/downgrade VERSION`| Download and restart into a specific CLI version. Available for team accounts. |
|`/every [INTERVAL PROMPT]`, `/every`| Schedule a recurring prompt, skill, or schedulable slash command for the current session (for example, `/every 1h run tests` or `/every 1d /chronicle standup`). With no arguments the schedule manager is displayed. {% data reusables.copilot.experimental %} |
|`/experimental [on\|off\|show]`| Toggle, set, or show experimental features. |
@@ -255,7 +257,7 @@ Holding <kbd>↑</kbd> or <kbd>↓</kbd> accelerates scrolling after the first 1
255
257
|`/usage`| Display session usage metrics and statistics. |
256
258
|`/user [show\|list\|switch]`| Manage the current {% data variables.product.github %} user. |
257
259
|`/version`| Display version information and check for updates. |
258
-
|`/worktree [branch]`, `/move [branch]`| Create a new git worktree and switch to it, moving any uncommitted changes along. If you omit the branch name, a name is auto-generated from the conversation. Requires a git repository. {% data reusables.copilot.experimental %} |
260
+
|`/worktree [branch]`, `/move [branch]`| Create a new Git worktree and switch to it, moving any uncommitted changes along. If you omit the branch name, a name is auto-generated from the conversation. Requires a Git repository. {% data reusables.copilot.experimental %} |
259
261
260
262
For a complete list of available slash commands enter `/help` in the CLI's interactive interface.
261
263
@@ -311,7 +313,7 @@ For a complete list of available slash commands enter `/help` in the CLI's inter
311
313
|`--output-format=FORMAT`| FORMAT can be `text` (default) or `json` (outputs JSONL: one JSON object per line). |
312
314
|`-p PROMPT`, `--prompt=PROMPT`| Execute a prompt programmatically (exits after completion). See [AUTOTITLE](/copilot/how-tos/copilot-cli/automate-copilot-cli/run-cli-programmatically). |
313
315
|`--plan`| Start in plan mode. Shorthand for `--mode plan`. Cannot be combined with `--mode` or `--autopilot`. |
314
-
|`--plain-diff`| Disable rich diff rendering (syntax highlighting via the diff tool specified by your git config). |
316
+
|`--plain-diff`| Disable rich diff rendering (syntax highlighting via the diff tool specified by your Git config). |
315
317
|`--plugin-dir=DIRECTORY`| Load a plugin from a local directory (can be used multiple times). |
316
318
|`--remote`| Enable remote access to this session from {% data variables.product.prodname_dotcom_the_website %} and {% data variables.product.prodname_mobile %}. See [AUTOTITLE](/copilot/how-tos/copilot-cli/use-copilot-cli/steer-remotely). |
317
319
|`-r`, `--resume[=VALUE]`| Resume a previous interactive session by choosing from a list. Optionally specify a session ID, ID prefix, or session name. Name matching is exact and case-insensitive; falls back to the auto-generated summary when no explicit name matches. |
@@ -426,6 +428,7 @@ copilot --allow-tool='MyMCP'
426
428
|`COPILOT_ALLOW_ALL`| Set to `true` to allow all permissions automatically (equivalent to `--allow-all`). |
427
429
|`COPILOT_AUTO_UPDATE`| Set to `false` to disable automatic updates. |
428
430
|`COPILOT_CACHE_HOME`| Override the cache directory (used for marketplace caches, auto-update packages, and other ephemeral data). See [AUTOTITLE](/copilot/reference/copilot-cli-reference/cli-config-dir-reference#changing-the-location-of-the-configuration-directory) for platform defaults. |
431
+
|`COPILOT_COMPUTER_USE_LINUX`| Set to opt in to the `computer-use` MCP server on Linux distributions that support it. The `computer-use` server is not available on Alpine Linux (musl libc). |
429
432
|`COPILOT_CUSTOM_INSTRUCTIONS_DIRS`| Comma-separated list of additional directories for custom instructions. |
430
433
|`COPILOT_EDITOR`| Editor command for interactive editing (checked after `$VISUAL` and `$EDITOR`). Defaults to `vi` if none are set. |
431
434
|`COPILOT_ENABLE_HTTP2`| Set to `1` or `true` to opt into HTTP/2 transport. HTTP/1.1 is the default. |
@@ -615,6 +618,7 @@ The CLI includes built-in MCP servers that are available without additional setu
615
618
|`playwright`| Browser automation: navigate, click, type, screenshot, and form handling. |
616
619
|`fetch`| HTTP requests via the `fetch` tool. |
617
620
|`time`| Time utilities: `get_current_time` and `convert_time`. |
621
+
|`computer-use`| Screen capture and mouse/keyboard automation. Not available on Alpine Linux (musl libc). Set `COPILOT_COMPUTER_USE_LINUX` to opt in on other Linux distributions where it is available. |
618
622
619
623
Use `--disable-builtin-mcps` to disable all built-in servers, or `--disable-mcp-server SERVER-NAME` to disable a specific one.
620
624
@@ -764,7 +768,7 @@ Custom agents are specialized AI agents defined in Markdown files. The filename
764
768
| User |`~/.copilot/agents/`|
765
769
| Plugin |`<plugin>/agents/`|
766
770
767
-
Project-levelagents take precedence over user-level agents. Plugin agents have the lowest priority.
771
+
For project-scoped agents, the CLI walks upward from your current working directory to the Git root, loading `.github/agents/` and `.claude/agents/` directories at each ancestor level. This means each package or subdirectory in a monorepo can contribute its own agents. When multiple `.github/agents/` directories exist in the path, all are loaded, with the deepest directory taking highest priority. The `.github/agents/` convention takes precedence over `.claude/agents/` at the same level. User-level agents have lower priority than project-level agents. Plugin agents have the lowest priority.
768
772
769
773
### Subagent limits
770
774
@@ -797,7 +801,7 @@ When the full dialog is shown, you can also choose from these options:
797
801
| This location | Until manually cleared | Saved to disk per location |
798
802
| Always | Permanent | Config file |
799
803
800
-
The **This location** option appears when the CLI can determine a location key (git root or current directory). It persists the approval to disk so the same permission is automatically granted the next time you work in that directory without prompting again.
804
+
The **This location** option appears when the CLI can determine a location key (Git root or current directory). It persists the approval to disk so the same permission is automatically granted the next time you work in that directory without prompting again.
801
805
802
806
Use `/permissions reset` to clear in-memory approvals for the current session.
Copy file name to clipboardExpand all lines: content/copilot/reference/hooks-reference.md
+55Lines changed: 55 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,34 @@ Command hooks run shell scripts and are supported on all hook types.
115
115
|`timeoutSec`| number | No | Timeout in seconds. Default: `30`. |
116
116
|`type`|`"command"`| No | Hook type. Defaults to `"command"` when omitted. |
117
117
118
+
#### Progress messages
119
+
120
+
Command hooks can emit progress status lines to the CLI timeline while executing. Write a `{"type": "progress", "message": "..."}` JSON object to stdout before writing the final output:
Set `"temporary": true` to emit a transient status line. A transient line replaces the previous transient line and is cleared when the assistant responds, instead of accumulating in the timeline:
Progress messages are display-only and do not affect hook output or decision logic.
138
+
139
+
**How stdout is parsed when progress messages are mixed in.** — The CLI scans stdout line-by-line as the hook runs. Any line that, after trimming, is a single complete JSON object with `"type": "progress"` is consumed as a progress event and **removed from the hook's output stream**. Every other line—blank lines, plain text, and JSON objects that are not progress messages—is preserved verbatim. When the hook exits, the preserved lines are concatenated, trimmed, and parsed with a single `JSON.parse` call: that result is the hook's output (the "hook output JSON" referenced elsewhere in this article). This means:
140
+
141
+
* Emitting progress lines alongside a final decision object (as in the examples above) is safe and is the intended pattern—the progress lines never reach the JSON parser.
142
+
* Each progress message must be on its own line and must be valid JSON on that single line. Multi-line / pretty-printed progress objects are not recognized as progress and will be left in the output stream, where they will likely cause the final `JSON.parse` to fail.
143
+
* The final decision object, by contrast, may span multiple lines—only progress *recognition* is line-oriented; what remains after progress stripping is parsed as one JSON document, not as line-delimited JSON.
144
+
* If the leftover output is empty, or fails to parse as JSON, the hook is treated as having produced no output and falls through to default behavior. Two or more non-progress JSON objects on stdout (for example, two `echo '{"permissionDecision": ...}'` calls) will therefore concatenate into invalid JSON and be ignored—emit exactly one final decision object.
145
+
118
146
### HTTP hooks
119
147
120
148
HTTP hooks send the input payload as a JSON `POST` to a URL.
@@ -311,6 +339,30 @@ When configured with the PascalCase event name `PreToolUse`, the payload uses sn
311
339
}
312
340
```
313
341
342
+
**Claude-format matchers (PascalCase `PreToolUse`):** Hooks configured with the PascalCase event name `PreToolUse`—as used in Claude Code plugins and the Open Plugins format—apply Claude's matcher semantics instead of the native regex rule:
343
+
344
+
*`*`, `**`, or an empty matcher fires for every tool.
345
+
* A literal name or `|`-separated alternation (for example, `Bash` or `Edit|Write`) fires when any token equals the runtime tool name or its Claude tool name from the table below.
346
+
* Any other value is treated as a case-sensitive regex anchored as `^(?:pattern)$` tested against the Claude tool name (or the runtime name for tools with no Claude equivalent).
347
+
348
+
Payloads for PascalCase `PreToolUse` report `tool_name` as the Claude tool name (for example, `Bash`, not `bash`).
|`task`|`Agent` (the literal `Task` is also accepted) |
363
+
364
+
Tools with no Claude equivalent keep their runtime names.
365
+
314
366
> [!IMPORTANT]
315
367
> **Command vs HTTP fail behavior for `preToolUse`:** Command `preToolUse` hooks are **fail-closed**—a crash or non-zero exit denies the tool call. HTTP `preToolUse` hooks are **fail-open**—a network error, timeout, or non-2xx response falls through to the default permission flow. Choose the variant that matches your security requirements.
316
368
@@ -573,6 +625,9 @@ All configured `permissionRequest` hooks run for each request (except `read` and
573
625
574
626
**Matcher:** Optional regex tested against `toolName`. Anchored as `^(?:pattern)$`; must match the full tool name. When set, the hook fires only for matching tool names.
575
627
628
+
> [!NOTE]
629
+
> **Claude-format matchers (PascalCase `PermissionRequest`):** Hooks configured with the PascalCase event name `PermissionRequest` use the same Claude matcher semantics as `PreToolUse`. See [Claude-format matchers (PascalCase PreToolUse)](#claude-format-matchers-pascalcase-pretooluse) for the matcher rules and tool name table.
630
+
576
631
Output JSON to stdout to control the permission decision:
0 commit comments