prism-mcp-server 4.0.0 β 4.3.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 +276 -78
- package/dist/config.js +8 -0
- package/dist/dashboard/ui.js +120 -0
- package/dist/lifecycle.js +164 -0
- package/dist/server.js +108 -49
- package/dist/storage/configStorage.js +44 -11
- package/dist/storage/sqlite.js +31 -0
- package/dist/storage/supabase.js +33 -0
- package/dist/storage/supabaseMigrations.js +110 -0
- package/dist/tools/index.js +2 -2
- package/dist/tools/sessionMemoryDefinitions.js +40 -0
- package/dist/tools/sessionMemoryHandlers.js +151 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
## Table of Contents
|
|
16
16
|
|
|
17
|
-
- [What's New (v4.
|
|
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)
|
|
@@ -41,26 +42,56 @@
|
|
|
41
42
|
|
|
42
43
|
---
|
|
43
44
|
|
|
44
|
-
## What's New in v4.
|
|
45
|
+
## What's New in v4.3.0 β The Bridge π
|
|
46
|
+
|
|
47
|
+
> **π§ Active Behavioral Memory & IDE Sync**
|
|
48
|
+
> Prism doesn't just log what happenedβit learns. When an agent is corrected, the memory gains "Importance". Once an insight graduates (Importance >= 7), Prism can automatically sync it directly to your `.cursorrules` or `.clauderules` file, turning dynamic behavioral learnings into permanent, zero-token IDE enforcement.
|
|
49
|
+
|
|
50
|
+
<details>
|
|
51
|
+
<summary><strong>What's in v4.2.0 β Project Repo Registry ποΈ</strong></summary>
|
|
52
|
+
|
|
53
|
+
| Feature | Description |
|
|
54
|
+
|---|---|
|
|
55
|
+
| ποΈ **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. |
|
|
56
|
+
| π **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. |
|
|
57
|
+
| π **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. |
|
|
58
|
+
|
|
59
|
+
</details>
|
|
60
|
+
|
|
61
|
+
<details>
|
|
62
|
+
<summary><strong>What's in v4.1.0 β Auto-Migration & Multi-Instance π</strong></summary>
|
|
63
|
+
|
|
64
|
+
| Feature | Description |
|
|
65
|
+
|---|---|
|
|
66
|
+
| π **Auto-Migrations (Supabase)** | Zero-config schema upgrades β pending DDL migrations run automatically on server startup via `prism_apply_ddl` RPC. |
|
|
67
|
+
| π **Multi-Instance Support** | `PRISM_INSTANCE` env var enables instance-aware PID locks β run multiple Prism servers side-by-side without conflicts. |
|
|
68
|
+
| π‘οΈ **Server Lifecycle Management** | Singleton PID lock with graceful shutdown and stale PID recovery. |
|
|
69
|
+
|
|
70
|
+
</details>
|
|
71
|
+
|
|
72
|
+
<details>
|
|
73
|
+
<summary><strong>What's in v4.0.0 β Behavioral Memory π§ </strong></summary>
|
|
45
74
|
|
|
46
75
|
| Feature | Description |
|
|
47
76
|
|---|---|
|
|
48
|
-
| π§ **
|
|
49
|
-
| π― **Dynamic
|
|
50
|
-
| π **Token Budget** |
|
|
51
|
-
| π **Importance Decay** | Stale
|
|
52
|
-
| π§ **Claude Code Hooks** |
|
|
77
|
+
| π§ **Behavioral Memory** | `session_save_experience` β log actions, outcomes, corrections with confidence scores. Auto-injects warnings into context so agents learn from mistakes. |
|
|
78
|
+
| π― **Dynamic Roles** | Role auto-resolves from dashboard settings. Set once in Mind Palace, applies everywhere. |
|
|
79
|
+
| π **Token Budget** | `max_tokens` on `session_load_context` β intelligently truncates to fit your budget. |
|
|
80
|
+
| π **Importance Decay** | Stale corrections auto-fade over time to keep context fresh. |
|
|
81
|
+
| π§ **Claude Code Hooks** | Simplified SessionStart/Stop hooks that reliably trigger MCP tool calls. |
|
|
82
|
+
|
|
83
|
+
</details>
|
|
53
84
|
|
|
54
85
|
<details>
|
|
55
86
|
<summary><strong>What's in v3.1.0 β Memory Lifecycle π</strong></summary>
|
|
56
87
|
|
|
57
88
|
| Feature | Description |
|
|
58
89
|
|---|---|
|
|
59
|
-
| π **Memory Analytics** |
|
|
60
|
-
| β³ **
|
|
61
|
-
| ποΈ **
|
|
62
|
-
| π¦ **PKM Export
|
|
63
|
-
| π§ͺ **
|
|
90
|
+
| π **Memory Analytics** | Dashboard sparkline chart, session counts, rollup savings, context richness metrics. |
|
|
91
|
+
| β³ **Data Retention (TTL)** | Per-project TTL via `knowledge_set_retention` or dashboard. Auto-expires old entries every 12h. |
|
|
92
|
+
| ποΈ **Auto-Compaction** | Background health check after saves β auto-compacts when brain is degraded. |
|
|
93
|
+
| π¦ **PKM Export** | Export project memory as ZIP of Markdown files for Obsidian/Logseq. |
|
|
94
|
+
| π§ͺ **95 Tests** | Analytics, TTL, rollup, compaction, type guards, and export coverage. |
|
|
64
95
|
|
|
65
96
|
</details>
|
|
66
97
|
|
|
@@ -69,10 +100,10 @@
|
|
|
69
100
|
|
|
70
101
|
| Feature | Description |
|
|
71
102
|
|---|---|
|
|
72
|
-
| π§Ή **Brain Health Clean-up** |
|
|
73
|
-
| π€ **Agent Identity
|
|
74
|
-
| π **Role-Scoped Skills** |
|
|
75
|
-
| π€ **Resource Formatting
|
|
103
|
+
| π§Ή **Brain Health Clean-up** | One-click **Fix Issues** button β detects and cleans orphaned handoffs, missing embeddings, stale rollups. |
|
|
104
|
+
| π€ **Agent Identity** | Set Default Role and Agent Name in dashboard β auto-applies as fallback in all tools. |
|
|
105
|
+
| π **Role-Scoped Skills** | Per-role persistent rules documents, auto-injected at `session_load_context`. |
|
|
106
|
+
| π€ **Resource Formatting** | `memory://` resources render as formatted text instead of raw JSON. |
|
|
76
107
|
|
|
77
108
|
</details>
|
|
78
109
|
|
|
@@ -81,13 +112,13 @@
|
|
|
81
112
|
|
|
82
113
|
| Feature | Description |
|
|
83
114
|
|---|---|
|
|
84
|
-
| π **Role-Scoped Memory** | Optional `role`
|
|
85
|
-
| π₯ **Agent Registry** |
|
|
86
|
-
| π― **Team Roster
|
|
87
|
-
| βοΈ **Dashboard Settings** |
|
|
88
|
-
| π‘ **Hivemind Radar** |
|
|
89
|
-
| π **Conditional
|
|
90
|
-
| β
**
|
|
115
|
+
| π **Role-Scoped Memory** | Optional `role` param β each role gets isolated memory within a project. |
|
|
116
|
+
| π₯ **Agent Registry** | `agent_register`, `agent_heartbeat`, `agent_list_team` β multi-agent discovery. |
|
|
117
|
+
| π― **Team Roster** | Auto-injected teammate awareness during context loading. |
|
|
118
|
+
| βοΈ **Dashboard Settings** | Runtime toggles backed by persistent key-value store. |
|
|
119
|
+
| π‘ **Hivemind Radar** | Dashboard widget showing active agents, roles, and heartbeats. |
|
|
120
|
+
| π **Conditional Tools** | `PRISM_ENABLE_HIVEMIND` gates multi-agent tools. |
|
|
121
|
+
| β
**58 Tests** | Storage, tools, dashboard, concurrent writes, role isolation. |
|
|
91
122
|
|
|
92
123
|
</details>
|
|
93
124
|
|
|
@@ -97,10 +128,10 @@
|
|
|
97
128
|
|
|
98
129
|
| Feature | Description |
|
|
99
130
|
|---|---|
|
|
100
|
-
| π **Memory Tracing
|
|
101
|
-
| π‘οΈ **GDPR
|
|
102
|
-
| π **LangChain Integration
|
|
103
|
-
| π§© **LangGraph
|
|
131
|
+
| π **Memory Tracing** | `MemoryTrace` with latency breakdown and scoring metadata for LangSmith. |
|
|
132
|
+
| π‘οΈ **GDPR Deletion** | `session_forget_memory` with soft/hard delete and Article 17 justification. |
|
|
133
|
+
| π **LangChain Integration** | `PrismMemoryRetriever` / `PrismKnowledgeRetriever` BaseRetriever adapters. |
|
|
134
|
+
| π§© **LangGraph Agent** | 5-node research agent example with MCP bridge and hybrid search. |
|
|
104
135
|
|
|
105
136
|
</details>
|
|
106
137
|
|
|
@@ -109,8 +140,8 @@
|
|
|
109
140
|
|
|
110
141
|
| Feature | Description |
|
|
111
142
|
|---|---|
|
|
112
|
-
| π **Dynamic Versioning** |
|
|
113
|
-
| π‘οΈ **Embedding
|
|
143
|
+
| π **Dynamic Versioning** | Version derived from `package.json` β MCP handshake, dashboard, and npm stay in sync. |
|
|
144
|
+
| π‘οΈ **Embedding Validation** | Validates 768-dimension vectors at runtime to catch model regressions. |
|
|
114
145
|
|
|
115
146
|
</details>
|
|
116
147
|
|
|
@@ -130,11 +161,11 @@
|
|
|
130
161
|
|
|
131
162
|
| Feature | Description |
|
|
132
163
|
|---|---|
|
|
133
|
-
| π€ **LangGraph
|
|
134
|
-
| π§ **Agentic Memory** | `save_session` node persists
|
|
135
|
-
| π **MCP Client Bridge** |
|
|
136
|
-
| π§ **Storage
|
|
137
|
-
| π‘οΈ **Error Boundaries** |
|
|
164
|
+
| π€ **LangGraph Agent** | 5-node research agent with autonomous looping, MCP integration, persistent memory. |
|
|
165
|
+
| π§ **Agentic Memory** | `save_session` node persists findings to ledger β agents don't just answer and forget. |
|
|
166
|
+
| π **MCP Client Bridge** | JSON-RPC 2.0 client wraps Prism tools as LangChain `StructuredTool` objects. |
|
|
167
|
+
| π§ **Storage Fix** | Resource/Prompt handlers route through `getStorage()` β eliminates EOF crashes. |
|
|
168
|
+
| π‘οΈ **Error Boundaries** | Graceful error handling with proper MCP error responses. |
|
|
138
169
|
|
|
139
170
|
</details>
|
|
140
171
|
|
|
@@ -172,25 +203,29 @@
|
|
|
172
203
|
|
|
173
204
|
| 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) |
|
|
174
205
|
|---|---|---|---|---|---|
|
|
175
|
-
| **Pricing** | β
Free
|
|
176
|
-
| **Storage** | SQLite
|
|
177
|
-
| **Zero Config** | β
|
|
178
|
-
| **
|
|
179
|
-
| **
|
|
180
|
-
| **
|
|
181
|
-
| **
|
|
182
|
-
| **
|
|
183
|
-
| **
|
|
184
|
-
| **
|
|
185
|
-
| **
|
|
186
|
-
| **
|
|
206
|
+
| **Pricing** | β
Free / MIT | β
Free / MIT | Freemium | β
Free / OSS | Freemium |
|
|
207
|
+
| **Storage** | SQLite + Supabase | JSON file | Postgres + Qdrant | Qdrant + S3 | Markdown files |
|
|
208
|
+
| **Zero Config** | β
npx one-liner | β
| β Qdrant/Postgres | β
uvx | β
pip |
|
|
209
|
+
| **Behavioral Memory** | β
Importance tracking | β | β | β | β |
|
|
210
|
+
| **Dynamic Roles** | β
Dashboard auto-resolve | β | β | β | β |
|
|
211
|
+
| **Token Budget** | β
max_tokens param | β | β | β | β |
|
|
212
|
+
| **Importance Decay** | β
Auto-fade stale data | β | β | β | β |
|
|
213
|
+
| **Semantic Search** | β
Vectors + FTS5 | β | β
pgvector | β
Qdrant | β Text only |
|
|
214
|
+
| **Knowledge Graph** | β
Neural Graph | β
Entity model | β | β
Graph | β
MD links |
|
|
215
|
+
| **Time Travel** | β
History + checkout | β | β | β | β |
|
|
216
|
+
| **Fact Merging** | β
Gemini async | β | β
Built-in | β
Contradiction | β |
|
|
217
|
+
| **Security Scan** | β
Injection detection | β | β | β
Anti-injection | β |
|
|
218
|
+
| **Health Check** | β
fsck tool | β | β | β
3-phase fsck | β |
|
|
219
|
+
| **Visual Dashboard** | β
Mind Palace | β | β
Cloud UI | β
Mgmt UI | β |
|
|
220
|
+
| **Multi-Agent Sync** | β
Real-time | β | β | β Per-user | β |
|
|
221
|
+
| **Visual Memory** | β
Screenshot vault | β | β | β
Artifacts | β |
|
|
187
222
|
| **Auto-Compaction** | β
Gemini rollups | β | β | β | β |
|
|
188
223
|
| **Morning Briefing** | β
Gemini synthesis | β | β | β | β |
|
|
189
224
|
| **OCC (Concurrency)** | β
Version-based | β | β | β | β |
|
|
190
|
-
| **GDPR Compliance** | β
Soft/hard delete
|
|
191
|
-
| **Memory Tracing** | β
|
|
192
|
-
| **LangChain
|
|
193
|
-
| **MCP Native** | β
stdio
|
|
225
|
+
| **GDPR Compliance** | β
Soft/hard delete | β | β | β | β |
|
|
226
|
+
| **Memory Tracing** | β
Latency breakdown | β | β | β | β |
|
|
227
|
+
| **LangChain** | β
BaseRetriever | β | β | β | β |
|
|
228
|
+
| **MCP Native** | β
stdio | β
stdio | β Python SDK | β
HTTP + MCP | β
stdio |
|
|
194
229
|
| **Language** | TypeScript | TypeScript | Python | Python | Python |
|
|
195
230
|
|
|
196
231
|
> **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.
|
|
@@ -280,6 +315,7 @@ Open **`http://localhost:3000`** in your browser to see exactly what your AI age
|
|
|
280
315
|
|
|
281
316
|
- **Current State & TODOs** β See the exact context injected into the LLM's prompt
|
|
282
317
|
- **Agent Identity Chip** β Header shows your active role + name (e.g. `π οΈ dev Β· Antigravity`); click to open Settings
|
|
318
|
+
- **Project Repo Paths** β Map each project to its repo directory for save validation
|
|
283
319
|
- **Brain Health π©Ί** β Memory integrity status at a glance; **π§Ή Fix Issues** button auto-cleans orphaned handoffs in one click
|
|
284
320
|
- **Git Drift Detection** β Alerts you if you've modified code outside the agent's view
|
|
285
321
|
- **Morning Briefing** β AI-synthesized action plan from your last sessions
|
|
@@ -621,6 +657,82 @@ The tool and dashboard button both call the same repair logic β the dashboard
|
|
|
621
657
|
| `session_search_memory` | Semantic search with `enable_trace` | `query`, `enable_trace` | Results + `MemoryTrace` in `content[1]` |
|
|
622
658
|
| `knowledge_search` | Knowledge search with `enable_trace` | `query`, `enable_trace` | Results + `MemoryTrace` in `content[1]` |
|
|
623
659
|
|
|
660
|
+
### v4.0 Behavioral Memory Tools
|
|
661
|
+
|
|
662
|
+
| Tool | Purpose | Key Args |
|
|
663
|
+
|------|---------|----------|
|
|
664
|
+
| `session_save_experience` | Record behavioral events with importance tracking | `project`, `event_type`, `context`, `action`, `outcome` |
|
|
665
|
+
|
|
666
|
+
**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.
|
|
667
|
+
|
|
668
|
+
**Token Budget (v4.0):** Set a default in the dashboard (βοΈ Settings β Token Budget) or pass `max_tokens` per call to override:
|
|
669
|
+
|
|
670
|
+
```json
|
|
671
|
+
{ "name": "session_load_context", "arguments": {
|
|
672
|
+
"project": "my-app", "level": "standard", "max_tokens": 2000
|
|
673
|
+
}}
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
> π‘ Set Token Budget to `0` in the dashboard for unlimited (default). Per-call `max_tokens` always takes priority.
|
|
677
|
+
|
|
678
|
+
**Recording experiences:**
|
|
679
|
+
|
|
680
|
+
```json
|
|
681
|
+
{ "name": "session_save_experience", "arguments": {
|
|
682
|
+
"project": "my-app",
|
|
683
|
+
"event_type": "correction",
|
|
684
|
+
"context": "User asked to add a database migration",
|
|
685
|
+
"action": "Ran ALTER TABLE directly in production",
|
|
686
|
+
"outcome": "Data was corrupted",
|
|
687
|
+
"correction": "Always create a migration file and test in staging first",
|
|
688
|
+
"confidence_score": 95
|
|
689
|
+
}}
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
**Event types:** `correction` (user corrected the agent), `success` (task went well), `failure` (task failed), `learning` (new knowledge acquired).
|
|
693
|
+
|
|
694
|
+
**How behavioral memory works:**
|
|
695
|
+
1. Agent records experiences via `session_save_experience`
|
|
696
|
+
2. Prism assigns an **importance score** based on event type + confidence
|
|
697
|
+
3. Stale entries **auto-decay** in importance over time
|
|
698
|
+
4. On `session_load_context`, high-importance corrections auto-surface as `[β οΈ BEHAVIORAL WARNINGS]`
|
|
699
|
+
5. Agent sees warnings and avoids repeating past mistakes
|
|
700
|
+
|
|
701
|
+
### v4.2 Knowledge Sync Rules β "The Bridge"
|
|
702
|
+
|
|
703
|
+
Bridges **v4.0 Behavioral Memory** (graduated insights) with **v4.2 Project Registry** (repo paths) to physically write agent learnings into your project's IDE rules file.
|
|
704
|
+
|
|
705
|
+
| Feature | Without Sync Rules | With `knowledge_sync_rules` |
|
|
706
|
+
|---------|-------------------|----------------------------|
|
|
707
|
+
| **Insight Visibility** | Only in Prism context injection | Persisted as static IDE context (`.cursorrules` / `.clauderules`) |
|
|
708
|
+
| **Cross-Session** | Loaded per-session via tool call | Always-on β IDE reads rules file on every prompt |
|
|
709
|
+
| **Agent Learning Loop** | Behavioral warnings during context load | Rules enforced even without Prism connected |
|
|
710
|
+
| **Idempotency** | N/A | Sentinel markers ensure safe re-runs |
|
|
711
|
+
| **User Control** | View in dashboard | User-maintained rules preserved; only sentinel block updated |
|
|
712
|
+
|
|
713
|
+
**Syncing graduated insights:**
|
|
714
|
+
|
|
715
|
+
```json
|
|
716
|
+
{ "name": "knowledge_sync_rules", "arguments": {
|
|
717
|
+
"project": "my-app",
|
|
718
|
+
"target_file": ".cursorrules",
|
|
719
|
+
"dry_run": true
|
|
720
|
+
}}
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
**How it works:**
|
|
724
|
+
1. Fetches graduated insights (`importance >= 7`) from the ledger
|
|
725
|
+
2. Formats them as markdown rules inside `<!-- PRISM:AUTO-RULES:START/END -->` sentinel markers
|
|
726
|
+
3. Idempotently writes them into the target file at the project's configured `repo_path`
|
|
727
|
+
|
|
728
|
+
| Tool | Purpose | Key Args |
|
|
729
|
+
|------|---------|----------|
|
|
730
|
+
| `knowledge_sync_rules` | Sync graduated insights to IDE rules file | `project`, `target_file`, `dry_run` |
|
|
731
|
+
| `knowledge_upvote` | Increase entry importance (+1) | `id` |
|
|
732
|
+
| `knowledge_downvote` | Decrease entry importance (-1) | `id` |
|
|
733
|
+
|
|
734
|
+
> π‘ **Prerequisite:** Set a `repo_path` for your project in the Mind Palace dashboard (βοΈ Settings β Project Repo Paths) before syncing.
|
|
735
|
+
|
|
624
736
|
### Code Mode Templates (v2.1)
|
|
625
737
|
|
|
626
738
|
Instead of writing custom JavaScript, pass a `template` name for instant extraction:
|
|
@@ -798,6 +910,7 @@ The retrievers use `_aget_relevant_documents` as the primary path with `asyncio.
|
|
|
798
910
|
| `BRAVE_API_KEY` | No | Brave Search Pro API key (enables web/local search tools) |
|
|
799
911
|
| `PRISM_STORAGE` | No | `"local"` (default) or `"supabase"` β **requires restart** |
|
|
800
912
|
| `PRISM_ENABLE_HIVEMIND` | No | Set `"true"` to enable multi-agent Hivemind tools β **requires restart** |
|
|
913
|
+
| `PRISM_INSTANCE` | No | Instance name for PID lock isolation (e.g. `"athena"`, `"prism-dev"`). Enables [multi-instance support](#multi-instance-support). Default: `"default"` |
|
|
801
914
|
| `GOOGLE_API_KEY` | No | Google AI / Gemini β enables paper analysis, Morning Briefings, compaction |
|
|
802
915
|
| `BRAVE_ANSWERS_API_KEY` | No | Separate Brave Answers key for AI-grounded answers |
|
|
803
916
|
| `SUPABASE_URL` | If cloud mode | Supabase project URL |
|
|
@@ -864,12 +977,27 @@ The agent boots up knowing exactly what to do β zero prompting needed.
|
|
|
864
977
|
|
|
865
978
|
### Auto-Load on Session Start (Recommended)
|
|
866
979
|
|
|
867
|
-
For the best experience,
|
|
980
|
+
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:
|
|
981
|
+
|
|
982
|
+
#### Option A: Dashboard Setting (Easiest)
|
|
983
|
+
|
|
984
|
+
Open the **Mind Palace Dashboard** (βοΈ Settings) and type your project names into the **Auto-Load Projects** field under Boot Settings:
|
|
985
|
+
|
|
986
|
+
```
|
|
987
|
+
prism-mcp, my-app
|
|
988
|
+
```
|
|
989
|
+
|
|
990
|
+
That's it. Restart your AI client and Prism auto-pushes context for each listed project on next boot.
|
|
991
|
+
|
|
992
|
+
#### Option B: Client-Side Hooks / Rules
|
|
993
|
+
|
|
994
|
+
For clients that support lifecycle hooks or startup rules, instruct the AI to **call `session_load_context` as a tool** at session start:
|
|
868
995
|
|
|
869
|
-
See the full setup guides for each client:
|
|
870
996
|
- **[Claude Code Integration (Hooks)](#claude-code-integration-hooks)** β `SessionStart` and `Stop` hook JSON samples for `~/.claude/settings.json`
|
|
871
997
|
- **[Gemini / Antigravity Integration](#gemini--antigravity-integration)** β global rules for `~/.gemini/GEMINI.md` or user rules
|
|
872
998
|
|
|
999
|
+
> **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).
|
|
1000
|
+
|
|
873
1001
|
> **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).
|
|
874
1002
|
|
|
875
1003
|
> **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.
|
|
@@ -1083,9 +1211,12 @@ Traces are returned as `content[1]` in MCP responses β a separate content bloc
|
|
|
1083
1211
|
|
|
1084
1212
|
### 2. Apply Migrations
|
|
1085
1213
|
|
|
1086
|
-
In the SQL Editor, run:
|
|
1214
|
+
In the SQL Editor, run the **bootstrap migration** first:
|
|
1087
1215
|
1. [`supabase/migrations/015_session_memory.sql`](supabase/migrations/015_session_memory.sql)
|
|
1088
1216
|
2. [`supabase/migrations/016_knowledge_accumulation.sql`](supabase/migrations/016_knowledge_accumulation.sql)
|
|
1217
|
+
3. [`supabase/migrations/027_auto_migration_infra.sql`](supabase/migrations/027_auto_migration_infra.sql) β **enables auto-migrations** (see below)
|
|
1218
|
+
|
|
1219
|
+
> **After applying migration 027**, all future schema changes are applied automatically on server startup β no manual SQL required.
|
|
1089
1220
|
|
|
1090
1221
|
### 3. Get Credentials
|
|
1091
1222
|
|
|
@@ -1113,6 +1244,70 @@ export PRISM_STORAGE="supabase"
|
|
|
1113
1244
|
|
|
1114
1245
|
</details>
|
|
1115
1246
|
|
|
1247
|
+
### Auto-Migrations (Supabase Cloud)
|
|
1248
|
+
|
|
1249
|
+
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.
|
|
1250
|
+
|
|
1251
|
+
**How it works:**
|
|
1252
|
+
|
|
1253
|
+
1. On startup, the migration runner checks each entry in `MIGRATIONS[]` (defined in `supabaseMigrations.ts`)
|
|
1254
|
+
2. For each migration, it calls `prism_apply_ddl(version, name, sql)` β a `SECURITY DEFINER` RPC function
|
|
1255
|
+
3. The function checks `prism_schema_versions` β if the version is already recorded, it's silently skipped (idempotent)
|
|
1256
|
+
4. If not applied, it executes the DDL and records the version number
|
|
1257
|
+
|
|
1258
|
+
**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.
|
|
1259
|
+
|
|
1260
|
+
**Adding new migrations** β just append to the `MIGRATIONS[]` array in `src/storage/supabaseMigrations.ts`:
|
|
1261
|
+
|
|
1262
|
+
```typescript
|
|
1263
|
+
{
|
|
1264
|
+
version: 28,
|
|
1265
|
+
name: "my_new_feature",
|
|
1266
|
+
sql: `ALTER TABLE session_ledger ADD COLUMN IF NOT EXISTS my_col TEXT;`,
|
|
1267
|
+
}
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
All SQL must be idempotent (`IF NOT EXISTS` / `IF EXISTS` guards).
|
|
1271
|
+
|
|
1272
|
+
---
|
|
1273
|
+
|
|
1274
|
+
## Multi-Instance Support
|
|
1275
|
+
|
|
1276
|
+
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.
|
|
1277
|
+
|
|
1278
|
+
### Configuration
|
|
1279
|
+
|
|
1280
|
+
Set `PRISM_INSTANCE` to a unique name per server instance:
|
|
1281
|
+
|
|
1282
|
+
```json
|
|
1283
|
+
{
|
|
1284
|
+
"mcpServers": {
|
|
1285
|
+
"prism-search": {
|
|
1286
|
+
"command": "node",
|
|
1287
|
+
"args": ["/path/to/prism/dist/server.js"],
|
|
1288
|
+
"env": {
|
|
1289
|
+
"PRISM_INSTANCE": "prism-search",
|
|
1290
|
+
"BRAVE_API_KEY": "your-key"
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1293
|
+
"prism-memory": {
|
|
1294
|
+
"command": "node",
|
|
1295
|
+
"args": ["/path/to/prism/dist/server.js"],
|
|
1296
|
+
"env": {
|
|
1297
|
+
"PRISM_INSTANCE": "prism-memory"
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
```
|
|
1303
|
+
|
|
1304
|
+
### How it works
|
|
1305
|
+
|
|
1306
|
+
- Each instance gets its own PID file: `/tmp/prism-{PRISM_INSTANCE}.pid`
|
|
1307
|
+
- Default instance name is `"default"` (backward compatible)
|
|
1308
|
+
- Instances share the same SQLite database and Supabase backend β only the process lock is isolated
|
|
1309
|
+
- Graceful shutdown cleans up the instance's PID file
|
|
1310
|
+
|
|
1116
1311
|
---
|
|
1117
1312
|
|
|
1118
1313
|
## Hybrid Search Pipeline (Brave + Vertex AI)
|
|
@@ -1139,12 +1334,13 @@ See [`vertex-ai/`](vertex-ai/) for setup and benchmarks.
|
|
|
1139
1334
|
|
|
1140
1335
|
```
|
|
1141
1336
|
βββ src/
|
|
1142
|
-
β βββ server.ts # MCP server core + tool routing
|
|
1337
|
+
β βββ server.ts # MCP server core + tool routing + lifecycle
|
|
1143
1338
|
β βββ config.ts # Environment management
|
|
1144
1339
|
β βββ storage/
|
|
1145
1340
|
β β βββ interface.ts # StorageBackend abstraction (+ GDPR delete methods)
|
|
1146
1341
|
β β βββ sqlite.ts # SQLite local storage (libSQL + F32_BLOB + deleted_at migration)
|
|
1147
1342
|
β β βββ supabase.ts # Supabase cloud storage (+ soft/hard delete)
|
|
1343
|
+
β β βββ supabaseMigrations.ts # Auto-migration runner for Supabase DDL
|
|
1148
1344
|
β β βββ configStorage.ts # Boot config micro-DB (~/.prism-mcp/prism-config.db)
|
|
1149
1345
|
β β βββ index.ts # Backend factory (auto-selects based on PRISM_STORAGE)
|
|
1150
1346
|
β βββ sync/
|
|
@@ -1182,7 +1378,8 @@ See [`vertex-ai/`](vertex-ai/) for setup and benchmarks.
|
|
|
1182
1378
|
β βββ prism_retriever.py # PrismMemoryRetriever + PrismKnowledgeRetriever
|
|
1183
1379
|
β βββ tools.py # Agent tools + GDPR forget_memory
|
|
1184
1380
|
β βββ demo_retriever.py # Standalone retriever demo
|
|
1185
|
-
βββ supabase/migrations/ # Cloud mode SQL schemas
|
|
1381
|
+
βββ supabase/migrations/ # Cloud mode SQL schemas + auto-migration bootstrap
|
|
1382
|
+
β βββ 027_auto_migration_infra.sql # prism_apply_ddl() RPC + schema version tracking
|
|
1186
1383
|
βββ vertex-ai/ # Vertex AI hybrid search pipeline
|
|
1187
1384
|
βββ index.ts # Server entry point
|
|
1188
1385
|
βββ package.json
|
|
@@ -1194,40 +1391,41 @@ See [`vertex-ai/`](vertex-ai/) for setup and benchmarks.
|
|
|
1194
1391
|
|
|
1195
1392
|
> **[View the full project board β](https://github.com/users/dcostenco/projects/1/views/1)**
|
|
1196
1393
|
|
|
1197
|
-
### β
|
|
1394
|
+
### β
v4.2 β Project Repo Registry + Knowledge Sync Rules (Shipped!)
|
|
1198
1395
|
|
|
1199
|
-
|
|
1396
|
+
| Feature | Description |
|
|
1397
|
+
|---|---|
|
|
1398
|
+
| ποΈ **Project Repo Paths** | Dashboard UI to map projects to repo directories + `session_save_ledger` path validation. |
|
|
1399
|
+
| π **Universal Auto-Load** | Dynamic tool descriptions replace env var β dashboard is sole source of truth. |
|
|
1400
|
+
| π **Dashboard-First Config** | Removed `PRISM_AUTOLOAD_PROJECTS` env var override. |
|
|
1401
|
+
| π **Knowledge Sync Rules** | `knowledge_sync_rules` β auto-sync graduated insights to `.cursorrules` / `.clauderules` with idempotent sentinel markers. |
|
|
1200
1402
|
|
|
1201
|
-
### β
|
|
1403
|
+
### β
v4.1 β Auto-Migration & Multi-Instance (Shipped!)
|
|
1202
1404
|
|
|
1203
|
-
See [What's
|
|
1405
|
+
See [What's in v4.1.0](#whats-in-v410--auto-migration--multi-instance-) above.
|
|
1204
1406
|
|
|
1205
|
-
###
|
|
1407
|
+
### β
v4.0 β Behavioral Memory (Shipped!)
|
|
1206
1408
|
|
|
1207
|
-
|
|
1409
|
+
See [What's in v4.0.0](#whats-in-v400--behavioral-memory-) above.
|
|
1208
1410
|
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1411
|
+
### β
v3.1 β Memory Lifecycle (Shipped!)
|
|
1412
|
+
|
|
1413
|
+
See [What's in v3.1.0](#whats-in-v310--memory-lifecycle-) above.
|
|
1414
|
+
|
|
1415
|
+
### β
v3.0 β Agent Hivemind (Shipped!)
|
|
1416
|
+
|
|
1417
|
+
See [What's in v3.0.0](#whats-in-v300--agent-hivemind-) above.
|
|
1216
1418
|
|
|
1217
1419
|
### π Future Ideas
|
|
1218
1420
|
|
|
1219
1421
|
| Feature | Issue | Description |
|
|
1220
1422
|
|---------|-------|-------------|
|
|
1221
|
-
|
|
|
1222
|
-
|
|
|
1223
|
-
|
|
|
1224
|
-
|
|
|
1225
|
-
|
|
|
1226
|
-
|
|
|
1227
|
-
| VLM / OCR for Visual Memory | [#14](https://github.com/dcostenco/prism-mcp/issues/14) | Auto-extract text and insights from stored images |
|
|
1228
|
-
| Automated Data Retention (TTL) | [#16](https://github.com/dcostenco/prism-mcp/issues/16) | Time-based memory expiration policies |
|
|
1229
|
-
| Obsidian / Logseq Export Bridge | [#17](https://github.com/dcostenco/prism-mcp/issues/17) | Export memory to Markdown knowledge bases |
|
|
1230
|
-
| Interactive Knowledge Graph Editor | [#19](https://github.com/dcostenco/prism-mcp/issues/19) | Visual graph editor inside the Mind Palace dashboard |
|
|
1423
|
+
| OpenTelemetry | [#6](https://github.com/dcostenco/prism-mcp/issues/6) | W3C tracing with Jaeger/Zipkin export |
|
|
1424
|
+
| GDPR Portability | [#7](https://github.com/dcostenco/prism-mcp/issues/7) | `session_export_memory` for Art. 20 |
|
|
1425
|
+
| CRDT Conflict Resolution | [#9](https://github.com/dcostenco/prism-mcp/issues/9) | Conflict-free types for concurrent edits |
|
|
1426
|
+
| Pluggable LLM Providers | [#13](https://github.com/dcostenco/prism-mcp/issues/13) | Anthropic, OpenAI, Ollama adapters |
|
|
1427
|
+
| VLM / OCR for Images | [#14](https://github.com/dcostenco/prism-mcp/issues/14) | Auto-extract text from stored images |
|
|
1428
|
+
| Knowledge Graph Editor | [#19](https://github.com/dcostenco/prism-mcp/issues/19) | Visual graph editor in Mind Palace |
|
|
1231
1429
|
|
|
1232
1430
|
### π§° Infrastructure & Stack
|
|
1233
1431
|
|
package/dist/config.js
CHANGED
|
@@ -114,6 +114,14 @@ export const PRISM_DEBUG_LOGGING = process.env.PRISM_DEBUG_LOGGING === "true";
|
|
|
114
114
|
// doesn't increase tool count.
|
|
115
115
|
// Set PRISM_ENABLE_HIVEMIND=true to unlock the Agent Registry tools.
|
|
116
116
|
export const PRISM_ENABLE_HIVEMIND = process.env.PRISM_ENABLE_HIVEMIND === "true";
|
|
117
|
+
// βββ v4.1: Auto-Load Projects ββββββββββββββββββββββββββββββββ
|
|
118
|
+
// Auto-load is configured exclusively via the Mind Palace dashboard
|
|
119
|
+
// ("Auto-Load Projects" checkboxes in Settings). The setting is stored
|
|
120
|
+
// in prism-config.db and read at startup via getSettingSync().
|
|
121
|
+
//
|
|
122
|
+
// The PRISM_AUTOLOAD_PROJECTS env var has been removed β the dashboard
|
|
123
|
+
// is the single source of truth. This prevents mismatches between
|
|
124
|
+
// env var and dashboard values causing duplicate project loads.
|
|
117
125
|
if (PRISM_AUTO_CAPTURE) {
|
|
118
126
|
// Use console.error instead of debugLog here to prevent circular dependency
|
|
119
127
|
if (PRISM_DEBUG_LOGGING) {
|