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

# Codex

> How partio integrates with OpenAI Codex CLI

# Codex Integration

partio supports [OpenAI Codex CLI](https://openai.com/codex) as a first-class agent alongside Claude Code. When you use Codex in a partio-enabled repository, sessions are captured alongside your commits — the same way they are for Claude Code.

## Detection

partio detects Codex by checking for a running `codex` process. When the pre-commit hook fires, it:

1. Checks if a Codex process is active on the system (`pgrep -f codex`)
2. Locates the latest session file under `~/.codex/sessions/`, matching the session's working directory against the current repository root

If both conditions are met, the session is marked as active and captured on commit.

## Selecting the agent

By default the `agent` setting is empty, and partio **auto-detects** whichever supported agent is currently running (Claude Code or Codex). You usually don't need to configure anything.

To pin partio to Codex explicitly — useful if you run multiple agents — set the `agent` field or the `PARTIO_AGENT` environment variable:

```json title=".partio/settings.json" theme={null}
{
  "agent": "codex"
}
```

```bash theme={null}
PARTIO_AGENT=codex git commit -m "..."
```

See [Configuration → Choosing the agent](/cli/configuration#choosing-the-agent) for details.

## What gets captured

For each commit made while Codex is active, partio captures the same checkpoint data as any other agent:

| File            | Contents                                           |
| --------------- | -------------------------------------------------- |
| `full.jsonl`    | The complete JSONL transcript of the Codex session |
| `context.md`    | A summary of the session context                   |
| `diff.patch`    | The unified diff for the commit                    |
| `prompt.txt`    | The initial prompt that started the session        |
| `metadata.json` | Session metadata (agent, token count, duration)    |

### Session metadata

```json theme={null}
{
  "agent": "codex",
  "total_tokens": 11840,
  "duration": "6m10.2s"
}
```

<Warning>Plan capture (`plan.md`) is specific to Claude Code's plan mode and is not produced for Codex sessions.</Warning>

## Attribution & trailers

Attribution and commit trailers work identically for every agent. After each checkpoint, your commit is amended with:

```
Your commit message here

Partio-Checkpoint: a3f8c2d14e9b
Partio-Attribution: 82% agent
```

## Troubleshooting

### Checkpoints not being created

1. **Run `partio doctor`** to check installation health
2. **Verify Codex is running** when you commit — partio only captures when it detects an active process
3. **Check log output** with `partio --log-level debug status` (the `Agent:` line shows which agent partio resolved)
4. **Verify hooks are installed** — look for `# Installed by partio` in `.git/hooks/post-commit`

### Session file not found

Codex stores session files under `~/.codex/sessions/`. If partio can't find the session:

* Ensure Codex has been used in the current repository at least once
* Check that the session file hasn't been cleaned up before the commit
