Codex Integration
MemoryLayer for Codex (memorylayer-codex-plugin, new in 0.2.0) connects Codex to MemoryLayer through the MemoryLayer MCP server. It adds a Codex skill that tells the agent when to recall prior context and when to store durable memories.
Unlike the Claude Code plugin, it has no lifecycle hooks or slash commands. It uses Codex-native skills plus MCP configuration instead. It shares the memorylayer-mcp command and the MEMORYLAYER_* environment variables with the Claude Code plugin.
What It Provides
- MCP server configuration: Registers the
memorylayerMCP server (thememorylayer-mcpcommand), so Codex gets the MemoryLayer tools (28 in the defaultccprofile) - The
memorylayerskill: Guidance for recall, durable memory capture, sessions, and context-environment workflows - Shared configuration: Uses the same environment variables as the Claude Code plugin
Prerequisites
-
A running MemoryLayer server, usually at
http://localhost:61001:Terminal window pip install memorylayer-servermemorylayer serve -
The
memorylayer-mcpcommand on yourPATH:Terminal window npm install -g @scitrera/memorylayer-mcp-server -
Optional environment variables:
Terminal window export MEMORYLAYER_URL="http://localhost:61001"export MEMORYLAYER_API_KEY="" # optional for local/open deploymentsexport MEMORYLAYER_WORKSPACE_ID="" # optional; auto-detected from the repo when empty
Installation
The Codex plugin is a plugin folder, not an npm package, and has no publish step. It lives in the MemoryLayer repository at memorylayer-codex-plugin/:
git clone https://github.com/scitrera/memorylayer.gitInstall the memorylayer-codex-plugin folder with Codex’s plugin mechanism. The folder layout is:
| Path | Purpose |
|---|---|
.codex-plugin/plugin.json | Codex plugin manifest (memorylayer-codex-plugin, displayed as “MemoryLayer for Codex”). Points at ./skills/ and ./.mcp.json |
.mcp.json | MemoryLayer MCP server configuration |
skills/memorylayer/SKILL.md | The memorylayer skill |
The bundled .mcp.json launches memorylayer-mcp and passes the environment through with defaults:
{ "mcpServers": { "memorylayer": { "command": "memorylayer-mcp", "env": { "MEMORYLAYER_URL": "${MEMORYLAYER_URL:-http://localhost:61001}", "MEMORYLAYER_API_KEY": "${MEMORYLAYER_API_KEY:-}", "MEMORYLAYER_WORKSPACE_ID": "${MEMORYLAYER_WORKSPACE_ID:-}" } } }}The memorylayer Skill
The skill activates when Codex should recall or store durable project context, keep decisions across sessions, use the MemoryLayer MCP tools, or troubleshoot MemoryLayer setup. It tells Codex to:
- Prefer workspace-scoped memories: respect
MEMORYLAYER_WORKSPACE_IDwhen it’s set, and otherwise let the MCP server auto-detect the workspace from the repo - Recall before substantial work: call
memory_recallormemory_briefingbefore broad reviews, architecture work, implementation in an unfamiliar subsystem, or recall requests - Store only durable, non-secret information: user directives, decisions with rationale, solved bugs, architecture tradeoffs, reusable workflows, and important task state
- Never store secrets: credentials, API keys, private tokens, and raw confidential payloads stay out. Sensitive context is summarized at a safe level of abstraction
- Degrade gracefully: if the MCP tools are unavailable, say MemoryLayer is not connected and continue from the local repository
Suggested tool use
| Tool | When |
|---|---|
memory_briefing | Start of a large task or review |
memory_recall | Preferences, prior decisions, subsystem history, or repeated bug/error work |
memory_remember | Right after a decision, bug fix, benchmark result, architecture conclusion, or user directive |
memory_session_start, memory_session_commit, memory_session_end | Long-running agent work whose working memory should survive handoffs |
memory_context_* | Server-side sandbox analysis that should survive context compaction or resume after a long investigation |
The skill also asks Codex to mention memory-backed context only when it materially affects the answer. The repository and its tests stay the source of truth for how the code currently behaves.
Differences from the Claude Code Plugin
| Claude Code plugin | Codex plugin | |
|---|---|---|
| MCP server | memorylayer-mcp | memorylayer-mcp |
| Lifecycle hooks (pre-compaction capture, context packs, observation capture) | Yes | No |
| Slash commands | Yes | No |
| Agent guidance | Hooks + optional CLAUDE.md protocol | memorylayer skill |
Because Codex has no MemoryLayer hooks, nothing is captured automatically before compaction. The skill has the agent store durable results explicitly, and it can call memory_session_commit or memory_session_checkpoint itself.
Troubleshooting
- Tools not available: check that
memorylayer-mcpis on yourPATH(which memorylayer-mcp) and the server is reachable (curl http://localhost:61001/health). - Wrong workspace: set
MEMORYLAYER_WORKSPACE_IDexplicitly.
Related Pages
- MCP Server: tool reference, profiles, and environment variables
- Claude Code: the hook-based plugin for Claude Code
- Skills & MCP Servers