#1000 landed the quarantine_stale_hnsw() primitive but, as noted in that PR, intentionally did not wire it into the backend open path:
Additive only. Exposes quarantine_stale_hnsw() as a helper. Intentionally not wired into _client() / startup on this PR — the goal is to land the primitive first so operators and higher layers can opt in. A natural follow-up is to call it automatically on palace open behind an env var or a config flag; happy to do that in a second PR once this shape is agreed.
Filing this as the tracking ticket for that follow-up.
Why it matters today
A palace hit the exact drift failure mode #1000 describes. Symptoms matched #823 / neo-cortex-mcp#2:
mempalace status — SIGSEGV
mempalace repair --yes — SIGSEGV (also crashes before it gets anywhere useful)
- MCP server under Claude Code — connection drops 1s into each
list_wings / search call, with "Failed to apply logs to the hnsw segment writer" in the stderr log
Three segments were 4–10 days out of sync between chroma.sqlite3 and data_level0.bin. After manually running quarantine_stale_hnsw(palace_path), everything worked immediately: status, search, MCP.
So the primitive does what it says — the gap is that an affected user has no path to recovery through the shipped CLI. mempalace repair is the natural entry point for "my palace crashes on open," and it currently segfaults before reaching any recovery code because get_collection() loads the HNSW index first.
Proposal
Two places it would help:
-
cmd_repair (highest-leverage) — call quarantine_stale_hnsw() before the first get_collection() / count() call. A repair command that can't be run on a corrupted palace is a repair command that doesn't do its job.
-
Backend _client() open path, behind a config flag — opt-in via hnsw.auto_quarantine_drifted = true in ~/.mempalace/config.json or a MEMPAL_AUTO_QUARANTINE=1 env var. The 1-hour default threshold is conservative enough that this should be safe to enable for most users who've been bitten. Keep it opt-in rather than default so the heuristic doesn't quietly quarantine segments on someone else's setup.
Related
#1000 landed the
quarantine_stale_hnsw()primitive but, as noted in that PR, intentionally did not wire it into the backend open path:Filing this as the tracking ticket for that follow-up.
Why it matters today
A palace hit the exact drift failure mode #1000 describes. Symptoms matched #823 / neo-cortex-mcp#2:
mempalace status— SIGSEGVmempalace repair --yes— SIGSEGV (also crashes before it gets anywhere useful)list_wings/searchcall, with"Failed to apply logs to the hnsw segment writer"in the stderr logThree segments were 4–10 days out of sync between
chroma.sqlite3anddata_level0.bin. After manually runningquarantine_stale_hnsw(palace_path), everything worked immediately: status, search, MCP.So the primitive does what it says — the gap is that an affected user has no path to recovery through the shipped CLI.
mempalace repairis the natural entry point for "my palace crashes on open," and it currently segfaults before reaching any recovery code becauseget_collection()loads the HNSW index first.Proposal
Two places it would help:
cmd_repair(highest-leverage) — callquarantine_stale_hnsw()before the firstget_collection()/count()call. A repair command that can't be run on a corrupted palace is a repair command that doesn't do its job.Backend
_client()open path, behind a config flag — opt-in viahnsw.auto_quarantine_drifted = truein~/.mempalace/config.jsonor aMEMPAL_AUTO_QUARANTINE=1env var. The 1-hour default threshold is conservative enough that this should be safe to enable for most users who've been bitten. Keep it opt-in rather than default so the heuristic doesn't quietly quarantine segments on someone else's setup.Related