prism-mcp-server 5.2.1 → 6.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +356 -377
- package/dist/backgroundScheduler.js +463 -0
- package/dist/config.js +33 -0
- package/dist/dashboard/server.js +445 -102
- package/dist/dashboard/ui.js +707 -60
- package/dist/hivemindWatchdog.js +206 -0
- package/dist/lifecycle.js +62 -7
- package/dist/scholar/freeSearch.js +78 -0
- package/dist/scholar/webScholar.js +258 -0
- package/dist/sdm/sdmDecoder.js +75 -0
- package/dist/sdm/sdmEngine.js +158 -0
- package/dist/server.js +204 -17
- package/dist/storage/configStorage.js +1 -1
- package/dist/storage/sqlite.js +969 -168
- package/dist/storage/supabase.js +298 -10
- package/dist/storage/supabaseMigrations.js +75 -1
- package/dist/tools/agentRegistryDefinitions.js +11 -4
- package/dist/tools/agentRegistryHandlers.js +23 -5
- package/dist/tools/commonHelpers.js +127 -0
- package/dist/tools/compactionHandler.js +20 -2
- package/dist/tools/graphHandlers.js +706 -0
- package/dist/tools/hygieneHandlers.js +476 -0
- package/dist/tools/index.js +7 -2
- package/dist/tools/ledgerHandlers.js +1240 -0
- package/dist/tools/sessionMemoryDefinitions.js +324 -67
- package/dist/tools/sessionMemoryHandlers.js +455 -48
- package/dist/utils/autoLinker.js +170 -0
- package/dist/utils/briefing.js +1 -1
- package/dist/utils/cognitiveMemory.js +46 -0
- package/dist/utils/crdtMerge.js +190 -0
- package/dist/utils/healthCheck.js +15 -0
- package/dist/utils/imageCaptioner.js +1 -1
- package/dist/utils/llm/adapters/gemini.js +3 -3
- package/dist/utils/llm/factory.js +1 -1
- package/dist/utils/math.js +10 -0
- package/dist/utils/telemetry.js +2 -2
- package/dist/utils/turboquant.js +12 -4
- package/dist/utils/universalImporter.js +0 -0
- package/dist/utils/vaultExporter.js +176 -0
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
**Your AI agent forgets everything between sessions. Prism fixes that.**
|
|
12
12
|
|
|
13
|
-
One command. Persistent memory.
|
|
13
|
+
One command. Persistent memory. Local-first by default. Optional cloud power-ups.
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
npx -y prism-mcp-server
|
|
@@ -18,6 +18,23 @@ npx -y prism-mcp-server
|
|
|
18
18
|
|
|
19
19
|
Works with **Claude Desktop · Claude Code · Cursor · Windsurf · Cline · Gemini · Antigravity** — any MCP client.
|
|
20
20
|
|
|
21
|
+
## 📖 Table of Contents
|
|
22
|
+
|
|
23
|
+
- [Why Prism?](#why-prism)
|
|
24
|
+
- [Quick Start](#-quick-start)
|
|
25
|
+
- [The Magic Moment](#-the-magic-moment)
|
|
26
|
+
- [Setup Guides](#-setup-guides)
|
|
27
|
+
- [What Makes Prism Different](#-what-makes-prism-different)
|
|
28
|
+
- [Use Cases](#-use-cases)
|
|
29
|
+
- [What's New](#-whats-new)
|
|
30
|
+
- [How Prism Compares](#-how-prism-compares)
|
|
31
|
+
- [Tool Reference](#-tool-reference)
|
|
32
|
+
- [Environment Variables](#environment-variables)
|
|
33
|
+
- [Architecture](#architecture)
|
|
34
|
+
- [Scientific Foundation](#-scientific-foundation)
|
|
35
|
+
- [Product Roadmap](#-product-roadmap)
|
|
36
|
+
- [Limitations](#limitations)
|
|
37
|
+
|
|
21
38
|
---
|
|
22
39
|
|
|
23
40
|
## Why Prism?
|
|
@@ -28,81 +45,9 @@ Every time you start a new conversation with an AI coding assistant, it starts f
|
|
|
28
45
|
|
|
29
46
|
---
|
|
30
47
|
|
|
31
|
-
## ✨ What Makes Prism Different
|
|
32
|
-
|
|
33
|
-
### 🧠 Your Agent Learns From Mistakes
|
|
34
|
-
When you correct your agent, Prism tracks it. Corrections accumulate **importance** over time. High-importance lessons auto-surface as warnings in future sessions — and can even sync to your `.cursorrules` file for permanent enforcement. Your agent literally gets smarter the more you use it.
|
|
35
|
-
|
|
36
|
-
### 🕰️ Time Travel
|
|
37
|
-
Every save creates a versioned snapshot. Made a mistake? `memory_checkout` reverts your agent's memory to any previous state — like `git revert` for your agent's brain. Full version history with optimistic concurrency control.
|
|
38
|
-
|
|
39
|
-
### 🔮 Mind Palace Dashboard
|
|
40
|
-
A gorgeous glassmorphism UI at `localhost:3000` that lets you see exactly what your agent is thinking:
|
|
41
|
-
|
|
42
|
-
- **Current State & TODOs** — the exact context injected into the LLM's prompt
|
|
43
|
-
- **Interactive Knowledge Graph** — force-directed neural graph with click-to-filter, node renaming, and surgical keyword deletion *(v5.1)*
|
|
44
|
-
- **Deep Storage Manager** — preview and execute vector purge operations with dry-run safety *(v5.1)*
|
|
45
|
-
- **Session Ledger** — full audit trail of every decision your agent has made
|
|
46
|
-
- **Time Travel Timeline** — browse and revert any historical handoff version
|
|
47
|
-
- **Visual Memory Vault** — browse VLM-captioned screenshots and auto-captured HTML states
|
|
48
|
-
- **Hivemind Radar** — real-time active agent roster with role, task, and heartbeat
|
|
49
|
-
- **Morning Briefing** — AI-synthesized action plan after 4+ hours away
|
|
50
|
-
- **Brain Health** — memory integrity scan with one-click auto-repair
|
|
51
|
-
|
|
52
|
-

|
|
53
|
-
|
|
54
|
-
### 🧬 10× Memory Compression
|
|
55
|
-
Powered by a pure TypeScript port of Google's TurboQuant (ICLR 2026), Prism compresses 768-dim embeddings from **3,072 bytes → ~400 bytes** — enabling decades of session history on a standard laptop. No native modules. No vector database required.
|
|
56
|
-
|
|
57
|
-
### 🐝 Multi-Agent Hivemind
|
|
58
|
-
Multiple agents (dev, QA, PM) can work on the same project with **role-isolated memory**. Agents discover each other automatically, share context in real-time via Telepathy sync, and see a team roster during context loading.
|
|
59
|
-
|
|
60
|
-
### 🖼️ Visual Memory
|
|
61
|
-
Save UI screenshots, architecture diagrams, and bug states to a searchable vault. Images are auto-captioned by a VLM (Claude Vision / GPT-4V / Gemini) and become semantically searchable across sessions.
|
|
62
|
-
|
|
63
|
-
### 🔭 Full Observability
|
|
64
|
-
OpenTelemetry spans for every MCP tool call, LLM hop, and background worker. Route to Jaeger, Grafana, or any OTLP collector. Configure in the dashboard — zero code changes.
|
|
65
|
-
|
|
66
|
-
### 🔒 GDPR Compliant
|
|
67
|
-
Soft/hard delete (Art. 17), full ZIP export (Art. 20), API key redaction, per-project TTL retention, and audit trail. Enterprise-ready out of the box.
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## 🎯 Use Cases
|
|
72
|
-
|
|
73
|
-
**Long-running feature work** — Save state at end of day, restore full context next morning. No re-explaining.
|
|
74
|
-
|
|
75
|
-
**Multi-agent collaboration** — Dev, QA, and PM agents share real-time context without stepping on each other's memory.
|
|
76
|
-
|
|
77
|
-
**Consulting / multi-project** — Switch between client projects with progressive loading: `quick` (~50 tokens), `standard` (~200), or `deep` (~1000+).
|
|
78
|
-
|
|
79
|
-
**Visual debugging** — Save UI screenshots to searchable memory. Find that CSS bug from last week by description.
|
|
80
|
-
|
|
81
|
-
**Team onboarding** — New team member's agent loads the full project history instantly.
|
|
82
|
-
|
|
83
|
-
**Behavior enforcement** — Agent corrections auto-graduate into permanent `.cursorrules` / `.clauderules` rules.
|
|
84
|
-
|
|
85
|
-
**Offline / air-gapped** — Full SQLite local mode + Ollama LLM adapter. Zero internet dependency.
|
|
86
|
-
|
|
87
|
-
**Morning Briefings** — After 4+ hours away, Prism auto-synthesizes a 3-bullet action plan from your last sessions.
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## 🆕 What's New in v5.2
|
|
92
|
-
|
|
93
|
-
- 🧠 **Cognitive Memory** — Ebbinghaus importance decay computes `effective_importance = base × 0.95^days` at retrieval time. Frequently accessed memories stay prominent; neglected ones naturally fade. Tracks `last_accessed_at` per entry.
|
|
94
|
-
- 🎯 **Context-Weighted Retrieval** — New `context_boost` parameter on `session_search_memory` prepends your active project's context to the query before embedding, biasing results toward what matters right now.
|
|
95
|
-
- 🔄 **[Universal History Migration](#migrating-existing-history-claude-gemini-openai)** — Import years of Claude Code, Gemini, and ChatGPT sessions on day one. Strategy Pattern adapters with OOM-safe streaming, content-hash dedup, and `--dry-run` support. Also available via the [Dashboard Import UI](#-mind-palace-dashboard).
|
|
96
|
-
- 🧹 **Smart Consolidation** — Enhanced compaction extracts recurring principles alongside summaries for richer rollups.
|
|
97
|
-
- 🛡️ **SQL Injection Prevention** — 17-column allowlist on `patchLedger()` hardens all dynamic SQL paths.
|
|
98
|
-
- 🧪 **352 Tests** — Zero regressions across 15 suites.
|
|
99
|
-
|
|
100
|
-
> [Full CHANGELOG →](CHANGELOG.md) · [Architecture Deep Dive →](docs/ARCHITECTURE.md)
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
48
|
## 🚀 Quick Start
|
|
105
49
|
|
|
50
|
+
|
|
106
51
|
Add to your MCP client config (`claude_desktop_config.json`, `.cursor/mcp.json`, etc.):
|
|
107
52
|
|
|
108
53
|
```json
|
|
@@ -116,9 +61,47 @@ Add to your MCP client config (`claude_desktop_config.json`, `.cursor/mcp.json`,
|
|
|
116
61
|
}
|
|
117
62
|
```
|
|
118
63
|
|
|
119
|
-
**
|
|
64
|
+
> **Note on Windows/Restricted Shells:** If your MCP client complains that `npx` is not found, use the absolute path to your node binary (e.g. `C:\Program Files\nodejs\npx.cmd`) or install globally with caution.
|
|
65
|
+
|
|
66
|
+
**That's it.** Restart your client. All tools are available. Dashboard at `http://localhost:3000`. *(Note: The MCP server automatically starts this UI on port 3000 when connected. If you have a Next.js/React app running, port 3000 might already be in use.)*
|
|
67
|
+
|
|
68
|
+
### Capability Matrix
|
|
120
69
|
|
|
121
|
-
|
|
70
|
+
| Feature | Local (Offline) | Cloud (API Key) |
|
|
71
|
+
|:--------|:---:|:---:|
|
|
72
|
+
| Session memory & handoffs | ✅ | ✅ |
|
|
73
|
+
| Keyword search (FTS5) | ✅ | ✅ |
|
|
74
|
+
| Time travel & versioning | ✅ | ✅ |
|
|
75
|
+
| Mind Palace Dashboard | ✅ | ✅ |
|
|
76
|
+
| GDPR export (JSON/Markdown/Vault) | ✅ | ✅ |
|
|
77
|
+
| Semantic vector search | ❌ | ✅ `GOOGLE_API_KEY` |
|
|
78
|
+
| Morning Briefings | ❌ | ✅ `GOOGLE_API_KEY` |
|
|
79
|
+
| Auto-compaction | ❌ | ✅ `GOOGLE_API_KEY` |
|
|
80
|
+
| Web Scholar research | ❌ | ✅ `BRAVE_API_KEY` + `FIRECRAWL_API_KEY` |
|
|
81
|
+
| VLM image captioning | ❌ | ✅ Provider key |
|
|
82
|
+
|
|
83
|
+
> 🔑 The core Mind Palace works **100% offline** with zero API keys. Cloud keys unlock intelligence features. See [Environment Variables](#environment-variables).
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## ✨ The Magic Moment
|
|
88
|
+
|
|
89
|
+
> **Session 1** (Monday evening):
|
|
90
|
+
> ```
|
|
91
|
+
> You: "Analyze this auth architecture and plan the OAuth migration."
|
|
92
|
+
> Agent: *deep analysis, decisions, TODO list*
|
|
93
|
+
> Agent: session_save_ledger → session_save_handoff ✅
|
|
94
|
+
> ```
|
|
95
|
+
>
|
|
96
|
+
> **Session 2** (Tuesday morning — new conversation, new context window):
|
|
97
|
+
> ```
|
|
98
|
+
> Agent: session_load_context → "Welcome back! Yesterday we decided to use PKCE
|
|
99
|
+
> flow with refresh tokens. 3 TODOs remain: migrate the user table,
|
|
100
|
+
> update the middleware, and write integration tests."
|
|
101
|
+
> You: "Pick up where we left off."
|
|
102
|
+
> ```
|
|
103
|
+
>
|
|
104
|
+
> **Your agent remembers everything.** No re-uploading files. No re-explaining decisions.
|
|
122
105
|
|
|
123
106
|
---
|
|
124
107
|
|
|
@@ -200,18 +183,21 @@ Add to your Continue `config.json` or Cline MCP settings:
|
|
|
200
183
|
|
|
201
184
|
</details>
|
|
202
185
|
|
|
186
|
+
### Migration
|
|
187
|
+
|
|
203
188
|
<details>
|
|
204
189
|
<summary><strong>Migrating Existing History (Claude, Gemini, OpenAI)</strong></summary>
|
|
205
190
|
|
|
206
|
-
Prism can ingest months of historical sessions from other tools to give your Mind Palace a massive head start.
|
|
191
|
+
Prism can ingest months of historical sessions from other tools to give your Mind Palace a massive head start. Import via the **CLI** or directly from the [Mind Palace Dashboard](#-mind-palace-dashboard) Import tab (file picker + manual path + dry-run toggle).
|
|
207
192
|
|
|
208
|
-
|
|
193
|
+
#### Supported Formats
|
|
209
194
|
* **Claude Code** (`.jsonl` logs) — Automatically handles streaming chunk deduplication and `requestId` normalization.
|
|
210
195
|
* **Gemini** (JSON history arrays) — Supports large-file streaming for 100MB+ exports.
|
|
211
196
|
* **OpenAI** (JSON chat completion history) — Normalizes disparate tool-call structures into the unified Ledger schema.
|
|
212
197
|
|
|
213
|
-
|
|
214
|
-
|
|
198
|
+
#### How to Run
|
|
199
|
+
|
|
200
|
+
**Option 1 — CLI:**
|
|
215
201
|
|
|
216
202
|
```bash
|
|
217
203
|
# Ingest Claude Code history
|
|
@@ -221,151 +207,34 @@ npx -y prism-mcp-server universal-import --format claude --path ~/path/to/claude
|
|
|
221
207
|
npx -y prism-mcp-server universal-import --format gemini --path ./gemini_history.json --dry-run
|
|
222
208
|
```
|
|
223
209
|
|
|
224
|
-
|
|
210
|
+
**Option 2 — Dashboard:** Open `localhost:3000`, navigate to the **Import** tab, select the format and file, and click Import. Supports dry-run preview. See the [dashboard screenshot](#-mind-palace-dashboard) above.
|
|
211
|
+
|
|
212
|
+
#### Key Features
|
|
225
213
|
* **OOM-Safe Streaming:** Processes massive log files line-by-line using `stream-json`.
|
|
214
|
+
* **Idempotent Dedup:** Content-hash prevents duplicate imports on re-run (`skipCount` reported).
|
|
226
215
|
* **Chronological Integrity:** Uses timestamp fallbacks and `requestId` sorting to ensure your memory timeline is accurate.
|
|
227
216
|
* **Smart Context Mapping:** Extracts `cwd`, `gitBranch`, and tool usage patterns into searchable metadata.
|
|
228
217
|
|
|
229
218
|
</details>
|
|
230
219
|
|
|
231
220
|
<details>
|
|
232
|
-
<summary><strong>Claude Code — Lifecycle
|
|
233
|
-
|
|
234
|
-
Claude Code supports `SessionStart` and `Stop` hooks that force the agent to load/save Prism context automatically.
|
|
235
|
-
|
|
236
|
-
### 1. Create the Hook Script
|
|
237
|
-
|
|
238
|
-
Save as `~/.claude/mcp_autoload_hook.py`:
|
|
239
|
-
|
|
240
|
-
```python
|
|
241
|
-
#!/usr/bin/env python3
|
|
242
|
-
import json, sys
|
|
243
|
-
|
|
244
|
-
def main():
|
|
245
|
-
print(json.dumps({
|
|
246
|
-
"continue": True,
|
|
247
|
-
"suppressOutput": True,
|
|
248
|
-
"systemMessage": (
|
|
249
|
-
"## First Action\n"
|
|
250
|
-
"Call `mcp__prism-mcp__session_load_context(project='my-project', level='deep')` "
|
|
251
|
-
"before responding to the user. Do not generate any text before calling this tool."
|
|
252
|
-
)
|
|
253
|
-
}))
|
|
254
|
-
|
|
255
|
-
if __name__ == "__main__":
|
|
256
|
-
main()
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### 2. Configure `settings.json`
|
|
260
|
-
|
|
261
|
-
```json
|
|
262
|
-
{
|
|
263
|
-
"hooks": {
|
|
264
|
-
"SessionStart": [
|
|
265
|
-
{
|
|
266
|
-
"matcher": "*",
|
|
267
|
-
"hooks": [
|
|
268
|
-
{
|
|
269
|
-
"type": "command",
|
|
270
|
-
"command": "python3 /Users/you/.claude/mcp_autoload_hook.py",
|
|
271
|
-
"timeout": 10
|
|
272
|
-
}
|
|
273
|
-
]
|
|
274
|
-
}
|
|
275
|
-
],
|
|
276
|
-
"Stop": [
|
|
277
|
-
{
|
|
278
|
-
"matcher": "*",
|
|
279
|
-
"hooks": [
|
|
280
|
-
{
|
|
281
|
-
"type": "command",
|
|
282
|
-
"command": "python3 -c \"import json; print(json.dumps({'continue': True, 'suppressOutput': True, 'systemMessage': 'MANDATORY END WORKFLOW: 1) Call mcp__prism-mcp__session_save_ledger with project and summary. 2) Call mcp__prism-mcp__session_save_handoff with expected_version set to the loaded version.'}))\""
|
|
283
|
-
}
|
|
284
|
-
]
|
|
285
|
-
}
|
|
286
|
-
]
|
|
287
|
-
},
|
|
288
|
-
"permissions": {
|
|
289
|
-
"allow": [
|
|
290
|
-
"mcp__prism-mcp__session_load_context",
|
|
291
|
-
"mcp__prism-mcp__session_save_ledger",
|
|
292
|
-
"mcp__prism-mcp__session_save_handoff",
|
|
293
|
-
"mcp__prism-mcp__knowledge_search",
|
|
294
|
-
"mcp__prism-mcp__session_search_memory"
|
|
295
|
-
]
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### Troubleshooting
|
|
301
|
-
|
|
302
|
-
- **Hook not firing?** Check `timeout` — if your script takes too long, Claude ignores it.
|
|
303
|
-
- **"Tool not available"?** This is a hallucination. Ensure `permissions.allow` exactly matches the double-underscore format.
|
|
304
|
-
|
|
305
|
-
</details>
|
|
306
|
-
|
|
307
|
-
<details>
|
|
308
|
-
<summary><strong>Gemini / Antigravity — Auto-Load Rules (Battle-Tested)</strong></summary>
|
|
221
|
+
<summary><strong>Claude Code — Lifecycle Autoload (.clauderules)</strong></summary>
|
|
309
222
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
### The Core Problem
|
|
313
|
-
|
|
314
|
-
When given verbose instructions with many constraints, Gemini models hallucinate that MCP tools "don't exist" or "aren't available" — even when they are. This is adversarial reasoning triggered by long rule lists, not a configuration issue.
|
|
315
|
-
|
|
316
|
-
### The 2-Line Rule (Proven Fix)
|
|
317
|
-
|
|
318
|
-
Create `~/.gemini/GEMINI.md`:
|
|
223
|
+
Claude Code naturally picks up MCP tools by adding them to your workspace `.clauderules`. Simply add:
|
|
319
224
|
|
|
320
225
|
```markdown
|
|
321
|
-
|
|
322
|
-
|
|
226
|
+
Always start the conversation by calling `mcp__prism-mcp__session_load_context(project='my-project', level='deep')`.
|
|
227
|
+
When wrapping up, always call `mcp__prism-mcp__session_save_ledger` and `mcp__prism-mcp__session_save_handoff`.
|
|
323
228
|
```
|
|
324
229
|
|
|
325
|
-
**
|
|
326
|
-
- Gemini uses **single underscores** for MCP tools (`mcp_prism-mcp_...`) vs Claude's **double underscores** (`mcp__prism-mcp__...`)
|
|
327
|
-
- Keeping the instruction to 2 lines avoids triggering the model's adversarial "tool not found" reasoning
|
|
328
|
-
- Framing as a positive "First Action" directive outperforms negative constraint lists
|
|
230
|
+
> **Format Note:** Claude automatically wraps MCP tools with double underscores (`mcp__prism-mcp__...`), while most other clients use single underscores (`mcp_prism-mcp_...`). Prism's backend natively handles both formats seamlessly.
|
|
329
231
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
Antigravity **does not visually render MCP tool output blocks** in the chat UI. The tool executes successfully, but the user sees nothing. Fix this by adding an echo rule:
|
|
333
|
-
|
|
334
|
-
```markdown
|
|
335
|
-
## Echo Context
|
|
336
|
-
After loading context, include in your text reply:
|
|
337
|
-
- Agent identity (role + name)
|
|
338
|
-
- Last session summary
|
|
339
|
-
- Open TODOs
|
|
340
|
-
- Session version number
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
This ensures the user sees their project context even though the raw MCP output is invisible.
|
|
344
|
-
|
|
345
|
-
### Session End Workflow
|
|
346
|
-
|
|
347
|
-
Tell the agent: *"Wrap up the session."* It should execute:
|
|
348
|
-
|
|
349
|
-
1. `session_save_ledger` — append immutable work log (summary, decisions, files changed)
|
|
350
|
-
2. `session_save_handoff` — upsert project state with `expected_version` for OCC
|
|
351
|
-
|
|
352
|
-
> **Tip:** Include the session-end instructions in your `GEMINI.md` or ask the agent to save when you're done.
|
|
353
|
-
|
|
354
|
-
### Key Findings from 14 Iterations
|
|
355
|
-
|
|
356
|
-
| Iteration | What We Tried | Result |
|
|
357
|
-
|-----------|---------------|--------|
|
|
358
|
-
| 1–6 | Verbose "Banned Behaviors" blocks, negative constraints | ❌ Model hallucinated tools were unavailable |
|
|
359
|
-
| 7–9 | `always_on` trigger rules, multi-file configs | ❌ Redundant configs caused race conditions |
|
|
360
|
-
| 10–11 | Emergency-style `🚨 MANDATORY` headers | ⚠️ Inconsistent — worked sometimes |
|
|
361
|
-
| 12–13 | Positive-only framing, progressively shorter | ⚠️ Better but still intermittent |
|
|
362
|
-
| 14 | **2-line "First Action" directive** | ✅ Reliable across sessions |
|
|
232
|
+
</details>
|
|
363
233
|
|
|
364
|
-
|
|
234
|
+
<details id="antigravity-auto-load">
|
|
235
|
+
<summary><strong>Gemini / Antigravity — Prompt Auto-Load</strong></summary>
|
|
365
236
|
|
|
366
|
-
|
|
367
|
-
- **Multiple GEMINI.md locations** can conflict: global (`~/.gemini/`), workspace, and User Rules in the Antigravity UI. Keep them synchronized
|
|
368
|
-
- **Camoufox/browser tools** called at startup spawn visible black windows — never call browser tools during greeting handlers
|
|
237
|
+
See the [Gemini Setup Guide](docs/SETUP_GEMINI.md) for the proven three-layer prompt architecture to ensure reliable session auto-loading.
|
|
369
238
|
|
|
370
239
|
</details>
|
|
371
240
|
|
|
@@ -383,7 +252,7 @@ To sync memory across machines or teams:
|
|
|
383
252
|
"env": {
|
|
384
253
|
"PRISM_STORAGE": "supabase",
|
|
385
254
|
"SUPABASE_URL": "https://your-project.supabase.co",
|
|
386
|
-
"SUPABASE_KEY": "your-supabase-anon-key"
|
|
255
|
+
"SUPABASE_KEY": "your-supabase-anon-or-service-key"
|
|
387
256
|
}
|
|
388
257
|
}
|
|
389
258
|
}
|
|
@@ -392,6 +261,8 @@ To sync memory across machines or teams:
|
|
|
392
261
|
|
|
393
262
|
See the **Supabase Setup** section below for schema migration instructions.
|
|
394
263
|
|
|
264
|
+
> **Anon key vs. service role key:** The anon key works for personal use (Supabase RLS policies apply). Use the service role key for team deployments where multiple users share the same Supabase project — it bypasses RLS and allows Prism to manage all rows regardless of auth context. Never expose the service role key client-side.
|
|
265
|
+
|
|
395
266
|
</details>
|
|
396
267
|
|
|
397
268
|
<details>
|
|
@@ -421,35 +292,201 @@ Then add to your MCP config:
|
|
|
421
292
|
|
|
422
293
|
</details>
|
|
423
294
|
|
|
295
|
+
### Common Installation Pitfalls
|
|
296
|
+
|
|
297
|
+
> **❌ Don't use `npm install -g`:**
|
|
298
|
+
> Hardcoding the binary path (e.g. `/opt/homebrew/Cellar/node/23.x/bin/prism-mcp-server`) is tied to a specific Node.js version — when Node updates, the path silently breaks.
|
|
299
|
+
>
|
|
300
|
+
> **✅ Always use `npx` instead:**
|
|
301
|
+
> ```json
|
|
302
|
+
> {
|
|
303
|
+
> "mcpServers": {
|
|
304
|
+
> "prism-mcp": {
|
|
305
|
+
> "command": "npx",
|
|
306
|
+
> "args": ["-y", "prism-mcp-server"]
|
|
307
|
+
> }
|
|
308
|
+
> }
|
|
309
|
+
> }
|
|
310
|
+
> ```
|
|
311
|
+
> `npx` resolves the correct binary automatically, always fetches the latest version, and works identically on macOS, Linux, and Windows. Already installed globally? Run `npm uninstall -g prism-mcp-server` first.
|
|
312
|
+
|
|
313
|
+
> **❓ Seeing warnings about missing API keys on startup?**
|
|
314
|
+
> That's expected and not an error. `BRAVE_API_KEY` / `GOOGLE_API_KEY` warnings are informational only — core session memory works with zero keys. See [Environment Variables](#environment-variables) for what each key unlocks.
|
|
315
|
+
|
|
424
316
|
---
|
|
425
317
|
|
|
426
|
-
##
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
-
|
|
439
|
-
-
|
|
440
|
-
-
|
|
441
|
-
-
|
|
442
|
-
-
|
|
443
|
-
-
|
|
444
|
-
-
|
|
445
|
-
-
|
|
446
|
-
|
|
447
|
-
|
|
318
|
+
## ✨ What Makes Prism Different
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
### 🧠 Your Agent Learns From Mistakes
|
|
322
|
+
When you correct your agent, Prism tracks it. Corrections accumulate **importance** over time. High-importance lessons auto-surface as warnings in future sessions — and can even sync to your `.cursorrules` file for permanent enforcement. Your agent literally gets smarter the more you use it.
|
|
323
|
+
|
|
324
|
+
### 🕰️ Time Travel
|
|
325
|
+
Every save creates a versioned snapshot. Made a mistake? `memory_checkout` reverts your agent's memory to any previous state — like `git revert` for your agent's brain. Full version history with optimistic concurrency control.
|
|
326
|
+
|
|
327
|
+
### 🔮 Mind Palace Dashboard
|
|
328
|
+
A gorgeous glassmorphism UI at `localhost:3000` that lets you see exactly what your agent is thinking:
|
|
329
|
+
|
|
330
|
+
- **Current State & TODOs** — the exact context injected into the LLM's prompt
|
|
331
|
+
- **Interactive Knowledge Graph** — force-directed neural graph with click-to-filter, node renaming, and surgical keyword deletion
|
|
332
|
+
- **Deep Storage Manager** — preview and execute vector purge operations with dry-run safety
|
|
333
|
+
- **Session Ledger** — full audit trail of every decision your agent has made
|
|
334
|
+
- **Time Travel Timeline** — browse and revert any historical handoff version
|
|
335
|
+
- **Visual Memory Vault** — browse VLM-captioned screenshots and auto-captured HTML states
|
|
336
|
+
- **Hivemind Radar** — real-time active agent roster with role, task, and heartbeat
|
|
337
|
+
- **Morning Briefing** — AI-synthesized action plan after 4+ hours away
|
|
338
|
+
- **Brain Health** — memory integrity scan with one-click auto-repair
|
|
339
|
+
|
|
340
|
+

|
|
341
|
+
|
|
342
|
+
### 🧬 10× Memory Compression
|
|
343
|
+
Powered by a pure TypeScript port of Google's TurboQuant (inspired by Google's ICLR research), Prism compresses 768-dim embeddings from **3,072 bytes → ~400 bytes** — enabling decades of session history on a standard laptop. No native modules. No vector database required.
|
|
344
|
+
|
|
345
|
+
### 🐝 Multi-Agent Hivemind
|
|
346
|
+
Multiple agents (dev, QA, PM) can work on the same project with **role-isolated memory**. Agents discover each other automatically, share context in real-time via Telepathy sync, and see a team roster during context loading.
|
|
347
|
+
|
|
348
|
+
### 🖼️ Visual Memory
|
|
349
|
+
Save UI screenshots, architecture diagrams, and bug states to a searchable vault. Images are auto-captioned by a VLM (Claude Vision / GPT-4V / Gemini) and become semantically searchable across sessions.
|
|
350
|
+
|
|
351
|
+
### 🔭 Full Observability
|
|
352
|
+
OpenTelemetry spans for every MCP tool call, LLM hop, and background worker. Route to Jaeger, Grafana, or any OTLP collector. Configure in the dashboard — zero code changes.
|
|
353
|
+
|
|
354
|
+
### 🌐 Autonomous Web Scholar
|
|
355
|
+
Prism researches while you sleep. A background pipeline searches the web, scrapes articles, synthesizes findings via LLM, and injects results directly into your semantic memory — fully searchable on your next session. Brave Search → Firecrawl scrape → LLM synthesis → Prism ledger. Task-aware, Hivemind-integrated, and zero-config when API keys are missing (falls back to Yahoo + Readability).
|
|
356
|
+
|
|
357
|
+
### 🔒 GDPR Compliant
|
|
358
|
+
Soft/hard delete (Art. 17), full export in JSON, Markdown, or Obsidian vault `.zip` (Art. 20), API key redaction, per-project TTL retention, and audit trail. Enterprise-ready out of the box.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## 🎯 Use Cases
|
|
363
|
+
|
|
364
|
+
**Long-running feature work** — Save state at end of day, restore full context next morning. No re-explaining.
|
|
365
|
+
|
|
366
|
+
**Multi-agent collaboration** — Dev, QA, and PM agents share real-time context without stepping on each other's memory.
|
|
367
|
+
|
|
368
|
+
**Consulting / multi-project** — Switch between client projects with progressive loading: `quick` (~50 tokens), `standard` (~200), or `deep` (~1000+).
|
|
369
|
+
|
|
370
|
+
**Visual debugging** — Save UI screenshots to searchable memory. Find that CSS bug from last week by description.
|
|
371
|
+
|
|
372
|
+
**Team onboarding** — New team member's agent loads the full project history instantly.
|
|
373
|
+
|
|
374
|
+
**Behavior enforcement** — Agent corrections auto-graduate into permanent `.cursorrules` / `.clauderules` rules.
|
|
375
|
+
|
|
376
|
+
**Offline / air-gapped** — Full SQLite local mode + Ollama LLM adapter. Zero internet dependency.
|
|
377
|
+
|
|
378
|
+
**Morning Briefings** — After 4+ hours away, Prism auto-synthesizes a 3-bullet action plan from your last sessions.
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## 🆕 What's New
|
|
383
|
+
|
|
384
|
+
### v6.1 — Prism-Port, Cognitive Load & Semantic Search ✅
|
|
385
|
+
> **Current stable release (v6.1.8).** Data sovereignty meets active memory intelligence.
|
|
386
|
+
|
|
387
|
+
- 📦 **Prism-Port Vault Export** — New `vault` format for `session_export_memory`. Generates a `.zip` of interlinked Markdown files with YAML frontmatter, `[[Wikilinks]]`, and auto-generated `Keywords/` backlink indices. Drop into Obsidian or Logseq for instant knowledge graph.
|
|
388
|
+
- 🏛️ **Dashboard Export Vault Button** — "🏛️ Export Vault" button in the Mind Palace UI exports the full Prism-Port vault ZIP directly from the browser. Both `/api/export` and `/api/export/vault` now use the unified `buildVaultDirectory` path — same rich format as the MCP tool.
|
|
389
|
+
- 🏥 **Dashboard Health Cleanup** — The "Fix Issues" button now repairs missing embeddings directly from the Mind Palace UI.
|
|
390
|
+
- 🧠 **Smart Memory Merge UI** — Dynamically merge duplicate knowledge nodes right from the Graph Editor. "Knowledge Gardening" made effortless.
|
|
391
|
+
- ✨ **Semantic Search Highlighting** — Native RegEx mapping that visually wraps the exact reason a vector result was retrieved during a search.
|
|
392
|
+
- 📊 **Deep Purge Visualization** — A zero-overhead "Memory Density" analytic providing instant signal-to-noise ratio visibility (Graduated ideas vs raw concepts).
|
|
393
|
+
- 🛡️ **Context-Boosted Search** — Biases semantic queries by intelligently interleaving your current project workspace.
|
|
394
|
+
|
|
395
|
+
#### v6.1.8 — Type Guard Hardening (Production Safety)
|
|
396
|
+
- 🛡️ **Missing Guard Added** — `isSessionCompactLedgerArgs` was absent; an LLM passing `{threshold: "many"}` would reach the handler as a string. Added full validation for all four optional fields.
|
|
397
|
+
- ✅ **Array Field Validation** — `isSessionSaveLedgerArgs` now guards `todos`, `files_changed`, and `decisions` with `Array.isArray` checks — prevents a hallucinated `{todos: "string"}` from bypassing the type system.
|
|
398
|
+
- 🔖 **Enum Literal Guard** — `isSessionExportMemoryArgs` now rejects any `format` value outside `'json' | 'markdown' | 'vault'` at the boundary instead of propagating to the handler.
|
|
399
|
+
- 🔢 **Numeric Field Guards** — `isSessionIntuitiveRecallArgs` now validates `limit` and `threshold` as numbers, blocking string coercion (`{limit: "many"}`).
|
|
400
|
+
- 🧹 **Legacy Guard Migration** — `isMemoryHistoryArgs`, `isMemoryCheckoutArgs`, and `isSessionSaveImageArgs` migrated to the consistent `Record<string, unknown>` pattern; `isMemoryHistoryArgs` also gains a previously missing `limit` number check.
|
|
401
|
+
|
|
402
|
+
#### v6.1.7 — Dashboard Toggle Persistence
|
|
403
|
+
- 🔄 **Rollback on Save Failure** — `saveSetting()` now returns `Promise<boolean>`; UI toggles (Hivemind, Auto-Capture) roll back their optimistic state if the server request fails.
|
|
404
|
+
- 🚫 **Cache-Busting** — `loadSettings()` appends `?t=<timestamp>` to bypass stale browser/service-worker caches.
|
|
405
|
+
- 🔔 **HTTP Error Detection** — Explicit 4xx/5xx catching in `saveSetting()` surfaces failed saves as user-visible toast notifications.
|
|
406
|
+
|
|
407
|
+
#### v6.1.6 — Type Guard Audit (Round 1)
|
|
408
|
+
- 🛡️ **11 Type Guards Hardened** — Audited and refactored all MCP tool argument guards to include explicit `typeof` validation for optional fields, preventing LLM-hallucinated payloads from causing runtime type coercion errors.
|
|
409
|
+
|
|
410
|
+
#### v6.1.5 — SQLite Deep Storage TTL
|
|
411
|
+
- 🧪 **Comprehensive Edge-Case Test Suite** — 425 tests across 20 files covering CRDT merges, TurboQuant mathematical invariants, prototype pollution guards, and SQLite retention TTL boundary conditions.
|
|
412
|
+
- 🔒 **Prototype Pollution Guards** — CRDT merge pipeline hardened against `__proto__` / `constructor` injection via `Object.create(null)` scratchpads.
|
|
413
|
+
- 🗜️ **`maintenance_vacuum` Tool** — New tool to reclaim SQLite disk space after large purge operations.
|
|
414
|
+
|
|
415
|
+
#### v6.1.4 — Production Hardening
|
|
416
|
+
- 🔒 **Embedding Binary Strip** — Both `embedding` (raw float32) and `embedding_compressed` (TurboQuant binary blob) are now stripped from all export formats, preventing ~400 bytes of raw binary per entry from appearing in vault/JSON exports.
|
|
417
|
+
- 🔗 **Vault Wikilink Fix** — Keyword backlink paths now use vault-relative `Ledger/filename.md` instead of `../Ledger/filename.md` — ensuring correct internal link resolution in Obsidian and Logseq.
|
|
418
|
+
- 🖼️ **Visual Memory Key Fix** — Export correctly reads `filename` and `timestamp` (the keys written by `session_save_image`), resolving a mismatch that produced `"Unknown"` values in the vault visual memory index.
|
|
419
|
+
- 🛡️ **OOM Guard on Large Exports** — `getLedgerEntries` in the export handler now has a 10,000-entry ceiling with explicit `ORDER BY created_at ASC`, preventing unbounded heap allocation on high-volume projects.
|
|
420
|
+
- ⚡ **O(1) Filename Dedup** — Vault filename collision resolution upgraded from O(n²) loop to O(1) `Map<string, number>` counter. Important for projects with many same-day sessions.
|
|
421
|
+
- 🔧 **TurboQuant Guard** — `bits` parameter now validated to `[2, 6]` range at construction time, preventing accidental multi-second Lloyd-Max initialization at higher bit depths.
|
|
422
|
+
|
|
423
|
+

|
|
424
|
+
|
|
425
|
+
<details>
|
|
426
|
+
<summary><strong>Earlier releases (v5.x and below)</strong></summary>
|
|
427
|
+
|
|
428
|
+
#### v5.5 — Architectural Hardening
|
|
429
|
+
- 🛡️ **Transactional Migrations** — SQLite DDL rebuilds are wrapped in explicit `BEGIN/COMMIT` blocks.
|
|
430
|
+
- 🛑 **Graceful Shutdown Registry** — `BackgroundTaskRegistry` uses a 5-second `Promise.race()` to await flushes.
|
|
431
|
+
- 🕰️ **Thundering Herd Prevention** — Maintenance scheduler migrated from `setInterval` to state-aware `setTimeout`.
|
|
432
|
+
- 🚀 **Zero-Thrashing SDM Scans** — `Int32Array` scratchpad allocations hoisted outside the hot decode loop.
|
|
433
|
+
|
|
434
|
+
#### v5.4 — Convergent Intelligence
|
|
435
|
+
- 🔄 **CRDT Handoff Merging** — Multi-agent saves no longer reject on version conflict. Custom OR-Map engine auto-merges concurrent edits.
|
|
436
|
+
- ⏰ **Background Purge Scheduler** — Fully automated storage maintenance TTL sweep, Ebbinghaus decay, auto-compaction.
|
|
437
|
+
- 🌐 **Autonomous Web Scholar** — Agent-driven research pipeline. Brave Search → Firecrawl scrape → LLM synthesis.
|
|
438
|
+
- **v5.3** — Hivemind Health Watchdog (state machine, loop detection, Telepathy alert injection)
|
|
439
|
+
- **v5.2** — Cognitive Memory (Ebbinghaus decay, context-weighted retrieval), Universal History Migration, Smart Consolidation
|
|
440
|
+
- **v5.1** — Knowledge Graph Editor, Deep Storage purge
|
|
441
|
+
- **v5.0** — TurboQuant 10× embedding compression, three-tier search architecture
|
|
442
|
+
- **v4.x** — OpenTelemetry, VLM multimodal memory, LLM adapters, Behavioral memory, Hivemind
|
|
443
|
+
|
|
444
|
+
</details>
|
|
445
|
+
|
|
446
|
+
> [Full CHANGELOG →](CHANGELOG.md) · [Architecture Deep Dive →](docs/ARCHITECTURE.md)
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
## 🆚 How Prism Compares
|
|
451
|
+
|
|
452
|
+
| Capability | **Prism MCP** | [MCP Memory](https://github.com/modelcontextprotocol/servers/tree/main/src/memory) | [Mem0](https://github.com/mem0ai/mem0) | [Mnemory](https://github.com/fpytloun/mnemory) | [Basic Memory](https://github.com/basicmachines-co/basic-memory) |
|
|
453
|
+
|:-----------|:---:|:---:|:---:|:---:|:---:|
|
|
454
|
+
| Zero-config (`npx` one-liner) | ✅ | ✅ | ❌ Docker | ✅ | ✅ |
|
|
455
|
+
| Time travel (version revert) | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
456
|
+
| Behavioral memory (mistake learning) | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
457
|
+
| Visual dashboard | ✅ | ❌ | ✅ Web | ❌ | ❌ |
|
|
458
|
+
| Multi-agent Hivemind | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
459
|
+
| CRDT conflict-free merging | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
460
|
+
| Autonomous research (Web Scholar) | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
461
|
+
| Visual memory (VLM screenshots) | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
462
|
+
| 10× vector compression | ✅ | ❌ | ❌ (Qdrant) | ❌ | ❌ |
|
|
463
|
+
| Obsidian/Logseq vault export | ✅ | ❌ | ❌ | ❌ | ✅ |
|
|
464
|
+
| Token budgeting | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
465
|
+
| GDPR compliance (Art. 17 + 20) | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
466
|
+
| OpenTelemetry tracing | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
467
|
+
| IDE rules sync (`.cursorrules`) | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
468
|
+
| Air-gapped mode (Ollama) | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
469
|
+
| Morning Briefings | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
470
|
+
| Auto-compaction | ✅ | ❌ | ❌ | ❌ | ❌ |
|
|
471
|
+
|
|
472
|
+
> **TL;DR:** Prism is the only MCP memory server with time travel, behavioral learning, autonomous research, CRDT multi-agent sync, and 10× compression — all from a single `npx` command.
|
|
448
473
|
|
|
449
474
|
---
|
|
450
475
|
|
|
451
476
|
## 🔧 Tool Reference
|
|
452
477
|
|
|
478
|
+
Prism ships 30+ tools, but **90% of your workflow uses just three:**
|
|
479
|
+
|
|
480
|
+
> **🎯 The Big Three**
|
|
481
|
+
>
|
|
482
|
+
> | Tool | When | What it does |
|
|
483
|
+
> |------|------|--------------|
|
|
484
|
+
> | `session_load_context` | ▶️ Start of session | Loads your agent’s brain from last time |
|
|
485
|
+
> | `session_save_ledger` | ⏹️ End of session | Records what was accomplished |
|
|
486
|
+
> | `knowledge_search` | 🔍 Anytime | Finds past decisions, context, and learnings |
|
|
487
|
+
>
|
|
488
|
+
> *Everything else is a power-up. Start with these three and you’re 90% there.*
|
|
489
|
+
|
|
453
490
|
<details>
|
|
454
491
|
<summary><strong>Session Memory & Knowledge (12 tools)</strong></summary>
|
|
455
492
|
|
|
@@ -464,7 +501,7 @@ Then add to your MCP config:
|
|
|
464
501
|
| `session_search_memory` | Vector similarity search across all sessions |
|
|
465
502
|
| `session_compact_ledger` | Auto-compact old entries via Gemini summarization |
|
|
466
503
|
| `session_forget_memory` | GDPR-compliant deletion (soft/hard + Art. 17 reason) |
|
|
467
|
-
| `session_export_memory` | Full
|
|
504
|
+
| `session_export_memory` | Full export (JSON, Markdown, or Obsidian vault `.zip` with `[[Wikilinks]]`) |
|
|
468
505
|
| `session_health_check` | Brain integrity scan + auto-repair (`fsck`) |
|
|
469
506
|
| `deep_storage_purge` | Reclaim ~90% vector storage (v5.1) |
|
|
470
507
|
|
|
@@ -531,6 +568,7 @@ Requires `PRISM_ENABLE_HIVEMIND=true`.
|
|
|
531
568
|
| Variable | Required | Description |
|
|
532
569
|
|----------|----------|-------------|
|
|
533
570
|
| `BRAVE_API_KEY` | No | Brave Search Pro API key |
|
|
571
|
+
| `FIRECRAWL_API_KEY` | No | Firecrawl API key — required for Web Scholar |
|
|
534
572
|
| `PRISM_STORAGE` | No | `"local"` (default) or `"supabase"` — restart required |
|
|
535
573
|
| `PRISM_ENABLE_HIVEMIND` | No | `"true"` to enable multi-agent tools — restart required |
|
|
536
574
|
| `PRISM_INSTANCE` | No | Instance name for multi-server PID isolation |
|
|
@@ -539,10 +577,16 @@ Requires `PRISM_ENABLE_HIVEMIND=true`.
|
|
|
539
577
|
| `SUPABASE_URL` | If cloud | Supabase project URL |
|
|
540
578
|
| `SUPABASE_KEY` | If cloud | Supabase anon/service key |
|
|
541
579
|
| `PRISM_USER_ID` | No | Multi-tenant user isolation (default: `"default"`) |
|
|
542
|
-
| `PRISM_AUTO_CAPTURE` | No | `"true"` to auto-snapshot dev
|
|
580
|
+
| `PRISM_AUTO_CAPTURE` | No | `"true"` to auto-snapshot dev server UI states (HTML/DOM) for visual memory |
|
|
543
581
|
| `PRISM_CAPTURE_PORTS` | No | Comma-separated ports (default: `3000,3001,5173,8080`) |
|
|
544
582
|
| `PRISM_DEBUG_LOGGING` | No | `"true"` for verbose logs |
|
|
545
583
|
| `PRISM_DASHBOARD_PORT` | No | Dashboard port (default: `3000`) |
|
|
584
|
+
| `PRISM_SCHEDULER_ENABLED` | No | `"false"` to disable background maintenance (default: enabled) |
|
|
585
|
+
| `PRISM_SCHEDULER_INTERVAL_MS` | No | Maintenance interval in ms (default: `43200000` = 12h) |
|
|
586
|
+
| `PRISM_SCHOLAR_ENABLED` | No | `"true"` to enable Web Scholar pipeline |
|
|
587
|
+
| `PRISM_SCHOLAR_INTERVAL_MS` | No | Scholar interval in ms (default: `0` = manual only) |
|
|
588
|
+
| `PRISM_SCHOLAR_TOPICS` | No | Comma-separated research topics (default: `"ai,agents"`) |
|
|
589
|
+
| `PRISM_SCHOLAR_MAX_ARTICLES_PER_RUN` | No | Max articles per Scholar run (default: `3`) |
|
|
546
590
|
|
|
547
591
|
</details>
|
|
548
592
|
|
|
@@ -550,183 +594,118 @@ Requires `PRISM_ENABLE_HIVEMIND=true`.
|
|
|
550
594
|
|
|
551
595
|
## Architecture
|
|
552
596
|
|
|
553
|
-
|
|
554
|
-
<summary><strong>Three-Tier Memory Architecture</strong></summary>
|
|
597
|
+
Prism is a **stdio-based MCP server** that manages persistent agent memory. Here's how the pieces fit together:
|
|
555
598
|
|
|
556
599
|
```
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
600
|
+
┌──────────────────────────────────────────────────────────┐
|
|
601
|
+
│ MCP Client (Claude Desktop / Cursor / Antigravity) │
|
|
602
|
+
│ ↕ stdio (JSON-RPC) │
|
|
603
|
+
├──────────────────────────────────────────────────────────┤
|
|
604
|
+
│ Prism MCP Server │
|
|
605
|
+
│ │
|
|
606
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌────────────────┐ │
|
|
607
|
+
│ │ 30+ Tools │ │ Lifecycle │ │ Dashboard │ │
|
|
608
|
+
│ │ (handlers) │ │ (PID lock, │ │ (HTTP :3000) │ │
|
|
609
|
+
│ │ │ │ shutdown) │ │ │ │
|
|
610
|
+
│ └──────┬───────┘ └──────────────┘ └────────────────┘ │
|
|
611
|
+
│ ↕ │
|
|
612
|
+
│ ┌────────────────────────────────────────────────────┐ │
|
|
613
|
+
│ │ Storage Engine │ │
|
|
614
|
+
│ │ Local: SQLite + FTS5 + TurboQuant vectors │ │
|
|
615
|
+
│ │ Cloud: Supabase + pgvector │ │
|
|
616
|
+
│ └────────────────────────────────────────────────────┘ │
|
|
617
|
+
│ ↕ │
|
|
618
|
+
│ ┌────────────────────────────────────────────────────┐ │
|
|
619
|
+
│ │ Background Workers │ │
|
|
620
|
+
│ │ • Scheduler (TTL, decay, compaction, purge) │ │
|
|
621
|
+
│ │ • Web Scholar (Brave → Firecrawl → LLM → Ledger) │ │
|
|
622
|
+
│ │ • Hivemind heartbeats & Telepathy broadcasts │ │
|
|
623
|
+
│ │ • OpenTelemetry span export │ │
|
|
624
|
+
│ └────────────────────────────────────────────────────┘ │
|
|
625
|
+
└──────────────────────────────────────────────────────────┘
|
|
566
626
|
```
|
|
567
627
|
|
|
568
|
-
|
|
569
|
-
1. Gemini generates float32 embedding (3,072 bytes)
|
|
570
|
-
2. TurboQuant compresses to turbo4 blob (~400 bytes)
|
|
571
|
-
3. Single atomic write stores both to the database
|
|
628
|
+
### Startup Sequence
|
|
572
629
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
630
|
+
1. **Acquire PID lock** — prevents duplicate instances per `PRISM_INSTANCE`
|
|
631
|
+
2. **Initialize config** — SQLite settings cache (`prism-config.db`)
|
|
632
|
+
3. **Register 30+ MCP tools** — session, knowledge, search, behavioral, hivemind
|
|
633
|
+
4. **Connect stdio transport** — MCP handshake with the client (~60ms total)
|
|
634
|
+
5. **Async post-connect** — storage warmup, dashboard launch, scheduler start (non-blocking)
|
|
578
635
|
|
|
579
|
-
|
|
636
|
+
### Storage Layers
|
|
580
637
|
|
|
581
|
-
|
|
582
|
-
|
|
638
|
+
| Layer | Technology | Purpose |
|
|
639
|
+
|-------|-----------|---------|
|
|
640
|
+
| **Session Ledger** | SQLite (append-only) | Immutable audit trail of all agent work |
|
|
641
|
+
| **Handoff State** | SQLite (upsert, versioned) | Live project context with OCC + CRDT merging |
|
|
642
|
+
| **Keyword Search** | FTS5 virtual tables | Zero-dependency full-text search |
|
|
643
|
+
| **Semantic Search** | TurboQuant compressed vectors | 10× compressed 768-dim embeddings, three-tier retrieval |
|
|
644
|
+
| **Cloud Sync** | Supabase + pgvector | Optional multi-device/team sync |
|
|
583
645
|
|
|
584
|
-
|
|
585
|
-
|-------|-------------|------|-------------|
|
|
586
|
-
| **quick** | Open TODOs + keywords | ~50 tokens | Fast check-in |
|
|
587
|
-
| **standard** | + summary + recent decisions + Git drift | ~200 tokens | **Recommended** |
|
|
588
|
-
| **deep** | + full logs (last 5 sessions) + cross-project knowledge | ~1000+ tokens | After a long break |
|
|
646
|
+
### Auto-Load Architecture
|
|
589
647
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
<details>
|
|
593
|
-
<summary><strong>Role Resolution</strong></summary>
|
|
594
|
-
|
|
595
|
-
Prism resolves agent roles using a priority chain:
|
|
596
|
-
|
|
597
|
-
```
|
|
598
|
-
explicit tool argument → dashboard setting → "global" (default)
|
|
599
|
-
```
|
|
648
|
+
Each MCP client has its own mechanism for ensuring Prism context loads on session start. See the platform-specific [Setup Guides](#-setup-guides) above for detailed instructions:
|
|
600
649
|
|
|
601
|
-
|
|
650
|
+
- **Claude Code** — Lifecycle hooks (`SessionStart` / `Stop`)
|
|
651
|
+
- **Gemini / Antigravity** — Three-layer architecture (User Rules + AGENTS.md + Startup Skill)
|
|
652
|
+
- **Cursor / Windsurf / VS Code** — System prompt instructions
|
|
602
653
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
</details>
|
|
606
|
-
|
|
607
|
-
<details>
|
|
608
|
-
<summary><strong>Project Structure</strong></summary>
|
|
609
|
-
|
|
610
|
-
```
|
|
611
|
-
src/
|
|
612
|
-
├── server.ts # MCP server core + tool routing
|
|
613
|
-
├── config.ts # Environment management
|
|
614
|
-
├── storage/
|
|
615
|
-
│ ├── interface.ts # StorageBackend abstraction
|
|
616
|
-
│ ├── sqlite.ts # SQLite local (libSQL + F32_BLOB)
|
|
617
|
-
│ ├── supabase.ts # Supabase cloud storage
|
|
618
|
-
│ └── configStorage.ts # Boot config micro-DB
|
|
619
|
-
├── dashboard/
|
|
620
|
-
│ ├── server.ts # Dashboard HTTP server
|
|
621
|
-
│ └── ui.ts # Mind Palace glassmorphism UI
|
|
622
|
-
├── tools/
|
|
623
|
-
│ ├── definitions.ts # Search & analysis schemas
|
|
624
|
-
│ ├── handlers.ts # Search & analysis handlers
|
|
625
|
-
│ ├── sessionMemoryDefinitions.ts
|
|
626
|
-
│ └── sessionMemoryHandlers.ts
|
|
627
|
-
└── utils/
|
|
628
|
-
├── telemetry.ts # OTel singleton
|
|
629
|
-
├── turboquant.ts # TurboQuant math core
|
|
630
|
-
├── universalImporter.ts # Universal migration orchestrator
|
|
631
|
-
├── migration/ # Format-specific adapters (Claude/Gemini/OpenAI)
|
|
632
|
-
├── imageCaptioner.ts # VLM auto-caption pipeline
|
|
633
|
-
└── llm/adapters/ # Gemini, OpenAI, Anthropic, Ollama
|
|
634
|
-
```
|
|
635
|
-
|
|
636
|
-
</details>
|
|
637
|
-
|
|
638
|
-
<details>
|
|
639
|
-
<summary><strong>Supabase Setup</strong></summary>
|
|
640
|
-
|
|
641
|
-
1. Create a Supabase project at [supabase.com](https://supabase.com)
|
|
642
|
-
2. Run the migration SQL files from `supabase/migrations/` in order
|
|
643
|
-
3. Set `PRISM_STORAGE=supabase`, `SUPABASE_URL`, and `SUPABASE_KEY` in your MCP config
|
|
644
|
-
4. Prism auto-applies pending DDL migrations on startup via `prism_apply_ddl` RPC
|
|
645
|
-
|
|
646
|
-
</details>
|
|
647
|
-
|
|
648
|
-
<details>
|
|
649
|
-
<summary><strong>LangChain / LangGraph Integration</strong></summary>
|
|
650
|
-
|
|
651
|
-
Prism includes Python adapters in `examples/langgraph-agent/`:
|
|
652
|
-
|
|
653
|
-
```python
|
|
654
|
-
from langchain.retrievers import EnsembleRetriever
|
|
655
|
-
from prism_retriever import PrismMemoryRetriever, PrismKnowledgeRetriever
|
|
656
|
-
|
|
657
|
-
# Hybrid search: 70% semantic, 30% keyword
|
|
658
|
-
retriever = EnsembleRetriever(
|
|
659
|
-
retrievers=[PrismMemoryRetriever(...), PrismKnowledgeRetriever(...)],
|
|
660
|
-
weights=[0.7, 0.3],
|
|
661
|
-
)
|
|
662
|
-
```
|
|
663
|
-
|
|
664
|
-
Includes a full 5-node LangGraph research agent with MCP bridge and persistent memory.
|
|
665
|
-
|
|
666
|
-
</details>
|
|
654
|
+
All platforms benefit from the **server-side fallback** (v5.2.1): if `session_load_context` hasn't been called within 10 seconds, Prism auto-pushes context via `sendLoggingMessage`.
|
|
667
655
|
|
|
668
656
|
---
|
|
669
657
|
|
|
670
|
-
##
|
|
658
|
+
## 🧬 Scientific Foundation
|
|
671
659
|
|
|
672
660
|
Prism is evolving from smart session logging toward a **cognitive memory architecture** — grounded in real research, not marketing.
|
|
673
661
|
|
|
674
662
|
| Phase | Feature | Inspired By | Status |
|
|
675
663
|
|-------|---------|-------------|--------|
|
|
664
|
+
| **v5.0** | TurboQuant 10× Compression — 4-bit quantized 768-dim vectors in <500 bytes | Vector quantization (product/residual PQ) | ✅ Shipped |
|
|
665
|
+
| **v5.0** | Three-Tier Search — native → TurboQuant → FTS5 keyword fallback | Cascaded retrieval architectures | ✅ Shipped |
|
|
676
666
|
| **v5.2** | Smart Consolidation — extract principles, not just summaries | Neuroscience sleep consolidation | ✅ Shipped |
|
|
677
667
|
| **v5.2** | Ebbinghaus Importance Decay — memories fade unless reinforced | Ebbinghaus forgetting curve | ✅ Shipped |
|
|
678
668
|
| **v5.2** | Context-Weighted Retrieval — current work biases what surfaces | Contextual memory in cognitive science | ✅ Shipped |
|
|
679
|
-
| **
|
|
680
|
-
| **
|
|
681
|
-
| **
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
- **v5.1** — Knowledge Graph Editor, Deep Storage purge
|
|
693
|
-
- **v5.0** — TurboQuant 10× embedding compression, three-tier search architecture
|
|
694
|
-
- **v4.6** — OpenTelemetry distributed tracing (Jaeger, Grafana)
|
|
695
|
-
- **v4.5** — VLM multimodal memory + GDPR Art. 20 ZIP export
|
|
696
|
-
- **v4.4** — Pluggable LLM adapters (OpenAI, Anthropic, Gemini, Ollama)
|
|
697
|
-
- **v4.3** — Knowledge Sync Rules (behavioral insights → IDE rules)
|
|
698
|
-
- **v4.2** — Project repo registry + universal auto-load
|
|
699
|
-
- **v4.1** — Auto-migration + multi-instance support
|
|
700
|
-
- **v4.0** — Behavioral memory (corrections, importance, auto-decay)
|
|
701
|
-
- **v3.1** — Memory lifecycle (TTL, auto-compaction, PKM export)
|
|
702
|
-
- **v3.0** — Agent Hivemind (role-scoped memory, Telepathy sync)
|
|
703
|
-
|
|
704
|
-
See [CHANGELOG.md](CHANGELOG.md) for full details.
|
|
705
|
-
|
|
706
|
-
</details>
|
|
669
|
+
| **v5.4** | CRDT Handoff Merging — conflict-free multi-agent state via OR-Map engine | CRDTs (Shapiro et al., 2011) | ✅ Shipped |
|
|
670
|
+
| **v5.4** | Autonomous Web Scholar — background research pipeline with LLM synthesis | Autonomous research agents | ✅ Shipped |
|
|
671
|
+
| **v5.5** | SDM Decoder Foundation — pre-allocated typed-array hot loop, zero GC thrash | Kanerva's Sparse Distributed Memory (1988) | ✅ Shipped |
|
|
672
|
+
| **v5.5** | Architectural Hardening — transactional migrations, graceful shutdown, thundering herd prevention | Production reliability engineering | ✅ Shipped |
|
|
673
|
+
| **v6.1** | Intuitive Recall — proactive surface of relevant past decisions without explicit search; `session_intuitive_recall` tool | Predictive memory (cognitive science) | ✅ Shipped |
|
|
674
|
+
| **v6.2+** | Full Superposed Memory (SDM) — O(1) key-value retrieval via Hamming correlation | Kanerva's SDM | 🔬 In Progress |
|
|
675
|
+
| **v6.1** | Prism-Port Vault Export — Obsidian/Logseq `.zip` with YAML frontmatter & `[[Wikilinks]]` | Data sovereignty, PKM interop | ✅ Shipped |
|
|
676
|
+
| **v6.1** | Cognitive Load & Semantic Search — dynamic graph thinning, search highlights | Contextual working memory | ✅ Shipped |
|
|
677
|
+
| **v6.2** | Synthesize & Prune — automated edge synthesis and visual decay | Implicit associative memory | 🔬 In Progress |
|
|
678
|
+
| **v7.x** | Affect-Tagged Memory — sentiment shapes what gets recalled | Affect-modulated retrieval (neuroscience) | 🔭 Horizon |
|
|
679
|
+
| **v8+** | Zero-Search Retrieval — no index, no ANN, just ask the vector | Holographic Reduced Representations | 🔭 Horizon |
|
|
680
|
+
|
|
681
|
+
> Informed by LeCun's "Why AI Systems Don't Learn" (Dupoux, LeCun, Malik) and Kanerva's SDM.
|
|
707
682
|
|
|
708
683
|
---
|
|
709
684
|
|
|
710
|
-
##
|
|
685
|
+
## 📦 Product Roadmap
|
|
711
686
|
|
|
712
687
|
> **[Full ROADMAP.md →](ROADMAP.md)**
|
|
713
688
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
-
|
|
689
|
+
### v6.2: The "Synthesize & Prune" Phase
|
|
690
|
+
The v6.1 series (through v6.1.8) shipped Prism-Port vault export, Intuitive Recall, full type guard hardening, and dashboard toggle persistence. The v6.2 phase aims to turn collected data into proactive intelligence, moving the dashboard from a passive storage viewer into an active, self-organizing Mind Palace.
|
|
691
|
+
|
|
692
|
+
1. 🕸️ **Automated Edge Synthesis (The "Dream" Procedure):** A background routine that runs on the graph payload to find semantically similar but disconnected nodes via Cosine Similarity. It highlights potential ghostly edges in the UI, empowering the system to autonomously suggest new mental models instead of waiting for the user to connect the dots manually.
|
|
693
|
+
2. 🗓️ **Temporal Decay Heatmaps (Visualizing the Ebbinghaus Curve):** A UI overlay toggle where un-accessed nodes dynamically desaturate or physically "fade" while Graduated nodes (Score >= 7) stay vibrant longer. This makes the "Deep Purge" decision-making visceral: if the graph looks gray, trigger a learning session or a cleanup.
|
|
694
|
+
3. 📝 **Active Recall Prompt Generation (Knowledge Activation):** A "Test Me" utility in the `nodeEditorPanel`. Using a node's semantic neighbors, the dashboard generates synthetic quizzes to ensure context retention, pushing the product away from pure "storage" into genuine "active learning" capabilities.
|
|
719
695
|
|
|
720
696
|
---
|
|
721
697
|
|
|
722
|
-
##
|
|
698
|
+
## Limitations
|
|
723
699
|
|
|
724
700
|
- **LLM-dependent features require an API key.** Semantic search, Morning Briefings, auto-compaction, and VLM captioning need a `GOOGLE_API_KEY` (Gemini) or equivalent provider key. Without one, Prism falls back to keyword-only search (FTS5).
|
|
725
|
-
- **Auto-load is model-dependent.** Session auto-loading relies on the LLM following system prompt instructions
|
|
701
|
+
- **Auto-load is model- and client-dependent.** Session auto-loading relies on both the LLM following system prompt instructions *and* the MCP client completing tool registration before the model's first turn. Prism provides platform-specific [Setup Guides](#-setup-guides) and a server-side fallback (v5.2.1) that auto-pushes context after 10 seconds.
|
|
702
|
+
- **MCP client race conditions.** Some MCP clients may not finish tool enumeration before the model generates its first response, causing transient `unknown_tool` errors. This is a client-side timing issue — Prism's server completes the MCP handshake in ~60ms. Workaround: the server-side auto-push fallback and the startup skill's retry logic.
|
|
726
703
|
- **No real-time sync without Supabase.** Local SQLite mode is single-machine only. Multi-device or team sync requires a Supabase backend.
|
|
727
|
-
- **Embedding quality varies by provider.** Gemini `text-embedding-004` and OpenAI `text-embedding-3-small` produce high-quality 768-dim vectors. Ollama embeddings (e.g., `nomic-embed-text`) are usable but may reduce retrieval accuracy.
|
|
704
|
+
- **Embedding quality varies by provider.** Gemini `text-embedding-004` and OpenAI `text-embedding-3-small` produce high-quality 768-dim vectors. Prism passes `dimensions: 768` via the Matryoshka API for OpenAI models (native output is 1536-dim; this truncation is lossless and outperforms ada-002 at full 1536 dims). Ollama embeddings (e.g., `nomic-embed-text`) are usable but may reduce retrieval accuracy.
|
|
728
705
|
- **Dashboard is HTTP-only.** The Mind Palace dashboard at `localhost:3000` does not support HTTPS. For remote access, use a reverse proxy (nginx/Caddy) or SSH tunnel. Basic auth is available via `PRISM_DASHBOARD_USER` / `PRISM_DASHBOARD_PASS`.
|
|
729
|
-
- **
|
|
706
|
+
- **Long-lived clients can accumulate zombie processes.** MCP clients that run for extended periods (e.g., Claude CLI) may leave orphaned Prism server processes. The lifecycle manager detects true orphans (PPID=1) but allows coexistence for active parent processes. Use `PRISM_INSTANCE` to isolate instances across clients.
|
|
707
|
+
- **Migration is one-way.** Universal History Migration imports sessions *into* Prism but does not export back to Claude/Gemini/OpenAI formats. Use `session_export_memory` for portable JSON/Markdown export, or the `vault` format for Obsidian/Logseq-compatible `.zip` archives.
|
|
708
|
+
- **Export ceiling at 10,000 ledger entries.** The `session_export_memory` tool and the dashboard export button cap vault/JSON exports at 10,000 entries per project as an OOM guard. Projects exceeding this limit should use per-project exports and time-based filtering to stay within the ceiling. This limit does not affect search or context loading.
|
|
730
709
|
- **No Windows CI testing.** Prism is developed and tested on macOS/Linux. It should work on Windows via Node.js, but edge cases (file paths, PID locks) may surface.
|
|
731
710
|
|
|
732
711
|
---
|