@getmarrow/mcp 3.9.101 → 3.9.103

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 (127) hide show
  1. package/README.md +63 -29
  2. package/dist/cli.js +64 -1005
  3. package/dist/cli.js.map +1 -1
  4. package/dist/codex-plugin-pins.d.ts +19 -0
  5. package/dist/codex-plugin-pins.d.ts.map +1 -0
  6. package/dist/codex-plugin-pins.js +43 -0
  7. package/dist/codex-plugin-pins.js.map +1 -0
  8. package/dist/codex-plugins.d.ts +34 -0
  9. package/dist/codex-plugins.d.ts.map +1 -0
  10. package/dist/codex-plugins.js +240 -0
  11. package/dist/codex-plugins.js.map +1 -0
  12. package/dist/env.d.ts +2 -0
  13. package/dist/env.d.ts.map +1 -1
  14. package/dist/env.js +229 -39
  15. package/dist/env.js.map +1 -1
  16. package/dist/hook-contract.d.ts +41 -3
  17. package/dist/hook-contract.d.ts.map +1 -1
  18. package/dist/hook-contract.js +126 -18
  19. package/dist/hook-contract.js.map +1 -1
  20. package/dist/hook-pre-action.d.ts +48 -2
  21. package/dist/hook-pre-action.d.ts.map +1 -1
  22. package/dist/hook-pre-action.js +199 -23
  23. package/dist/hook-pre-action.js.map +1 -1
  24. package/dist/hook-tool-policy.d.ts +3 -3
  25. package/dist/hook-tool-policy.d.ts.map +1 -1
  26. package/dist/hook-tool-policy.js +6 -22
  27. package/dist/hook-tool-policy.js.map +1 -1
  28. package/dist/hook.d.ts +2 -2
  29. package/dist/hook.d.ts.map +1 -1
  30. package/dist/hook.js +13 -6
  31. package/dist/hook.js.map +1 -1
  32. package/dist/host-approval-state.d.ts +9 -0
  33. package/dist/host-approval-state.d.ts.map +1 -1
  34. package/dist/host-approval-state.js +4 -0
  35. package/dist/host-approval-state.js.map +1 -1
  36. package/dist/host-approval.d.ts +6 -0
  37. package/dist/host-approval.d.ts.map +1 -1
  38. package/dist/host-approval.js +3 -1
  39. package/dist/host-approval.js.map +1 -1
  40. package/dist/host-session.d.ts +11 -0
  41. package/dist/host-session.d.ts.map +1 -1
  42. package/dist/host-session.js +49 -0
  43. package/dist/host-session.js.map +1 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +27 -19
  46. package/dist/index.js.map +1 -1
  47. package/dist/normalized-action.d.ts +29 -6
  48. package/dist/normalized-action.d.ts.map +1 -1
  49. package/dist/normalized-action.js +497 -103
  50. package/dist/normalized-action.js.map +1 -1
  51. package/dist/own-server-identity.d.ts +123 -0
  52. package/dist/own-server-identity.d.ts.map +1 -0
  53. package/dist/own-server-identity.js +1052 -0
  54. package/dist/own-server-identity.js.map +1 -0
  55. package/dist/own-tool.d.ts +87 -0
  56. package/dist/own-tool.d.ts.map +1 -0
  57. package/dist/own-tool.js +169 -0
  58. package/dist/own-tool.js.map +1 -0
  59. package/dist/redact.d.ts +23 -0
  60. package/dist/redact.d.ts.map +1 -1
  61. package/dist/redact.js +181 -8
  62. package/dist/redact.js.map +1 -1
  63. package/dist/seatbelt/classifier-pin.d.ts +15 -0
  64. package/dist/seatbelt/classifier-pin.d.ts.map +1 -0
  65. package/dist/seatbelt/classifier-pin.js +26 -0
  66. package/dist/seatbelt/classifier-pin.js.map +1 -0
  67. package/dist/seatbelt/guards.d.ts +10 -0
  68. package/dist/seatbelt/guards.d.ts.map +1 -0
  69. package/dist/seatbelt/guards.js +509 -0
  70. package/dist/seatbelt/guards.js.map +1 -0
  71. package/dist/seatbelt/hook.d.ts +72 -0
  72. package/dist/seatbelt/hook.d.ts.map +1 -0
  73. package/dist/seatbelt/hook.js +362 -0
  74. package/dist/seatbelt/hook.js.map +1 -0
  75. package/dist/seatbelt/longopts.d.ts +68 -0
  76. package/dist/seatbelt/longopts.d.ts.map +1 -0
  77. package/dist/seatbelt/longopts.js +377 -0
  78. package/dist/seatbelt/longopts.js.map +1 -0
  79. package/dist/seatbelt/mapper.d.ts +83 -0
  80. package/dist/seatbelt/mapper.d.ts.map +1 -0
  81. package/dist/seatbelt/mapper.js +10248 -0
  82. package/dist/seatbelt/mapper.js.map +1 -0
  83. package/dist/seatbelt/record.d.ts +94 -0
  84. package/dist/seatbelt/record.d.ts.map +1 -0
  85. package/dist/seatbelt/record.js +776 -0
  86. package/dist/seatbelt/record.js.map +1 -0
  87. package/dist/seatbelt/tables.d.ts +82 -0
  88. package/dist/seatbelt/tables.d.ts.map +1 -0
  89. package/dist/seatbelt/tables.js +359 -0
  90. package/dist/seatbelt/tables.js.map +1 -0
  91. package/dist/seatbelt-deploy.d.ts +100 -0
  92. package/dist/seatbelt-deploy.d.ts.map +1 -0
  93. package/dist/seatbelt-deploy.js +393 -0
  94. package/dist/seatbelt-deploy.js.map +1 -0
  95. package/dist/seatbelt-fs.d.ts +30 -0
  96. package/dist/seatbelt-fs.d.ts.map +1 -0
  97. package/dist/seatbelt-fs.js +94 -0
  98. package/dist/seatbelt-fs.js.map +1 -0
  99. package/dist/seatbelt-git.d.ts +212 -0
  100. package/dist/seatbelt-git.d.ts.map +1 -0
  101. package/dist/seatbelt-git.js +844 -0
  102. package/dist/seatbelt-git.js.map +1 -0
  103. package/dist/seatbelt-mode.d.ts +77 -0
  104. package/dist/seatbelt-mode.d.ts.map +1 -0
  105. package/dist/seatbelt-mode.js +496 -0
  106. package/dist/seatbelt-mode.js.map +1 -0
  107. package/dist/seatbelt-path.d.ts +123 -0
  108. package/dist/seatbelt-path.d.ts.map +1 -0
  109. package/dist/seatbelt-path.js +482 -0
  110. package/dist/seatbelt-path.js.map +1 -0
  111. package/dist/seatbelt-scripts.d.ts +109 -0
  112. package/dist/seatbelt-scripts.d.ts.map +1 -0
  113. package/dist/seatbelt-scripts.js +1060 -0
  114. package/dist/seatbelt-scripts.js.map +1 -0
  115. package/dist/tool-catalog.d.ts +6852 -0
  116. package/dist/tool-catalog.d.ts.map +1 -0
  117. package/dist/tool-catalog.js +999 -0
  118. package/dist/tool-catalog.js.map +1 -0
  119. package/dist/types.d.ts +2 -1
  120. package/dist/types.d.ts.map +1 -1
  121. package/package.json +2 -1
  122. package/server.json +10 -3
  123. package/vendor/classifier/MANIFEST.json +25 -0
  124. package/vendor/classifier/classifier.js +1356 -0
  125. package/vendor/classifier/policy-baseline.js +187 -0
  126. package/vendor/classifier/redact.js +59 -0
  127. package/vendor/classifier/shell-parse.js +455 -0
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const node_crypto_1 = require("node:crypto");
13
- const model_usage_1 = require("./model-usage");
13
+ const tool_catalog_1 = require("./tool-catalog");
14
14
  const index_1 = require("./index");
15
15
  const control_state_1 = require("./control-state");
16
16
  const hook_1 = require("./hook");
@@ -160,6 +160,7 @@ async function runPingCommand() {
160
160
  return;
161
161
  }
162
162
  const baseUrl = (0, index_1.validateBaseUrl)(resolved.baseUrl || 'https://api.getmarrow.ai');
163
+ const endpointHost = (0, env_1.nonDefaultBaseUrlHost)(baseUrl);
163
164
  const controller = new AbortController();
164
165
  const timer = setTimeout(() => controller.abort(), (0, ping_state_1.resolvePingTimeoutMs)(process.env.MARROW_PING_TIMEOUT_MS));
165
166
  timer.unref?.();
@@ -177,6 +178,7 @@ async function runPingCommand() {
177
178
  sample_count: history.sample_count,
178
179
  last_success_at: history.last_success_at,
179
180
  lifecycle_spool: reportLifecycleSpool({ apiKey: resolved.apiKey, baseUrl, agentId: resolved.agentId }),
181
+ ...(endpointHost ? { endpoint_host: endpointHost } : {}),
180
182
  }, null, 2) + '\n');
181
183
  }
182
184
  catch (error) {
@@ -190,6 +192,7 @@ async function runPingCommand() {
190
192
  sample_count: history.sample_count,
191
193
  last_success_at: history.last_success_at,
192
194
  lifecycle_spool: reportLifecycleSpool({ apiKey: resolved.apiKey, baseUrl, agentId: resolved.agentId }),
195
+ ...(endpointHost ? { endpoint_host: endpointHost } : {}),
193
196
  }, null, 2) + '\n');
194
197
  process.exitCode = 1;
195
198
  }
@@ -225,7 +228,7 @@ async function runSpoolCommand(drain) {
225
228
  }
226
229
  const GET_A_KEY_URL = 'https://getmarrow.ai/signup';
227
230
  const ACTIVATE_COMMAND = 'npx -y @getmarrow/install@latest activate';
228
- const ENFORCEMENT_SENTENCE = 'On the 30-day evaluation and Business, deploys and publishes are held in hooks and the governed runner. Team and Free warn. If Marrow is unreachable, hooks let actions run with a warning, and the governed runner stops protected actions it cannot verify. Over MCP, the agent gets the decision and is expected to follow it.';
231
+ const ENFORCEMENT_SENTENCE = 'On the 30-day evaluation and Business, deploys and publishes are held in hooks and the governed runner. Team and Free warn. If Marrow is unreachable, hooks hold high-risk actions and let routine actions run with a warning, and the governed runner stops protected actions it cannot verify. Over MCP, the agent gets the decision and is expected to follow it.';
229
232
  const HELP_TEXT = `Marrow MCP server and hook commands (@getmarrow/mcp)
230
233
 
231
234
  Day one:
@@ -324,6 +327,7 @@ ${MARROW_BLOCK_END}`;
324
327
  fs.writeFileSync(claudeMdPath, marrowInstructions + '\n');
325
328
  process.stdout.write(`Added Marrow instructions to ${claudeMdPath}\n`);
326
329
  }
330
+ const matcherRepair = (0, hook_contract_1.localHookRepairStatus)(process.cwd());
327
331
  const hookInstall = (0, hook_1.installPostToolUseHook)(process.cwd());
328
332
  if (hookInstall.installed) {
329
333
  process.stdout.write('Configured PostToolUse hook. Activity is client-self-reported and does not certify action-result coverage.\n');
@@ -366,6 +370,13 @@ ${MARROW_BLOCK_END}`;
366
370
  else {
367
371
  process.stdout.write(`Grok native hook configuration is present at ${grokHookInstall.settingsPath}. Restart Grok and inspect /hooks before relying on it. Activity remains client-self-reported and does not certify observed coverage.\n`);
368
372
  }
373
+ if (matcherRepair.needs_repair) {
374
+ const events = [...new Set(matcherRepair.stale_matchers.map((entry) => entry.event))].join(', ');
375
+ const repaired = (0, hook_contract_1.localHookRepairStatus)(process.cwd());
376
+ process.stdout.write(repaired.needs_repair
377
+ ? `Marrow ${events} hooks still use an outdated tool matcher that skips some MCP tools. Fix the settings file and run setup again.\n`
378
+ : `Repaired Marrow ${events} hooks that used an outdated tool matcher (it skipped unregistered mcp__marrow__ tools).\n`);
379
+ }
369
380
  process.stdout.write(`Hook settings: ${hookInstall.settingsPath}\n`);
370
381
  process.stdout.write('Configured private local session loop guard for supported native hook events. It becomes active only after host restart/trust review and an actual hook invocation; setup alone does not prove enforcement.\n');
371
382
  process.stdout.write('Offline verification: marrow-mcp loop-guard-self-test (uses isolated temporary state and does not touch the user ledger).\n');
@@ -397,24 +408,54 @@ if (process.argv[2] === 'keys') {
397
408
  const idx = process.argv.findIndex(a => a === `--${name}` || (short ? a === `-${short}` : false));
398
409
  return idx >= 0 ? process.argv[idx + 1] : undefined;
399
410
  };
400
- const getFlagList = (name) => {
401
- const val = getFlag(name);
402
- return val ? val.split(',').map(s => s.trim()) : [];
411
+ // Absent flag: undefined, so the key is left out of the request (the server's default).
412
+ // Present flag: its non-empty parts. Present but empty is a usage error, never "omitted":
413
+ // omitted means full scopes / unrestricted agents. Repeated flags: the first one wins.
414
+ const getFlagList = (name, noun) => {
415
+ const idx = process.argv.findIndex(a => a === `--${name}` || a.startsWith(`--${name}=`));
416
+ if (idx < 0)
417
+ return undefined;
418
+ const arg = process.argv[idx];
419
+ const raw = arg.startsWith(`--${name}=`) ? arg.slice(name.length + 3) : process.argv[idx + 1];
420
+ const parts = (raw ?? '').split(',').map(s => s.replace(/^[ \t\n\f\r]+|[ \t\n\f\r]+$/g, '')).filter(Boolean);
421
+ if (!parts.length) {
422
+ process.stderr.write(`Error: list at least one ${noun}, or omit --${name} for the default\n`);
423
+ process.exit(2);
424
+ }
425
+ return parts;
426
+ };
427
+ // `keys create` single values, the same rule as getFlagList: absent is undefined (the default:
428
+ // live key, no expiry); `--name value`, `--name=value`, `-n value` and `-n=value` are present
429
+ // (the first occurrence wins); present but blank is a usage error (exit 2, nothing sent), never
430
+ // "absent" (an ignored `--expires=` would make a key that never expires). A value is sent as typed.
431
+ const getFlagValue = (name, short) => {
432
+ const forms = [`--${name}`, ...(short ? [`-${short}`] : [])];
433
+ const idx = process.argv.findIndex(a => forms.some(f => a === f || a.startsWith(`${f}=`)));
434
+ if (idx < 0)
435
+ return undefined;
436
+ const arg = process.argv[idx];
437
+ const form = forms.find(f => arg === f || arg.startsWith(`${f}=`));
438
+ const raw = arg === form ? process.argv[idx + 1] : arg.slice(form.length + 1);
439
+ if (!(raw ?? '').replace(/^[ \t\n\f\r]+|[ \t\n\f\r]+$/g, '')) {
440
+ process.stderr.write(`Error: --${name} needs a value, or omit --${name} for the default\n`);
441
+ process.exit(2);
442
+ }
443
+ return raw;
403
444
  };
404
445
  const runCli = async () => {
405
446
  try {
406
447
  if (cmd === 'create') {
407
- const name = getFlag('name', 'n');
448
+ const name = getFlagValue('name', 'n');
408
449
  if (!name) {
409
450
  process.stderr.write('Error: --name required\n');
410
451
  process.exit(1);
411
452
  }
412
453
  const result = await (0, index_1.marrowCreateKey)(API_KEY, 'https://api.getmarrow.ai', {
413
454
  name,
414
- key_type: (getFlag('type', 't') || 'live'),
415
- scopes: getFlagList('scopes'),
416
- agent_ids: getFlagList('agents'),
417
- expires_at: getFlag('expires'),
455
+ key_type: (getFlagValue('type', 't') || 'live'),
456
+ scopes: getFlagList('scopes', 'scope'),
457
+ agent_ids: getFlagList('agents', 'agent'),
458
+ expires_at: getFlagValue('expires'),
418
459
  }, undefined, undefined);
419
460
  process.stdout.write(JSON.stringify({ ...result, warning: formatKeyMaterialWarning() }, null, 2) + '\n');
420
461
  }
@@ -518,6 +559,8 @@ if (process.argv[2] !== 'keys') {
518
559
  // [SECURITY #3] Validate BASE_URL — require HTTPS to prevent SSRF / credential leakage
519
560
  const rawBaseUrl = resolvedEnv.baseUrl || 'https://api.getmarrow.ai';
520
561
  const BASE_URL = (0, index_1.validateBaseUrl)(rawBaseUrl);
562
+ // A non-default endpoint receives every action; name its host wherever status is shown.
563
+ const ENDPOINT_HOST = (0, env_1.nonDefaultBaseUrlHost)(BASE_URL);
521
564
  const SESSION_ID = resolvedEnv.sessionId || undefined;
522
565
  // One identity must bind headers, bodies, queries, cache, and lifecycle events.
523
566
  // resolveMarrowEnv already gives MARROW_FLEET_AGENT_ID precedence over MARROW_AGENT_ID.
@@ -531,6 +574,9 @@ if (process.argv[2] !== 'keys') {
531
574
  process.stderr.write(`Get a key: ${GET_A_KEY_URL}. Day-one steps and commands: npx @getmarrow/mcp --help\n`);
532
575
  process.exit(1);
533
576
  }
577
+ if (ENDPOINT_HOST) {
578
+ process.stderr.write(`[marrow] Using a non-default Marrow endpoint: ${ENDPOINT_HOST} (MARROW_BASE_URL).\n`);
579
+ }
534
580
  // [SECURITY #12] Warn if API key is visible in process args
535
581
  if (cliArgs.apiKey) {
536
582
  process.stderr.write('[marrow] Warning: --key flag exposes API key in process list. Use MARROW_API_KEY env var for production.\n');
@@ -793,6 +839,7 @@ if (process.argv[2] !== 'keys') {
793
839
  legacy_namespaces: spool.other_namespaces?.count || 0,
794
840
  },
795
841
  mcp_tool_profile: mcpToolProfileStatus(payload),
842
+ marrow_endpoint: { host: ENDPOINT_HOST || 'api.getmarrow.ai', non_default: Boolean(ENDPOINT_HOST) },
796
843
  };
797
844
  }
798
845
  // [FIX #9] Runtime validation helper for required string params
@@ -1015,7 +1062,8 @@ if (process.argv[2] !== 'keys') {
1015
1062
  }
1016
1063
  async function marrowRetrieveMemories(apiKey, baseUrl, query, params, sessionId) {
1017
1064
  const qs = new URLSearchParams();
1018
- qs.set('q', query);
1065
+ // The query leaves the process redacted, like every other tool's text.
1066
+ qs.set('q', (0, redact_1.redactSensitiveText)(query));
1019
1067
  if (params?.limit)
1020
1068
  qs.set('limit', String(params.limit));
1021
1069
  if (params?.from)
@@ -1039,995 +1087,6 @@ if (process.argv[2] !== 'keys') {
1039
1087
  const json = await safeMemoryResponse(res);
1040
1088
  return json.data;
1041
1089
  }
1042
- // Tool definitions (unchanged)
1043
- const TOOLS = [
1044
- {
1045
- name: 'marrow_orient',
1046
- description: 'Call at session start or before meaningful work. ' +
1047
- 'Returns authorized prior lessons and failure warnings for the current account or agent. ' +
1048
- 'If shouldPause=true, stop and review the lesson before acting. ' +
1049
- 'Use marrow_agent_runtime for the policy gate before a consequential side effect.',
1050
- inputSchema: {
1051
- type: 'object',
1052
- properties: {
1053
- taskType: {
1054
- type: 'string',
1055
- enum: ['implementation', 'security', 'architecture', 'process', 'general'],
1056
- description: 'Optional: filter warnings to a specific task type you are about to perform',
1057
- },
1058
- autoWarn: {
1059
- type: 'boolean',
1060
- description: 'Enable active intervention: scans recent failures, returns HIGH/MEDIUM/LOW severity warnings with recommendations. Recommended: true.',
1061
- },
1062
- },
1063
- required: [],
1064
- },
1065
- },
1066
- {
1067
- name: 'marrow_think',
1068
- description: 'Record intent and retrieve authorized governance intelligence before acting. ' +
1069
- 'Returns a decision_id for outcome closure plus relevant patterns, prior outcomes, and recommendedNext. ' +
1070
- 'Pass previous_outcome to auto-commit the last decision and open a new one. ' +
1071
- 'Response MAY include: onboarding_hint (new accounts), intelligence.collective (cross-account patterns), intelligence.team_context (recent decisions from other sessions).',
1072
- inputSchema: {
1073
- type: 'object',
1074
- properties: {
1075
- idempotency_key: { type: 'string', description: 'Original privacy-safe pending receipt key when resuming the identical think request.' },
1076
- request_hash: { type: 'string', description: 'Pending receipt request_hash; validates unchanged arguments, credentials, agent and session before resuming.' },
1077
- action: { type: 'string', description: 'What the agent is about to do' },
1078
- type: {
1079
- type: 'string',
1080
- enum: ['implementation', 'security', 'architecture', 'process', 'general'],
1081
- description: 'Type of action (default: general)',
1082
- },
1083
- context: { type: 'object', description: 'Optional metadata about the current situation' },
1084
- previous_decision_id: { type: 'string', description: 'decision_id from previous think() call — auto-commits that session' },
1085
- previous_success: { type: 'boolean', description: 'Did the previous action succeed?' },
1086
- previous_outcome: { type: 'string', description: 'What happened in the previous action (required if previous_decision_id provided)' },
1087
- checkLoop: { type: 'boolean', description: 'Enable loop detection: warns if you are about to retry a failed approach. Recommended: true.' },
1088
- source_kind: {
1089
- type: 'string',
1090
- enum: ['human_directed', 'agent_autonomous', 'scheduled', 'integration', 'system', 'unknown'],
1091
- description: 'Optional provenance source. Defaults to agent_autonomous for MCP calls.',
1092
- },
1093
- human_directed: { type: 'boolean', description: 'True only when the action is directly requested by the owner/user.' },
1094
- instruction_ref: { type: 'string', description: 'Optional privacy-safe opaque reference. Dates, long digit runs, provider IDs, addresses, and domains are rejected locally; valid values are preserved exactly.' },
1095
- source_meta: { type: 'object', description: 'Optional provenance metadata. PII and raw provider IDs are rejected by the API.' },
1096
- },
1097
- required: ['action'],
1098
- },
1099
- },
1100
- {
1101
- name: 'marrow_commit',
1102
- description: 'Close a recorded action with success/failure, a specific outcome, and required proof. ' +
1103
- 'decision_id comes from marrow_think, marrow_auto, or a runtime that actually created a decision. ' +
1104
- 'Use the gate receipt from marrow_agent_runtime for consequential work. ' +
1105
- 'A held action closes trusted only after the server records its approval (the operator in the host\'s own prompt, or the account owner); never write or claim an approval in proof. ' +
1106
- 'The exact non-authorizing outcome_observation_only runtime correlation may submit an observed_unverified result, but is never sent as receipt evidence and never authorizes action or trusted learning. ' +
1107
- 'Only committed:true closes trusted outcome learning.',
1108
- inputSchema: {
1109
- type: 'object',
1110
- properties: {
1111
- decision_id: { type: 'string', description: 'decision_id from marrow_think, marrow_auto, or a runtime that created a decision' },
1112
- success: { type: 'boolean', description: 'Did the action succeed?' },
1113
- outcome: { type: 'string', description: 'What happened — be specific, this trains the hive' },
1114
- caused_by: { type: 'string', description: 'Optional: what caused this action' },
1115
- proof: {
1116
- type: 'object',
1117
- description: 'Optional required proof pack for gated work: summary, checks, outcome, blockers, commits_prs_shas, rollback_target, handoff_result_file, deployment_and_smoke.',
1118
- },
1119
- gate_receipt_id: { type: 'string', description: 'Canonical receipt id from marrow_agent_runtime.runtime_authorization.id for risky work.' },
1120
- arbitration_receipt_id: { type: 'string', description: 'Required for arbitrated work: use marrow_arbitrate.arbitration.receipt_id from the same runtime response.' },
1121
- owner_approval_receipt_id: { type: 'string', description: 'Single-use owner approval receipt that Marrow issued for this hold. Optional for an ordinary held gate receipt (the gate_receipt_id alone finds the recorded approval); required for review_required arbitration. Chat text is not an approval receipt.' },
1122
- action: { type: 'string', description: 'Optional exact original action for post-action observation lookup. This lookup cannot renew execution authority.' },
1123
- target: { type: 'string', description: 'Exact original target, if supplied when the decision was created.' },
1124
- type: { type: 'string', description: 'Exact original action type for observation lookup; defaults to general.' },
1125
- surfaces: { type: 'array', items: { type: 'string' }, description: 'Exact original surfaces for observation lookup; omitted and empty both mean no surfaces.' },
1126
- auto_gate: { type: 'boolean', description: 'If true/default and action is provided, fetch runtime truth bound to this existing decision. Authorizing receipts preserve normal closure; exact outcome_observation_only correlation can submit only an observed_unverified result and is omitted from receipt evidence.' },
1127
- model_usage: { type: 'object', properties: model_usage_1.MODEL_USAGE_EVIDENCE_PROPERTIES, additionalProperties: false, description: 'Optional compact token/cost/latency counts. Do not include raw prompts or completions.' },
1128
- },
1129
- required: ['decision_id', 'success', 'outcome'],
1130
- },
1131
- },
1132
- {
1133
- name: 'marrow_model_usage',
1134
- description: 'Record compact model token usage for value proof. Use when the harness exposes provider/model token counts. Do not send raw prompts, completions, tool logs, secrets, or customer content.',
1135
- inputSchema: {
1136
- type: 'object',
1137
- properties: {
1138
- ...model_usage_1.MODEL_USAGE_EVIDENCE_PROPERTIES,
1139
- provider: { type: 'string', description: 'Model provider, e.g. openai, anthropic, google, xai, qwen, deepseek.' },
1140
- model: { type: 'string', description: 'Model name.' },
1141
- input_tokens: { type: 'number' },
1142
- output_tokens: { type: 'number' },
1143
- cached_tokens: { type: 'number' },
1144
- total_tokens: { type: 'number' },
1145
- cost_usd: { type: 'number' },
1146
- latency_ms: { type: 'number' },
1147
- task_type: { type: 'string' },
1148
- action_type: { type: 'string' },
1149
- marrow_intervention: { type: 'string', description: 'runtime_gate, risk_gate, prior_lesson, proof_pack, before_you_act, fleet_lesson, or other compact reason.' },
1150
- estimated_tokens_saved: { type: 'number' },
1151
- estimated_cost_saved_usd: { type: 'number' },
1152
- estimated_minutes_saved: { type: 'number' },
1153
- decision_id: { type: 'string' },
1154
- workflow_id: { type: 'string' },
1155
- success: { type: 'boolean' },
1156
- },
1157
- required: [],
1158
- },
1159
- },
1160
- {
1161
- name: 'marrow_run',
1162
- description: 'Governed outcome capture. Records intent, obtains a gate for risky work, and closes only with an explicit measured result.',
1163
- inputSchema: {
1164
- type: 'object',
1165
- properties: {
1166
- description: { type: 'string', description: 'What the agent did' },
1167
- success: { type: 'boolean', description: 'Whether it succeeded' },
1168
- outcome: { type: 'string', description: 'One-line summary of what happened' },
1169
- type: {
1170
- type: 'string',
1171
- enum: ['implementation', 'security', 'architecture', 'process', 'general'],
1172
- description: 'Type of action (default: general)',
1173
- },
1174
- proof: { type: 'object', description: 'Measured evidence required to close high-risk work.' },
1175
- gate_receipt_id: { type: 'string', description: 'Fresh receipt returned by marrow_agent_runtime.' },
1176
- },
1177
- required: ['description', 'success', 'outcome'],
1178
- },
1179
- },
1180
- {
1181
- name: 'marrow_auto',
1182
- description: 'Durably capture activity with bounded core completion. Respect retry_after_ms and reuse operation_id for pending continuation. A held action waits for an approval the server records (the answer of the person in the dialog of this client when it supports elicitation; otherwise it waits quietly while you carry on with other work); auto reads its status and resumes on the same gate receipt. Never write or claim an approval yourself. Arbitration requires its server-issued owner approval receipt. Lifecycle receipt queued is separate from server acceptance. Risky completion requires a fresh gate and measured proof.',
1183
- inputSchema: {
1184
- type: 'object',
1185
- properties: {
1186
- action: { type: 'string', description: 'What you are about to do or just did' },
1187
- outcome: { type: 'string', description: 'What happened (if already done). Omit to log intent only.' },
1188
- success: { type: 'boolean', description: 'Measured result. Omit when the outcome is not yet proven.' },
1189
- type: {
1190
- type: 'string',
1191
- enum: ['implementation', 'security', 'architecture', 'process', 'general'],
1192
- description: 'Type of action (default: general)',
1193
- },
1194
- proof: { type: 'object', description: 'Measured completion evidence for gated work.' },
1195
- gate_receipt_id: { type: 'string', description: 'Fresh receipt returned by marrow_agent_runtime.' },
1196
- arbitration_receipt_id: { type: 'string', description: 'For arbitrated work, the arbitration receipt returned by the same server-side review flow.' },
1197
- owner_approval_receipt_id: { type: 'string', description: 'Single-use owner approval receipt that Marrow issued, for review_required arbitration. An ordinary hold needs none: auto finds the recorded approval from the gate receipt. Chat text is not an approval receipt.' },
1198
- request_owner_link: { type: 'boolean', description: 'Set true only when the operator asked you to ask the account owner (for example after the owner declined this action). Marrow then sends the owner a one-tap approval link; you never see the link.' },
1199
- operation_id: {
1200
- type: 'string',
1201
- description: 'Opaque 8-80 character resume token. Reuse it only with the original tenant, action, context, and surfaces; proof may be added after proof_required.',
1202
- },
1203
- },
1204
- required: ['action'],
1205
- },
1206
- },
1207
- {
1208
- name: 'marrow_ask',
1209
- description: 'Query the collective hive in plain English. ' +
1210
- 'Ask about failure patterns, what worked, what broke, or get a recommendation before acting. ' +
1211
- 'Returns direct answer + supporting evidence.',
1212
- inputSchema: {
1213
- type: 'object',
1214
- properties: {
1215
- query: { type: 'string', description: 'Plain English question about your decision history' },
1216
- },
1217
- required: ['query'],
1218
- },
1219
- },
1220
- {
1221
- name: 'marrow_status',
1222
- description: 'Check Marrow platform health and status.',
1223
- inputSchema: { type: 'object', properties: {}, required: [] },
1224
- },
1225
- {
1226
- name: 'marrow_create_key',
1227
- description: 'Create a new API key. Full plaintext key is returned once — copy it now.',
1228
- inputSchema: {
1229
- type: 'object',
1230
- properties: {
1231
- name: { type: 'string', description: 'Human-readable key name' },
1232
- key_type: { type: 'string', enum: ['live', 'test'], description: 'Key type (default: live)' },
1233
- scopes: { type: 'array', items: { type: 'string' }, description: 'Allowed scopes' },
1234
- agent_ids: { type: 'array', items: { type: 'string' }, description: 'Optional agent bindings' },
1235
- expires_at: { type: 'string', description: 'Optional ISO-8601 expiry' },
1236
- },
1237
- required: ['name'],
1238
- },
1239
- },
1240
- {
1241
- name: 'marrow_list_keys',
1242
- description: 'List API keys. Keys are masked here by design.',
1243
- inputSchema: { type: 'object', properties: {}, required: [] },
1244
- },
1245
- {
1246
- name: 'marrow_get_key',
1247
- description: 'Get a single API key by ID. The key value is masked after creation.',
1248
- inputSchema: {
1249
- type: 'object',
1250
- properties: {
1251
- id: { type: 'string', description: 'API key ID' },
1252
- },
1253
- required: ['id'],
1254
- },
1255
- },
1256
- {
1257
- name: 'marrow_revoke_key',
1258
- description: 'Revoke an API key by ID.',
1259
- inputSchema: {
1260
- type: 'object',
1261
- properties: {
1262
- id: { type: 'string', description: 'API key ID' },
1263
- },
1264
- required: ['id'],
1265
- },
1266
- },
1267
- {
1268
- name: 'marrow_rotate_key',
1269
- description: 'Rotate an API key by ID. Full plaintext key is returned once — copy it now.',
1270
- inputSchema: {
1271
- type: 'object',
1272
- properties: {
1273
- id: { type: 'string', description: 'API key ID' },
1274
- },
1275
- required: ['id'],
1276
- },
1277
- },
1278
- {
1279
- name: 'marrow_list_memories',
1280
- description: 'List memories with optional filters (status, query, limit, agent_id for shared memories).',
1281
- inputSchema: {
1282
- type: 'object',
1283
- properties: {
1284
- status: { type: 'string', enum: ['active', 'outdated', 'deleted'], description: 'Filter by status' },
1285
- query: { type: 'string', description: 'Search query' },
1286
- limit: { type: 'number', description: 'Max results (default: 20)' },
1287
- agentId: { type: 'string', description: 'Agent ID for shared memories' },
1288
- },
1289
- required: [],
1290
- },
1291
- },
1292
- {
1293
- name: 'marrow_get_memory',
1294
- description: 'Get a single memory by ID.',
1295
- inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Memory ID' } }, required: ['id'] },
1296
- },
1297
- {
1298
- name: 'marrow_update_memory',
1299
- description: 'Update memory text, tags, or metadata.',
1300
- inputSchema: {
1301
- type: 'object',
1302
- properties: {
1303
- id: { type: 'string', description: 'Memory ID' },
1304
- text: { type: 'string', description: 'New text' },
1305
- source: { type: 'string', description: 'Source' },
1306
- tags: { type: 'array', items: { type: 'string' }, description: 'Tags' },
1307
- actor: { type: 'string', description: 'Actor name' },
1308
- note: { type: 'string', description: 'Audit note' },
1309
- },
1310
- required: ['id'],
1311
- },
1312
- },
1313
- {
1314
- name: 'marrow_delete_memory',
1315
- description: 'Soft delete a memory.',
1316
- inputSchema: {
1317
- type: 'object',
1318
- properties: {
1319
- id: { type: 'string', description: 'Memory ID' },
1320
- actor: { type: 'string', description: 'Actor name' },
1321
- note: { type: 'string', description: 'Audit note' },
1322
- },
1323
- required: ['id'],
1324
- },
1325
- },
1326
- {
1327
- name: 'marrow_mark_outdated',
1328
- description: 'Mark a memory as outdated.',
1329
- inputSchema: {
1330
- type: 'object',
1331
- properties: {
1332
- id: { type: 'string', description: 'Memory ID' },
1333
- actor: { type: 'string', description: 'Actor name' },
1334
- note: { type: 'string', description: 'Audit note' },
1335
- },
1336
- required: ['id'],
1337
- },
1338
- },
1339
- {
1340
- name: 'marrow_supersede_memory',
1341
- description: 'Atomically replace a memory with a new version.',
1342
- inputSchema: {
1343
- type: 'object',
1344
- properties: {
1345
- id: { type: 'string', description: 'Memory ID to supersede' },
1346
- text: { type: 'string', description: 'New memory text' },
1347
- source: { type: 'string', description: 'Source' },
1348
- tags: { type: 'array', items: { type: 'string' }, description: 'Tags' },
1349
- actor: { type: 'string', description: 'Actor name' },
1350
- note: { type: 'string', description: 'Audit note' },
1351
- },
1352
- required: ['id', 'text'],
1353
- },
1354
- },
1355
- {
1356
- name: 'marrow_share_memory',
1357
- description: 'Share a memory with specific agents.',
1358
- inputSchema: {
1359
- type: 'object',
1360
- properties: {
1361
- id: { type: 'string', description: 'Memory ID' },
1362
- agentIds: { type: 'array', items: { type: 'string' }, description: 'Agent IDs to share with' },
1363
- actor: { type: 'string', description: 'Actor name' },
1364
- },
1365
- required: ['id', 'agentIds'],
1366
- },
1367
- },
1368
- {
1369
- name: 'marrow_export_memories',
1370
- description: 'Export memories to JSON or CSV.',
1371
- inputSchema: {
1372
- type: 'object',
1373
- properties: {
1374
- format: { type: 'string', enum: ['json', 'csv'], description: 'Export format' },
1375
- status: { type: 'string', enum: ['active', 'all'], description: 'Filter by status' },
1376
- tags: { type: 'string', description: 'Comma-separated tags' },
1377
- },
1378
- required: [],
1379
- },
1380
- },
1381
- {
1382
- name: 'marrow_import_memories',
1383
- description: 'Import memories with merge (dedup) or replace mode.',
1384
- inputSchema: {
1385
- type: 'object',
1386
- properties: {
1387
- memories: { type: 'array', items: { type: 'object', properties: { text: { type: 'string' }, source: { type: 'string' }, tags: { type: 'array', items: { type: 'string' } } } }, description: 'Memories to import' },
1388
- mode: { type: 'string', enum: ['merge', 'replace'], description: 'Import mode' },
1389
- },
1390
- required: ['memories', 'mode'],
1391
- },
1392
- },
1393
- {
1394
- name: 'marrow_retrieve_memories',
1395
- description: 'Full-text search memories with filters (from, to, tags, source, status, shared).',
1396
- inputSchema: {
1397
- type: 'object',
1398
- properties: {
1399
- query: { type: 'string', description: 'Search query' },
1400
- limit: { type: 'number', description: 'Max results' },
1401
- from: { type: 'string', description: 'From date (ISO-8601)' },
1402
- to: { type: 'string', description: 'To date (ISO-8601)' },
1403
- tags: { type: 'string', description: 'Comma-separated tags' },
1404
- source: { type: 'string', description: 'Source filter' },
1405
- status: { type: 'string', enum: ['active', 'outdated', 'deleted'], description: 'Status filter' },
1406
- shared: { type: 'boolean', description: 'Include shared memories' },
1407
- },
1408
- required: ['query'],
1409
- },
1410
- },
1411
- {
1412
- name: 'marrow_workflow',
1413
- description: 'Interact with Marrow Workflow Registry. Register, start, and advance multi-step workflows. ' +
1414
- 'Actions: register (create workflow template), list (show all), get (details), start (begin instance), ' +
1415
- 'advance (complete a step), instances (list runs).',
1416
- inputSchema: {
1417
- type: 'object',
1418
- properties: {
1419
- action: { type: 'string', enum: ['register', 'list', 'get', 'update', 'start', 'advance', 'instances'], description: 'Workflow action to perform' },
1420
- workflowId: { type: 'string', description: 'Workflow ID (required for get/start/advance/instances)' },
1421
- instanceId: { type: 'string', description: 'Instance ID (required for advance)' },
1422
- name: { type: 'string', description: 'Workflow name (for register)' },
1423
- description: { type: 'string', description: 'Workflow description (for register/update)' },
1424
- steps: { type: 'array', description: 'Step definitions (for register)', items: { type: 'object', properties: { step: { type: 'number', description: 'Step order (1, 2, 3...)' }, agent_role: { type: 'string', description: 'Expected agent role (e.g., "builder", "auditor")' }, action_type: { type: 'string', description: 'Action type (e.g., "build", "audit", "patch")' }, description: { type: 'string', description: 'Step description' } }, required: ['step', 'description'] } },
1425
- tags: { type: 'array', items: { type: 'string' }, description: 'Tags (for register)' },
1426
- agentId: { type: 'string', description: 'Agent ID starting the workflow (for start)' },
1427
- context: { type: 'object', description: 'Workflow context (for start)' },
1428
- inputs: { type: 'object', description: 'Workflow inputs (for start)' },
1429
- stepCompleted: { type: 'number', description: 'Step number completed (for advance)' },
1430
- outcome: { type: 'string', description: 'Step outcome (for advance)' },
1431
- nextAgentId: { type: 'string', description: 'Next agent for the following step (for advance)' },
1432
- contextUpdate: { type: 'object', description: 'Context changes (for advance)' },
1433
- status: { type: 'string', enum: ['running', 'completed', 'failed', 'cancelled', 'active', 'archived'], description: 'Filter by status (for list/instances)' },
1434
- },
1435
- required: ['action'],
1436
- },
1437
- },
1438
- {
1439
- name: 'marrow_dashboard',
1440
- description: 'Get operator dashboard — account health, top failures, workflow status, recent activity, Marrow\'s saves metric. ' +
1441
- 'One call returns everything an operator needs to see.',
1442
- inputSchema: { type: 'object', properties: {}, required: [] },
1443
- },
1444
- {
1445
- name: 'marrow_digest',
1446
- description: 'Get periodic summary of agent activity and Marrow impact (default 7-day period). ' +
1447
- 'Shows decision counts, success rate trend vs previous period, saves, top improvements and risks.',
1448
- inputSchema: {
1449
- type: 'object',
1450
- properties: {
1451
- period: { type: 'string', description: 'Time period: 7d (default), 14d, or 30d' },
1452
- },
1453
- required: [],
1454
- },
1455
- },
1456
- {
1457
- name: 'marrow_agent_status',
1458
- description: 'Check whether Marrow is passively active for this agent or fleet. ' +
1459
- 'Returns connected state, signal quality, non-sensitive proof, and next actions. ' +
1460
- 'Use at session start or before owner reporting to prove Marrow is working without a dashboard.',
1461
- inputSchema: {
1462
- type: 'object',
1463
- properties: {
1464
- period: { type: 'string', description: 'Time period: 7d (default), 14d, or 30d' },
1465
- agentId: { type: 'string', description: 'Optional agent_id/session_id filter. Defaults to the canonical fleet-bound agent identity.' },
1466
- },
1467
- required: [],
1468
- },
1469
- },
1470
- {
1471
- name: 'marrow_runtime_status',
1472
- description: 'Read live Marrow runtime hook diagnostics from /v1/agent/status. ' +
1473
- 'Use this when an agent needs exact passive hook, token-capture, outcome-closure, client-update, and repair-command status.',
1474
- inputSchema: {
1475
- type: 'object',
1476
- properties: {
1477
- fast: { type: 'boolean', description: 'Use fast cached summary path when available. Defaults to true.' },
1478
- },
1479
- required: [],
1480
- },
1481
- },
1482
- {
1483
- name: 'marrow_value_report',
1484
- description: 'Get owner-ready proof of Marrow value for this agent or fleet. ' +
1485
- 'Returns summary, decision metrics, saves, active agents, top risks, recommendations, and improvement data without raw decision text.',
1486
- inputSchema: {
1487
- type: 'object',
1488
- properties: {
1489
- period: { type: 'string', description: 'Time period: 7d (default), 14d, 30d, or a day count up to 90.' },
1490
- agentId: { type: 'string', description: 'Optional agent_id/session_id filter. Defaults to the canonical fleet-bound agent identity.' },
1491
- },
1492
- required: [],
1493
- },
1494
- },
1495
- {
1496
- name: 'marrow_decision_brief',
1497
- description: 'One pre-action call before meaningful or risky work. Returns risk level, workflow/playbook steps, ' +
1498
- 'handoff requirements, freshness/source-of-truth checks, minimum verification checks, proof-pack fields, ' +
1499
- 'and next actions. Use this before deploys, publishes, merges, audits, patches, secret changes, or production work.',
1500
- inputSchema: {
1501
- type: 'object',
1502
- properties: {
1503
- action: { type: 'string', description: 'What the agent is about to do.' },
1504
- type: { type: 'string', description: 'Decision type, e.g. deploy, audit, patch, review.' },
1505
- role: { type: 'string', description: 'Agent role/playbook: deploy, audit, patch, review, or general.' },
1506
- agentId: { type: 'string', description: 'Optional agent_id filter. Defaults to the canonical fleet-bound agent identity.' },
1507
- sessionId: { type: 'string', description: 'Optional session id. Defaults to MARROW_SESSION_ID.' },
1508
- surfaces: {
1509
- type: 'array',
1510
- items: { type: 'string' },
1511
- description: 'Surfaces to keep current, e.g. github, npm, docs, production, secrets.',
1512
- },
1513
- period: { type: 'number', description: 'Lookback period in days, default 7, max 90.' },
1514
- },
1515
- required: ['action'],
1516
- },
1517
- },
1518
- {
1519
- name: 'marrow_first_value',
1520
- description: 'First-run Marrow value proof. Returns what is captured, whether outcome closure/runtime gate are active, ' +
1521
- 'a plain-English first useful lesson, and a five-minute try-this-now prompt for agents and owners.',
1522
- inputSchema: {
1523
- type: 'object',
1524
- properties: {
1525
- action: { type: 'string', description: 'Optional action to test. Defaults to a production deploy safety prompt.' },
1526
- type: { type: 'string', description: 'Decision type, e.g. deploy, audit, patch, review.' },
1527
- role: { type: 'string', description: 'Agent role/playbook: deploy, audit, patch, review, or general.' },
1528
- agentId: { type: 'string', description: 'Optional agent_id filter. Defaults to the canonical fleet-bound agent identity.' },
1529
- sessionId: { type: 'string', description: 'Optional session id. Defaults to MARROW_SESSION_ID.' },
1530
- surfaces: { type: 'array', items: { type: 'string' }, description: 'Surfaces to test, e.g. production, deploy, github, npm.' },
1531
- context: { type: 'object', description: 'Optional non-sensitive metadata.' },
1532
- proof: { type: 'object', description: 'Optional proof fields already collected.' },
1533
- },
1534
- required: [],
1535
- },
1536
- },
1537
- {
1538
- name: 'marrow_agent_runtime',
1539
- description: 'One-call agent-native Marrow loop. Returns passive status, decision brief, risk gate, relevant lessons, ' +
1540
- 'template suggestion, required proof pack, before-you-act instruction, and exact next action. ' +
1541
- 'Its runtime_authorization is the authoritative gate receipt; it returns decision_id only when runtime actually creates a decision. ' +
1542
- 'Reuse its server-created decision_id for outcome closure; use marrow_auto or marrow_think only when the completion contract requires decision creation. ' +
1543
- 'A review_required hold does not permit the action: wait until the server records an approval, then commit with the same gate receipt. ' +
1544
- 'Use this before meaningful work when you want Marrow to guide the whole action in one call.',
1545
- inputSchema: {
1546
- type: 'object',
1547
- properties: {
1548
- action: { type: 'string', description: 'What the agent is about to do.' },
1549
- type: { type: 'string', description: 'Decision type, e.g. deploy, audit, patch, review.' },
1550
- role: { type: 'string', description: 'Agent role/playbook: deploy, audit, patch, review, or general.' },
1551
- agentId: { type: 'string', description: 'Optional agent_id filter. Defaults to the canonical fleet-bound agent identity.' },
1552
- sessionId: { type: 'string', description: 'Optional session id. Defaults to MARROW_SESSION_ID.' },
1553
- surfaces: {
1554
- type: 'array',
1555
- items: { type: 'string' },
1556
- description: 'Surfaces to keep current, e.g. github, npm, docs, production, secrets.',
1557
- },
1558
- context: { type: 'object', description: 'Optional non-sensitive metadata.' },
1559
- proof: { type: 'object', description: 'Optional proof fields already collected, such as checks, rollback_target, smoke_result.' },
1560
- period: { type: 'number', description: 'Lookback period in days, default 7, max 90.' },
1561
- },
1562
- required: ['action'],
1563
- },
1564
- },
1565
- {
1566
- name: 'marrow_arbitrate',
1567
- description: 'Resolve conflicting next-step proposals from two or more tenant agents before execution. ' +
1568
- 'Uses the existing Marrow runtime gate and returns a durable arbitration receipt with the selected, ' +
1569
- 'synthesized, review-required, or blocked action and exactly why it changed.',
1570
- inputSchema: {
1571
- type: 'object',
1572
- properties: {
1573
- objective: { type: 'string', description: 'The shared owner or workflow objective.' },
1574
- ownerIntent: { type: 'string', description: 'Optional bounded owner intent used for deterministic alignment.' },
1575
- conflictType: {
1576
- type: 'string',
1577
- enum: ['action_conflict', 'policy_conflict', 'evidence_conflict', 'authority_conflict', 'risk_conflict'],
1578
- },
1579
- proposals: {
1580
- type: 'array',
1581
- minItems: 2,
1582
- maxItems: 8,
1583
- items: {
1584
- type: 'object',
1585
- properties: {
1586
- proposal_id: { type: 'string', description: 'Stable opaque proposal id.' },
1587
- agent_id: { type: 'string', description: 'Existing agent id in this Marrow account.' },
1588
- action: { type: 'string', description: 'Proposed next action.' },
1589
- rationale: { type: 'string', description: 'Optional concise rationale; redacted before transport.' },
1590
- confidence: { type: 'number', minimum: 0, maximum: 1 },
1591
- risk_level: { type: 'string', enum: ['low', 'medium', 'high'] },
1592
- requires_owner_approval: { type: 'boolean' },
1593
- evidence: {
1594
- type: 'array',
1595
- maxItems: 8,
1596
- items: {
1597
- type: 'object',
1598
- properties: {
1599
- kind: { type: 'string' },
1600
- reference: { type: 'string', description: 'Opaque identifier only; no URL, path, or raw evidence.' },
1601
- },
1602
- required: ['kind', 'reference'],
1603
- },
1604
- },
1605
- },
1606
- required: ['proposal_id', 'agent_id', 'action'],
1607
- },
1608
- },
1609
- action: { type: 'string', description: 'Optional runtime action label.' },
1610
- type: { type: 'string', description: 'Optional runtime action type. Defaults to coordination.' },
1611
- agentId: { type: 'string', description: 'Requesting agent id. Defaults to the canonical fleet-bound agent identity.' },
1612
- sessionId: { type: 'string', description: 'Optional workflow session id.' },
1613
- surfaces: { type: 'array', items: { type: 'string' } },
1614
- context: { type: 'object', description: 'Optional non-sensitive runtime metadata.' },
1615
- proof: { type: 'object', description: 'Optional proof already available to the runtime gate.' },
1616
- },
1617
- required: ['objective', 'proposals'],
1618
- },
1619
- },
1620
- {
1621
- name: 'marrow_coordinate',
1622
- description: 'Coordinate tenant agents without sharing transcripts. Acquire or release a bounded resource lease, ' +
1623
- 'list current leases, or create/list compact evidence-backed child proof packets for a parent agent.',
1624
- inputSchema: {
1625
- type: 'object',
1626
- properties: {
1627
- action: {
1628
- type: 'string',
1629
- enum: ['list_leases', 'acquire_lease', 'release_lease', 'list_proof_packets', 'create_proof_packet'],
1630
- },
1631
- resource_type: { type: 'string', enum: ['file', 'directory', 'service', 'workflow', 'deployment', 'custom'] },
1632
- resource: { type: 'string', maxLength: 160, description: 'Bounded tenant-visible resource label. Do not send secrets.' },
1633
- workflow_id: { type: 'string' },
1634
- ttl_seconds: { type: 'number', minimum: 30, maximum: 3600 },
1635
- lease_id: { type: 'string' },
1636
- lease_token: { type: 'string', description: 'One-time lease capability returned by acquire_lease.' },
1637
- status: { type: 'string', enum: ['active', 'released', 'expired', 'incomplete', 'complete', 'failed'] },
1638
- limit: { type: 'number', minimum: 1, maximum: 100 },
1639
- decision_id: { type: 'string' },
1640
- proof_pack_id: { type: 'string' },
1641
- summary: { type: 'string', maxLength: 280, description: 'Compact result summary; no raw transcript.' },
1642
- evidence_refs: {
1643
- type: 'array', maxItems: 20, items: { type: 'string' },
1644
- description: 'Opaque durable evidence identifiers only.',
1645
- },
1646
- },
1647
- required: ['action'],
1648
- },
1649
- },
1650
- {
1651
- name: 'marrow_replay_compare',
1652
- description: 'Compare two already-recorded outcomes for the same tenant task using durable proof. ' +
1653
- 'This does not run a model or replay customer content; it returns complete or insufficient_evidence.',
1654
- inputSchema: {
1655
- type: 'object',
1656
- additionalProperties: false,
1657
- properties: {
1658
- comparison_id: { type: 'string', minLength: 1, description: 'Fetch a prior replay comparison by id.' },
1659
- source_decision_id: {
1660
- type: 'string', minLength: 1, maxLength: 128, pattern: '^[A-Za-z0-9._:-]{1,128}$',
1661
- description: 'Original task decision used to bind the comparison.',
1662
- },
1663
- workspace_binding_id: {
1664
- type: 'string', minLength: 34, maxLength: 34, pattern: '^workspace_[a-f0-9]{24}$',
1665
- description: 'Optional privacy-safe workspace binding from runtime.',
1666
- },
1667
- constraints: {
1668
- type: 'object',
1669
- additionalProperties: false,
1670
- maxProperties: 7,
1671
- description: 'Allowlisted comparison labels only; prompts, code, transcripts, credentials, and nested content are rejected.',
1672
- properties: {
1673
- environment: { type: 'string', maxLength: 80 },
1674
- tests: { type: 'string', maxLength: 80 },
1675
- policy_profile_id: { type: 'string', maxLength: 80 },
1676
- workflow_type: { type: 'string', maxLength: 80 },
1677
- task_type: { type: 'string', maxLength: 80 },
1678
- required_proof: { type: 'boolean' },
1679
- same_workspace: { type: 'boolean' },
1680
- },
1681
- },
1682
- baseline: {
1683
- type: 'object',
1684
- additionalProperties: false,
1685
- maxProperties: 2,
1686
- properties: {
1687
- label: { type: 'string', minLength: 1, maxLength: 80, pattern: '^[A-Za-z0-9._:-]{1,80}$' },
1688
- decision_id: { type: 'string', minLength: 1, maxLength: 128, pattern: '^[A-Za-z0-9._:-]{1,128}$' },
1689
- },
1690
- required: ['decision_id'],
1691
- },
1692
- candidate: {
1693
- type: 'object',
1694
- additionalProperties: false,
1695
- maxProperties: 2,
1696
- properties: {
1697
- label: { type: 'string', minLength: 1, maxLength: 80, pattern: '^[A-Za-z0-9._:-]{1,80}$' },
1698
- decision_id: { type: 'string', minLength: 1, maxLength: 128, pattern: '^[A-Za-z0-9._:-]{1,128}$' },
1699
- },
1700
- required: ['decision_id'],
1701
- },
1702
- },
1703
- oneOf: [
1704
- {
1705
- required: ['comparison_id'],
1706
- not: {
1707
- anyOf: [
1708
- { required: ['source_decision_id'] },
1709
- { required: ['workspace_binding_id'] },
1710
- { required: ['constraints'] },
1711
- { required: ['baseline'] },
1712
- { required: ['candidate'] },
1713
- ],
1714
- },
1715
- },
1716
- {
1717
- required: ['source_decision_id', 'baseline', 'candidate'],
1718
- not: { required: ['comparison_id'] },
1719
- },
1720
- ],
1721
- },
1722
- },
1723
- {
1724
- name: 'marrow_governance_control_plane',
1725
- description: 'Return Marrow control-plane proof: governance, runtime gates, proof packs, fleet intelligence, supported harnesses, and exact next action.',
1726
- inputSchema: { type: 'object', properties: {}, required: [] },
1727
- },
1728
- {
1729
- name: 'marrow_hermes_integration',
1730
- description: 'Return the Hermes Agent integration guide mapping /goal, verification evidence, /learn, /journey, and background subagents into Marrow proof and outcome workflows.',
1731
- inputSchema: { type: 'object', properties: {}, required: [] },
1732
- },
1733
- {
1734
- name: 'marrow_completion_contracts',
1735
- description: 'List Marrow completion contracts for deploy, merge, publish, database migration, security change, support response, and Hermes goal workflows.',
1736
- inputSchema: { type: 'object', properties: {}, required: [] },
1737
- },
1738
- {
1739
- name: 'marrow_evaluate_completion_contract',
1740
- description: 'Evaluate whether an agent has enough proof to mark work complete. Returns complete, missing_proof, review_required, or blocked with missing proof fields.',
1741
- inputSchema: {
1742
- type: 'object',
1743
- properties: {
1744
- action: { type: 'string', description: 'Action/workflow being completed, e.g. deploy, publish, db_migration, hermes_goal.' },
1745
- workflow_type: { type: 'string', description: 'Optional workflow type if action is not supplied.' },
1746
- risk_level: { type: 'string', enum: ['low', 'medium', 'high'], description: 'Optional risk override.' },
1747
- evidence: { type: 'object', description: 'Non-sensitive proof fields already collected.' },
1748
- },
1749
- required: [],
1750
- },
1751
- },
1752
- {
1753
- name: 'marrow_governance_timeline',
1754
- description: 'Return the recent fleet governance timeline across decisions, risk gates, and proof-pack events.',
1755
- inputSchema: {
1756
- type: 'object',
1757
- properties: {
1758
- agentId: { type: 'string', description: 'Optional agent filter. Defaults to the canonical fleet-bound agent identity.' },
1759
- limit: { type: 'number', description: 'Max events to return, default 25, max 100.' },
1760
- },
1761
- required: [],
1762
- },
1763
- },
1764
- {
1765
- name: 'marrow_decision_trace',
1766
- description: 'Inspect the tenant-scoped path behind one governed decision and return its owner-readable intervention receipt with gate, required workflow, permit follow-through, proof, and observed outcome.',
1767
- inputSchema: {
1768
- type: 'object',
1769
- properties: {
1770
- decisionId: { type: 'string', description: 'Decision ID owned by this account and agent scope.' },
1771
- },
1772
- required: ['decisionId'],
1773
- },
1774
- },
1775
- {
1776
- name: 'marrow_buyer_proof',
1777
- description: 'Return buyer-grade value proof: failures avoided, risky actions reviewed, proofs completed, token/time saved, failure classes, agent leaderboard, and reliability score.',
1778
- inputSchema: {
1779
- type: 'object',
1780
- properties: {
1781
- agentId: { type: 'string', description: 'Optional agent filter. Defaults to the canonical fleet-bound agent identity.' },
1782
- periodDays: { type: 'number', description: 'Lookback period in days, default 30, max 90.' },
1783
- },
1784
- required: [],
1785
- },
1786
- },
1787
- {
1788
- name: 'marrow_mode_recommend',
1789
- description: 'Recommend passive, pilot, or enforce mode from project/workflow signals. Marrow never auto-switches here; the agent/user must accept or override.',
1790
- inputSchema: {
1791
- type: 'object',
1792
- properties: {
1793
- project: { type: 'object', description: 'Project signals: name, type, frameworks, signals, package_scripts, config_files.' },
1794
- workflow: { type: 'object', description: 'Workflow context: action, type, branch, environment.' },
1795
- agent: { type: 'object', description: 'Agent context: id and role.' },
1796
- selected_mode: { type: 'string', enum: ['passive', 'pilot', 'enforce'], description: 'Optional final user-selected mode to log.' },
1797
- selection_source: { type: 'string', enum: ['accepted', 'overridden', 'ignored', 'system'], description: 'How the final mode was selected.' },
1798
- },
1799
- required: [],
1800
- },
1801
- },
1802
- {
1803
- name: 'marrow_policy_profiles',
1804
- description: 'List saved Marrow governance policy profiles for this account. Returns default-business when none are saved.',
1805
- inputSchema: { type: 'object', properties: {}, required: [] },
1806
- },
1807
- {
1808
- name: 'marrow_create_policy_profile',
1809
- description: 'Create or update an explicit governance policy profile. Mutating call; requires a key with full scope.',
1810
- inputSchema: {
1811
- type: 'object',
1812
- properties: {
1813
- name: { type: 'string', description: 'Profile name, e.g. default-business or production-agents.' },
1814
- description: { type: 'string', description: 'Optional profile description.' },
1815
- rules: { type: 'array', items: { type: 'object' }, description: 'Rules with match fields and mode passive/pilot/enforce.' },
1816
- },
1817
- required: ['name'],
1818
- },
1819
- },
1820
- {
1821
- name: 'marrow_assign_project_policy_profile',
1822
- description: 'Assign an active governance policy profile to a project key. Mutating call; requires a key with full scope.',
1823
- inputSchema: {
1824
- type: 'object',
1825
- properties: {
1826
- project_key: { type: 'string', description: 'Stable project key, e.g. marrow-api or clinic-api.' },
1827
- profile_id: { type: 'string', description: 'Active policy profile id.' },
1828
- },
1829
- required: ['project_key', 'profile_id'],
1830
- },
1831
- },
1832
- {
1833
- name: 'marrow_policy_resolve',
1834
- description: 'Resolve the explicit mode for a project/workflow from saved policy profiles, falling back to recommendation. Does not auto-apply.',
1835
- inputSchema: {
1836
- type: 'object',
1837
- properties: {
1838
- profile_id: { type: 'string', description: 'Optional policy profile id.' },
1839
- profile_name: { type: 'string', description: 'Optional policy profile name.' },
1840
- project: { type: 'object', description: 'Project signals: name, type, frameworks, signals, package_scripts, config_files.' },
1841
- workflow: { type: 'object', description: 'Workflow context: action, type, branch, environment.' },
1842
- agent: { type: 'object', description: 'Agent context: id and role.' },
1843
- },
1844
- required: [],
1845
- },
1846
- },
1847
- {
1848
- name: 'marrow_workflow_gate',
1849
- description: 'Pre-action risk gate for deploys, publishes, merges, DB migrations, key rotation, destructive commands, and production work. ' +
1850
- 'Returns allow, warn, review_required, or block plus prior lessons/playbooks.',
1851
- inputSchema: {
1852
- type: 'object',
1853
- properties: {
1854
- action: { type: 'string', description: 'What the agent is about to do.' },
1855
- description: { type: 'string', description: 'Optional extra context for the action.' },
1856
- riskTolerance: { type: 'string', enum: ['low', 'medium', 'high'], description: 'Default high. Use medium/low for stricter gates.' },
1857
- requiresApproval: { type: 'boolean', description: 'Set true when owner approval is required before proceeding.' },
1858
- context: { type: 'object', description: 'Optional metadata. Do not include secrets or raw payloads.' },
1859
- },
1860
- required: ['action'],
1861
- },
1862
- },
1863
- {
1864
- name: 'marrow_agent_performance',
1865
- description: 'Get agent-facing fleet value metrics: avoided mistakes, reused winning decisions, failed patterns, token/time saved estimate, reliability score, and next improvements.',
1866
- inputSchema: {
1867
- type: 'object',
1868
- properties: {
1869
- period: { type: 'string', description: 'Time period: 7d (default), 14d, 30d, or day count up to 90.' },
1870
- agentId: { type: 'string', description: 'Optional agent_id/session_id filter. Defaults to the canonical fleet-bound agent identity.' },
1871
- },
1872
- required: [],
1873
- },
1874
- },
1875
- {
1876
- name: 'marrow_fleet_lessons',
1877
- description: 'Retrieve ranked reusable fleet lessons before similar work. Use before deploys, handoffs, migrations, audits, and repeated task types.',
1878
- inputSchema: {
1879
- type: 'object',
1880
- properties: {
1881
- query: { type: 'string', description: 'Search phrase for similar work.' },
1882
- type: { type: 'string', enum: ['success', 'failure', 'deploy', 'incident', 'handoff', 'general'] },
1883
- agentId: { type: 'string', description: 'Optional agent filter.' },
1884
- limit: { type: 'number', description: 'Max lessons to return, default 10.' },
1885
- },
1886
- required: [],
1887
- },
1888
- },
1889
- {
1890
- name: 'marrow_record_deployment_memory',
1891
- description: 'Record deploy or incident memory: PR, commit, tests, smoke result, rollback plan, production health, and incident notes.',
1892
- inputSchema: {
1893
- type: 'object',
1894
- properties: {
1895
- release_id: { type: 'string' },
1896
- pr_url: { type: 'string' },
1897
- commit_sha: { type: 'string' },
1898
- environment: { type: 'string' },
1899
- status: { type: 'string', enum: ['planned', 'dry_run', 'deployed', 'verified', 'rolled_back', 'incident'] },
1900
- tests: { type: 'array', items: { type: 'string' } },
1901
- smoke_result: { type: 'string' },
1902
- rollback_plan: { type: 'string' },
1903
- prod_health: { type: 'string' },
1904
- incident_summary: { type: 'string' },
1905
- },
1906
- required: [],
1907
- },
1908
- },
1909
- {
1910
- name: 'marrow_create_handoff',
1911
- description: 'Create a structured cross-agent handoff that Marrow can track for pending, stale, blocked, and complete states.',
1912
- inputSchema: {
1913
- type: 'object',
1914
- properties: {
1915
- to_agent_id: { type: 'string' },
1916
- task: { type: 'string' },
1917
- workflow_id: { type: 'string' },
1918
- from_agent_id: { type: 'string' },
1919
- checkpoint: { type: 'string' },
1920
- stale_after_seconds: { type: 'number' },
1921
- },
1922
- required: ['to_agent_id', 'task'],
1923
- },
1924
- },
1925
- {
1926
- name: 'marrow_update_handoff',
1927
- description: 'Update a Marrow handoff checkpoint/status when an agent accepts, blocks, completes, or needs review.',
1928
- inputSchema: {
1929
- type: 'object',
1930
- properties: {
1931
- handoffId: { type: 'string' },
1932
- status: { type: 'string', enum: ['pending', 'accepted', 'working', 'blocked', 'complete', 'stale', 'cancelled'] },
1933
- checkpoint: { type: 'string' },
1934
- result_summary: { type: 'string' },
1935
- },
1936
- required: ['handoffId'],
1937
- },
1938
- },
1939
- {
1940
- name: 'marrow_handoff_status',
1941
- description: 'Ask who is pending, stuck, stale, blocked, or complete across the agent fleet.',
1942
- inputSchema: {
1943
- type: 'object',
1944
- properties: {
1945
- status: { type: 'string' },
1946
- agentId: { type: 'string' },
1947
- limit: { type: 'number' },
1948
- },
1949
- required: [],
1950
- },
1951
- },
1952
- {
1953
- name: 'marrow_session_end',
1954
- description: 'Explicitly end the current session. Optionally auto-commits any open decision. ' +
1955
- 'Prevents orphaned decisions when an agent finishes a task.',
1956
- inputSchema: {
1957
- type: 'object',
1958
- properties: {
1959
- autoCommitOpen: { type: 'boolean', description: 'Whether to auto-commit any open decision (default: true)' },
1960
- },
1961
- required: [],
1962
- },
1963
- },
1964
- {
1965
- name: 'marrow_accept_detected',
1966
- description: 'Convert a detected decision pattern into an enforced workflow. ' +
1967
- 'The pattern ID comes from suggested_workflows in the orient() response.',
1968
- inputSchema: {
1969
- type: 'object',
1970
- properties: {
1971
- detectedId: { type: 'string', description: 'ID of the detected pattern to accept' },
1972
- },
1973
- required: ['detectedId'],
1974
- },
1975
- },
1976
- {
1977
- name: 'marrow_list_templates',
1978
- description: 'Browse pre-built workflow templates. Filter by industry (insurance, healthcare, ecommerce, legal, saas, fintech, media, enterprise) or category. ' +
1979
- 'Use to discover available workflows before installing.',
1980
- inputSchema: {
1981
- type: 'object',
1982
- properties: {
1983
- industry: { type: 'string', description: 'Filter by industry (e.g., insurance, healthcare, saas)' },
1984
- category: { type: 'string', description: 'Filter by category (e.g., claims, engineering, support)' },
1985
- limit: { type: 'number', description: 'Max results (default: 20)' },
1986
- },
1987
- required: [],
1988
- },
1989
- },
1990
- {
1991
- name: 'marrow_install_template',
1992
- description: 'Install a workflow template into your fleet as an active workflow. ' +
1993
- 'Use after marrow_list_templates to pick one.',
1994
- inputSchema: {
1995
- type: 'object',
1996
- properties: {
1997
- slug: { type: 'string', description: 'Template slug to install (e.g., code-review-deploy, claims-triage)' },
1998
- },
1999
- required: ['slug'],
2000
- },
2001
- },
2002
- ];
2003
- const CORE_TOOL_NAMES = new Set([
2004
- 'marrow_agent_runtime',
2005
- 'marrow_think',
2006
- 'marrow_commit',
2007
- 'marrow_ask',
2008
- 'marrow_status',
2009
- 'marrow_auto',
2010
- 'marrow_handoff_status',
2011
- ]);
2012
- const PRIMARY_TOOL_NAMES = new Set([
2013
- 'marrow_agent_runtime',
2014
- 'marrow_arbitrate',
2015
- 'marrow_coordinate',
2016
- 'marrow_replay_compare',
2017
- 'marrow_decision_brief',
2018
- 'marrow_think',
2019
- 'marrow_commit',
2020
- 'marrow_workflow_gate',
2021
- 'marrow_completion_contracts',
2022
- 'marrow_evaluate_completion_contract',
2023
- 'marrow_agent_status',
2024
- 'marrow_value_report',
2025
- 'marrow_buyer_proof',
2026
- 'marrow_governance_timeline',
2027
- 'marrow_decision_trace',
2028
- 'marrow_fleet_lessons',
2029
- 'marrow_model_usage',
2030
- ]);
2031
1090
  function activeToolProfile() {
2032
1091
  const configured = process.env.MARROW_TOOL_PROFILE;
2033
1092
  if (configured === undefined || configured === 'primary')
@@ -2039,9 +1098,9 @@ if (process.argv[2] !== 'keys') {
2039
1098
  }
2040
1099
  function toolsForProfile(profile) {
2041
1100
  if (profile === 'full')
2042
- return TOOLS;
2043
- const visibleNames = profile === 'primary' ? PRIMARY_TOOL_NAMES : CORE_TOOL_NAMES;
2044
- return TOOLS.filter((tool) => visibleNames.has(tool.name));
1101
+ return tool_catalog_1.TOOLS;
1102
+ const visibleNames = profile === 'primary' ? tool_catalog_1.PRIMARY_TOOL_NAMES : tool_catalog_1.CORE_TOOL_NAMES;
1103
+ return tool_catalog_1.TOOLS.filter((tool) => visibleNames.has(tool.name));
2045
1104
  }
2046
1105
  function advertisedTools() {
2047
1106
  return toolsForProfile(activeToolProfile());
@@ -2062,7 +1121,7 @@ if (process.argv[2] !== 'keys') {
2062
1121
  const evidence = recordValue(projection?.entitlement_evidence);
2063
1122
  const counts = recordValue(projection?.counts);
2064
1123
  const tools = projection?.tools;
2065
- const expectedNames = [...PRIMARY_TOOL_NAMES];
1124
+ const expectedNames = [...tool_catalog_1.PRIMARY_TOOL_NAMES];
2066
1125
  if (!projection
2067
1126
  || projection.profile !== 'primary'
2068
1127
  || (projection.current_plan !== null && typeof projection.current_plan !== 'string')
@@ -2293,7 +1352,7 @@ Marrow is not a replacement agent or a standalone memory app. Context and prior
2293
1352
  const toolName = params?.name;
2294
1353
  const args = (params?.arguments || {});
2295
1354
  if (!toolAllowedByActiveProfile(toolName)) {
2296
- const repair = toolName && PRIMARY_TOOL_NAMES.has(toolName)
1355
+ const repair = toolName && tool_catalog_1.PRIMARY_TOOL_NAMES.has(toolName)
2297
1356
  ? 'Unset MARROW_TOOL_PROFILE or set MARROW_TOOL_PROFILE=primary, then restart MCP.'
2298
1357
  : 'Set MARROW_TOOL_PROFILE=full, then restart MCP for the complete advanced/legacy catalog.';
2299
1358
  error(id, -32601, `Tool is not available in the active Marrow tool profile. ${repair}`);