Overview
Codex integrates with CEMS via:- MCP server (stdio) in
config.toml - 3 commands for recall, remember, and foundation guidelines
- 2 skills for advanced recall and remember workflows
What Gets Installed
When you runcems setup --codex, the installer creates:
Shared Configuration
MCP Configuration
The installer adds this block to~/.codex/config.toml:
- Uses
stdiotransport (requirespip install cems) - Credentials passed via environment variables
- 300 second timeout for long-running queries
Commands
/recall
File:~/.codex/commands/recall.md
Purpose: Search memories for relevant information from past sessions
Usage:
$ARGUMENTS- The search query (natural language)
--limit N(default: 5) - Maximum results to return--scope(default: both) -personal,shared, orboth
-
Parse the arguments to extract:
--limit <N>if provided (default: 5)--scope <personal|shared|both>if provided (default: “both”)- The remaining text is the search query
-
Detect the current project from the working directory:
- Run
git remote get-url originto extractorg/repoformat - SSH:
[email protected]:org/repo.git→org/repo - HTTPS:
https://github.com/org/repo.git→org/repo - Pass this as the
projectparameter to boost same-project results
- Run
-
Search via MCP:
-
For truncated results, fetch the full document:
-
Present results in a clear format:
/recall hook development
Codex should:
- Detect project from git remote (e.g., “Chocksy/cems”)
- Call
memory_searchwith query=“hook development”, max_results=5, project=“Chocksy/cems” - Format and display results
/remember
File:~/.codex/commands/remember.md
Purpose: Store memories with project context, categories, and tags
Usage:
$ARGUMENTS- The content to remember
--scope(default: personal) -personalorshared--category(default: general) -preferences,conventions,architecture,decisions,workflow,errors,learnings, orgeneral--tags(optional) - Comma-separated tags
-
Parse the arguments to extract:
--scope <personal|shared>if provided (default: “personal”)--category <category>if provided (default: “general”)--tags <tag1,tag2>if provided- The remaining text is the content to remember
-
Detect the current project from git remote (same as
/recall) -
Store via MCP:
-
Confirm storage:
/remember --category workflow Deployment uses Coolify with Docker Compose
Codex should:
- Detect project from git remote
- Call
memory_addwith content=“Deployment uses Coolify with Docker Compose”, scope=“personal”, category=“workflow”, source_ref=“project:Chocksy/cems” - Display confirmation
- User preferences and style choices
- Project conventions and naming patterns
- Architecture and infrastructure decisions
- Debugging insights and solutions to recurring problems
- Workflow patterns and deployment processes
- Session-specific context (current task, temporary state)
- Information already in the codebase
- Build output or error messages being debugged right now
- Speculative conclusions from a single observation
/foundation
File:~/.codex/commands/foundation.md
Purpose: Display foundation guidelines for the current project
Usage:
- Detect current project from git remote
- Fetch via MCP (or direct API call to
/api/memory/foundation?project=org/repo) - Display formatted guidelines:
Skills
recall
File:~/.codex/skills/recall/SKILL.md
Purpose: Advanced memory search workflow with project-scoped boosting
When to use:
Agent invokes this skill when:
- User asks to recall something
- Agent needs context before starting work
- User says “what do we know about…”
-
Detect the current project from the working directory:
- Run
git remote get-url originto extractorg/repoformat - SSH:
[email protected]:org/repo.git→org/repo - HTTPS:
https://github.com/org/repo.git→org/repo
- Run
- Formulate a natural language query
-
Call
memory_searchwith appropriate parameters (always includeproject): -
If any results are truncated, use
memory_getto fetch the full content: - Use the results to inform your work
| Parameter | Default | Purpose |
|---|---|---|
query | (required) | Natural language search query |
scope | "both" | "personal", "shared", or "both" |
max_results | 10 | Maximum results (1-20) |
max_tokens | 4000 | Token budget for results |
enable_graph | true | Include related memories via graph traversal |
enable_query_synthesis | true | Expand query with LLM for better retrieval |
raw | false | Debug mode: bypass relevance filtering |
project | (auto-detect) | Project ID (org/repo) — always pass this to boost same-project results |
- Always pass
project— auto-detect from git remote to filter cross-project noise - Use natural language: “how do we handle authentication” > “auth”
- Be specific: “Python backend database conventions” > “conventions”
- The system uses semantic matching, not just keywords
- Results include relevance scores and time decay ranking
remember
File:~/.codex/skills/remember/SKILL.md
Purpose: Store memories with project context and categories
When to use:
Agent invokes this skill when:
- User says “remember this”
- Agent discovers something worth persisting
- User makes a decision that should be recorded
- Determine the content to store
-
Choose the appropriate scope:
personal(default) — only you see itshared— visible to the whole team
-
Pick a category:
preferences,conventions,architecture,decisions,workflow,errors,learnings, orgeneral -
Detect the current project from git remote for scoped recall:
- Run
git remote get-url originto extractorg/repoformat - SSH:
[email protected]:org/repo.git→org/repo - HTTPS:
https://github.com/org/repo.git→org/repo - Pass as
source_ref: "project:org/repo"
- Run
-
Call
memory_add:
Setup Verification
1. Check MCP config
2. Check commands
3. Check skills
4. Check credentials
5. Test MCP connection
6. Test in Codex
Start Codex and type:How It Works
User runs /recall command
- Codex parses arguments (query, —limit, —scope)
- Detects project from git remote
- Calls
memory_searchMCP tool with project parameter - Displays results
- For truncated results, calls
memory_getto fetch full content
User runs /remember command
- Codex parses arguments (content, —scope, —category, —tags)
- Detects project from git remote
- Calls
memory_addMCP tool with source_ref=“project:org/repo” - Displays confirmation
User runs /foundation command
- Detects project from git remote
- Fetches foundation guidelines from API or MCP
- Displays formatted guidelines
MCP Tools
CEMS exposes these MCP tools to Codex (same as Cursor):memory_search- Search memories with semantic retrievalmemory_add- Store a memory (personal or shared scope)memory_get- Fetch full memory by IDmemory_forget- Archive or delete a memorymemory_update- Update an existing memorymemory_maintenance- Run consolidation, summarization, or reindex jobs
Troubleshooting
Commands not appearing
- Check files exist:
ls ~/.codex/commands/ - Restart Codex
- Type
/and look forrecall,remember,foundation
MCP connection failed
- Check
cems-mcpis installed:which cems-mcp - Install if missing:
pip install cemsoruv tool install cems - Test manually:
cems-mcp(should start stdio server) - Check credentials in
~/.codex/config.toml
No search results
- Test CLI:
cems search "test query" - Check server connection:
cems health - Verify credentials:
cat ~/.cems/credentials - Check server logs if self-hosting
Skills not invoked
- Verify files exist:
ls ~/.codex/skills/*/SKILL.md - Try explicit invocation: “Use the recall skill to search for X”
- Restart Codex
Advanced Configuration
Custom MCP timeout
Edit~/.codex/config.toml:
Self-hosted server
Edit~/.codex/config.toml:
Team memory
Add team header (if supported by your server):Differences from Claude Code
Codex has a lighter integration compared to Claude Code:| Feature | Claude Code | Codex |
|---|---|---|
| Hooks | 6 (session start, prompt, pre/post tool use, stop, compact) | 0 |
| Skills | 6 (recall, remember, share, forget, context, guide) | 2 (recall, remember) |
| Commands | 2 (recall, remember) | 3 (recall, remember, foundation) |
| Auto context injection | Yes (every prompt) | No (manual commands) |
| Observer daemon | Yes | No |
| Gate rules | Yes | No |
Next Steps
- Claude Code Integration - Full hook-based integration
- Cursor Integration - MCP + hooks + skills
- Goose Integration - MCP-only extension