prism-mcp-server 9.1.1 → 9.2.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.
Files changed (3) hide show
  1. package/README.md +80 -1
  2. package/dist/cli.js +106 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -35,6 +35,7 @@ https://github.com/dcostenco/prism-mcp/raw/main/docs/prism_mcp_demo.mp4
35
35
  - [Use Cases](#use-cases)
36
36
  - [What's New](#whats-new)
37
37
  - [How Prism Compares](#how-prism-compares)
38
+ - [CLI Reference](#-cli-reference)
38
39
  - [Tool Reference](#tool-reference)
39
40
  - [Environment Variables](#environment-variables)
40
41
  - [Architecture](#architecture)
@@ -248,6 +249,16 @@ When wrapping up, always call `mcp__prism-mcp__session_save_ledger` and `mcp__pr
248
249
 
249
250
  > **Format Note:** Claude automatically wraps MCP tools with double underscores (`mcp__prism-mcp__...`), while most other clients use single underscores (`mcp_prism-mcp_...`). Prism's backend natively handles both formats seamlessly.
250
251
 
252
+ **CLI Alternative:** If MCP tools aren't available or you're scripting around Claude Code:
253
+
254
+ ```bash
255
+ # Load context before a session
256
+ prism load my-project --level deep
257
+
258
+ # Machine-readable JSON for parsing in scripts
259
+ prism load my-project --level deep --json
260
+ ```
261
+
251
262
  </details>
252
263
 
253
264
  <details id="antigravity-auto-load">
@@ -255,6 +266,46 @@ When wrapping up, always call `mcp__prism-mcp__session_save_ledger` and `mcp__pr
255
266
 
256
267
  See the [Gemini Setup Guide](docs/SETUP_GEMINI.md) for the proven three-layer prompt architecture to ensure reliable session auto-loading.
257
268
 
269
+ Antigravity doesn't expose MCP tools to the model. Use the `prism load` CLI as a fallback:
270
+
271
+ ```bash
272
+ # From a shell or run_command tool
273
+ prism load my-project --level standard --json
274
+
275
+ # Or via the wrapper script
276
+ bash ~/.gemini/antigravity/scratch/prism_session_loader.sh my-project
277
+ ```
278
+
279
+ The CLI uses the same storage layer as the MCP tool (SQLite or Supabase).
280
+
281
+ </details>
282
+
283
+ <details>
284
+ <summary><strong>Bash / CI/CD / Scripts</strong></summary>
285
+
286
+ Use the `prism load` CLI to access session context from any shell environment:
287
+
288
+ ```bash
289
+ # Quick check — human-readable
290
+ prism load my-project
291
+
292
+ # Parse JSON in scripts
293
+ CONTEXT=$(prism load my-project --level quick --json)
294
+ SUMMARY=$(echo "$CONTEXT" | jq -r '.handoff[0].last_summary')
295
+ VERSION=$(echo "$CONTEXT" | jq -r '.handoff[0].version')
296
+ echo "Project at v$VERSION: $SUMMARY"
297
+
298
+ # Role-scoped loading
299
+ prism load my-project --role qa --json
300
+
301
+ # Use in CI/CD to verify context exists before deploying
302
+ if ! prism load my-project --level quick --json | jq -e '.handoff[0].version' > /dev/null 2>&1; then
303
+ echo "No Prism context found — skipping context-aware deploy"
304
+ fi
305
+ ```
306
+
307
+ > 📦 **Install:** `npm install -g prism-mcp-server` makes the `prism` CLI available globally. For local builds: `node /path/to/prism/dist/cli.js load`.
308
+
258
309
  </details>
259
310
 
260
311
  <details>
@@ -727,8 +778,9 @@ The Generator strips the `console.log`, resubmits, and the next `EVALUATE` retur
727
778
 
728
779
  ## 🆕 What's New
729
780
 
730
- > **Current release: v9.1.0Task Router v2 & Local Agent Hardening**
781
+ > **Current release: v9.2.1 — CLI Full Feature Parity**
731
782
 
783
+ - 💻 **v9.2.1 — CLI Full Feature Parity:** `prism load` text mode now delegates to the real `session_load_context` handler, giving CLI-only users the same enriched output as MCP clients: morning briefings, reality drift detection, SDM intuitive recall, visual memory index, role-scoped skill injection, behavioral warnings, importance scores, and agent identity. JSON mode now includes `agent_name` from dashboard settings. Session loader script PATH fix for Homebrew/nvm/volta environments.
732
784
  - 🚦 **v9.1.0 — Task Router v2:** File-type complexity signal for intelligent code-vs-config routing, 6-signal weighted heuristic engine, multi-step false-positive fix, expanded file extension classification. Local agent hardened with buffered streaming, system prompts, memory trimming, and stateful `/api/chat` API.
733
785
  - 🔒 **v9.0.5 — JWKS Auth Security Hardening:** JWT audience/issuer claim validation (`PRISM_JWT_AUDIENCE`, `PRISM_JWT_ISSUER`), structured error logging for JWT failures, typed `PrismAuthenticatedRequest` interface, 11 new JWKS unit tests, Smithery server card fix. Vendor-neutral — tested with Auth0, AgentLair ([llms.txt](https://agentlair.com/llms.txt)), Keycloak, and custom JWKS endpoints.
734
786
  - 🧠 **v9.0.0 — Autonomous Cognitive OS:** Token-Economic Reinforcement Learning (Surprisal Gate + Cognitive Budget), Affect-Tagged Memory (valence-scored retrieval), and Episodic→Semantic Consolidation. Your agents learn compression and develop intuition. → [Cognitive OS](#-autonomous-cognitive-os-v90)
@@ -791,6 +843,33 @@ Every other AI coding pipeline has a fatal flaw: it asks the same model that wro
791
843
 
792
844
  ---
793
845
 
846
+ ## 💻 CLI Reference
847
+
848
+ Prism includes a CLI for environments where MCP tools aren't available (CI/CD pipelines, Bash scripts, non-MCP IDEs like Antigravity).
849
+
850
+ **Text mode** delegates to the real `session_load_context` handler — full feature parity with MCP clients, including morning briefings, reality drift detection, SDM intuitive recall, visual memory, role-scoped skills, behavioral warnings, and agent identity.
851
+
852
+ **JSON mode** emits a structured envelope for programmatic consumption (scripts, CI/CD, session loaders).
853
+
854
+ ```bash
855
+ # Load session context (full enrichments — same as MCP tool)
856
+ prism load my-project # Human-readable, standard depth
857
+ prism load my-project --level deep # Full context with all enrichments
858
+ prism load my-project --level quick --json # Machine-readable JSON
859
+ prism load my-project --role dev --json # Role-scoped loading
860
+
861
+ # Verification harness
862
+ prism verify status # Check verification state
863
+ prism verify status --json # Machine-readable output
864
+ prism verify generate # Bless current rubric as canonical
865
+ ```
866
+
867
+ > 💡 **When to use the CLI vs MCP tools:** If your environment supports MCP (Claude Desktop, Cursor, Windsurf, Cline), always use the MCP tools — they integrate seamlessly with the agent's tool-calling flow. Use the CLI when you need session context in scripts, CI/CD, or non-MCP IDEs.
868
+
869
+ > 📦 **Installation:** The CLI is available as `prism` when installed globally (`npm install -g prism-mcp-server`), or via `node dist/cli.js` for local dev builds.
870
+
871
+ ---
872
+
794
873
  ## 🔧 Tool Reference
795
874
 
796
875
  Prism ships 30+ tools, but **90% of your workflow uses just three:**
package/dist/cli.js CHANGED
@@ -3,11 +3,115 @@ import { Command } from 'commander';
3
3
  import { SqliteStorage } from './storage/sqlite.js';
4
4
  import { handleVerifyStatus, handleGenerateHarness } from './verification/cliHandler.js';
5
5
  import * as path from 'path';
6
+ import { getStorage, closeStorage } from './storage/index.js';
7
+ import { getSetting } from './storage/configStorage.js';
8
+ import { PRISM_USER_ID, SERVER_CONFIG } from './config.js';
9
+ import { getCurrentGitState } from './utils/git.js';
10
+ import { sessionLoadContextHandler } from './tools/ledgerHandlers.js';
6
11
  const program = new Command();
7
12
  program
8
13
  .name('prism')
9
- .description('Prism Configuration & CLI')
10
- .version('7.3.1');
14
+ .description('Prism The Mind Palace for AI Agents')
15
+ .version(SERVER_CONFIG.version);
16
+ // ─── prism load <project> ─────────────────────────────────────
17
+ // Loads session context using the same storage layer as the MCP
18
+ // session_load_context tool. Works with both SQLite and Supabase.
19
+ // Designed for environments that cannot use MCP tools directly
20
+ // (Antigravity, Bash scripts, CI/CD pipelines).
21
+ //
22
+ // TEXT MODE: Delegates to the real sessionLoadContextHandler for
23
+ // full feature parity — morning briefing, reality drift detection,
24
+ // SDM recall, visual memory, skill injection, behavioral warnings,
25
+ // importance scores, recent validations. Any future MCP enrichments
26
+ // automatically appear in CLI too.
27
+ //
28
+ // JSON MODE: Structured envelope for programmatic consumption
29
+ // (session loader scripts, CI/CD pipelines, etc.).
30
+ program
31
+ .command('load <project>')
32
+ .description('Load session context for a project (same output as session_load_context MCP tool)')
33
+ .option('-l, --level <level>', 'Context depth: quick, standard, deep', 'standard')
34
+ .option('-r, --role <role>', 'Role scope for context loading')
35
+ .option('--json', 'Emit machine-readable JSON instead of formatted text')
36
+ .action(async (project, options) => {
37
+ try {
38
+ const { level, role, json: jsonOutput } = options;
39
+ const validLevels = ['quick', 'standard', 'deep'];
40
+ if (!validLevels.includes(level)) {
41
+ console.error(`Error: Invalid level "${level}". Must be one of: ${validLevels.join(', ')}`);
42
+ process.exit(1);
43
+ }
44
+ if (jsonOutput) {
45
+ // ── JSON mode: structured output for programmatic consumption ──
46
+ const storage = await getStorage();
47
+ const effectiveRole = role || await getSetting('default_role', '') || undefined;
48
+ const agentName = await getSetting('agent_name', '') || undefined;
49
+ const data = await storage.loadContext(project, level, PRISM_USER_ID, effectiveRole);
50
+ if (!data) {
51
+ console.log(JSON.stringify({ error: `No session context found for project "${project}"` }));
52
+ await closeStorage();
53
+ process.exit(0);
54
+ }
55
+ const d = data;
56
+ const gitState = getCurrentGitState();
57
+ const output = {
58
+ agent_name: agentName || null,
59
+ handoff: [{
60
+ project,
61
+ role: effectiveRole || d.role || 'global',
62
+ last_summary: d.last_summary || null,
63
+ pending_todo: d.pending_todo || null,
64
+ active_decisions: d.active_decisions || null,
65
+ keywords: d.keywords || null,
66
+ key_context: d.key_context || null,
67
+ active_branch: d.active_branch || null,
68
+ version: d.version ?? null,
69
+ updated_at: d.updated_at || null,
70
+ }],
71
+ recent_ledger: (d.recent_sessions || []).map((s) => ({
72
+ summary: s.summary || null,
73
+ decisions: s.decisions || null,
74
+ keywords: s.keywords || null,
75
+ created_at: s.session_date || s.created_at || null,
76
+ })),
77
+ git_hash: gitState.commitSha ? gitState.commitSha.substring(0, 7) : null,
78
+ git_branch: gitState.branch || null,
79
+ pkg_version: SERVER_CONFIG.version,
80
+ };
81
+ console.log(JSON.stringify(output, null, 2));
82
+ }
83
+ else {
84
+ // ── Text mode: full parity with MCP session_load_context ──
85
+ // Delegates to the real handler so all enrichments (morning briefing,
86
+ // reality drift, SDM recall, visual memory, skill injection,
87
+ // behavioral warnings, etc.) are included automatically.
88
+ const result = await sessionLoadContextHandler({ project, level, role });
89
+ // Surface handler-level errors (e.g. invalid args, storage failures)
90
+ if (result.isError) {
91
+ console.error(result.content[0]?.text || 'Unknown error loading context');
92
+ await closeStorage();
93
+ process.exit(1);
94
+ }
95
+ let output = '';
96
+ if (result.content?.[0]) {
97
+ output = result.content[0].text;
98
+ }
99
+ // Append git state (not included in the MCP handler output)
100
+ const gitState = getCurrentGitState();
101
+ if (gitState.isRepo) {
102
+ output += `\n\n🔧 Git: ${gitState.branch} @ ${gitState.commitSha?.substring(0, 7)} (Prism v${SERVER_CONFIG.version})`;
103
+ }
104
+ console.log(output);
105
+ }
106
+ await closeStorage();
107
+ }
108
+ catch (err) {
109
+ console.error(`Error loading context: ${err instanceof Error ? err.message : String(err)}`);
110
+ await closeStorage().catch(() => { });
111
+ process.exit(1);
112
+ }
113
+ });
114
+ // ─── prism verify ─────────────────────────────────────────────
11
115
  const verifyCmd = program
12
116
  .command('verify')
13
117
  .description('Manage the verification harness');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prism-mcp-server",
3
- "version": "9.1.1",
3
+ "version": "9.2.1",
4
4
  "mcpName": "io.github.dcostenco/prism-mcp",
5
5
  "description": "The Mind Palace for AI Agents — a true Cognitive Architecture with Hebbian learning (episodic→semantic consolidation), ACT-R spreading activation (multi-hop causal reasoning), uncertainty-aware rejection gates (agents that know when they don't know), adversarial evaluation (anti-sycophancy), fail-closed Dark Factory pipelines, persistent memory (SQLite/Supabase), multi-agent Hivemind, time travel & visual dashboard. Zero-config local mode.",
6
6
  "module": "index.ts",