# HarnessLink for Codex

Codex gets the full set: its transcripts and prompt history are captured, every finished turn is banked, context hooks bring a project brief and related memories into each session, and the MCP memory tools search what Claude Code, omp and pi banked too.

## What HarnessLink captures from Codex

| Feature | In Codex | Details |
| --- | --- | --- |
| Prompt history | Yes | `~/.codex/history.jsonl`. |
| Session transcripts | Yes | `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl`, uploaded moments after they change. |
| Memory bank (autobank) | Yes | Every finished turn becomes a memory entry (subagent threads are skipped). |
| Gateway routing | Yes | A top-level `openai_base_url` in `~/.codex/config.toml`: `.../codex/chatgpt/codex` with a ChatGPT login, `.../codex/openai` with an API key. |
| Context hooks | Yes | `SessionStart`, `UserPromptSubmit`, `PreToolUse` and `PreCompact` in `~/.codex/hooks.json` (no `Stop`). |
| Memory tools (MCP) | Yes | `[mcp_servers.superpi]` in `~/.codex/config.toml`, running `superpi` with `args = ["mcp", "--harness", "codex"]`. |
| Org policy rules | Partly | Checked in `PreToolUse`. "Ask first" rules block, because Codex cannot ask from a hook. |
| Skills from templates | Yes | `hnl add <skill>` installs into `~/.agents/skills`, which Codex reads. |
| Resume in another harness | Yes | `hnl resume` reopens a session with `codex resume`. |

## Set up Codex

1. Install HarnessLink on macOS or Linux ([Windows](https://harnesslink.sh/docs#windows) has its own one-liner).
   ```
   curl -fsSL https://harnesslink.sh/install.sh | bash
   ```
2. Sign in once in your browser; setup then turns on what each harness on the machine supports.
   ```
   hnl cloud setup
   ```
3. Or turn the pieces on one at a time.
   ```
   hnl gateway connect codex
   hnl cloud harnesses enable codex
   hnl cloud autobank enable codex
   hnl harness context codex
   hnl mcp register --harness=codex --yes
   ```
4. Trust the new hooks once in Codex: run `/hooks` there. Codex skips hooks you have not trusted, and `hnl` reminds you until you do.
5. Check what is connected: plain `hnl` shows, for each harness, the gateway, transcripts, autobank, context and memory tools.
   ```
   hnl
   ```

## How memory reaches Codex

**At session start** the `SessionStart` hook adds your organisation's policy instructions and a brief of the project, up to 7,000 characters (Codex shows longer hook output only as a preview).

**On each prompt** the `UserPromptSubmit` hook adds up to 3 memory entries that share at least two distinctive words with your prompt, wherever they were banked: a decision made in Claude Code reaches Codex this way.

The hooks read files on the machine only (the local memory index and `MAIN.md`); they never call the cloud, so they stay fast and work offline.

**When the model needs more** it calls the memory tools. The MCP server is the HarnessLink service's own (`superpi mcp`). Its tools include `memory_search` (search your memory across projects and machines), `memory_get` (read one entry in full), `memory_bank` (record a decision or outcome), `context_brief` (a budgeted brief of the project), `session_list` and `session_get`.

**Before Codex compacts** the `PreCompact` hook saves a handoff entry, so a new session (`/new`) can pick the task up.

## Limits

- Codex runs a new or changed hook only after you trust it in `/hooks`.
- Org policy: "ask first" rules block in Codex, and Codex's hosted web search cannot be hooked.
- There is no `Stop` hook for Codex, so it does not prompt for a handoff; `PreCompact` still saves one.
- The MCP server is registered only when the `codex` command is on your PATH.

## Guides

- [Using HarnessLink](https://harnesslink.sh/docs/usage): Using HarnessLink day to day: Ask, history, policies, shared memory, resuming sessions across harnesses, profile sync, templates, delegation, runs and cost.
- [Memory Banking](https://harnesslink.sh/docs/memory-banking): How HarnessLink turns each finished turn in omp, Claude Code, Codex, pi and Antigravity into a Markdown memory entry, when banking runs, and what reads it.
- [What HarnessLink captures from each harness](https://harnesslink.sh/docs/multi-harness): What HarnessLink captures from omp, Claude Code, Codex, pi, Antigravity and Cursor after setup, and how it stays a controller rather than a harness.

## Other harnesses

- [Claude Code](https://harnesslink.sh/harnesses/claude-code): Hooks, MCP memory tools, gateway and autobank
- [omp](https://harnesslink.sh/harnesses/omp): Context extension, MCP memory tools, gateway and autobank
- [pi](https://harnesslink.sh/harnesses/pi): Transcripts, autobank and gateway
- [Antigravity](https://harnesslink.sh/harnesses/antigravity): Transcripts and one memory entry per conversation
- [Cursor](https://harnesslink.sh/harnesses/cursor): MCP memory tools, by hand; chats not captured

[All harnesses](https://harnesslink.sh/harnesses) · [Install guide](https://harnesslink.sh/docs) · [Pricing](https://harnesslink.sh/pricing) · [Integrations](https://harnesslink.sh/integrations)
