📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

I Fixed OpenClaw’s Biggest Problem (Memory)

Larue6:31

Transcription

In my previous video, the most common question people asked was how to fix memory. It is the most important system you need to build for your agent because the default one sucks. Today, you'll learn how OpenClaw's memory actually works and why it fails, how to fix it, and build a perfect memory system that makes OpenClaw remember everything.

So, OpenClaw's memory is split in two layers. A few markdown files stored on your computer and a retrieval system. Basically, how well it can search through those files. The markdown layer has two main files. Memory MD, which stores long-term memory, and daily logs, which your agent creates every day with notes like what you asked, what it did, and what decisions were made that day. Basically, if the information will still matter next month, it goes to memory.md. But if it matters only today, it goes to daily logs. Markdown files are the source of truth. And the way information gets in there is either you explicitly ask your agent to remember something or it does it on its own automatically. And when the agent needs to pull information from memory, it doesn't just read through every file because that would blow up your context window. Instead, it uses hybrid memory search, which lets it search through memory files by exact keywords and by meaning and then pull only the relevant chunks of information.

By the way, if you don't have a Mac Mini or you just don't want to deal with the technical setup, Maxclaw is the easiest and most affordable way to deploy OpenClaw built by Miniax. It's a 24/7 AI agent that you can deploy in one click for just $19 with zero extra API cost. It's powered by Miniax M2.5, which is a state-of-the-art model for coding and agentic tool use. All you have to do is head over to agent.mminia.io, io. Open the Maxclaw tab and click start now. Choose a configuration for your use case and that's it. Your agent is up and running. You can also use it on your phone through Miniaax agent mobile app or connect it directly to Telegram, Discord or Slack. Use the first link in the description and shout out Maxclaw for sponsoring this video. Now, let's get back to it.

The default memory system has quite a few problems. What information to save and what not to is decided by the model. Though some important information won't be saved automatically, and some things will be saved that you don't even want. Even when information is saved, the agent often just answers based on the context window instead of going to search its memory files. Lots of information gets wiped out because of the compaction. And the default memory flush saves a lot of noise instead of information that actually matters. By default, the agent has access only to your memory files. It cannot access your previous conversations. Search quality degrades as memory grows. The more you use it, the more memory files there are, which leads to less accurate results. And finally, there's no relation between chunks of text. For example, if you mention that Sarah manages the [music] backend team, and in a few days you ask who handles the API. The agent knows Sarah exists, knows the backend exists, but can't connect them. It retrieves both memories, but doesn't understand Sarah manages the backend.

So, let's fix it. Memory flush is a function that triggers right before the compaction to save important information from the context window to memory before it's gone. It's enabled by default, but the default configuration sucks. The prompt it uses is just store durable memories, but it doesn't explain what durable is. So, paste this code into your config file, and it'll improve the quality of information it saves. Basically, we specify what type of information the agent should look for. Feel free to customize it, but be careful because if your flush prompt is sloppy, you will store junk and retrieval will get noisy. By the way, all the config snippets and prompts from this video you can find in my Telegram channel. [music] Scan the QR code or click the link in the description under this video.

Now, let's make the past queryable. Add this configuration to your agent and it'll enable session indexing, which gives your agent the ability to search through past conversations. The trade-off is that you get coverage, but you also bring in more noise. So, your flush prompt becomes even more important because it creates a cleaner signal for the agent to retrieve. But the best way to manage your memory system is to do it manually. If you have any specific information you want your agent to remember, just ask it to do so. Or at the end of an important conversation, say something like, "Listen that we can save to memory." And pick the information you think is important. And to remove the junk from your memory system, give yourself a habit at least once a week to read through memory files and remove noise from there. Use Obsidian if you want a really nice and clean UI to edit markdown files.

That'll cover the basics, but now let's get to the advanced stuff. Searching memory becomes a real problem as it grows. The default search system wasn't built for large memory. It works perfectly fine at the beginning, but struggles to find the right information as your memory grows. QMD is a local search engine that combines keyword and semantic search and then reranks the results to put the most relevant ones first. It's much better than the default search for larger memory files. You can download it with npm or bun and change the memory backend config to QMD, but honestly, just ask your agent to help you.

Mezero is an open-source separate memory layer that solves two of the most important problems. It auto captures memory without relying on the agent to decide what to save. And it autorecalls relevant memory before the agent responds. Basically, you stop relying on the agent's judgment for what to save and what to look up. Mem0ero handles both automatically. It directly solves missed writes and compaction loss because the memory lives outside the context window. Mem0ero installs as an openclaw plugin. Use this single command and in just 30 seconds it gives your agent persistent memory across sessions.

And finally, to add relationships to your memory, we can use Cognney. Cognney is an open-source knowledge engine that makes your documents both searchable by meaning and connected by relationships. So, if Sarah manages the back-end team, the agent now understands she also owns the API. The default retrieval is good at similarity but bad at reasoning over relationships like ownership or dependencies. Cognney is good for deep understanding of relationships and structured knowledge like enterprise settings or multi-agent teams, but it might be overkill for more basic openclaw setups. Anyway, if you learned anything from this video, subscribe [music] and I'll see you in the next one.