openclaw memory
Manage semantic memory indexing, search, and promotion into MEMORY.md.
Provided by the bundled memory-core plugin, available when
plugins.slots.memory selects memory-core (the default). Other memory
plugins expose their own CLI namespaces.
Related: Memory concept, Dreaming,
Memory config reference, Memory Wiki,
wiki, Plugins.
memory status
--agent, runs for every agent in agents.entries; if no agent list is
configured, falls back to the default agent.
If the
Dreaming line stays off even with dreaming.enabled: true, or
scheduled sweeps never seem to run, the managed dreaming cron depends on the
default agent’s heartbeat firing to trigger reconciliation. See
Dreaming for scheduling details.
Status also lists any extra search paths from memory.search.extraPaths.
memory index
status. --force runs a full reindex instead of
an incremental one. --verbose prints per-agent provider, model, sources, and
extra-path details before showing indexing progress. The completion message
reports the indexed file count. An empty corpus is a successful no-op: the
command reports the resolved workspace path and that nothing was indexed, and
leaves the missing memory/ directory for the first memory write to create.
memory search
- Query: positional
[query]or--query <text>. If both are set,--querywins. If neither is set, the command errors. --agent <id>: defaults to the default agent (not the full agent list).--max-results <n>: cap result count (positive integer).--min-score <n>: filter out matches below this score.
--json, the response adds
stale: true, plus warning and action fields describing how to rebuild the
index. Treat an empty results array as authoritative only when stale is
absent.
memory promote
Rank short-term candidates from memory/YYYY-MM-DD.md and optionally append
top entries to MEMORY.md.
The CLI and scheduled dreaming sweep share the deep-phase defaults below.
Explicit CLI flags override them for a one-off manual run.
Ranking signals: recall frequency, retrieval relevance, query diversity,
temporal recency, cross-day consolidation, and derived concept richness, drawn
from both memory recalls and daily-ingestion passes, plus a light/REM phase
reinforcement boost for repeated dreaming revisits. Before writing, promotion
re-reads the live daily note, so edits or deletions to short-term snippets
since ranking are respected instead of promoting from a stale snapshot.
memory promote-explain
Explain one promotion candidate’s score breakdown.
<selector> matches a candidate’s key (exact or substring), path, or snippet
text.
memory rem-harness
Preview REM reflections, candidate truths, and deep-phase promotion output
without writing anything.
--path <file-or-dir>: seed the harness from historicalYYYY-MM-DD.mddaily files instead of the live workspace.--grounded: also render a groundedWhat Happened/Reflections/Possible Lasting Updatespreview from the historical notes.
memory rem-backfill
Write grounded historical REM summaries into DREAMS.md for UI review.
Reversible.
--path <file-or-dir>: required unless--rollback/--rollback-short-termis set. Historical daily memory file(s) or directory to backfill from.--stage-short-term: also seed grounded durable candidates into the live short-term promotion store so the normal deep phase can rank them.--rollback: remove previously written grounded diary entries fromDREAMS.md.--rollback-short-term: remove previously staged grounded short-term candidates.
memory session-backfill
Distill retained session history through the same provenance and short-term
staging pipeline used by dreaming. The default is a read-only preview, ordered
from the oldest unprocessed day to the newest.
The command reads the selected agent’s canonical session store, including
retained SQLite transcript identities from session rotation. It uses the same
tracked message hashes and per-run caps as live session ingestion, so repeated
--apply runs skip already ingested messages. Owner and agent lines from the
canonical store are eligible; tool output, web or non-owner input, and turns
without trustworthy owner provenance are excluded. Foreign archive files have
no authenticated owner-provenance contract, so their embedded ownership fields
remain untrusted and cannot be staged.
--apply drains the selected history to completion in one invocation while
keeping each bounded batch in its own transaction. Human and JSON output report
per-batch progress plus total batches, candidates, and staged entries. A
successful apply followed immediately by preview therefore reports zero new
candidates. It writes only the session corpus under memory/.dreams/, short-term
staging state, and reversible diary entries in DREAMS.md. It never writes
MEMORY.md or USER.md; durable promotion remains a separate memory promote
or dreaming decision. --rem and --apply are mutually exclusive.
Backfill rollback is intentionally shared with memory rem-backfill: both
commands use the same grounded-only staging class and diary markers. Run
session-backfill --rollback only when you intend to clear both commands’
grounded backfill artifacts from that workspace. Rollback also removes the
tracked hashes added by session backfill and rewinds the affected transcript
cursors, so the same candidates can be previewed and applied again.
Dreaming
Dreaming is the background memory consolidation system with three cooperative phases, run in order on one schedule: light (sort/stage short-term material), REM (reflect and surface themes), deep (promote durable facts intoMEMORY.md). Only deep writes to MEMORY.md.
- Enable with
plugins.entries.memory-core.config.dreaming.enabled: true(defaulttrue);memory-coreauto-manages the sweep cron job, no manualopenclaw cron addrequired. - Toggle from chat with
/dreaming on|off; inspect with/dreaming status(or/dreaming//dreaming help).on/offrequires channel owner status or gatewayoperator.admin;statusand help stay available to anyone who can invoke the command. - Human-readable phase output goes to
DREAMS.md(or an existingdreams.md). By default (dreaming.storage.mode: "separate") each phase also writes a standalone report tomemory/dreaming/<phase>/YYYY-MM-DD.md; setmode: "inline"to fold reports into the daily memory file instead, or"both"for both. - Scheduled and manual
memory promoteruns share the same deep-phase ranking signals and default thresholds; explicit CLI flags remain one-run overrides. - Scheduled runs fan out across every configured agent’s memory workspace.
plugins.entries.memory-core.config.dreaming):
SecretRef gateway dependency
If active memory remote API key fields are configured as SecretRefs,memory
commands resolve them from the active gateway snapshot; if the gateway is
unavailable, the command fails fast. This requires a gateway supporting the
secrets.resolve method; older gateways return an unknown-method error.