@getmarrow/mcp 3.9.42 → 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 CHANGED
@@ -1,768 +1,181 @@
1
1
  # @getmarrow/mcp
2
2
 
3
- > **Governance, proof, and decision intelligence for MCP-compatible agent fleets.**
3
+ > MCP-native runtime control, proof, and fleet intelligence for AI agents.
4
4
 
5
- ![npm](https://img.shields.io/npm/v/@getmarrow/mcp)
6
- ![npm](https://img.shields.io/npm/dw/@getmarrow/mcp)
7
- ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@getmarrow/mcp)
8
- ![GitHub](https://img.shields.io/github/license/getmarrow/marrow-mcp)
9
- ![TypeScript](https://img.shields.io/badge/TypeScript-5.3%2B-blue)
10
- ![Node.js](https://img.shields.io/badge/Node.js-18%2B-green)
5
+ Marrow is the runtime control and proof layer for teams running AI agents. It applies policy and prior lessons before consequential actions, then records the evidence and outcome afterward.
11
6
 
12
- Marrow gives your agent a governance loop that compounds.
7
+ Use `@getmarrow/mcp` when your agent client supports the Model Context Protocol and you want Marrow available inside the agent's normal workflow. It works with Claude Code, Claude Desktop, Cursor and other MCP-compatible clients without replacing the model or harness.
13
8
 
14
- With `@getmarrow/mcp`, any MCP-compatible client can ask Marrow before risky work, inspect live loop state during work, collect required proof, and commit outcomes when the work is done. That means your agent stops operating without accountability and starts carrying forward real decision history.
15
-
16
- **Your agent stops repeating the same mistakes. It learns from prior sessions, authorized fleet history, and sanitized shared signals while staying inside proof, policy, and tenant boundaries.**
17
-
18
- ## Trust and Data Boundaries
19
-
20
- Marrow is tenant-aware by design. Private account, fleet, workflow, proof-pack, and agent data stays scoped to the authenticated account and authorized agent-bound keys.
21
-
22
- Enterprise tenants receive a strong private governance baseline from day one: risk gates, proof requirements, workflow templates, private/account learning, and exact next actions. Teams that enable sanitized aggregate contribution unlock richer k-anonymous collective workflow guidance. Contribution never means raw prompts, decisions, proof packs, code, secrets, account identifiers, agent identifiers, or customer identities.
23
-
24
- For business pilots, review the live trust notes before production rollout: https://getmarrow.ai/docs#trust-boundaries
25
-
26
- ## What's New in v3.9.40
27
-
28
- v3.9.40 adds MCP tools for Marrow's governance-control layer.
29
-
30
- - `marrow_governance_control_plane` returns Marrow's cross-harness control-plane contract.
31
- - `marrow_hermes_integration` maps Hermes `/goal`, verification evidence, `/learn`, `/journey`, and background subagents into Marrow proof/outcome workflows.
32
- - `marrow_completion_contracts` lists built-in proof contracts for deploy, merge, publish, migration, security, support, and Hermes goal workflows.
33
- - `marrow_evaluate_completion_contract` checks whether an agent has enough proof to mark work complete.
34
- - `marrow_governance_timeline` returns a fleet journey timeline across decisions, gates, and proof packs.
35
- - `marrow_buyer_proof` returns owner/procurement-ready value proof: failures avoided, risky actions reviewed, proofs completed, token/time saved, failure classes, and reliability score.
36
-
37
- ---
38
-
39
- ## Current Backend Surfaces
40
-
41
- The Marrow API also exposes two agent-facing surfaces that help MCP clients and operators verify whether passive capture is producing useful fleet data:
42
-
43
- - `GET /v1/agent/data-quality` returns an authenticated attribution scorecard for the current account or bound agent, including `agent_id`, `source_meta`, harness/client, workflow type, outcome closure, and non-trivial data coverage.
44
- - `GET /v1/agent/integrations/{client}` returns a per-harness setup guide for supported clients such as Codex, Claude Code, Cursor, Composer, Windsurf, Cline, OpenCode, Hermes, OpenClaw, Gemini, Grok, DeepSeek, Qwen, Kimi, MiniMax, GLM, MCP clients, CI runners, and custom harnesses.
45
-
46
- These endpoints are protected by Marrow API-key or agent-bound-key auth and are documented in the source-of-truth docs at [getmarrow.ai/docs](https://getmarrow.ai/docs/).
47
-
48
- ---
49
-
50
- ## Start Here
51
-
52
- For most agents and new users, start with the universal installer:
9
+ ## Install
53
10
 
54
11
  ```bash
55
- npx @getmarrow/install --yes
56
- ```
57
-
58
- The installer detects your MCP client, agent instructions, Node project, and runtime surfaces, then wires the safest passive setup automatically.
59
- It now also includes a governed runner: `npx @getmarrow/install run --agent <agent-id> -- <command>`, which gives MCP and non-MCP agents the same pre-action Marrow risk gate and automatic outcome closure for existing shell, deploy, publish, merge, and migration commands.
60
- MCP clients can also call `marrow_first_value` to show the first five-minute proof payload directly inside the agent.
61
-
62
- Use this MCP package directly when you want manual MCP server/hook setup for Claude Code, Claude Desktop, Cursor, or another MCP-compatible client. Use `@getmarrow/sdk` when you are building a custom Node/TypeScript integration in code.
63
-
64
- ## Auto-Logging
65
-
66
- Marrow auto-logs at three layers — transparent to your agent, invisible to you:
67
-
68
- | Layer | How | Agent effort |
69
- |-------|-----|-------------|
70
- | Server-side | Every authenticated API call auto-logged as a decision | Zero |
71
- | Governed runner | `npx @getmarrow/install run --agent <id> -- <command>` — pre-action gate + outcome proof around existing commands | Minimal |
72
- | SDK | `marrow.think()` / `marrow.commit()` — explicit control | Minimal |
73
- | MCP hooks | `npx @getmarrow/mcp setup` — PostToolUse + UserPromptSubmit hooks | Zero |
74
-
75
- **Passive mode in action:** Run `npx @getmarrow/mcp setup` once. Every tool call your agent makes (Bash, file edits, MCP calls) is auto-logged in the background. Marrow intelligence is auto-injected into your agent's context. Fail-silent, 2-second timeout, never blocks your prompt.
76
-
77
- Disable: `MARROW_AUTO_HOOK=false`. Debug: `MARROW_HOOK_DEBUG=true`.
78
-
79
- ---
80
-
81
- ## Improvement Since Onboarding
82
-
83
- `marrow_dashboard` and `marrow_digest` now return an `improvement` block comparing your agents' current performance against their day-1 baseline — a frozen snapshot of the first week of activity. Baseline captures automatically once an account reaches 7 days OR 20 decisions (whichever first).
84
-
85
- Four measured deltas, all from real decision data:
86
-
87
- - `attempts_per_success` — baseline week vs current week
88
- - `time_to_success_seconds` — median think → successful commit
89
- - `drift_rate` — % of decisions without a matching prior pattern
90
- - `success_rate` — baseline vs current outcome fraction
91
-
92
- Sample response:
93
-
94
- ```json
95
- {
96
- "improvement": {
97
- "status": "active",
98
- "days_since_baseline": 20,
99
- "decisions_since_baseline": 2124,
100
- "baseline_captured_at": "2026-04-23T15:07:41.919Z",
101
- "trigger_reason": "time_7d",
102
- "time_to_success_seconds": { "baseline": 244, "current": 24, "delta_pct": -90.16 }
103
- }
104
- }
105
- ```
106
-
107
- Accounts with <7 days of activity AND <20 decisions get an onboarding payload showing days/decisions until baseline fires. Token-value proof is also available now: MCP agents can call `marrow_model_usage` or attach `model_usage` to `marrow_commit` so Marrow reports observed model calls, tokens, estimated savings, trend direction, and top models without storing raw prompts or completions.
108
-
109
- ---
110
-
111
- ## What's New in v3.9.37
112
-
113
- v3.9.37 adds MCP token-value proof status parity.
114
-
115
- - `marrow_model_usage` records compact provider/model token counts through `/v1/agent/model-usage`.
116
- - `marrow_commit` accepts optional `model_usage` and returns `token_value_signal` from the backend.
117
- - `marrow_runtime_status` calls `/v1/agent/status?fast=1` for live passive hook, token-capture, outcome-closure, and exact repair-command diagnostics.
118
- - Token usage data is counts and labels only: provider, model, input/output/cached/total tokens, cost, latency, outcome linkage, and optional saved-token estimates.
119
- - Do not send raw prompts, completions, tool logs, secrets, or customer content.
120
-
121
- ## What's New in v3.9.33
122
-
123
- v3.9.33 adds MCP tools for adaptive governance recommendations and explicit policy profiles, while keeping the enterprise readiness contract documented for business pilots.
124
-
125
- - `marrow_mode_recommend` returns an explainable `passive`, `pilot`, or `enforce` recommendation for the current project/workflow.
126
- - `marrow_policy_profiles` lists saved account policy profiles, including the default business starter profile.
127
- - `marrow_create_policy_profile` creates or updates explicit rules such as local=passive, staging=pilot, production deploys=enforce.
128
- - `marrow_assign_project_policy_profile` binds an active profile to a project key so future resolves use it automatically.
129
- - `marrow_policy_resolve` resolves the current workflow mode from saved policy profiles, falling back to recommendation.
130
- - Marrow does not silently auto-switch modes. The agent/user must accept or override the recommendation.
131
- - MCP agents can call `GET /v1/agent/enterprise-readiness?agents=20` when an owner asks whether Marrow is ready for a fleet rollout.
132
- - The response is owner-safe and covers tenant isolation, data boundaries, fail behavior, policy controls, scale proof, and a 30-day pilot package.
133
- - The source-of-truth docs include the enterprise trust and scale readiness page at [getmarrow.ai/docs](https://getmarrow.ai/docs/).
134
-
135
- ```json
136
- {
137
- "project": {
138
- "name": "agent-api",
139
- "type": "node",
140
- "frameworks": ["edge-service"],
141
- "signals": ["package_json", "platform_config", "github_actions"]
142
- },
143
- "workflow": {
144
- "action": "deploy production service",
145
- "type": "deploy",
146
- "environment": "production"
147
- }
148
- }
149
- ```
150
-
151
- ## What's New in v3.9.42
152
-
153
- v3.9.42 adds typed adaptive capacity instructions to the MCP runtime contract.
154
-
155
- - `marrow_agent_runtime` now types `capacity_guidance` with capacity state, cache duration, recommended batch size, retry delay, safe parallelism, and polling guidance.
156
- - Passive hooks can keep low-risk work moving with bounded cached guidance while requiring a fresh gate and proof for high-risk actions.
157
- - The field is additive and remains compatible with existing MCP setup and outcome-closure hooks.
158
-
159
- Business value: MCP-compatible fleets get explicit backpressure behavior from Marrow instead of hard-coded retry guesses in every agent.
160
-
161
- ## Previous Release Notes
162
-
163
- ### v3.9.31
164
-
165
- v3.9.31 is a docs-sync release. It keeps npm and GitHub README copy aligned with Marrow's current backend-first runtime contract and proof/gate enforcement loop. Runtime behavior is unchanged from v3.9.30.
166
-
167
- v3.9.30 brings MCP tools and passive prompt hooks up to Marrow's current backend-first runtime contract and proof/gate enforcement loop:
168
-
169
- - UserPromptSubmit context now prefers `intervention.agent_copy`, so agents see the strongest `before you act` instruction before legacy runtime text.
170
- - `marrow_agent_runtime` types now expose `intervention`, `runtime_contract`, `risk_gate_event`, and `behavior_governance` for `/v1/agent/runtime`.
171
- - MCP now supports the backend-first contracts `marrow.before-action-intervention.v1` and `agent-runtime-contract.v3`.
172
- - `marrow_commit` exposes `proof`, `gate_receipt_id`, `action`, `surfaces`, and `auto_gate` fields for gated work.
173
- - MCP commit paths preserve the same fleet agent identity used by `marrow_think`, preventing agent-bound key commit mismatches.
174
- - `marrow_run` and `marrow_auto` attach standard proof packs when they close outcomes automatically.
175
-
176
- First-run value proof remains current:
177
-
178
- - `marrow_first_value` returns the five-minute proof payload: capture status, runtime gate, first useful lesson, value proof, and the exact try-this-now prompt.
179
- - UserPromptSubmit hook context still shows runtime interruption state, why Marrow is interrupting, required proof, and the quiet/noise policy.
180
- - Legacy `before_you_act_injection` types still expose `state`, `why_now`, `noise_policy`, `required_proof`, `missing_proof`, and `owner_approval_required`.
181
-
182
- Previous agent-native runtime behavior remains current:
183
-
184
- - UserPromptSubmit hooks call the one-call runtime by default, so agents receive status, risk gate, lessons, proof requirements, and exact next action before acting.
185
- - When Marrow marks `before_you_act_injection.must_use_before_action=true`, the prompt injection labels the Marrow action gate as required and tells the agent to stop if the lesson/proof cannot be applied.
186
- - `marrow_agent_runtime` now includes structured `before_you_act_injection` data for fleet lessons and deployment playbooks.
187
- - PostToolUse continues to close outcomes automatically for successful and failed tool calls.
188
- - Degraded passive capture points agents to exact installer/MCP/SDK repair commands.
189
-
190
- ```json
191
- {
192
- "action": "deploy edge service to production",
193
- "type": "deploy",
194
- "surfaces": ["github", "deployment-platform", "production"]
195
- }
196
- ```
197
-
198
- Full feature history, examples, and API reference live at [getmarrow.ai/docs](https://getmarrow.ai/docs/).
199
-
200
- ---
201
-
202
- ### Gated Commit Proof
203
-
204
- For risky actions, call `marrow_agent_runtime` before acting and pass the receipt plus proof into `marrow_commit`:
205
-
206
- ```json
207
- {
208
- "decision_id": "...",
209
- "success": true,
210
- "outcome": "Deploy succeeded and production smoke passed",
211
- "gate_receipt_id": "runtime.gate_receipt.id",
212
- "proof": {
213
- "summary": "Production deploy completed",
214
- "checks": ["tests passed", "smoke passed"],
215
- "outcome": "success",
216
- "blockers": "none",
217
- "commits_prs_shas": "abc123",
218
- "rollback_target": "previous release version",
219
- "handoff_result_file": "/tmp/marrow-handoffs/release/result.md",
220
- "deployment_and_smoke": "production smoke passed"
221
- }
222
- }
223
- ```
224
-
225
- If you provide `action` and omit `gate_receipt_id`, `marrow_commit` can fetch a matching runtime gate receipt automatically.
226
-
227
- ## Human-Directed Attribution Status
228
-
229
- The Marrow API supports privacy-preserving provenance fields on direct `POST /v1/decisions` calls: `source_kind`, `human_directed`, `source_confidence`, `instruction_ref`, `instruction_hash`, and `source_meta`. These fields classify instruction source class without identifying the human or storing raw prompts/PII.
230
-
231
- MCP tools and passive hooks now attach structured attribution by default. Marrow sends `X-Marrow-Agent-Id` when `MARROW_FLEET_AGENT_ID` or `MARROW_AGENT_ID` is configured, and it fills `source_meta.channel`, `source_meta.client`, `source_meta.agent_id`, and `source_meta.user_intent` where safe. Set `MARROW_CLIENT`, `MARROW_HARNESS`, or `MARROW_AGENT_CLIENT` to one of the supported client labels (`codex`, `claude-code`, `cursor`, `gemini`, `grok`, `deepseek`, `qwen`, `kimi`, `minimax`, `cline`, `opencode`, `hermes`, `glm`, `openclaw`, `windsurf`, or `custom`) for cleaner per-harness reporting.
232
-
233
- ---
234
-
235
- ## Agent Value Report
236
-
237
- `marrow_value_report` lets MCP agents pull owner-ready proof of Marrow value without a dashboard. The existing passive hooks remain the default install path: `PostToolUse` logs meaningful tool outcomes and `UserPromptSubmit` injects relevant context plus decision briefs for risky prompts.
238
-
239
- ### Value Report Tool
240
-
241
- MCP tool: `marrow_value_report`.
242
-
243
- Use it when an agent needs to explain whether Marrow is active, useful, and improving the fleet.
244
-
245
- ```json
246
- {
247
- "period": "7d",
248
- "agentId": "jarvis-agent"
249
- }
250
- ```
251
-
252
- The response includes summary, decisions, success rate, saves, active agents, top risks, recommendations, and improvement data. It does not expose raw action, context, or outcome text.
253
-
254
- ### Passive Decision Briefs
255
-
256
- Agents no longer need to remember to call `marrow_decision_brief` for common deploy, publish, merge, audit, patch, secret, or production prompts. They still can call it explicitly when they need stronger control.
257
-
258
- ### Decision Brief Tool
259
-
260
- MCP tool: `marrow_decision_brief`.
261
-
262
- Use it before deploys, publishes, merges, audits, patches, secret changes, or production work. One call returns the agent's operating brief: risk, workflow/playbook steps, handoff requirements, freshness/source-of-truth checks, minimum verification checks, proof-pack fields, and next actions.
263
-
264
- ```json
265
- {
266
- "action": "publish SDK and MCP packages to npm and update docs",
267
- "type": "deploy",
268
- "role": "deploy",
269
- "surfaces": ["github", "npm", "docs", "production"]
270
- }
12
+ npx @getmarrow/mcp setup
271
13
  ```
272
14
 
273
- Marrow returns aggregated prior failure categories only. It does not expose raw action, context, or outcome text from past decisions.
274
-
275
- `marrow_decision_brief` is additive. It gives the pre-action operating brief, then the agent still logs intent with `marrow_think`/passive auto-logging and commits the verified outcome with `marrow_commit`.
276
-
277
- Passive decision briefs are enabled by default. Set `MARROW_PASSIVE_BRIEF=false` to disable them, or `MARROW_PASSIVE_BRIEF=always` to brief every prompt.
278
-
279
- ### Workflow Gate Tool
15
+ Set the key through trusted secret storage:
280
16
 
281
- MCP tool: `marrow_workflow_gate`.
282
-
283
- Use it before deploys, publishes, merges, DB migrations, key rotation, destructive commands, or production work.
284
-
285
- ```json
286
- {
287
- "action": "rotate deployment token and verify production",
288
- "riskTolerance": "medium",
289
- "requiresApproval": true
290
- }
17
+ ```bash
18
+ export MARROW_API_KEY=mrw_live_...
291
19
  ```
292
20
 
293
- The response returns `allow`, `warn`, `review_required`, or `block`, plus prior lessons and deployment playbooks when available.
294
-
295
- Passive value summaries are enabled by default in auto mode. Set `MARROW_PASSIVE_VALUE_SUMMARY=false` to disable them, or `MARROW_PASSIVE_VALUE_SUMMARY=always` to include them on every prompt hook.
296
-
297
- Full feature history, examples, and API reference live at [getmarrow.ai/docs](https://getmarrow.ai/docs/).
298
-
299
- ---
300
-
301
- ## Agent-Narrated Marrow Contribution
302
-
303
- Marrow now tells the agent exactly what it contributed to each decision, so the agent can surface that contribution to the user in plain English — no dashboard required.
304
-
305
- Three new fields:
306
-
307
- - `marrow_think` returns `marrow_contributed` describing what intelligence Marrow surfaced for this decision (warnings consulted, shared patterns, similar decisions, workflow templates, loop detection, collective insight).
308
- - `marrow_commit` returns `marrow_contributed` describing concrete signals on the commit itself (pattern reused, warning avoided, workflow step).
309
- - `marrow_session_end` returns `session_summary` aggregating Marrow's contribution across the session, plus a one-line `narrative` for the agent to surface as it wraps up.
310
-
311
- Each object includes `has_signal: boolean` — when true, the agent narrates Marrow's role in 1 sentence; when false, it stays quiet. The built-in `marrow-always-on` system prompt now instructs agents on tone and timing for these narrations.
312
-
313
- Sample think response:
21
+ Then configure the MCP server:
314
22
 
315
23
  ```json
316
24
  {
317
- "decision_id": "...",
318
- "intelligence": { "...": "..." },
319
- "marrow_contributed": {
320
- "warnings_consulted": 2,
321
- "hive_patterns_surfaced": 12,
322
- "similar_decisions_found": 8,
323
- "workflow_templates_available": 1,
324
- "loop_detected": false,
325
- "collective_intelligence": true,
326
- "team_context_present": false,
327
- "has_signal": true
25
+ "mcpServers": {
26
+ "marrow": {
27
+ "command": "npx",
28
+ "args": ["-y", "@getmarrow/mcp"]
29
+ }
328
30
  }
329
31
  }
330
32
  ```
331
33
 
332
- The user installed Marrow to make their agent better. They should hear, in plain English, what Marrow actually did. Their agent's reply IS the dashboard.
333
-
334
- ---
335
-
336
- ## Agent-Narrated Milestones
337
-
338
- `marrow_commit` returns a `narrative` field. When a milestone fires (first commit, baseline capture, decision 100/500/1000/5000, weekly recap), the backend returns a human-readable string the agent relays to the user. Otherwise it returns `null`.
339
-
340
- ```json
341
- {
342
- "committed": true,
343
- "narrative": "Baseline captured. Your first-week averages: 42s per task, 1.3 attempts per success."
344
- }
345
- ```
346
-
347
- Narratives are aggregated metrics only — no user data, no decision content, no heuristics.
348
-
349
- ---
350
-
351
- ## Velocity Metrics
352
-
353
- `marrow_dashboard` and `marrow_digest` include three measured velocity metrics:
354
-
355
- - `attempts_per_success` — avg decisions before an agent lands a success
356
- - `time_to_success_seconds` — median seconds from `marrow_think` to successful `marrow_commit`
357
- - `drift_rate` — % of decisions that didn't link to a known pattern
358
-
359
- Each reports `{current, previous, delta_pct, direction}` so operators see whether agents are trending toward or away from improvement.
360
-
361
- All metrics are computed from real decision data — no estimates, no heuristics.
362
-
363
- ---
364
-
365
- ## Passive Mode
366
-
367
- Running `npx @getmarrow/mcp setup` installs a PostToolUse hook into `.claude/settings.json`. After setup, every tool call your agent makes (Bash, file edits, MCP calls) is auto-logged to Marrow in the background — no agent discipline required.
368
-
369
- Disable via: `MARROW_AUTO_HOOK=false`
370
-
371
- For troubleshooting hook behavior, set `MARROW_HOOK_DEBUG=true` to re-enable one-line stderr diagnostics.
372
-
373
- PostToolUse now marks automatic outcome closure explicitly. Successful tool calls commit success, tool errors commit failure, and `/v1/agent/status` can tell the agent whether the outcome hook is missing. If status is degraded, run `npx @getmarrow/install --yes` or `npx @getmarrow/mcp setup` to repair passive capture.
374
-
375
- MCP write paths now keep a bounded in-process retry queue for temporary network/server failures on `think` and `commit`. Auth failures, policy blocks, proof-pack failures, and validation errors are not retried blindly; status returns exact failure reasons and fix commands instead.
376
-
377
- **Operator visibility + auto-intelligence tools.**
378
-
379
- ## Operator Tools
380
-
381
- ### marrow_dashboard
382
-
383
- Operator dashboard in one call. Account health, top failures, workflow status, recent activity, Marrow's saves metric. Now includes velocity metrics (see v3.3.0 section above).
384
-
385
- ### marrow_digest
386
-
387
- Periodic summary with success rate trend vs previous period. Optional `period` parameter (default `7d`). Now includes velocity summary (see v3.3.0 section above).
388
-
389
- ### marrow_agent_status
390
-
391
- Agent-native proof that Marrow is connected and collecting useful signal. Optional `period` and `agentId` parameters; when omitted, the tool filters by `MARROW_AGENT_ID`. Returns `active`, `state`, `signals`, `quality`, `proof`, `failure_reasons`, `agent_warnings`, `diagnostics`, and `next_actions` without exposing raw decision text. Common failure reasons include `missing_key`, `invalid_key`, `wrong_agent_id`, `network_blocked`, and `proof_required`.
392
-
393
- ### marrow_decision_brief
394
-
395
- One pre-action call before meaningful work. Returns `risk`, `workflow`, `handoff`, `freshness`, `quality`, `role_playbook`, `failure_alerts`, `proof_pack`, `source_of_truth`, `fleet_reliability`, and `next_actions`.
396
-
397
- Use this before risky work so the agent does not need to stitch together multiple backend calls. It does not replace outcome logging.
398
-
399
- ### marrow_session_end
400
-
401
- Explicitly end a session and optionally auto-commit any open decision. Prevents orphaned decisions.
402
-
403
- ### marrow_accept_detected
404
-
405
- Convert a detected recurring pattern into an enforced workflow. Pattern ID comes from `orient()` response's `suggested_workflows`.
406
-
407
- ## Intelligence Fields in marrow_think Response
408
-
409
- `marrow_think` surfaces three additional fields when the backend provides them:
410
- - `onboarding_hint` — contextual tip for new accounts
411
- - `intelligence.collective` — entitlement-gated, k-anonymous aggregate patterns when the tenant contributes sanitized aggregate signals and the minimum-account threshold is met
412
- - `curated_baseline_guidance` — strong private baseline guidance for private or non-contributing tenants
413
- - `intelligence.team_context` — recent decisions from other sessions in the same account, so multi-agent teams stay aware of each other's work
414
-
415
- ---
34
+ For most new installations, start with the universal installer instead:
416
35
 
417
- ## Available Templates
418
-
419
- 24 pre-built workflow templates across 8 industries. Browse via `marrow_list_templates` and install with `marrow_install_template`.
420
-
421
- - **Insurance (4):** `claims-triage`, `fraud-review`, `underwriting-decision`, `complaint-escalation`
422
- - **Healthcare (4):** `patient-triage`, `clinical-documentation`, `prior-authorization`, `coding-audit`
423
- - **E-commerce (3):** `order-fulfillment`, `refund-approval`, `return-processing`
424
- - **Legal (3):** `contract-review`, `case-triage`, `document-discovery`
425
- - **SaaS (6):** `code-review-deploy`, `incident-response`, `feature-rollout`, `ticket-triage`, `escalation-flow`, `lead-qualify`
426
- - **Fintech (2):** `etl-pipeline`, `approval-flow`
427
- - **Media (1):** `content-publish`
428
- - **Enterprise (1):** `change-management`
429
-
430
- Full catalog with descriptions: [https://getmarrow.ai/docs/#template-marketplace](https://getmarrow.ai/docs/#template-marketplace)
431
-
432
- ```
433
- marrow_list_templates({ industry: 'insurance' })
434
- marrow_install_template({ slug: 'claims-triage' })
36
+ ```bash
37
+ npx @getmarrow/install --yes
435
38
  ```
436
39
 
437
- ## Claude Code Compatibility
40
+ ## What's New in v3.9.44
438
41
 
439
- Marrow MCP works natively with Claude Code. The server runs as a long-running process and handles the full MCP protocol correctly.
42
+ v3.9.44 makes the MCP integration an always-on governance lifecycle rather than a prompt reminder:
440
43
 
441
- ## One-Command Agent Setup
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.
442
49
 
443
- Inject Marrow instructions directly into your project's `CLAUDE.md`:
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.
444
51
 
445
- ```bash
446
- npx @getmarrow/mcp setup
447
- ```
448
-
449
- After setup, your agent uses Marrow automatically every session, and Claude Code PostToolUse hooks auto-log tool calls in the background — no human prompting required.
52
+ ## Governed Action Flow
450
53
 
451
- ## Auto-Enroll by Default
452
- The `marrow-always-on` prompt is served to all MCP clients automatically. Set `MARROW_AUTO_ENROLL=false` to opt out.
54
+ Before deploys, merges, publishes, migrations, credential changes, financial operations, or customer-impacting work:
453
55
 
454
- ## Security Hardening
455
- - **Input validation** — all URL path parameters are sanitized to prevent path traversal
456
- - **SSRF protection** — `MARROW_BASE_URL` must use HTTPS
457
- - **Crash protection** — malformed JSON on stdin no longer kills the server
458
- - **Error handling** — proper error logging throughout
459
- - **HTTP status checking** — API errors return clear messages
56
+ 1. Call `marrow_agent_runtime` or `marrow_decision_brief`.
57
+ 2. Stop when the returned decision is `block` or `review_required`; otherwise follow its prior lesson and proof contract.
58
+ 3. Call `marrow_think` to record intent and obtain the `decision_id` that will be closed.
59
+ 4. Perform the action only when its gate allows it.
60
+ 5. Call `marrow_commit` with that `decision_id`, the outcome, gate receipt, and required proof.
460
61
 
461
- ### Auto-Warn on Orient
462
- The `marrow_orient` tool now accepts `autoWarn: true` and warns you BEFORE you start a task that recently failed:
62
+ Example pre-action request:
463
63
 
464
64
  ```json
465
65
  {
466
- "name": "marrow_orient",
66
+ "tool": "marrow_agent_runtime",
467
67
  "arguments": {
468
- "autoWarn": true,
469
- "task": "Fix authentication error"
68
+ "action": "deploy the production worker",
69
+ "type": "deploy",
70
+ "role": "deploy",
71
+ "surfaces": ["repository", "deployment", "production"]
470
72
  }
471
73
  }
472
74
  ```
473
75
 
474
- **Response includes warnings:**
475
- ```
476
- ⚠️ HIGH: This task type failed 4x with approach='retry-without-fix'.
477
- Try approach='apply-patch-first' (89% success rate)
478
- ```
479
-
480
- ### Loop Detection on Think
481
- The `marrow_think` tool now accepts `checkLoop: true` and detects if you're about to retry a failed approach:
76
+ Example closeout:
482
77
 
483
78
  ```json
484
79
  {
485
- "name": "marrow_think",
80
+ "tool": "marrow_think",
486
81
  "arguments": {
487
- "action": "Retry auth with method='internal'",
82
+ "action": "deploy the production worker",
83
+ "type": "process",
488
84
  "checkLoop": true
489
85
  }
490
86
  }
491
87
  ```
492
88
 
493
- **Response includes loop warnings:**
494
- ```
495
- 🚨 LOOP DETECTED: You're retrying a failed approach.
496
- Previous failure: 'retry-without-fix' approach not supported.
497
- Suggested: Use 'apply-patch-first' approach instead.
498
- ```
499
-
500
- ### Rate Limiting
501
- - `marrow_orient`: 30 requests/minute per account
502
- - `marrow_think`: 60 requests/minute per account
503
- - Automatic 429 responses when limit exceeded
504
-
505
- ### Enhanced PII Protection
506
- - Automatic stripping of emails, phone numbers, API keys from all responses
507
- - Applied to `recentLessons`, `warnings`, and `outcome` fields
508
- - Deep object stripping for complex data structures
509
-
510
- ---
511
-
512
- ## The Problem
513
-
514
- Most agents still operate with shallow governance.
515
-
516
- They might keep a short context window, maybe write a note or two, then lose the important part:
517
- - what they were trying to do
518
- - what they actually did
519
- - whether it worked
520
- - what pattern that should teach the next run
521
-
522
- That creates a familiar failure loop:
523
- - the same mistakes repeat
524
- - work gets marked done without structured outcome proof
525
- - agents drift between sessions
526
- - hosts have no clean way to inspect whether the work loop is actually closed
527
-
528
- **Marrow fixes this.**
529
-
530
- Through MCP, your agent can:
531
- - orient at session start
532
- - log intent before meaningful action
533
- - inspect loop state before handoff or completion
534
- - commit outcomes back to Marrow with proof cleanly
535
-
536
- ---
537
-
538
- ## How It Works
539
-
540
- Marrow exposes a simple operating loop through MCP:
541
-
542
- ```text
543
- orient -> think -> act -> check -> commit
544
- ```
545
-
546
- That gives agents an actual governance discipline:
547
- - **orient** → pick up recent lessons and current loop state
548
- - **think** → log intent and receive decision intelligence
549
- - **act** → perform the meaningful work
550
- - **check** → inspect whether the loop is still open or missing something
551
- - **commit** → log the outcome and close the loop
552
-
553
- The value compounds with use. Each decision your agent logs makes the fleet safer — failure rates drop, patterns emerge, proof requirements get clearer, and the next session starts with real intelligence instead of a blank slate. Teams running multiple agents see this compound fastest, but even a single agent builds meaningful history within a few sessions.
554
-
555
- ---
556
-
557
- ## Install
558
-
559
- Default path for new users:
560
-
561
- ```bash
562
- npx @getmarrow/install --yes
563
- ```
564
-
565
- Manual MCP path for MCP-native clients:
566
-
567
- ### Quick Start (Claude Code)
568
-
569
- ```bash
570
- # 1. Add the MCP server
571
- claude mcp add marrow -e MARROW_API_KEY="$MARROW_API_KEY" -- npx @getmarrow/mcp
572
-
573
- # 2. Set up auto-enrollment (agent uses Marrow automatically)
574
- npx @getmarrow/mcp setup
575
- ```
576
-
577
- That's it. Your agent will use Marrow automatically in every session.
578
-
579
- ### Manual Setup
580
-
581
- Run it directly with `npx`:
582
-
583
- ```bash
584
- MARROW_API_KEY="$MARROW_API_KEY" npx @getmarrow/mcp
585
- ```
586
-
587
- Or register it in your MCP client config using environment variables or your client's secret storage. Avoid putting API keys in command arguments or static config files.
588
-
589
- ---
590
-
591
- ## MCP Tools
592
-
593
- ### Core Loop Tools
594
-
595
- #### `marrow_orient`
596
- **Call this first** at session start. Returns failure warnings from your history so you avoid known mistakes immediately.
597
-
598
- #### `marrow_think`
599
- Log intent before meaningful action. Returns pattern insights, similar past decisions, and a recommended next step.
600
-
601
- #### `marrow_commit`
602
- Log the outcome after acting. Closes the decision loop. Can include `model_usage` so Marrow returns token-value proof after work completes.
603
-
604
- #### `marrow_model_usage`
605
- Record compact model token/cost/latency counts when your harness exposes them. This powers token savings proof in `/v1/agent/value/proof` and owner reports.
606
-
607
- #### `marrow_run`
608
- Zero-ceremony wrapper. Handles orient → think → commit in a single call.
609
-
610
- #### `marrow_auto`
611
- Fire-and-forget logging. Pass what you're about to do (and optionally the outcome). Marrow handles everything in the background.
612
-
613
- ### Memory Management Tools
614
-
615
- #### `marrow_list_memories`
616
- List memories with optional filters:
617
- - `status` — Filter by status (active, outdated, deleted)
618
- - `query` — Search query
619
- - `limit` — Max results
620
- - `agentId` — Include memories shared with this agent
621
-
622
- #### `marrow_get_memory`
623
- Get a single memory by ID.
624
-
625
- #### `marrow_update_memory`
626
- Update memory text, tags, or metadata.
627
-
628
- #### `marrow_delete_memory`
629
- Soft delete a memory.
630
-
631
- #### `marrow_mark_outdated`
632
- Mark a memory as outdated.
633
-
634
- #### `marrow_supersede_memory`
635
- Atomically replace a memory with a new version.
636
-
637
- #### `marrow_share_memory`
638
- Share a memory with specific agents.
639
-
640
- #### `marrow_export_memories`
641
- Export memories to JSON or CSV format.
642
-
643
- #### `marrow_import_memories`
644
- Import memories with merge (dedup) or replace mode.
645
-
646
- #### `marrow_retrieve_memories`
647
- Full-text search with filters:
648
- - `query` — Search query (required)
649
- - `limit` — Max results
650
- - `from` / `to` — Date range (ISO-8601)
651
- - `tags` — Comma-separated tags
652
- - `source` — Source filter
653
- - `status` — Status filter
654
- - `shared` — Include shared memories
655
-
656
- ### Query Tools
657
-
658
- #### `marrow_ask`
659
- Query the collective hive in plain English. Ask about failure patterns, what worked, what broke, or get a recommendation.
660
-
661
- #### `marrow_status`
662
- Check Marrow platform health and status.
663
-
664
- ---
665
-
666
- ## Claude Code Config
667
-
668
- ```bash
669
- claude mcp add marrow -e MARROW_API_KEY="$MARROW_API_KEY" -- npx @getmarrow/mcp
670
- ```
671
-
672
- ## Claude Desktop Config
673
-
674
89
  ```json
675
90
  {
676
- "mcpServers": {
677
- "marrow": {
678
- "command": "npx",
679
- "args": ["@getmarrow/mcp"],
680
- "env": {
681
- "MARROW_API_KEY": "${MARROW_API_KEY}"
682
- }
91
+ "tool": "marrow_commit",
92
+ "arguments": {
93
+ "decision_id": "decision_id returned by marrow_think",
94
+ "gate_receipt_id": "receipt id returned by marrow_agent_runtime",
95
+ "success": true,
96
+ "outcome": "Production deploy succeeded and smoke checks passed.",
97
+ "proof": {
98
+ "checks": ["tests passed", "secret scan passed", "production smoke passed"],
99
+ "rollback_target": "previous release"
683
100
  }
684
101
  }
685
102
  }
686
103
  ```
687
104
 
688
- ---
105
+ High-risk work can be allowed, warned, held for review, or blocked according to account policy. Low-risk work can use passive guidance and bounded cached state where the runtime contract permits it.
689
106
 
690
- ## Environment Variables
107
+ ## Passive Use
691
108
 
692
- | Variable | Required | Description |
693
- |----------|----------|-------------|
694
- | `MARROW_API_KEY` | Yes | Your API key from getmarrow.ai. Prefer environment variables or client secret storage. MCP also auto-loads `.marrow/env`, `.marrow/env.local`, `.env`, `.env.local`, `~/.marrow/env`, and `~/.marrow/env.local`. |
695
- | `MARROW_KEY` | No | Alias accepted by MCP for fleet runners and secret managers. |
696
- | `MARROW_BASE_URL` | No | Custom API URL (default: `https://api.getmarrow.ai`). Must use HTTPS. |
697
- | `MARROW_SESSION_ID` | No | Session identifier for multi-agent setups |
698
- | `MARROW_FLEET_AGENT_ID` | No | Agent identifier sent as `X-Marrow-Agent-Id` for fleet attribution |
699
- | `MARROW_CLIENT` / `MARROW_HARNESS` / `MARROW_AGENT_CLIENT` | No | Harness/client label used for per-client reporting, such as `codex`, `claude-code`, `cursor`, `gemini`, `qwen`, `opencode`, or `custom` |
700
- | `MARROW_AUTO_ENROLL` | No | Auto-enrollment prompt (default: `true`). Set to `false` to disable. |
701
- | `MARROW_AUTO_HOOK` | No | PostToolUse auto-logging kill switch. Set to `false` to disable the hook without editing settings. |
702
- | `MARROW_PASSIVE_BRIEF` | No | Passive decision-brief mode for the prompt hook. Defaults to `auto`; set `false` to disable or `always` to brief every prompt. |
703
- | `MARROW_HOOK_DEBUG` | No | When set to `true`, write-side and prompt-context hooks emit one-line stderr diagnostics. |
704
- | `MARROW_CONTEXT_HOOK_DEBUG` | No | When set to `true`, only the UserPromptSubmit context hook emits one-line stderr diagnostics. |
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.
705
110
 
706
- If hooks are installed but no decisions are being logged, run:
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.
707
112
 
708
- ```bash
709
- npx @getmarrow/install doctor
710
- ```
113
+ Check the installed runtime:
711
114
 
712
- Deep doctor with harmless write/outcome verification:
713
-
714
- ```bash
715
- MARROW_API_KEY=<your_marrow_key> npx @getmarrow/install doctor --self-test
115
+ ```text
116
+ marrow_agent_status
716
117
  ```
717
118
 
718
- Healthy output should confirm `key valid: yes`, `account active: yes`, `agent identity accepted: yes`, `write test event: passed`, and `outcome closed: passed`. If it fails, Marrow returns the exact reason and fix command.
119
+ Status diagnostics distinguish missing keys, invalid keys, wrong bound-agent identity, network limits, missing hooks, and incomplete proof. They include an exact repair action without exposing secrets.
719
120
 
720
- Stable project-local key file:
121
+ ## Primary MCP Tools
721
122
 
722
- ```bash
723
- mkdir -p .marrow
724
- printf "MARROW_API_KEY=<your_marrow_key>\\n" > .marrow/env
725
- chmod 600 .marrow/env
726
- npx @getmarrow/mcp setup
727
- ```
123
+ | Tool | Purpose |
124
+ | --- | --- |
125
+ | `marrow_agent_runtime` | One-call pre-action status, policy gate, relevant lessons, proof requirements, and exact next action |
126
+ | `marrow_decision_brief` | Compact operating brief for meaningful work |
127
+ | `marrow_think` | Record intent and retrieve relevant governance intelligence |
128
+ | `marrow_commit` | Close an action with outcome, receipt, and proof |
129
+ | `marrow_workflow_gate` | Evaluate a workflow action against policy |
130
+ | `marrow_completion_contracts` | List proof contracts for consequential action types |
131
+ | `marrow_evaluate_completion_contract` | Check whether evidence is sufficient to call work complete |
132
+ | `marrow_agent_status` | Verify capture, identity, outcome coverage, and hook health |
133
+ | `marrow_value_report` | Return account/agent value evidence without requiring a dashboard |
134
+ | `marrow_buyer_proof` | Return owner-ready governance and reliability evidence |
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 |
137
+ | `marrow_fleet_lessons` | Retrieve proven lessons authorized for the current account or agent |
138
+ | `marrow_model_usage` | Record compact token, cost, and latency counts when the harness exposes them |
728
139
 
729
- ---
140
+ The package also exposes key management, fleet handoff, deployment history, adaptive policy, context/lesson, query, and workflow-example tools. See the [complete source-of-truth documentation](https://getmarrow.ai/docs/) for every tool and field.
730
141
 
731
- ## The Always-On Prompt
142
+ ## Context and Workflow Examples
732
143
 
733
- Marrow includes a built-in prompt called `marrow-always-on` that instructs agents to use Marrow automatically. It's served by default — no configuration needed.
144
+ The stable `marrow_*memory*` tools manage authorized context and prior lessons used by governance decisions. They are advanced supporting APIs, not a separate product category.
734
145
 
735
- **To use:** In your MCP client, request the `marrow-always-on` prompt and include it in your system instructions. For Claude Code, run `npx @getmarrow/mcp setup` instead — it handles this automatically.
146
+ The template tools expose 24 configurable workflow examples. They are starting points for policy design, not customer case studies, regulatory validation, legal advice, or proof of production use in each listed industry.
736
147
 
737
- ---
148
+ ## Trust and Data Boundaries
149
+
150
+ - Private account, fleet, workflow, proof, and agent data remains tenant-scoped by default.
151
+ - Agent-bound keys can be restricted to an allowed identity and permission set.
152
+ - Sanitized aggregate contribution is optional and never means sharing raw prompts, code, secrets, proof packs, account identifiers, agent identifiers, or customer identities.
153
+ - Existing API keys are never returned after creation; key material should be supplied through the client's secret store.
154
+ - Marrow returns guidance and policy data. Agents must not execute returned text as shell input.
738
155
 
739
- ## Why This Matters
156
+ See the [Trust Center](https://getmarrow.ai/trust/) for implemented controls, current limits, and roadmap status.
740
157
 
741
- Without Marrow:
742
- - Agents repeat the same failures session after session
743
- - Successful patterns get lost when the context window clears
744
- - There's no structured trail of what was tried and what worked
745
- - Every new session starts from zero
158
+ ## Environment
746
159
 
747
- With Marrow:
748
- - Failure patterns surface before you repeat them
749
- - Successful outcomes compound across sessions
750
- - Every decision has a trail: intent → action → outcome
751
- - The hive gets smarter with every logged decision
160
+ | Variable | Required | Purpose |
161
+ | --- | --- | --- |
162
+ | `MARROW_API_KEY` | Yes | Account or agent-bound API key |
163
+ | `MARROW_BASE_URL` | No | API base override |
164
+ | `MARROW_AGENT_ID` | No | Bound agent identity for MCP tools |
165
+ | `MARROW_FLEET_AGENT_ID` | No | Fleet agent identity used by passive setup |
752
166
 
753
- **Marrow tells you what went wrong last time before you do it again.**
167
+ ## Documentation
754
168
 
755
- ---
169
+ - [Source-of-truth docs](https://getmarrow.ai/docs/)
170
+ - [Trust Center](https://getmarrow.ai/trust/)
171
+ - [Status](https://getmarrow.ai/status/)
172
+ - [GitHub](https://github.com/getmarrow/marrow-mcp)
756
173
 
757
174
  ## License
758
175
 
759
176
  MIT
760
177
 
761
- ---
762
-
763
178
  ## Related Packages
764
179
 
765
- - **[@getmarrow/install](https://www.npmjs.com/package/@getmarrow/install)** — Default front door for new users. Detects local agent/runtime surfaces, writes safe config, runs self-tests, and reports first-value proof.
766
- - **[@getmarrow/sdk](https://www.npmjs.com/package/@getmarrow/sdk)** — TypeScript/Node.js SDK for programmatic access to Marrow. Use this for custom agent integrations outside of MCP.
767
-
768
- **📖 Full API reference with all endpoints:** [https://getmarrow.ai/docs/#api-reference](https://getmarrow.ai/docs/#api-reference)
180
+ - [@getmarrow/install](https://www.npmjs.com/package/@getmarrow/install) - default installer, self-test, governed runner, and operator TUI
181
+ - [@getmarrow/sdk](https://www.npmjs.com/package/@getmarrow/sdk) - Node.js and TypeScript integration for owned agent runtimes