prism-mcp-server 19.3.0 โ†’ 19.3.2

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 CHANGED
@@ -85,7 +85,9 @@ Every `prism_infer` call tracks which model handled it (local Ollama vs cloud) a
85
85
  ```
86
86
  ๐Ÿ“Š Inference Metrics (this session):
87
87
  Total calls: 12 โ€” Local: 10 (83%) | Cloud: 2 (17%)
88
- Tokens: 8,420 in + 3,150 out = 11,570 total
88
+ Prompt tokens: 7,840 evaluated / 8,420 submitted est.
89
+ Completion tokens: 3,150
90
+ Cloud tokens saved (est.): 11,570 โ€” token volume handled locally instead of cloud
89
91
  Avg latency: 1,240ms
90
92
  By model:
91
93
  prism-coder:27b: 6 calls, 7,200 tokens, avg 1,800ms
@@ -93,6 +95,8 @@ Every `prism_infer` call tracks which model handled it (local Ollama vs cloud) a
93
95
  synalux-27b: 2 calls, 1,500 tokens, avg 1,100ms
94
96
  ```
95
97
 
98
+ **Cloud tokens saved** is the honest routing metric โ€” it accrues only when local Ollama handles a call that would otherwise have gone to Claude or the Synalux portal. A compact version appears inline after every 5th `prism_infer` call: `๐Ÿ“Š local 10 (83%) ยท cloud 2 (17%) ยท ~11,570 tok ยท avg 1,240ms ยท 11,570 cloud tok saved`.
99
+
96
100
  Local calls use actual Ollama token counts (`prompt_eval_count` / `eval_count` from Ollama); cloud calls use char/4 estimates. Metrics are tracked locally โ€” no portal dependency, no env vars, works offline. Per-call data is also forwarded to the Synalux portal as best-effort analytics (independent of the display).
97
101
 
98
102
  ### Session Drift Detection
@@ -741,6 +741,7 @@ export class SqliteStorage {
741
741
  "archived_at", "deleted_at", "is_rollup", "role", "event_type",
742
742
  "created_at", "updated_at", "session_date", "importance", "title",
743
743
  "agent_name", "last_accessed_at", "confidence_score", "rollup_count",
744
+ "embedding",
744
745
  ]);
745
746
  parsePostgRESTFilters(params) {
746
747
  const conditions = [];
@@ -11,7 +11,7 @@
11
11
  * 3. Call /api/generate locally โ€” return on success
12
12
  * 4. On local fail, if cloud_fallback=true:
13
13
  * - exchange synalux_sk_ โ†’ JWT (cached)
14
- * - POST synalux portal /api/v1/prism-aac/inference
14
+ * - POST synalux portal /api/v1/prism/inference
15
15
  * - portal runs its own cascade (9B/27B/Claude by tier)
16
16
  * 5. Return { output, backend, model_picked, ram_free_mb, latency_ms, used_cloud }
17
17
  *
@@ -260,7 +260,7 @@ async function callSynaluxInference(prompt, maxTokens, timeoutMs) {
260
260
  const jwt = await getSynaluxJwt();
261
261
  if (!jwt)
262
262
  return { ok: false, reason: "jwt_exchange_failed" };
263
- const url = `${PRISM_SYNALUX_BASE_URL}/api/v1/prism-aac/inference`;
263
+ const url = `${PRISM_SYNALUX_BASE_URL}/api/v1/prism/inference`;
264
264
  try {
265
265
  let res = await fetch(url, {
266
266
  method: "POST",
@@ -37,6 +37,7 @@ let promptTokensEvaluated = 0;
37
37
  let promptTokensSubmittedEst = 0;
38
38
  let totalCompletionTokens = 0;
39
39
  let totalLatencyMs = 0;
40
+ let cloudTokensSavedEst = 0;
40
41
  export function recordInference(result) {
41
42
  if (result.backend === "safety_gate")
42
43
  return;
@@ -64,6 +65,9 @@ export function recordInference(result) {
64
65
  promptTokensSubmittedEst += submittedEst;
65
66
  totalCompletionTokens += ct;
66
67
  totalLatencyMs += result.latency_ms;
68
+ if (!result.used_cloud) {
69
+ cloudTokensSavedEst += submittedEst + ct;
70
+ }
67
71
  if (!byModel[key]) {
68
72
  byModel[key] = {
69
73
  calls: 0,
@@ -96,6 +100,7 @@ export function getInferenceSnapshot() {
96
100
  totalCompletionTokens,
97
101
  totalTokens: promptTokensSubmittedEst + totalCompletionTokens,
98
102
  avgLatencyMs: total > 0 ? Math.round(totalLatencyMs / total) : 0,
103
+ cloudTokensSavedEst,
99
104
  byModel: modelCopy,
100
105
  };
101
106
  }
@@ -106,6 +111,7 @@ export function resetInferenceMetrics() {
106
111
  promptTokensSubmittedEst = 0;
107
112
  totalCompletionTokens = 0;
108
113
  totalLatencyMs = 0;
114
+ cloudTokensSavedEst = 0;
109
115
  for (const key of Object.keys(byModel)) {
110
116
  delete byModel[key];
111
117
  }
@@ -142,7 +148,8 @@ export function formatInferenceMetrics(compact = false) {
142
148
  // see at least one rollup. Otherwise emit every N calls as the rolling summary.
143
149
  if (snap.totalCalls !== 1 && snap.totalCalls % every !== 0)
144
150
  return "";
145
- return `๐Ÿ“Š local ${snap.localCalls} (${snap.localPct}%) ยท cloud ${snap.cloudCalls} (${snap.cloudPct}%) ยท ~${snap.totalTokens.toLocaleString()} tok ยท avg ${snap.avgLatencyMs}ms`;
151
+ const savedStr = snap.cloudTokensSavedEst > 0 ? ` ยท ${snap.cloudTokensSavedEst.toLocaleString()} cloud tok saved` : "";
152
+ return `๐Ÿ“Š local ${snap.localCalls} (${snap.localPct}%) ยท cloud ${snap.cloudCalls} (${snap.cloudPct}%) ยท ~${snap.totalTokens.toLocaleString()} tok ยท avg ${snap.avgLatencyMs}ms${savedStr}`;
146
153
  }
147
154
  // Full multi-line block (explicit inference_metrics tool call).
148
155
  // T2: show both evaluated (Ollama actual) and submitted estimate.
@@ -150,11 +157,15 @@ export function formatInferenceMetrics(compact = false) {
150
157
  const promptLine = snap.promptTokensEvaluated !== snap.promptTokensSubmittedEst
151
158
  ? ` Prompt tokens: ${snap.promptTokensEvaluated.toLocaleString()} evaluated / ${snap.promptTokensSubmittedEst.toLocaleString()} submitted est.`
152
159
  : ` Prompt tokens: ${snap.promptTokensEvaluated.toLocaleString()}`;
160
+ const savedLine = snap.cloudTokensSavedEst > 0
161
+ ? ` Cloud tokens saved (est.): ${snap.cloudTokensSavedEst.toLocaleString()} โ€” token volume handled locally instead of cloud`
162
+ : ` Cloud tokens saved (est.): 0`;
153
163
  const lines = [
154
164
  `\n๐Ÿ“Š Delegation Metrics โ€” local-model calls this session (not host model spend):`,
155
165
  ` Total calls: ${snap.totalCalls} โ€” Local: ${snap.localCalls} (${snap.localPct}%) | Cloud: ${snap.cloudCalls} (${snap.cloudPct}%)`,
156
166
  promptLine,
157
167
  ` Completion tokens: ${snap.totalCompletionTokens.toLocaleString()}`,
168
+ savedLine,
158
169
  ` Avg latency: ${snap.avgLatencyMs}ms`,
159
170
  ];
160
171
  const models = Object.entries(snap.byModel).sort((a, b) => b[1].calls - a[1].calls);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prism-mcp-server",
3
- "version": "19.3.0",
3
+ "version": "19.3.2",
4
4
  "mcpName": "io.github.dcostenco/prism-coder",
5
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",