@martinloop/mcp 0.5.6 → 0.5.8

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 (40) hide show
  1. package/README.md +137 -175
  2. package/dist/arcade/resource.js +20 -20
  3. package/dist/package-version.d.ts +1 -1
  4. package/dist/package-version.js +1 -1
  5. package/dist/resources.js +148 -160
  6. package/dist/server.js +192 -43
  7. package/dist/tools/execution-policy.js +1 -1
  8. package/dist/tools/get-status.d.ts +2 -4
  9. package/dist/tools/get-status.js +6 -3
  10. package/dist/tools/preflight.d.ts +1 -1
  11. package/dist/tools/run-loop.d.ts +1 -1
  12. package/dist/tools/run-loop.js +3 -1
  13. package/dist/tools/run-store.js +1 -1
  14. package/dist/tools/tool-support.d.ts +3 -2
  15. package/dist/tools/tool-support.js +9 -2
  16. package/dist/tools/workflow-governance.d.ts +1 -1
  17. package/dist/tools/workflow-governance.js +1 -1
  18. package/dist/vendor/adapters/openai-compatible.js +6 -6
  19. package/dist/vendor/adapters/verifier-only.js +1 -1
  20. package/dist/vendor/contracts/execution-policy.js +1 -1
  21. package/dist/vendor/contracts/exits.d.ts +1 -1
  22. package/dist/vendor/contracts/governance.d.ts +1 -1
  23. package/dist/vendor/contracts/index.d.ts +1 -1
  24. package/dist/vendor/contracts/index.js +1 -2
  25. package/dist/vendor/contracts/operator.d.ts +1 -1
  26. package/dist/vendor/contracts/operator.js +1 -2
  27. package/dist/vendor/core/compiler.d.ts +2 -2
  28. package/dist/vendor/core/compiler.js +3 -1
  29. package/dist/vendor/core/exits.js +9 -4
  30. package/dist/vendor/core/grounding.d.ts +1 -0
  31. package/dist/vendor/core/grounding.js +28 -1
  32. package/dist/vendor/core/index.d.ts +2 -2
  33. package/dist/vendor/core/index.js +29 -12
  34. package/dist/vendor/core/policy-compiler.js +17 -1
  35. package/dist/vendor/core/policy.d.ts +1 -1
  36. package/dist/vendor/core/policy.js +7 -5
  37. package/dist/vendor/presentation/motion.js +0 -4
  38. package/dist/workflow-state.js +1 -1
  39. package/package.json +95 -81
  40. package/server.json +21 -21
package/README.md CHANGED
@@ -1,175 +1,137 @@
1
- # @martinloop/mcp
2
-
3
- You give an AI agent a coding task. It runs. You get a bill.
4
-
5
- But did it actually work? Did it pass your tests? How much did it spend? What files did it touch? Did it loop 47 times trying the same broken approach?
6
-
7
- You don't know. And that's the problem.
8
-
9
- ## One system around the coding agent
10
-
11
- MartinLoop is the execution-control system around coding agents. The coding agent still performs the software work. MartinLoop connects the run from Definition of Done through preflight, control, verification, recovery evidence, receipts, and post-run analysis.
12
-
13
- ```text
14
- DEFINE -> PREFLIGHT -> CONTROL -> VERIFY -> RECOVER -> PROVE -> ANALYZE
15
- ```
16
-
17
- The product-level flow is **Definition of Done -> Controlled Run -> Verified Handoff**.
18
-
19
- Through MCP, compatible hosts can use the same MartinLoop lifecycle without giving up the host's own model selection. MartinLoop does not inject a hidden fallback model.
20
-
21
- For agent-readable product context see [`../../llms.txt`](../../llms.txt), [`../../llms-full.txt`](../../llms-full.txt), and [`../../docs/for-agents.md`](../../docs/for-agents.md).
22
-
23
- ## What This Does
24
-
25
- MartinLoop governs AI coding-agent execution. You define what the run needs to accomplish, set execution boundaries such as budget and verifier checks, and let the configured coding agent do the work inside that contract.
26
-
27
- When it's done, you get a receipt — not a vague summary, but a structured record: dollars spent when available, attempts made, verification results, files changed, recovery state, and what the available evidence established.
28
-
29
- The final governed outcome is one of:
30
-
31
- - `VERIFIED` when the configured evidence supports the Definition of Done
32
- - `STOPPED` when a configured hard boundary ends the run
33
- - `NEEDS REVIEW` when completion cannot be established from the available evidence
34
-
35
- **One line to connect it:**
36
-
37
- ```sh
38
- claude mcp add martin-loop -- npx -y @martinloop/mcp
39
- ```
40
-
41
- That's it. Your host can now use MartinLoop's governed run and evidence surfaces.
42
-
43
- ## Real Numbers From Real Runs
44
-
45
- We tested this against live repos with real API spend:
46
-
47
- | What happened | Without MartinLoop | With MartinLoop |
48
- |---|---|---|
49
- | Budget: $1.50 task | Agent spent **$28.42** | Agent stopped at **$1.20** |
50
- | Failing verifier | Retried indefinitely | Stopped after 3 attempts with diagnosis |
51
- | CLI not on PATH | "not available on PATH" (dead stop) | Auto-discovered in AppData, kept running |
52
- | `bun run lint && bun run test` | Passed `&&` as a literal arg (always fails) | Routed through shell, worked |
53
-
54
- These aren't hypotheticals. The $28 overshoot happened in production testing. We fixed the circuit breaker in `0.3.8`.
55
-
56
- ## Install
57
-
58
- ### Claude Code
59
- ```sh
60
- claude mcp add martin-loop -- npx -y @martinloop/mcp@0.5.5
61
- ```
62
-
63
- Windows:
64
- ```sh
65
- claude mcp add --transport stdio --scope user martin-loop -- cmd /c npx -y @martinloop/mcp@0.5.5
66
- ```
67
-
68
- ### Codex
69
- ```sh
70
- codex mcp add martin-loop -- npx -y @martinloop/mcp@0.5.5
71
- ```
72
-
73
- ### Gemini CLI
74
- ```sh
75
- gemini mcp add martin-loop -- npx -y @martinloop/mcp@0.5.5
76
- ```
77
-
78
- ### Any MCP Host
79
- ```sh
80
- npx -y @martinloop/mcp@0.5.5
81
- ```
82
-
83
- ## How a Governed Run Works
84
-
85
- ```
86
- You: "Fix the auth bug. Budget $3. Verify: npm test"
87
-
88
- martin_doctor → checks CLI, auth, environment
89
- martin_plan → scopes the task, sets constraints
90
- martin_preflight → validates before any spend
91
- martin_run → agent works inside budget + verifier gates
92
- martin_dossier → receipt: spend, attempts, verifier evidence, final outcome
93
- ```
94
-
95
- Every attempt can be checked by your configured verifier. Budget and policy controls stay attached to the run. If the agent drifts off-task, the scope contract can block the change. If a hard spend boundary is reached, the run stops according to policy instead of silently retrying forever.
96
-
97
- ## What Your Agent Gets
98
-
99
- ### MCP Tools
100
-
101
- The exact tool set is discoverable from the running MCP server with `tools/list`; do not rely on a hard-coded count in documentation.
102
-
103
- **Run the loop:**
104
- `martin_doctor` `martin_plan` `martin_preflight` `martin_run` `martin_pause` `martin_continue` `martin_cancel`
105
-
106
- **Inspect results:**
107
- `martin_status` `martin_logs` `martin_dossier` `martin_eval` `martin_inspect` `martin_list_runs` `martin_get_run` `martin_get_attempt` `martin_get_verification_results` `martin_triage_runs`
108
-
109
- **Ship the work:**
110
- `martin_pr_summary` `martin_create_pr` `martin_review_pr`
111
-
112
- ### Read-Only Resources
113
-
114
- The exact resource set is discoverable from the running MCP server; this documentation names the primary public resources without treating a count as a release invariant.
115
-
116
- Your agent can pull context without side effects:
117
-
118
- `martin://runs/latest` · `martin://runs/latest/proof-card` · `martin://runs/latest/budget-status` · `martin://runs/latest/verifier-evidence` · `martin://runs/recent` · `martin://server/health` · `martin://policies/current` · `martin://agent/next-step` · `martin://guides/mcp-usage` · `martin://guides/agent-start` · `martin://repo/risk-map`
119
-
120
- ### Configuration Profiles
121
-
122
- Generate host config tuned to your workflow:
123
-
124
- ```sh
125
- npx martin-loop mcp print-config --host claude --profile minimal # run + inspect
126
- npx martin-loop mcp print-config --host claude --profile diagnostic # + doctor + triage
127
- npx martin-loop mcp print-config --host claude --profile full-local # all local tools
128
- npx martin-loop mcp print-config --host claude --profile github-review # + PR workflow
129
- ```
130
-
131
- ## What Happens When Things Go Wrong
132
-
133
- MartinLoop does not round failure into success. It preserves the evidence and follows the configured recovery path while budget and policy still allow useful work.
134
-
135
- | Failure | Old behavior | Now |
136
- |---|---|---|
137
- | CLI not on PATH | Error message, dead stop | Searches npm global, homebrew, nvm, scoop — uses what it finds |
138
- | Verifier says "command not found" | Generic "verification failed" | Carries specific failure context into the next allowed attempt |
139
- | `git restore` fails mid-rollback | Throws, leaves dirty state | Retries once, falls back to `git checkout`, cleans up |
140
- | Invalid `--profile` flag | Crashes | Warns, falls back to `minimal`, keeps running |
141
-
142
- ## Codex compatibility in 0.5.5
143
-
144
- MartinLoop no longer assumes one Codex host or one fixed Codex flag set. The CLI resolves the exact Codex executable, reads its advertised capabilities, negotiates a supported write strategy, proves that strategy before reporting launch readiness, and reuses the same contract for the governed run.
145
-
146
- That means MCP hosts can point MartinLoop at different Codex installations without requiring a documentation-specific approval or sandbox flag to exist everywhere.
147
-
148
- ## Presentation and evidence
149
-
150
- MCP responses are Markdown-first for humans while retaining structured content for agents and automation. The presentation layer does not rewrite governed truth.
151
-
152
- MartinLoop Arcade is a terminal-only experience. It does not run inside MCP and cannot influence MCP evidence, budgets, verification, or final outcomes.
153
-
154
- ## Who Uses This
155
-
156
- - **Engineers running overnight agent loops** — you need a kill switch that actually works, and a receipt in the morning
157
- - **Teams with shared API budgets** — you need per-task spend caps, not org-wide prayer
158
- - **Anyone reviewing agent-generated PRs** — the dossier shows what the agent tried, what passed, and what didn't
159
- - **Teams tired of stitching together point tools** — you want one execution-control lifecycle around coding-agent work from preflight through post-run analysis
160
-
161
- ## Requirements
162
-
163
- - Node.js 20+
164
- - One AI coding CLI: [Claude Code](https://docs.anthropic.com/claude-code), [Codex](https://github.com/openai/codex), or [Gemini CLI](https://github.com/google/gemini-cli)
165
-
166
- ## Links
167
-
168
- - [martin-loop](https://www.npmjs.com/package/martin-loop) — the standalone CLI
169
- - [MartinLoop for AI Agents](../../docs/for-agents.md)
170
- - [GitHub](https://github.com/Keesan12/martin-loop) — source and issues
171
- - [martinloop.com](https://martinloop.com)
172
-
173
- ## License
174
-
175
- Apache-2.0
1
+ # @martinloop/mcp
2
+
3
+ You give an AI agent a coding task. It runs. You get a bill.
4
+
5
+ But did it actually work? Did it pass your tests? How much did it spend? What files did it touch? Did it loop 47 times trying the same broken approach?
6
+
7
+ You don't know. And that's the problem.
8
+
9
+ ## What This Does
10
+
11
+ MartinLoop is a governed loop for AI coding agents. You tell it what to do, set a budget, and point it at your test suite. It runs the agent, checks your tests after every attempt, and stops when either the tests pass or the money runs out.
12
+
13
+ When it's done, you get a receipt — not a vague summary, but a structured record: dollars spent, attempts made, verification results, files changed, and whether you got what you asked for.
14
+
15
+ **One line to connect it:**
16
+
17
+ ```sh
18
+ claude mcp add martin-loop -- npx -y @martinloop/mcp
19
+ ```
20
+
21
+ That's it. Your agent now runs governed.
22
+
23
+ ## Real Numbers From Real Runs
24
+
25
+ We tested this against live repos with real API spend:
26
+
27
+ | What happened | Without MartinLoop | With MartinLoop |
28
+ |---|---|---|
29
+ | Budget: $1.50 task | Agent spent **$28.42** | Agent stopped at **$1.20** |
30
+ | Failing verifier | Retried indefinitely | Stopped after 3 attempts with diagnosis |
31
+ | CLI not on PATH | "not available on PATH" (dead stop) | Auto-discovered in AppData, kept running |
32
+ | `bun run lint && bun run test` | Passed `&&` as a literal arg (always fails) | Routed through shell, worked |
33
+
34
+ These aren't hypotheticals. The $28 overshoot happened in production testing. We fixed the circuit breaker in `0.3.8`.
35
+
36
+ ## Install
37
+
38
+ ### Claude Code
39
+ ```sh
40
+ claude mcp add martin-loop -- npx -y @martinloop/mcp
41
+ ```
42
+
43
+ Windows:
44
+ ```sh
45
+ claude mcp add --transport stdio --scope user martin-loop -- cmd /c npx -y @martinloop/mcp
46
+ ```
47
+
48
+ ### Codex
49
+ ```sh
50
+ codex mcp add martin-loop -- npx -y @martinloop/mcp
51
+ ```
52
+
53
+ ### Gemini CLI
54
+ ```sh
55
+ gemini mcp add martin-loop -- npx -y @martinloop/mcp
56
+ ```
57
+
58
+ ### Any MCP Host
59
+ ```sh
60
+ npx -y @martinloop/mcp
61
+ ```
62
+
63
+ ## How a Governed Run Works
64
+
65
+ ```
66
+ You: "Fix the auth bug. Budget $3. Verify: npm test"
67
+
68
+ martin_doctor → checks CLI, auth, environment
69
+ martin_plan → scopes the task, sets constraints
70
+ martin_preflight → validates before any spend
71
+ martin_run → agent works inside budget + verifier gates
72
+ martin_dossier → receipt: $1.40 spent, 2 attempts, tests pass
73
+ ```
74
+
75
+ Every attempt runs your verifier. Every dollar is tracked. If the agent drifts off-task, the scope contract catches it. If it blows the budget, the circuit breaker kills the subprocess mid-stream — not after the bill arrives.
76
+
77
+ ## What Your Agent Gets
78
+
79
+ ### 21 Tools
80
+
81
+ **Run the loop:**
82
+ `martin_doctor` `martin_plan` `martin_preflight` `martin_run` `martin_pause` `martin_continue` `martin_cancel`
83
+
84
+ **Inspect results:**
85
+ `martin_status` `martin_logs` `martin_dossier` `martin_eval` `martin_inspect` `martin_list_runs` `martin_get_run` `martin_get_attempt` `martin_get_verification_results` `martin_triage_runs`
86
+
87
+ **Ship the work:**
88
+ `martin_pr_summary` `martin_create_pr` `martin_review_pr`
89
+
90
+ ### 11 Read-Only Resources
91
+
92
+ Your agent can pull context without side effects:
93
+
94
+ `martin://runs/latest` · `martin://runs/latest/proof-card` · `martin://runs/latest/budget-status` · `martin://runs/latest/verifier-evidence` · `martin://runs/recent` · `martin://server/health` · `martin://policies/current` · `martin://agent/next-step` · `martin://guides/mcp-usage` · `martin://guides/agent-start` · `martin://repo/risk-map`
95
+
96
+ ### Configuration Profiles
97
+
98
+ Generate host config tuned to your workflow:
99
+
100
+ ```sh
101
+ npx martin-loop mcp print-config --host claude --profile minimal # run + inspect
102
+ npx martin-loop mcp print-config --host claude --profile diagnostic # + doctor + triage
103
+ npx martin-loop mcp print-config --host claude --profile full-local # all local tools
104
+ npx martin-loop mcp print-config --host claude --profile github-review # + PR workflow
105
+ ```
106
+
107
+ ## What Happens When Things Go Wrong
108
+
109
+ MartinLoop doesn't just report failures — it tries to fix them:
110
+
111
+ | Failure | Old behavior | Now |
112
+ |---|---|---|
113
+ | CLI not on PATH | Error message, dead stop | Searches npm global, homebrew, nvm, scoop — uses what it finds |
114
+ | Verifier says "command not found" | Generic "verification failed" | Tells the next attempt: "bun is missing, install with `npm i -g bun`" |
115
+ | `git restore` fails mid-rollback | Throws, leaves dirty state | Retries once, falls back to `git checkout`, cleans up |
116
+ | Invalid `--profile` flag | Crashes | Warns, falls back to `minimal`, keeps running |
117
+
118
+ ## Who Uses This
119
+
120
+ - **Engineers running overnight agent loops** — you need a kill switch that actually works, and a receipt in the morning
121
+ - **Teams with shared API budgets** — you need per-task spend caps, not org-wide prayer
122
+ - **Anyone reviewing agent-generated PRs** — the dossier shows what the agent tried, what passed, and what didn't
123
+
124
+ ## Requirements
125
+
126
+ - Node.js 20+
127
+ - One AI coding CLI: [Claude Code](https://docs.anthropic.com/claude-code), [Codex](https://github.com/openai/codex), or [Gemini CLI](https://github.com/google/gemini-cli)
128
+
129
+ ## Links
130
+
131
+ - [martin-loop](https://www.npmjs.com/package/martin-loop) — the standalone CLI
132
+ - [GitHub](https://github.com/Keesan12/martin-loop) — source and issues
133
+ - [martinloop.com](https://martinloop.com)
134
+
135
+ ## License
136
+
137
+ Apache-2.0
@@ -1,24 +1,24 @@
1
1
  import { MARTIN_ARCADE_MIME_TYPE, MARTIN_ARCADE_RESOURCE_URI, supportsMartinArcadeApp } from "./capabilities.js";
2
- const ARCADE_APP_HTML = `<!doctype html>
3
- <html lang="en" data-martin-arcade-app>
4
- <head>
5
- <meta charset="utf-8">
6
- <meta name="viewport" content="width=device-width,initial-scale=1">
7
- <title>MartinLoop Arcade</title>
8
- <style>
9
- :root { color-scheme: light dark; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
10
- body { margin: 0; min-height: 100vh; display: grid; place-items: center; background: Canvas; color: CanvasText; }
11
- main { width: min(42rem, calc(100% - 2rem)); border: 1px solid currentColor; padding: 1.25rem; }
12
- p { line-height: 1.5; }
13
- </style>
14
- </head>
15
- <body>
16
- <main aria-labelledby="arcade-title">
17
- <h1 id="arcade-title">MartinLoop Arcade</h1>
18
- <p>Presentation only. Governed run status and outcomes remain authoritative in MartinLoop.</p>
19
- <p aria-live="polite" data-run-status>Waiting for authoritative run evidence.</p>
20
- </main>
21
- </body>
2
+ const ARCADE_APP_HTML = `<!doctype html>
3
+ <html lang="en" data-martin-arcade-app>
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1">
7
+ <title>MartinLoop Arcade</title>
8
+ <style>
9
+ :root { color-scheme: light dark; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
10
+ body { margin: 0; min-height: 100vh; display: grid; place-items: center; background: Canvas; color: CanvasText; }
11
+ main { width: min(42rem, calc(100% - 2rem)); border: 1px solid currentColor; padding: 1.25rem; }
12
+ p { line-height: 1.5; }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <main aria-labelledby="arcade-title">
17
+ <h1 id="arcade-title">MartinLoop Arcade</h1>
18
+ <p>Presentation only. Governed run status and outcomes remain authoritative in MartinLoop.</p>
19
+ <p aria-live="polite" data-run-status>Waiting for authoritative run evidence.</p>
20
+ </main>
21
+ </body>
22
22
  </html>`;
23
23
  export function listArcadeResources(capabilities) {
24
24
  return {
@@ -1 +1 @@
1
- export declare const MARTIN_MCP_PACKAGE_VERSION = "0.5.6";
1
+ export declare const MARTIN_MCP_PACKAGE_VERSION = "0.5.8";
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by build — do not edit by hand.
2
2
  // Source of truth: packages/mcp/package.json#version
3
- export const MARTIN_MCP_PACKAGE_VERSION = "0.5.6";
3
+ export const MARTIN_MCP_PACKAGE_VERSION = "0.5.8";