Skip to content

feat: integrate MemPalace as persistent agent memory backend #738

@ductrantrong

Description

@ductrantrong

Proposal

Integrate MemPalace as a persistent memory backend for GoClaw agents — giving them cross-session recall with the highest retrieval accuracy ever benchmarked.

Why MemPalace

MemPalace holds the highest LongMemEval score ever published, free or paid:

Metric Score
LongMemEval R@5 (zero API calls) 96.6%
LongMemEval R@5 (with Haiku rerank) 100%
Retrieval boost from palace structure +34%
Cost $0 — local only, no cloud, no subscription

Benchmarks are reproducible: benchmarks/

Why This Fits GoClaw

  1. MCP-native — MemPalace ships an MCP server (python -m mempalace.mcp_server) exposing 19 tools. GoClaw already supports MCP (stdio/SSE/streamable-http), so the integration path is straightforward: register MemPalace as an MCP tool provider per agent or per tenant.

  2. Complements existing memory — GoClaw has BM25 + pgvector hybrid search for skills and a knowledge graph for structured facts. MemPalace adds a different layer: lossless conversational memory organized into a palace structure (wings → halls → rooms). Agents could recall why a decision was made months ago, not just what was decided.

  3. AAAK compression — MemPalace's AAAK dialect compresses months of context into ~170 tokens for agent wake-up. For GoClaw's multi-tenant setup, this means each agent can load its full history cheaply at session start without blowing token budgets.

  4. Multi-tenant alignment — MemPalace stores everything locally per project/person. This maps naturally to GoClaw's per-user PostgreSQL workspaces — each tenant gets their own palace.

  5. Local-first — No external API calls needed. Runs on ChromaDB locally. Fits GoClaw's "$5 VPS" deployment target.

Suggested Implementation

Phase 1: MCP Tool Provider

  • Register MemPalace MCP server as an optional tool provider in agent config
  • Expose mempalace_search, mempalace_mine, mempalace_status etc. to agents
  • Per-tenant palace paths mapped to GoClaw workspaces

Phase 2: Native Integration

  • Auto-mine agent conversations into MemPalace after each session
  • AAAK wake-up context injected into agent system prompts on session start
  • Palace management via GoClaw admin dashboard

Phase 3: Deep Integration

  • Replace or augment pgvector memory with MemPalace's palace-structured retrieval for conversation history
  • Team-level palaces for shared agent memory across agent teams
  • Heartbeat agents that periodically mine and organize palace data

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions