Consolidation gate
Consolidation merges facts that say the same thing. Merging too eagerly loses
detail that a raw memory still had, so every candidate cluster must pass a gate
before it is merged and a replay check after. The gate is
runConsolidationGate in packages/consolidation/src/ConsolidationGate.ts.
The gate
A cluster of facts is merged only if all of these hold. The gate stops at the first condition that fails and reports it.
| Condition | Failure code |
|---|---|
| The cluster has at least 3 members; pairs are never merged | cluster_too_small |
| No member is canonical | canonical |
| Every member has a worth below 0.5 | high_worth |
| No member was recalled in the last 14 days | recently_recalled |
| No member has a Wilson lower bound above 0.7 | high_confidence |
| No member is pinned | pinned |
| No member is contested | contested |
| All members share one sensitivity tier | sensitivity_mismatch |
| Every member has an embedding | missing_embeddings |
| Every pair of members has a cosine of at least 0.85 | low_similarity |
The scheduler adds three checks around the gate
(packages/consolidation/src/scheduler.ts): it skips a workspace whose
consolidation lock is set, and treats a failed lock check as locked; it leaves
confidential and restricted facts out of the candidate set; and it only
considers facts, so episodes, decisions and the other kinds are never merged.
Replay check and rollback
A merge is applied and then tested (ReplayValidator.ts):
- Take up to ten distinct recent queries, from the recall log, that had returned one of the merged facts.
- If fewer than five exist, an LLM writes the missing ones to reach five.
- Run each query and see whether the merged fact still comes back.
| Result | Verdict | What happens |
|---|---|---|
| 60% or more of the queries miss | flagged | The merge is rolled back |
| 80% or more of the queries hit | boosted | The merge is kept and boosted |
| In between | neutral | The merge is kept |
| The check could not run | skipped | The merge is rolled back |
An error in the infrastructure is never counted as a miss. If the workspace has no replay validator available, the tick skips its candidates. A merge interrupted by a crash is restored at the start of the next tick.
What is never merged
- Pinned facts. Pinning is what protects a fact from merges. It does not raise the fact in recall.
- Canonical facts, marked by the daily governance job (worth above 0.8 with
a Wilson lower bound above 0.7) or by an operator with
POST /governance/gate. See Memory Worth. - Contested facts, and facts recalled in the last 14 days.
- Confidential and restricted facts.
- Anything that is not a fact.
Running it
The scheduler runs in the server on a 60-second interval. To force a pass for your workspace:
curl -X POST http://localhost:3939/consolidation/trigger \
-H "Authorization: Bearer mns_live_..." \
-H "Content-Type: application/json" \
-d '{"mode": "fast"}'{
"accepted": true,
"workspaceId": "...",
"mode": "fast",
"dryRun": false,
"mergedPairs": 0,
"skippedPairs": 2,
"candidatesProcessed": 14,
"errors": 0,
"tookMs": 412
}Only fast mode without dry-run is supported. "mode": "deep" and
"dryRun": true answer 422 and change nothing. The MCP tool is
memory_consolidate, with the same mode and dryRun arguments plus an
optional idempotencyKey.
Beta in docs/STATUS.md. Mnemosyne is alpha, on the 3.6.x line, and the API
can still change within 3.x.