prism-mcp-server 17.1.1 → 18.0.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 +69 -4
- package/dist/tools/ledgerHandlers.js +6 -2
- package/dist/tools/prismInferHandler.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -28,12 +28,12 @@ Ask "what did I decide about the auth flow last month?" and get the answer with
|
|
|
28
28
|
### 🧬 Cognitive routing
|
|
29
29
|
Different memory types live in different stores: episodic (what happened), semantic (what's true), procedural (how to do X). The router picks where to store and where to retrieve.
|
|
30
30
|
|
|
31
|
-
### 🔄 Proactive session drift detection *(new in v15)*
|
|
31
|
+
### 🔄 Proactive session drift detection *(new in v15, HRR-powered in v17)*
|
|
32
32
|
Your AI agent can now detect when it has drifted from your original goals — mid-session, automatically — and self-correct before you notice the problem.
|
|
33
33
|
|
|
34
34
|
Three direct Prism calls:
|
|
35
35
|
1. **`session_save_ledger`** — snapshot current state
|
|
36
|
-
2. **`
|
|
36
|
+
2. **`session_detect_drift`** — HRR-powered semantic comparison of current work vs original goals, returns `on_track / minor_drift / major_drift` with domain-specific signals (BCBA/Coding/AAC)
|
|
37
37
|
3. **`session_compact_ledger`** — if drifted, compress and reload only what matters
|
|
38
38
|
|
|
39
39
|
When major drift is detected, the alert routes to the **Synalux portal** so it's visible across sessions and devices — not just in the current conversation.
|
|
@@ -42,6 +42,19 @@ When major drift is detected, the alert routes to the **Synalux portal** so it's
|
|
|
42
42
|
|
|
43
43
|
No scripts. No cron. No hooks. Three tool calls, Prism handles the rest.
|
|
44
44
|
|
|
45
|
+
### 🛡 PHI Guard *(new in v17)*
|
|
46
|
+
Automatic Protected Health Information detection and redaction in the memory pipeline. Every `session_save_ledger` and `session_save_handoff` call passes through the PHI guard before storage.
|
|
47
|
+
|
|
48
|
+
**What it catches:** Names, DOBs, SSNs, MRNs, phone numbers, email addresses, and 18 HIPAA identifier categories. Redaction is deterministic (regex + pattern matching, no LLM) — zero false negatives on structured identifiers.
|
|
49
|
+
|
|
50
|
+
**Fail-closed:** PHI detection errors log to stderr (never suppressed) and block the save. Metric: `phi_guard.detected` count per category is always emitted for audit compliance.
|
|
51
|
+
|
|
52
|
+
### ⚡ Prompt-based skill routing *(new in v17)*
|
|
53
|
+
114 agent skills auto-load based on prompt keywords. No manual skill selection needed — the MCP server scans the user's prompt and injects the relevant skill instructions into the session context before the AI responds.
|
|
54
|
+
|
|
55
|
+
### 💰 Tier enforcement *(new in v17.1)*
|
|
56
|
+
`prism_infer` now enforces subscription-tier gates: model ceiling, max tokens, daily limits, and cloud fallback are all gated by your plan. Free users get local-only inference up to 4b; paid tiers unlock higher models, more tokens, and cloud fallback. Flat-rate seat caps via `max_seats` per plan.
|
|
57
|
+
|
|
45
58
|
### 🛡 Local-first — security + speed
|
|
46
59
|
Free tier runs entirely on your machine — SQLite, local embedding model, no API keys, no cloud. Paid tier adds cloud sync via Synalux portal.
|
|
47
60
|
|
|
@@ -155,7 +168,58 @@ Categories: abstention, adversarial traps, cascade, disambiguation, edge cases,
|
|
|
155
168
|
**What it does NOT mean**: these scores measure routing precision on a 17-tool taxonomy, not general intelligence. Claude outperforms on everything outside this task. The value is **offline reliability at zero cost**, not replacing Claude. Code and clinical knowledge come from RAG via `knowledge_search`.
|
|
156
169
|
|
|
157
170
|
### 🔍 L3 Grounding Verifier
|
|
158
|
-
|
|
171
|
+
|
|
172
|
+
Fail-closed fact-checking layer. When `prism_infer` receives an `evidence` payload, a separate verifier model (default: `prism-coder:4b`) checks every factual claim in the draft against the evidence before serving it. This is the third layer (L3) of the cascade — after tool routing (L1) and confidence gating (L2).
|
|
173
|
+
|
|
174
|
+
**Three-tier pre-check:**
|
|
175
|
+
|
|
176
|
+
| Tier | Condition | Action |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| **0 — Conversational** | Draft has no numbers, dates, names, codes, or $ amounts | Serve without verification |
|
|
179
|
+
| **0a — No evidence** | Assertive draft + zero evidence snippets | Refuse (fail-closed) |
|
|
180
|
+
| **2 — NLI** | Assertive draft + evidence provided | Verify each claim against evidence |
|
|
181
|
+
|
|
182
|
+
**Per-claim verdicts:**
|
|
183
|
+
- `ENTAILED` — claim matches evidence (including arithmetic identity: "3" ≈ "three")
|
|
184
|
+
- `CONTRADICTED` — evidence states a different value for the same fact → **refuse**
|
|
185
|
+
- `NEUTRAL` — claim not covered by evidence → **refuse** (fail-closed default)
|
|
186
|
+
|
|
187
|
+
**Fail-closed guarantees:** HTTP errors, malformed JSON, timeouts → all treated as refusal. The caller gets the specific claim that failed and can retry with more evidence or fall back to cloud.
|
|
188
|
+
|
|
189
|
+
**Usage with `prism_infer`:**
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"prompt": "What was the patient's last A1C?",
|
|
193
|
+
"evidence": [
|
|
194
|
+
{ "source": "lab_2026-05-01", "content": "HbA1c: 6.8% (ref <7.0)" }
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Structured output:**
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"output": "The patient's last A1C was 6.8%.",
|
|
203
|
+
"verification": {
|
|
204
|
+
"action": "served",
|
|
205
|
+
"claims": [{ "text": "A1C was 6.8%", "verdict": "ENTAILED" }],
|
|
206
|
+
"verifierChain": [{ "model": "prism-coder:4b", "verdict": "ENTAILED", "latencyMs": 340 }]
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
When a claim is contradicted or unsupported:
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"output": "⚠ Verification failed: claim 'A1C was 7.2%' is CONTRADICTED by evidence.",
|
|
215
|
+
"verification": {
|
|
216
|
+
"action": "refused_fabricated",
|
|
217
|
+
"refusalClaim": "A1C was 7.2%"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
The verifier model (`prism-coder:4b`) is intentionally different from the inference model — satisfying the independent-reviewer principle. Requires a paid plan (see [Plans](#plans)). Set `verify: false` to explicitly skip verification even when evidence is provided.
|
|
159
223
|
|
|
160
224
|
### 🧠 HRR Semantic Drift Detection (v17.0)
|
|
161
225
|
Detects when long AI agent sessions drift from their original goal — using Holographic Reduced Representations for temporal trajectory encoding and anomaly detection.
|
|
@@ -366,6 +430,7 @@ Paid Synalux subscribers get a built-in analytics dashboard at `/app/memory-anal
|
|
|
366
430
|
| `knowledge_search` | Semantic + keyword search over all memories |
|
|
367
431
|
| `query_memory_natural` | Natural-language Q&A over your Mind Palace |
|
|
368
432
|
| `extract_entities` | Pull people / projects / decisions from text |
|
|
433
|
+
| `session_detect_drift` | HRR-powered semantic drift detection (BCBA/Coding/AAC) |
|
|
369
434
|
| `session_synthesize_edges` | Auto-link related memories into a graph |
|
|
370
435
|
|
|
371
436
|
(35+ tools total — full TypeScript signatures in `src/tools/`. Architecture overview in [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md).)
|
|
@@ -675,7 +740,7 @@ prism register-models # Alias dcostenco/prism-coder:* → prism-coder:*
|
|
|
675
740
|
## Testing
|
|
676
741
|
|
|
677
742
|
```bash
|
|
678
|
-
npm test # 2,
|
|
743
|
+
npm test # 2,676 test cases across 89 files (vitest)
|
|
679
744
|
npm test -- --coverage # coverage report
|
|
680
745
|
python3 tests/benchmarks/prism-routing-100/benchmark.py --models 1b7 14b 32b
|
|
681
746
|
```
|
|
@@ -801,11 +801,15 @@ export async function sessionLoadContextHandler(args) {
|
|
|
801
801
|
const eff = computeEffectiveImportance(s.importance, s.last_accessed_at, s.created_at, Boolean(s.is_rollup));
|
|
802
802
|
impStr = ` [Imp: ${eff}]`;
|
|
803
803
|
}
|
|
804
|
-
|
|
804
|
+
const dateStr = (s.session_date || s.created_at || s.date || "unknown").split("T")[0];
|
|
805
|
+
return ` [${dateStr}]${impStr} ${s.summary}`;
|
|
805
806
|
}).join("\n") + `\n`;
|
|
806
807
|
}
|
|
807
808
|
if (d.session_history?.length) {
|
|
808
|
-
formattedContext += `\n📂 Session History (${d.session_history.length} entries):\n` + d.session_history.map((s) =>
|
|
809
|
+
formattedContext += `\n📂 Session History (${d.session_history.length} entries):\n` + d.session_history.map((s) => {
|
|
810
|
+
const dateStr = (s.session_date || s.created_at || s.date || "unknown").split("T")[0];
|
|
811
|
+
return ` [${dateStr}] ${s.summary}`;
|
|
812
|
+
}).join("\n") + `\n`;
|
|
809
813
|
}
|
|
810
814
|
if (d.recent_validations?.length) {
|
|
811
815
|
formattedContext += `\n🔬 Recent Validations:\n` + d.recent_validations.map((v) => {
|
|
@@ -91,12 +91,12 @@ export const PRISM_INFER_TOOL = {
|
|
|
91
91
|
type: "boolean",
|
|
92
92
|
description: "Enable the L3 grounding verifier. Default: true when `evidence` is provided, " +
|
|
93
93
|
"false otherwise. When enabled, the model's draft is checked by a different model " +
|
|
94
|
-
"(prism-coder:
|
|
94
|
+
"(prism-coder:4b by default) against the supplied `evidence`. Drafts with " +
|
|
95
95
|
"NEUTRAL or CONTRADICTED claims are refused.",
|
|
96
96
|
},
|
|
97
97
|
verifier_model: {
|
|
98
98
|
type: "string",
|
|
99
|
-
description: "Override the verifier model. Default: prism-coder:
|
|
99
|
+
description: "Override the verifier model. Default: prism-coder:4b.",
|
|
100
100
|
},
|
|
101
101
|
verifier_timeout_ms: {
|
|
102
102
|
type: "number",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prism-mcp-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"mcpName": "io.github.dcostenco/prism-coder",
|
|
5
|
-
"description": "Prism Coder — Cognitive memory + tool-calling intelligence for AI agents. Mind Palace persistent memory (BFCL Gold Certified, 100% Tool-Call Accuracy, 114 Agent Skills, Zero-Search HDC/HRR retrieval, HRR Semantic Drift Detection across BCBA/Coding/AAC domains, HIPAA-hardened local-first storage, SLERP-optimized GRPO alignment) plus the prism-coder 1.7B–32B open-weights LLM fleet.",
|
|
5
|
+
"description": "Prism Coder — Cognitive memory + tool-calling intelligence for AI agents. Mind Palace persistent memory (BFCL Gold Certified, 100% Tool-Call Accuracy, 114 Agent Skills, PHI Guard, Tier Enforcement, Prompt-Based Skill Routing, Zero-Search HDC/HRR retrieval, HRR Semantic Drift Detection across BCBA/Coding/AAC domains, HIPAA-hardened local-first storage, SLERP-optimized GRPO alignment) plus the prism-coder 1.7B–32B open-weights LLM fleet.",
|
|
6
6
|
"module": "index.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/server.js",
|