Skip to content

Integration guide

OpenReflex for Claude Code

OpenReflex plugs into Claude Code's lifecycle hooks and MCP. It records how each task went, hands the next similar task what worked, and interrupts only when Claude is stuck retrying the same failing step. Everything stays in a local SQLite file.

What OpenReflex adds to Claude Code

Context before the first tool call

Similar past tasks, the files that mattered and known fixes arrive as additional context when you submit a prompt.

Loop alerts while it works

Repeated failing commands, identical retries or stalled progress raise one specific alert with a different approach to try.

Lessons checked by your tests

A task only counts as a success when a test, lint or build passes after the last edit, so guesses never become advice.

Install OpenReflex for Claude Code

  1. 1

    Install the OpenReflex CLI (Python 3.11 or newer)

    $pipx install openreflex
  2. 2

    Add the OpenReflex plugin marketplace

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

    Install the plugin

    $claude plugin install openreflex@openreflex
  4. 4

    Enable it in each project you want it to learn from

    $openreflex approve

Prefer project settings over a plugin?

  1. 1

    Install the OpenReflex CLI (Python 3.11 or newer)

    $pipx install openreflex
  2. 2

    Write hooks to .claude/settings.json and the MCP server to .mcp.json

    $openreflex install claude-code

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

How it works in Claude Code

Hook eventWhat OpenReflex does
UserPromptSubmitStarts a task and injects the Execution Context when relevant experience exists.
PreToolUse / PostToolUseRecords each tool call's category, files and result; alerts are returned as additional context.
PostToolUseFailureRecords the failure and a masked, one-line error signature.
PreCompactNotes context compaction, a signal of runaway context growth.
Stop / SessionEndWorks out the outcome and stores lessons from the task.
  • The MCP server adds tools Claude can call directly: get_execution_context, choose_path, record_outcome, search_experience, explain_node and project_insights.
  • Claude Code is verified in live, headless sessions by OpenReflex's end-to-end test suite.

Common questions

Does OpenReflex send my code or conversation to a model?
No. It learns deterministically from hook metadata and never stores file contents, commands, tool output or transcripts.
Will it slow Claude Code down?
Each hook is a short local process that always exits cleanly and never blocks Claude, even if something goes wrong.
How do I turn it off?
Run openreflex revoke in the project, or set OPENREFLEX_DISABLE=1 to disable capture everywhere.

Other integrations

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