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/reference/copilot-cli-reference/cli-command-reference.md
+319-2Lines changed: 319 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -415,6 +415,323 @@ Prompt hooks auto-submit text as if the user typed it. They are only supported o
415
415
|`errorOccurred`| An error occurs during execution. | No |
416
416
|`notification`| Fires asynchronously when the CLI emits a system notification (shell completion, agent completion or idle, permission prompts, elicitation dialogs). Fire-and-forget: never blocks the session. Supports `matcher` regex on `notification_type`. | Optional — can inject `additionalContext` into the session. |
417
417
418
+
### Hook event input payloads
419
+
420
+
Each hook event delivers a JSON payload to the hook handler. Two payload formats are supported, selected by the event name used in the hook configuration:
421
+
422
+
***camelCase format** — Configure the event name in camelCase (for example, `sessionStart`). Fields use camelCase.
423
+
***{% data variables.product.prodname_vscode_shortname %} compatible format** — Configure the event name in PascalCase (for example, `SessionStart`). Fields use snake_case to match the {% data variables.product.prodname_vscode_shortname %} {% data variables.product.prodname_copilot_short %} extension format.
424
+
425
+
#### `sessionStart` / `SessionStart`
426
+
427
+
**camelCase input:**
428
+
429
+
```typescript
430
+
{
431
+
sessionId: string;
432
+
timestamp: number; // Unix timestamp in milliseconds
433
+
cwd: string;
434
+
source: "startup"|"resume"|"new";
435
+
initialPrompt?:string;
436
+
}
437
+
```
438
+
439
+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
491
+
492
+
```typescript
493
+
{
494
+
hook_event_name: "UserPromptSubmit";
495
+
session_id: string;
496
+
timestamp: string; // ISO 8601 timestamp
497
+
cwd: string;
498
+
prompt: string;
499
+
}
500
+
```
501
+
502
+
#### `preToolUse` / `PreToolUse`
503
+
504
+
**camelCase input:**
505
+
506
+
```typescript
507
+
{
508
+
sessionId: string;
509
+
timestamp: number;
510
+
cwd: string;
511
+
toolName: string;
512
+
toolArgs: unknown;
513
+
}
514
+
```
515
+
516
+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
517
+
518
+
When configured with the PascalCase event name `PreToolUse`, the payload uses snake_case field names to match the {% data variables.product.prodname_vscode_shortname %} {% data variables.product.prodname_copilot_short %} extension format:
519
+
520
+
```typescript
521
+
{
522
+
hook_event_name: "PreToolUse";
523
+
session_id: string;
524
+
timestamp: string; // ISO 8601 timestamp
525
+
cwd: string;
526
+
tool_name: string;
527
+
tool_input: unknown; // Tool arguments (parsed from JSON string when possible)
528
+
}
529
+
```
530
+
531
+
#### `postToolUse` / `PostToolUse`
532
+
533
+
**camelCase input:**
534
+
535
+
```typescript
536
+
{
537
+
sessionId: string;
538
+
timestamp: number;
539
+
cwd: string;
540
+
toolName: string;
541
+
toolArgs: unknown;
542
+
toolResult: {
543
+
resultType: "success";
544
+
textResultForLlm: string;
545
+
}
546
+
}
547
+
```
548
+
549
+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
722
+
723
+
```typescript
724
+
{
725
+
hook_event_name: "PreCompact";
726
+
session_id: string;
727
+
timestamp: string; // ISO 8601 timestamp
728
+
cwd: string;
729
+
transcript_path: string;
730
+
trigger: "manual"|"auto";
731
+
custom_instructions: string;
732
+
}
733
+
```
734
+
418
735
### `preToolUse` decision control
419
736
420
737
The `preToolUse` hook can control tool execution by writing a JSON object to stdout.
@@ -628,7 +945,7 @@ Custom agents are specialized AI agents defined in Markdown files. The filename
628
945
| Agent | Default model | Description |
629
946
|-------|--------------|-------------|
630
947
|`code-review`| claude-sonnet-4.5 | High signal-to-noise code review. Analyzes diffs for bugs, security issues, and logic errors. |
631
-
|`critic`| complementary model |Adversarial feedback on proposals, designs, and implementations. Identifies weak points and suggests improvements. Experimental—requires `--experimental`. |
948
+
|`critic`| complementary model |Rubber-duck adversarial feedback on proposals, designs, and implementations. Identifies weak points and suggests improvements. Available for Claude models. Experimental—requires `--experimental`. |
632
949
|`explore`| claude-haiku-4.5 | Fast codebase exploration. Searches files, reads code, and answers questions. Returns focused answers under 300 words. Safe to run in parallel. |
633
950
|`general-purpose`| claude-sonnet-4.5 | Full-capability agent for complex multi-step tasks. Runs in a separate context window. |
634
951
|`research`| claude-sonnet-4.6 | Deep research agent. Generates a report based on information in your codebase, in relevant repositories, and on the web. |
@@ -847,7 +1164,7 @@ Feature flags enable functionality that is not yet generally available. Enable f
847
1164
848
1165
| Flag | Tier | Description |
849
1166
|------|------|-------------|
850
-
|`CRITIC_AGENT`| experimental |Critic subagent for adversarial feedback on code and designs (Claude and GPT models) |
1167
+
|`RUBBER_DUCK_AGENT`| experimental |Rubber-duck subagent for adversarial feedback on code and designs (available for Claude models) |
851
1168
|`BACKGROUND_SESSIONS`| experimental | Multiple concurrent sessions with background management |
852
1169
|`MULTI_TURN_AGENTS`| experimental | Multi-turn subagent message passing via `write_agent`|
853
1170
|`EXTENSIONS`| experimental | Programmatic extensions with custom tools and hooks |
0 commit comments