> ## Documentation Index
> Fetch the complete documentation index at: https://midway.hazyio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub Copilot

> Send Midway notifications from Copilot CLI and cloud agent hooks

Create a JSON hook file under `.github/hooks/`, for example `.github/hooks/midway-notifications.json`. The same file can be used by Copilot CLI and Copilot cloud agent, but not all events run on both surfaces.

```json theme={null}
{
  "version": 1,
  "hooks": {
    "notification": [
      {
        "type": "command",
        "bash": "midway send-text -m 'Copilot needs attention'",
        "powershell": "midway send-text -m 'Copilot needs attention'",
        "matcher": "agent_completed|agent_idle|permission_prompt|elicitation_dialog"
      }
    ],
    "sessionEnd": [
      {
        "type": "command",
        "bash": "midway send-text -m 'Copilot session ended'",
        "powershell": "midway send-text -m 'Copilot session ended'"
      }
    ]
  }
}
```

The `notification` event is available in Copilot CLI, but not Copilot cloud agent. It fires asynchronously for matching system notifications, such as when an agent completes or needs approval. `sessionEnd` runs when a session terminates; in Copilot cloud agent, it runs once per job.

Copilot CLI runs hooks on your machine. Copilot cloud agent runs hooks inside a temporary Linux environment, not on your desktop. To use `sessionEnd` there, Midway and its configuration must be made available in that environment. Do not commit notification credentials to the repository; cloud-agent outbound network access may also require an administrator allow rule.

For VS Code, the selected agent harness determines which hook implementation is active. Copilot harness sessions use the Copilot SDK hooks; see the [VS Code hooks guide](https://code.visualstudio.com/docs/copilot/customization/hooks) and verify event availability for your VS Code version.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.