Skip to content

Open source, MIT licensed, runs on your machine

Muscle memory for AI coding agents.

AI coding agents often solve the task, but not efficiently: they search the same code again, reread files, retry failed commands and keep going after the evidence is in. OpenReflex learns how each task gets done, recommends a more efficient path for the next one, and tells the agent when to continue, pivot or stop. Everything stays on your machine.

$pipx install openreflex

Evaluating the approach?

You are in the Researcher view: how OpenReflex learns, and where it fits among related work.

OpenReflex execution replay
Retrieve
Route
Observe
Learn

Muscle memory for how work gets done

OpenReflex runs alongside Claude Code, Codex, Cursor and OpenCode through plugins, lifecycle hooks and MCP. Install it once and keep working normally. It never reads your files or transcripts; it learns from what the agent did and how it turned out.

  1. 1Before a task

    It recommends a more efficient path

    OpenReflex finds similar past tasks and compares candidate approaches by expected success, time, tool calls, context cost, risk and uncertainty. Your agent gets the best path, a budget, the files that mattered and lessons from earlier attempts. If there is nothing relevant yet, it stays silent.

    [OpenReflex] debug task | 2 similar past tasks, 2 succeeded
    Suggested path: test-first (success~95%, ~14 tool calls)
    Alternatives: inspect-first (dominated by test-first)
    Budget: ~31 tool calls, ~20 min, ~30k tokens
    Likely relevant files: src/auth/session.py
  2. 2During a task

    It says continue, pivot or stop

    Repeated failures, excessive exploration, context growth and stalled progress are caught as they happen. OpenReflex then weighs whether more work on the current path is still worth it, and recommends continuing, pivoting to another approach, or stopping to check in with you. It speaks up once, not on every tool call.

    OpenReflex: 15 calls over 5 min without a successful edit or check (only read).
    Recommendation: pivot to test-first (success estimate ~24% on inspect-first, ~95% for test-first, budget 52% used)
  3. 3After a task

    It learns from the outcome

    When the task ends, OpenReflex works out whether it succeeded from the checks that actually ran, compares the chosen route with plausible alternatives, and feeds both into the next recommendation.

    outcome: success (test passed after the last edit)
    path taken: test-first
    regret: 0.0 against inspect-first
    lesson: "AssertionError: expired token accepted" was resolved by an edit in src/auth/session.py

The goal is simple: help your agents reach the same or better results with fewer unnecessary tool calls, less context, less time and less repeated work.

Connect your agent

Pick your agent. OpenReflex needs Python 3.11 or newer, and nothing is recorded until you enable a project.

  1. 1

    Install the OpenReflex CLI

    $pipx install openreflex
  2. 2

    Add the plugin marketplace

    $claude plugin marketplace add vishnu-77/openreflex
  3. 3

    Install the plugin

    $claude plugin install openreflex@openreflex
  4. 4

    Enable it in each project you want it to learn from

    $openreflex approve

Full setup guide for Claude Code
Check the setup any time with openreflex doctor. Claude Code and Codex are verified in live sessions; Cursor and OpenCode follow each agent's documented hook protocol.

Private by design

OpenReflex is a local SQLite database on your machine. There is no account, no server and no telemetry, and capture stays off until you enable a project.

What it keeps

  • Tool names and a coarse category, such as read, edit or test
  • A fingerprint of each call's arguments, so repeats can be spotted
  • File paths inside the project
  • Whether a call passed or failed, and a short masked error line
  • Your prompt as the task description, with keys and tokens redacted

What it never keeps

  • The contents of your files
  • The commands your agent ran
  • Tool output and logs
  • Conversation transcripts
  • Anything outside the project folder

Stop capture with openreflex revoke, delete a project's data with openreflex forget --yes, or turn it off everywhere with OPENREFLEX_DISABLE=1.

What's shipped

OpenReflex is MIT licensed and available on PyPI. Here’s what ships in the current release.

On PyPI
Install with pipx, uv or pip. The package is called openreflex.
View on PyPI
Works with four agents
Claude Code, Codex, Cursor and OpenCode, through lifecycle hooks and an MCP server with twelve tools.
Read the setup guide
Verified in real Claude Code and Codex sessions
End-to-end suites drive headless Claude Code and Codex, and check that context, alerts and recommendations actually reach the model.
See the test harness
Tested on Linux, macOS and Windows
Every change runs the full suite on Python 3.11, 3.12 and 3.13, plus a clean install of the built package.
View CI
Runs locally
One SQLite file per project, no background service, and hooks that never block your agent.
How data is handled
Budget-aware execution
Pareto-efficient path selection, a budget for every task, and a continue, pivot or stop recommendation when work stops paying off.
See the MCP tools

Execution intelligence for coding agents

OpenReflex studies whether evidence from prior executions can help coding agents use computation more deliberately during a task. This page documents only research ideas that are already represented in public releases.

Research question

Can verified execution experience improve how a coding agent chooses a path, spends its budget and responds when progress deteriorates?

Claim boundary

Public claims are limited to behaviour and evidence present in tagged OpenReflex releases. Unreleased methods, experiments and research directions are intentionally not described here.

Released execution loop

  1. 01

    Retrieve

    Retrieve comparable verified executions from the project-local Experience Graph.

  2. 02

    Select

    Estimate candidate execution paths under success, cost, risk, uncertainty and reversibility constraints.

  3. 03

    Control

    Observe execution progress and estimate whether continuing, pivoting or stopping has higher expected utility.

  4. 04

    Learn

    Persist verified outcomes and estimated execution regret to update later path priors.

The developer-facing idea remains simple: useful execution memory should make the agent feel more effective. The researcher view exists to document what has been released, how it is measured and where its claims sit relative to prior work.

Novelty and positioning

OpenReflex does not claim novelty for agent memory, budget awareness or runtime control in isolation. The public research position is restricted to the combination and evidence already present in released versions.

Related work

Historical coding trajectories can already be abstracted into reusable plans through STAIR[1]. Budget-aware agents can adapt planning under resource constraints through BATS[2]. Runtime controllers for coding agents are evaluated by LoopArena[3], while learned harness control has also been formalised with a frozen executor[4]. Evidence-conditioned execution systems such as ECLoop further show that runtime intervention is an active research area[5].

Released position

OpenReflex currently combines project-local execution experience, multi-objective path selection, execution budgets, runtime continue / pivot / stop recommendations, and observable decision evidence. These are treated as an experimental system design rather than as individually novel primitives.

A visible execution recap, without a noisy agent

OpenReflex separates what the coding agent needs to know from what the developer needs to see. Routine guidance stays in the agent context; only the start, a consequential policy change, and completion become compact user-facing recaps.

Execution recap · v0.3

Plan → observe → intervene → learn.

Claude Code
TASK START

↺ OpenReflex · 82

4 experiences · test-first 71%

~23 calls · ~18k tokens · +186 context tokens

Visible once when a substantial task begins.

MATERIAL CHANGE

↺ OpenReflex · 64 ↓18

11/23 calls · 2 failures · confidence 71→52%

inspect-first now leads · recommendation → pivot

Visible only when the execution policy materially changes its recommendation.

COMPLETION

↺ OpenReflex · COMPLETE

success · test-first

18 calls · 14.2k tokens · 6.4m

regret 0.05 vs inspect-first

Closes the visible loop with realised path, observed cost and comparison route. Reusable lessons are stored immediately after completion.

Visibility contract

ModeClaude receivesDeveloper seesUsed for
AmbientadditionalContextSilentRetrieved experience, likely files, normal execution guidance
RecapadditionalContextsystemMessageTask start and completion
InterventionadditionalContextsystemMessagePivot, stop, budget pressure, failure loop or material degradation

Research notes by release

This section is retrospective by design. It records the research-relevant behaviour that is already public, shipped and inspectable. New entries are added only when a release makes the corresponding evidence available.

v0.3.2

Observation integrity

The released instrumentation was hardened so malformed or context-poor activity does not contaminate the explanation surface.

  • Malformed hook events without a tool identity are ignored.
  • Explanation commands resolve to the latest task that actually contains decision evidence.
  • The live Codex harness reports agent refusal causes more accurately.
Release
v0.3.1

Evidence semantics and user control

The public interface was tightened so research-facing concepts have explicit meanings and stored experience remains user-removable.

  • MCP tool contracts define return values, intended use and side effects more precisely.
  • Execution Regret and Reflex Score are defined where they appear.
  • Individual stored experiences can be explicitly forgotten.
Release
v0.3.0

Observable execution policy

Execution recommendations became inspectable rather than opaque, separating recommendation strength from estimated task success.

  • Decision snapshots persist route, confidence, evidence, budget pressure and context overhead.
  • Reflex Score exposes recommendation strength independently of success probability.
  • `why` and `trace` read the same stored decision evidence used by the runtime.
Release
v0.2.0

Budget-aware execution

OpenReflex moved from retrieval alone toward execution optimisation by treating agent work as a constrained multi-objective process.

  • Candidate paths are compared across success, time, tool calls, context, risk, uncertainty and reversibility.
  • Tasks receive execution budgets for tool calls, active time and context.
  • Runtime advice can recommend continue, pivot or stop when progress deteriorates.
Release

This is not a forward roadmap. Ongoing research, unreleased implementation details and future experiments remain private until they are ready to be introduced with a public release and supporting evidence.

Watch one reflex form

This is the Experience Graph for a real bug fix, using the same node types and relations the engine stores. Step through it, or select any node to see exactly what OpenReflex keeps.

Hooks record the task and each tool call. The same test run fails three times, a loop alert fires, and an edit to dates.py fixes it.

What the research says

Three published studies shaped how OpenReflex works. Each is quoted from the paper itself, next to what OpenReflex takes from it and where it goes its own way.

Failed runs are longer, not just wrong

“…we find that failed trajectories are consistently longer and exhibit higher variance than successful ones, with failure patterns differing significantly between agents.”

Majgaonkar, Fei, Li, Sarro and Ye (2025). Understanding Code Agent Behaviour: An Empirical Study of Success and Failure Trajectories arXiv:2511.00197, abstract.

In the paper's own measurements (Section 4.2), failed trajectories took between 12.6% and 82.5% more steps than successful ones, depending on the agent (OpenHands, SWE-agent or Prometheus) and the SWE-Bench split.

What OpenReflex takes from it

OpenReflex watches the shape of a run while it happens: identical calls repeated, failures in a row, long stretches without a successful edit or check, and work past the task's budget. When none of those appear, it stays silent.

Agents stall in their own reasoning

“…with the majority of agentic failures stemming from flawed reasoning and cognitive deadlocks.”

Liu, Liu, Li, Tan, Zhu, Lian and Zhang (2025). An Empirical Study on Failures in Automated Issue Solving arXiv:2509.13941, abstract.

The authors respond with a second, supervisory agent that provides strategic oversight and course-correction for the agent doing the work.

What OpenReflex takes from it

OpenReflex also corrects course from outside the agent, but without a second model. Its recommendation to continue, pivot or stop is computed from lifecycle-hook signals and verified outcomes, and it is advice the agent can weigh, never a block on its tools.

Language feedback can change behaviour without retraining

“We propose Reflexion, a novel framework to reinforce language agents not by updating weights, but instead through linguistic feedback.”

Shinn, Cassano, Berman, Gopinath, Narasimhan and Yao (2023). Reflexion: Language Agents with Verbal Reinforcement Learning arXiv:2303.11366, abstract.

What OpenReflex takes from it

OpenReflex likewise works through text placed in the agent's context rather than through training. It differs in where that text comes from: Reflexion agents write their own reflections and reuse them on later trials, while OpenReflex derives its context deterministically from hook metadata and checks that actually passed, and keeps it across sessions and across agents.

OpenReflex is an independent open-source project. It is not affiliated with the authors of these papers, uses none of their code, and is not an implementation of Reflexion; its name comes from reflexes, the learned responses it builds up for a project. Numbers quoted here describe the papers' own experiments, not OpenReflex.

Where OpenReflex fits

OpenReflex builds on a lot of good work in agent memory and self-improvement. The difference is what it learns from and where that learning happens.

claude-mem[1]

Open-source plugin

Captures what a coding agent does in its sessions and injects relevant context into future sessions. Works with Claude Code, Codex, OpenCode and others.

Compresses captured sessions with an LLM; stores them locally with vector search, with optional cloud sync.

OpenReflex: Learns without a model and never stores session content, only tool metadata, verified outcomes and the fixes that worked.

Mem0 for Claude Code[2]

Plugin

Remembers project knowledge and personal preferences across coding sessions.

Hooks save messages, answers, changed files and test results; Mem0's backend extracts and classifies memories.

OpenReflex: Keeps everything on your machine and records how tasks went rather than what was said.

ReasoningBank[3]

Research, 2025

Distils reusable reasoning strategies from an agent's successful and failed experiences; evaluated on web browsing and software engineering benchmarks.

The agent judges its own trajectories with an LLM-as-a-judge, then retrieves distilled memories for new tasks.

OpenReflex: Judges success by checks that actually passed, weighs execution cost as well as success when choosing a path, and runs inside everyday coding agents.

Agent Workflow Memory[4]

Research, 2024

Induces commonly reused workflows from past experience and provides them to guide later actions; evaluated on web navigation.

A language model induces workflows from past trajectories.

OpenReflex: Learns per project from live coding-agent hooks, without a model in the loop.

Agentic Context Engineering[5]

Research, 2025

Treats context as an evolving playbook that accumulates and refines strategies.

Generation, reflection and curation, adapting from natural execution feedback.

OpenReflex: Keeps a structured graph of paths and outcomes, picks among Pareto-efficient strategies within a budget and records regret, without an LLM curator.

Reflexion[6]

Research, 2023

Agents reflect verbally on task feedback and keep the reflections in an episodic memory buffer for later trials.

Self-reflection text written by the model itself.

OpenReflex: Lessons persist across sessions and agents in a project, and come from verified outcomes rather than self-reflection.

OpenHands Stuck Detector[7]

Agent framework feature

Flags repeating action-observation or action-error cycles, monologues and alternating patterns, and can halt the run.

Pattern checks over a single conversation's event history.

OpenReflex: Works across four agents through their hooks, weighs whether more work is worth it (continue, pivot or stop), and can point to a fix learned in an earlier task.

Sources

  1. 1.claude-mem (GitHub)
  2. 2.Mem0 for Claude Code (docs)
  3. 3.ReasoningBank (arXiv 2509.25140)
  4. 4.Agent Workflow Memory (arXiv 2409.07429)
  5. 5.Agentic Context Engineering (arXiv 2510.04618)
  6. 6.Reflexion (arXiv 2303.11366)
  7. 7.OpenHands Stuck Detector (docs)

Descriptions of other projects are summarised from their public documentation and papers as of September 2026. Spotted something out of date? Open an issue on GitHub.