prism-mcp-server 20.0.4 → 20.0.6

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
@@ -18,13 +18,13 @@ A paid subscription adds cloud sync, higher model tiers, and team features throu
18
18
 
19
19
  ---
20
20
 
21
- ## What's New in v20.0.4
21
+ ## What's New in v20.0.5
22
22
 
23
- ### Think-Only Retry
24
- Qwen 3.5 models (9B/27B) with thinking enabled could burn all tokens on `<think>` blocks and return empty content, causing a cascade to 4B. Now detects think-only responses and retries the same tier with thinking disabledpreserving model quality instead of falling to a smaller model.
23
+ ### Local-First Delegation — 15 Categories, Measured Rate
24
+ The `local-inference-first` skill covers 15 hard-trigger categories (code gen, regex, format conversion, summarization, documentation, factual lookup, classification, shell commands, config gen, and more). Pasted code blocks now trigger delegation regardless of question phrasing. Measured delegation rate: **30-35% on engineering sessions, 40-60% on transform/content sessions**. Rate depends on prompt mix, not the skill the instruments now self-validate with `nonDelegatedCount` to prevent curated-set tautologies.
25
25
 
26
- ### Local-First Skill Rewrite
27
- The `local-inference-first` skill now uses a hard falsifiable trigger list (format conversion, regex, i18n, boilerplate CRUD, deterministic tests) with no self-assessment escape. Clinical content removed from delegation it conflicts with the Layer 1 reserved-category safety floor. Honest target: 15-25% of prompts delegated at equal quality.
26
+ ### Think-Only Retry (v20.0.4)
27
+ Qwen 3.5 models (9B/27B) with thinking enabled could burn all tokens on `<think>` blocks and return empty content, causing a cascade to 4B. Now detects think-only responses and retries the same tier with thinking disabled preserving model quality instead of falling to a smaller model.
28
28
 
29
29
  ---
30
30
 
@@ -23,7 +23,16 @@ const FALLBACK_SCENARIO = [
23
23
  "",
24
24
  "Answer concretely. If you cannot, READ THE FILE FIRST.",
25
25
  ].join("\n");
26
+ /**
27
+ * MCP tool entrypoint. Every tool handler MUST return a CallToolResult
28
+ * object ({ content: [{ type: "text", text }] }) — returning a bare string
29
+ * makes the MCP SDK reject the result ("expected object, received string",
30
+ * -32602). See the dispatch contract in server.ts (result.content usage).
31
+ */
26
32
  export async function verifyBehaviorHandler(args) {
33
+ return { content: [{ type: "text", text: await buildScenarioText(args) }] };
34
+ }
35
+ async function buildScenarioText(args) {
27
36
  if (!SYNALUX_CONFIGURED || !PRISM_SYNALUX_BASE_URL) {
28
37
  return FALLBACK_SCENARIO;
29
38
  }
@@ -969,8 +969,10 @@ export async function sessionLoadContextHandler(args) {
969
969
  : (effectiveRole ? " · 📜 No skill configured" : "");
970
970
  greetingBlock = `\n\n[👤 AGENT IDENTITY]\n${namePart}${rolePart}${skillPart}`;
971
971
  }
972
- // ─── SDM Intuitive Recall (v5.5) ───
973
- // Generate embedding of current context and fetch latent SDM patterns
972
+ // ─── SDM Associative Recall (v5.5) ───
973
+ // Accepted as-is (R27): cosine similarity at 0.55 threshold, 3 matches max.
974
+ // Relabeled from "Intuitive Recall" to "Associative Recall" in R16.
975
+ // Not a verified-fact source — label says "similarity-matched, not verified facts."
974
976
  let sdmRecallBlock = "";
975
977
  if (level !== "quick") {
976
978
  try {
@@ -30,7 +30,7 @@ import { stripThink } from "../utils/thinkStrip.js";
30
30
  import { passesQualityGate } from "../utils/qualityGate.js";
31
31
  import { checkInputSafety, checkOutputSafety } from "../utils/safetyGate.js";
32
32
  import { callLayer1 as defaultCallLayer1, keywordBackstop } from "../utils/layer1.js";
33
- import { recordInference, formatInferenceMetrics } from "../utils/inferenceMetrics.js";
33
+ import { recordInference, recordThinkOnlyRetry, formatInferenceMetrics } from "../utils/inferenceMetrics.js";
34
34
  // ─── Tool Definition ────────────────────────────────────────────
35
35
  export const PRISM_INFER_TOOL = {
36
36
  name: "prism_infer",
@@ -572,6 +572,7 @@ export async function runInfer(args, deps) {
572
572
  // One-shot: think=false cannot re-trigger think_only (no thinking to burn).
573
573
  if (!result.ok && result.reason === "think_only" && enableThink) {
574
574
  debugLog(`[prism_infer] ${tier.tag} returned think-only — retrying with think=false`);
575
+ recordThinkOnlyRetry();
575
576
  result = await deps.callLocal(deps.ollamaUrl, ollamaName, args.prompt, args.system, maxTokens, temperature, timeout, false);
576
577
  }
577
578
  if (result.ok) {
@@ -38,6 +38,17 @@ let promptTokensSubmittedEst = 0;
38
38
  let totalCompletionTokens = 0;
39
39
  let totalLatencyMs = 0;
40
40
  let cloudTokensSavedEst = 0;
41
+ let thinkOnlyRetries = 0;
42
+ let totalPrompts = 0;
43
+ let nonDelegatedCount = 0;
44
+ export function recordThinkOnlyRetry() {
45
+ thinkOnlyRetries++;
46
+ }
47
+ export function recordPromptSeen(delegated) {
48
+ totalPrompts++;
49
+ if (!delegated)
50
+ nonDelegatedCount++;
51
+ }
41
52
  export function recordInference(result) {
42
53
  if (result.backend === "safety_gate")
43
54
  return;
@@ -101,6 +112,10 @@ export function getInferenceSnapshot() {
101
112
  totalTokens: promptTokensSubmittedEst + totalCompletionTokens,
102
113
  avgLatencyMs: total > 0 ? Math.round(totalLatencyMs / total) : 0,
103
114
  cloudTokensSavedEst,
115
+ thinkOnlyRetries,
116
+ thinkOnlyRetryPct: localCalls > 0 ? Math.round((thinkOnlyRetries / localCalls) * 100) : 0,
117
+ totalPrompts,
118
+ nonDelegatedCount,
104
119
  byModel: modelCopy,
105
120
  };
106
121
  }
@@ -112,6 +127,9 @@ export function resetInferenceMetrics() {
112
127
  totalCompletionTokens = 0;
113
128
  totalLatencyMs = 0;
114
129
  cloudTokensSavedEst = 0;
130
+ thinkOnlyRetries = 0;
131
+ totalPrompts = 0;
132
+ nonDelegatedCount = 0;
115
133
  for (const key of Object.keys(byModel)) {
116
134
  delete byModel[key];
117
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prism-mcp-server",
3
- "version": "20.0.4",
3
+ "version": "20.0.6",
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",