# Setting up shared memory in OpenAI Codex

URL: https://codexmemory.com/setup
Last updated: 2026-11-07
Published by Glen (https://tryglen.com), shared memory for coding agents.

> Run npx @tryglen/cli@latest install, choose Codex and sign in. The installer registers Glen's four hooks in ~/.codex/hooks.json; Codex only runs hooks you trust, so approve them when prompted or through /hooks. After that, each prompt goes to Glen and matching team memory comes back as context before the model reads it.

1. **Run the installer** It needs Node.js. The installer looks for coding agents on your machine, asks which should get Glen, and installs the `glen` CLI.

   ```bash
   npx @tryglen/cli@latest install
   ```
2. **Sign in** A browser window opens. Create a free account, or join the organization your team already uses.
3. **Trust the hooks** The installer writes Glen's entries into `~/.codex/hooks.json`. Codex won't run a hook until you trust it, so accept the prompt when Codex shows it, or run `/hooks` inside Codex and approve the four Glen entries.

   ```bash
   /hooks
   ```
4. **Bring in your history** Optional, and worth doing on day one. Importing your last 30 days of local sessions gives recall something to find straight away.

   ```bash
   glen import
   ```
5. **Work, then ask** Start a Codex session and prompt as usual; matching memory arrives with each prompt. To ask a question outright, run a search. The answer cites a source for every claim and takes about 10 seconds.

   ```bash
   glen search "why does the migration run before the backfill"
   ```

## What the installer puts in hooks.json

*Glen's Codex hooks*

| Codex event | Command | Effect |
| --- | --- | --- |
| SessionStart | `glen session-start` | Runs once when a session opens |
| UserPromptSubmit | `glen ingest` | Sends the prompt, prior reply, repo and branch; returns matching memory as `additionalContext` |
| Stop | `glen ingest` | Records the prompt and the final reply |
| PostToolUse (Bash) | `glen pr-link` | Links each `git commit` to the session |

If memory never shows up, the hooks are the first thing to check. An untrusted hook is skipped without running, and `/hooks` shows which ones Codex has approved.

## Pausing or limiting recording

*Glen's recording modes*

| Command | Recall | Recording to team memory |
| --- | --- | --- |
| `glen incognito` | Keeps working | Stops |
| `glen silent` | Stops surfacing anything | Keeps going |
| `glen off` | Stops | Stops |

Glen does not train AI models on customer content. The details are in [Glen's Codex docs](https://tryglen.com/docs/codex) and the [privacy policy](https://tryglen.com/privacy).

## Searching from ChatGPT too

The [ChatGPT connector](https://tryglen.com/docs/chatgpt) searches the same memory your Codex sessions write to, which helps when you're planning outside the terminal. It reads; it does not record your chats. Other tools can connect through [Glen's remote MCP server](https://memorymcp.dev).

> **Install Glen for Codex** One command, free for up to 3 people and 15,000 memories. Install: `npx @tryglen/cli@latest install`. Start free at https://tryglen.com

## Frequently asked questions

### Why aren't my Codex hooks running?

Codex skips hooks it hasn't been told to trust. Open /hooks in Codex and approve Glen's entries, then start a new session.

### Where are Codex hooks configured?

In ~/.codex/hooks.json. Glen's installer adds its four entries there for you.

### Do I need Codex memories turned on for Glen?

No. Glen works through hooks and its own hosted memory, so the memories = true setting makes no difference to it.

### Does Glen slow Codex down?

Each hook adds a network round trip. In Glen's replay of 100 merged PRs on Codex 5.5, runs with Glen still finished 21% faster and used 29% fewer tokens.
