diff --git a/apps/docs/docs.json b/apps/docs/docs.json index 5731c945..f33133ef 100644 --- a/apps/docs/docs.json +++ b/apps/docs/docs.json @@ -185,6 +185,7 @@ "integrations/openclaw", "integrations/claude-code", "integrations/opencode", + "integrations/codex", "integrations/hermes" ] } diff --git a/apps/docs/integrations/codex.mdx b/apps/docs/integrations/codex.mdx new file mode 100644 index 00000000..69049e33 --- /dev/null +++ b/apps/docs/integrations/codex.mdx @@ -0,0 +1,141 @@ +--- +title: "OpenAI Codex" +sidebarTitle: "OpenAI Codex" +description: "codex-supermemory — persistent memory for OpenAI Codex CLI" +icon: "terminal" +--- + + +This integration requires the **Supermemory Pro plan**. [Upgrade here](https://console.supermemory.ai/billing). + + +[codex-supermemory](https://github.com/supermemoryai/codex-supermemory) wires Supermemory into the [OpenAI Codex CLI](https://github.com/openai/codex) via its hooks system. Your agent automatically recalls relevant context before each prompt and captures the conversation after each session — no slash commands required. + +## Get Your API Key + +Create a Supermemory API key from the [API Keys](https://console.supermemory.ai/keys) page, then export it in your shell profile: + + + + ```bash + echo 'export SUPERMEMORY_CODEX_API_KEY="sm_..."' >> ~/.zshrc + source ~/.zshrc + ``` + + + ```bash + echo 'export SUPERMEMORY_CODEX_API_KEY="sm_..."' >> ~/.bashrc + source ~/.bashrc + ``` + + + ```powershell + [System.Environment]::SetEnvironmentVariable("SUPERMEMORY_CODEX_API_KEY", "sm_...", "User") + ``` + Restart your terminal after running this. + + + +## Install the Plugin + +```bash +npx codex-supermemory@latest install +``` + +This command: +- Copies hook scripts to `~/.codex/supermemory/` +- Enables `codex_hooks = true` in `~/.codex/config.toml` +- Registers `UserPromptSubmit` (recall) and `Stop` (capture) hooks in `~/.codex/hooks.json` + +Restart Codex CLI after installing. + +## How It Works + +Once installed, the plugin runs automatically on every Codex session: + +- **Recall** — Before each prompt, relevant memories and your user profile are fetched from Supermemory and injected as additional context. +- **Capture** — After each session ends, the conversation transcript is ingested into Supermemory, scoped to the current project and user. +- **Privacy** — Content wrapped in `...` tags is redacted before storage. + +### Memory Scopes + +Memories are tagged with two container tags per session: + +| Tag | Format | Description | +|-----|--------|-------------| +| User | `codex_user_{sha256}` | Memories shared across all your projects | +| Project | `codex_project_{sha256}` | Memories scoped to the current working directory | + +## Verify Installation + +```bash +npx codex-supermemory status +``` + +Expected output when everything is configured: + +``` +codex-supermemory status: + + API key: ✓ set (SUPERMEMORY_CODEX_API_KEY) + Hook scripts: ✓ installed at ~/.codex/supermemory + hooks.json: ✓ registered + config.toml: ✓ exists + +All good! Memory is active. +``` + +## Uninstall + +```bash +npx codex-supermemory uninstall +``` + +This removes the hook registrations from `~/.codex/hooks.json` and disables `codex_hooks` in `~/.codex/config.toml`. Your existing memories in Supermemory are preserved. + +## Configuration + +Create `~/.codex/supermemory.json` to override defaults: + +```json +{ + "apiKey": "sm_...", + "similarityThreshold": 0.6, + "maxMemories": 5, + "maxProfileItems": 5, + "injectProfile": true, + "containerTagPrefix": "codex", + "debug": false +} +``` + +| Option | Default | Description | +|--------|---------|-------------| +| `apiKey` | — | API key (overrides env var) | +| `similarityThreshold` | `0.6` | Minimum match score for recall (0–1) | +| `maxMemories` | `5` | Max memories injected per prompt | +| `maxProfileItems` | `5` | Max profile facts injected per prompt | +| `injectProfile` | `true` | Include user profile in context | +| `containerTagPrefix` | `"codex"` | Prefix for container tags | +| `debug` | `false` | Write debug logs to `~/.codex-supermemory.log` | + +## Logging + +Enable debug logging to trace hook activity: + +```bash +export SUPERMEMORY_DEBUG=true +tail -f ~/.codex-supermemory.log +``` + +## Next Steps + + + + Source code, issues, and detailed README. + + + + Memory plugin for Claude Code. + +