prism-mcp-server 20.5.0 → 20.5.1

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/dist/server.js CHANGED
@@ -324,7 +324,9 @@ export const PRISM_SERVER_INSTRUCTIONS = `Prism MCP — The Mind Palace for AI A
324
324
  `prompt_keywords ON-DEVICE to load symptom-triggered skills on turn one; it is used for routing ` +
325
325
  `only and never leaves the machine. Pass {} only when there is no user message. ` +
326
326
  `When the startup display lists "Symptom-triggered skills", those skills matched the first message's ` +
327
- `trigger rules — read them before proposing any change. Surfacing a name is not loading it. ` +
327
+ `trigger rules — read each before proposing any change. Surfacing a name is not loading it: hosts that ` +
328
+ `do not auto-load skill files must fetch each body with knowledge_search, passing the skill name ` +
329
+ `exactly as listed. ` +
328
330
  `Emit no preamble. Print the complete tool result verbatim as the entire first-turn startup display, before any optional ` +
329
331
  `answer. Do not summarize, paraphrase, rename headings, reformat, or omit any returned section. Preserve its order and ` +
330
332
  `line content. For a greeting-only prompt, stop after the verbatim startup display. ` +
@@ -386,9 +386,33 @@ async function enforceNativeEntitlements(incomingNames, agentsSkillsDir) {
386
386
  await quarantineManagedSkill(target, name, agentsSkillsDir);
387
387
  }
388
388
  }
389
+ /**
390
+ * The cross-host canonical skills root — single source of truth.
391
+ *
392
+ * Do NOT re-derive this path anywhere else. It is overridable per caller
393
+ * (`agentsSkillsDir`) and per home (`homeDir`), so a literal copied into
394
+ * another module is wrong on any machine that overrides either.
395
+ */
396
+ export function resolveCanonicalSkillsDir(options = {}) {
397
+ return options.agentsSkillsDir ?? join(options.homeDir ?? homedir(), ".agents", "skills");
398
+ }
399
+ /**
400
+ * Read a skill's body from the canonical root. Returns null when absent or
401
+ * unreadable — callers must degrade, never fail startup over it.
402
+ */
403
+ export async function readNativeSkillBody(name, options = {}) {
404
+ if (!SAFE_NAME.test(name))
405
+ return null; // no traversal via name
406
+ try {
407
+ return await readFile(join(resolveCanonicalSkillsDir(options), name, "SKILL.md"), "utf8");
408
+ }
409
+ catch {
410
+ return null;
411
+ }
412
+ }
389
413
  async function resolveNativeSkillsDirs(options) {
390
414
  const userHome = options.homeDir ?? homedir();
391
- const canonical = options.agentsSkillsDir ?? join(userHome, ".agents", "skills");
415
+ const canonical = resolveCanonicalSkillsDir(options);
392
416
  let claudeCode = null;
393
417
  let cursor = null;
394
418
  if (typeof options.claudeCodeSkillsDir === "string") {
@@ -86,6 +86,20 @@ const MEMORY_BOUNDARY_SUFFIX = '\n</prism_memory>';
86
86
  * budget — an unbounded list would starve the context it is meant to annotate.
87
87
  */
88
88
  const MAX_SYMPTOM_SKILLS = 5;
89
+ /**
90
+ * Hard ceiling on the inlined skill body, and the share of the display budget
91
+ * it may take. Naming a skill is not delivering it: skill bodies reach agents
92
+ * ONLY as files under resolveNativeSkillsDirs, and hosts outside that list
93
+ * (Gemini) have no path to the content at all — no MCP tool serves it. Three
94
+ * instruction rewrites failed for that reason before it was found. Inlining
95
+ * removes the indirection entirely: the rule is simply in context.
96
+ */
97
+ const SYMPTOM_SKILL_INLINE_MAX = 1_800;
98
+ const SYMPTOM_SKILL_BUDGET_SHARE = 0.4;
99
+ // Skill bodies are read via skillManifestSync.readNativeSkillBody, which owns
100
+ // the canonical root. That path is overridable per caller and per home, so a
101
+ // literal copied to this module would be wrong on any machine that overrides
102
+ // either — and would silently drift from the writer.
89
103
  const NATIVE_STARTUP_MAX_CHARS = {
90
104
  quick: 4_000,
91
105
  standard: 8_000,
@@ -1262,9 +1276,28 @@ export async function sessionLoadContextHandler(args, options = {}) {
1262
1276
  const overflow = matched.length - shown.length;
1263
1277
  // Imperative, not a label: a bare list is decorative, and nothing
1264
1278
  // else in the pipeline tells the agent to act on it.
1279
+ // Names are interpolated, never a placeholder. A `<skill name>`
1280
+ // placeholder here rendered as knowledge_search("") on a real host —
1281
+ // markdown/HTML display ate the angle brackets as an unknown tag.
1282
+ // Never emit angle brackets in text a host will render.
1265
1283
  symptomSkillSuffix = `\n\n**Symptom-triggered skills:** ${shown.join(", ")}` +
1266
1284
  (overflow > 0 ? `, … ${overflow} more` : "") +
1267
- `\nThe first message matches these skills' trigger rules. Read them before proposing changes.\n`;
1285
+ `\nThe first message matches these skills' trigger rules. Follow them before ` +
1286
+ `proposing any change.\n`;
1287
+ // INLINE the top match's body rather than pointing at it. Naming a
1288
+ // skill is not delivering it: bodies reach agents only as files under
1289
+ // the canonical root, and hosts outside that mirror have no path to
1290
+ // the content — no MCP tool serves it. Three instruction rewrites
1291
+ // failed on that gap. Inlining removes the indirection entirely.
1292
+ const { readNativeSkillBody } = await import("../skillManifestSync.js");
1293
+ const body = (await readNativeSkillBody(shown[0]))?.trim();
1294
+ if (body) {
1295
+ const cap = Math.min(SYMPTOM_SKILL_INLINE_MAX, Math.floor(NATIVE_STARTUP_MAX_CHARS[level] * SYMPTOM_SKILL_BUDGET_SHARE));
1296
+ const clipped = body.length > cap
1297
+ ? `${body.slice(0, cap).trimEnd()}\n… (rule truncated to fit the startup budget)`
1298
+ : body;
1299
+ symptomSkillSuffix += `\n--- ${shown[0]} ---\n${clipped}\n`;
1300
+ }
1268
1301
  }
1269
1302
  }
1270
1303
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prism-mcp-server",
3
- "version": "20.5.0",
3
+ "version": "20.5.1",
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 or subscription-gated Synalux storage, SLERP-optimized GRPO alignment) plus the prism-coder 1.7B–32B open-weights LLM fleet.",
6
6
  "module": "index.ts",