> ## 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.

# AI agent notifications

> Connect coding-agent lifecycle hooks to Midway notifications

Use agent lifecycle hooks to call [`midway send-text`](/commands/send-text) when an agent finishes or needs approval. Choose your agent's guide:

* [Claude Code](/agents/claude-code)
* [Codex CLI](/agents/codex-cli)
* [GitHub Copilot](/agents/github-copilot)
* [Gemini CLI](/agents/gemini-cli)
* [Antigravity CLI](/agents/antigravity-cli)
* [OpenCode](/agents/opencode)
* [Cursor](/agents/cursor)

Use `midway send-text --background` in hooks so the notification send continues if the agent or hook process is interrupted. The detached process is still subject to system shutdown, explicit termination, and teardown of ephemeral environments.

Before enabling a hook:

* Make sure `midway` is on the hook process's `PATH`.
* Make sure the hook's working directory contains `midway.yaml`; background sends use the default config in their working directory.
* Configure notification destinations in Midway. See [configuration](/config) and the [notification guides](/notifications/local).

For example, to select a config explicitly:

```bash theme={null}
midway --config /path/to/midway.yaml send-text -m "Agent finished"
```

Hooks execute commands with your user permissions. Only add hook commands you trust. A completion event can fire more than once per session, so notifications may be sent for each completed turn rather than only when you close the agent.


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