Codex Plugin
Automatically save conversation facts and inject context into prompts.
Installation
npx @audaxic/memory-codex install
This will:
- Prompt for your Audaxic API key (saved to
~/.config/audaxic/config.json) - Copy hook scripts to
~/.codex/audaxic/ - Register hooks in
~/.codex/hooks.json
Get your API key from: memory-dashboard.audaxic.com
How It Works
The installer registers two Codex CLI hooks:
UserPromptSubmit → recall.js
When you submit a prompt, this hook:
- Buffers your prompt to
~/.codex/audaxic/buffer.json - Searches Audaxic Memory for relevant context (POST /search)
- Injects retrieved memories as
<audaxic_memory_context>into the agent
Stop → capture.js
When the agent finishes responding, this hook:
- Buffers the assistant's response to
~/.codex/audaxic/buffer.json - When the buffer reaches 30 messages, flushes to POST /add
- Persists to disk immediately so no messages are lost on crash
Architecture
┌──────────────────────────────────────────────────────────────┐
│ Codex CLI │
│ │
│ User types prompt │
│ │ │
│ ▼ │
│ UserPromptSubmit ──► recall.js │
│ │ ├─ buffer user prompt to disk │
│ │ └─ POST /search → inject context │
│ ▼ │
│ LLM responds │
│ │ │
│ ▼ │
│ Stop ──────────────► capture.js │
│ ├─ buffer assistant msg to disk │
│ └─ if buffer >= 30 → POST /add │
└──────────────────────────────────────────────────────────────┘
Environment Variable Alternative
Instead of the setup prompt, you can set the API key as an environment variable:
export AUDAXIC_API_KEY="ak_your_key_here"
The scripts check in this order:
AUDAXIC_API_KEYenvironment variable~/.config/audaxic/config.jsonconfig file
Uninstall
Remove the plugin by deleting the hook files:
# Remove hooks directory
rm -rf ~/.codex/audaxic/
# Remove hooks from ~/.codex/hooks.json
# (Edit the file and remove the Audaxic entries)
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
https://api.memory.audaxic.com/search | POST | Search memories for context injection |
https://api.memory.audaxic.com/add | POST | Save conversation messages in batch |
Behavioral Triggers
AUTO-SEARCH before:
- Making architectural decisions
- Adding new dependencies
- Fixing bugs (check for prior solutions)
- Starting new sessions (load preferences)
AUTO-SAVE after:
- User states a preference
- Decision with rationale made
- Complex bug fixed
- Project conventions learned
DO NOT save:
- Temporary state, debug info, secrets
Content Rules
- One fact per memory
- Natural language, not keywords
- Include reasoning, not just outcomes
- Be specific for better semantic matching
Lifecycle
Add → Search → Update (delete + re-add) → Delete (when obsolete)
Troubleshooting
Plugin not working
- Verify hooks are registered: Check
~/.codex/hooks.json - Verify API key is set:
cat ~/.config/audaxic/config.json - Check
~/.codex/audaxic/buffer.jsonfor unsent messages
Context not being injected
- Check that
recall.jsexists in~/.codex/audaxic/ - Verify API key is valid at memory-dashboard.audaxic.com
- Check network connectivity to
api.memory.audaxic.com
Messages not saving
- Check that
capture.jsexists in~/.codex/audaxic/ - Check
~/.codex/audaxic/buffer.jsonfor pending messages - Verify API endpoint is reachable