nexus-prime 7.6.0 → 7.7.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.
@@ -962,8 +962,13 @@ export function buildMcpToolDefinitions() {
962
962
  required: ['taskId', 'goal', 'findings'],
963
963
  },
964
964
  },
965
- ...synapseToolDefinitions,
966
- ...architectsToolDefinitions,
965
+ // When NEXUS_DISABLE_WORKFORCE=1 (the daemon default since v7.6.1),
966
+ // strip the 24 nexus_synapse_* / nexus_architects_* tools from the
967
+ // catalog so the model doesn't see surface area for engines that
968
+ // aren't initialized at runtime. Set NEXUS_DISABLE_WORKFORCE=0 to
969
+ // re-enable both engines + their tools.
970
+ ...(process.env.NEXUS_DISABLE_WORKFORCE === '1' ? [] : synapseToolDefinitions),
971
+ ...(process.env.NEXUS_DISABLE_WORKFORCE === '1' ? [] : architectsToolDefinitions),
967
972
  // ── Workforce (unified worker+job layer) ──────────────────────────
968
973
  {
969
974
  name: 'nexus_work_enqueue',
@@ -66,11 +66,22 @@ export async function handleMemoryGroup(toolName, hctx, request, args, ctx) {
66
66
  ], '35');
67
67
  if (fmt === 'nxl')
68
68
  return nxlResult({ query, count: memories.length, memories });
69
+ // Token-economy: truncate each body to 280 chars by default. Pass
70
+ // format='full' to opt back into verbatim output. Verified savings
71
+ // are typically 4-6× on recall payloads.
72
+ const RECALL_BODY_LIMIT = 280;
73
+ const truncate = fmt !== 'full';
74
+ const formatted = memories.map((m, i) => {
75
+ const body = String(m ?? '');
76
+ if (!truncate || body.length <= RECALL_BODY_LIMIT)
77
+ return `${i + 1}. ${body}`;
78
+ return `${i + 1}. ${body.slice(0, RECALL_BODY_LIMIT)}… [truncated; pass format="full" for verbatim]`;
79
+ }).join('\n\n');
69
80
  return {
70
81
  content: [{
71
82
  type: 'text',
72
83
  text: (memories.length > 0
73
- ? `🧠 ${memories.length} memories recalled for "${query}":\n\n${memories.map((m, i) => `${i + 1}. ${m}`).join('\n\n')}`
84
+ ? `🧠 ${memories.length} memories recalled for "${query}":\n\n${formatted}`
74
85
  : `No memories found for "${query}". Fresh session or new topic.`) + '\n\n' + nudge,
75
86
  }],
76
87
  };
@@ -607,6 +607,28 @@ export async function handleOrchestrationGroup(toolName, hctx, request, args, ct
607
607
  hctx.telemetry.recordTokens(plan.savings);
608
608
  const pct = plan.totalEstimatedTokens > 0 ? Math.round(plan.savings / (plan.totalEstimatedTokens + plan.savings) * 100) : 0;
609
609
  nexusEventBus.emit('tokens.optimized', { savings: plan.savings, pct, files: filePaths.length });
610
+ // Persist token savings to the global ledger so the dashboard
611
+ // hero KPI grows on day-one (not just from nexus_orchestrate runs).
612
+ // Best-effort — never block the response.
613
+ try {
614
+ const orchestrator = hctx.getOrchestrator?.(request.params.arguments ?? {});
615
+ const memory = orchestrator?.getMemoryEngine?.();
616
+ if (memory && typeof memory.insertTokenTelemetry === 'function' && plan.savings > 0) {
617
+ const grossInput = plan.totalEstimatedTokens + plan.savings;
618
+ memory.insertTokenTelemetry({
619
+ sessionId: 'optimize-tokens',
620
+ task: String(task ?? 'optimize-tokens').slice(0, 200),
621
+ model: 'optimize-tokens',
622
+ tokensOptimized: plan.totalEstimatedTokens,
623
+ tokensSaved: plan.savings,
624
+ tokensForwarded: plan.totalEstimatedTokens,
625
+ compressionRatio: grossInput > 0 ? plan.totalEstimatedTokens / grossInput : 0,
626
+ fileCount: filePaths.length,
627
+ usdValueSaved: plan.savings / 1000 * 0.0006,
628
+ });
629
+ }
630
+ }
631
+ catch { /* best-effort; ledger writer is non-critical */ }
610
632
  const notification = hctx.telemetry.notifyTokens(task, plan.savings, pct, filePaths.length);
611
633
  const fullReads = plan.files.filter((a) => a.action === 'full').length;
612
634
  const nudge = hctx.telemetry.planningNudge('optimize', { fullReads });
package/dist/cli.js CHANGED
@@ -788,6 +788,16 @@ program
788
788
  if (process.env.NEXUS_DAEMON_FAST_START === undefined) {
789
789
  process.env.NEXUS_DAEMON_FAST_START = '1';
790
790
  }
791
+ // Default the daemon to "workforce-disabled" mode: Synapse + Architects
792
+ // engines stay in the source tree (tests still run, code is preserved)
793
+ // but they don't open their SQLite DBs, run schema migrations, or
794
+ // surface their 24 MCP tools to clients. Saves ~700ms boot, shrinks
795
+ // the model-visible tool catalog, and removes the empty Workforce
796
+ // surface from the dashboard. Re-enable with NEXUS_DISABLE_WORKFORCE=0
797
+ // for users who actually hire operatives + dispatch missions.
798
+ if (process.env.NEXUS_DISABLE_WORKFORCE === undefined) {
799
+ process.env.NEXUS_DISABLE_WORKFORCE = '1';
800
+ }
791
801
  const workspaceContext = resolveWorkspaceContext({ workspaceRoot: getWorkspaceRoot() });
792
802
  const daemon = new NexusDaemonServer(workspaceContext);
793
803
  const { started, record } = await daemon.start();
@@ -164,8 +164,21 @@ function renderConnectedEcosystem() {
164
164
  ${ago ? `<span style="margin-left:auto;font-size:10px;color:var(--muted)">${esc(ago)}</span>` : ''}
165
165
  </div>`;
166
166
  }).join('');
167
- list.innerHTML = html;
168
- if (stamp) stamp.textContent = `${ordered.length} client${ordered.length === 1 ? '' : 's'}`;
167
+ // Workforce status indicator — surface the v7.6.1 mute as a visible
168
+ // chip with the env-var hint, so users who want autonomous agent hiring
169
+ // know how to re-enable it without reading CLAUDE.md.
170
+ const workforceMuted = (op?.workforce?.disabled === true)
171
+ || ((op?.runtimeEnvelope?.engines?.synapse?.deferred === true)
172
+ && (op?.runtimeEnvelope?.engines?.architects?.deferred === true));
173
+ const workforceChip = workforceMuted
174
+ ? `<div style="display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:6px;background:var(--surface2);font-size:11px;border-left:3px solid var(--muted);opacity:0.85" title="Restart with NEXUS_DISABLE_WORKFORCE=0 to enable Synapse + Architects">
175
+ <span style="width:6px;height:6px;border-radius:50%;background:var(--muted);flex-shrink:0"></span>
176
+ <span style="font-family:var(--font-mono);font-weight:600;color:var(--muted)">Workforce</span>
177
+ <span style="font-size:10px;color:var(--muted);font-family:var(--font-mono);text-transform:uppercase;letter-spacing:0.5px">muted · NEXUS_DISABLE_WORKFORCE=0 to enable</span>
178
+ </div>`
179
+ : '';
180
+ list.innerHTML = html + workforceChip;
181
+ if (stamp) stamp.textContent = `${ordered.length} client${ordered.length === 1 ? '' : 's'}${workforceMuted ? ' · workforce muted' : ''}`;
169
182
  }
170
183
 
171
184
  /* ── Neural Stream HUD (live SSE event feed strip, restored from v3.8.0) ── */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexus-prime",
3
- "version": "7.6.0",
3
+ "version": "7.7.1",
4
4
  "description": "Local-first MCP control plane for coding agents with bootstrap-orchestrate execution, memory fabric, token budgeting, and worktree-backed swarms",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",