@martinloop/mcp 0.2.5 → 0.2.7

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 (44) hide show
  1. package/README.md +101 -138
  2. package/dist/discovery-metadata.d.ts +10 -5
  3. package/dist/discovery-metadata.js +95 -5
  4. package/dist/package-version.d.ts +1 -1
  5. package/dist/package-version.js +1 -1
  6. package/dist/prompts.js +93 -1
  7. package/dist/resources.d.ts +8 -0
  8. package/dist/resources.js +245 -14
  9. package/dist/server-validation.d.ts +1 -1
  10. package/dist/server-validation.js +116 -0
  11. package/dist/server.js +361 -3
  12. package/dist/tools/doctor.d.ts +2 -0
  13. package/dist/tools/doctor.js +6 -2
  14. package/dist/tools/eval.d.ts +24 -0
  15. package/dist/tools/eval.js +65 -0
  16. package/dist/tools/get-status.d.ts +8 -0
  17. package/dist/tools/get-status.js +18 -0
  18. package/dist/tools/logs.d.ts +25 -0
  19. package/dist/tools/logs.js +49 -0
  20. package/dist/tools/plan.d.ts +20 -0
  21. package/dist/tools/plan.js +10 -0
  22. package/dist/tools/pr-tools.d.ts +31 -0
  23. package/dist/tools/pr-tools.js +111 -0
  24. package/dist/tools/preflight.d.ts +10 -0
  25. package/dist/tools/preflight.js +11 -2
  26. package/dist/tools/run-controls.d.ts +36 -0
  27. package/dist/tools/run-controls.js +88 -0
  28. package/dist/tools/run-dossier.d.ts +14 -0
  29. package/dist/tools/run-dossier.js +61 -1
  30. package/dist/tools/run-loop.js +21 -2
  31. package/dist/tools/tool-errors.d.ts +1 -1
  32. package/dist/tools/tool-support.js +28 -1
  33. package/dist/tools/workflow-governance.d.ts +133 -0
  34. package/dist/tools/workflow-governance.js +581 -0
  35. package/dist/vendor/adapters/cli-bridge.d.ts +5 -0
  36. package/dist/vendor/adapters/cli-bridge.js +16 -8
  37. package/dist/vendor/adapters/index.d.ts +2 -1
  38. package/dist/vendor/adapters/index.js +2 -0
  39. package/dist/vendor/adapters/openai-compatible.d.ts +47 -0
  40. package/dist/vendor/adapters/openai-compatible.js +242 -0
  41. package/dist/workflow-state.d.ts +25 -0
  42. package/dist/workflow-state.js +102 -0
  43. package/package.json +3 -3
  44. package/server.json +2 -2
package/README.md CHANGED
@@ -1,56 +1,132 @@
1
1
  # @martinloop/mcp
2
2
 
3
- Governed execution cockpit for AI coding agents over MCP stdio.
3
+ Governed MCP server for AI coding agents with budgets, receipts, and review-ready evidence.
4
4
 
5
- The standalone `@martinloop/mcp` release train is documented through `0.1.4`, `0.2.0`, and the later `0.2.5` stable cockpit line. It gives hosts one bounded execution entrypoint, rich read-only inspection tools, discoverable resources, run triage, and operator prompts on top of Martin Loop’s persisted run records.
5
+ `@martinloop/mcp` is the standalone MartinLoop server for MCP hosts. It stays local-first and stdio-first, and it gives hosts one clear execution path: check readiness, plan the work, preflight the contract, run it, and inspect the result with enough evidence to decide what happens next.
6
6
 
7
- This package stays local-first and stdio-first in public packaging today.
7
+ The root `martin-loop` package and the standalone `@martinloop/mcp` package move on separate version lines. For the current root release, see [MartinLoop 0.2.8 release notes](../../docs/release/OSS-0.2.8-RELEASE-NOTES.md).
8
8
 
9
- For host-facing guidance, see [MCP for AI Agents](https://github.com/Keesan12/martin-loop/blob/main/docs/oss/MCP-FOR-AI-AGENTS.md).
9
+ ## What is new in 0.2.7
10
10
 
11
- ## Public Release Train
11
+ - better onboarding inside MCP, including guide resources for command mapping, IDE setup, and operating rules
12
+ - a stricter governed run sequence, so `martin_run` refuses to start until matching `martin_doctor`, `martin_plan`, and `martin_preflight` receipts exist for the same task
13
+ - cleaner review and handoff surfaces, especially around dossier, eval, and publish-readiness guidance
12
14
 
13
- - 0.1.4 operator foundation.
14
- - 0.2.0 cockpit expansion. 0.2.0 adds resources, resource templates, prompts, and read-only cockpit inspection.
15
- - 0.2.5 stable cockpit line with local triage and degraded run-store hardening.
15
+ If you are installing MartinLoop for the first time, start with the root CLI first:
16
16
 
17
- ## What Ships
17
+ ```sh
18
+ npx martin-loop start
19
+ npx martin-loop tour
20
+ npx martin-loop doctor
21
+ ```
22
+
23
+ ## Install
24
+
25
+ Run the packaged server directly:
26
+
27
+ ```sh
28
+ npx -y @martinloop/mcp
29
+ ```
30
+
31
+ Add it to Codex:
32
+
33
+ ```sh
34
+ codex mcp add martin-loop -- npx -y @martinloop/mcp
35
+ ```
36
+
37
+ Add it to Claude Code:
38
+
39
+ ```sh
40
+ claude mcp add --transport stdio --scope user martin-loop -- npx -y @martinloop/mcp
41
+ claude mcp add --transport stdio --scope user martin-loop -- cmd /c npx -y @martinloop/mcp
42
+ ```
43
+
44
+ Generate host config from the root CLI:
45
+
46
+ ```sh
47
+ npx martin-loop mcp print-config --host codex --transport stdio --profile minimal
48
+ npx martin-loop mcp print-config --host claude --transport stdio --profile diagnostic
49
+ npx martin-loop mcp print-config --host gemini --transport stdio --profile full-local
50
+ npx martin-loop mcp print-config --host generic --transport stdio --profile github-review
51
+ ```
52
+
53
+ Registry/server identifier: `io.github.Keesan12/martin-loop`
54
+
55
+ ## Recommended Flow
56
+
57
+ 1. `martin_doctor`
58
+ 2. `martin_plan`
59
+ 3. `martin_preflight`
60
+ 4. `martin_run`
61
+ 5. `martin_status` or `martin_logs`
62
+ 6. `martin_dossier` or the `martin_get_*` tools
63
+ 7. `martin_eval`
64
+ 8. `martin_pr_summary` or `martin_review_pr` when a host is preparing GitHub review output
18
65
 
19
- ### Tools
66
+ `martin_run` is the primary coding execution entrypoint. In `0.2.7`, it hard-blocks until the matching readiness, planning, and preflight receipts exist for the same task. That keeps the default flow honest for both humans and agents.
67
+
68
+ ## Profiles
69
+
70
+ - `minimal`: read-heavy default for safe host setup
71
+ - `diagnostic`: deeper inspection and evaluator support
72
+ - `full-local`: includes execution and run-control helpers for local workflows
73
+ - `github-review`: adds PR review helpers for GitHub-oriented hosts
74
+ - `starter` and `full`: compatibility aliases that map onto the same discovery surface
75
+
76
+ ## Tools
20
77
 
21
78
  - `martin_doctor`
79
+ - `martin_plan`
22
80
  - `martin_preflight`
23
81
  - `martin_run`
24
82
  - `martin_inspect`
25
83
  - `martin_status`
84
+ - `martin_logs`
85
+ - `martin_pause`
86
+ - `martin_cancel`
87
+ - `martin_continue`
26
88
  - `martin_list_runs`
27
89
  - `martin_triage_runs`
28
90
  - `martin_get_run`
29
91
  - `martin_get_attempt`
30
92
  - `martin_get_verification_results`
31
93
  - `martin_run_dossier`
94
+ - `martin_dossier`
95
+ - `martin_eval`
96
+ - `martin_pr_summary`
97
+ - `martin_create_pr`
98
+ - `martin_review_pr`
32
99
 
33
- ### Resources
100
+ ## Resources
34
101
 
35
102
  - `martin://server/health`
36
103
  - `martin://runs/recent`
37
104
  - `martin://runs/triage`
105
+ - `martin://runs/latest`
38
106
  - `martin://runs/latest/summary`
39
107
  - `martin://runs/latest/proof-card`
40
108
  - `martin://runs/latest/budget-status`
41
109
  - `martin://runs/latest/verifier-evidence`
42
110
  - `martin://runs/latest/rollback-evidence`
111
+ - `martin://policies/current`
112
+ - `martin://repo/risk-map`
113
+ - `martin://verifiers/results`
43
114
  - `martin://agent/next-step`
44
115
  - `martin://guides/mcp-usage`
116
+ - `martin://guides/agent-start`
117
+ - `martin://guides/command-map`
118
+ - `martin://guides/ide-onboarding`
119
+ - `martin://guides/operating-rules`
45
120
  - `martin://guides/publish-readiness`
46
121
 
47
- ### Resource templates
122
+ ## Resource Templates
48
123
 
49
124
  - `martin://runs/{loopId}`
125
+ - `martin://runs/{loopId}/dossier`
50
126
  - `martin://runs/{loopId}/attempts/{attemptIndex}`
51
127
  - `martin://runs/{loopId}/verification`
52
128
 
53
- ### Prompts
129
+ ## Prompts
54
130
 
55
131
  - `martin_start`
56
132
  - `martin_preflight`
@@ -62,119 +138,26 @@ For host-facing guidance, see [MCP for AI Agents](https://github.com/Keesan12/ma
62
138
  - `martin_debug_failed_run`
63
139
  - `martin_publish_readiness_review`
64
140
  - `martin_triage_run_store`
65
-
66
- ## Recommended Flow
67
-
68
- 1. `martin_doctor`
69
- 2. `martin_preflight`
70
- 3. `martin_run`
71
- 4. `martin_triage_runs`
72
- 5. `martin://agent/next-step` or `martin://runs/latest/summary`
73
- 6. `martin_run_dossier` or `martin_get_*` when compact evidence says the full record is needed
74
- 7. `martin://runs/latest/proof-card` or `martin_prove` for a shareable receipt
75
-
76
- ## Install
77
-
78
- Run the packaged server directly:
79
-
80
- ```sh
81
- npx -y @martinloop/mcp
82
- ```
83
-
84
- Add it to Codex:
85
-
86
- ```sh
87
- codex mcp add martin-loop -- npx -y @martinloop/mcp
88
- ```
89
-
90
- Add it to Claude Code:
91
-
92
- ```sh
93
- # macOS/Linux
94
- claude mcp add --transport stdio --scope user martin-loop -- npx -y @martinloop/mcp
95
-
96
- # Windows PowerShell or cmd.exe
97
- claude mcp add --transport stdio --scope user martin-loop -- cmd /c npx -y @martinloop/mcp
98
- ```
99
-
100
- Generate host config from the CLI when you want minimal, diagnostic, or full-local profiles:
101
-
102
- ```sh
103
- martin mcp print-config --host codex --transport stdio --profile minimal
104
- martin mcp print-config --host claude --transport stdio --profile diagnostic
105
- martin mcp print-config --host gemini --transport stdio --profile full-local
106
- ```
107
-
108
- `martin mcp install` supports the same host set and only writes when the target file is absent or already contains a Martin Loop block.
109
-
110
- Codex also supports `~/.codex/config.toml` and project-scoped `.codex/config.toml`:
111
-
112
- ```toml
113
- [mcp_servers."martin-loop"]
114
- command = "npx"
115
- args = ["-y", "@martinloop/mcp"]
116
- cwd = "C:\\path\\to\\repo"
117
- startup_timeout_sec = 20
118
- tool_timeout_sec = 180
119
- enabled_tools = [
120
- "martin_doctor",
121
- "martin_preflight",
122
- "martin_list_runs",
123
- "martin_triage_runs",
124
- "martin_run_dossier",
125
- ]
126
- env = { MARTIN_RUNS_DIR = "C:\\path\\to\\runs" }
127
- ```
128
-
129
- If you use `martin mcp install`, it will only write a starter host config when the target file is absent, or when it detects an existing Martin Loop block and can remain idempotent. Otherwise it refuses to overwrite mixed host config so you can merge safely.
130
-
131
- When `CODEX_HOME` is set, Codex user-scope installs target `CODEX_HOME\\config.toml` instead of the default user path.
132
-
133
- Registry/server identifier: `io.github.Keesan12/martin-loop`
134
-
135
- ## Host coverage
136
-
137
- - `codex`: local stdio profiles
138
- - `claude`: local, user, and project scopes
139
- - `gemini`: local `settings.json` snippets with `includeTools`
140
- - `generic`: JSON config for MCP-aware wrappers
141
-
142
- Operating-system launcher behavior is explicit:
143
-
144
- - Windows: `cmd /c npx -y @martinloop/mcp`
145
- - macOS/Linux: `npx -y @martinloop/mcp`
146
-
147
- Claude `--scope local` remains CLI-managed. `martin mcp install --host claude --scope local` shells out to Claude Code directly instead of fabricating a repo config file for that scope.
148
-
149
- ## Discovery metadata
150
-
151
- - JSON resources now carry `metadata.serverVersion` and `metadata.discoveryRevision`.
152
- - Environment-specific path details stay in `martin://server/health` instead of low-context discovery metadata.
153
- - Compact resources expose low-token latest-run summaries, proof cards, budget status, verifier evidence, rollback evidence, and a single recommended next step.
154
- - Prompts stamp the current server version and discovery revision into their descriptions so hosts can confirm which surface they discovered.
155
- - The server does **not** advertise `listChanged` yet. That is deliberate: the current discovery surface is stable and versioned, but it does not yet emit authoritative change notifications.
141
+ - `safe_bug_fix`
142
+ - `write_tests_first`
143
+ - `small_refactor`
144
+ - `security_review`
145
+ - `pr_review`
146
+ - `release_check`
156
147
 
157
148
  ## Runtime Model
158
149
 
159
- - `martin_run` is the only execution entrypoint.
160
- - All other Martin MCP tools are read-only.
150
+ - `martin_run` is the primary coding execution entrypoint.
151
+ - `martin_run` now blocks until the same task has matching `martin_doctor`, `martin_plan`, and `martin_preflight` receipts.
152
+ - `martin_plan`, `martin_doctor`, `martin_preflight`, `martin_status`, `martin_logs`, `martin_dossier`, `martin_eval`, and the `martin_get_*` family are planning or inspection surfaces.
153
+ - `martin_pause`, `martin_cancel`, `martin_continue`, and `martin_create_pr` are explicit follow-on control helpers and stay out of the default `minimal` profile.
161
154
  - Live runs require `claude` or `codex` on `PATH`.
162
155
  - Stub or smoke flows use `MARTIN_LIVE=false`.
163
156
  - Paths stay bounded to the configured workspace root and runs root.
164
- - Direct raw-model compatibility is not the target. Martin Loop supports hosts and wrappers that speak MCP; open-source model families such as Gemma or Nemotron should use the `generic` host path through an MCP-capable shell or runtime.
165
-
166
- ## Operator Notes
167
-
168
- - `martin_get_verification_results` only reports persisted verification evidence. If evidence is missing, it returns `unavailable` with warnings.
169
- - `martin_triage_runs` is the fastest way to decide which persisted run deserves attention first.
170
- - `martin://agent/next-step`, `martin://runs/latest/summary`, and `martin://runs/latest/proof-card` are the best default follow-ups for context-constrained agents.
171
- - `martin_run_dossier` is the richest single-run inspection surface and is best when a compact receipt says deeper evidence is needed.
172
- - Resources and prompts reuse the same run-store selectors as the tools; they are discovery surfaces, not a second data model.
173
- - The recommended host default is the `minimal` profile: `martin_doctor`, `martin_preflight`, `martin_list_runs`, `martin_triage_runs`, and `martin_run_dossier`. Use `diagnostic` for read-only archaeology and `full-local` only when the host should execute runs.
174
157
 
175
158
  ## Debugging
176
159
 
177
- Use the live handshake inspector before you blame the host:
160
+ Use the live handshake inspector before you blame a host config:
178
161
 
179
162
  ```sh
180
163
  pnpm --filter @martinloop/mcp inspect:live
@@ -186,10 +169,6 @@ If you want the official MCP Inspector UI, point it at the same stdio launch com
186
169
  npx @modelcontextprotocol/inspector --command npx --args "-y,@martinloop/mcp"
187
170
  ```
188
171
 
189
- The stdio server keeps protocol output on stdout and diagnostic logging on stderr. When a host integration goes sideways, confirm the live discovery surface first, then move on to the host config.
190
-
191
- For WSL or Linux validation, do a native install on that platform before you smoke the package. Reusing Windows-installed `node_modules` across WSL will fail on native dependencies such as `esbuild`, which looks like a transport failure but is really a cross-platform install mismatch.
192
-
193
172
  ## Verification
194
173
 
195
174
  From the repository root:
@@ -202,22 +181,6 @@ pnpm --filter @martinloop/mcp smoke:pack
202
181
  pnpm --filter @martinloop/mcp smoke:published:pack
203
182
  pnpm --filter @martinloop/mcp verify:release
204
183
  pnpm --filter @martin/cli verify:hosts:live
205
- pnpm --filter @martinloop/mcp smoke:published
206
- pnpm --filter @martinloop/mcp inspect:live
207
184
  ```
208
185
 
209
- - `smoke:pack` verifies the packed tarball and stdio launch path.
210
- - `smoke:published:pack` verifies install-and-run behavior from a freshly packed local tarball through the installed `mcp` bin before npm publish.
211
- - `verify:release` checks metadata parity, release-note presence, install docs, and discovery-surface claims.
212
- - `@martin/cli verify:hosts:live` proves the generated host config against the real Codex, Claude, and Gemini CLIs on this machine.
213
- - `smoke:published` remains a post-publish npm gate.
214
-
215
- ## Compatibility
216
-
217
- `0.2.5` is the current integrated governed execution cockpit line:
218
-
219
- - `martin_run`, `martin_inspect`, `martin_status`, `martin_doctor`, and `martin_preflight` remain backward-compatible.
220
- - New read-only surfaces are additive.
221
- - No new write-capable MCP tools are introduced in `0.2.5`.
222
-
223
- See `docs/release/MCP-COMPATIBILITY.md`, `docs/release/MCP-0.2.0-RELEASE-NOTES.md`, and `docs/release/MCP-0.2.5-RELEASE-NOTES.md` for the public release contract and delivery sequence.
186
+ See [MCP setup](../../docs/getting-started/mcp.md), [MCP tool reference](../../docs/reference/mcp-tools.md), and [MCP compatibility](../../docs/reference/mcp-compatibility.md).
@@ -1,8 +1,12 @@
1
- export declare const MARTIN_TOOL_NAMES: readonly ["martin_run", "martin_inspect", "martin_status", "martin_doctor", "martin_preflight", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_attempt", "martin_get_verification_results", "martin_run_dossier"];
2
- export declare const MARTIN_STARTER_TOOL_NAMES: readonly ["martin_doctor", "martin_preflight", "martin_run", "martin_triage_runs", "martin_run_dossier"];
3
- export declare const MARTIN_RESOURCE_URIS: readonly ["martin://server/health", "martin://runs/recent", "martin://runs/triage", "martin://guides/mcp-usage", "martin://guides/publish-readiness"];
4
- export declare const MARTIN_RESOURCE_TEMPLATE_URIS: readonly ["martin://runs/{loopId}", "martin://runs/{loopId}/attempts/{attemptIndex}", "martin://runs/{loopId}/verification"];
5
- export declare const MARTIN_PROMPT_NAMES: readonly ["martin_governed_coding_kickoff", "martin_debug_failed_run", "martin_publish_readiness_review", "martin_triage_run_store"];
1
+ export declare const MARTIN_TOOL_NAMES: readonly ["martin_run", "martin_inspect", "martin_status", "martin_doctor", "martin_plan", "martin_preflight", "martin_logs", "martin_pause", "martin_cancel", "martin_continue", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_attempt", "martin_get_verification_results", "martin_run_dossier", "martin_dossier", "martin_eval", "martin_pr_summary", "martin_create_pr", "martin_review_pr"];
2
+ export declare const MARTIN_STARTER_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_run", "martin_triage_runs", "martin_dossier"];
3
+ export declare const MARTIN_MINIMAL_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_list_runs", "martin_triage_runs", "martin_dossier"];
4
+ export declare const MARTIN_DIAGNOSTIC_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_logs", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_attempt", "martin_get_verification_results", "martin_dossier", "martin_eval"];
5
+ export declare const MARTIN_GITHUB_REVIEW_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_dossier", "martin_eval", "martin_pr_summary", "martin_create_pr", "martin_review_pr"];
6
+ export declare const MARTIN_PAID_REMOTE_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_run", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_verification_results", "martin_dossier", "martin_eval"];
7
+ export declare const MARTIN_RESOURCE_URIS: readonly ["martin://server/health", "martin://runs/recent", "martin://runs/triage", "martin://runs/latest", "martin://runs/latest/summary", "martin://runs/latest/proof-card", "martin://runs/latest/budget-status", "martin://runs/latest/verifier-evidence", "martin://runs/latest/rollback-evidence", "martin://policies/current", "martin://repo/risk-map", "martin://verifiers/results", "martin://agent/next-step", "martin://guides/mcp-usage", "martin://guides/agent-start", "martin://guides/command-map", "martin://guides/ide-onboarding", "martin://guides/operating-rules", "martin://guides/publish-readiness"];
8
+ export declare const MARTIN_RESOURCE_TEMPLATE_URIS: readonly ["martin://runs/{loopId}", "martin://runs/{loopId}/dossier", "martin://runs/{loopId}/attempts/{attemptIndex}", "martin://runs/{loopId}/verification"];
9
+ export declare const MARTIN_PROMPT_NAMES: readonly ["martin_start", "martin_preflight", "martin_triage", "martin_resume", "martin_prove", "martin_release_check", "martin_governed_coding_kickoff", "martin_debug_failed_run", "martin_publish_readiness_review", "martin_triage_run_store", "safe_bug_fix", "write_tests_first", "small_refactor", "security_review", "pr_review", "release_check"];
6
10
  export interface MartinDiscoveryMetadata {
7
11
  serverVersion: string;
8
12
  discoveryRevision: string;
@@ -12,5 +16,6 @@ export interface MartinDiscoveryMetadata {
12
16
  resourceTemplateCount: number;
13
17
  promptCount: number;
14
18
  starterTools: string[];
19
+ profiles: Record<string, string[]>;
15
20
  }
16
21
  export declare function buildMartinDiscoveryMetadata(serverVersion: string): MartinDiscoveryMetadata;
@@ -4,38 +4,119 @@ export const MARTIN_TOOL_NAMES = [
4
4
  "martin_inspect",
5
5
  "martin_status",
6
6
  "martin_doctor",
7
+ "martin_plan",
7
8
  "martin_preflight",
9
+ "martin_logs",
10
+ "martin_pause",
11
+ "martin_cancel",
12
+ "martin_continue",
8
13
  "martin_list_runs",
9
14
  "martin_triage_runs",
10
15
  "martin_get_run",
11
16
  "martin_get_attempt",
12
17
  "martin_get_verification_results",
13
- "martin_run_dossier"
18
+ "martin_run_dossier",
19
+ "martin_dossier",
20
+ "martin_eval",
21
+ "martin_pr_summary",
22
+ "martin_create_pr",
23
+ "martin_review_pr"
14
24
  ];
15
25
  export const MARTIN_STARTER_TOOL_NAMES = [
16
26
  "martin_doctor",
27
+ "martin_plan",
17
28
  "martin_preflight",
18
29
  "martin_run",
19
30
  "martin_triage_runs",
20
- "martin_run_dossier"
31
+ "martin_dossier"
32
+ ];
33
+ export const MARTIN_MINIMAL_TOOL_NAMES = [
34
+ "martin_doctor",
35
+ "martin_plan",
36
+ "martin_preflight",
37
+ "martin_list_runs",
38
+ "martin_triage_runs",
39
+ "martin_dossier"
40
+ ];
41
+ export const MARTIN_DIAGNOSTIC_TOOL_NAMES = [
42
+ "martin_doctor",
43
+ "martin_plan",
44
+ "martin_preflight",
45
+ "martin_logs",
46
+ "martin_list_runs",
47
+ "martin_triage_runs",
48
+ "martin_get_run",
49
+ "martin_get_attempt",
50
+ "martin_get_verification_results",
51
+ "martin_dossier",
52
+ "martin_eval"
53
+ ];
54
+ export const MARTIN_GITHUB_REVIEW_TOOL_NAMES = [
55
+ "martin_doctor",
56
+ "martin_plan",
57
+ "martin_preflight",
58
+ "martin_dossier",
59
+ "martin_eval",
60
+ "martin_pr_summary",
61
+ "martin_create_pr",
62
+ "martin_review_pr"
63
+ ];
64
+ export const MARTIN_PAID_REMOTE_TOOL_NAMES = [
65
+ "martin_doctor",
66
+ "martin_plan",
67
+ "martin_preflight",
68
+ "martin_run",
69
+ "martin_list_runs",
70
+ "martin_triage_runs",
71
+ "martin_get_run",
72
+ "martin_get_verification_results",
73
+ "martin_dossier",
74
+ "martin_eval"
21
75
  ];
22
76
  export const MARTIN_RESOURCE_URIS = [
23
77
  "martin://server/health",
24
78
  "martin://runs/recent",
25
79
  "martin://runs/triage",
80
+ "martin://runs/latest",
81
+ "martin://runs/latest/summary",
82
+ "martin://runs/latest/proof-card",
83
+ "martin://runs/latest/budget-status",
84
+ "martin://runs/latest/verifier-evidence",
85
+ "martin://runs/latest/rollback-evidence",
86
+ "martin://policies/current",
87
+ "martin://repo/risk-map",
88
+ "martin://verifiers/results",
89
+ "martin://agent/next-step",
26
90
  "martin://guides/mcp-usage",
91
+ "martin://guides/agent-start",
92
+ "martin://guides/command-map",
93
+ "martin://guides/ide-onboarding",
94
+ "martin://guides/operating-rules",
27
95
  "martin://guides/publish-readiness"
28
96
  ];
29
97
  export const MARTIN_RESOURCE_TEMPLATE_URIS = [
30
98
  "martin://runs/{loopId}",
99
+ "martin://runs/{loopId}/dossier",
31
100
  "martin://runs/{loopId}/attempts/{attemptIndex}",
32
101
  "martin://runs/{loopId}/verification"
33
102
  ];
34
103
  export const MARTIN_PROMPT_NAMES = [
104
+ "martin_start",
105
+ "martin_preflight",
106
+ "martin_triage",
107
+ "martin_resume",
108
+ "martin_prove",
109
+ "martin_release_check",
35
110
  "martin_governed_coding_kickoff",
36
111
  "martin_debug_failed_run",
37
112
  "martin_publish_readiness_review",
38
- "martin_triage_run_store"
113
+ "martin_triage_run_store",
114
+ "safe_bug_fix",
115
+ "write_tests_first",
116
+ "small_refactor",
117
+ "security_review",
118
+ "pr_review",
119
+ "release_check"
39
120
  ];
40
121
  export function buildMartinDiscoveryMetadata(serverVersion) {
41
122
  const surface = {
@@ -43,7 +124,15 @@ export function buildMartinDiscoveryMetadata(serverVersion) {
43
124
  resources: [...MARTIN_RESOURCE_URIS],
44
125
  resourceTemplates: [...MARTIN_RESOURCE_TEMPLATE_URIS],
45
126
  prompts: [...MARTIN_PROMPT_NAMES],
46
- starterTools: [...MARTIN_STARTER_TOOL_NAMES]
127
+ starterTools: [...MARTIN_STARTER_TOOL_NAMES],
128
+ profiles: {
129
+ minimal: [...MARTIN_MINIMAL_TOOL_NAMES],
130
+ diagnostic: [...MARTIN_DIAGNOSTIC_TOOL_NAMES],
131
+ "github-review": [...MARTIN_GITHUB_REVIEW_TOOL_NAMES],
132
+ "full-local": [...MARTIN_TOOL_NAMES],
133
+ starter: [...MARTIN_STARTER_TOOL_NAMES],
134
+ full: [...MARTIN_TOOL_NAMES]
135
+ }
47
136
  };
48
137
  const discoveryRevision = createHash("sha256")
49
138
  .update(JSON.stringify({ serverVersion, surface }))
@@ -57,6 +146,7 @@ export function buildMartinDiscoveryMetadata(serverVersion) {
57
146
  resourceCount: surface.resources.length,
58
147
  resourceTemplateCount: surface.resourceTemplates.length,
59
148
  promptCount: surface.prompts.length,
60
- starterTools: [...surface.starterTools]
149
+ starterTools: [...surface.starterTools],
150
+ profiles: surface.profiles
61
151
  };
62
152
  }
@@ -1 +1 @@
1
- export declare const MARTIN_MCP_PACKAGE_VERSION = "0.2.5";
1
+ export declare const MARTIN_MCP_PACKAGE_VERSION = "0.2.7";
@@ -1,3 +1,3 @@
1
1
  // Keep this aligned with packages/mcp/package.json during version bumps so the
2
2
  // runtime does not depend on package.json being present in every hosted bundle.
3
- export const MARTIN_MCP_PACKAGE_VERSION = "0.2.5";
3
+ export const MARTIN_MCP_PACKAGE_VERSION = "0.2.7";
package/dist/prompts.js CHANGED
@@ -108,6 +108,56 @@ export const MARTIN_PROMPTS = [
108
108
  arguments: [
109
109
  { name: "focus", description: "Optional triage focus, such as verification failures, budget pressure, or publish blockers." }
110
110
  ]
111
+ },
112
+ {
113
+ name: "safe_bug_fix",
114
+ title: "Safe Bug Fix",
115
+ description: appendPromptMetadata("Plan a small scoped bug fix through doctor, plan, preflight, run, and dossier."),
116
+ arguments: [
117
+ { name: "objective", description: "Bug fix objective.", required: true }
118
+ ]
119
+ },
120
+ {
121
+ name: "write_tests_first",
122
+ title: "Write Tests First",
123
+ description: appendPromptMetadata("Constrain the plan around failing tests first, then a small fix."),
124
+ arguments: [
125
+ { name: "objective", description: "Objective to satisfy with tests-first discipline.", required: true }
126
+ ]
127
+ },
128
+ {
129
+ name: "small_refactor",
130
+ title: "Small Refactor",
131
+ description: appendPromptMetadata("Keep a refactor small, verifier-backed, and path-scoped."),
132
+ arguments: [
133
+ { name: "objective", description: "Refactor objective.", required: true }
134
+ ]
135
+ },
136
+ {
137
+ name: "security_review",
138
+ title: "Security Review",
139
+ description: appendPromptMetadata("Review a risky change with Martin risk, scope, and verifier evidence first."),
140
+ arguments: [
141
+ { name: "objective", description: "Security review focus.", required: true }
142
+ ]
143
+ },
144
+ {
145
+ name: "pr_review",
146
+ title: "PR Review",
147
+ description: appendPromptMetadata("Generate a Martin-aware PR review checklist with dossier and eval evidence."),
148
+ arguments: [
149
+ { name: "objective", description: "Review objective.", required: true },
150
+ { name: "loopId", description: "Optional loop identifier to review." }
151
+ ]
152
+ },
153
+ {
154
+ name: "release_check",
155
+ title: "Release Check",
156
+ description: appendPromptMetadata("Run a release-readiness check grounded in Martin evidence."),
157
+ arguments: [
158
+ { name: "objective", description: "Release check objective.", required: true },
159
+ { name: "loopId", description: "Optional loop identifier for concrete evidence." }
160
+ ]
111
161
  }
112
162
  ];
113
163
  export function listMartinPrompts() {
@@ -141,6 +191,7 @@ export async function getMartinPrompt(input) {
141
191
  });
142
192
  case "martin_release_check":
143
193
  case "martin_publish_readiness_review":
194
+ case "release_check":
144
195
  return buildPublishReadinessPrompt({
145
196
  args,
146
197
  runsDir: context.runsRoot
@@ -161,6 +212,16 @@ export async function getMartinPrompt(input) {
161
212
  args,
162
213
  runsDir: context.runsRoot
163
214
  });
215
+ case "safe_bug_fix":
216
+ return buildWorkflowPrompt(args, "safe bug fix", "Keep the file scope narrow and verifier-backed.");
217
+ case "write_tests_first":
218
+ return buildWorkflowPrompt(args, "tests-first change", "Write or update the targeted verifier before widening the implementation.");
219
+ case "small_refactor":
220
+ return buildWorkflowPrompt(args, "small refactor", "Preserve behavior and keep the diff easy to review.");
221
+ case "security_review":
222
+ return buildWorkflowPrompt(args, "security-sensitive change", "Escalate if auth, secrets, payments, or infra paths are involved.");
223
+ case "pr_review":
224
+ return buildWorkflowPrompt(args, "PR review", "Use martin_dossier and martin_eval before any approval decision.");
164
225
  default:
165
226
  throw invalidArgumentsError(`Unknown prompt '${input.name}'.`, "Use prompts/list to discover the available Martin prompt names.");
166
227
  }
@@ -172,12 +233,24 @@ async function buildKickoffPrompt(input) {
172
233
  runsDir: input.runsDir,
173
234
  workingDirectory: input.workingDirectory
174
235
  });
236
+ const commandMapGuide = await readMartinResource({
237
+ uri: MARTIN_STATIC_RESOURCE_URIS.commandMapGuide,
238
+ runsDir: input.runsDir,
239
+ workingDirectory: input.workingDirectory
240
+ });
241
+ const operatingRulesGuide = await readMartinResource({
242
+ uri: MARTIN_STATIC_RESOURCE_URIS.operatingRulesGuide,
243
+ runsDir: input.runsDir,
244
+ workingDirectory: input.workingDirectory
245
+ });
175
246
  const healthResource = MARTIN_STATIC_RESOURCES.find((resource) => resource.uri === MARTIN_STATIC_RESOURCE_URIS.serverHealth);
176
247
  return {
177
248
  description: appendPromptMetadata("Kick off a Martin-governed coding session with explicit scope, budgets, and verification expectations."),
178
249
  messages: [
179
- textMessage("assistant", "You are helping prepare a Martin Loop coding run. Keep the plan governed: validate the environment first, preflight non-trivial work, preserve scope discipline, and make verification requirements explicit."),
250
+ textMessage("assistant", "You are helping prepare a Martin Loop coding run. Keep the plan governed: validate the environment first, plan before spend, preflight non-trivial work, preserve scope discipline, and make verification requirements explicit. Do not skip Martin commands and do not treat Martin as optional."),
180
251
  embeddedResourceMessage("assistant", firstResourceContent(usageGuide)),
252
+ embeddedResourceMessage("assistant", firstResourceContent(commandMapGuide)),
253
+ embeddedResourceMessage("assistant", firstResourceContent(operatingRulesGuide)),
181
254
  ...(healthResource ? [resourceLinkMessage("assistant", healthResource)] : []),
182
255
  textMessage("user", joinSections([
183
256
  "Prepare a Martin Loop kickoff plan and a ready-to-send `martin_preflight` payload for this task.",
@@ -193,6 +266,7 @@ async function buildKickoffPrompt(input) {
193
266
  optionalLine("Workspace ID", input.args["workspaceId"]),
194
267
  optionalLine("Project ID", input.args["projectId"]),
195
268
  "Return:",
269
+ "- the required Martin command order before actual coding work begins,",
196
270
  "- a concise governed execution plan,",
197
271
  "- the exact `martin_preflight` arguments,",
198
272
  "- the main risks or blockers to resolve before `martin_run`."
@@ -304,6 +378,24 @@ async function buildTriageRunStorePrompt(input) {
304
378
  ]
305
379
  };
306
380
  }
381
+ async function buildWorkflowPrompt(args, label, guardrail) {
382
+ const objective = requirePromptArgument(args, "objective");
383
+ return {
384
+ description: appendPromptMetadata(`Guide an agent through a ${label} with Martin governance.`),
385
+ messages: [
386
+ textMessage("assistant", "Use Martin as the command center: doctor first, then plan, preflight, run, dossier, and eval. Do not jump directly to execution."),
387
+ textMessage("user", joinSections([
388
+ `Objective: ${objective}`,
389
+ `Guardrail: ${guardrail}`,
390
+ "Return:",
391
+ "- the first Martin tool to call,",
392
+ "- the proposed file scope,",
393
+ "- the verifier plan,",
394
+ "- the conditions that should block or escalate the run."
395
+ ]))
396
+ ]
397
+ };
398
+ }
307
399
  async function buildResumePrompt(input) {
308
400
  const loopId = input.args["loopId"]?.trim();
309
401
  const messages = [
@@ -3,13 +3,21 @@ export declare const MARTIN_STATIC_RESOURCE_URIS: {
3
3
  readonly serverHealth: "martin://server/health";
4
4
  readonly recentRuns: "martin://runs/recent";
5
5
  readonly triage: "martin://runs/triage";
6
+ readonly latestRun: "martin://runs/latest";
6
7
  readonly latestSummary: "martin://runs/latest/summary";
7
8
  readonly latestProofCard: "martin://runs/latest/proof-card";
8
9
  readonly latestBudgetStatus: "martin://runs/latest/budget-status";
9
10
  readonly latestVerifierEvidence: "martin://runs/latest/verifier-evidence";
10
11
  readonly latestRollbackEvidence: "martin://runs/latest/rollback-evidence";
12
+ readonly currentPolicies: "martin://policies/current";
13
+ readonly repoRiskMap: "martin://repo/risk-map";
14
+ readonly verifierResults: "martin://verifiers/results";
11
15
  readonly agentNextStep: "martin://agent/next-step";
12
16
  readonly mcpUsageGuide: "martin://guides/mcp-usage";
17
+ readonly agentStartGuide: "martin://guides/agent-start";
18
+ readonly commandMapGuide: "martin://guides/command-map";
19
+ readonly ideOnboardingGuide: "martin://guides/ide-onboarding";
20
+ readonly operatingRulesGuide: "martin://guides/operating-rules";
13
21
  readonly publishReadinessGuide: "martin://guides/publish-readiness";
14
22
  };
15
23
  export declare const MARTIN_RESOURCE_TEMPLATES: ResourceTemplate[];