Codex

The Codex CLI gets session recording, memory at session start, memory on each prompt, and the four memory tools.

What install changes

WhatFileHow
Memory tools (MCP server weavekeep)~/.codex/config.tomlAdds a [mcp_servers.weavekeep] table between marker comments
5 hooks~/.codex/hooks.jsonAdded next to any hooks you already have
The Weavekeep skill~/.agents/skills/weavekeep/SKILL.mdA 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

~/.codex/config.toml
# 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:end

The 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 eventWeavekeep commandTimeoutWhat it does
SessionStarthook session-start --client codex10 sAdds memory to the session's context
UserPromptSubmithook user-prompt-submit --client codex10 sStores your prompt and adds matching memory to it
PostToolUsehook post-tool-use --client codex30 s, asyncStores the tool call and its result
Stophook stop --client codex10 sStores 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
SessionEndhook session-end --client codex3 sMarks 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:

  1. Start Codex.
  2. Open /hooks.
  3. 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

FeatureWorks
Records sessionsYes
Memory at session startYes, up to about 7,000 characters, to fit Codex's limit for hook messages
Memory added to each promptYes
Memory toolsYes
Reminder to save a rule on the prompt that states itYes
Compaction summaryNo. Codex's compaction hook does not include the summary, so it is not registered
Transcript backfillNo. 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

Terminal
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 trusted

If 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.

On this page