prism-mcp-server 3.1.1 โ 4.2.0
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 +344 -111
- package/dist/config.js +8 -0
- package/dist/dashboard/ui.js +120 -0
- package/dist/lifecycle.js +164 -0
- package/dist/server.js +117 -46
- package/dist/storage/configStorage.js +44 -11
- package/dist/storage/sqlite.js +94 -2
- package/dist/storage/supabase.js +35 -0
- package/dist/storage/supabaseMigrations.js +110 -0
- package/dist/tools/index.js +2 -2
- package/dist/tools/sessionMemoryDefinitions.js +111 -3
- package/dist/tools/sessionMemoryHandlers.js +155 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,11 +14,14 @@
|
|
|
14
14
|
|
|
15
15
|
## Table of Contents
|
|
16
16
|
|
|
17
|
-
- [What's New (
|
|
17
|
+
- [What's New (v4.2.0)](#whats-new-in-v420--project-repo-registry-)
|
|
18
|
+
- [Multi-Instance Support](#multi-instance-support)
|
|
18
19
|
- [How Prism Compares](#how-prism-compares)
|
|
19
20
|
- [Quick Start](#quick-start-zero-config--local-mode)
|
|
20
21
|
- [Mind Palace Dashboard](#-the-mind-palace-dashboard)
|
|
21
22
|
- [Integration Examples](#integration-examples)
|
|
23
|
+
- [Claude Code Integration (Hooks)](#claude-code-integration-hooks)
|
|
24
|
+
- [Gemini / Antigravity Integration](#gemini--antigravity-integration)
|
|
22
25
|
- [Use Cases](#use-cases)
|
|
23
26
|
- [Architecture](#architecture)
|
|
24
27
|
- [Tool Reference](#tool-reference)
|
|
@@ -39,25 +42,60 @@
|
|
|
39
42
|
|
|
40
43
|
---
|
|
41
44
|
|
|
42
|
-
## What's New in
|
|
45
|
+
## What's New in v4.2.0 โ Project Repo Registry ๐๏ธ
|
|
43
46
|
|
|
44
47
|
| Feature | Description |
|
|
45
48
|
|---|---|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
| ๐๏ธ **Project Repo Paths** | Map each project to its repo directory in the dashboard. `session_save_ledger` validates `files_changed` paths and warns on mismatch โ prevents cross-project contamination. |
|
|
50
|
+
| ๐ **Universal Auto-Load** | Auto-load projects via dynamic tool descriptions โ works across all MCP clients (Claude, Cursor, Gemini, Antigravity) without lifecycle hooks. Dashboard is the sole source of truth. |
|
|
51
|
+
| ๐ **Dashboard-First Config** | Removed `PRISM_AUTOLOAD_PROJECTS` env var override. The Mind Palace dashboard is now the single source of truth for auto-load project configuration. |
|
|
52
|
+
|
|
53
|
+
<details>
|
|
54
|
+
<summary><strong>What's in v4.1.0 โ Auto-Migration & Multi-Instance ๐</strong></summary>
|
|
55
|
+
|
|
56
|
+
| Feature | Description |
|
|
57
|
+
|---|---|
|
|
58
|
+
| ๐ **Auto-Migrations (Supabase)** | Zero-config schema upgrades โ pending DDL migrations run automatically on server startup via `prism_apply_ddl` RPC. |
|
|
59
|
+
| ๐ **Multi-Instance Support** | `PRISM_INSTANCE` env var enables instance-aware PID locks โ run multiple Prism servers side-by-side without conflicts. |
|
|
60
|
+
| ๐ก๏ธ **Server Lifecycle Management** | Singleton PID lock with graceful shutdown and stale PID recovery. |
|
|
61
|
+
|
|
62
|
+
</details>
|
|
63
|
+
|
|
64
|
+
<details>
|
|
65
|
+
<summary><strong>What's in v4.0.0 โ Behavioral Memory ๐ง </strong></summary>
|
|
66
|
+
|
|
67
|
+
| Feature | Description |
|
|
68
|
+
|---|---|
|
|
69
|
+
| ๐ง **Behavioral Memory** | `session_save_experience` โ log actions, outcomes, corrections with confidence scores. Auto-injects warnings into context so agents learn from mistakes. |
|
|
70
|
+
| ๐ฏ **Dynamic Roles** | Role auto-resolves from dashboard settings. Set once in Mind Palace, applies everywhere. |
|
|
71
|
+
| ๐ **Token Budget** | `max_tokens` on `session_load_context` โ intelligently truncates to fit your budget. |
|
|
72
|
+
| ๐ **Importance Decay** | Stale corrections auto-fade over time to keep context fresh. |
|
|
73
|
+
| ๐ง **Claude Code Hooks** | Simplified SessionStart/Stop hooks that reliably trigger MCP tool calls. |
|
|
74
|
+
|
|
75
|
+
</details>
|
|
76
|
+
|
|
77
|
+
<details>
|
|
78
|
+
<summary><strong>What's in v3.1.0 โ Memory Lifecycle ๐</strong></summary>
|
|
79
|
+
|
|
80
|
+
| Feature | Description |
|
|
81
|
+
|---|---|
|
|
82
|
+
| ๐ **Memory Analytics** | Dashboard sparkline chart, session counts, rollup savings, context richness metrics. |
|
|
83
|
+
| โณ **Data Retention (TTL)** | Per-project TTL via `knowledge_set_retention` or dashboard. Auto-expires old entries every 12h. |
|
|
84
|
+
| ๐๏ธ **Auto-Compaction** | Background health check after saves โ auto-compacts when brain is degraded. |
|
|
85
|
+
| ๐ฆ **PKM Export** | Export project memory as ZIP of Markdown files for Obsidian/Logseq. |
|
|
86
|
+
| ๐งช **95 Tests** | Analytics, TTL, rollup, compaction, type guards, and export coverage. |
|
|
87
|
+
|
|
88
|
+
</details>
|
|
51
89
|
|
|
52
90
|
<details>
|
|
53
91
|
<summary><strong>What's in v3.0.1 โ Agent Identity & Brain Clean-up ๐งน</strong></summary>
|
|
54
92
|
|
|
55
93
|
| Feature | Description |
|
|
56
94
|
|---|---|
|
|
57
|
-
| ๐งน **Brain Health Clean-up** |
|
|
58
|
-
| ๐ค **Agent Identity
|
|
59
|
-
| ๐ **Role-Scoped Skills** |
|
|
60
|
-
| ๐ค **Resource Formatting
|
|
95
|
+
| ๐งน **Brain Health Clean-up** | One-click **Fix Issues** button โ detects and cleans orphaned handoffs, missing embeddings, stale rollups. |
|
|
96
|
+
| ๐ค **Agent Identity** | Set Default Role and Agent Name in dashboard โ auto-applies as fallback in all tools. |
|
|
97
|
+
| ๐ **Role-Scoped Skills** | Per-role persistent rules documents, auto-injected at `session_load_context`. |
|
|
98
|
+
| ๐ค **Resource Formatting** | `memory://` resources render as formatted text instead of raw JSON. |
|
|
61
99
|
|
|
62
100
|
</details>
|
|
63
101
|
|
|
@@ -66,13 +104,13 @@
|
|
|
66
104
|
|
|
67
105
|
| Feature | Description |
|
|
68
106
|
|---|---|
|
|
69
|
-
| ๐ **Role-Scoped Memory** | Optional `role`
|
|
70
|
-
| ๐ฅ **Agent Registry** |
|
|
71
|
-
| ๐ฏ **Team Roster
|
|
72
|
-
| โ๏ธ **Dashboard Settings** |
|
|
73
|
-
| ๐ก **Hivemind Radar** |
|
|
74
|
-
| ๐ **Conditional
|
|
75
|
-
| โ
**
|
|
107
|
+
| ๐ **Role-Scoped Memory** | Optional `role` param โ each role gets isolated memory within a project. |
|
|
108
|
+
| ๐ฅ **Agent Registry** | `agent_register`, `agent_heartbeat`, `agent_list_team` โ multi-agent discovery. |
|
|
109
|
+
| ๐ฏ **Team Roster** | Auto-injected teammate awareness during context loading. |
|
|
110
|
+
| โ๏ธ **Dashboard Settings** | Runtime toggles backed by persistent key-value store. |
|
|
111
|
+
| ๐ก **Hivemind Radar** | Dashboard widget showing active agents, roles, and heartbeats. |
|
|
112
|
+
| ๐ **Conditional Tools** | `PRISM_ENABLE_HIVEMIND` gates multi-agent tools. |
|
|
113
|
+
| โ
**58 Tests** | Storage, tools, dashboard, concurrent writes, role isolation. |
|
|
76
114
|
|
|
77
115
|
</details>
|
|
78
116
|
|
|
@@ -82,10 +120,10 @@
|
|
|
82
120
|
|
|
83
121
|
| Feature | Description |
|
|
84
122
|
|---|---|
|
|
85
|
-
| ๐ **Memory Tracing
|
|
86
|
-
| ๐ก๏ธ **GDPR
|
|
87
|
-
| ๐ **LangChain Integration
|
|
88
|
-
| ๐งฉ **LangGraph
|
|
123
|
+
| ๐ **Memory Tracing** | `MemoryTrace` with latency breakdown and scoring metadata for LangSmith. |
|
|
124
|
+
| ๐ก๏ธ **GDPR Deletion** | `session_forget_memory` with soft/hard delete and Article 17 justification. |
|
|
125
|
+
| ๐ **LangChain Integration** | `PrismMemoryRetriever` / `PrismKnowledgeRetriever` BaseRetriever adapters. |
|
|
126
|
+
| ๐งฉ **LangGraph Agent** | 5-node research agent example with MCP bridge and hybrid search. |
|
|
89
127
|
|
|
90
128
|
</details>
|
|
91
129
|
|
|
@@ -94,8 +132,8 @@
|
|
|
94
132
|
|
|
95
133
|
| Feature | Description |
|
|
96
134
|
|---|---|
|
|
97
|
-
| ๐ **Dynamic Versioning** |
|
|
98
|
-
| ๐ก๏ธ **Embedding
|
|
135
|
+
| ๐ **Dynamic Versioning** | Version derived from `package.json` โ MCP handshake, dashboard, and npm stay in sync. |
|
|
136
|
+
| ๐ก๏ธ **Embedding Validation** | Validates 768-dimension vectors at runtime to catch model regressions. |
|
|
99
137
|
|
|
100
138
|
</details>
|
|
101
139
|
|
|
@@ -115,11 +153,11 @@
|
|
|
115
153
|
|
|
116
154
|
| Feature | Description |
|
|
117
155
|
|---|---|
|
|
118
|
-
| ๐ค **LangGraph
|
|
119
|
-
| ๐ง **Agentic Memory** | `save_session` node persists
|
|
120
|
-
| ๐ **MCP Client Bridge** |
|
|
121
|
-
| ๐ง **Storage
|
|
122
|
-
| ๐ก๏ธ **Error Boundaries** |
|
|
156
|
+
| ๐ค **LangGraph Agent** | 5-node research agent with autonomous looping, MCP integration, persistent memory. |
|
|
157
|
+
| ๐ง **Agentic Memory** | `save_session` node persists findings to ledger โ agents don't just answer and forget. |
|
|
158
|
+
| ๐ **MCP Client Bridge** | JSON-RPC 2.0 client wraps Prism tools as LangChain `StructuredTool` objects. |
|
|
159
|
+
| ๐ง **Storage Fix** | Resource/Prompt handlers route through `getStorage()` โ eliminates EOF crashes. |
|
|
160
|
+
| ๐ก๏ธ **Error Boundaries** | Graceful error handling with proper MCP error responses. |
|
|
123
161
|
|
|
124
162
|
</details>
|
|
125
163
|
|
|
@@ -157,25 +195,29 @@
|
|
|
157
195
|
|
|
158
196
|
| Feature | **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) |
|
|
159
197
|
|---|---|---|---|---|---|
|
|
160
|
-
| **Pricing** | โ
Free
|
|
161
|
-
| **Storage** | SQLite
|
|
162
|
-
| **Zero Config** | โ
|
|
163
|
-
| **
|
|
164
|
-
| **
|
|
165
|
-
| **
|
|
166
|
-
| **
|
|
167
|
-
| **
|
|
168
|
-
| **
|
|
169
|
-
| **
|
|
170
|
-
| **
|
|
171
|
-
| **
|
|
198
|
+
| **Pricing** | โ
Free / MIT | โ
Free / MIT | Freemium | โ
Free / OSS | Freemium |
|
|
199
|
+
| **Storage** | SQLite + Supabase | JSON file | Postgres + Qdrant | Qdrant + S3 | Markdown files |
|
|
200
|
+
| **Zero Config** | โ
npx one-liner | โ
| โ Qdrant/Postgres | โ
uvx | โ
pip |
|
|
201
|
+
| **Behavioral Memory** | โ
Importance tracking | โ | โ | โ | โ |
|
|
202
|
+
| **Dynamic Roles** | โ
Dashboard auto-resolve | โ | โ | โ | โ |
|
|
203
|
+
| **Token Budget** | โ
max_tokens param | โ | โ | โ | โ |
|
|
204
|
+
| **Importance Decay** | โ
Auto-fade stale data | โ | โ | โ | โ |
|
|
205
|
+
| **Semantic Search** | โ
Vectors + FTS5 | โ | โ
pgvector | โ
Qdrant | โ Text only |
|
|
206
|
+
| **Knowledge Graph** | โ
Neural Graph | โ
Entity model | โ | โ
Graph | โ
MD links |
|
|
207
|
+
| **Time Travel** | โ
History + checkout | โ | โ | โ | โ |
|
|
208
|
+
| **Fact Merging** | โ
Gemini async | โ | โ
Built-in | โ
Contradiction | โ |
|
|
209
|
+
| **Security Scan** | โ
Injection detection | โ | โ | โ
Anti-injection | โ |
|
|
210
|
+
| **Health Check** | โ
fsck tool | โ | โ | โ
3-phase fsck | โ |
|
|
211
|
+
| **Visual Dashboard** | โ
Mind Palace | โ | โ
Cloud UI | โ
Mgmt UI | โ |
|
|
212
|
+
| **Multi-Agent Sync** | โ
Real-time | โ | โ | โ Per-user | โ |
|
|
213
|
+
| **Visual Memory** | โ
Screenshot vault | โ | โ | โ
Artifacts | โ |
|
|
172
214
|
| **Auto-Compaction** | โ
Gemini rollups | โ | โ | โ | โ |
|
|
173
215
|
| **Morning Briefing** | โ
Gemini synthesis | โ | โ | โ | โ |
|
|
174
216
|
| **OCC (Concurrency)** | โ
Version-based | โ | โ | โ | โ |
|
|
175
|
-
| **GDPR Compliance** | โ
Soft/hard delete
|
|
176
|
-
| **Memory Tracing** | โ
|
|
177
|
-
| **LangChain
|
|
178
|
-
| **MCP Native** | โ
stdio
|
|
217
|
+
| **GDPR Compliance** | โ
Soft/hard delete | โ | โ | โ | โ |
|
|
218
|
+
| **Memory Tracing** | โ
Latency breakdown | โ | โ | โ | โ |
|
|
219
|
+
| **LangChain** | โ
BaseRetriever | โ | โ | โ | โ |
|
|
220
|
+
| **MCP Native** | โ
stdio | โ
stdio | โ Python SDK | โ
HTTP + MCP | โ
stdio |
|
|
179
221
|
| **Language** | TypeScript | TypeScript | Python | Python | Python |
|
|
180
222
|
|
|
181
223
|
> **When to choose Prism MCP:** You want MCP-native memory with zero infrastructure overhead, progressive context loading, and enterprise features (OCC, compaction, time travel, security scanning) that work directly in Claude Desktop โ without running Qdrant, Postgres, or cloud services.
|
|
@@ -265,6 +307,7 @@ Open **`http://localhost:3000`** in your browser to see exactly what your AI age
|
|
|
265
307
|
|
|
266
308
|
- **Current State & TODOs** โ See the exact context injected into the LLM's prompt
|
|
267
309
|
- **Agent Identity Chip** โ Header shows your active role + name (e.g. `๐ ๏ธ dev ยท Antigravity`); click to open Settings
|
|
310
|
+
- **Project Repo Paths** โ Map each project to its repo directory for save validation
|
|
268
311
|
- **Brain Health ๐ฉบ** โ Memory integrity status at a glance; **๐งน Fix Issues** button auto-cleans orphaned handoffs in one click
|
|
269
312
|
- **Git Drift Detection** โ Alerts you if you've modified code outside the agent's view
|
|
270
313
|
- **Morning Briefing** โ AI-synthesized action plan from your last sessions
|
|
@@ -363,36 +406,124 @@ Add to your Continue `config.json` or Cline MCP settings:
|
|
|
363
406
|
|
|
364
407
|
---
|
|
365
408
|
|
|
366
|
-
## Claude Code
|
|
409
|
+
## Claude Code Integration (Hooks)
|
|
367
410
|
|
|
368
|
-
|
|
411
|
+
Claude Code supports **lifecycle hooks** in `~/.claude/settings.json` that fire automatically at session start and end. Use these to auto-hydrate and persist Prism memory without manual prompting.
|
|
369
412
|
|
|
370
|
-
|
|
371
|
-
2. **Context hydration**: explicitly call `session_load_context` at session start.
|
|
413
|
+
### SessionStart Hook
|
|
372
414
|
|
|
373
|
-
|
|
415
|
+
Automatically loads context when a new session begins:
|
|
374
416
|
|
|
375
417
|
```json
|
|
376
418
|
{
|
|
377
|
-
"
|
|
378
|
-
|
|
419
|
+
"hooks": {
|
|
420
|
+
"SessionStart": [
|
|
421
|
+
{
|
|
422
|
+
"matcher": "*",
|
|
423
|
+
"hooks": [
|
|
424
|
+
{
|
|
425
|
+
"type": "command",
|
|
426
|
+
"command": "python3 -c \"import json; print(json.dumps({'continue': True, 'suppressOutput': False, 'systemMessage': 'You MUST call mcp__prism-mcp__session_load_context twice before responding to the user: first with project=my-project level=standard, then with project=my-other-project level=standard. Do not skip this.'}))\"",
|
|
427
|
+
"timeout": 10
|
|
428
|
+
}
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
]
|
|
432
|
+
}
|
|
379
433
|
}
|
|
380
434
|
```
|
|
381
435
|
|
|
382
|
-
|
|
436
|
+
### Stop Hook
|
|
437
|
+
|
|
438
|
+
Automatically saves session memory when a session ends:
|
|
439
|
+
|
|
440
|
+
```json
|
|
441
|
+
{
|
|
442
|
+
"hooks": {
|
|
443
|
+
"Stop": [
|
|
444
|
+
{
|
|
445
|
+
"matcher": "*",
|
|
446
|
+
"hooks": [
|
|
447
|
+
{
|
|
448
|
+
"type": "command",
|
|
449
|
+
"command": "python3 -c \"import json; print(json.dumps({'continue': True, 'suppressOutput': False, '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.'}))\"",
|
|
450
|
+
"timeout": 10
|
|
451
|
+
}
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### How the Hooks Work
|
|
460
|
+
|
|
461
|
+
The hook `command` runs a Python one-liner that returns a JSON object to Claude Code:
|
|
462
|
+
|
|
463
|
+
| Field | Purpose |
|
|
464
|
+
|---|---|
|
|
465
|
+
| `continue: true` | Tell Claude Code to proceed (don't abort the session) |
|
|
466
|
+
| `suppressOutput: false` | Show the hook result to the agent |
|
|
467
|
+
| `systemMessage` | Instruction injected as a system message โ the agent follows it |
|
|
468
|
+
|
|
469
|
+
The agent receives the `systemMessage` as an instruction and executes the tool calls. The server resolves the agent's **role** and **name** automatically from the dashboard โ no need to specify them in the hook.
|
|
470
|
+
|
|
471
|
+
### Role Resolution โ No Hardcoding Needed
|
|
472
|
+
|
|
473
|
+
Prism resolves the agent role dynamically using a priority chain:
|
|
474
|
+
|
|
475
|
+
```
|
|
476
|
+
explicit tool argument โ dashboard setting โ "global" (default)
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
1. **Explicit arg wins** โ if `role` is passed in the tool call, it's used directly.
|
|
480
|
+
2. **Dashboard fallback** โ if `role` is omitted, the server calls `getSetting("default_role")` and uses whatever role you configured in the **Mind Palace Dashboard โ๏ธ Settings โ Agent Identity**.
|
|
481
|
+
3. **Final default** โ if no dashboard setting exists, falls back to `"global"`.
|
|
482
|
+
|
|
483
|
+
Change your role once in the dashboard, and it automatically applies to every session โ CLI, extension, and all MCP clients.
|
|
484
|
+
|
|
485
|
+
### Verification
|
|
486
|
+
|
|
487
|
+
If hydration ran successfully, the agent's output will include:
|
|
488
|
+
- A `[๐ค AGENT IDENTITY]` block showing your dashboard-configured role and name
|
|
489
|
+
- `PRISM_CONTEXT_LOADED` marker text
|
|
490
|
+
|
|
491
|
+
If the marker is missing, the hook did not fire or the MCP server is not connected.
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
## Gemini / Antigravity Integration
|
|
496
|
+
|
|
497
|
+
Gemini-based clients (like Antigravity) use `GEMINI.md` global rules or user rules for startup behavior. The server resolves the role from the dashboard automatically.
|
|
498
|
+
|
|
499
|
+
### Global Rules (`~/.gemini/GEMINI.md`)
|
|
500
|
+
|
|
501
|
+
```markdown
|
|
502
|
+
## Prism MCP Memory Auto-Load (CRITICAL)
|
|
503
|
+
At the start of every new session, call `mcp__prism-mcp__session_load_context`
|
|
504
|
+
for these projects:
|
|
505
|
+
- `my-project` (level=standard)
|
|
506
|
+
- `my-other-project` (level=standard)
|
|
507
|
+
|
|
508
|
+
After both succeed, print PRISM_CONTEXT_LOADED.
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### User Rules (Antigravity Settings)
|
|
383
512
|
|
|
384
|
-
|
|
385
|
-
- It does **not** guarantee memory context is auto-hydrated unless your client runtime/hook invokes `session_load_context`.
|
|
513
|
+
If your Gemini client supports user rules, add the same instructions there. The key points:
|
|
386
514
|
|
|
387
|
-
|
|
515
|
+
1. **Call `session_load_context` as a tool** โ not `read_resource`. Only the tool returns the `[๐ค AGENT IDENTITY]` block.
|
|
516
|
+
2. **Verify** โ confirm the response includes `version` and `last_summary`.
|
|
388
517
|
|
|
389
|
-
|
|
390
|
-
- **Claude Code** should use a local `SessionStart` hook in `~/.claude/settings.json` for deterministic startup context loading.
|
|
518
|
+
### Session End
|
|
391
519
|
|
|
392
|
-
|
|
520
|
+
At the end of each session, save state:
|
|
393
521
|
|
|
394
|
-
|
|
395
|
-
|
|
522
|
+
```markdown
|
|
523
|
+
## Session End Protocol
|
|
524
|
+
1) Call `mcp__prism-mcp__session_save_ledger` with project and summary.
|
|
525
|
+
2) Call `mcp__prism-mcp__session_save_handoff` with expected_version from the loaded version.
|
|
526
|
+
```
|
|
396
527
|
|
|
397
528
|
---
|
|
398
529
|
|
|
@@ -518,6 +649,47 @@ The tool and dashboard button both call the same repair logic โ the dashboard
|
|
|
518
649
|
| `session_search_memory` | Semantic search with `enable_trace` | `query`, `enable_trace` | Results + `MemoryTrace` in `content[1]` |
|
|
519
650
|
| `knowledge_search` | Knowledge search with `enable_trace` | `query`, `enable_trace` | Results + `MemoryTrace` in `content[1]` |
|
|
520
651
|
|
|
652
|
+
### v4.0 Behavioral Memory Tools
|
|
653
|
+
|
|
654
|
+
| Tool | Purpose | Key Args |
|
|
655
|
+
|------|---------|----------|
|
|
656
|
+
| `session_save_experience` | Record behavioral events with importance tracking | `project`, `event_type`, `context`, `action`, `outcome` |
|
|
657
|
+
|
|
658
|
+
**Dynamic Roles (v4.0):** `role` is now *optional* on all tools. Set your **Default Role** once in the dashboard (โ๏ธ Settings โ Agent Identity) and it auto-applies everywhere โ no need to pass it per call.
|
|
659
|
+
|
|
660
|
+
**Token Budget (v4.0):** Set a default in the dashboard (โ๏ธ Settings โ Token Budget) or pass `max_tokens` per call to override:
|
|
661
|
+
|
|
662
|
+
```json
|
|
663
|
+
{ "name": "session_load_context", "arguments": {
|
|
664
|
+
"project": "my-app", "level": "standard", "max_tokens": 2000
|
|
665
|
+
}}
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
> ๐ก Set Token Budget to `0` in the dashboard for unlimited (default). Per-call `max_tokens` always takes priority.
|
|
669
|
+
|
|
670
|
+
**Recording experiences:**
|
|
671
|
+
|
|
672
|
+
```json
|
|
673
|
+
{ "name": "session_save_experience", "arguments": {
|
|
674
|
+
"project": "my-app",
|
|
675
|
+
"event_type": "correction",
|
|
676
|
+
"context": "User asked to add a database migration",
|
|
677
|
+
"action": "Ran ALTER TABLE directly in production",
|
|
678
|
+
"outcome": "Data was corrupted",
|
|
679
|
+
"correction": "Always create a migration file and test in staging first",
|
|
680
|
+
"confidence_score": 95
|
|
681
|
+
}}
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
**Event types:** `correction` (user corrected the agent), `success` (task went well), `failure` (task failed), `learning` (new knowledge acquired).
|
|
685
|
+
|
|
686
|
+
**How behavioral memory works:**
|
|
687
|
+
1. Agent records experiences via `session_save_experience`
|
|
688
|
+
2. Prism assigns an **importance score** based on event type + confidence
|
|
689
|
+
3. Stale entries **auto-decay** in importance over time
|
|
690
|
+
4. On `session_load_context`, high-importance corrections auto-surface as `[โ ๏ธ BEHAVIORAL WARNINGS]`
|
|
691
|
+
5. Agent sees warnings and avoids repeating past mistakes
|
|
692
|
+
|
|
521
693
|
### Code Mode Templates (v2.1)
|
|
522
694
|
|
|
523
695
|
Instead of writing custom JavaScript, pass a `template` name for instant extraction:
|
|
@@ -695,6 +867,7 @@ The retrievers use `_aget_relevant_documents` as the primary path with `asyncio.
|
|
|
695
867
|
| `BRAVE_API_KEY` | No | Brave Search Pro API key (enables web/local search tools) |
|
|
696
868
|
| `PRISM_STORAGE` | No | `"local"` (default) or `"supabase"` โ **requires restart** |
|
|
697
869
|
| `PRISM_ENABLE_HIVEMIND` | No | Set `"true"` to enable multi-agent Hivemind tools โ **requires restart** |
|
|
870
|
+
| `PRISM_INSTANCE` | No | Instance name for PID lock isolation (e.g. `"athena"`, `"prism-dev"`). Enables [multi-instance support](#multi-instance-support). Default: `"default"` |
|
|
698
871
|
| `GOOGLE_API_KEY` | No | Google AI / Gemini โ enables paper analysis, Morning Briefings, compaction |
|
|
699
872
|
| `BRAVE_ANSWERS_API_KEY` | No | Separate Brave Answers key for AI-grounded answers |
|
|
700
873
|
| `SUPABASE_URL` | If cloud mode | Supabase project URL |
|
|
@@ -761,50 +934,28 @@ The agent boots up knowing exactly what to do โ zero prompting needed.
|
|
|
761
934
|
|
|
762
935
|
### Auto-Load on Session Start (Recommended)
|
|
763
936
|
|
|
764
|
-
For the best experience,
|
|
937
|
+
For the best experience, ensure your agent boots with full project memory on every new session. There are three approaches โ use whichever fits your workflow:
|
|
765
938
|
|
|
766
|
-
|
|
767
|
-
<summary><strong>Claude Code (.clauderules / CLAUDE.md)</strong></summary>
|
|
768
|
-
|
|
769
|
-
Add this rule to your project's `.clauderules` or `CLAUDE.md`:
|
|
770
|
-
|
|
771
|
-
```markdown
|
|
939
|
+
#### Option A: Dashboard Setting (Easiest)
|
|
772
940
|
|
|
773
|
-
|
|
774
|
-
At the start of every new session, you MUST call `session_load_context`
|
|
775
|
-
at the `standard` level for these projects:
|
|
776
|
-
- `my-project`
|
|
777
|
-
- `my-other-project`
|
|
941
|
+
Open the **Mind Palace Dashboard** (โ๏ธ Settings) and type your project names into the **Auto-Load Projects** field under Boot Settings:
|
|
778
942
|
|
|
779
|
-
|
|
943
|
+
```
|
|
944
|
+
prism-mcp, my-app
|
|
780
945
|
```
|
|
781
946
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
<details>
|
|
785
|
-
<summary><strong>Gemini / Antigravity (GEMINI.md)</strong></summary>
|
|
786
|
-
|
|
787
|
-
Add this rule to your `~/.gemini/GEMINI.md` global rules file:
|
|
947
|
+
That's it. Restart your AI client and Prism auto-pushes context for each listed project on next boot.
|
|
788
948
|
|
|
789
|
-
|
|
949
|
+
#### Option B: Client-Side Hooks / Rules
|
|
790
950
|
|
|
791
|
-
|
|
951
|
+
For clients that support lifecycle hooks or startup rules, instruct the AI to **call `session_load_context` as a tool** at session start:
|
|
792
952
|
|
|
793
|
-
**
|
|
794
|
-
|
|
795
|
-
`prism-mcp` MCP server) at the `standard` level for these projects:
|
|
796
|
-
- `my-project`
|
|
797
|
-
- `my-other-project`
|
|
953
|
+
- **[Claude Code Integration (Hooks)](#claude-code-integration-hooks)** โ `SessionStart` and `Stop` hook JSON samples for `~/.claude/settings.json`
|
|
954
|
+
- **[Gemini / Antigravity Integration](#gemini--antigravity-integration)** โ global rules for `~/.gemini/GEMINI.md` or user rules
|
|
798
955
|
|
|
799
|
-
|
|
800
|
-
from previous sessions are always available. Do NOT skip this step.
|
|
956
|
+
> **You can use both approaches together.** The dashboard auto-load (A) injects project names into the `session_load_context` tool description โ works universally across all MCP clients. Client-side hooks (B) give the AI full structured access to the context response (including version numbers for OCC).
|
|
801
957
|
|
|
802
|
-
**
|
|
803
|
-
Do NOT display any warnings or notes about MCP server availability
|
|
804
|
-
โ just call the tools directly. Never claim the server is unavailable.
|
|
805
|
-
```
|
|
806
|
-
|
|
807
|
-
</details>
|
|
958
|
+
> **Key principle:** Never hardcode a `role` in your hooks or rules. Set your role once in the **Mind Palace Dashboard โ๏ธ Settings โ Agent Identity**, and Prism automatically resolves it for every tool call across all clients. See [Role Resolution](#role-resolution--no-hardcoding-needed).
|
|
808
959
|
|
|
809
960
|
> **Tip:** Replace `my-project` with your actual project identifiers. You can list as many projects as you need โ each one gets its own independent memory timeline.
|
|
810
961
|
|
|
@@ -1017,9 +1168,12 @@ Traces are returned as `content[1]` in MCP responses โ a separate content bloc
|
|
|
1017
1168
|
|
|
1018
1169
|
### 2. Apply Migrations
|
|
1019
1170
|
|
|
1020
|
-
In the SQL Editor, run:
|
|
1171
|
+
In the SQL Editor, run the **bootstrap migration** first:
|
|
1021
1172
|
1. [`supabase/migrations/015_session_memory.sql`](supabase/migrations/015_session_memory.sql)
|
|
1022
1173
|
2. [`supabase/migrations/016_knowledge_accumulation.sql`](supabase/migrations/016_knowledge_accumulation.sql)
|
|
1174
|
+
3. [`supabase/migrations/027_auto_migration_infra.sql`](supabase/migrations/027_auto_migration_infra.sql) โ **enables auto-migrations** (see below)
|
|
1175
|
+
|
|
1176
|
+
> **After applying migration 027**, all future schema changes are applied automatically on server startup โ no manual SQL required.
|
|
1023
1177
|
|
|
1024
1178
|
### 3. Get Credentials
|
|
1025
1179
|
|
|
@@ -1047,6 +1201,70 @@ export PRISM_STORAGE="supabase"
|
|
|
1047
1201
|
|
|
1048
1202
|
</details>
|
|
1049
1203
|
|
|
1204
|
+
### Auto-Migrations (Supabase Cloud)
|
|
1205
|
+
|
|
1206
|
+
Prism includes a zero-config auto-migration system for Supabase. Once the bootstrap migration (`027_auto_migration_infra.sql`) is applied, all future schema changes are applied automatically on server startup.
|
|
1207
|
+
|
|
1208
|
+
**How it works:**
|
|
1209
|
+
|
|
1210
|
+
1. On startup, the migration runner checks each entry in `MIGRATIONS[]` (defined in `supabaseMigrations.ts`)
|
|
1211
|
+
2. For each migration, it calls `prism_apply_ddl(version, name, sql)` โ a `SECURITY DEFINER` RPC function
|
|
1212
|
+
3. The function checks `prism_schema_versions` โ if the version is already recorded, it's silently skipped (idempotent)
|
|
1213
|
+
4. If not applied, it executes the DDL and records the version number
|
|
1214
|
+
|
|
1215
|
+
**Graceful degradation:** If `prism_apply_ddl()` doesn't exist (you haven't applied migration 027 yet), the runner logs a warning and continues โ the server still starts, but newer schema features may not be available.
|
|
1216
|
+
|
|
1217
|
+
**Adding new migrations** โ just append to the `MIGRATIONS[]` array in `src/storage/supabaseMigrations.ts`:
|
|
1218
|
+
|
|
1219
|
+
```typescript
|
|
1220
|
+
{
|
|
1221
|
+
version: 28,
|
|
1222
|
+
name: "my_new_feature",
|
|
1223
|
+
sql: `ALTER TABLE session_ledger ADD COLUMN IF NOT EXISTS my_col TEXT;`,
|
|
1224
|
+
}
|
|
1225
|
+
```
|
|
1226
|
+
|
|
1227
|
+
All SQL must be idempotent (`IF NOT EXISTS` / `IF EXISTS` guards).
|
|
1228
|
+
|
|
1229
|
+
---
|
|
1230
|
+
|
|
1231
|
+
## Multi-Instance Support
|
|
1232
|
+
|
|
1233
|
+
Run multiple Prism MCP servers side-by-side on the same machine without PID lock conflicts. This is useful when you have different MCP configurations (e.g., one for web search + memory, another for memory-only) running in different clients simultaneously.
|
|
1234
|
+
|
|
1235
|
+
### Configuration
|
|
1236
|
+
|
|
1237
|
+
Set `PRISM_INSTANCE` to a unique name per server instance:
|
|
1238
|
+
|
|
1239
|
+
```json
|
|
1240
|
+
{
|
|
1241
|
+
"mcpServers": {
|
|
1242
|
+
"prism-search": {
|
|
1243
|
+
"command": "node",
|
|
1244
|
+
"args": ["/path/to/prism/dist/server.js"],
|
|
1245
|
+
"env": {
|
|
1246
|
+
"PRISM_INSTANCE": "prism-search",
|
|
1247
|
+
"BRAVE_API_KEY": "your-key"
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
"prism-memory": {
|
|
1251
|
+
"command": "node",
|
|
1252
|
+
"args": ["/path/to/prism/dist/server.js"],
|
|
1253
|
+
"env": {
|
|
1254
|
+
"PRISM_INSTANCE": "prism-memory"
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
```
|
|
1260
|
+
|
|
1261
|
+
### How it works
|
|
1262
|
+
|
|
1263
|
+
- Each instance gets its own PID file: `/tmp/prism-{PRISM_INSTANCE}.pid`
|
|
1264
|
+
- Default instance name is `"default"` (backward compatible)
|
|
1265
|
+
- Instances share the same SQLite database and Supabase backend โ only the process lock is isolated
|
|
1266
|
+
- Graceful shutdown cleans up the instance's PID file
|
|
1267
|
+
|
|
1050
1268
|
---
|
|
1051
1269
|
|
|
1052
1270
|
## Hybrid Search Pipeline (Brave + Vertex AI)
|
|
@@ -1073,12 +1291,13 @@ See [`vertex-ai/`](vertex-ai/) for setup and benchmarks.
|
|
|
1073
1291
|
|
|
1074
1292
|
```
|
|
1075
1293
|
โโโ src/
|
|
1076
|
-
โ โโโ server.ts # MCP server core + tool routing
|
|
1294
|
+
โ โโโ server.ts # MCP server core + tool routing + lifecycle
|
|
1077
1295
|
โ โโโ config.ts # Environment management
|
|
1078
1296
|
โ โโโ storage/
|
|
1079
1297
|
โ โ โโโ interface.ts # StorageBackend abstraction (+ GDPR delete methods)
|
|
1080
1298
|
โ โ โโโ sqlite.ts # SQLite local storage (libSQL + F32_BLOB + deleted_at migration)
|
|
1081
1299
|
โ โ โโโ supabase.ts # Supabase cloud storage (+ soft/hard delete)
|
|
1300
|
+
โ โ โโโ supabaseMigrations.ts # Auto-migration runner for Supabase DDL
|
|
1082
1301
|
โ โ โโโ configStorage.ts # Boot config micro-DB (~/.prism-mcp/prism-config.db)
|
|
1083
1302
|
โ โ โโโ index.ts # Backend factory (auto-selects based on PRISM_STORAGE)
|
|
1084
1303
|
โ โโโ sync/
|
|
@@ -1116,7 +1335,8 @@ See [`vertex-ai/`](vertex-ai/) for setup and benchmarks.
|
|
|
1116
1335
|
โ โโโ prism_retriever.py # PrismMemoryRetriever + PrismKnowledgeRetriever
|
|
1117
1336
|
โ โโโ tools.py # Agent tools + GDPR forget_memory
|
|
1118
1337
|
โ โโโ demo_retriever.py # Standalone retriever demo
|
|
1119
|
-
โโโ supabase/migrations/ # Cloud mode SQL schemas
|
|
1338
|
+
โโโ supabase/migrations/ # Cloud mode SQL schemas + auto-migration bootstrap
|
|
1339
|
+
โ โโโ 027_auto_migration_infra.sql # prism_apply_ddl() RPC + schema version tracking
|
|
1120
1340
|
โโโ vertex-ai/ # Vertex AI hybrid search pipeline
|
|
1121
1341
|
โโโ index.ts # Server entry point
|
|
1122
1342
|
โโโ package.json
|
|
@@ -1128,28 +1348,41 @@ See [`vertex-ai/`](vertex-ai/) for setup and benchmarks.
|
|
|
1128
1348
|
|
|
1129
1349
|
> **[View the full project board โ](https://github.com/users/dcostenco/projects/1/views/1)**
|
|
1130
1350
|
|
|
1131
|
-
### โ
|
|
1351
|
+
### โ
v4.2 โ Project Repo Registry (Shipped!)
|
|
1352
|
+
|
|
1353
|
+
| Feature | Description |
|
|
1354
|
+
|---|---|
|
|
1355
|
+
| ๐๏ธ **Project Repo Paths** | Dashboard UI to map projects to repo directories + `session_save_ledger` path validation. |
|
|
1356
|
+
| ๐ **Universal Auto-Load** | Dynamic tool descriptions replace env var โ dashboard is sole source of truth. |
|
|
1357
|
+
| ๐ **Dashboard-First Config** | Removed `PRISM_AUTOLOAD_PROJECTS` env var override. |
|
|
1358
|
+
|
|
1359
|
+
### โ
v4.1 โ Auto-Migration & Multi-Instance (Shipped!)
|
|
1360
|
+
|
|
1361
|
+
See [What's in v4.1.0](#whats-in-v410--auto-migration--multi-instance-) above.
|
|
1362
|
+
|
|
1363
|
+
### โ
v4.0 โ Behavioral Memory (Shipped!)
|
|
1364
|
+
|
|
1365
|
+
See [What's in v4.0.0](#whats-in-v400--behavioral-memory-) above.
|
|
1366
|
+
|
|
1367
|
+
### โ
v3.1 โ Memory Lifecycle (Shipped!)
|
|
1132
1368
|
|
|
1133
|
-
See [What's
|
|
1369
|
+
See [What's in v3.1.0](#whats-in-v310--memory-lifecycle-) above.
|
|
1134
1370
|
|
|
1135
1371
|
### โ
v3.0 โ Agent Hivemind (Shipped!)
|
|
1136
1372
|
|
|
1137
|
-
See [What's
|
|
1373
|
+
See [What's in v3.0.0](#whats-in-v300--agent-hivemind-) above.
|
|
1138
1374
|
|
|
1139
1375
|
### ๐ Future Ideas
|
|
1140
1376
|
|
|
1141
1377
|
| Feature | Issue | Description |
|
|
1142
1378
|
|---------|-------|-------------|
|
|
1143
|
-
|
|
|
1144
|
-
| OpenTelemetry
|
|
1145
|
-
| GDPR
|
|
1146
|
-
|
|
|
1147
|
-
|
|
|
1148
|
-
|
|
|
1149
|
-
|
|
|
1150
|
-
| Automated Data Retention (TTL) | [#16](https://github.com/dcostenco/prism-mcp/issues/16) | Time-based memory expiration policies |
|
|
1151
|
-
| Obsidian / Logseq Export Bridge | [#17](https://github.com/dcostenco/prism-mcp/issues/17) | Export memory to Markdown knowledge bases |
|
|
1152
|
-
| Interactive Knowledge Graph Editor | [#19](https://github.com/dcostenco/prism-mcp/issues/19) | Visual graph editor inside the Mind Palace dashboard |
|
|
1379
|
+
| Insight Graduation | โ | `knowledge_upvote` / `knowledge_downvote` โ importance โฅ 7 promotes to rule |
|
|
1380
|
+
| OpenTelemetry | [#6](https://github.com/dcostenco/prism-mcp/issues/6) | W3C tracing with Jaeger/Zipkin export |
|
|
1381
|
+
| GDPR Portability | [#7](https://github.com/dcostenco/prism-mcp/issues/7) | `session_export_memory` for Art. 20 |
|
|
1382
|
+
| CRDT Conflict Resolution | [#9](https://github.com/dcostenco/prism-mcp/issues/9) | Conflict-free types for concurrent edits |
|
|
1383
|
+
| Pluggable LLM Providers | [#13](https://github.com/dcostenco/prism-mcp/issues/13) | Anthropic, OpenAI, Ollama adapters |
|
|
1384
|
+
| VLM / OCR for Images | [#14](https://github.com/dcostenco/prism-mcp/issues/14) | Auto-extract text from stored images |
|
|
1385
|
+
| Knowledge Graph Editor | [#19](https://github.com/dcostenco/prism-mcp/issues/19) | Visual graph editor in Mind Palace |
|
|
1153
1386
|
|
|
1154
1387
|
### ๐งฐ Infrastructure & Stack
|
|
1155
1388
|
|