OpenReflex

io.github.vishnu-77Published by GitHub account vishnu-77v0.10.1Updated Oct 30, 2026

Optional diagnostics MCP server for OpenReflex's ambient project muscle memory.

VerifiedSTDIODesktop onlyKnowledge & MemoryDeveloper Tools

Overview

AI-generated overview

Diagnostics and admin MCP surface for OpenReflex, a local tool that gives coding agents project memory and records how tasks actually went.

What you can do
  • Inspect past work: search similar past tasks with their lessons, open a single Experience Graph node and its relations, and summarize what the project has recorded and learned.
  • Review decisions: explain the latest recommendation, read its Reflex Score and components, list candidate paths side by side, and show the decision timeline of the most recent task.
  • Plan and track manually: get an execution context for a task, check whether continuing is worth it, declare the path being followed, and record a confirmed outcome.
  • Administer memory: enable capture for a project or delete one past task, both only on explicit user request.
When to use it
For users who already run OpenReflex and want to ask their assistant what it learned, why a recommendation was made, or to see a trace. Normal coding work does not need these tools, since OpenReflex works through lifecycle hooks.
Requirements
Runs as a local stdio process via uvx from the openreflex PyPI package; Python 3.11 or newer. No account, API key or hosted service. Data is kept in a local SQLite database under the OpenReflex home directory. Desktop only.
Before you install
approve_project turns on capture for the project and forget_experience deletes stored task memory; both should only run when the user explicitly asks. Capture stores coarse metadata such as task descriptions up to 1,000 characters with secrets redacted, project-relative paths, tool names and error signatures, so review the privacy table before approving. The README also links to a donation page.

Installation

In SourceWeft

  1. Open OpenReflex in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README


What is OpenReflex

OpenReflex gives AI coding agents ambient project muscle memory across coding, investigation, and reasoning work. Lifecycle hooks quietly record how work actually goes, compile repeated project behaviour into reusable Reflexes, and inject only the relevant project procedure into new tasks. The model does not need to remember to call OpenReflex, and MCP diagnostics are opt-in rather than loaded into normal agent context.

You install it once and keep working normally. Core memory stays on your machine in a local SQLite database. There is no OpenReflex account or hosted service. Claude Code token counts are read from the session transcript Claude Code already writes locally, and only counts are stored. openreflex tokens enable optionally adds estimated cost through Claude Code's OpenTelemetry export to a loopback-only receiver.

[Recording of a Claude Code session with OpenReflex: OpenReflex injects compact prior context, Claude fixes the task and runs verification, and lifecycle hooks close the outcome automatically]
A recorded Claude Code session. OpenReflex injects compact relevant context before work; lifecycle hooks capture tools and verification and close the execution automatically. MCP is not required for the normal path. The step-by-step walkthrough is in docs/walkthrough.md.

Why OpenReflex

  • It learns how the project behaves. OpenReflex compiles successful work into project-scoped Reflexes such as authentication changes, Helm configuration, database migrations or CI work. Resolution combines semantic intent, task family and module/file locality, so a novel task can reuse a project procedure without repeating an earlier task.
  • It catches loops while they happen. Repeated failing commands, identical retries, stalled progress, and runaway context growth raise one alert that says whether to continue, pivot to another approach, or stop and check in with you, never a stream of nags.
  • It learns after every task. Build work closes against tests/lint/build evidence; investigations can close against cross-checked sources; reasoning-only work can complete without external tools. A simple Path check only names a better option when comparable past tasks actually support one.
  • 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: retrieve similar experience, score candidate paths, inject context and a budget. During a task: watch every tool call, flag loops and stalls, advise continue, pivot or stop. After a task: close the outcome using evidence appropriate to the work, run a simple Path check, extract lessons. Lessons feed the Experience Graph for the next task.]

Quick start

Requires Python 3.11 or newer.

Claude Code — recommended: install the plugin, reload it, inspect the current state, then explicitly enable project memory.

text
/plugin marketplace add vishnu-77/openreflex/plugin install openreflex@openreflex/reload-plugins/openreflex/openreflex approve

Claude may display the canonical plugin namespace as /openreflex:openreflex; both refer to the same user-invoked OpenReflex control surface when the bare alias is available. The no-argument command is read-only and compact. approve explicitly enables local memory for the current project. The plugin prepares an exact-version runtime under ~/.openreflex/runtime/ and normal agent work remains ambient after approval.

The Claude plugin does not execute a global openreflex from PATH. An older pipx/uv/pip installation can coexist without taking over the plugin runtime.

CLI / other agents: use a persistent package install.

bash
pipx install openreflex            # or: uv tool install openreflexcd your-projectopenreflex install codex           # or cursor / opencode / claude-code

After a few tasks:

bash
openreflex context "fix the login redirect bug"   # preview the context a task would receiveopenreflex status                                 # what has been captured and learnedopenreflex doctor                                 # installation checks and recent hook errorsopenreflex update --check                         # check the latest stable release

Package updates preserve local memory and project configuration. Managed pipx and uv tool installs can use openreflex update, openreflex update --reinstall, or openreflex self reinstall. The Claude plugin manages its own pinned runtime automatically; these package-manager commands are only needed for standalone CLI installs.

Use it with your agent

OpenReflex installs per project with openreflex install <agent>, or as a plugin.

AgentConnects throughInstallVerified
Claude CodePlugin hooks, or project hooksclaude plugin marketplace add vishnu-77/openreflex then claude plugin install openreflex@openreflex, or openreflex install claude-codeLive sessions
CodexPlugin hooks, or project hookscodex plugin marketplace add vishnu-77/openreflex, or openreflex install codex, then trust the hooks once in /hooksLive sessions
CursorLifecycle hooksopenreflex install cursorProtocol and fuzz tests
OpenCodeLocal lifecycle pluginopenreflex install opencodeProtocol and fuzz tests

With the Claude plugin, /openreflex shows a compact read-only state view. Use /openreflex approve to enable local memory for the current project, then work normally. Other explicit controls include status, reflexes, memory, doctor, why, trace, and revoke. OpenReflex control turns are not learned as project experiences and do not trigger normal task verification. The control skill is user-invoked only and does not enable MCP diagnostics or participate in normal model routing. Claude may show the canonical namespaced form /openreflex:openreflex. Per-agent guides: Claude Code, Codex, Cursor, OpenCode.

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-> ExperienceCandidatePath -recommended_for-> Task            Lesson -recommended_for-> TaskExecution -failed_with-> ToolCall -resolved_by-> ToolCallExecution -caused-> Outcome -caused-> Experience -caused-> Lesson
  • Before a task: similar experiences are retrieved and OpenReflex first identifies the work mode. BUILD uses inspect-first, test-first, and incremental; INVESTIGATE uses source-first, cross-check, and broad-then-deep; THINK uses reason-first, compare-options, and evidence-first. Paths are ranked using past evidence, estimated cost, risk, uncertainty and reversibility. Injected text is re-read by every later API call, so context is injected only when it is specific to the task: a matched Reflex, or a lesson about a failure already seen in this project. One substantial task in five (the evaluation.holdout_percent policy value) is a holdout: OpenReflex records it but shows nothing, so openreflex status can compare model tokens per task with and without OpenReflex.
  • Between tasks (Claude Code): when a new, unrelated task starts in a session already carrying a large history (context.reset_hint_tokens), OpenReflex suggests /clear to you; the model never sees the suggestion. After /clear, the new session gets a short summary of the cleared task instead of its full history.
  • During a task: an identical call that already failed twice, with no edit or passing check since, is refused before it runs (Claude Code) or flagged (other agents). The first failure with an error this project has resolved before shows what resolved it. When a detector finds a failure loop, repeated calls, stalled progress or context growth, OpenReflex estimates the marginal value of more work. Over-budget alerts are off by default; set detectors.over_budget_tiers to turn them on. The current path's success estimate is updated with each call that makes no progress or fails, and compared with the cost of the work left and with the best untried alternative. The alert ends with a recommendation to continue, pivot to another strategy, or stop and ask the user. Each problem, pivot, or stop is raised once, with a cooldown between messages.
  • After a task: lifecycle hooks close the execution automatically from work-mode-appropriate evidence; the model does not need to call OpenReflex. Explicit MCP outcome/path operations remain available only for manual or diagnostic workflows. The Path check says either better option: <path> when comparable completed tasks support it or better option: none proven. Recommendations are never presented as paths that were actually executed.

Every recommendation is stored as a decision snapshot with a Reflex Score (0-100): how strong the recommendation is, which is separate from the estimated chance that the task succeeds. openreflex why explains the latest decision and openreflex trace shows the timeline. In Claude Code, a short recap appears when a task starts, when OpenReflex recommends a pivot or stop or detects trouble, and when the task completes.

Set optional limits for every task with OPENREFLEX_BUDGET, for example calls=40,minutes=20,tokens=60000. Routing, scoring, budget and recap settings come from a versioned policy: the packaged defaults, overridden by ~/.openreflex/config.toml and then by .openreflex.toml in the project.

Normal work does not load OpenReflex MCP tools. If you explicitly want model-facing introspection for a project, enable it with openreflex diagnostics enable <agent>. Disable it again with openreflex diagnostics disable <agent>. The standalone MCP Registry package remains available for users who deliberately install OpenReflex as an MCP server.

The optional MCP diagnostics/admin tools
ToolWhat it does
get_execution_contextPlan a task: similar past tasks, the suggested strategy with alternatives, a budget, likely files, lessons. Optional max_tool_calls, max_minutes, max_context_tokens.
check_progressWhether more work on the current path is worth it: continue, pivot or stop.
choose_pathDeclare the strategy being followed when it differs from the suggestion.
record_outcomeRecord a confirmed outcome (tests/builds, cross-checked research, user confirmation, or failure) and learn from it.
explain_decisionWhy the latest recommendation was made: Reflex Score, signals, confidence, next-best route.
get_execution_traceThe decision timeline of the most recent task.
get_reflex_scoreThe latest Reflex Score and its components as JSON.
search_experiencePast tasks in the project by description similarity, with their lessons.
explain_nodeOne Experience Graph node and its relations.
get_project_insightsWhat has been recorded, reused and learned in the project.
approve_projectEnable capture, only when the user explicitly asks.
forget_experienceDelete one past task's memory, only when the user explicitly asks.

CLI

CommandPurpose
install <agent> [--dry-run]Install the hooks-only ambient runtime and enable the project
diagnostics enable/disable <agent>Explicitly opt in/out of model-facing MCP diagnostics
uninstall <agent> [--dry-run]Remove OpenReflex's integration entries; captured memory is kept
update [--check] [--reinstall]Check or update a managed pipx/uv-tool installation; optionally force a reinstall
self reinstallRepair/reinstall the managed OpenReflex package while preserving memory/config
self uninstall --yesRemove only the managed OpenReflex package; memory/config remain on disk
approve / revokeEnable or disable capture for the current project
context "<task>"Preview the Execution Context a task would receive
status [--json]What has been captured, reused, learned, and how model-token usage compares
why / traceExplain the latest recommendation, or show the decision timeline
doctorInstallation, project resolution, and recent hook activity checks
forget --yesDelete the project's data
tokens enable / tokens status / tokens disableToken counts need no setup; opt in to estimated cost via local Claude Code telemetry, inspect it, or remove OpenReflex-owned telemetry settings
benchmarkRun the simulated benchmark
hook <agent> <event>Used by ambient agent integrations
mcpRun the optional diagnostics/admin MCP server explicitly

Privacy

StoredNever stored
Tool name and a coarse category (read, edit, search, test, ...)File contents
A fingerprint of the argumentsCommand text
Project-relative file pathsTool output
Pass or fail, duration, output sizeTranscripts and model output
Model-token counts per API call, read from the local Claude transcript; model/source label; optional estimated costPrompt/response/tool contents from the transcript or Claude telemetry
A masked one-line error signaturePaths outside the project
The prompt as a task description (up to 1,000 characters, secrets redacted)Anything sent to an OpenReflex-hosted service: there is none

Data lives in ~/.openreflex/projects/<hash>/experience.sqlite3. Set OPENREFLEX_HOME to move it, OPENREFLEX_DISABLE=1 to turn capture off everywhere, openreflex forget --yes to delete a project's data, or ask your agent to forget_experience a single task.

Research

OpenReflex is also a research project in budget-aware execution: instead of treating success as a yes or no, it studies how agents choose execution paths, spend tool calls, model tokens and context, respond to uncertainty, and whether past work makes similar future work cheaper without reducing outcome quality. The loop is experience retrieval, evidence-aware path selection, budget-aware execution, work-mode-specific completion and plain-language path comparison. The Researcher view on the site explains the idea, lets you step through one reflex forming in the graph, and places it next to related work.

The reproducible evaluation protocol, pinned real-agent corpus, exact prompts, and claim boundaries are documented in docs/evaluation.md.

Community & Contributing

  • Issues and ideas: GitHub Issues

  • Support the project: Buy me a coffee

  • Develop locally:

    bash
    git clone https://github.com/vishnu-77/openreflex && cd openreflexpip install -e ".[dev]"pytest && ruff check src tests scripts
[Contributors]

OpenReflex is listed in the MCP Registry as io.github.vishnu-77/openreflex and on Glama:

[OpenReflex MCP server: quality and maintenance score on Glama]

License

OpenReflex is released under the MIT License.

Source: README.md at commit ae971a8

Tools

14

get_execution_context

Get execution context

Plan a task from this project's past experience. Returns: plain text with the learned project Reflex procedure when one applies; otherwise a neutral working approach, relevant past experience, budget, likely files/sources and lessons. Internal strategy names and candidate scores are deliberately omitted from this normal surface; use get_candidate_paths for diagnostics. Use when: starting any substantial coding, investigation, research, analysis, review, planning or reasoning task and no [OpenReflex] block was injected. Not for: looking up history (use search_experience) or checking progress mid-task (use check_progress). Side effects: starts or re-plans the current task in the local Experience Graph; touches no project files, runs no commands, sends nothing over the network. Calling it again for the same task returns the same plan unless new limits are given. Errors: invalid non-positive limits are rejected by the input schema; a 'not enabled' message is returned until the project is approved.

Parameterstaskrequiredmax_minutesmax_tool_callsmax_context_tokens

check_progress

Check progress

Estimate whether more work on the current task's path is still worth it. Returns: plain text starting with 'Recommendation: continue', 'pivot' or 'stop', then the success estimates for the current path and the best alternative, the marginal value of each option, the execution budget and how much of it is used, and any detected problems (failure loop, repeated calls, stalled progress, context growth, budget overrun). Use when: unsure mid-task whether to keep going. Follow 'pivot' by switching to the named strategy; follow 'stop' by summarizing what was tried and asking the user. Not for: planning a task (use get_execution_context). Side effects: none; read-only on the most recent task. Errors: asks for get_execution_context first when no task exists; a 'not enabled' message until the project is approved.

Takes no parameters.

explain_decision

Explain decision

Explain OpenReflex's latest recommendation for the most recent task. Returns: plain text with the recommended strategy, the Reflex Score (0-100: how strong the recommendation is, not the chance of success), the estimated success probability, confidence, the signals behind the score, the next-best strategy with its route advantage, and the policy version. Use when: the user asks why OpenReflex suggested a path, pivot or stop. Not for: the same numbers as structured data (use get_reflex_score) or every decision in order (use get_execution_trace). Side effects: none; read-only. Errors: 'No decision snapshot recorded yet' before any task was planned; a 'not enabled' message until the project is approved.

Takes no parameters.

get_execution_trace

Get execution trace

Return the decision timeline of the most recent task. Returns: plain text, one line per decision in order, with elapsed time, phase (start, runtime, complete), action, strategy, Reflex Score and the event that triggered it. Never includes prompts, commands or tool output. Use when: reviewing how a task unfolded. Not for: only the latest decision (use explain_decision). Side effects: none; read-only. Errors: 'No decision snapshots recorded yet' before any task was planned; a 'not enabled' message until the project is approved.

Takes no parameters.

get_candidate_paths

Get candidate paths

Show every candidate path OpenReflex considered for the most recent task side by side. Returns: plain text with each strategy's score, success probability, cost/risk numbers, and whether it was dominated; which path was recommended; and which one was actually followed - explicit (via choose_path), inferred from tool-call evidence, or not yet determined while the execution is still running. Use when: the user asks what other approaches were considered, or whether the agent followed the suggested path. Not for: a single recommendation's reasoning (use explain_decision) or the decision timeline (use get_execution_trace). Side effects: none; read-only. Errors: 'No execution recorded yet' before any task was planned; a 'not enabled' message until the project is approved.

Takes no parameters.

get_project_reflexes

Get project Reflexes

Show the project Reflex and specialised procedures OpenReflex is learning from repeated work. Returns: the root Project Reflex after the first captured experience, plus specialised Reflexes with learning/learned/proven/stale maturity, support/verification counts and procedure steps. Use when: the user asks what OpenReflex has learned specifically about this project, which reusable procedures exist, or how a named Reflex works. Not for: backend routing internals or generic strategies (use get_candidate_paths for those diagnostics). Side effects: may refresh derived local Reflex data from already-captured evidence; touches no project files. Errors: a 'not enabled' message is returned until the project is approved.

Takes no parameters.

get_reflex_score

Get Reflex Score

Return the latest decision's Reflex Score and machine-readable components. Returns: structured fields for availability, Reflex Score (0-100 recommendation strength, not success probability), success probability, confidence, strategy, next-best strategy, route advantage, evidence, context cost, budget use, component signals and policy version. If no decision exists, available=false and reason explains why. Use when: a program or agent needs decision numbers it can inspect without parsing prose. Not for: a readable explanation (use explain_decision) or the full decision timeline (use get_execution_trace). Side effects: none; read-only. Errors: an MCP error is returned until the project is approved.

Takes no parameters.

choose_path

Choose path

Declare the strategy you are following for the most recent task. Returns: one line, 'Recorded chosen path: <strategy>'. Use when: deliberately departing from the suggested path, so OpenReflex remembers what was actually done rather than confusing the recommendation with the observed work. Not for: tasks that follow the suggestion; the path is then inferred from tool activity. Side effects: writes the choice to the local Experience Graph; calling it again replaces the earlier choice. Touches no project files. Errors: 'No current execution' before any task was planned (call get_execution_context first); a 'not enabled' message until the project is approved.

Parametersstepsstrategyrequired

record_outcome

Record outcome

Record the verified outcome of the most recent task and learn from it. Returns: the recorded status plus a plain-language Path check. A better path is only named when comparable completed tasks provide evidence; otherwise the result says that no better option is proven. Use when: the result is confirmed: tests/lint/build passed, research was cross-checked against relevant evidence, the user confirmed the answer, or the task failed/was abandoned. Not for: declaring the strategy (use choose_path). Side effects: finalizes the task in the local Experience Graph and updates its experience, lessons and path comparison; calling it again for the same task replaces the recorded outcome. Touches no project files. Errors: 'No execution to record an outcome for' before any task was planned; a 'not enabled' message until the project is approved.

Parametersstatusrequiredevidencerequired

search_experience

Search experience

Search this project's past tasks by description similarity. Returns: structured 'experiences' (id, score, description, class, agent, strategy, status, tool_calls, minutes, files), best match first, plus structured 'lessons' (text, confidence, support). Both lists are empty when nothing is similar enough. Use when: the user asks what was learned or what worked before, or to find an experience id for explain_node or forget_experience. Not for: planning a new task (use get_execution_context). Side effects: none; read-only. Matching is lexical, on task descriptions only. Errors: invalid limit values are rejected by the input schema; an MCP error is returned until the project is approved.

Parameterslimitqueryrequired

explain_node

Explain graph node

Show one Experience Graph node with its direct relations. Returns: structured 'root', 'nodes' (Task, Execution, ToolCall, Outcome, Experience, Lesson, Context or CandidatePath and their stored fields) and typed 'edges' (used, caused, failed_with, resolved_by, recommended_for). Embeddings are omitted. Use when: tracing why a lesson or recommendation exists, after finding an id with search_experience or get_execution_context. Not for: searching by topic (use search_experience). Side effects: none; read-only. Errors: an MCP error reports 'Unknown graph node' for an id that does not exist, and an MCP error is returned until the project is approved.

Parametersnode_idrequired

get_project_insights

Get project insights

Summarize what OpenReflex has recorded and learned in this project. Returns: structured activation, engagement, experience reuse, outcomes, observational efficiency with and without prior experience, path-comparison trends, routing agreement, live alerts, execution-control metrics and lesson count. Efficiency comparisons are observational and are not presented as causal evidence. Use when: the user asks how OpenReflex is doing in this project or a program needs project-level metrics. Not for: individual past tasks (use search_experience). Side effects: none; read-only. Errors: an MCP error is returned until the project is approved.

Takes no parameters.

approve_project

Enable project

Enable OpenReflex capture for this project. Returns: one line confirming the project is enabled, or 'Not approved' when confirm is false. Use when: the user explicitly asks to enable OpenReflex here. Never call it on your own initiative; the user can also run `openreflex approve`, and `openreflex revoke` disables capture again. Not for: anything else; every other tool answers with a 'not enabled' message until this has happened. Side effects: writes the project's approval to the local OpenReflex home; enabling an already enabled project changes nothing. Touches no project files. Errors: none.

Parametersconfirm

forget_experience

Forget experience

Delete one past task from this project's memory. Returns: one line listing what was removed (task, executions, tool calls, outcomes, experience, lessons), or 'Not forgotten' when confirm is false. Use when: the user explicitly asks to forget a specific past task, for example one that involved sensitive work or taught a wrong lesson. Never call it on your own initiative. Not for: deleting everything; the user runs `openreflex forget --yes` for that. Side effects: permanently removes that task's nodes from the local Experience Graph; other tasks are untouched. Touches no project files. Errors: 'Unknown experience id' for an id that does not exist, is not an experience, or was already forgotten; a 'not enabled' message until the project is approved.

Parametersconfirmexperience_idrequired

Version history

12
  1. v0.10.1LatestOct 29, 2026
  2. v0.9.10Sep 24, 2026
  3. v0.9.7Sep 24, 2026
  4. v0.9.6Sep 23, 2026
  5. v0.9.3Sep 23, 2026
  6. v0.9.2Sep 22, 2026
  7. v0.8.0Sep 21, 2026
  8. v0.5.3Sep 21, 2026
  9. v0.5.2Sep 20, 2026
  10. v0.5.1Sep 19, 2026
  11. v0.5.0Sep 18, 2026
  12. v0.3.2Sep 16, 2026

Score

90% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts
  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listedRequired15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts