Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions website/src/content/docs/learning-hub/automating-with-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: 'Automating with Hooks'
description: 'Learn how to use hooks to automate lifecycle events like formatting, linting, and governance checks during Copilot agent sessions.'
authors:
- GitHub Copilot Learning Hub Team
lastUpdated: 2026-07-13
lastUpdated: 2026-07-26
estimatedReadingTime: '8 minutes'
tags:
- hooks
Expand Down Expand Up @@ -94,7 +94,7 @@ Hooks can trigger on several lifecycle events:
| `postToolUse` | After a tool **successfully** completes execution | Log results, track usage, format code after edits |
| `postToolUseFailure` | When a tool call **fails with an error** | Log errors for debugging, send failure alerts, track error patterns |
| `PermissionRequest` | When the CLI shows a **permission prompt** to the user | Programmatically approve or deny permission requests, enable auto-approval in CI/headless environments |
| `agentStop` | Main agent finishes responding to a prompt | Run final linters/formatters, validate complete changes |
| `agentStop` | Main agent finishes responding to a prompt | Run final linters/formatters, validate complete changes; receives `stop_hook_active` flag *(v1.0.72+)* |
| `preCompact` | Before the agent compacts its context window | Save a snapshot, log compaction event, run summary scripts |
| `subagentStart` | A subagent is spawned by the main agent | Inject additional context into the subagent's prompt, log subagent launches |
| `subagentStop` | A subagent completes before returning results | Audit subagent outputs, log subagent activity |
Expand Down Expand Up @@ -369,6 +369,17 @@ Run ESLint after the agent finishes responding and block if there are errors:

If the lint command exits with a non-zero status, the action is blocked.

> **Preventing infinite loops with `agentStop` *(v1.0.72+)***: If an `agentStop` hook always exits with a non-zero code (blocking every turn), the CLI would previously loop indefinitely. Starting in v1.0.72, the CLI ends the turn after 8 consecutive blocks and passes a `stop_hook_active: true` flag to your hook script in the input JSON, so the hook can detect it is in a forced-continuation scenario and self-limit. Use this flag to break out of blocking logic when appropriate:
>
> ```bash
> #!/usr/bin/env bash
> input=$(cat)
> if echo "$input" | jq -e '.stop_hook_active == true' > /dev/null; then
> exit 0 # Already in forced continuation — don't block again
> fi
> npx eslint . --max-warnings 0
> ```

### Security Gating with preToolUse

Block dangerous commands before they execute. Use the `matcher` field to target only the `bash` tool, so the hook doesn't fire for file edits or other tools:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: 'Building Custom Agents'
description: 'Learn how to create specialized GitHub Copilot agents with custom personas, tool integrations, and domain expertise.'
authors:
- GitHub Copilot Learning Hub Team
lastUpdated: 2026-07-09
lastUpdated: 2026-07-26
estimatedReadingTime: '10 minutes'
tags:
- agents
Expand Down Expand Up @@ -254,12 +254,13 @@ The agent can then query your database, analyze query plans, and suggest optimiz

| Scenario | Recommended Model |
|----------|-------------------|
| Highest-capability tasks, frontier reasoning | Claude Opus 5 *(v1.0.75+)* |
| Most demanding reasoning, security review | Claude Sonnet 5 *(v1.0.67+)* |
| Complex reasoning, analysis | Claude Sonnet 4 |
| Code generation, tool-driven agentic work | GPT-5.6 *(v1.0.70+)* |
| Code generation, refactoring | GPT-4.1 |
| Code-specialized tasks, large context | kimi-k2.7-code *(v1.0.68+)* |
| Quick analysis, simple tasks | Claude Haiku or GPT-4.1-mini |
| Quick analysis, simple tasks | Claude Haiku, GPT-4.1-mini, or gemini-3.6-flash *(v1.0.74+)* |
| Large codebase understanding | Models with larger context windows |

### Organizing Agents in Your Repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: 'Copilot Configuration Basics'
description: 'Learn how to configure GitHub Copilot at user, workspace, and repository levels to optimize your AI-assisted development experience.'
authors:
- GitHub Copilot Learning Hub Team
lastUpdated: 2026-07-13
lastUpdated: 2026-07-26
estimatedReadingTime: '10 minutes'
tags:
- configuration
Expand Down Expand Up @@ -468,6 +468,16 @@ The settings dialog supports search — type to filter settings by name. Changes
/model --local # view/edit your personal model preference
```

*(v1.0.74+)* Use `/model plan` (or `/model --plan`) to pick a **separate model for plan mode**. This lets you use a lightweight model for planning while using a more capable model for execution:

```
/model plan # open the model picker scoped to plan mode
/model --plan claude-haiku-4 # set a specific model for plan mode by ID
/model --plan off # clear the plan-mode model override (reverts to session model)
```

When you leave plan mode, Copilot automatically reverts to your session model. This is useful for keeping plan-mode fast and cost-efficient while still having a powerful model available for agentic execution.

These flags mirror the **Repo** and **Repo (local)** scope tabs available in the `/settings` dashboard (v1.0.71+), making it easier to manage per-repository vs. user-global configuration without ambiguity. In v1.0.71+, the `/settings` dashboard also shows **Repo** and **Repo (local)** tabs alongside the existing user-level view, giving you a unified place to see which settings are applied at each layer.

GitHub Copilot CLI has two commands for managing session state, with distinct behaviours:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: 'Installing and Using Plugins'
description: 'Learn how to find, install, and manage plugins that extend GitHub Copilot CLI with reusable agents, skills, hooks, and integrations.'
authors:
- GitHub Copilot Learning Hub Team
lastUpdated: 2026-07-13
lastUpdated: 2026-07-26
estimatedReadingTime: '8 minutes'
tags:
- plugins
Expand Down Expand Up @@ -31,7 +31,7 @@ A plugin bundles one or more of the following components:
| **Custom Agents** | Specialized AI assistants with tailored expertise | `agents/*.agent.md` |
| **Skills** | Discrete callable capabilities with bundled resources | `skills/*/SKILL.md` |
| **Hooks** | Event handlers that intercept agent behavior | `hooks.json` or `hooks/` |
| **MCP Servers** | Model Context Protocol integrations for external tools | `.mcp.json` or `.github/mcp.json` |
| **MCP Servers** | Model Context Protocol integrations for external tools | `.mcp.json`, `mcp.json` *(v1.0.74+)*, or `.github/mcp.json` |
| **LSP Servers** | Language Server Protocol integrations | `lsp.json` or `.github/lsp.json` |
| **Extensions** | IDE extensions installable via the plugin marketplace (v1.0.62+) | `extensions/` |

Expand Down Expand Up @@ -74,6 +74,8 @@ The `plugin.json` manifest declares what the plugin contains:
}
```

> **Open Plugin Spec v1 *(v1.0.74+)***: GitHub Copilot CLI now supports [Open Plugin Spec v1](https://openpluginspec.org/) plugin manifests alongside the native `plugin.json` format. This means plugins authored for compatible tools using the Open Plugin Spec can be installed directly without reformatting. The CLI also recognises `mcp.json` (without the leading dot) as a valid MCP server configuration file, improving interoperability with other tools that use this convention.

## Why Use Plugins?

You might wonder: why not just copy agent files into your project manually? Plugins provide several advantages:
Expand Down
Loading