AIApril 9, 20265 min read

OpenClaw's Memory Problem Is Solved: A 4-Layer Obsidian System That Actually Works

Alex Finn's viral prompt system gives OpenClaw a four-layer memory architecture — from instant recall to deep knowledge graphs. Here's how to build it.

OpenClaw's Memory Problem Is Solved: A 4-Layer Obsidian System That Actually Works
5:00

TL;DR

  • OpenClaw's native memory is an afterthought — but it doesn't have to be
  • Alex Finn's 4-layer memory framework gives your agent persistent, scalable context
  • Layer 1 (working) + Layer 2 (project) live inside OpenClaw; Layer 3 (Obsidian vault) + Layer 4 (on-demand RAG) extend it externally
  • Setup takes under an hour and transforms multi-day projects from frustrating to seamless

The Memory Problem

OpenClaw is world-class at execution. It spawns agents, runs cron jobs, browses the web, writes code — all with speed and reliability that rivals any dev tool on the market.

But if you've used it for more than a week, you've hit the wall. Ask your agent about a decision you made three days ago, and you're starting from scratch. It forgets your project conventions, your preferences, your earlier reasoning. You find yourself repeating context like a broken record.

This isn't a bug. It's an architectural gap. OpenClaw ships with lightweight session memory and a basic MEMORY.md, but for power users running complex, multi-session projects, that's simply not enough.

@AlexFinn surfaced a practical solution in a post that hit 563 likes — a four-layer memory architecture that scales from sub-second working memory to deep on-demand retrieval. No hype, no enterprise jargon. Just a system you can implement today.


The 4-Layer Theory

Alex's framework is elegant in its simplicity: four layers, each with a distinct purpose and retrieval speed.

Layer 1 — Working Memory (Always Present, Fast) The smallest layer. System prompts, your current preferences, active conventions. This lives in OpenClaw's SOUL.md or a dedicated system prompt and is injected into every session automatically. Latency: zero.

// Layer 1 System Prompt Snippet
You are working with Ziwen Xu's project. 
Current stack: React + Vite + TypeScript. 
Code style: functional components, named exports only. 
Always check existing files before creating new ones.

Layer 2 — Project Memory (Per-Repo, Context-Switched) Medium-grained. Lives in MEMORY.md files scoped to each project or workspace. When you switch projects, the agent loads a different memory file. This is where project-specific decisions, architecture choices, and conventions live.

// .openclaw/workspace/MEMORY.md excerpt
## Current Sprint (Week 14)
- Migrating auth from Session → JWT (see decisions/auth-2026-04.md)
- PR review requires 2 approvals from senior engineers
- Database: Postgres 16, accessed via Drizzle ORM

Layer 3 — Long-Term Knowledge (Obsidian Vault) The largest layer. A full Obsidian vault indexed and searchable. This is where you dump meeting notes, RFC discussions, architecture diagrams, and anything that doesn't fit in a single project's scope. OpenClaw queries this via a skill or MCP connection on demand.

// obsidian-query skill: triggered when project context is loaded
// Searches vault for: decisions/, standups/, architecture/
// Returns top 5 relevant notes as context injection

Layer 4 — On-Demand Retrieval (RAG-Style) The heaviest layer. Used when you need to pull in large documents, external references, or legacy codebase context. A RAG pipeline over a vector store or even a smart grep over your codebase. Triggered only when explicitly requested — never by default.

// Layer 4 Trigger Prompt
Before touching any legacy auth code, run:
search_codebase --query "JWT refresh token implementation"
search_docs --query "auth migration RFC"
Then summarize relevant findings before writing code.

The genius of this分层 (layered) approach: each layer has a different cost to retrieve and a different freshness. You never pay RAG prices for what you could keep in a system prompt.


Implementation Guide

Here's how to wire this up in under an hour.

Step 1: Configure Layer 1 — Working Memory

Update your SOUL.md with a persistent SYSTEM_PREAMBLE section at the top:

<!-- SYSTEM_PREAMBLE -->
You serve Ziwen Xu. He runs Hypercho Inc. and is building Copanion, 
an AI execution cockpit. He values speed, world-class aesthetics, 
and shipping. His communication style: bullet points, direct, 
no fluff. Never ask "would you like me to" — just do it or present a decision.

Step 2: Set Up Layer 2 — Project Memory

For each project workspace, create a MEMORY.md:

# In each ~/.openclaw/workspace-<project>/
touch MEMORY.md

Populate it with decisions, conventions, and active context. The key discipline: update it after every significant decision, not at the end of the day.

Step 3: Connect Obsidian (Layer 3)

Install the Obsidian MCP server or use a simple folder-watching skill:

// ~/.openclaw/skills/obsidian-query/SKILL.md (excerpt)
## Trigger
When: Agent loads a project workspace
Action:
  1. Scan ~/Vault/decisions/ for files modified in last 7 days
  2. Scan ~/Vault/standups/ for this week's entries
  3. Inject top 3 relevant notes as context

Alternatively, use the memory_search tool with your Obsidian vault path:

memory_search({ 
  query: "auth JWT migration decisions", 
  corpus: "wiki" 
})

Step 4: Configure Layer 4 — On-Demand RAG (Optional)

For legacy codebase queries, add a skill that triggers only on explicit request:

// ~/.openclaw/skills/rag-retrieval/SKILL.md
## Trigger
When: User says "check the legacy codebase" or "what did we do in v1?"
Action:
  1. Query vector store over ~/Code/legacy/
  2. Return top 10 chunks with file paths
  3. Do NOT auto-trigger — this layer is expensive

Results to Expect

After implementing all four layers:

  • Repeat question rate drops significantly — your agent stops asking the same clarifying questions it asked last week
  • Context on multi-day projects improves — a Friday afternoon session picks up exactly where Monday morning left off
  • Preference memory becomes reliable — your code style, communication preferences, and workflow conventions are remembered without re-explaining
  • Fewer "what were we doing here?" moments — the vault layer means architecture decisions are findable, not lost in Slack threads

Measurable signal: track how often you re-explain project context in a week. Before this system: probably daily. After: ideally once per project, at most.


How This Compares to Alternatives

Built-in OpenClaw memory (MEMORY.md): Not bad, but flat. No layering means everything competes for the same context slot. The 4-layer system gives you a principled hierarchy.

Third-party memory tools (Mem.ai, Notion AI, etc.): Solid for human memory, but they require manual linking to agent sessions. Alex's system is designed for agents from the ground up.

Manual context injection: The status quo. Effective but exhausting. You're the memory layer — that's a job for your agent, not you.

Enterprise RAG pipelines: Overkill for most developers. The 4-layer system uses RAG only for Layer 4, and only when explicitly called. No $50k vector DB required.

The key difference: this system respects retrieval cost. Cheap layers handle common cases; expensive layers handle rare, high-value lookups.


Final Take

OpenClaw's memory problem isn't a fatal flaw — it's a gap that the community has already solved. Alex Finn's 4-layer framework is implementable today, requires no special infrastructure, and scales from solo devs to teams.

The investment: about an hour to set up Layers 1–3. The return: agents that actually remember your project, your preferences, and your decisions — across sessions, across weeks.

Start with Layer 1 (your SOUL.md). Add Layer 2 (project MEMORY.md files) this week. Connect Obsidian next sprint. You'll never go back.


Inspired by @AlexFinn's viral post on AI agent memory architecture. His public prompt document is available in his original post.

Free tools

Hypercho also builds free, private, no-sign-up utilities that run entirely in your browser.

Browse all free tools →

Work with Hypercho

Have an AI idea or a problem to solve?We'll help you build it.

Strategy, a custom AI product, agents or AI employees. Tell us the goal and we'll show you the fastest honest path to it.

Book a strategy call