Codex
The Codex CLI gets session recording, memory at session start, memory on each prompt, and the four memory tools.
What install changes
| What | File | How |
|---|---|---|
Memory tools (MCP server weavekeep) | ~/.codex/config.toml | Adds a [mcp_servers.weavekeep] table between marker comments |
| 5 hooks | ~/.codex/hooks.json | Added next to any hooks you already have |
| The Weavekeep skill | ~/.agents/skills/weavekeep/SKILL.md | A new file, shared with Cursor |
If you set CODEX_HOME, Weavekeep uses that folder instead of ~/.codex. The skill stays in ~/.agents/skills, where Codex looks for your skills. Every config file is backed up before it changes, as <file>.bak-<timestamp>.
Weavekeep never edits your AGENTS.md.
The MCP server
# weavekeep:start
# Managed by `weavekeep install`; `weavekeep uninstall` removes this block.
[mcp_servers.weavekeep]
command = "/usr/local/bin/node"
args = ["/usr/local/lib/node_modules/@weavekeep/cli/dist/cli/index.js", "serve"]
# weavekeep:endThe paths are the Node and Weavekeep on your machine. Do not edit inside the markers; install and uninstall manage that block. Install puts the block in front of your first table, after your top-level settings, so the tables Codex adds later go after it.
Codex can still write its own settings, such as [tui] or [projects."…"], inside the block when the block is at the end of the file. weavekeep doctor warns when that happens. Run weavekeep install to move those settings out of the block; their values stay as they are. weavekeep uninstall removes only the Weavekeep table and keeps them.
The hooks
| Codex event | Weavekeep command | Timeout | What it does |
|---|---|---|---|
SessionStart | hook session-start --client codex | 10 s | Adds memory to the session's context |
UserPromptSubmit | hook user-prompt-submit --client codex | 10 s | Stores your prompt and adds matching memory to it |
PostToolUse | hook post-tool-use --client codex | 30 s, async | Stores the tool call and its result |
Stop | hook stop --client codex | 10 s | Stores the agent's final message for the turn. Now and then, asks the agent to save any rule or decision you stated; Codex shows this as one extra message |
SessionEnd | hook session-end --client codex | 3 s | Marks the session ended |
The skill
The skill tells the agent when to use memory. When you state a lasting rule, preference or decision, the agent saves it to its own memory as usual and also calls remember, so your other agents learn it. It calls recall before asking you something you may have settled already, and forget when you take something back or a new decision replaces an old one. It never stores secrets.
Install updates the skill when a newer Weavekeep changes it. If you edit the file, install leaves it as it is and warns you; delete it and run weavekeep install to get the current one.
Trust the hooks in Codex
Codex does not run new or changed hooks until you trust them. After weavekeep install:
- Start Codex.
- Open
/hooks. - Trust the Weavekeep hooks.
Do this again after any weavekeep install that changes the hooks, for example after upgrading Node. Until then, Codex skips them: the memory tools work, but nothing is recorded and no memory is added at session start.
What works
| Feature | Works |
|---|---|
| Records sessions | Yes |
| Memory at session start | Yes, up to about 7,000 characters, to fit Codex's limit for hook messages |
| Memory added to each prompt | Yes |
| Memory tools | Yes |
| Reminder to save a rule on the prompt that states it | Yes |
| Compaction summary | No. Codex's compaction hook does not include the summary, so it is not registered |
| Transcript backfill | No. Codex documents its transcript format as unstable, so Weavekeep only stores what the hooks send |
If config.toml also defines hooks inline in [hooks] tables, install warns you: Codex merges them with hooks.json and warns at startup.
Check that it works
weavekeep doctor✓ Codex hooks: 5 of 5 hooks present
✓ Codex hook command: /usr/local/bin/node and /usr/local/lib/node_modules/@weavekeep/cli/dist/cli/index.js exist
✓ Codex memory tools: registered
✓ Codex skill: ~/.agents/skills/weavekeep/SKILL.md is current
✓ Codex hook trust: all 5 Weavekeep hooks are trustedIf you see ! Codex hook trust: 5 of 5 Weavekeep hooks not trusted yet, so Codex skips them, open /hooks in Codex and trust them.
Then start a Codex session in a project with a saved decision. It should be in the context from the start, and weavekeep recent should list the session with agent codex.