Skip to main content
Connectors
Coding Agent
Codex

Codex

Native startup context and memory routing, bundled MCP retrieval and writes, plus automatic Codex thread capture.

Start with the setup prompt or connection guide. Open the guide for detailed steps.

Agent shortcut

Ask your agent to set it up

Copy the setup prompt. Your agent will open this guide, use the recommended path, and verify the setup.

Overview

Switch between Codex, Claude Code, Gemini, and Cursor without losing context. The recommended Codex setup is hybrid: SessionStart injects Context Bundle / Working Memory, a compact prompt hook routes historical work to Nowledge search, bundled MCP handles retrieval and writes, and Stop captures real Codex threads. Codex desktop app and Codex CLI share the same ~/.codex configuration, so the same connector applies to both. If you use remote Mem or a custom local port, override the bundled MCP server in Codex config.

Setup

Command
codex plugin marketplace add nowledge-co/community --sparse .agents --sparse nowledge-mem-codex-plugin
codex plugin add nowledge-mem@nowledge-community

Legacy Codex fallback:

Command
codex marketplace add nowledge-co/community

If your Codex build does not expose codex plugin add, open /plugins and install nowledge-mem@nowledge-community from there.

Use the sparse marketplace command when your Codex build supports it. Codex only pulls the marketplace metadata and the Codex plugin package instead of cloning the whole community repository, which avoids 30-second clone timeouts on slower networks.

Then enable the plugin in ~/.codex/config.toml:

TOML
[features]
plugins = true
hooks = true

[plugins."nowledge-mem@nowledge-community"]
enabled = true

Enable lifecycle context and automatic thread capture:

Command
HOOK_SETUP="$(find ~/.codex/plugins/cache -path '*/nowledge-mem/*/scripts/install_hooks.py' -print 2>/dev/null | sort | tail -1)"
test -n "$HOOK_SETUP" && python3 "$HOOK_SETUP"

On Windows PowerShell, find the same installed script and run py -3 $HookSetup.FullName.

Current Codex loads SessionStart, UserPromptSubmit, and Stop hooks from enabled plugins automatically. Older builds used a separate plugin_hooks gate; setup detects that capability and adds the compatibility flag only when required. Restart Codex, then trust the three Nowledge Mem hooks in /hooks. The setup script also keeps the host-level Stop fallback for builds that still need it; duplicate capture sources are guarded so the same transcript state is not saved twice.

Restart Codex and ask "What was I working on?" to verify. The plugin includes the default local MCP endpoint.

Codex Local Memory

Codex local Memory can stay enabled, but turn off Settings → Personalization → Allow memory generation from tool-assisted tasks. The equivalent config is:

TOML
[memories]
disable_on_external_context = true

This keeps tasks that used Nowledge MCP, web search, or tool search out of Codex's separate memory generator. Codex local Memory remains a local hint; Nowledge Mem stays the source for current cross-tool context, exact threads, and sourced decisions. The connector reports an unsafe combination but never changes Codex Memory settings for you.

For remote Mem, configure nmem once and generate the Codex MCP override:

Command
nmem config client set url https://your-server
nmem config client set api-key your-key
nmem config mcp show --host codex

Update

If you installed the Codex package before 0.1.13, marketplace update alone may refresh the source checkout without replacing the installed package cache. Install or update the package with codex plugin add nowledge-mem@nowledge-community, or use Codex /plugins, then restart Codex and run the hook setup.

Command
(codex plugin marketplace remove nowledge-community || codex marketplace remove nowledge-community || true)
codex plugin marketplace add nowledge-co/community --sparse .agents --sparse nowledge-mem-codex-plugin
codex plugin add nowledge-mem@nowledge-community
HOOK_SETUP="$(find ~/.codex/plugins/cache -path '*/nowledge-mem/*/scripts/install_hooks.py' -print 2>/dev/null | sort | tail -1)"
test -n "$HOOK_SETUP" && python3 "$HOOK_SETUP"

This re-adds the marketplace with Codex sparse checkout. Older installs used a full clone; if Codex reports git clone marketplace source timed out after 30s or early EOF, this is the recovery path.

If the marketplace is not registered yet:

Command
codex plugin marketplace add nowledge-co/community --sparse .agents --sparse nowledge-mem-codex-plugin || codex marketplace add nowledge-co/community

Import Older Sessions

Command
nmem t sync --from codex --all-projects --limit 20
nmem t sync --from codex --all-projects --apply

Use -p /path/to/project instead of --all-projects when you only want one project.

Skills

  • Context Bundle / Working Memory: automatic SessionStart bootstrap
  • Search: strongest when the Codex package is paired with MCP
  • Save thread: Stop hook imports the real Codex transcript; the skill remains the manual fallback
  • Distill: stronger when Codex can choose MCP memory-write tools directly
  • Status: check connectivity

More Coding Agent Connectors