feat: MemPalace memory provider (96.6% LongMemEval, local, free) - #5671
feat: MemPalace memory provider (96.6% LongMemEval, local, free)#5671ZK-Snarky wants to merge 4 commits into
Conversation
|
this would be a really amazing addition for hermes memory! any timeline on |
|
I would like to use this |
|
Bug report: embedding dimension mismatch on existing MemPalace collections Hi @ZK-Snarky, thanks for this PR — I cherry-picked it locally to integrate Hermes with my existing MemPalace install and hit a blocker worth reporting. TL;DR: the plugin opens the Chroma collection without specifying an Symptom (every conversational turn): Result: Root cause — self._chroma_client = chromadb.PersistentClient(path=str(self._palace_path))
self._chroma_collection = self._chroma_client.get_or_create_collection(
"mempalace_drawers" # no embedding_function → Chroma default = MiniLM 384
)Compare with the upstream MemPalace package ( from mempalace.ollama_embedding import OllamaEmbeddingFunction
ef = OllamaEmbeddingFunction(model="bge-m3")
col = client.get_or_create_collection("mempalace_drawers", embedding_function=ef)Fix — 3-line patch: from mempalace.ollama_embedding import OllamaEmbeddingFunction
ef = OllamaEmbeddingFunction(model="bge-m3")
self._chroma_client = chromadb.PersistentClient(path=str(self._palace_path))
self._chroma_collection = self._chroma_client.get_or_create_collection(
"mempalace_drawers",
embedding_function=ef,
)Tested locally (Hermes gateway + MemPalace 1024-dim collection, ~68k drawers). After patch + gateway restart, a Telegram turn produced the expected log: Sync now works as designed. Same bug exists in #12203 and #9761. Open design question — should the plugin fall back gracefully if |
|
Likely duplicate of #12203 — same MemPalace memory provider plugin, more recent PR with triage notes referencing this one. |
|
Likely duplicate of #12203 |
|
Thanks for the triage @alt-glitch — you're right, I'll repost this on #12203 since it's the canonical one with active triage. Leaving this thread alone after this. Apologies for the noise. |
|
Salvage PR at #21017 — rebased the MemPalace provider implementation onto current main. |
|
Thanks @ZK-Snarky — appreciate you pointing people to #21017 and the kind words. The core implementation is yours; I just rebased it and picked up the review feedback. Hope to see it land soon. |
Adds MemPalace as a built-in Hermes memory provider.
MemPalace is the highest-scoring AI memory system ever benchmarked — 100% LongMemEval R@5 with Haiku rerank, 96.6% raw, no API key, no cloud, fully local.
Usage
Or use the one-command installer from the MemPalace side:
mempalace hermes installHow it works
initialize()~/.mempalace/, starts background worker, warms ChromaDBsystem_prompt_block()prefetch()sync_turn()on_session_end()on_pre_compress()on_memory_write()mcp_memorywrites into the palace8 tools exposed:
mempalace_search,mempalace_status,mempalace_list_wings,mempalace_list_rooms,mempalace_kg_query,mempalace_kg_add,mempalace_diary_write,mempalace_diary_readImplementation notes
Zero hardcoded config. Wings and identity load from
~/.mempalace/wing_config.jsonand~/.mempalace/identity.txtif they exist. Ships with empty defaults. Runmempalace initto configure.Non-blocking by design. All palace I/O runs in a background worker thread (bounded queue, maxsize=500). The agent loop never waits on storage.
Circuit breaker. After 5 consecutive failures the plugin backs off for 120s and logs a warning. Degraded gracefully — the agent keeps running, just without palace context.
Storage safety. ChromaDB client created once in
initialize()viaget_or_create_collection(). Dedup uses SHA-256 over full content (not a prefix hash). Collection errors disable palace writes without crashing the agent.Hermes-home scoped. Palace path, diary, and KG respect
hermes_homefrominitialize()kwargs, withget_hermes_home()fallback. Multiple profiles stay isolated.Review process
This PR went through four rounds of review before submission:
agent/memory_provider.pyABC and all 7 existing providerson_memory_writemissing from plugin.yaml,sys.path.insertinserting HOME into path,wake_up()None crash, wrong log levels in worker, tuple unpack outside try/finally, magic numbersAll findings fixed before submission. Smoke-tested end-to-end: import, init, sync_turn, prefetch, tool dispatch, shutdown.
Dependencies:
mempalace>=3.0.0,chromadb>=0.4.0(declared inplugin.yaml)Companion PR adding the integration to the MemPalace repo: MemPalace/mempalace#3