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.

The OpenReflex execution loop

The product behaviour is the same in every supported coding agent. Only the installation and hook transport differ.

01

Retrieve

Find similar past tasks, successful files and reusable lessons from local project memory.

02

Route

Score candidate approaches and recommend the best fit for success, cost, risk, uncertainty and the current budget.

03

Observe

Watch tool calls, verification, failures, context growth and progress, then intervene when the current path degrades.

04

Learn

Verify the outcome, record path, cost and regret, then turn successful resolutions into evidence for the next similar task.

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 come from the exit code when Codex reports one, and otherwise from test, lint, build and shell errors in the output.
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.
  • Codex is verified in live codex exec sessions by OpenReflex's end-to-end test suite: capture, context delivery, the failure-loop alert and the MCP tools.

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.