Integration guide
OpenReflex for Cursor
OpenReflex uses Cursor's agent hooks and MCP support to learn from each task in your project and bring what worked into the next one.
The OpenReflex execution loop
The product behaviour is the same in every supported coding agent. Only the installation and hook transport differ.
Retrieve
Find similar past tasks, successful files and reusable lessons from local project memory.
Route
Score candidate approaches and recommend the best fit for success, cost, risk, uncertainty and the current budget.
Observe
Watch tool calls, verification, failures, context growth and progress, then intervene when the current path degrades.
Learn
Verify the outcome, record path, cost and regret, then turn successful resolutions into evidence for the next similar task.
Install OpenReflex for Cursor
- 1
Install the OpenReflex CLI (Python 3.11 or newer)
$pipx install openreflex - 2
Write hooks to .cursor/hooks.json and the MCP server to .cursor/mcp.json
$openreflex install cursor
Check the setup any time with openreflex doctor. Nothing is recorded until a project is enabled.
How it works in Cursor
| Hook event | What OpenReflex does |
|---|---|
| beforeSubmitPrompt | Starts a task; the Execution Context is held until the first tool result. |
| preToolUse / postToolUse | Records each tool call and returns context or alerts after it. |
| postToolUseFailure | Records the failure and a masked error signature. |
| stop / sessionEnd | Works out the outcome and stores lessons. |
- OpenReflex never grants or denies tool permissions in Cursor; it only observes and advises.
- The Cursor integration follows Cursor's documented hook protocol and is covered by OpenReflex's protocol and fuzz tests.
Common questions
- Why does context appear after the first tool call?
- Cursor's beforeSubmitPrompt hook cannot inject context, so the first tool result is the earliest point OpenReflex can reach the model.
- Does it work with other agents in the same repo?
- Yes. Cursor shares one local Experience Graph with Claude Code, Codex and OpenCode.
Other integrations
Full CLI and MCP reference in the docs, and the source on GitHub.