What is OpenReflex
OpenReflex gives AI coding agents muscle memory. It plugs into Claude Code, Codex, Cursor, and OpenCode through lifecycle hooks and MCP, quietly records how each task actually went, and hands the next similar task what worked before: the approach, the files that mattered, and the fix for the error you hit last time.
You install it once and keep working normally. Everything stays on your machine in a local SQLite database. There is no account, no service, and no telemetry.
Why OpenReflex
- It remembers what worked. Before a substantial task, OpenReflex retrieves similar past tasks and injects a compact Execution Context: a suggested approach with alternatives, the files that were changed, and lessons such as which edit resolved a recurring error.
- It catches loops while they happen. Repeated failing commands, identical retries, stalled progress, and runaway context growth raise a single, specific alert with an alternative path, never a stream of nags.
- It learns after every task. OpenReflex infers the outcome from real verification (a test or build that passed or failed after the last edit), estimates Execution Regret against the alternatives, and extracts lessons.
- It is private by design. Only coarse, project-relative metadata is stored. File contents, commands, tool output, and transcripts never are, and capture is off until you approve a project.
before a task during a task after a task
┌──────────────────────┐ ┌──────────────────────────┐ ┌───────────────────────┐
│ retrieve experience │ │ watch tool calls │ │ infer outcome │
│ score candidate paths│ → │ flag loops and stalls │ → │ estimate regret │
│ inject context │ │ suggest an alternative │ │ extract lessons │
└──────────────────────┘ └──────────────────────────┘ └───────────────────────┘
▲ │
└──────────────────── Experience Graph ◄─────────────────┘
Quick start
Requires Python 3.11 or newer.
pipx install openreflex # or: uv tool install openreflex
cd your-project
openreflex install claude-code # writes hooks + MCP config and enables this project
Then work as usual. After a few tasks:
openreflex context "fix the login redirect bug" # preview the context a task would receive
openreflex status # what has been captured and learned
openreflex doctor # installation checks and recent hook errors
Use it with your agent
OpenReflex installs per project with openreflex install <agent>, or as a plugin.
| Claude Code Plugin or hooks + MCP |
Codex Plugin or hooks + MCP |
Cursor Hooks + MCP |
OpenCode Plugin + MCP |
| Agent | Install |
|---|---|
| Claude Code | claude plugin marketplace add vishnu-77/openreflex and claude plugin install openreflex@openreflex, or openreflex install claude-code |
| Codex | codex plugin marketplace add vishnu-77/openreflex, or openreflex install codex, then trust the hooks once in /hooks |
| Cursor | openreflex install cursor |
| OpenCode | openreflex install opencode |
With a plugin install, enable each project with openreflex approve. Claude Code is verified in live sessions;
the Codex, Cursor, and OpenCode integrations follow each agent's documented hook protocol.
How it works
Hooks send lifecycle events (prompt, tool start, tool end, compaction, stop) to the OpenReflex engine, which stores them in an Experience Graph:
Task -caused-> Execution -used-> Context -used-> Experience
CandidatePath -recommended_for-> Task Lesson -recommended_for-> Task
Execution -failed_with-> ToolCall -resolved_by-> ToolCall
Execution -caused-> Outcome -caused-> Experience -caused-> Lesson
- Before a task: similar experiences are retrieved, three strategies (
inspect-first,test-first,incremental) are scored on success probability, time, tool calls, context cost, risk, uncertainty, and reversibility, and a context of at most 1,400 characters is injected. Nothing is injected without relevant experience. - During a task: each alert fires at most once per task with a cooldown, and names a concrete alternative.
- After a task: outcome and chosen path come from the agent's
record_outcome/choose_pathMCP calls when available, and are otherwise inferred from tool activity. Execution Regret is withheld when the outcome is unknown.
Agents can also query OpenReflex directly through its MCP server: get_execution_context, choose_path,
record_outcome, search_experience, explain_node, project_insights, and approve_project.
CLI
| Command | Purpose |
|---|---|
install <agent> [--dry-run] |
Write project hooks and MCP config, and enable the project |
approve / revoke |
Enable or disable capture for the current project |
context "<task>" |
Preview the Execution Context a task would receive |
status [--json] |
What has been captured, reused, and learned |
doctor |
Installation checks and recent hook errors |
forget --yes |
Delete the project's data |
benchmark |
Run the simulated benchmark |
hook <agent> <event> / mcp |
Used by agent configs |
Privacy
- Stored per tool call: tool name, a coarse category (
read,edit,search,test, ...), a fingerprint of the arguments, project-relative file paths, status, duration, output size, and a masked one-line error signature. - Never stored: file contents, command text, tool output, transcripts, or paths outside the project.
- Prompts are kept as task descriptions (up to 1,000 characters) with secrets such as API keys and tokens redacted.
- Data lives in
~/.openreflex/projects/<hash>/experience.sqlite3. SetOPENREFLEX_HOMEto move it,OPENREFLEX_DISABLE=1to turn capture off everywhere, or runopenreflex forget --yesto delete a project's data.
Community & Contributing
-
Issues and ideas: GitHub Issues
-
Support the project: Buy me a coffee
-
Develop locally:
git clone https://github.com/vishnu-77/openreflex && cd openreflex pip install -e ".[dev]" pytest && ruff check src tests scripts
License
OpenReflex is released under the MIT License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openreflex-0.1.1.tar.gz.
File metadata
- Download URL: openreflex-0.1.1.tar.gz
- Upload date:
- Size: 53.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8716af764abd7fc4aa53dc3344e5baf602446349841839d8bdf8f3558d2a06ce
|
|
| MD5 |
d5dc27f30a81038c86b05ef5d9814d26
|
|
| BLAKE2b-256 |
8a26662c100e975ef84d8524a8d2eac822f6fb2b8307a21351c161b5bea4c485
|
Provenance
The following attestation bundles were made for openreflex-0.1.1.tar.gz:
Publisher:
release.yml on vishnu-77/openreflex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openreflex-0.1.1.tar.gz -
Subject digest:
8716af764abd7fc4aa53dc3344e5baf602446349841839d8bdf8f3558d2a06ce - Sigstore transparency entry: 2822247706
- Sigstore integration time:
-
Permalink:
vishnu-77/openreflex@88130ca43a8212edd89d5744bcfa691097ca7350 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vishnu-77
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@88130ca43a8212edd89d5744bcfa691097ca7350 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file openreflex-0.1.1-py3-none-any.whl.
File metadata
- Download URL: openreflex-0.1.1-py3-none-any.whl
- Upload date:
- Size: 47.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d0ebf70ef809f7e42c697def5cf4aaa70e68eac452970c26d33fa6e152448d4
|
|
| MD5 |
c0297c68f515f5760b47090c0714e2fd
|
|
| BLAKE2b-256 |
2aa24f5fad74b86eb7a996847de9e16337c422081a83050d81555a4df598d552
|
Provenance
The following attestation bundles were made for openreflex-0.1.1-py3-none-any.whl:
Publisher:
release.yml on vishnu-77/openreflex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openreflex-0.1.1-py3-none-any.whl -
Subject digest:
9d0ebf70ef809f7e42c697def5cf4aaa70e68eac452970c26d33fa6e152448d4 - Sigstore transparency entry: 2822247808
- Sigstore integration time:
-
Permalink:
vishnu-77/openreflex@88130ca43a8212edd89d5744bcfa691097ca7350 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vishnu-77
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@88130ca43a8212edd89d5744bcfa691097ca7350 -
Trigger Event:
workflow_dispatch
-
Statement type: