← Back to PRs

#7894: Memory improvements: Give OpenClaw better memory + REM sleep

by bornio open 2026-02-03 08:58 View on GitHub →
docs scripts agents stale
## Summary / user impact This change makes OpenClaw’s memory feel “sticky” across sessions without extra configuration by standardizing on a WM/STM-friendly workspace layout while keeping LTM explicit and opt-in. After this PR, OpenClaw will automatically create `STM.md` and `WORKING.md` in the agent workspace (when missing) and keep them updated via the existing pre-compaction memory flush. LTM stays opt-in (via `ltm/index.md` or `ltm/nodes/`). This means preferences, decisions, and other personalization signals can reliably land in durable memory that `memory_search` can retrieve later, improving continuity and “it remembers how I like things” behavior over time without unexpectedly expanding the indexed surface. ## What users get (before → after) - **Before**: memory was effectively limited to `MEMORY.md`/`memory.md` + `memory/**`. Users who already kept structured memory (STM + LTM) had to manually wire `extraPaths` or accept that the memory tools wouldn’t reliably see that content. - **After**: OpenClaw creates and maintains `STM.md` automatically and the memory tools can search/read STM (and LTM if you already opted in) out of the box, so structured personalization works immediately without extra config. ## Key behaviors / guardrails - `WORKING.md` is readable via `memory_get` but intentionally **not indexed** by default (keeps search results high-signal). - `ltm/` is only indexed when explicitly opted in by structure (`ltm/index.md` or `ltm/nodes/`), and OpenClaw does not auto-create that opt-in. - Existing workspaces that already have memory files keep working; legacy `MEMORY.md` + `memory/` remains supported. ## Implementation notes - Memory file detection includes `STM.md` and (when opted in) `ltm/`. - `memory_get` allowlist expands to include `STM.md`, `WORKING.md`, and `ltm/**` (opt-in only) while preserving existing `"path required"` rejection semantics for disallowed paths. - Docs and tool descriptions are updated to describe the expanded memory surface and the default retrieval strategy. ## Verification - Unit tests: cover STM inclusion, LTM opt-in behavior, and `ltm/` read gating. - Manual repro: `scripts/repro/memory-wm-stm-ltm-smoke.ts` exercises the WM/STM/LTM flow with a live model.

Most Similar PRs