Skip to content

Commit 819a8fa

Browse files
github-actions[bot]Copilotaaronpowell
authored
docs: update Learning Hub for Copilot CLI v1.0.11/v1.0.12 changes (#1208)
Add documentation for new features released in the past 7 days: - /rewind command and double-Esc timeline picker (v1.0.12) - /allow-all on/off/show subcommands (v1.0.12) - .claude/settings.json and .claude/settings.local.json as additional repo config sources (v1.0.12) - preCompact hook event in the events table (v1.0.5, previously missing) - Plugin hooks CLAUDE_PROJECT_DIR and CLAUDE_PLUGIN_DATA env variables and {{project_dir}}/{{plugin_data_dir}} template variables (v1.0.12) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Aaron Powell <me@aaron-powell.com>
1 parent c63db63 commit 819a8fa

2 files changed

Lines changed: 44 additions & 7 deletions

File tree

website/src/content/docs/learning-hub/automating-with-hooks.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: 'Automating with Hooks'
33
description: 'Learn how to use hooks to automate lifecycle events like formatting, linting, and governance checks during Copilot agent sessions.'
44
authors:
55
- GitHub Copilot Learning Hub Team
6-
lastUpdated: 2026-03-27
6+
lastUpdated: 2026-03-28
77
estimatedReadingTime: '8 minutes'
88
tags:
99
- hooks
@@ -93,6 +93,7 @@ Hooks can trigger on several lifecycle events:
9393
| `preToolUse` | Before the agent uses any tool (e.g., `bash`, `edit`) | **Approve or deny** tool executions, block dangerous commands, enforce security policies |
9494
| `postToolUse` | After a tool completes execution | Log results, track usage, format code after edits, send failure alerts |
9595
| `agentStop` | Main agent finishes responding to a prompt | Run final linters/formatters, validate complete changes |
96+
| `preCompact` | Before the agent compacts its context window | Save a snapshot, log compaction event, run summary scripts |
9697
| `subagentStart` | A subagent is spawned by the main agent | Inject additional context into the subagent's prompt, log subagent launches |
9798
| `subagentStop` | A subagent completes before returning results | Audit subagent outputs, log subagent activity |
9899
| `errorOccurred` | An error occurs during agent execution | Log errors for debugging, send notifications, track error patterns |
@@ -123,6 +124,34 @@ When multiple IDE extensions (or a mix of extensions and a `hooks.json` file) ea
123124

124125
Hook event names can be written in **camelCase** (e.g., `preToolUse`) or **PascalCase** (e.g., `PreToolUse`). Both are accepted, making hook configuration files compatible across GitHub Copilot CLI, VS Code, and Claude Code without modification. Hooks also support Claude Code's nested `matcher`/`hooks` structure alongside the standard flat format.
125126

127+
### Plugin Hooks Environment Variables
128+
129+
When hooks are defined inside a **plugin**, the hook scripts receive two additional environment variables automatically:
130+
131+
| Variable | Description |
132+
|----------|-------------|
133+
| `CLAUDE_PROJECT_DIR` | The path to the current project (working) directory |
134+
| `CLAUDE_PLUGIN_DATA` | The path to a persistent data directory scoped to the plugin |
135+
136+
You can also use these as **template variables** directly in the `bash` or `powershell` fields of your `hooks.json` configuration:
137+
138+
```json
139+
{
140+
"version": 1,
141+
"hooks": {
142+
"sessionStart": [
143+
{
144+
"type": "command",
145+
"bash": "{{plugin_data_dir}}/scripts/init.sh --project {{project_dir}}",
146+
"timeoutSec": 10
147+
}
148+
]
149+
}
150+
}
151+
```
152+
153+
This makes it straightforward to write plugin hooks that are portable across machines and projects without hardcoding paths.
154+
126155
### Event Configuration
127156

128157
Each hook entry supports these fields:

website/src/content/docs/learning-hub/copilot-configuration-basics.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: 'Copilot Configuration Basics'
33
description: 'Learn how to configure GitHub Copilot at user, workspace, and repository levels to optimize your AI-assisted development experience.'
44
authors:
55
- GitHub Copilot Learning Hub Team
6-
lastUpdated: 2026-03-27
6+
lastUpdated: 2026-03-28
77
estimatedReadingTime: '10 minutes'
88
tags:
99
- configuration
@@ -416,6 +416,14 @@ GitHub Copilot CLI has two commands for managing session state, with distinct be
416416

417417
Both commands accept an optional prompt argument to seed the new session with an opening message, for example `/new Add error handling to the login flow`.
418418

419+
The `/rewind` command opens a timeline picker that lets you roll back the conversation to any earlier point in history, reverting both the conversation and any file changes made after that point. You can also trigger it by pressing **double-Esc**:
420+
421+
```
422+
/rewind
423+
```
424+
425+
Use `/rewind` when you want to branch off from a different point in the conversation, rather than just undoing the most recent turn.
426+
419427
The `/undo` command reverts the last turn—including any file changes the agent made—letting you course-correct without manually undoing edits:
420428

421429
```
@@ -432,15 +440,15 @@ The `/cd` command changes the working directory for the current session. Each se
432440

433441
This is useful when you have multiple backgrounded sessions each focused on a different project directory.
434442

435-
The `/allow-all` command (also accessible as `/yolo`) enables a mode where the agent can execute tools without per-action confirmation. It now supports explicit subcommands:
443+
The `/allow-all` command (also accessible as `/yolo`) enables autopilot mode, where the agent runs all tools without asking for confirmation. It now supports `on`, `off`, and `show` subcommands:
436444

437445
```
438-
/allow-all on # Enable allow-all mode
439-
/allow-all off # Disable allow-all mode
440-
/allow-all show # Check whether allow-all mode is currently active
446+
/allow-all on # enable allow-all mode
447+
/allow-all off # disable allow-all mode
448+
/allow-all show # check current allow-all status
441449
```
442450

443-
Path permissions granted via `/allow-all` persist across `/clear`, so if you've granted access to a directory in one session, that access carries into the new session.
451+
> **Note**: `/allow-all on` permissions persist after `/clear` starts a new session, so you don't need to re-enable it each time.
444452
445453
The `--effort` flag (shorthand for `--reasoning-effort`) controls how much computational reasoning the model applies to a request:
446454

0 commit comments

Comments
 (0)