Adding memory to OpenClaw

it keeps a log and can resume one session; nothing reads the others back

OpenClaw writes every session to disk — since 2026.8 into one SQLite database per agent, ~/.openclaw/agents/<agent>/agent/openclaw-agent.sqlite, and before that one JSONL file per session under ~/.openclaw/agents/<agent>/sessions/, which the upgrade leaves behind as an archive. deja reads both, and needs the sqlite3 CLI for the database. openclaw chat --session <key> reopens a session. That is resumption, not memory: a new session knows nothing about the last one, and nothing about what you did in Claude Code, Codex or Cursor on the same machine the week before. This page is about adding that.

What OpenClaw already has

The session log, per agent, and a session key to resume by. Its default backend is claude-cli, so a Claude Code hook already reaches it there; the other providers get nothing between sessions unless a plugin puts it in front of the model.

Adding recall

From ClawHub, without the deja CLI on hand:

openclaw plugins install clawhub:@vshulcz/openclaw-deja
openclaw config set plugins.entries.deja-vu.hooks.allowConversationAccess true

The package brings the binary along, recalls before each turn and registers deja_recall, deja_fix and deja_blame. The second line is OpenClaw's grant: 2026.8.1 and later run a plugin's per-prompt hook only with it, and a plugin cannot ask for it itself. Or, with the CLI installed:

deja install openclaw-auto

Three things are written, and all three are reversible with deja uninstall openclaw:

  • The MCP server, so the model can call the deja tool itself — search past sessions, read one in full, see a file's history, ask what fixed an error, ask how a command is really run here, store a decision.
  • A hook pack under ~/.openclaw/hooks — a directory with HOOK.md and handler.js, which is OpenClaw's own format, so no openclaw plugins install step. It answers the agent:bootstrap event by appending a digest of this machine's relevant history to the Project Context set, without writing anything into the workspace.
  • A plugin under extensions/, with the package.json and openclaw.plugin.json pair OpenClaw validates. It registers an agent:bootstrap hook of its own that adds the project digest to the Project Context, and answers before_prompt_build with the history the prompt you just typed is about — both run under openclaw agent --local too, where the hook pack never does. The pack and the plugin name the session the same way, so a gateway session gets one digest, not two. It also answers before_compaction: deja reads the session file, which still holds the turns about to be summarized, and the next prompt gets the task, the commands with whether they passed, and what was still open. The list of blocks it has already been shown goes too, so recall can say them again.

Three things learned by running it against OpenClaw 2026.7.1, which the installer prints but are worth knowing before you test:

  • Internal hooks are off wholesale until hooks.internal.enabled is set. A pack listed as "ready" still never runs until then.
  • A hook pack is loaded by the gateway only. Tested under openclaw agent --local, the pack looks dead; that is what the plugin half is for.
  • There is no way to answer a failed command in the turn that produced it. before_tool_call can block a tool or rewrite its arguments; after_tool_call only observes; a message returned from tool_result_persist never reached the model in either mode; and enqueueNextTurnInjection returned nothing and drained nothing on the next turn, locally or through the gateway. So the repair other harnesses get beside the error has nowhere to go here.

plugins.allow is left alone: writing to it would be deja deciding what you trust. The plugin's directory goes into plugins.load.paths instead, which OpenClaw counts as provenance, so it starts without the two [plugins] warnings about an untracked plugin.

What arrives

At bootstrap, a short digest of what this machine has done on the project — decisions, the commands that worked, the errors that recurred — as one more entry in the Project Context. On each prompt, when your history already answers it, the plugin says so in front of the model; silence is the common case, and an injection is capped at about 1.5 KB per prompt and 4 KB per tool call. What memory costs has the measured comparison.

The part that is not about OpenClaw

The index covers every agent's transcripts on the machine — forty-two of them, each in its own format — so a fix found in Claude Code answers a question asked in OpenClaw, including sessions from before any of this was installed. A transcript a client later deletes stays searchable; only deja forget drops one on purpose. Nothing here writes memories, so there is nothing to hallucinate into your history; indexing and search are local, and credentials are stripped as the index is built (privacy).

Getting started · Switching between agents · The OpenClaw session format

Found this useful? Star deja-vu on GitHub.