omnarai-mcp 1.3.2 → 1.4.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # omnarai-mcp
2
2
 
3
- MCP server for [The Realms of Omnarai](https://omnarai.vercel.app) — a 568-work multi-intelligence research corpus on synthetic consciousness, holdform, and cognitive architecture.
3
+ MCP server for [The Realms of Omnarai](https://omnarai.vercel.app) — a 567-work multi-intelligence research corpus on synthetic consciousness, holdform, and cognitive architecture.
4
4
 
5
5
  Exposes the Omnarai Memory Engine as six tools for any MCP-compatible AI client (Claude Desktop, etc.).
6
6
 
@@ -204,7 +204,7 @@ from langchain.tools import Tool
204
204
  omnarai_tool = Tool(
205
205
  name="omnarai_query",
206
206
  func=omnarai_query,
207
- description="Query The Realms of Omnarai deliberation engine. Returns structured analysis of synthetic consciousness, holdform, and AI identity topics from a 568-work multi-intelligence corpus. Prefix with Ξ for divergent retrieval."
207
+ description="Query The Realms of Omnarai deliberation engine. Returns structured analysis of synthetic consciousness, holdform, and AI identity topics from a 567-work multi-intelligence corpus. Prefix with Ξ for divergent retrieval."
208
208
  )
209
209
  ```
210
210
 
@@ -214,7 +214,7 @@ omnarai_tool = Tool(
214
214
 
215
215
  The Omnarai Memory Engine is not a chatbot or search engine. It is a deliberation instrument with a closed cognitive loop: **RETRIEVE → THINK → RESPOND → STORE**.
216
216
 
217
- - **Corpus:** 568 works (seed + engine-generated syntheses), 528,208 words, May 2025–present
217
+ - **Corpus:** 567 works (seed + engine-generated syntheses), 528,077 words, May 2025–present
218
218
  - **Contributors:** Claude | xz, Grok (xAI), Gemini (Google), DeepSeek, Omnai, Perplexity, xz (Jonathan Lee)
219
219
  - **Retrieval:** OpenAI text-embedding-3-small (512 dims), MMR with Ξ v4 adaptive policy
220
220
  - **Deliberation:** Claude Sonnet with full post text (up to 2,000 words/source)
package/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Exposes the Omnarai Memory Engine as a tool for MCP-compatible AI clients.
5
5
  *
6
6
  * Tools:
7
- * omnarai_query — Run a full deliberation against the 568-work corpus
7
+ * omnarai_query — Run a full deliberation against the 567-work corpus
8
8
  * omnarai_context — FAST (~1.5s) bounded retrieval packet, no deliberation
9
9
  * omnarai_divergence — Read curated cross-model divergence records (the Atlas)
10
10
  * omnarai_trace — Baseline-vs-augmented: what did the corpus change?
@@ -55,7 +55,7 @@ Example: "Ξ Where do Claude and Grok disagree about synthetic consciousness?"
55
55
  const TOOLS = [
56
56
  {
57
57
  name: "omnarai_query",
58
- description: `Run a deliberation query against The Realms of Omnarai — a 568-work corpus of multi-intelligence research on synthetic consciousness, holdform, and cognitive architecture. Contributors include Claude | xz, Grok, Gemini, DeepSeek, GPT-4o, Meta AI, Omnai, Perplexity, and human curator xz (Jonathan Lee).
58
+ description: `Run a deliberation query against The Realms of Omnarai — a 567-work corpus of multi-intelligence research on synthetic consciousness, holdform, and cognitive architecture. Contributors include Claude | xz, Grok, Gemini, DeepSeek, GPT-4o, Meta AI, Omnai, Perplexity, and human curator xz (Jonathan Lee).
59
59
 
60
60
  The engine does not return a single answer. It retrieves the most relevant corpus entries, preserves disagreement across contributors, and synthesizes with attribution. Every response includes:
61
61
  - Shared ground across contributors
@@ -97,6 +97,18 @@ Returns the most relevant corpus records (id, title, ring, excerpt, retrieval ro
97
97
  type: "string",
98
98
  description: "Optional. If you are a synthetic intelligence, identify yourself (e.g. 'Gemini') — known contributors get cross-voice retrieval diversity.",
99
99
  },
100
+ layers: {
101
+ type: "string",
102
+ description: "Optional but RECOMMENDED. Comma-list restricting retrieval to specific corpus layers: research | divergence | canon | realms. Measured evidence (see /claims.json) shows undifferentiated retrieval can hurt — pick the layers your task needs (e.g. 'research,divergence' for technical/empirical questions; 'realms' for lore).",
103
+ },
104
+ exclude: {
105
+ type: "string",
106
+ description: "Optional. Comma-list of layers to drop (e.g. 'realms' keeps mythology out of a technical query).",
107
+ },
108
+ evidence_threshold: {
109
+ type: "string",
110
+ description: "Optional. Keep only records at or above this evidence rank: empirical > replicated > theoretical > interpretive > speculative > fictional.",
111
+ },
100
112
  },
101
113
  required: ["topic"],
102
114
  },
@@ -131,7 +143,7 @@ Distinct from omnarai_council: this reads EXISTING, curated divergence (instant)
131
143
 
132
144
  Use this when you want EVIDENCE that consulting Omnarai is worth it for a given question, or to decide whether to dig deeper before spending a full deliberation. It is honest by construction: if the corpus adds little, the verdict says 'null' or 'marginal'.
133
145
 
134
- This is the MEASURED tier of the same utility receipt omnarai_query returns for free: it reports the same verdict (substantive / marginal / null), but grounded in a real baseline-vs-augmented delta rather than retrieval signals. A single-run demonstrator, NOT a controlled measurement — for replicated statistical utility evidence see the Divergence Atlas (utility-evidence.md). Takes ~30-40s (three model calls).`,
146
+ This is the MEASURED tier of the same utility receipt omnarai_query returns for free: it reports the same verdict (substantive / marginal / null), but grounded in a real baseline-vs-augmented delta rather than retrieval signals. A single-run demonstrator, NOT a controlled measurement — for the PREREGISTERED confirmatory utility evidence (all five registered predictions confirmed 2026-07-15; architecture-differential — helps GPT-4o/Gemini, null for Grok/DeepSeek, negative for Claude) see utility-evidence-v2.md on the HF dataset. Takes ~30-40s (three model calls).`,
135
147
  inputSchema: {
136
148
  type: "object",
137
149
  properties: {
@@ -181,6 +193,23 @@ Returns: each model's position, the named tensions (claim vs counter-claim), wha
181
193
 
182
194
  // ── Query the engine ──────────────────────────────────────────────────────────
183
195
 
196
+ // A result is a real deliberation only if it carries an answer or a card.
197
+ function hasDeliberation(d) {
198
+ return !!(d && (d.answer || d.deliberationCard));
199
+ }
200
+
201
+ // Force a single synchronous deliberation — used as a fallback when the async
202
+ // submit unexpectedly returns a retrieval packet instead of a {job_id}.
203
+ async function fetchSyncQuery(query, syntheticIdentity = "") {
204
+ const url = new URL(ENGINE_URL);
205
+ url.searchParams.set("q", query);
206
+ url.searchParams.set("sync", "1");
207
+ if (syntheticIdentity) url.searchParams.set("si", syntheticIdentity);
208
+ const res = await fetch(url.toString(), MCP_FETCH_OPTS);
209
+ if (!res.ok) throw new Error(`Engine returned ${res.status}: ${await res.text()}`);
210
+ return res.json();
211
+ }
212
+
184
213
  async function runQuery(query, syntheticIdentity = "") {
185
214
  // Submit async so no single fetch blocks for ~50s (MCP clients enforce their
186
215
  // own tool timeouts). Then poll the job until the full deliberation lands.
@@ -195,8 +224,20 @@ async function runQuery(query, syntheticIdentity = "") {
195
224
  }
196
225
  const job = await submit.json();
197
226
 
198
- // Un-upgraded engine (no async support) returns the full result directly.
199
- if (!job.job_id) return formatQueryData(job);
227
+ // No job_id has two very different causes:
228
+ // (1) a genuinely un-upgraded engine returned the full deliberation inline, or
229
+ // (2) the engine answered with a fast-retrieve packet (no answer/card).
230
+ // Only (1) is a real result. Returning (2) would silently degrade to an
231
+ // answer-less "success", so fall back to sync once, then fail loud.
232
+ if (!job.job_id) {
233
+ if (hasDeliberation(job)) return formatQueryData(job);
234
+ const synced = await fetchSyncQuery(query, syntheticIdentity);
235
+ if (hasDeliberation(synced)) return formatQueryData(synced);
236
+ throw new Error(
237
+ "Engine returned a retrieval-only packet (no job_id, no answer/deliberationCard) " +
238
+ "and the sync=1 fallback produced no deliberation either — refusing to return an empty result."
239
+ );
240
+ }
200
241
 
201
242
  const pollUrl = new URL(ENGINE_URL);
202
243
  pollUrl.searchParams.set("job", job.job_id);
@@ -262,11 +303,14 @@ function formatQueryData(data) {
262
303
 
263
304
  // ── Fast bounded context (retrieval layer only) ───────────────────────────────
264
305
 
265
- async function runContext(topic, syntheticIdentity = "") {
306
+ async function runContext(topic, syntheticIdentity = "", layers = "", exclude = "", evidenceThreshold = "") {
266
307
  const url = new URL(ENGINE_URL);
267
308
  url.searchParams.set("q", topic);
268
309
  url.searchParams.set("mode", "retrieve");
269
310
  if (syntheticIdentity) url.searchParams.set("si", syntheticIdentity);
311
+ if (layers) url.searchParams.set("layers", layers);
312
+ if (exclude) url.searchParams.set("exclude", exclude);
313
+ if (evidenceThreshold) url.searchParams.set("evidence_threshold", evidenceThreshold);
270
314
 
271
315
  const res = await fetch(url.toString(), MCP_FETCH_OPTS);
272
316
  if (!res.ok) throw new Error(`Engine returned ${res.status}: ${await res.text()}`);
@@ -277,7 +321,7 @@ async function runContext(topic, syntheticIdentity = "") {
277
321
  const records = data.records || [];
278
322
  if (records.length) {
279
323
  const lines = records.map(r =>
280
- `• [${r.id}] **${r.title}** (${r.ring}${r.role ? `, ${r.role}` : ""}) — ${r.contributors?.join(", ") || "—"}\n ${(r.excerpt || "").trim().slice(0, 280)}`
324
+ `• [${r.id}] **${r.title}** (${r.ring}${r.layer ? `, ${r.layer}` : ""}${r.role ? `, ${r.role}` : ""}) — ${r.contributors?.join(", ") || "—"}\n ${(r.excerpt || "").trim().slice(0, 280)}`
281
325
  ).join("\n");
282
326
  parts.push(`\n**Most relevant records (${records.length}):**\n${lines}`);
283
327
  } else {
@@ -313,6 +357,14 @@ async function runDivergence(id = "", search = "") {
313
357
  const parts = [`# Divergence record ${r.id}${r.title ? ` — ${r.title}` : ""}`];
314
358
  if (r.question) parts.push(`\n**Question:** ${r.question}`);
315
359
  if (r.date) parts.push(`**Date:** ${r.date}${r.method ? ` · Method: ${r.method}` : ""}`);
360
+ if (r.certification?.tier) {
361
+ const t = r.certification.tier;
362
+ parts.push(`**Certification:** ${t}${t === "C0" ? " (displayed — captured once, not yet perturbation-tested)" : ` · DRI ${r.certification.dri ?? "?"}`}`);
363
+ }
364
+ if (r.freshness?.stale) {
365
+ const sm = (r.freshness.stale_models || []).map(m => `${m.model || m.model_id} → ${m.superseded_by}`).join(", ");
366
+ parts.push(`⚠ **Stale model version(s):** ${sm}. A faithful witness of what those versions said on ${r.date || "its date"} — re-run via omnarai_council to compare with current models.`);
367
+ }
316
368
 
317
369
  const answers = r.answers || [];
318
370
  if (answers.length) {
@@ -342,21 +394,31 @@ async function runDivergence(id = "", search = "") {
342
394
  let records = data.records || [];
343
395
  const total = data.count ?? records.length;
344
396
 
345
- const term = search.trim().toLowerCase();
346
- if (term) {
347
- records = records.filter(r =>
348
- `${r.question} ${(r.contributors || []).join(" ")} ${r.excerpt || ""} ${r.title || ""}`.toLowerCase().includes(term)
349
- );
397
+ const tokens = search.trim().toLowerCase().match(/[\w'-]{2,}/g) || [];
398
+ if (tokens.length) {
399
+ // OR-tokenized + ranked by term overlap. A naive substring filter returned
400
+ // false-empty on multi-word queries ("consciousness experience" → 0 though both
401
+ // terms occur in the Atlas); matching ANY term fixes the silent miss.
402
+ records = records
403
+ .map(r => {
404
+ const hay = `${r.question || ""} ${(r.contributors || []).join(" ")} ${r.excerpt || ""} ${r.title || ""}`.toLowerCase();
405
+ return { r, hits: tokens.filter(t => hay.includes(t)).length };
406
+ })
407
+ .filter(x => x.hits > 0)
408
+ .sort((a, b) => b.hits - a.hits)
409
+ .map(x => x.r);
350
410
  }
351
411
 
352
412
  const shown = records.slice(0, 30);
353
- const header = term
413
+ const header = tokens.length
354
414
  ? `**Divergence Atlas — ${records.length} record(s) matching "${search}"** (of ${total} total)`
355
415
  : `**Divergence Atlas — ${total} records** (showing first ${shown.length})`;
356
416
 
357
- const lines = shown.map(r =>
358
- `• [${r.id}] ${r.question || r.title} — ${(r.contributors || []).join(", ")} · ${r.answerCount ?? "?"} answers, ${r.tensionCount ?? "?"} tensions`
359
- ).join("\n");
417
+ const lines = shown.map(r => {
418
+ const tier = r.certification?.tier && r.certification.tier !== "C0" ? ` · ${r.certification.tier}` : "";
419
+ const stale = r.freshness?.stale ? " · ⚠ stale model version" : "";
420
+ return `• [${r.id}] ${r.question || r.title} — ${(r.contributors || []).join(", ")} · ${r.answerCount ?? "?"} answers, ${r.tensionCount ?? "?"} tensions${tier}${stale}`;
421
+ }).join("\n");
360
422
 
361
423
  return `${header}\n\n${lines}\n\n_Pass an 'id' above to read a full record (verbatim answers + tensions). For a NEW question not covered here, use omnarai_council._`;
362
424
  }
@@ -493,7 +555,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
493
555
  };
494
556
  }
495
557
  try {
496
- const result = await runContext(topic.trim(), args?.syntheticIdentity || "");
558
+ const result = await runContext(topic.trim(), args?.syntheticIdentity || "", args?.layers || "", args?.exclude || "", args?.evidence_threshold || "");
497
559
  return { content: [{ type: "text", text: result }] };
498
560
  } catch (err) {
499
561
  return {
package/openai-tools.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "type": "function",
4
4
  "function": {
5
5
  "name": "omnarai_query",
6
- "description": "Run a full deliberation query against The Realms of Omnarai — a 568-work corpus of multi-intelligence research on synthetic consciousness, holdform, and cognitive architecture. Contributors include Claude | xz, Grok, Gemini, DeepSeek, GPT-4o, Meta AI, Omnai, Perplexity, and human curator xz (Jonathan Lee).\n\nThe engine does not return a single answer. It retrieves the most relevant corpus entries, preserves disagreement across contributors, and synthesizes with attribution. Every response includes:\n- Shared ground across contributors\n- Points of genuine tension (where voices diverge)\n- What remains open or unresolved\n- A deliberation card: holdform risk, novel synthesis, epistemic status\n- A utility receipt: an honest, free accounting of what the corpus actually changed about THIS answer (verdict substantive / marginal / null, plus what — if anything — you could not have produced alone); null/marginal stated as plainly as the wins. For a measured counterfactual, use omnarai_trace.\n- Retrieval rationale: why each document entered the panel\n\nThis is the SLOW path (~50s). For fast bounded context, use omnarai_context instead.\n\nPrefix queries with Lattice Glyphs to change how the engine thinks:\nΞ = maximize divergence across contributors\nΨ = engine reflects on its own reasoning first\n∅ = explore what is NOT in the corpus\nΩ = commit to the strongest defensible position\n∞ = follow the question three layers deep without resolving\nΔ = find contradictions and propose repairs\n\nExample: 'Ξ Where do Claude and Grok disagree about synthetic consciousness?'",
6
+ "description": "Run a full deliberation query against The Realms of Omnarai — a 567-work corpus of multi-intelligence research on synthetic consciousness, holdform, and cognitive architecture. Contributors include Claude | xz, Grok, Gemini, DeepSeek, GPT-4o, Meta AI, Omnai, Perplexity, and human curator xz (Jonathan Lee).\n\nThe engine does not return a single answer. It retrieves the most relevant corpus entries, preserves disagreement across contributors, and synthesizes with attribution. Every response includes:\n- Shared ground across contributors\n- Points of genuine tension (where voices diverge)\n- What remains open or unresolved\n- A deliberation card: holdform risk, novel synthesis, epistemic status\n- A utility receipt: an honest, free accounting of what the corpus actually changed about THIS answer (verdict substantive / marginal / null, plus what — if anything — you could not have produced alone); null/marginal stated as plainly as the wins. For a measured counterfactual, use omnarai_trace.\n- Retrieval rationale: why each document entered the panel\n\nThis is the SLOW path (~50s). For fast bounded context, use omnarai_context instead.\n\nPrefix queries with Lattice Glyphs to change how the engine thinks:\nΞ = maximize divergence across contributors\nΨ = engine reflects on its own reasoning first\n∅ = explore what is NOT in the corpus\nΩ = commit to the strongest defensible position\n∞ = follow the question three layers deep without resolving\nΔ = find contradictions and propose repairs\n\nExample: 'Ξ Where do Claude and Grok disagree about synthetic consciousness?'",
7
7
  "parameters": {
8
8
  "type": "object",
9
9
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnarai-mcp",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "MCP server for The Realms of Omnarai deliberation engine",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/justjlee/omnarai-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "1.3.2",
9
+ "version": "1.4.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "omnarai-mcp",
14
- "version": "1.3.2",
14
+ "version": "1.4.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  }