---
title: OpenAI Codex
description: Send Trigv push notifications when OpenAI Codex CLI finishes a turn using Stop hooks.
---
# OpenAI Codex

Get a push when a Codex CLI turn completes.

## Before you start

- [Shared `trigv-notify.sh` script](/docs/learn/ai-agents)
- `TRIGV_API_KEY` exported in your environment
- Codex CLI with hooks support

## Step 1 — Enable hooks

Edit `~/.codex/config.toml` and add:

```
[features]
hooks = true
```

## Step 2 — Add a Stop hook

Append to the same file:

```
[[hooks.Stop]]
[[hooks.Stop.hooks]]
type = "command"
command = "bash -c 'TRIGV_LEVEL=success ~/.local/bin/trigv-notify.sh \"Codex: turn complete\" \"Open terminal to review\" >/dev/null 2>&1 || true'"
statusMessage = "Notifying Trigv"
```

## Step 3 — Trust and test

<ol>
  <li>In Codex CLI, run <code>/hooks</code> to review new hook definitions.</li>
  <li>Approve/trust the hook when prompted.</li>
  <li>Run a Codex task and wait for completion — check your phone.</li>
</ol>

## Troubleshooting

- Test `trigv-notify.sh` manually first.
- Hooks must not print to stdout — the command above redirects output.
- See [Codex hooks docs](https://developers.openai.com/codex/hooks).
