Native Remnic plugin for OpenAI Codex CLI. Provides automatic memory recall, observation, and session-end learning capture.
remnic connectors install codex-cliThis:
- Starts the Remnic daemon if not running
- Generates a dedicated auth token
- Installs the plugin to
~/.codex/plugins/ - Enables hooks (
[features] codex_hooks = truein~/.codex/config.toml) - Configures MCP server pointing to Remnic
- Drops the Codex memory extension at
~/.codex/memories_extensions/remnic/instructions.md - Runs a health check
| Hook | When | What Happens |
|---|---|---|
SessionStart |
Session begins | Recalls project context + user preferences |
UserPromptSubmit |
Every user message | Recalls memories relevant to the prompt |
PostToolUse |
After Bash execution | Observes command results and file changes |
Stop |
Session ends | Flushes session learnings to EMO |
Skills ship as packages/plugin-codex/skills/<slug>/SKILL.md folders and are
materialized into ~/.codex/memories/skills/<slug>/SKILL.md by the Codex
materializer.
| Skill folder | Description |
|---|---|
remnic-memory-workflow/ |
Umbrella workflow: recall, observe, remember. |
remnic-recall/ |
Search memories by natural-language query. |
remnic-remember/ |
Store a durable memory for cross-agent recall. |
remnic-search/ |
Full-text search across all stored memories. |
remnic-entities/ |
Browse entities in the Remnic knowledge graph. |
remnic-status/ |
Check Remnic daemon and memory system health. |
All 44 Remnic MCP tools are available via the .mcp.json configuration. The legacy engram.* aliases remain available during v1.x.
Codex ships a phase-2 memory consolidation sub-agent that looks for
extensions under a folder that is a sibling of <codex_home>/memories/.
From Codex's memories module:
MEMORIES_SUBDIR = "memories"EXTENSIONS_SUBDIR = "memories_extensions"memory_extensions_root()is computed via Rust'sPath::with_file_name("memories_extensions"), so the extensions live at<codex_home>/memories_extensions/— NOT inside<codex_home>/memories/.
remnic connectors install codex-cli copies the contents of
packages/plugin-codex/memories_extensions/remnic/ (notably
instructions.md) into that sibling location atomically. The write goes
to a temporary folder first and is then renamed into place, so a concurrent
Codex consolidation run never observes a half-written extension.
When Codex phase-2 runs, its sandboxed consolidation sub-agent reads
instructions.md via filesystem tools — no MCP, no network, no remnic
CLI invocation. The instructions teach the sub-agent how to locate Remnic
memory files on disk (~/.remnic/memories/<namespace>/…), how to resolve
the namespace from the session's cwd, when to consult Remnic and when to
skip it, and how to cite Remnic sources with <oai-mem-citation /> blocks.
| Env | Location |
|---|---|
| default | ~/.codex/memories_extensions/remnic/ |
$CODEX_HOME=/foo |
/foo/memories_extensions/remnic/ |
codex.codexHome config |
<codexHome>/memories_extensions/remnic/ |
The extension directory is scoped to remnic/. Adjacent extensions under
memories_extensions/ (from other vendors) are never read, overwritten,
or removed by remnic connectors install|remove codex-cli.
Users who self-manage Codex memory extensions can disable this behavior
via the codex.installExtension config flag:
When installExtension is false, remnic connectors install codex-cli
still installs MCP and hooks but does not touch memories_extensions/.
- Stop hook: Codex has a
Stopevent that fires when the agent completes its turn. The plugin uses this to flush any remaining observations and store session learnings — ensuring nothing is lost even if the session ends abruptly. - PostToolUse matcher: Matches
Bash(Codex's primary tool) instead ofWrite|Edit|MultiEdit. - Hooks feature flag: Codex hooks require
[features] codex_hooks = true— the installer sets this automatically. - Config format: TOML (
~/.codex/config.toml) instead of JSON.
Token is read from ~/.remnic/tokens.json, with ~/.engram/tokens.json still accepted as a migration fallback. Server defaults to 127.0.0.1:4318.
Same as Claude Code plugin — see claude-code.md.
Additional Codex-specific issue:
Verify hooks are enabled:
grep codex_hooks ~/.codex/config.toml
# Should show: codex_hooks = trueCodex CLI's phase-2 consolidation reads memories directly from files under
<codex_home>/memories/ — memory_summary.md (always-loaded),
MEMORY.md (searchable handbook, task-group schema), raw_memories.md, and
per-session rollout_summaries/*.md. Remnic can mirror its hot memories into
this exact layout so Codex's native read path picks up Remnic content with
zero MCP calls.
- Opt-in sentinel. Remnic will only write into a memories directory that
already contains a
.remnic-managedsentinel file. If the sentinel is missing, the materializer skips with a warning and never touches the directory — this preserves any hand-edits the user has made. Useremnic connectors install codex-cli(or drop a.remnic-managedfile yourself) to opt in. - Atomic writes. Every file is rendered under
<codex_home>/memories/.remnic-tmp/first and thenrename()-ed into place, so Codex never observes a half-written file. - Schema validation.
MEMORY.mdis validated against Codex's task-group schema before it is written. Invalid output throws — the materializer refuses to leave garbage on disk. - Idempotent no-ops. The sentinel stores a content hash of the last render. If the next run produces identical content, the materializer short-circuits with zero writes.
- Token budget.
memory_summary.mdis capped atcodexMaterializeMaxSummaryTokenswhitespace tokens (default4500), leaving headroom under Codex's 5000-token summary limit.
| Trigger | Config flag | Notes |
|---|---|---|
| Semantic / causal consolidation complete | codexMaterializeOnConsolidation (default true) |
Runs immediately after a consolidation pass finishes. |
Codex Stop / session-end hook |
codexMaterializeOnSessionEnd (default true) |
The session-end event of the unified hook runner (hooks/bin/remnic-codex-hook.cjs) invokes the packaged bin/materialize.cjs (dev fallback: scripts/codex-materialize.ts). |
| Manual | — | tsx scripts/codex-materialize.ts --reason manual |
Every knob is exposed via plugin config so users have maximum control:
| Key | Default | Description |
|---|---|---|
codexMaterializeMemories |
true |
Master switch — set false to disable all materialization. |
codexMaterializeNamespace |
"auto" |
Namespace to materialize. "auto" derives it from the connector context. |
codexMaterializeMaxSummaryTokens |
4500 |
Whitespace-tokenized cap for memory_summary.md. |
codexMaterializeRolloutRetentionDays |
30 |
Prune rollout summaries older than this window. |
codexMaterializeOnConsolidation |
true |
Run after semantic/causal consolidation completes. |
codexMaterializeOnSessionEnd |
true |
Run from the plugin-codex session-end hook. |
Set codexMaterializeMemories = false in your Remnic plugin config. The
materializer becomes a no-op immediately. Alternatively, delete the
.remnic-managed sentinel — Remnic will start warning and will not touch the
directory again until the sentinel is restored.
remnic connectors remove codex-cli
{ "remnic": { "codex": { "installExtension": false, "codexHome": null } } }