Skip to content

Integration guide

OpenReflex for OpenAI Codex CLI

OpenReflex connects to Codex through its hooks and MCP support. Lessons learned in any agent working on the project, including Claude Code, are offered to Codex before a similar task starts.

What OpenReflex adds to Codex

Shared project memory

Codex reads from the same local Experience Graph as your other agents, so a fix found elsewhere is not rediscovered.

Failure loops caught

Codex reports failures inside tool results; OpenReflex reads exit codes from them and alerts when a loop forms.

Private by design

Only tool categories, project-relative paths, pass or fail and masked error lines are kept.

Install OpenReflex for Codex

  1. 1

    Install the OpenReflex CLI (Python 3.11 or newer)

    $pipx install openreflex
  2. 2

    Write hooks to .codex/hooks.json and the MCP server to .codex/config.toml

    $openreflex install codex
  3. 3

    Open /hooks in Codex once and trust the OpenReflex entries

Install as a Codex plugin instead

  1. 1

    Install the OpenReflex CLI (Python 3.11 or newer)

    $pipx install openreflex
  2. 2

    Add the plugin marketplace, then enable the plugin in Codex

    $codex plugin marketplace add vishnu-77/openreflex
  3. 3

    Enable each project

    $openreflex approve

Check the setup any time with openreflex doctor. Nothing is recorded until a project is enabled.

How it works in Codex

Hook eventWhat OpenReflex does
UserPromptSubmitStarts a task and injects the Execution Context when relevant experience exists.
PreToolUse / PostToolUseRecords each tool call; failures are detected from the exit code in the tool response.
PreCompactNotes context compaction.
Stop / SessionEndWorks out the outcome and stores lessons.
  • Codex asks you to trust new hooks once. Until then, the hooks do not run.
  • The Codex integration follows Codex's documented hook protocol and is covered by OpenReflex's protocol and fuzz tests.

Common questions

Can Codex use lessons learned in Claude Code?
Yes. All agents in a project share one local Experience Graph.
Where is the data stored?
In ~/.openreflex/projects/<hash>/experience.sqlite3 on your machine.

Other integrations

Full CLI and MCP reference in the docs, and the source on GitHub.