Skip to content

Commit fe6fc50

Browse files
tcconnallytcconnallyclaude
authored
feat(dream): sleep-time LLM consolidation episodic->semantic (mimir_dream, #364) (#369)
New mimir_dream tool: batches clusters of related cold/episodic memories per category (trigram neighborhoods, cold-first), reflects over each cluster via the configured --llm-endpoint, and writes back durable semantic insights (category=insight, working/semantic layer) with full evidence_for provenance to every source and derivation="dream". - Never fabricates: insights need >=2 cited sources; LLM output is untrusted data, parsed strictly (unknown types / empty summaries / out-of-range evidence indices are dropped, never repaired). - Idempotent: insight keys are a stable FNV-1a hash of the evidence set, so re-dreaming an unchanged cluster dedupes instead of duplicating. - Contradiction-aware: disagreeing sources become a flagged "contradiction" insight (sources always stay live), not a silent merge. - Bounded: max_entities caps the scan, max_clusters caps LLM calls. - Same archive safety rules as consolidate/#350: opt-in archive_sources never touches verified or importance-floored sources. - Local-first: clean error without --llm-endpoint (works offline), or opt-in fallback_consolidate to degrade to the non-LLM consolidate pass. Prompt fields sanitized via sanitize_prompt_field (#337); memories demoted to data-not-instructions in the prompt. - LLM boundary injected via dream_with_llm for deterministic, zero- network tests (9 db-level + 1 MCP-level; JSON-RPC smoke verified against the compiled binary). No schema change; no new dependencies (reuses ureq, Ollama /api/generate shape with OpenAI-compat fallback). - Docs: retention.md "Dreaming" section, README/CHANGELOG, tool count 49 -> 50 across README badge/tables, server.json, manifest.json, glama.json, CLAIMS-AUDIT.md. Closes #364 Co-authored-by: tcconnally <hermes@perseus.observer> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 2439efb commit fe6fc50

11 files changed

Lines changed: 1299 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ All notable changes to Perseus Vault (formerly Mimir/Mneme) are documented here.
2424
entities across clusters instead of only the nearest one). Communities are
2525
persisted in a new `communities` table (schema v8); `mimir_stats` now
2626
reports `total_communities` and `graph_modularity`.
27+
- `mimir_dream` — sleep-time LLM consolidation of episodic → semantic memory:
28+
clusters related cold memories per category, reflects over each cluster via
29+
the configured `--llm-endpoint`, and writes back provenance-linked semantic
30+
insights (`evidence_for` to every source, `derivation: "dream"`, idempotent
31+
by evidence-set hash, contradiction-aware, bounded budgets, dry-run;
32+
verified/importance-floored sources never archived). 53rd MCP tool (#364)
2733

2834
### Fixed
2935
- Context injection relevance gating (#356): `context`/`prepare` no longer

CLAIMS-AUDIT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
Claims verified against `src/`:
1010

11-
- **49 MCP tools** — exactly 49 distinct `mimir_*` tool names registered in
11+
- **50 MCP tools** — exactly 50 distinct `mimir_*` tool names registered in
1212
source (`src/mcp.rs` TOOLS schema); each is additionally exposed under
1313
`mneme_*` and `perseus_vault_*` aliases (same handler, not counted).
14-
README badge, comparison table, and the "49 MCP Tools" section all agree. ✓
14+
README badge, comparison table, and the "50 MCP Tools" section all agree. ✓
1515

1616
Verify the count against source (this is the authoritative command — re-run
1717
it and update README/manifest.json/glama.json whenever a tool is added):

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[![LangGraph](https://img.shields.io/badge/integrations-LangGraph-blue)](integrations/langgraph/)
1111
[![CrewAI](https://img.shields.io/badge/integrations-CrewAI-orange)](integrations/crewai/)
1212
[![AutoGen](https://img.shields.io/badge/integrations-AutoGen-purple)](integrations/autogen/)
13-
[![MCP Tools](https://img.shields.io/badge/MCP%20tools-52-brightgreen)]()
13+
[![MCP Tools](https://img.shields.io/badge/MCP%20tools-53-brightgreen)]()
1414

1515
Perseus Vault is a single Rust binary that gives AI agents durable memory across sessions.
1616
**One binary. One file. No Docker. No Postgres. No cloud.** Just persistent memory
@@ -93,15 +93,15 @@ local-first, zero-dependency, AND agent-first.
9393
|---|---|---|---|---|
9494
| **Deployment** | Single binary (~8MB) | Cloud + self-host | Docker/Postgres | Docker/Postgres |
9595
| **Dependencies** | None (SQLite embedded) | Python + vector DB | Postgres + Python | Postgres + Go |
96-
| **MCP-Native** |52 tools | ❌ Not MCP-native | ❌ Not MCP-native | ❌ Not MCP-native |
96+
| **MCP-Native** |53 tools | ❌ Not MCP-native | ❌ Not MCP-native | ❌ Not MCP-native |
9797
| **Offline/Local** | ✅ Fully local | Cloud-dependent | Docker needed | Docker needed |
9898
| **Encryption** | AES-256-GCM ✅ ||||
9999
| **Hybrid Search** | BM25 + Dense + RRF | Vector only | Vector only | Vector + Graph |
100100
| **Entity Lifecycle** | Decay + Promote + Archive ||||
101101
| **Entity Graph** | Link + Traverse ||||
102102
| **Journal Audit Trail** | ✅ Immutable ||||
103103
| **State Management** | ✅ Key-value + TTL ||||
104-
| **MCP Tools** | 52 | 5 | 8 | 0 |
104+
| **MCP Tools** | 53 | 5 | 8 | 0 |
105105
| **GitHub Stars** | ~20 | ~55K | ~15K | ~3K |
106106
| **License** | MIT | Apache 2.0 | Apache 2.0 | Apache 2.0 |
107107

@@ -143,7 +143,7 @@ Each adapter:
143143
Any MCP-compatible framework works with Perseus Vault directly. See
144144
[Awesome Mimir](awesome-mimir.md) for the full list.
145145

146-
## 52 MCP Tools
146+
## 53 MCP Tools
147147

148148
### Entity CRUD
149149
| Tool | Description |
@@ -204,6 +204,7 @@ Any MCP-compatible framework works with Perseus Vault directly. See
204204
| `mimir_compact` | Archive entities below decay threshold. |
205205
| `mimir_reindex` | Rebuild FTS5 search index from entities table. |
206206
| `mimir_consolidate` | Merge overlapping/duplicative entities in a category into durable, evidence-tracked observations (mirror image of `mimir_conflicts`). |
207+
| `mimir_dream` | Sleep-time LLM consolidation: reflect over clusters of related episodic memories via the configured LLM and write back durable semantic insights, provenance-linked to every source. Idempotent (evidence-set hash), contradiction-aware, bounded; requires `--llm-endpoint`. |
207208

208209
### Quality
209210
| Tool | Description |

docs/retention.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,38 @@ The legacy unconditional top-N dump remains available as an explicit opt-in
149149
(`mode: "always_inject"` on `mimir_context`, `--legacy-context` on
150150
`prepare`) and is unclamped unless a budget is passed. The gRPC `context`
151151
RPC keeps the legacy semantics for wire compatibility.
152+
## Dreaming (LLM consolidation, episodic → semantic)
153+
154+
Consolidation compresses *duplicates*; `mimir_dream` goes one step further and
155+
**reasons** over clusters of merely *related* memories. It batches the coldest
156+
entities per category (cold-first by default — consolidate fading memories
157+
before decay claims them), sends each trigram-neighborhood cluster to the
158+
configured LLM ("given these N memories, what stable pattern / preference /
159+
fact do they collectively imply?"), and writes the answer back as a durable
160+
**semantic insight** (category `insight`, `working` layer — the canonical
161+
storage layer for the `semantic` biomimetic alias). Properties:
162+
163+
- **Full provenance** — every insight links `evidence_for` to each source
164+
entity, and its body carries `derived: true`, `derivation: "dream"`, and the
165+
source ids, so it is auditable and reversible.
166+
- **Never fabricates** — insights need at least two cited sources; clusters
167+
that support no durable generalization are a no-op. LLM output is parsed
168+
strictly (unknown types, empty summaries, out-of-range evidence indices are
169+
dropped, never repaired into a write).
170+
- **Idempotent** — insights are keyed by a hash of their evidence set, so
171+
re-dreaming an unchanged cluster dedupes instead of duplicating.
172+
- **Contradiction-aware** — disagreeing sources become a flagged
173+
`contradiction` insight (sources always stay live), never a silent merge.
174+
- **Bounded**`max_entities` caps the scan, `max_clusters` caps LLM calls.
175+
- **Same archive safety rules** — opt-in `archive_sources` retires dreamed
176+
sources (`archive_reason` names the insight), but **verified or
177+
importance-floored sources are never archived**.
178+
179+
Dreaming requires `--llm-endpoint` (fully local via Ollama). Without one it
180+
returns a clean error — or, with `fallback_consolidate: true`, degrades to the
181+
mechanical `mimir_consolidate` cold-first pass. `dry_run: true` previews the
182+
candidate insights and their evidence sets without writing anything (not even
183+
a journal entry).
152184

153185
## Semantic recall and reinforcement
154186

glama.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"maintainers": [
44
"tcconnally"
55
],
6-
"tools": 52,
6+
"tools": 53,
77
"transport": {
88
"stdio": true,
99
"sse": true,

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"name": "perseus-vault",
44
"version": "2.13.0",
55
"display_name": "Perseus Vault — Persistent Memory for Claude (formerly Mimir/Mneme)",
6-
"description": "Persistent cross-session memory for Claude. 52 MCP tools: remember, recall, search, link entities, journal audit trail, state management, AES-256-GCM encryption. Local-first, single Rust binary, zero cloud dependencies.",
7-
"long_description": "Perseus Vault (formerly \"Mimir\", then \"Mneme\") gives Claude durable memory across sessions. It is a single Rust binary (~8MB) with an embedded SQLite database — no Docker, no Postgres, no cloud. Features include:\n\n- **52 MCP tools** for entity storage, hybrid search (FTS5 + dense vector), knowledge-graph traversal, journal audit trail, and state management\n- **AES-256-GCM encryption at rest** (optional, transparent)\n- **Fully local** — never phones home, no telemetry, air-gapped by default\n- **Agent-first design** — entity lifecycle with Ebbinghaus decay, auto-promotion, archiving\n- **Works with any MCP host** — Claude Desktop, Claude Code, Cursor, Hermes Agent, Perseus, and more\n\nInstall in one line: `curl -sSf https://raw.githubusercontent.com/Perseus-Computing-LLC/perseus-vault/main/scripts/install.sh | sh`",
6+
"description": "Persistent cross-session memory for Claude. 53 MCP tools: remember, recall, search, link entities, journal audit trail, state management, AES-256-GCM encryption. Local-first, single Rust binary, zero cloud dependencies.",
7+
"long_description": "Perseus Vault (formerly \"Mimir\", then \"Mneme\") gives Claude durable memory across sessions. It is a single Rust binary (~8MB) with an embedded SQLite database — no Docker, no Postgres, no cloud. Features include:\n\n- **53 MCP tools** for entity storage, hybrid search (FTS5 + dense vector), knowledge-graph traversal, journal audit trail, and state management\n- **AES-256-GCM encryption at rest** (optional, transparent)\n- **Fully local** — never phones home, no telemetry, air-gapped by default\n- **Agent-first design** — entity lifecycle with Ebbinghaus decay, auto-promotion, archiving\n- **Works with any MCP host** — Claude Desktop, Claude Code, Cursor, Hermes Agent, Perseus, and more\n\nInstall in one line: `curl -sSf https://raw.githubusercontent.com/Perseus-Computing-LLC/perseus-vault/main/scripts/install.sh | sh`",
88
"author": {
99
"name": "Perseus Computing LLC",
1010
"email": "privacy@perseus.observer",

server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
33
"name": "io.github.Perseus-Computing-LLC/mimir",
44
"title": "Perseus Vault (formerly Mimir/Mneme), persistent memory engine for AI agents",
5-
"description": "Local-first MCP memory server: SQLite, FTS5 and vector search, AES-256-GCM. 52 tools, no cloud.",
5+
"description": "Local-first MCP memory server: SQLite, FTS5 and vector search, AES-256-GCM. 53 tools, no cloud.",
66
"version": "2.13.0",
77
"packages": [{
88
"registryType": "oci",

0 commit comments

Comments
 (0)