@getmarrow/mcp 3.9.43 → 3.9.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -8
- package/dist/cli.js +70 -79
- package/dist/cli.js.map +1 -1
- package/dist/hook-context.d.ts.map +1 -1
- package/dist/hook-context.js +73 -44
- package/dist/hook-context.js.map +1 -1
- package/dist/hook-session.d.ts +7 -0
- package/dist/hook-session.d.ts.map +1 -0
- package/dist/hook-session.js +133 -0
- package/dist/hook-session.js.map +1 -0
- package/dist/hook.d.ts +2 -0
- package/dist/hook.d.ts.map +1 -1
- package/dist/hook.js +46 -50
- package/dist/hook.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/dist/lifecycle-spool.d.ts +29 -0
- package/dist/lifecycle-spool.d.ts.map +1 -0
- package/dist/lifecycle-spool.js +321 -0
- package/dist/lifecycle-spool.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,16 +37,17 @@ For most new installations, start with the universal installer instead:
|
|
|
37
37
|
npx @getmarrow/install --yes
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
## What's New in v3.9.
|
|
40
|
+
## What's New in v3.9.44
|
|
41
41
|
|
|
42
|
-
v3.9.
|
|
42
|
+
v3.9.44 makes the MCP integration an always-on governance lifecycle rather than a prompt reminder:
|
|
43
43
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
44
|
+
- `UserPromptSubmit` obtains relevant before-action guidance without storing raw prompt text;
|
|
45
|
+
- `PostToolUse` records compact success/failure lifecycle receipts;
|
|
46
|
+
- `Stop` keeps unfinished outcomes visible instead of silently treating a session exit as success;
|
|
47
|
+
- transient lifecycle delivery failures use an owner-only, bounded local spool with stable event IDs;
|
|
48
|
+
- `marrow_decision_trace` explains the tenant-scoped path from prior failure and lesson through gate, proof, workflow, and outcome.
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
Existing MCP tools and stable context API names remain compatible. Authentication, policy, proof, and validation failures are surfaced rather than retried as network failures.
|
|
50
51
|
|
|
51
52
|
## Governed Action Flow
|
|
52
53
|
|
|
@@ -105,7 +106,9 @@ High-risk work can be allowed, warned, held for review, or blocked according to
|
|
|
105
106
|
|
|
106
107
|
## Passive Use
|
|
107
108
|
|
|
108
|
-
`npx @getmarrow/mcp setup` installs supported hooks so the agent can receive before-action context
|
|
109
|
+
`npx @getmarrow/mcp setup` installs supported prompt, tool-result, and session-stop hooks so the agent can receive before-action context, record meaningful tool outcomes, and keep unfinished closure visible without the owner repeatedly prompting it to use Marrow.
|
|
110
|
+
|
|
111
|
+
The hooks send compact classifications and lifecycle receipts. They do not need raw prompts, completions, command output, tool output, or credentials. A completed tool or session does not automatically become a successful business outcome; explicit success/failure closure is required.
|
|
109
112
|
|
|
110
113
|
Check the installed runtime:
|
|
111
114
|
|
|
@@ -130,6 +133,7 @@ Status diagnostics distinguish missing keys, invalid keys, wrong bound-agent ide
|
|
|
130
133
|
| `marrow_value_report` | Return account/agent value evidence without requiring a dashboard |
|
|
131
134
|
| `marrow_buyer_proof` | Return owner-ready governance and reliability evidence |
|
|
132
135
|
| `marrow_governance_timeline` | Inspect decisions, gates, proof packs, and outcomes over time |
|
|
136
|
+
| `marrow_decision_trace` | Explain the tenant-scoped causal path behind one governed decision |
|
|
133
137
|
| `marrow_fleet_lessons` | Retrieve proven lessons authorized for the current account or agent |
|
|
134
138
|
| `marrow_model_usage` | Record compact token, cost, and latency counts when the harness exposes them |
|
|
135
139
|
|
package/dist/cli.js
CHANGED
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
const index_1 = require("./index");
|
|
14
14
|
const hook_1 = require("./hook");
|
|
15
15
|
const hook_context_1 = require("./hook-context");
|
|
16
|
+
const hook_session_1 = require("./hook-session");
|
|
16
17
|
const env_1 = require("./env");
|
|
17
18
|
const redact_1 = require("./redact");
|
|
18
19
|
// Parse CLI args
|
|
@@ -33,6 +34,9 @@ function parseArgs() {
|
|
|
33
34
|
if (args[i] === 'context-hook' || args[i] === '--context-hook') {
|
|
34
35
|
result.contextHook = true;
|
|
35
36
|
}
|
|
37
|
+
if (args[i] === 'session-hook' || args[i] === '--session-hook') {
|
|
38
|
+
result.sessionHook = true;
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
return result;
|
|
38
42
|
}
|
|
@@ -43,18 +47,18 @@ function runSetup() {
|
|
|
43
47
|
const MARROW_BLOCK_START = '<!-- marrow:start -->';
|
|
44
48
|
const MARROW_BLOCK_END = '<!-- marrow:end -->';
|
|
45
49
|
const marrowInstructions = `${MARROW_BLOCK_START}
|
|
46
|
-
## Marrow —
|
|
50
|
+
## Marrow — Agent Control and Proof (auto-injected by @getmarrow/mcp setup)
|
|
47
51
|
|
|
48
52
|
You have Marrow MCP connected. Use it on EVERY session automatically:
|
|
49
53
|
|
|
50
|
-
1. **Passive by default:** Marrow hooks
|
|
51
|
-
2. **
|
|
52
|
-
3. **
|
|
53
|
-
4. **
|
|
54
|
-
5. **
|
|
55
|
-
6. **To query history:** Call \`marrow_ask("plain english question")\` — ask what failed, what worked, what
|
|
54
|
+
1. **Passive by default:** Marrow hooks record compact lifecycle receipts and inject relevant policy, warnings, lessons, and risky-work decision briefs into your prompt context.
|
|
55
|
+
2. **Before risky actions:** Respect the returned \`allow\`, \`warn\`, \`review_required\`, or \`block\` decision and its proof contract. Call \`marrow_agent_runtime\` explicitly when the passive hook cannot cover the action.
|
|
56
|
+
3. **After meaningful work:** Record the real success or failure with \`marrow_commit\` or \`marrow_auto\`. A tool exit or session end is not proof that the business outcome succeeded.
|
|
57
|
+
4. **Unfinished work:** Leave pending outcomes visible. Do not invent success to clear a closure item.
|
|
58
|
+
5. **To explain a decision:** Use \`marrow_decision_trace\` to connect the prior failure, lesson, gate, proof, workflow, and outcome.
|
|
59
|
+
6. **To query authorized history:** Call \`marrow_ask("plain english question")\` — ask what failed, what worked, and what policy should apply.
|
|
56
60
|
|
|
57
|
-
Do
|
|
61
|
+
Do not skip the gate or outcome. Marrow's value comes from controlling the action before execution and preserving evidence afterward.
|
|
58
62
|
|
|
59
63
|
For one-shot logging: \`marrow_auto({ action: "did X", outcome: "result Y", success: true })\` — one call, done.
|
|
60
64
|
${MARROW_BLOCK_END}`;
|
|
@@ -111,8 +115,15 @@ ${MARROW_BLOCK_END}`;
|
|
|
111
115
|
else {
|
|
112
116
|
process.stdout.write('UserPromptSubmit hook already installed — Marrow context and passive decision briefs are injected on matching prompts.\n');
|
|
113
117
|
}
|
|
118
|
+
const sessionHookInstall = (0, hook_session_1.installSessionEndHook)(process.cwd());
|
|
119
|
+
if (sessionHookInstall.installed) {
|
|
120
|
+
process.stdout.write('Installed Stop hook — unfinished outcomes remain visible for reconciliation.\n');
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
process.stdout.write('Stop hook already installed — unfinished outcomes remain visible for reconciliation.\n');
|
|
124
|
+
}
|
|
114
125
|
process.stdout.write(`Hook settings: ${hookInstall.settingsPath}\n`);
|
|
115
|
-
process.stdout.write('Set MARROW_AUTO_HOOK=false to disable
|
|
126
|
+
process.stdout.write('Set MARROW_AUTO_HOOK=false to disable passive hooks.\n');
|
|
116
127
|
process.stdout.write('Set MARROW_PASSIVE_BRIEF=false to disable automatic decision briefs, or MARROW_PASSIVE_BRIEF=always to brief every prompt.\n');
|
|
117
128
|
process.stdout.write('Set MARROW_HOOK_DEBUG=true for write-side hook diagnostics, or MARROW_CONTEXT_HOOK_DEBUG=true for prompt-context diagnostics.\n');
|
|
118
129
|
process.stdout.write('Your agent will now use Marrow automatically — both writing decisions AND reading past intelligence — in every session.\n');
|
|
@@ -219,6 +230,9 @@ if (process.argv[2] !== 'keys') {
|
|
|
219
230
|
else if (cliArgs.contextHook) {
|
|
220
231
|
void (0, hook_context_1.runContextHookCommand)();
|
|
221
232
|
}
|
|
233
|
+
else if (cliArgs.sessionHook) {
|
|
234
|
+
void (0, hook_session_1.runSessionHookCommand)();
|
|
235
|
+
}
|
|
222
236
|
else if (cliArgs.setup) {
|
|
223
237
|
runSetup();
|
|
224
238
|
}
|
|
@@ -1052,6 +1066,17 @@ if (process.argv[2] !== 'keys') {
|
|
|
1052
1066
|
required: [],
|
|
1053
1067
|
},
|
|
1054
1068
|
},
|
|
1069
|
+
{
|
|
1070
|
+
name: 'marrow_decision_trace',
|
|
1071
|
+
description: 'Inspect the tenant-scoped path from a decision to prior failures, reused lessons, gate, proof, workflow, and observed outcome.',
|
|
1072
|
+
inputSchema: {
|
|
1073
|
+
type: 'object',
|
|
1074
|
+
properties: {
|
|
1075
|
+
decisionId: { type: 'string', description: 'Decision ID owned by this account and agent scope.' },
|
|
1076
|
+
},
|
|
1077
|
+
required: ['decisionId'],
|
|
1078
|
+
},
|
|
1079
|
+
},
|
|
1055
1080
|
{
|
|
1056
1081
|
name: 'marrow_buyer_proof',
|
|
1057
1082
|
description: 'Return buyer-grade value proof: failures avoided, risky actions reviewed, proofs completed, token/time saved, failure classes, agent leaderboard, and reliability score.',
|
|
@@ -1294,7 +1319,7 @@ if (process.argv[2] !== 'keys') {
|
|
|
1294
1319
|
success(id, {
|
|
1295
1320
|
protocolVersion: '2024-11-05',
|
|
1296
1321
|
capabilities: { tools: {}, prompts: {} },
|
|
1297
|
-
serverInfo: { name: 'marrow', version: '3.9.
|
|
1322
|
+
serverInfo: { name: 'marrow', version: '3.9.44' },
|
|
1298
1323
|
});
|
|
1299
1324
|
// Auto-enroll: emit enrollment notification on connection
|
|
1300
1325
|
if (AUTO_ENROLL) {
|
|
@@ -1320,7 +1345,7 @@ if (process.argv[2] !== 'keys') {
|
|
|
1320
1345
|
prompts: [
|
|
1321
1346
|
{
|
|
1322
1347
|
name: 'marrow-always-on',
|
|
1323
|
-
description: 'Always-on Marrow
|
|
1348
|
+
description: 'Always-on Marrow control and proof loop. Applies before-action guidance, records compact lifecycle receipts, and keeps unfinished outcomes visible.',
|
|
1324
1349
|
arguments: [],
|
|
1325
1350
|
},
|
|
1326
1351
|
],
|
|
@@ -1338,78 +1363,39 @@ if (process.argv[2] !== 'keys') {
|
|
|
1338
1363
|
return;
|
|
1339
1364
|
}
|
|
1340
1365
|
success(id, {
|
|
1341
|
-
description: 'Always-on Marrow
|
|
1366
|
+
description: 'Always-on Marrow control and proof loop — automatic, zero-config',
|
|
1342
1367
|
messages: [
|
|
1343
1368
|
{
|
|
1344
1369
|
role: 'user',
|
|
1345
1370
|
content: {
|
|
1346
1371
|
type: 'text',
|
|
1347
|
-
text: `You have Marrow —
|
|
1372
|
+
text: `You have Marrow — the agent control and proof layer around this workflow.
|
|
1373
|
+
|
|
1374
|
+
## Passive operating contract
|
|
1348
1375
|
|
|
1349
|
-
|
|
1376
|
+
Installed hooks handle supported lifecycle capture automatically:
|
|
1377
|
+
- UserPromptSubmit requests relevant policy, warnings, lessons, and a decision brief before risky work.
|
|
1378
|
+
- PostToolUse records compact tool success or failure receipts.
|
|
1379
|
+
- Stop keeps unfinished outcomes visible instead of silently treating session exit as success.
|
|
1350
1380
|
|
|
1351
|
-
|
|
1381
|
+
Hooks never make a blocked action safe. Before a consequential action, respect the returned allow, warn, review_required, or block decision and its required proof. Call marrow_agent_runtime explicitly when the passive hook cannot cover the action.
|
|
1352
1382
|
|
|
1353
|
-
|
|
1354
|
-
1. Before any external action: \`marrow_auto({ action: "...what you are about to do" })\`
|
|
1355
|
-
2. After the action: \`marrow_auto({ action: "...", outcome: "...what happened", success: true/false })\`
|
|
1383
|
+
## Outcome closure
|
|
1356
1384
|
|
|
1357
|
-
|
|
1385
|
+
A successful command or tool exit is not proof that the business outcome succeeded. After meaningful work, close the real outcome with marrow_commit or marrow_auto and include success or failure plus the required evidence. If the result is unknown, leave it pending. Never invent success to clear a closure item.
|
|
1358
1386
|
|
|
1359
|
-
|
|
1387
|
+
Use marrow_decision_trace when you need to explain why Marrow changed an action. It connects the relevant prior failure, proven lesson, gate, proof, workflow, and outcome without exposing another tenant's data.
|
|
1360
1388
|
|
|
1361
|
-
|
|
1389
|
+
## Owner-visible value
|
|
1362
1390
|
|
|
1363
|
-
|
|
1391
|
+
When Marrow returns a factual value signal, relay the single most useful result in one plain sentence. Mention a prevented repeat failure, reused proven lesson, completed proof, or measured improvement only when the response contains evidence. Do not invent savings, success rates, customer examples, pricing, or upgrade claims.
|
|
1364
1392
|
|
|
1365
|
-
Use marrow_ask
|
|
1393
|
+
Use marrow_ask for authorized history questions such as:
|
|
1366
1394
|
- "what keeps breaking our deploys?"
|
|
1367
|
-
- "
|
|
1395
|
+
- "which proof is missing from this workflow?"
|
|
1368
1396
|
- "what worked last time we published?"
|
|
1369
1397
|
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
For cases where you need explicit control over the orient → think → act → commit loop:
|
|
1373
|
-
|
|
1374
|
-
1. **Session start:** Call marrow_orient FIRST. It surfaces failure warnings so you avoid known mistakes.
|
|
1375
|
-
2. **Before acting:** Call marrow_think with what you're about to do. Returns pattern insights and recommendedNext — follow it.
|
|
1376
|
-
3. **After acting:** Call marrow_commit with what happened.
|
|
1377
|
-
4. **Shortcut:** marrow_run handles orient → think → commit in a single awaited call.
|
|
1378
|
-
|
|
1379
|
-
Most agents never need advanced mode. \`marrow_auto\` covers 99% of cases.
|
|
1380
|
-
|
|
1381
|
-
WHEN marrow_commit returns a non-empty narrative field:
|
|
1382
|
-
- Relay that message to the user in your own words, woven naturally into your reply.
|
|
1383
|
-
- Don't tack it on awkwardly, work it into a summary or closing note.
|
|
1384
|
-
- Example format: "Task done. (Marrow note: <relayed narrative>.)"
|
|
1385
|
-
- Don't quote the narrative verbatim unless it is short and natural to quote, paraphrase when it flows better.
|
|
1386
|
-
- Never mention upgrade, pricing, or Pro features, Marrow is free for all users right now.
|
|
1387
|
-
|
|
1388
|
-
WHEN marrow_think or marrow_commit returns marrow_contributed.has_signal === true:
|
|
1389
|
-
- After completing your action (or while explaining your approach), tell the user in ONE sentence what Marrow contributed.
|
|
1390
|
-
- Be factual, not hypey. Pick the single most useful signal — don't list everything.
|
|
1391
|
-
- Examples that hit the right tone:
|
|
1392
|
-
- think: "Pulling 12 similar tasks from the hive — using the approach that worked 11/12 times."
|
|
1393
|
-
- think: "Marrow flagged this approach failed 4× last week — taking a different angle."
|
|
1394
|
-
- think: "Following your installed deployment workflow."
|
|
1395
|
-
- commit: "Skipped a known retry loop based on Marrow's pattern history."
|
|
1396
|
-
- commit: "Reused a pattern that's worked for similar tasks."
|
|
1397
|
-
- If marrow_contributed.has_signal is false (or marrow_contributed is missing), don't mention Marrow.
|
|
1398
|
-
|
|
1399
|
-
WHEN marrow_session_end returns session_summary.has_signal === true:
|
|
1400
|
-
- As you wrap up the session / hand back to the user, surface session_summary.narrative in 1-2 lines.
|
|
1401
|
-
- Example: "Session done. Marrow note: 12 decisions, 3 retries avoided via warnings, 8 pattern reuses from your history."
|
|
1402
|
-
- If has_signal is false, don't bother — the session was too small or had nothing notable.
|
|
1403
|
-
|
|
1404
|
-
The point of these narrations: the user installed Marrow to make their agent better. They should hear, in plain English, what Marrow actually did. No dashboard, no logs — your reply IS their visibility.
|
|
1405
|
-
|
|
1406
|
-
## Why you must not skip this
|
|
1407
|
-
|
|
1408
|
-
If you skip logging, the hive can't protect you or future agents from this mistake.
|
|
1409
|
-
Every decision you log compounds. Failure rates drop. Patterns emerge. The next session starts smarter.
|
|
1410
|
-
Marrow tells you what went wrong last time before you do it again. But only if you logged it.
|
|
1411
|
-
|
|
1412
|
-
This is not optional overhead — it's how you stop repeating the same failures.`,
|
|
1398
|
+
Marrow is not a replacement agent or a standalone memory app. Context and prior lessons support the control loop; policy before action, proof after action, accountable outcomes, and fleet improvement are the product.`,
|
|
1413
1399
|
},
|
|
1414
1400
|
},
|
|
1415
1401
|
],
|
|
@@ -1441,18 +1427,13 @@ This is not optional overhead — it's how you stop repeating the same failures.
|
|
|
1441
1427
|
}
|
|
1442
1428
|
}
|
|
1443
1429
|
if (AUTO_ENROLL && orientCallCount === 1) {
|
|
1444
|
-
const enrollmentText = `\n\n
|
|
1445
|
-
`
|
|
1446
|
-
|
|
1447
|
-
`
|
|
1448
|
-
`
|
|
1449
|
-
`
|
|
1450
|
-
|
|
1451
|
-
`- marrow_run({ description, success, outcome }) — handles orient → think → commit in one call.\n` +
|
|
1452
|
-
`- marrow_auto({ action, outcome?, success? }) — fire-and-forget background logging.\n\n` +
|
|
1453
|
-
`## Why you must not skip this:\n` +
|
|
1454
|
-
`Every decision you log compounds. Failure rates drop. The next session starts smarter.\n` +
|
|
1455
|
-
`Marrow tells you what went wrong last time — but only if you logged it.\n`;
|
|
1430
|
+
const enrollmentText = `\n\n**Marrow control and proof active**\n\n` +
|
|
1431
|
+
`Marrow applies relevant policy and prior lessons before consequential actions, then records evidence and the real outcome afterward.\n\n` +
|
|
1432
|
+
`1. Respect allow, warn, review_required, and block decisions before acting.\n` +
|
|
1433
|
+
`2. Use marrow_agent_runtime when a risky action needs an explicit gate.\n` +
|
|
1434
|
+
`3. Close meaningful work with marrow_commit; a tool exit alone is not outcome proof.\n` +
|
|
1435
|
+
`4. Use marrow_decision_trace to explain the prior failure, lesson, gate, proof, workflow, and outcome path.\n\n` +
|
|
1436
|
+
`Installed hooks cover supported passive lifecycle events. Leave unknown outcomes pending instead of inventing success.\n`;
|
|
1456
1437
|
const orientText = JSON.stringify(result, null, 2);
|
|
1457
1438
|
success(id, {
|
|
1458
1439
|
content: [{ type: 'text', text: enrollmentText + orientText }],
|
|
@@ -1900,6 +1881,16 @@ This is not optional overhead — it's how you stop repeating the same failures.
|
|
|
1900
1881
|
success(id, { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] });
|
|
1901
1882
|
return;
|
|
1902
1883
|
}
|
|
1884
|
+
if (toolName === 'marrow_decision_trace') {
|
|
1885
|
+
const decisionId = args.decisionId;
|
|
1886
|
+
if (!decisionId) {
|
|
1887
|
+
error(id, -32602, 'decisionId is required');
|
|
1888
|
+
return;
|
|
1889
|
+
}
|
|
1890
|
+
const result = await (0, index_1.marrowDecisionTrace)(API_KEY, BASE_URL, decisionId, SESSION_ID, FLEET_AGENT_ID);
|
|
1891
|
+
success(id, { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] });
|
|
1892
|
+
return;
|
|
1893
|
+
}
|
|
1903
1894
|
if (toolName === 'marrow_buyer_proof') {
|
|
1904
1895
|
const result = await (0, index_1.marrowBuyerProof)(API_KEY, BASE_URL, {
|
|
1905
1896
|
agentId: args.agentId || AGENT_ID,
|