Skip to content
Flows
Tier 3 · Agent memory Agent memory · fetched 2026-07-02

openclaw-self-memory

Long-term memory for agents with hybrid search, reranking, and explicit 'compaction protection': preserving what matters when the context window fills and compaction wipes raw conversation detail.

View source on GitHub

Key takeaways

  • 01

    Compaction is the moment memories are lost - protect against it explicitly

  • 02

    Hybrid search + reranking for recall quality

  • 03

    Write session-survival summaries before compaction hits

Flows built on this research

From the archive

Verbatim excerpts mined from our local archive of this repository — the prompts, schemas, and patterns worth stealing.

Memory

Hybrid + rerank: from 30% to 100% Precision@3

Query -> [BM25 keyword search] --+
                                  +- Weighted Fusion (70/30) -> Cohere Rerank -> Results
Query -> [ChromaDB vector search]-+

Benchmark results:
| Vector-only (baseline) | Precision@3 30% | MRR 0.167 | Grade D |
| Hybrid (BM25+vector)   | Precision@3 60% | MRR 0.417 | Grade C |
| Hybrid + Rerank        | Precision@3 100% | MRR 0.950 | Grade A |

Measured on a real agent's memory corpus: pure vector search graded D; adding BM25 keywords and a reranker took retrieval to perfect Precision@3.

README.md

Memory

HOT/WARM/COLD tiers with promotion rules

HOT - memory/hot/HOT_MEMORY.md: active tasks, session state; load every session; aggressively prune, max 1-2 pages.
WARM - stable preferences, tool config, important people, recurring errors; load every session.
COLD - MEMORY.md: archive, distilled lessons; load only in main session (not shared/group contexts).
Daily logs - memory/YYYY-MM-DD.md: raw record.

Tier maintenance (during heartbeats):
- Completed task in HOT -> delete or archive to COLD
- New stable info -> promote to WARM
- Daily log lessons -> promote to COLD

A working three-tier memory with explicit promotion/demotion rules - and a compaction-guard script that snapshots all tiers before the context window gets compacted.

references/memory-tiers.md