# How to give OpenClaw better memory

OpenClaw remembers things by writing plain Markdown files in your agent's workspace ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)), and the model only remembers what gets saved to disk, with no hidden state ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). MEMORY.md is the long-term file for durable facts and decisions, loaded at the start of a session ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)), and memory/YYYY-MM-DD.md files are the working layer for detailed daily notes ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). memory_search recalls notes with hybrid search ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)), the default built-in memory engine is SQLite-based and works out of the box with keyword, vector, and hybrid search ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)), and Dreaming is the default background consolidation path for memory ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

## How OpenClaw memory works

OpenClaw remembers things by writing plain Markdown files in your agent's workspace ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). The model only remembers what gets saved to disk, and there is no hidden state ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

The sections below cover the files, how to save things, how to find them again, the limits, and how memory is consolidated.

## The memory files

Each agent has four memory-related files ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). USER.md is optional and holds stable preferences and communication style ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). MEMORY.md is the long-term memory file, for durable non-profile facts and decisions, and it is loaded at the start of a session ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). It is not a raw transcript, daily log, or exhaustive archive ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). The memory/YYYY-MM-DD.md files are the working layer, for detailed daily notes ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

## How to save things to memory

Just ask your agent to remember something, and it writes the note to the appropriate file ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

OpenClaw also protects the moment context gets compressed. Before compaction summarizes the conversation, it runs a silent turn that reminds the agent to save important context to durable memory ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). The automatic memory flush is on by default; you can turn it off with `agents.defaults.compaction.memoryFlush.enabled: false` ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

## How to find things again

memory_search finds relevant notes using [semantic search](https://www.knowman.io/guides/ai-knowledge-base), even when the wording differs from the original ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). It uses hybrid search, combining vector similarity for semantic meaning with keyword matching ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

memory_get reads a specific memory file or line range ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). The intent tool creates, lists, or explicitly cancels event-conditioned standing intents, while time-based reminders continue to use scheduled tasks ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). The default built-in memory engine is SQLite-based and works out of the box with keyword search, vector similarity, and hybrid search ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

## Limits to plan around

If MEMORY.md grows past the bootstrap file budget, OpenClaw keeps the file on disk intact but truncates the copy injected into context ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

OpenClaw can exclude MEMORY.md from automatic memory context, logging a warning that memory provenance is untrusted ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). Memory can preserve approval context, but it does not enforce policy ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). For keeping what you inject into any model lean, see [give your AI context](https://www.knowman.io/guides/give-your-ai-context).

## Consolidation and imports

Dreaming is the default background consolidation path for memory ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). It writes phase summaries and diary entries to DREAMS.md for human review, including rewrite counts and highlights ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

The Control UI can import existing local [memory from Codex](https://www.knowman.io/guides/codex-memory), [Claude Code](https://www.knowman.io/guides/claude-code-memory), and [Hermes](https://www.knowman.io/integrations/hermes) ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). Imported memories are available through memory_get but are not merged into the agent's bootstrap MEMORY.md ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). If you want durable memory to behave more like a [maintained knowledge base](https://www.knowman.io/guides/knowledge-base-vs-second-brain-vs-pkm) than raw notes, the bundled memory-wiki plugin serves that use case ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

## Where KnowMan fits

[KnowMan saves articles and links](https://www.knowman.io/guides/teach-openclaw-your-knowledge), reads and tags them, answers questions with citations, and keeps memories of claims, decisions, and playbooks ([KnowMan guide](https://www.knowman.io/guides/mcp-server-knowledge-base)). Its open-source MCP client is a standalone local [stdio server](https://www.knowman.io/guides/what-is-an-mcp-server), package @knowman/mcp, run with `npx -y @knowman/mcp` on Node 22 or newer ([KnowMan guide](https://www.knowman.io/guides/mcp-server-knowledge-base)). It talks to KnowMan's HTTP API with a Bearer key in `KNOWMAN_API_KEY` ([KnowMan guide](https://www.knowman.io/guides/mcp-server-knowledge-base)). KnowMan also runs as a hosted remote MCP server at https://api.knowman.io/mcp, using OAuth sign-in or an API key.

Tools include kb_search for saved items by keyword or meaning, kb_ask for cited answers, kb_get_item for one item, kb_save to save a URL, kb_recent, and kb_memories for claims, decisions, and playbooks ([KnowMan guide](https://www.knowman.io/guides/mcp-server-knowledge-base)). Documented client setups include Claude Desktop, Claude Code, and Cursor ([KnowMan guide](https://www.knowman.io/guides/mcp-server-knowledge-base)). For the wider pattern, see [persistent memory for AI agents](https://www.knowman.io/guides/persistent-memory-for-ai-agents).

## Use the hosted KnowMan server

Open KnowMan at https://app.knowman.io and add https://api.knowman.io/mcp in an OpenClaw client that supports remote MCP servers. [Sign in](https://www.knowman.io/guides/personal-knowledge-base) on the KnowMan consent page with OAuth and approve access, or use an API key as an `Authorization: Bearer <key>` header.

After connecting, ask OpenClaw to search your KnowMan or [save a URL](https://www.knowman.io/guides/how-to-save-articles). The hosted server provides tools for searching, asking questions, reading items, saving links, and viewing recent items and memories.

## Questions

### How do I make OpenClaw remember something?

Just ask your agent to remember it, and it writes the note to the appropriate file ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). Before compaction summarizes the conversation, OpenClaw also runs a silent turn that reminds the agent to save important context to durable memory ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

### Why does MEMORY.md seem cut off in a session?

If MEMORY.md grows past the bootstrap file budget, OpenClaw keeps the file on disk intact but truncates the copy injected into context ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). OpenClaw can also exclude MEMORY.md from automatic memory context, logging a warning that memory provenance is untrusted ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

### Can OpenClaw import memory from other agents?

Yes. The Control UI can import existing local memory from Codex, Claude Code, and Hermes ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)). Imported memories are available through memory_get but are not merged into the agent's bootstrap MEMORY.md ([OpenClaw docs](https://docs.openclaw.ai/concepts/memory)).

### What does the KnowMan MCP server offer?

KnowMan saves articles and links, reads and tags them, answers questions with citations, and keeps memories of claims, decisions, and playbooks ([KnowMan guide](https://www.knowman.io/guides/mcp-server-knowledge-base)). Its open-source MCP client runs locally as a stdio server, with tools including kb_search, kb_ask, and kb_memories ([KnowMan guide](https://www.knowman.io/guides/mcp-server-knowledge-base)). KnowMan also runs as a hosted remote MCP server at https://api.knowman.io/mcp, using OAuth sign-in or an API key.

## Related guides

- [Persistent Memory for AI Agents](https://www.knowman.io/guides/persistent-memory-for-ai-agents)

- [Connect your knowledge base through KnowMan's MCP server](https://www.knowman.io/guides/mcp-server-knowledge-base)

- [How to Give Your AI Context from What You Read](https://www.knowman.io/guides/give-your-ai-context)

- [What is a personal knowledge base, and how do you build one?](https://www.knowman.io/guides/personal-knowledge-base)

## More in this topic

- [How to give VS Code better memory](https://www.knowman.io/guides/vscode-memory)
- [How to give opencode context with AGENTS.md](https://www.knowman.io/guides/opencode-memory)
- [How to give Qwen Code better memory](https://www.knowman.io/guides/qwen-code-memory)

## More for OpenClaw

- [Connect KnowMan to OpenClaw](https://www.knowman.io/integrations/openclaw)
- [How to teach OpenClaw your knowledge](https://www.knowman.io/guides/teach-openclaw-your-knowledge)

## A library your agent can read

Try KnowMan Pro for 14 days with no credit card. [Create your account](https://app.knowman.io/signup)

[Start free](https://app.knowman.io/signup)

Every new account starts with 14 days of Pro. No credit card.

Source: https://www.knowman.io/guides/openclaw-memory
