Skip to content

Documentation

OpenReflex docs

OpenReflex is an open-source plugin that helps AI coding agents learn from every task. It reuses what worked, catches failure loops while they happen, and keeps everything on your machine.

Install

OpenReflex needs Python 3.11 or newer. Install the CLI with pipx, uv or pip.

$pipx install openreflex

Then install it for your agent. Nothing is recorded until a project is enabled; openreflex install enables the project for you.

Set up your agent

CLI reference

CommandWhat it does
openreflex install <agent>Write hooks and MCP config for claude-code, codex, cursor or opencode, and enable the project. Add --dry-run to preview.
openreflex approveEnable capture for the current project (needed after a plugin install).
openreflex revokeDisable capture for the current project. Existing data is kept.
openreflex context "<task>"Preview the Execution Context a task would receive, without recording anything.
openreflex status [--json]Show what has been captured, reused and learned in this project.
openreflex doctorCheck the installation and show recent hook errors.
openreflex forget --yesDelete all captured data for the project.
openreflex benchmarkRun the simulated benchmark suite.
openreflex mcpStart the MCP server over stdio (used by agent configs).

MCP tools

The OpenReflex MCP server runs over stdio. Agent installs register it automatically; any other MCP client can add it:

{
  "mcpServers": {
    "openreflex": { "command": "openreflex", "args": ["mcp"] }
  }
}
ToolWhat it does
get_execution_contextRetrieve relevant past experience, scored candidate strategies, likely files and lessons for a task.
choose_pathDeclare the strategy the agent is following, so the outcome is compared against the right plan.
record_outcomeRecord a verified outcome, such as tests passing, with short evidence.
search_experienceSearch past tasks in the project by description.
explain_nodeShow an Experience Graph node and its relations.
project_insightsSummarise capture, reuse, outcomes and learning for the project.
approve_projectEnable the project, only when the user explicitly asks.

Privacy and data

  • Kept: tool names and categories, a fingerprint of each call's arguments, project-relative file paths, pass or fail, duration, output size, and a masked one-line error signature.
  • Never kept: file contents, command text, tool output, transcripts, or paths outside the project.
  • Prompts: stored as a task description of up to 1,000 characters, with keys and tokens redacted.
  • Location: ~/.openreflex/projects/<hash>/experience.sqlite3. Set OPENREFLEX_HOME to move it or OPENREFLEX_DISABLE=1 to turn capture off everywhere.

Troubleshooting

Nothing is being captured
Run openreflex doctor. Check the project is enabled (openreflex approve) and that the openreflex command is on your PATH.
Hooks seem to do nothing in Codex
Open /hooks in Codex and trust the OpenReflex entries; untrusted hooks do not run.
Where are hook errors logged?
In ~/.openreflex/logs/errors.log. Hooks never block your agent, so errors are recorded there instead of shown.
No context was injected
Context is only added when relevant past experience exists, so a new project starts silent.

Still stuck? Open an issue on GitHub.