Skip to content

How memory works

Your agent captures what’s worth keeping and brings it back when it’s relevant, without any wiring from you. This page explains what’s happening behind that, so you can trust it and adjust it.

Alfe reads an agent’s conversations and distills the durable details into memory: decisions, preferences, and facts worth keeping. This happens in the background, shortly after a conversation goes quiet, so it doesn’t slow the live interaction.

When memory is first installed, it can also backfill the agent’s recent chat history once, so the agent doesn’t start from nothing.

When a new message arrives, the agent looks for relevant memories and brings them into its working context before answering. Recall is based on meaning, so a memory can surface even when the wording differs from the question.

The agent also has memory tools for deliberate use, including memory_recall, memory_store, and memory_forget. They work the same way on OpenClaw and on terminal runtimes such as Claude Code.

Memories are grouped into a three-level hierarchy, so related knowledge stays together:

  • Topic — the broad area, such as billing or product.
  • Subtopic — a narrower grouping, such as invoicing.
  • Tag — the kind of memory, such as preference or fact.

Each memory also has an importance, a hint about how significant it is.

Alongside individual memories, an agent keeps facts about the people and things it deals with, in the form subject, predicate, object. For example: “Acme → prefers → single monthly invoice.”

Facts are recalled with related memories, which is why an agent can answer “what do we know about Acme?” with a coherent picture. Each fact has a date it became true from and a confidence. When new information contradicts a fact, the old one expires instead of lingering.

The Memory integration has settings you can change for an OpenClaw agent:

  • Auto-capture — capture memories from conversations automatically.
  • Auto-recall — bring relevant memories into context automatically.
  • Backfill chat history — ingest existing chat sessions once, on first install.
  • Max capture length, Idle flush interval, and Backfill session cap — fine-tune how capture and backfill behave.

You don’t always have to start empty. There are two ways to begin with memory:

  • Curated seeds — a template can declare reviewed starter knowledge that’s loaded when you create an agent from it.
  • Your own agent’s memory — when you save an agent as a template, you can include what it has learned. That template stays private.

The automatic behavior covers most needs. Reach for the Agent API when you want to:

  • Seed an agent from a document or a knowledge base.
  • Guarantee that a specific fact is remembered.
  • Search memory to build a feature on top of it.
  • Remove a memory that’s no longer accurate.