Local agent memory that learns when to matter.
OpenClawBrain is my local-first memory system for OpenClaw agents. It turns corrections, outcomes, route misses, and handoff decisions into inspectable evidence, then learns a compact route function that decides when memory should enter a future turn.
An agent should learn when memory matters, not remember everything.
OpenClawBrain turns corrections, outcomes, misses, and handoffs into local evidence, then learns a small routing policy that decides when to bring the right memory into a future turn — or abstain when it is not confident.
The trust boundary is the important part: the LLM proposes meaning, but code owns validation, storage, calibration, promotion, and rollback. SQLite keeps the graph and evidence local and inspectable.
If you already run OpenClaw, install or upgrade with openclaw plugins install clawhub:openclawbrain@0.2.21 --force, then enable the plugin and restart the gateway.
The model proposes meaning. Code owns production behavior.
OpenClawBrain uses an LLM where it is useful: semantic interpretation of messy human feedback. The LLM can notice that "actually use pnpm here" is durable repo guidance, or that a bad handoff is a route-learning example. It does not directly write production memory or route traffic.
Deterministic code redacts, validates, scopes, dedupes, thresholds, stores, replays, calibrates, promotes, and rolls back. SQLite holds the graph and the evidence trail.
How a normal turn becomes a safer routing policy.
corrections, outcomes, route misses, handoffs
-> redacted route frames and memory nodes
-> SQLite evidence graph
-> shadow decisions on real traffic
-> replayable eval cases and labels
-> action-family calibration
-> candidate route-policy-v3 snapshots
-> gated promotion or rollback
-> bounded context injection or abstention
Harvest
Useful signals are captured after work happens: accepted memory, rejected memory, operator corrections, tool outcomes, and places where routing would have helped.
Distill
The teacher turns messy interaction into structured route frames with family, scope, canonical action key, risk flags, support, and evidence ids.
Shadow
Candidate policies score traffic without serving. The live agent keeps using the active policy while OpenClawBrain records what the candidate would have done.
Calibrate
Confidence floors are family-aware. A policy can be ready for repo workflow routing while still abstaining from personal preference routing.
route-policy-v3 is a compact learned function, not a memory dump.
The active policy runs before broad search. It asks a narrow question: does this kind of turn deserve memory, and if so, which evidence slice is worth injecting?
| Runtime path | Behavior |
|---|---|
| v3 match | Route memory when calibrated confidence clears the family threshold, then record proof. |
| v3 abstain | Keep the prompt clean when support is weak, confidence is low, or the policy lacks a safe match. |
| fallback | Use route-policy-v2, then legacy heuristics, for missing snapshots, invalid snapshots, no-match cases, and emergency rollback. |
| promotion | Only activate candidates that pass schema validation, replay, calibration, cold-start support, sync-budget checks, and cooldown controls. |
The system leaves proof for the things it claims.
OpenClawBrain exposes load state, SQLite health, proof events, graph/search state, active route-policy snapshots, shadow decisions, eval cases, calibration examples, family stats, candidate reports, and injection decisions.
openclaw plugins inspect openclawbrain --runtime
openclaw doctor
# /plugins/openclawbrain/proof?limit=10
# /plugins/openclawbrain/search?query=pnpm&limit=10
# /plugins/openclawbrain/route-policy
The current public release is 0.2.21, published on ClawHub and installed live on the Mac mini with the OpenClawBrain service, hooks, and routes loaded.