openclaw - 💡(How to fix) Fix Proposal: Palace-style structured memory — integrate hierarchical memory architecture (inspired by MemPalace) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62488Fetched 2026-04-08 03:03:36
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
1
Participants

Code Example

memory/
  INDEX.mdShort curated index (search entry point)
  palace/
    personal/Wing: people, relationships
      preferences/Hall: user preferences, habits
      decisions/Hall: key decisions made
    projects/Wing: work, tasks, goals
      milestones/Hall: achievements, progress
      problems/Hall: technical issues, solutions
    knowledge/Wing: learned facts, concepts
      concepts/Hall: explanations, frameworks
      references/Hall: links, resources
RAW_BUFFERClick to expand / collapse

Motivation

Current OpenClaw memory is flat: MEMORY.md (curated long-term) + memory/YYYY-MM-DD.md (daily logs). This works, but has fundamental limitations:

  1. Flat files hit context limits — MEMORY.md grows until it gets truncated. The 20KB soft cap is a band-aid, not a solution.
  2. No structure = poor retrieval — semantic search over a flat file finds matches but can't leverage organizational hierarchy.
  3. Claude's own context management (evident in Claude Code's architecture leaks) shows that structured, categorized memory significantly outperforms flat storage.

Proposal: Palace Memory Architecture

Inspired by MemPalace — which benchmarks 96.6% recall on LongMemEval with a hierarchical "Palace" structure.

Core Design

memory/
  INDEX.md              ← Short curated index (search entry point)
  palace/
    personal/            ← Wing: people, relationships
      preferences/     ← Hall: user preferences, habits
      decisions/        ← Hall: key decisions made
    projects/           ← Wing: work, tasks, goals
      milestones/       ← Hall: achievements, progress
      problems/         ← Hall: technical issues, solutions
    knowledge/          ← Wing: learned facts, concepts
      concepts/         ← Hall: explanations, frameworks
      references/       ← Hall: links, resources

Key insight from MemPalace: the structure itself improves retrieval by 34% — before any semantic search.

OpenClaw-Specific Advantages

  1. Pre-compaction flush already existscompaction.memoryFlush already auto-triggers before context compaction. Point this at the Palace structure instead of flat files.
  2. Built-in vector search — OpenClaw's memory_search supports hybrid BM25 + vector search + MMR. Apply it to Palace subdirectories for domain-specific retrieval.
  3. No new dependencies — MemPalace's gains come from structure, not new libraries. The Palace structure is just organized Markdown files.
  4. MMCP integration — MemPalace has an MCP server; OpenClaw v4.x supports MCP. A native Palace MCP provider could pull in MemPalace's research directly.

Compatibility

  • Backwards compatible: existing MEMORY.md and memory/*.md remain valid
  • Gradual migration: new memory goes to Palace structure, old files remain searchable
  • memory_search works: vector index can span directory trees

Comparison

ApproachRecallAnnual Cost
Flat MEMORY.md~60-70% (estimated)Low
LLM summaries~70%$507/yr
Palace Memory96.6%~$10/yr

Implementation Ideas

  1. Config option agents.defaults.memory.layout: "flat" | "palace" — flat is default, palace opt-in
  2. Auto-classify on write — when agent writes to memory/YYYY-MM-DD.md, also classify into Palace subdirectories
  3. Palace-aware memory_search — prioritize results from relevant Wing/Hall based on query terms
  4. MMCP integration — OpenClaw v4.x supports MCP; connect to MemPalace MCP server for native Palace support

References

  • MemPalace: https://github.com/milla-jovovich/mempalace
  • Benchmark: 96.6% LongMemEval R@5, +34% retrieval boost from structure alone
  • AAAK dialect: 30x lossless compression for AI context (relevant if Palace content grows large)

Inspired by hands-on use of OpenClaw alongside MemPalace. Happy to help test or prototype.

extent analysis

TL;DR

Implement the proposed Palace Memory Architecture to improve memory retrieval and structure.

Guidance

  • Introduce a configuration option agents.defaults.memory.layout to allow opting-in to the Palace structure.
  • Develop an auto-classification system to categorize new memory entries into the Palace subdirectories.
  • Modify the memory_search function to prioritize results from relevant Wings and Halls based on query terms.
  • Explore integrating the MemPalace MCP server with OpenClaw's MCP support for native Palace support.

Example

No explicit code example is provided, but the proposed directory structure for the Palace Memory Architecture is:

memory/
  INDEX.md
  palace/
    personal/
      preferences/
      decisions/
    projects/
      milestones/
      problems/
    knowledge/
      concepts/
      references/

Notes

The implementation of the Palace Memory Architecture requires careful consideration of backwards compatibility and gradual migration from the existing flat memory structure.

Recommendation

Apply the workaround by implementing the Palace Memory Architecture, as it offers a significant improvement in recall rate (96.6%) and retrieval boost from structure alone (+34%).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING