OpenHands (formerly OpenDevin) Forgets Every Task. Here's the One-Command Fix.

OpenHands (formerly OpenDevin) is one of the most capable open-source coding agents — it reads your repo, runs commands, edits files, and ships changes. But every task starts from a blank slate. The architectural decision you explained last week, the convention you corrected it on yesterday, the library you told it to never use — all gone the moment the task ends.
This post is a walkthrough of the Hindsight integration for OpenHands. One command wires Hindsight's MCP server into your config and drops a recall/retain rule into AGENTS.md, so the agent pulls relevant context at the start of every task and saves durable facts as it works.
TL;DR
- OpenHands agents start every task cold — no memory of past decisions, preferences, or conventions.
- The Hindsight integration uses OpenHands' native MCP support.
pip install hindsight-openhands, runinit, done. initadds the Hindsight MCP server toconfig.toml(giving the agentrecall/retain/reflecttools) and writes a recall/retain rule intoAGENTS.md.- Because
AGENTS.mdis always-on context, the rule reliably steers the agent: recall first, retain durable facts — no prompting required. - Memory lives in a Hindsight bank you choose per project, so each repo gets its own isolated memory.
- Hindsight Cloud means no infrastructure. Sign up free.
Why OpenHands Needs Persistent Memory
OpenHands is great at the doing: give it a task and it plans, runs tools, and iterates until the work is done. Within a task it has full working context. But that context is scoped to the task. Close it, start the next one, and the agent is back to zero.
For a coding agent you run against the same repo day after day, that's the limitation you hit first. It re-derives the project's structure on every task. It re-suggests the dependency you already rejected. It forgets the deploy step you walked it through last time. You end up re-explaining the same context until it feels easier to just do the work yourself.
Hindsight gives OpenHands a memory that persists across tasks and sessions — and because OpenHands speaks MCP natively, wiring it in takes one command.
How It Works
OpenHands has native Streamable-HTTP MCP support, so the Hindsight MCP endpoint connects directly — no bridge, no proxy:
[mcp]
shttp_servers = [
{url = "https://api.hindsight.vectorize.io/mcp/my-project/", api_key = "hsk_..."}
]
That alone gives the agent three tools: recall, retain, and reflect. But tools the model can call aren't tools it will call. The second half of the integration makes memory a habit, not an option.
OpenHands loads AGENTS.md into the agent's context on every task. So the integration writes a recall/retain rule there:
You have persistent long-term memory through the Hindsight MCP server (
recall,retain, andreflecttools).
- At the start of each task, call
recallwith the user's request to load relevant decisions, preferences, and project context before you act. Use what's relevant and ignore the rest.- When you learn a durable fact — an architectural decision, a user preference, a convention, or anything worth remembering across sessions — call
retainto store it.- Do not mention these memory operations unless the user asks about them.
The rule lives in a fenced <!-- HINDSIGHT:BEGIN --> … <!-- HINDSIGHT:END --> block at the top of the file, so it leads the instructions and can be updated or removed without touching your own content.
Setup
Install the package and run init in your project:
pip install hindsight-openhands
cd your-project
hindsight-openhands init --api-token YOUR_HINDSIGHT_API_KEY --bank-id my-project
init merges the [mcp] entry into ./config.toml and writes the rule into ./AGENTS.md. The recommended backend is Hindsight Cloud — sign up free and create an API key.
Self-hosting works the same way; run the API locally and point init at it (no token needed for an open local server):
hindsight-openhands init --api-url http://localhost:8888 --bank-id my-project
If config.toml can't be parsed safely, init never touches it — it prints the exact snippet to paste instead. You can also preview everything without writing anything:
hindsight-openhands init --print-only
Per-Project Memory
The --bank-id is the routing key for memory. A Hindsight bank is just a namespace, and the natural granularity for a coding agent is one bank per project:
hindsight-openhands init --bank-id acme-api
Each repo gets its own isolated memory — decisions and conventions for acme-api never bleed into acme-frontend. Because the bank lives server-side (on Cloud or your own instance), the same memory is there whether you run OpenHands locally, in CI, or from another machine. The bank id defaults to openhands if you don't set one.
Commands
| Command | What it does |
|---|---|
hindsight-openhands init | Add the MCP server + recall/retain rule |
hindsight-openhands status | Show whether the server + rule are configured |
hindsight-openhands uninstall | Remove the server + rule (leaves your own content intact) |
Three Things It Gets Right
Native MCP, no bridge. OpenHands speaks Streamable-HTTP MCP, and Hindsight serves it directly. There's no local proxy process to babysit and nothing to keep running alongside the agent — just a URL in config.toml.
The rule makes recall reliable. Exposing memory tools isn't enough; the model has to actually use them. Putting the rule in always-on AGENTS.md context means the agent is reminded to recall and retain on every single task, so memory isn't left to chance.
It edits your files surgically. init merges into existing config.toml and AGENTS.md rather than overwriting them, and the rule sits in a fenced block. uninstall removes exactly that block and nothing else. Your config and your agent instructions stay yours.
Recap
| OpenHands default | With Hindsight | |
|---|---|---|
| Memory across tasks | None | Persistent, per bank |
| Setup | n/a | One command (init) |
| Transport | n/a | Native MCP (no bridge) |
| Recall/retain | n/a | recall / retain / reflect tools, rule-guided |
| Per-project isolation | n/a | Set --bank-id |
| Removal | n/a | uninstall — surgical, non-destructive |
Next Steps
- Hindsight Cloud: ui.hindsight.vectorize.io
- Integration docs: OpenHands + Hindsight
- Source: vectorize-io/hindsight/hindsight-integrations/openhands
