Prerequisite: Install the
engram binary first via Homebrew or binary download.One-Command Setup (Recommended)
- Registers
[mcp_servers.engram]in~/.codex/config.toml(Windows:%APPDATA%\codex\config.toml) - Writes
~/.codex/engram-instructions.mdwith the Engram Memory Protocol - Writes
~/.codex/engram-compact-prompt.mdfor compaction recovery
What Gets Configured
MCP Server Registration
Adds to~/.codex/config.toml:
Memory Protocol Instructions
Writes to~/.codex/engram-instructions.md:
Compaction Recovery Prompt
Writes to~/.codex/engram-compact-prompt.md:
Manual Setup (Alternative)
If you prefer to configure manually:Add MCP Server
Edit~/.codex/config.toml (Windows: %APPDATA%\codex\config.toml):
Add Memory Protocol
Create~/.codex/engram-instructions.md and copy the Memory Protocol from DOCS.md.
Then point to it in config.toml:
Add Compaction Recovery
Create~/.codex/engram-compact-prompt.md:
config.toml:
Compaction Recovery
Codex usesexperimental_compact_prompt_file to inject instructions after compaction.
When Codex compacts (summarizes long conversations), it:
- Generates a compacted summary
- Injects the content of
engram-compact-prompt.md - The new agent reads: “FIRST ACTION REQUIRED: Call
mem_session_summary…” - The agent saves the summary to engram, preserving work from before compaction
Platform-Specific Notes
Windows
engram setup codex writes to:
- MCP config:
%APPDATA%\codex\config.toml - Instructions:
%APPDATA%\codex\engram-instructions.md - Compaction prompt:
%APPDATA%\codex\engram-compact-prompt.md
macOS / Linux
engram setup codex writes to:
- MCP config:
~/.codex/config.toml - Instructions:
~/.codex/engram-instructions.md - Compaction prompt:
~/.codex/engram-compact-prompt.md
Memory Protocol Behavior
With the Memory Protocol inengram-instructions.md, the agent:
- Saves proactively after bugfixes, decisions, discoveries, patterns
- Searches reactively when you say “remember” or “what did we do”
- Searches proactively when starting work that might overlap past sessions
- Closes sessions with
mem_session_summarybefore saying “done” - Recovers state after compaction via
experimental_compact_prompt_file
Troubleshooting
MCP tools not available
Check MCP server registration:Agent doesn’t use memory
Check that instruction files exist:Server not running
Manually start the server:Next Steps
- Learn about the Memory Protocol
- Explore MCP Tools
- Set up Git Sync for team memory sharing