Simon Høiberg
@SimonHoiberg
I solved OpenClaw's memory issue. (At least, this is the best solution I tried so far). And yes. Big surprise. I solved it using RAG. All major models can now take millions of tokens as context. But the issue remains... The undisputed number #1 reason your agent is stupid and forgets simple things is because you're bloating context. So here's how I solved it with OpenClaw. 1️⃣ I installed PostgreSQL + pgvetor I run my OpenClaw on a Hetzner server, so I installed the database + pgvector extension directly on here. 2️⃣ Create a search tool Ask your agent to create a search tool for itself. Every time you ask it to remember something, it should: - Label the memory - Create a vector from the label - Store the label, vector, and raw text in the database Every time it's asked something it doesn't know, the FIRST thing it should always do is to use the search tool. 3️⃣ Memory CRON/heartbeat The agent can write to its memory file on-the-go. Consider this short-term memory. On a scheduled CRON (or heartbeat), it should "flush" its own short-term memory and store it in the database. Now, on every new session, the agent has very little context. The most important one is the description of using the search tool to enhance itself based on the task it's given. ✨ Major upsides - MUCH better memory - MUCH smarter - MUCH less token-greedy 👎 Major downsides - More moving parts - Complex for non-devs - Ongoing maintenance Still. Benefits outweigh the cons here. If you REALLY want to use OpenClaw professionally, I recommend that you use this 3-tool combo as a base: - OpenClaw itself - PostgreSQL + pgvector - n8n (for API proxies/security)