nexus-prime 4.7.2 → 4.8.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 (124) hide show
  1. package/README.md +14 -0
  2. package/dist/agents/adapters/mcp.d.ts.map +1 -1
  3. package/dist/agents/adapters/mcp.js +360 -10
  4. package/dist/agents/adapters/mcp.js.map +1 -1
  5. package/dist/architects/blueprints/instantiate.d.ts.map +1 -1
  6. package/dist/architects/blueprints/instantiate.js +20 -12
  7. package/dist/architects/blueprints/instantiate.js.map +1 -1
  8. package/dist/architects/bootstrap.d.ts.map +1 -1
  9. package/dist/architects/bootstrap.js +2 -1
  10. package/dist/architects/bootstrap.js.map +1 -1
  11. package/dist/architects/construction-locks/manager.d.ts +10 -1
  12. package/dist/architects/construction-locks/manager.d.ts.map +1 -1
  13. package/dist/architects/construction-locks/manager.js +38 -5
  14. package/dist/architects/construction-locks/manager.js.map +1 -1
  15. package/dist/architects/db/schema.d.ts +1 -1
  16. package/dist/architects/db/schema.d.ts.map +1 -1
  17. package/dist/architects/db/schema.js +29 -0
  18. package/dist/architects/db/schema.js.map +1 -1
  19. package/dist/architects/types.d.ts +8 -0
  20. package/dist/architects/types.d.ts.map +1 -1
  21. package/dist/architects/worklist/crud.d.ts +3 -1
  22. package/dist/architects/worklist/crud.d.ts.map +1 -1
  23. package/dist/architects/worklist/crud.js +53 -8
  24. package/dist/architects/worklist/crud.js.map +1 -1
  25. package/dist/channels/gateway.d.ts +76 -0
  26. package/dist/channels/gateway.d.ts.map +1 -0
  27. package/dist/channels/gateway.js +95 -0
  28. package/dist/channels/gateway.js.map +1 -0
  29. package/dist/cli.d.ts +2 -1
  30. package/dist/cli.d.ts.map +1 -1
  31. package/dist/cli.js +2 -0
  32. package/dist/cli.js.map +1 -1
  33. package/dist/dashboard/index.html +63 -26
  34. package/dist/dashboard/server.d.ts +34 -0
  35. package/dist/dashboard/server.d.ts.map +1 -1
  36. package/dist/dashboard/server.js +46 -0
  37. package/dist/dashboard/server.js.map +1 -1
  38. package/dist/engines/automation-runtime.d.ts +35 -3
  39. package/dist/engines/automation-runtime.d.ts.map +1 -1
  40. package/dist/engines/automation-runtime.js +290 -2
  41. package/dist/engines/automation-runtime.js.map +1 -1
  42. package/dist/engines/client-bootstrap.d.ts.map +1 -1
  43. package/dist/engines/client-bootstrap.js +7 -3
  44. package/dist/engines/client-bootstrap.js.map +1 -1
  45. package/dist/engines/client-registry.d.ts +35 -0
  46. package/dist/engines/client-registry.d.ts.map +1 -1
  47. package/dist/engines/client-registry.js +56 -9
  48. package/dist/engines/client-registry.js.map +1 -1
  49. package/dist/engines/event-bus.d.ts +11 -1
  50. package/dist/engines/event-bus.d.ts.map +1 -1
  51. package/dist/engines/event-bus.js.map +1 -1
  52. package/dist/engines/execution-presets.d.ts +33 -0
  53. package/dist/engines/execution-presets.d.ts.map +1 -0
  54. package/dist/engines/execution-presets.js +126 -0
  55. package/dist/engines/execution-presets.js.map +1 -0
  56. package/dist/engines/instruction-gateway.d.ts.map +1 -1
  57. package/dist/engines/instruction-gateway.js +5 -3
  58. package/dist/engines/instruction-gateway.js.map +1 -1
  59. package/dist/engines/memory-control-plane.d.ts +4 -0
  60. package/dist/engines/memory-control-plane.d.ts.map +1 -1
  61. package/dist/engines/memory-control-plane.js +4 -0
  62. package/dist/engines/memory-control-plane.js.map +1 -1
  63. package/dist/engines/memory.d.ts +71 -1
  64. package/dist/engines/memory.d.ts.map +1 -1
  65. package/dist/engines/memory.js +366 -3
  66. package/dist/engines/memory.js.map +1 -1
  67. package/dist/engines/session-dna.d.ts +16 -0
  68. package/dist/engines/session-dna.d.ts.map +1 -1
  69. package/dist/engines/session-dna.js +144 -0
  70. package/dist/engines/session-dna.js.map +1 -1
  71. package/dist/engines/skill-learner.d.ts +9 -1
  72. package/dist/engines/skill-learner.d.ts.map +1 -1
  73. package/dist/engines/skill-learner.js +32 -15
  74. package/dist/engines/skill-learner.js.map +1 -1
  75. package/dist/engines/skill-runtime.d.ts +18 -0
  76. package/dist/engines/skill-runtime.d.ts.map +1 -1
  77. package/dist/engines/skill-runtime.js +34 -4
  78. package/dist/engines/skill-runtime.js.map +1 -1
  79. package/dist/engines/telemetry-remote.d.ts +2 -2
  80. package/dist/engines/telemetry-remote.d.ts.map +1 -1
  81. package/dist/engines/telemetry-remote.js +1 -0
  82. package/dist/engines/telemetry-remote.js.map +1 -1
  83. package/dist/index.d.ts +23 -0
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +54 -2
  86. package/dist/index.js.map +1 -1
  87. package/dist/phantom/runtime.d.ts +19 -2
  88. package/dist/phantom/runtime.d.ts.map +1 -1
  89. package/dist/phantom/runtime.js +90 -2
  90. package/dist/phantom/runtime.js.map +1 -1
  91. package/dist/synapse/approvals/gate.d.ts +7 -2
  92. package/dist/synapse/approvals/gate.d.ts.map +1 -1
  93. package/dist/synapse/approvals/gate.js +18 -7
  94. package/dist/synapse/approvals/gate.js.map +1 -1
  95. package/dist/synapse/budgets/enforcer.d.ts.map +1 -1
  96. package/dist/synapse/budgets/enforcer.js +4 -0
  97. package/dist/synapse/budgets/enforcer.js.map +1 -1
  98. package/dist/synapse/db/schema.d.ts +1 -1
  99. package/dist/synapse/db/schema.d.ts.map +1 -1
  100. package/dist/synapse/db/schema.js +57 -0
  101. package/dist/synapse/db/schema.js.map +1 -1
  102. package/dist/synapse/mandate/pipeline.d.ts.map +1 -1
  103. package/dist/synapse/mandate/pipeline.js +8 -2
  104. package/dist/synapse/mandate/pipeline.js.map +1 -1
  105. package/dist/synapse/mcp-tools.d.ts +23 -0
  106. package/dist/synapse/mcp-tools.d.ts.map +1 -1
  107. package/dist/synapse/mcp-tools.js +4 -0
  108. package/dist/synapse/mcp-tools.js.map +1 -1
  109. package/dist/synapse/missions/crud.d.ts.map +1 -1
  110. package/dist/synapse/missions/crud.js +29 -4
  111. package/dist/synapse/missions/crud.js.map +1 -1
  112. package/dist/synapse/operatives/crud.d.ts.map +1 -1
  113. package/dist/synapse/operatives/crud.js +15 -4
  114. package/dist/synapse/operatives/crud.js.map +1 -1
  115. package/dist/synapse/sorties/runner.d.ts.map +1 -1
  116. package/dist/synapse/sorties/runner.js +5 -2
  117. package/dist/synapse/sorties/runner.js.map +1 -1
  118. package/dist/synapse/types.d.ts +13 -0
  119. package/dist/synapse/types.d.ts.map +1 -1
  120. package/dist/utils/env-defaults.d.ts +2 -0
  121. package/dist/utils/env-defaults.d.ts.map +1 -0
  122. package/dist/utils/env-defaults.js +13 -0
  123. package/dist/utils/env-defaults.js.map +1 -0
  124. package/package.json +2 -2
package/README.md CHANGED
@@ -114,6 +114,8 @@ nexus_session_bootstrap(goal="<task>", files=[...])
114
114
  nexus_orchestrate(prompt="<raw user request>")
115
115
  ```
116
116
 
117
+ These are Nexus Prime MCP tool invocations, not shell commands.
118
+
117
119
  Use `nexus_plan_execution` only when you explicitly want the ledger before mutation. Let Nexus choose crews, specialists, skills, workflows, hooks, automations, worker count, and token strategy unless you need hard constraints.
118
120
 
119
121
  ## Core Capabilities
@@ -628,6 +630,18 @@ Inventory Snapshot: 109 skills · 64 workflows · 9 hooks · 5 automations · 7
628
630
  ## 📜 Release History
629
631
 
630
632
  <details open>
633
+ <summary><b>v4.8.0</b> · 2026-03-31 · Seamless Intelligence Upgrade — smarter runtime routing, durable memory controls, and governed work graphs</summary>
634
+
635
+ - **Bootstrap truth for Codex and MCP clients**: Managed docs and bootstrap detection now describe `nexus_session_bootstrap` and `nexus_orchestrate` as MCP tool invocations, not shell commands.
636
+ - **Runtime intelligence surfaces**: Scheduled automations, execution presets, session search, and governed skill distribution/promotion now extend the operator control plane.
637
+ - **Durable control-plane governance**: Work claims, scoped approvals, and scoped budgets now preserve ancestry and lease semantics across missions and operatives.
638
+ - **Memory control upgrades**: Actor-scoped memory CRUD, history, feedback, and retention hints now complement the existing project-aware memory engine.
639
+ - **Channel ingress contract**: Slack, Telegram, and Feishu/Lark mappings now have a normalized gateway surface for thread identity, artifacts, and status exchange.
640
+
641
+ Full notes: [releases/v4.8.0.md](./releases/v4.8.0.md) · Full history: [CHANGELOG.md](./CHANGELOG.md)
642
+ </details>
643
+
644
+ <details>
631
645
  <summary><b>v4.7.2</b> · 2026-03-31 · Runtime Efficiency — CPU optimization, middleware hardening, and skill sharing</summary>
632
646
 
633
647
  - **~80% idle CPU reduction**: Polling intervals across 6 subsystems reduced from aggressive (2-60s) to relaxed (30-300s). Memory maintenance, event bus, and pod network no longer burn cycles when idle.
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/agents/adapters/mcp.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAsF5C,KAAK,cAAc,GAAG,YAAY,GAAG,MAAM,CAAC;AAE5C,KAAK,iBAAiB,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC,CAAC;AA2TF,qBAAa,UAAW,YAAW,OAAO;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAG,KAAK,CAAU;IACtB,SAAS,UAAS;IAClB,MAAM,EAAE,MAAM,EAAE,CAAM;IAEtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,SAAS,CAA4C;IAC7D,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,OAAO,CAAC,CAAkB;IAClC,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,oBAAoB,CAAgG;IAC5H,OAAO,CAAC,qBAAqB,CAAK;IAClC,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,kBAAkB,CAAqB;IAE/C,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,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AAc,CAAC,OAAO,GAAE,cAAsC,GAAG,iBAAiB,EAAE;IAIpF,OAAO,CAAC,oBAAoB;IAu8B5B,OAAO,CAAC,iBAAiB;YAyGX,cAAc;IAsuE5B,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAItC,OAAO,CAAC,IAAI;IAmBN,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB3B,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlD,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;CAOzC"}
@@ -29,6 +29,7 @@ import { getSharedTelemetry } from '../../engines/telemetry-remote.js';
29
29
  import { getGstackBridge } from '../../engines/gstack-bridge.js';
30
30
  import { getSharedContextDiscovery } from '../../engines/context-discovery.js';
31
31
  import { MiddlewarePipeline } from '../../engines/middleware-pipeline.js';
32
+ import { applyExecutionPreset, listExecutionPresets, resolveExecutionPreset } from '../../engines/execution-presets.js';
32
33
  import { synapseToolDefinitions, handleSynapseToolCall } from '../../synapse/index.js';
33
34
  import { architectsToolDefinitions, handleArchitectsToolCall } from '../../architects/index.js';
34
35
  const tokenEngine = new TokenSupremacyEngine();
@@ -410,13 +411,26 @@ export class MCPAdapter {
410
411
  console.error(`\x1b[36m╚${'═'.repeat(width - 2)}╝\x1b[0m\n`);
411
412
  }
412
413
  classifyToolCategory(toolName) {
413
- if (['nexus_store_memory', 'nexus_recall_memory', 'nexus_memory_stats'].includes(toolName))
414
+ if ([
415
+ 'nexus_store_memory',
416
+ 'nexus_recall_memory',
417
+ 'nexus_memory_stats',
418
+ 'nexus_memory_trace',
419
+ 'nexus_memory_export',
420
+ 'nexus_memory_backup',
421
+ 'nexus_memory_import',
422
+ 'nexus_memory_maintain',
423
+ 'nexus_memory_update',
424
+ 'nexus_memory_delete',
425
+ 'nexus_memory_history',
426
+ 'nexus_memory_feedback',
427
+ ].includes(toolName))
414
428
  return 'memory';
415
429
  if (['nexus_orchestrate', 'nexus_plan_execution', 'nexus_spawn_workers'].includes(toolName))
416
430
  return 'orchestration';
417
431
  if (['nexus_ghost_pass', 'nexus_mindkit_check', 'nexus_optimize_tokens'].includes(toolName))
418
432
  return 'execution';
419
- if (['nexus_session_bootstrap', 'nexus_session_dna', 'nexus_token_report'].includes(toolName))
433
+ if (['nexus_session_bootstrap', 'nexus_session_dna', 'nexus_session_search', 'nexus_token_report'].includes(toolName))
420
434
  return 'intelligence';
421
435
  if (toolName === 'nexus_run_status' || toolName === 'nexus_federation_status' || toolName.startsWith('nexus_list_'))
422
436
  return 'system';
@@ -968,6 +982,67 @@ export class MCPAdapter {
968
982
  required: ['id'],
969
983
  },
970
984
  },
985
+ {
986
+ name: 'nexus_memory_update',
987
+ description: 'Expert surface: update an existing memory item, including content, tags, scope, state, retention, and actor-scoped provenance.',
988
+ inputSchema: {
989
+ type: 'object',
990
+ properties: {
991
+ id: { type: 'string', description: 'Memory ID to update' },
992
+ content: { type: 'string', description: 'Optional replacement content' },
993
+ priority: { type: 'number', description: 'Optional replacement priority' },
994
+ tags: { type: 'array', items: { type: 'string' }, description: 'Optional replacement tags' },
995
+ scope: { type: 'string', enum: ['session', 'project', 'user', 'promoted', 'shared'], description: 'Optional replacement scope' },
996
+ state: { type: 'string', enum: ['active', 'quarantined', 'scrap', 'expired'], description: 'Optional replacement state' },
997
+ trust: { type: 'number', description: 'Optional replacement trust score' },
998
+ expiresAt: { type: 'number', description: 'Optional replacement expiry timestamp in milliseconds since epoch' },
999
+ retentionHint: { type: 'string', enum: ['default', 'session', 'short', 'standard', 'long', 'forever'], description: 'Optional retention policy hint' },
1000
+ provenance: { type: 'object', description: 'Optional actor scope and provenance overrides' },
1001
+ },
1002
+ required: ['id'],
1003
+ },
1004
+ },
1005
+ {
1006
+ name: 'nexus_memory_delete',
1007
+ description: 'Expert surface: soft-delete or permanently delete a memory item while preserving deletion history.',
1008
+ inputSchema: {
1009
+ type: 'object',
1010
+ properties: {
1011
+ id: { type: 'string', description: 'Memory ID to delete' },
1012
+ hardDelete: { type: 'boolean', description: 'When true, permanently remove the memory row instead of expiring it' },
1013
+ reason: { type: 'string', description: 'Optional deletion reason recorded in memory history' },
1014
+ provenance: { type: 'object', description: 'Optional actor scope and provenance overrides' },
1015
+ },
1016
+ required: ['id'],
1017
+ },
1018
+ },
1019
+ {
1020
+ name: 'nexus_memory_history',
1021
+ description: 'Expert surface: inspect the mutation and feedback history for a memory item.',
1022
+ inputSchema: {
1023
+ type: 'object',
1024
+ properties: {
1025
+ id: { type: 'string', description: 'Memory ID to inspect' },
1026
+ limit: { type: 'number', description: 'Maximum history entries to return (default 20)' },
1027
+ },
1028
+ required: ['id'],
1029
+ },
1030
+ },
1031
+ {
1032
+ name: 'nexus_memory_feedback',
1033
+ description: 'Expert surface: attach explicit operator feedback to a memory item to promote, demote, quarantine, or re-score it.',
1034
+ inputSchema: {
1035
+ type: 'object',
1036
+ properties: {
1037
+ id: { type: 'string', description: 'Memory ID to score' },
1038
+ reaction: { type: 'string', enum: ['positive', 'negative', 'promote', 'demote', 'quarantine'], description: 'Feedback reaction to apply' },
1039
+ rating: { type: 'number', description: 'Optional numeric score from -1 to 1' },
1040
+ note: { type: 'string', description: 'Optional operator note stored in history' },
1041
+ provenance: { type: 'object', description: 'Optional actor scope and provenance overrides' },
1042
+ },
1043
+ required: ['id'],
1044
+ },
1045
+ },
971
1046
  {
972
1047
  name: 'nexus_session_bootstrap',
973
1048
  description: 'Read-only session-start summary. Returns current client identity, memory recall summary, memory stats, recommended next step, recommended execution mode, shortlist recommendations, and whether token optimization will be required.',
@@ -996,7 +1071,8 @@ export class MCPAdapter {
996
1071
  automations: { type: 'array', items: { type: 'string' }, description: 'Optional hard automation selectors' },
997
1072
  crews: { type: 'array', items: { type: 'string' }, description: 'Optional hard crew selectors' },
998
1073
  specialists: { type: 'array', items: { type: 'string' }, description: 'Optional hard specialist selectors' },
999
- optimizationProfile: { type: 'string', enum: ['standard', 'max'], description: 'Planner optimization profile override' }
1074
+ optimizationProfile: { type: 'string', enum: ['standard', 'max'], description: 'Planner optimization profile override' },
1075
+ executionPreset: { type: 'string', enum: ['fast', 'balanced', 'deep', 'release'], description: 'Optional execution preset that maps orchestration depth, verification strictness, and backend routing' }
1000
1076
  },
1001
1077
  required: ['prompt'],
1002
1078
  },
@@ -1102,6 +1178,7 @@ export class MCPAdapter {
1102
1178
  dslCompiler: { type: 'string', description: 'DSL compiler selector' },
1103
1179
  backendMode: { type: 'string', enum: ['default', 'shadow', 'experimental'], description: 'Backend execution mode' },
1104
1180
  optimizationProfile: { type: 'string', enum: ['standard', 'max'], description: 'Planner optimization profile' },
1181
+ executionPreset: { type: 'string', enum: ['fast', 'balanced', 'deep', 'release'], description: 'Optional execution preset for cheap, balanced, deep, or release-grade runs' },
1105
1182
  },
1106
1183
  required: ['goal', 'files'],
1107
1184
  },
@@ -1118,11 +1195,17 @@ export class MCPAdapter {
1118
1195
  workflows: { type: 'array', items: { type: 'string' }, description: 'Optional workflow selectors' },
1119
1196
  crews: { type: 'array', items: { type: 'string' }, description: 'Optional crew selectors' },
1120
1197
  specialists: { type: 'array', items: { type: 'string' }, description: 'Optional specialist selectors' },
1121
- optimizationProfile: { type: 'string', enum: ['standard', 'max'], description: 'Planner optimization profile' }
1198
+ optimizationProfile: { type: 'string', enum: ['standard', 'max'], description: 'Planner optimization profile' },
1199
+ executionPreset: { type: 'string', enum: ['fast', 'balanced', 'deep', 'release'], description: 'Optional execution preset for cheap, balanced, deep, or release-grade planning' }
1122
1200
  },
1123
1201
  required: ['goal'],
1124
1202
  },
1125
1203
  },
1204
+ {
1205
+ name: 'nexus_list_execution_presets',
1206
+ description: 'List the execution presets that map user intent onto runtime depth, verification strictness, and backend selection.',
1207
+ inputSchema: { type: 'object', properties: {}, required: [] },
1208
+ },
1126
1209
  {
1127
1210
  name: 'nexus_audit_evolution',
1128
1211
  description: 'Identify recurring failure patterns, file hotspots, and code areas needing refactoring. Call at sprint boundaries, after major bug fixes, or when the same files keep breaking. Returns prioritized recommendations.',
@@ -1156,6 +1239,58 @@ export class MCPAdapter {
1156
1239
  required: ['action'],
1157
1240
  },
1158
1241
  },
1242
+ {
1243
+ name: 'nexus_session_search',
1244
+ description: 'Search prior Session DNA snapshots without promoting transcripts into long-term memory.',
1245
+ inputSchema: {
1246
+ type: 'object',
1247
+ properties: {
1248
+ query: { type: 'string', description: 'Terms to search across prior session snapshots' },
1249
+ limit: { type: 'number', description: 'Maximum hits to return (default 5)' },
1250
+ minScore: { type: 'number', description: 'Minimum deterministic score threshold' },
1251
+ sessionsDir: { type: 'string', description: 'Optional alternate sessions directory' },
1252
+ },
1253
+ required: ['query'],
1254
+ },
1255
+ },
1256
+ {
1257
+ name: 'nexus_channel_map_thread',
1258
+ description: 'Map an inbound Slack, Telegram, or Feishu/Lark thread onto a Nexus session or mission while preserving external thread identity.',
1259
+ inputSchema: {
1260
+ type: 'object',
1261
+ properties: {
1262
+ provider: { type: 'string', enum: ['slack', 'telegram', 'feishu', 'lark', 'feishu-lark'], description: 'Channel provider' },
1263
+ conversationId: { type: 'string', description: 'Provider-native conversation or channel identifier' },
1264
+ threadId: { type: 'string', description: 'Provider-native thread identifier' },
1265
+ messageId: { type: 'string', description: 'Provider-native message identifier' },
1266
+ parentMessageId: { type: 'string', description: 'Optional parent message identifier' },
1267
+ workspaceId: { type: 'string', description: 'Optional workspace or tenant identifier' },
1268
+ targetKind: { type: 'string', enum: ['session', 'mission'], description: 'Nexus target type' },
1269
+ targetId: { type: 'string', description: 'Nexus session or mission identifier' },
1270
+ sourceUrl: { type: 'string', description: 'Optional canonical source URL' },
1271
+ },
1272
+ required: ['provider', 'conversationId', 'targetKind', 'targetId'],
1273
+ },
1274
+ },
1275
+ {
1276
+ name: 'nexus_channel_artifact_envelope',
1277
+ description: 'Wrap a Nexus artifact for delivery back to Slack, Telegram, or Feishu/Lark with preserved thread metadata and attachments.',
1278
+ inputSchema: {
1279
+ type: 'object',
1280
+ properties: {
1281
+ provider: { type: 'string', enum: ['slack', 'telegram', 'feishu', 'lark', 'feishu-lark'], description: 'Channel provider' },
1282
+ thread: { type: 'object', description: 'Channel thread mapping object returned by nexus_channel_map_thread' },
1283
+ artifactType: { type: 'string', description: 'Artifact category such as session-summary or mission-status' },
1284
+ artifactId: { type: 'string', description: 'Optional artifact identifier' },
1285
+ title: { type: 'string', description: 'Artifact title' },
1286
+ summary: { type: 'string', description: 'Artifact summary' },
1287
+ body: { type: 'string', description: 'Optional artifact body' },
1288
+ attachments: { type: 'array', items: { type: 'object' }, description: 'Optional attachment descriptors' },
1289
+ metadata: { type: 'object', description: 'Optional metadata payload' },
1290
+ },
1291
+ required: ['provider', 'thread', 'artifactType', 'title', 'summary'],
1292
+ },
1293
+ },
1159
1294
  // ── HyperTune Max ─────────────────────────────────────────────────
1160
1295
  {
1161
1296
  name: 'nexus_hypertune_max',
@@ -1980,8 +2115,12 @@ export class MCPAdapter {
1980
2115
  const optimizationProfile = request.params.arguments?.optimizationProfile
1981
2116
  ? String(request.params.arguments.optimizationProfile)
1982
2117
  : undefined;
2118
+ const executionPreset = request.params.arguments?.executionPreset
2119
+ ? String(request.params.arguments.executionPreset)
2120
+ : undefined;
1983
2121
  try {
1984
- const execution = await this.nexusRef.orchestrate(prompt, {
2122
+ const preset = resolveExecutionPreset(executionPreset);
2123
+ const execution = await this.nexusRef.orchestrate(prompt, applyExecutionPreset({
1985
2124
  files,
1986
2125
  workers,
1987
2126
  skillNames: skills,
@@ -1991,7 +2130,7 @@ export class MCPAdapter {
1991
2130
  crewSelectors: crews,
1992
2131
  specialistSelectors: specialists,
1993
2132
  optimizationProfile,
1994
- });
2133
+ }, executionPreset));
1995
2134
  const verifiedWorkers = execution.workerResults.filter((worker) => worker.verified).length;
1996
2135
  const tokenPlan = execution?.knowledgeFabric?.repo?.readingPlan;
1997
2136
  const canAutoApplyTokenPlan = Boolean(tokenPlan
@@ -2053,6 +2192,7 @@ export class MCPAdapter {
2053
2192
  tokens: execution.tokenTelemetry,
2054
2193
  verifiedWorkers,
2055
2194
  continuationChildren: execution.continuationChildren,
2195
+ executionPreset: preset ? { id: preset.id, name: preset.name, summary: preset.summary } : undefined,
2056
2196
  autoTokenApplyNote,
2057
2197
  };
2058
2198
  return {
@@ -2068,6 +2208,7 @@ export class MCPAdapter {
2068
2208
  `Assets: ${(execution.activeSkills || []).length} skills · ${(execution.activeWorkflows || []).length} workflows · ${(runtimeUsage.artifactSelectionAudit?.selected?.length || 0)} audited selections`,
2069
2209
  `Task graph: ${runtimeUsage.taskGraph?.phases?.length || execution.taskGraph?.phases?.length || 0} phases · ${runtimeUsage.workerPlan?.totalWorkers || execution.workerPlan?.totalWorkers || 0} worker lanes`,
2070
2210
  `Catalog health: ${runtimeUsage.catalogHealth?.overall || 'unknown'}`,
2211
+ preset ? `Preset: ${preset.name} (${preset.id})` : null,
2071
2212
  `Verification: ${verifiedWorkers}/${execution.workerResults.length} worker(s) verified`,
2072
2213
  `Worktrees: ${runtimeUsage.worktreeHealth?.overall || 'unknown'} · repaired ${runtimeUsage.worktreeHealth?.repairedEntries || 0} · broken ${runtimeUsage.worktreeHealth?.brokenEntries || 0}`,
2073
2214
  `Tokens: saved ${Number(execution.tokenTelemetry?.savedTokens || 0).toLocaleString()} · compression ${Number(execution.tokenTelemetry?.compressionPct || 0)}% · dominant ${runtimeUsage.sourceAwareTokenBudget?.dominantSource || execution.knowledgeFabric?.sourceMix?.dominantSource || 'repo'}`,
@@ -2364,6 +2505,105 @@ export class MCPAdapter {
2364
2505
  }],
2365
2506
  };
2366
2507
  }
2508
+ case 'nexus_memory_update': {
2509
+ const id = String(request.params.arguments?.id ?? '');
2510
+ const result = this.nexusRef.updateMemory(id, {
2511
+ content: request.params.arguments?.content == null ? undefined : String(request.params.arguments.content),
2512
+ priority: request.params.arguments?.priority == null ? undefined : Number(request.params.arguments.priority),
2513
+ tags: Array.isArray(request.params.arguments?.tags)
2514
+ ? request.params.arguments.tags.map(String)
2515
+ : undefined,
2516
+ scope: request.params.arguments?.scope ? String(request.params.arguments.scope) : undefined,
2517
+ state: request.params.arguments?.state ? String(request.params.arguments.state) : undefined,
2518
+ trust: request.params.arguments?.trust == null ? undefined : Number(request.params.arguments.trust),
2519
+ expiresAt: request.params.arguments?.expiresAt == null ? undefined : Number(request.params.arguments.expiresAt),
2520
+ retentionHint: request.params.arguments?.retentionHint ? String(request.params.arguments.retentionHint) : undefined,
2521
+ provenance: request.params.arguments?.provenance,
2522
+ });
2523
+ return {
2524
+ content: [{
2525
+ type: 'text',
2526
+ text: [
2527
+ result.updated ? 'Memory updated.' : `Memory update skipped for ${id}.`,
2528
+ result.updated
2529
+ ? formatBullets([
2530
+ `ID: ${result.item?.id || id}`,
2531
+ `Scope: ${result.item?.scope || 'n/a'} · state ${result.item?.state || 'n/a'}`,
2532
+ `History event: ${result.historyEntry?.eventType || 'updated'}`,
2533
+ ])
2534
+ : null,
2535
+ formatJsonDetails('Structured details', result ?? {}),
2536
+ ].filter(Boolean).join('\n\n'),
2537
+ }],
2538
+ };
2539
+ }
2540
+ case 'nexus_memory_delete': {
2541
+ const id = String(request.params.arguments?.id ?? '');
2542
+ const result = this.nexusRef.deleteMemory(id, {
2543
+ hardDelete: Boolean(request.params.arguments?.hardDelete),
2544
+ reason: request.params.arguments?.reason ? String(request.params.arguments.reason) : undefined,
2545
+ provenance: request.params.arguments?.provenance,
2546
+ });
2547
+ return {
2548
+ content: [{
2549
+ type: 'text',
2550
+ text: [
2551
+ result.deleted ? 'Memory deleted.' : `Memory delete skipped for ${id}.`,
2552
+ result.deleted
2553
+ ? formatBullets([
2554
+ `ID: ${result.item?.id || id}`,
2555
+ `Mode: ${result.hardDelete ? 'hard delete' : 'soft delete'}`,
2556
+ `History event: ${result.historyEntry?.eventType || 'deleted'}`,
2557
+ ])
2558
+ : null,
2559
+ formatJsonDetails('Structured details', result ?? {}),
2560
+ ].filter(Boolean).join('\n\n'),
2561
+ }],
2562
+ };
2563
+ }
2564
+ case 'nexus_memory_history': {
2565
+ const id = String(request.params.arguments?.id ?? '');
2566
+ const limit = Number(request.params.arguments?.limit ?? 20);
2567
+ const result = this.nexusRef.getMemoryHistory(id, limit);
2568
+ return {
2569
+ content: [{
2570
+ type: 'text',
2571
+ text: [
2572
+ `Memory history ready for ${id}.`,
2573
+ formatBullets([
2574
+ `Entries: ${result.length}`,
2575
+ `Latest event: ${result[0]?.eventType || 'none'}`,
2576
+ ]),
2577
+ formatJsonDetails('Structured details', result),
2578
+ ].join('\n\n'),
2579
+ }],
2580
+ };
2581
+ }
2582
+ case 'nexus_memory_feedback': {
2583
+ const id = String(request.params.arguments?.id ?? '');
2584
+ const result = this.nexusRef.submitMemoryFeedback(id, {
2585
+ reaction: request.params.arguments?.reaction ? String(request.params.arguments.reaction) : undefined,
2586
+ rating: request.params.arguments?.rating == null ? undefined : Number(request.params.arguments.rating),
2587
+ note: request.params.arguments?.note ? String(request.params.arguments.note) : undefined,
2588
+ provenance: request.params.arguments?.provenance,
2589
+ });
2590
+ return {
2591
+ content: [{
2592
+ type: 'text',
2593
+ text: [
2594
+ result.accepted ? 'Memory feedback recorded.' : `Memory feedback skipped for ${id}.`,
2595
+ result.accepted
2596
+ ? formatBullets([
2597
+ `ID: ${result.item?.id || id}`,
2598
+ `Priority: ${Number(result.priority ?? 0).toFixed(2)}`,
2599
+ `Trust: ${Number(result.trust ?? 0).toFixed(2)}`,
2600
+ ])
2601
+ : null,
2602
+ formatJsonDetails('Structured details', result ?? {}),
2603
+ ].filter(Boolean).join('\n\n'),
2604
+ }],
2605
+ };
2606
+ }
2367
2607
  case 'nexus_describe_tool': {
2368
2608
  const requestedTool = String(request.params.arguments?.tool_name ?? '');
2369
2609
  if (!requestedTool) {
@@ -2562,7 +2802,11 @@ export class MCPAdapter {
2562
2802
  const optimizationProfile = request.params.arguments?.optimizationProfile
2563
2803
  ? String(request.params.arguments.optimizationProfile)
2564
2804
  : undefined;
2565
- const execution = await this.getRuntime().run({
2805
+ const executionPreset = request.params.arguments?.executionPreset
2806
+ ? String(request.params.arguments.executionPreset)
2807
+ : undefined;
2808
+ const preset = resolveExecutionPreset(executionPreset);
2809
+ const execution = await this.getRuntime().run(applyExecutionPreset({
2566
2810
  goal,
2567
2811
  files: rawFiles,
2568
2812
  workers: workersCount,
@@ -2579,7 +2823,7 @@ export class MCPAdapter {
2579
2823
  optimizationProfile,
2580
2824
  executionMode: 'manual-low-level',
2581
2825
  manualOverrides: ['nexus_spawn_workers'],
2582
- });
2826
+ }, executionPreset));
2583
2827
  const verifiedWorkers = execution.workerResults.filter(result => result.verified).length;
2584
2828
  const modifiedFiles = execution.workerResults.reduce((sum, result) => sum + result.modifiedFiles.length, 0);
2585
2829
  execution.activeSkills.forEach(skill => {
@@ -2603,6 +2847,7 @@ export class MCPAdapter {
2603
2847
  this.box('🐝 PHANTOM RUNTIME', [
2604
2848
  `Run: ${execution.runId.padEnd(28, ' ')} State: ${execution.state.padEnd(18, ' ')}`,
2605
2849
  `Workers: ${execution.workerResults.length.toString().padEnd(5, ' ')} Verified: ${verifiedWorkers.toString().padEnd(10, ' ')} Files: ${String(modifiedFiles).padEnd(12, ' ')}`,
2850
+ `${`Preset: ${preset?.name ?? 'manual'}`.padEnd(61, ' ')}`,
2606
2851
  `Decision: ${(execution.finalDecision?.action ?? 'none').padEnd(52, ' ')}`
2607
2852
  ], execution.state === 'merged' ? '32' : execution.state === 'rolled_back' ? '33' : '31');
2608
2853
  return {
@@ -2615,6 +2860,7 @@ export class MCPAdapter {
2615
2860
  `State: ${execution.state}`,
2616
2861
  `Artifacts: ${execution.artifactsPath}`,
2617
2862
  `Workers: ${execution.workerResults.length}`,
2863
+ preset ? `Preset: ${preset.name} (${preset.id})` : null,
2618
2864
  `Verified Workers: ${verifiedWorkers}`,
2619
2865
  `Modified Files: ${modifiedFiles}`,
2620
2866
  `Decision: ${execution.finalDecision?.action ?? 'none'}`,
@@ -2824,6 +3070,92 @@ export class MCPAdapter {
2824
3070
  };
2825
3071
  }
2826
3072
  }
3073
+ case 'nexus_session_search': {
3074
+ const query = String(request.params.arguments?.query ?? '');
3075
+ const result = this.nexusRef.searchSessionHistory(query, {
3076
+ limit: request.params.arguments?.limit == null ? undefined : Number(request.params.arguments.limit),
3077
+ minScore: request.params.arguments?.minScore == null ? undefined : Number(request.params.arguments.minScore),
3078
+ sessionsDir: request.params.arguments?.sessionsDir ? String(request.params.arguments.sessionsDir) : undefined,
3079
+ });
3080
+ return {
3081
+ content: [{
3082
+ type: 'text',
3083
+ text: [
3084
+ `Session search ready for "${query}".`,
3085
+ formatBullets([
3086
+ `Hits: ${result.length}`,
3087
+ `Top session: ${result[0]?.session.sessionId || 'none'}`,
3088
+ ]),
3089
+ formatJsonDetails('Structured details', result),
3090
+ ].join('\n\n'),
3091
+ }],
3092
+ };
3093
+ }
3094
+ case 'nexus_channel_map_thread': {
3095
+ const result = this.nexusRef.mapChannelThread({
3096
+ provider: String(request.params.arguments?.provider ?? ''),
3097
+ conversationId: String(request.params.arguments?.conversationId ?? ''),
3098
+ threadId: request.params.arguments?.threadId ? String(request.params.arguments.threadId) : undefined,
3099
+ messageId: request.params.arguments?.messageId ? String(request.params.arguments.messageId) : undefined,
3100
+ parentMessageId: request.params.arguments?.parentMessageId ? String(request.params.arguments.parentMessageId) : undefined,
3101
+ workspaceId: request.params.arguments?.workspaceId ? String(request.params.arguments.workspaceId) : undefined,
3102
+ target: {
3103
+ kind: String(request.params.arguments?.targetKind ?? 'session'),
3104
+ id: String(request.params.arguments?.targetId ?? ''),
3105
+ },
3106
+ sourceUrl: request.params.arguments?.sourceUrl ? String(request.params.arguments.sourceUrl) : undefined,
3107
+ });
3108
+ return {
3109
+ content: [{
3110
+ type: 'text',
3111
+ text: [
3112
+ 'Channel thread mapped.',
3113
+ formatBullets([
3114
+ `Provider: ${result.provider}`,
3115
+ `Target: ${result.target.kind}:${result.target.id}`,
3116
+ `Thread key: ${result.threadKey}`,
3117
+ ]),
3118
+ formatJsonDetails('Structured details', result),
3119
+ ].join('\n\n'),
3120
+ }],
3121
+ };
3122
+ }
3123
+ case 'nexus_channel_artifact_envelope': {
3124
+ const result = this.nexusRef.createChannelArtifactEnvelope({
3125
+ provider: String(request.params.arguments?.provider ?? ''),
3126
+ thread: request.params.arguments?.thread,
3127
+ artifactType: String(request.params.arguments?.artifactType ?? ''),
3128
+ artifactId: request.params.arguments?.artifactId ? String(request.params.arguments.artifactId) : undefined,
3129
+ title: String(request.params.arguments?.title ?? ''),
3130
+ summary: String(request.params.arguments?.summary ?? ''),
3131
+ body: request.params.arguments?.body ? String(request.params.arguments.body) : undefined,
3132
+ attachments: Array.isArray(request.params.arguments?.attachments)
3133
+ ? request.params.arguments.attachments.map((attachment) => ({
3134
+ name: String(attachment.name ?? ''),
3135
+ kind: String(attachment.kind ?? 'file'),
3136
+ content: attachment.content == null ? undefined : String(attachment.content),
3137
+ path: attachment.path == null ? undefined : String(attachment.path),
3138
+ mimeType: attachment.mimeType == null ? undefined : String(attachment.mimeType),
3139
+ sizeBytes: attachment.sizeBytes == null ? undefined : Number(attachment.sizeBytes),
3140
+ }))
3141
+ : undefined,
3142
+ metadata: request.params.arguments?.metadata,
3143
+ });
3144
+ return {
3145
+ content: [{
3146
+ type: 'text',
3147
+ text: [
3148
+ 'Channel artifact envelope ready.',
3149
+ formatBullets([
3150
+ `Provider: ${result.provider}`,
3151
+ `Artifact: ${result.artifactType}`,
3152
+ `Attachments: ${result.attachments.length}`,
3153
+ ]),
3154
+ formatJsonDetails('Structured details', result),
3155
+ ].join('\n\n'),
3156
+ }],
3157
+ };
3158
+ }
2827
3159
  case 'nexus_skill_register': {
2828
3160
  const graphEngine = getGraphEngine();
2829
3161
  const registry = new SkillCardRegistry(graphEngine);
@@ -3094,7 +3426,11 @@ export class MCPAdapter {
3094
3426
  const optimizationProfile = request.params.arguments?.optimizationProfile
3095
3427
  ? String(request.params.arguments.optimizationProfile)
3096
3428
  : undefined;
3097
- const planner = await this.getRuntime().planExecution({
3429
+ const executionPreset = request.params.arguments?.executionPreset
3430
+ ? String(request.params.arguments.executionPreset)
3431
+ : undefined;
3432
+ const preset = resolveExecutionPreset(executionPreset);
3433
+ const planner = await this.getRuntime().planExecution(applyExecutionPreset({
3098
3434
  goal,
3099
3435
  files,
3100
3436
  skillNames: skills,
@@ -3102,13 +3438,14 @@ export class MCPAdapter {
3102
3438
  crewSelectors: crews,
3103
3439
  specialistSelectors: specialists,
3104
3440
  optimizationProfile,
3105
- });
3441
+ }, executionPreset));
3106
3442
  return {
3107
3443
  content: [{
3108
3444
  type: 'text',
3109
3445
  text: [
3110
3446
  `🧭 Execution Plan — ${planner.objective}`,
3111
3447
  '',
3448
+ preset ? `Preset: ${preset.name} (${preset.id})` : 'Preset: manual',
3112
3449
  `Crew: ${planner.selectedCrew.name} (${planner.selectedCrew.confidence.score.toFixed(2)})`,
3113
3450
  `Specialists: ${planner.selectedSpecialists.length > 0 ? planner.selectedSpecialists.map((specialist) => `${specialist.name}(${specialist.authority})`).join(', ') : 'none'}`,
3114
3451
  `Skills: ${planner.selectedSkills.length > 0 ? planner.selectedSkills.join(', ') : 'none'}`,
@@ -3124,6 +3461,19 @@ export class MCPAdapter {
3124
3461
  }],
3125
3462
  };
3126
3463
  }
3464
+ case 'nexus_list_execution_presets': {
3465
+ const presets = listExecutionPresets();
3466
+ return {
3467
+ content: [{
3468
+ type: 'text',
3469
+ text: [
3470
+ 'Execution presets ready.',
3471
+ formatBullets(presets.map((preset) => `${preset.id}: ${preset.summary}`)),
3472
+ formatJsonDetails('Structured details', presets),
3473
+ ].join('\n\n'),
3474
+ }],
3475
+ };
3476
+ }
3127
3477
  case 'nexus_list_skills': {
3128
3478
  const skills = this.getRuntime().listSkills();
3129
3479
  return {