Source: Source pull request number: 245 in rohitg00/agentmemory (URL omitted to avoid GitHub cross-reference)
Title: feat: add Codex Desktop hooks integration
Author: vybie
State: open
Draft: no
Merged: no
Head: vybie/agentmemory:codex/codex-desktop-hooks @ 4b89df8
Base: main @ 1c8713f
Labels: (none)
Changed files: 0
Commits: 0
Created: 2026-05-08T20:16:07Z
Updated: 2026-05-17T09:42:42Z
Closed: (not closed)
Merged at: (not merged)
Original PR body:
Summary
Adds a Codex integration guide and hook bridge so Codex Desktop / Codex CLI users can use agentmemory in a Claude Code-style workflow.
This documents a two-layer setup:
- MCP server config for explicit memory tools (
memory_save, memory_recall, memory_smart_search, etc.)
- Codex lifecycle hooks for automatic capture of session starts, prompts, tool calls, tool results, and turn stops
What changed
- Added
integrations/codex/agentmemory-codex-hook.mjs, a best-effort Codex hook bridge that translates Codex hook payloads into agentmemory REST API calls.
- Added
integrations/codex/README.md with end-to-end setup steps for Codex Desktop and Codex CLI.
- Updated the main README Codex row to point users to the new Codex integration guide.
Setup covered in the guide
-
Start the full agentmemory server:
npx -y @<!-- -->agentmemory/agentmemory
-
Add the MCP server to ~/.codex/config.toml:
[mcp_servers.agentmemory]
command = "npx"
args = ["-y", "@<!-- -->agentmemory/mcp"]
env = { AGENTMEMORY_TOOLS = "all" }
startup_timeout_sec = 30
tool_timeout_sec = 60
enabled = true
-
Copy the hook bridge into ~/.codex/hooks/.
-
Enable Codex hooks:
[features]
codex_hooks = true
-
Register SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, and Stop hooks to call the bridge script.
-
Verify captured sessions in the viewer at http://localhost:3113 or via GET /agentmemory/export.
Behavior
The bridge maps Codex events to agentmemory observations:
| Codex hook |
agentmemory action |
SessionStart |
Calls /agentmemory/session/start, optionally injects recalled context |
UserPromptSubmit |
Captures prompt_submit observation |
PreToolUse |
Captures pre_tool_use observation |
PostToolUse |
Captures post_tool_use observation |
Stop |
Captures latest assistant message as stop observation |
The bridge truncates large tool outputs and never throws or blocks Codex if agentmemory is down.
Validation
node --check integrations/codex/agentmemory-codex-hook.mjs
- Smoke-tested the hook bridge against a local agentmemory server on Windows by sending a fake Codex
UserPromptSubmit payload.
- Separately tested the full Codex Desktop setup locally with MCP plus hooks: Codex saw the MCP server, the hook created sessions, and prompt/tool observations appeared in
GET /agentmemory/export.
Notes
Codex hooks currently expose fewer lifecycle events than the Claude Code plugin, so this is not a byte-for-byte replacement. It does cover the main loop users need: automatic capture, session registration, startup context recall, and explicit MCP memory tools.
Summary by CodeRabbit
-
Documentation
- Main README updated to reference Codex CLI/Desktop and link a new Codex integration guide with setup steps, configuration examples, verification checklist, and limitations.
-
New Features
- Added Codex lifecycle event integration for agentmemory with optional context injection, configurable capture/truncation limits, and non‑blocking behavior when agentmemory is unavailable.
-
Tests
- Added tests validating hook event mappings, auth handling, output behavior, and timeout resilience.

Local branch:
Fork PR:
Fork decision:
Verification:
Notes:
Source: Source pull request number: 245 in rohitg00/agentmemory (URL omitted to avoid GitHub cross-reference)
Title: feat: add Codex Desktop hooks integration
Author: vybie
State: open
Draft: no
Merged: no
Head: vybie/agentmemory:codex/codex-desktop-hooks @ 4b89df8
Base: main @ 1c8713f
Labels: (none)
Changed files: 0
Commits: 0
Created: 2026-05-08T20:16:07Z
Updated: 2026-05-17T09:42:42Z
Closed: (not closed)
Merged at: (not merged)
Original PR body:
Summary
Adds a Codex integration guide and hook bridge so Codex Desktop / Codex CLI users can use agentmemory in a Claude Code-style workflow.
This documents a two-layer setup:
memory_save,memory_recall,memory_smart_search, etc.)What changed
integrations/codex/agentmemory-codex-hook.mjs, a best-effort Codex hook bridge that translates Codex hook payloads into agentmemory REST API calls.integrations/codex/README.mdwith end-to-end setup steps for Codex Desktop and Codex CLI.Setup covered in the guide
Start the full agentmemory server:
Add the MCP server to
~/.codex/config.toml:Copy the hook bridge into
~/.codex/hooks/.Enable Codex hooks:
Register
SessionStart,UserPromptSubmit,PreToolUse,PostToolUse, andStophooks to call the bridge script.Verify captured sessions in the viewer at
http://localhost:3113or viaGET /agentmemory/export.Behavior
The bridge maps Codex events to agentmemory observations:
SessionStart/agentmemory/session/start, optionally injects recalled contextUserPromptSubmitprompt_submitobservationPreToolUsepre_tool_useobservationPostToolUsepost_tool_useobservationStopstopobservationThe bridge truncates large tool outputs and never throws or blocks Codex if agentmemory is down.
Validation
node --check integrations/codex/agentmemory-codex-hook.mjsUserPromptSubmitpayload.GET /agentmemory/export.Notes
Codex hooks currently expose fewer lifecycle events than the Claude Code plugin, so this is not a byte-for-byte replacement. It does cover the main loop users need: automatic capture, session registration, startup context recall, and explicit MCP memory tools.
Summary by CodeRabbit
Documentation
New Features
Tests
Local branch:
Fork PR:
Fork decision:
Verification:
Notes: