codex

A setup guide for connecting Code Context Engine to OpenAI's Codex CLI, a command-line coding agent. It explains how to register the tool for each project in Codex's global configuration and add instructions for code exploration.

In plain words
What is it for?
Use it to configure Codex for a project, direct it to use context search during code exploration, and remove only that project's registration when uninstalling.
Why use it?
It makes Code Context Engine available to Codex while keeping multiple projects separate in one configuration file. It also preserves your existing agent instructions during updates.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/elara-labs/code-context-engine/codex
Clone the repo
git clone --depth 1 https://github.com/elara-labs/code-context-engine
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 769 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00012 $0.00769
Opus 5 $0.00006 $0.00385
Sonnet 5 $0.00002 $0.00154
Haiku 4.5 $0.00001 $0.00077

Measured yesterday against content hash c70c0ae984b8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

codex scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

cat ~/.codex/config.toml | grep cce
docs-src/src/content/docs/agents/codex.md · 90 lines

How it starts

The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codex CLI uses a global configuration file rather than per-project MCP config. CCE registers itself in the user-level config with a project-specific section.

Quick setup

cce init --agent codex

Or let CCE auto-detect (if ~/.codex/ exists or the VS Code OpenAI extension is installed):

cce init

Files created

~/.codex/config.toml

Codex CLI reads MCP servers from this single user-global file. CCE adds one section per project, keyed by a slug derived from the project's absolute path:

[mcp_servers.cce-my-project-a3f2b1]
command = "cce"
args = ["serve", "--project-dir", "/path/to/your/project"]

Multiple projects coexist in the same file. Each gets a unique section name (cce-<basename>-<hash>) so two projects named "api" in different directories won't collide.

AGENTS.md

Contains instructions for Codex to use context_search for code exploration. The CCE block is wrapped in markers so your own content is preserved during upgrades.

Important notes

  • Codex CLI does not support per-project .mcp.json files. The global ~/.codex/config.toml is the only location for MCP server registration.
  • Running cce uninstall removes only the section for the current project.
  • If you're using Codex via the VS Code extension (not the CLI), CCE detects it by looking for openai.* directories under ~/.vscode/extensions/.

Verify it's working

  1. After cce init, start a new Codex session in your project directory
  2. Ask a code question:
How does error handling work in this project?
  1. Check that Codex calls context_search in the tool output
  2. Verify savings:
cce savings

Cross-agent memory

Decisions recorded during Claude Code sessions (record_decision) are stored in the project's memory.db and shared across all agents. If you switch between Claude Code and Codex on the same project, session_recall returns decisions from both.

Troubleshooting

"cce: command not found" in Codex

Read the full file on GitHub · 90 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 90 lines · 12 tokens per session scan B c70c0ae984b8

Subscribe to this mod's changes

codex is an agent published in the GitHub repository elara-labs/code-context-engine (407 stars, last pushed 8d ago), licensed MIT. It adds 12 tokens to every session and 769 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.