OpenReflex
OpenReflex is an optional local MCP diagnostics/admin server for project-scoped agent memory: it helps plan tasks from past experience, monitor execution, inspect learned behavior, record outcomes, and manage local project data.
Plan substantial coding, investigation, or reasoning tasks with
get_execution_context, including similar past work, lessons, budgets, and likely files/sources.Check mid-task whether to continue, pivot, or stop with
check_progress.Explain recommendations and inspect Reflex Score, candidate paths, and decision timeline via
explain_decision,get_reflex_score,get_candidate_paths, andget_execution_trace.Review learned project Reflexes and project-level insights/metrics with
get_project_reflexesandget_project_insights.Search past tasks and lessons with
search_experience, and inspect Experience Graph nodes withexplain_node.Declare a chosen strategy with
choose_pathand record verified success or failure withrecord_outcome.Explicitly approve project capture with
approve_project, or delete a specific past task’s memory withforget_experienceonly when the user asks.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OpenReflex get execution context for refactoring the auth module"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Website · Docs · Walkthrough · PyPI · Issues · Buy me a coffee
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.
Related MCP server: Thoth-Mem
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.
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.
/plugin marketplace add vishnu-77/openreflex
/plugin install openreflex@openreflex
/reload-plugins
/openreflex
/openreflex approveClaude 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.
pipx install openreflex # or: uv tool install openreflex
cd your-project
openreflex install codex # or cursor / opencode / claude-codeAfter 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
openreflex update --check # check the latest stable releasePackage 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.
Agent | Connects through | Install | Verified |
Claude Code | Plugin hooks, or project hooks |
| Live sessions |
Codex | Plugin hooks, or project hooks |
| Live sessions |
Cursor | Lifecycle hooks |
| Protocol and fuzz tests |
OpenCode | Local lifecycle plugin |
| Protocol 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-> Experience
CandidatePath -recommended_for-> Task Lesson -recommended_for-> Task
Execution -failed_with-> ToolCall -resolved_by-> ToolCall
Execution -caused-> Outcome -caused-> Experience -caused-> LessonBefore a task: similar experiences are retrieved and OpenReflex first identifies the work mode. BUILD uses
inspect-first,test-first, andincremental; INVESTIGATE usessource-first,cross-check, andbroad-then-deep; THINK usesreason-first,compare-options, andevidence-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 (theevaluation.holdout_percentpolicy value) is a holdout: OpenReflex records it but shows nothing, soopenreflex statuscan 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/clearto 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_tiersto 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 orbetter 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.
Tool | What it does |
| Plan a task: similar past tasks, the suggested strategy with alternatives, a budget, likely files, lessons. Optional |
| Whether more work on the current path is worth it: continue, pivot or stop. |
| Declare the strategy being followed when it differs from the suggestion. |
| Record a confirmed outcome (tests/builds, cross-checked research, user confirmation, or failure) and learn from it. |
| Why the latest recommendation was made: Reflex Score, signals, confidence, next-best route. |
| The decision timeline of the most recent task. |
| The latest Reflex Score and its components as JSON. |
| Past tasks in the project by description similarity, with their lessons. |
| One Experience Graph node and its relations. |
| What has been recorded, reused and learned in the project. |
| Enable capture, only when the user explicitly asks. |
| Delete one past task's memory, only when the user explicitly asks. |
CLI
Command | Purpose |
| Install the hooks-only ambient runtime and enable the project |
| Explicitly opt in/out of model-facing MCP diagnostics |
| Remove OpenReflex's integration entries; captured memory is kept |
| Check or update a managed pipx/uv-tool installation; optionally force a reinstall |
| Repair/reinstall the managed OpenReflex package while preserving memory/config |
| Remove only the managed OpenReflex package; memory/config remain on disk |
| Enable or disable capture for the current project |
| Preview the Execution Context a task would receive |
| What has been captured, reused, learned, and how model-token usage compares |
| Explain the latest recommendation, or show the decision timeline |
| Installation, project resolution, and recent hook activity checks |
| Delete the project's data |
| Token counts need no setup; opt in to estimated cost via local Claude Code telemetry, inspect it, or remove OpenReflex-owned telemetry settings |
| Run the simulated benchmark |
| Used by ambient agent integrations |
| Run the optional diagnostics/admin MCP server explicitly |
Privacy
Stored | Never stored |
Tool name and a coarse category ( | File contents |
A fingerprint of the arguments | Command text |
Project-relative file paths | Tool output |
Pass or fail, duration, output size | Transcripts and model output |
Model-token counts per API call, read from the local Claude transcript; model/source label; optional estimated cost | Prompt/response/tool contents from the transcript or Claude telemetry |
A masked one-line error signature | Paths 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:
git clone https://github.com/vishnu-77/openreflex && cd openreflex pip install -e ".[dev]" pytest && ruff check src tests scripts
OpenReflex is listed in the MCP Registry as io.github.vishnu-77/openreflex and on Glama:
License
OpenReflex is released under the MIT License.
Available Tools
14 toolsapprove_projectEnable projectAIdempotent
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.
Inputs: confirm. Returns: result
check_progressCheck progressARead-onlyIdempotent
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.
Inputs: no named parameters. Returns: result
choose_pathChoose pathAIdempotent
Declare the strategy you are following for the most recent task. Returns: one line, 'Recorded chosen path: '. 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.
Inputs: strategy (required), steps. Returns: result
explain_decisionExplain decisionARead-onlyIdempotent
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.
Inputs: no named parameters. Returns: result
explain_nodeExplain graph nodeARead-onlyIdempotent
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.
Inputs: node_id (required). Returns: root, edges, nodes
forget_experienceForget experienceADestructiveIdempotent
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.
Inputs: experience_id (required), confirm. Returns: result
get_candidate_pathsGet candidate pathsARead-onlyIdempotent
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.
Inputs: no named parameters. Returns: result
get_execution_contextGet execution contextA
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.
Inputs: task (required), max_minutes, max_tool_calls, max_context_tokens. Returns: result
get_execution_traceGet execution traceARead-onlyIdempotent
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.
Inputs: no named parameters. Returns: result
get_project_insightsGet project insightsARead-onlyIdempotent
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.
Inputs: no named parameters. Returns: lessons, project, routing, outcomes, +8 more
get_project_reflexesGet project ReflexesARead-onlyIdempotent
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.
Inputs: no named parameters. Returns: result
get_reflex_scoreGet Reflex ScoreARead-onlyIdempotent
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.
Inputs: no named parameters. Returns: reason, signals, strategy, available, +9 more
record_outcomeRecord outcomeAIdempotent
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.
Inputs: status (required), evidence (required). Returns: result
search_experienceSearch experienceARead-onlyIdempotent
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.
Inputs: query (required), limit. Returns: lessons, experiences
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Each tool targets a distinct action or view, and close pairs like explain_decision vs get_reflex_score are clearly separated by output format and explicit 'Not for' cross-references. The tools are easy for an agent to tell apart despite several operating on the same recent-task context.
All 14 tools follow a consistent snake_case verb_noun pattern: get_, explain_, search_, check_, choose_, record_, approve_, forget_. No mixed casing or stylistic drift is present.
At 14 tools, the set is well within the ideal range and each tool has a clear role in the OpenReflex workflow. The count feels appropriate for covering planning, execution monitoring, explanation, memory management, and metrics without redundancy.
The core lifecycle is well covered: approval, planning, path selection, progress checks, outcome recording, searching experiences, and forgetting tasks. Minor gaps exist, such as no MCP tool to revoke project approval or perform a full memory wipe, both of which are delegated to CLI commands.
Maintenance
Related MCP Connectors
Shared task board and knowledge base for AI coding agents Give your coding agents a shared task board and knowledge base, so the plan survives between sessions and across agents.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.
Persistent memory for AI agents: save, search and connect context across tools and sessions.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceGives AI coding agents persistent memory by storing observations, decisions, and learnings in a local SQLite database with vector search, full-text search, and a rules engine.4MIT
- AlicenseBqualityBmaintenancePersistent memory for AI coding agents, storing learned architecture decisions, patterns, and bug fixes in a local SQLite database with full-text search, enabling agents to recall information across sessions.6464 npm1MIT
- FlicenseNot gradedqualityAmaintenanceGives AI coding agents a local-first persistent memory they can read and write directly during sessions, storing decisions, preferences, error patterns, and guidelines in per-project and global SQLite stores. Enables semantic and keyword retrieval of relevant context across sessions so agents start work already knowing a codebase's conventions and history.-
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to read and write persistent memory directly during sessions, storing decisions, preferences, error patterns, research, and cross-project guidelines in local SQLite databases. Supports semantic search so relevant project and global context can be recalled by meaning, fully offline and without API keys.-