@martinloop/mcp 0.3.7 → 0.3.9

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 (88) hide show
  1. package/README.md +196 -137
  2. package/dist/resources.js +148 -148
  3. package/dist/server.js +0 -0
  4. package/dist/tools/tool-support.js +11 -1
  5. package/dist/vendor/adapters/claude-cli.d.ts +2 -2
  6. package/dist/vendor/adapters/claude-cli.js +127 -51
  7. package/dist/vendor/adapters/codex-launcher.js +10 -1
  8. package/dist/vendor/adapters/openai-compatible.js +6 -6
  9. package/package.json +86 -76
  10. package/server.json +21 -21
  11. package/dist/vendor/adapters/adapters/src/claude-cli.d.ts +0 -146
  12. package/dist/vendor/adapters/adapters/src/claude-cli.js +0 -1100
  13. package/dist/vendor/adapters/adapters/src/cli-bridge.d.ts +0 -103
  14. package/dist/vendor/adapters/adapters/src/cli-bridge.js +0 -569
  15. package/dist/vendor/adapters/adapters/src/codex-launcher.d.ts +0 -78
  16. package/dist/vendor/adapters/adapters/src/codex-launcher.js +0 -663
  17. package/dist/vendor/adapters/adapters/src/direct-provider.d.ts +0 -10
  18. package/dist/vendor/adapters/adapters/src/direct-provider.js +0 -40
  19. package/dist/vendor/adapters/adapters/src/index.d.ts +0 -8
  20. package/dist/vendor/adapters/adapters/src/index.js +0 -8
  21. package/dist/vendor/adapters/adapters/src/openai-compatible.d.ts +0 -62
  22. package/dist/vendor/adapters/adapters/src/openai-compatible.js +0 -306
  23. package/dist/vendor/adapters/adapters/src/runtime-support.d.ts +0 -17
  24. package/dist/vendor/adapters/adapters/src/runtime-support.js +0 -59
  25. package/dist/vendor/adapters/adapters/src/stub-agent-cli.d.ts +0 -8
  26. package/dist/vendor/adapters/adapters/src/stub-agent-cli.js +0 -40
  27. package/dist/vendor/adapters/adapters/src/stub-direct-provider.d.ts +0 -8
  28. package/dist/vendor/adapters/adapters/src/stub-direct-provider.js +0 -12
  29. package/dist/vendor/adapters/adapters/src/verifier-only.d.ts +0 -9
  30. package/dist/vendor/adapters/adapters/src/verifier-only.js +0 -63
  31. package/dist/vendor/adapters/contracts/src/context-graph.d.ts +0 -48
  32. package/dist/vendor/adapters/contracts/src/context-graph.js +0 -26
  33. package/dist/vendor/adapters/contracts/src/execution-policy.d.ts +0 -78
  34. package/dist/vendor/adapters/contracts/src/execution-policy.js +0 -43
  35. package/dist/vendor/adapters/contracts/src/governance.d.ts +0 -24
  36. package/dist/vendor/adapters/contracts/src/governance.js +0 -11
  37. package/dist/vendor/adapters/contracts/src/identity.d.ts +0 -29
  38. package/dist/vendor/adapters/contracts/src/identity.js +0 -30
  39. package/dist/vendor/adapters/contracts/src/index.d.ts +0 -412
  40. package/dist/vendor/adapters/contracts/src/index.js +0 -225
  41. package/dist/vendor/adapters/contracts/src/operator.d.ts +0 -19
  42. package/dist/vendor/adapters/contracts/src/operator.js +0 -11
  43. package/dist/vendor/adapters/contracts/src/trajectory.d.ts +0 -26
  44. package/dist/vendor/adapters/contracts/src/trajectory.js +0 -27
  45. package/dist/vendor/adapters/core/src/compiler.d.ts +0 -52
  46. package/dist/vendor/adapters/core/src/compiler.js +0 -52
  47. package/dist/vendor/adapters/core/src/context-graph.d.ts +0 -3
  48. package/dist/vendor/adapters/core/src/context-graph.js +0 -371
  49. package/dist/vendor/adapters/core/src/context-integrity.d.ts +0 -26
  50. package/dist/vendor/adapters/core/src/context-integrity.js +0 -80
  51. package/dist/vendor/adapters/core/src/grounding.d.ts +0 -38
  52. package/dist/vendor/adapters/core/src/grounding.js +0 -273
  53. package/dist/vendor/adapters/core/src/identity.d.ts +0 -20
  54. package/dist/vendor/adapters/core/src/identity.js +0 -86
  55. package/dist/vendor/adapters/core/src/index.d.ts +0 -186
  56. package/dist/vendor/adapters/core/src/index.js +0 -1495
  57. package/dist/vendor/adapters/core/src/leash.d.ts +0 -48
  58. package/dist/vendor/adapters/core/src/leash.js +0 -497
  59. package/dist/vendor/adapters/core/src/persistence/compiler.d.ts +0 -18
  60. package/dist/vendor/adapters/core/src/persistence/compiler.js +0 -34
  61. package/dist/vendor/adapters/core/src/persistence/index.d.ts +0 -10
  62. package/dist/vendor/adapters/core/src/persistence/index.js +0 -5
  63. package/dist/vendor/adapters/core/src/persistence/integrity.d.ts +0 -39
  64. package/dist/vendor/adapters/core/src/persistence/integrity.js +0 -252
  65. package/dist/vendor/adapters/core/src/persistence/ledger.d.ts +0 -23
  66. package/dist/vendor/adapters/core/src/persistence/ledger.js +0 -9
  67. package/dist/vendor/adapters/core/src/persistence/memory-store.d.ts +0 -63
  68. package/dist/vendor/adapters/core/src/persistence/memory-store.js +0 -115
  69. package/dist/vendor/adapters/core/src/persistence/runs-reader.d.ts +0 -66
  70. package/dist/vendor/adapters/core/src/persistence/runs-reader.js +0 -140
  71. package/dist/vendor/adapters/core/src/persistence/store.d.ts +0 -89
  72. package/dist/vendor/adapters/core/src/persistence/store.js +0 -125
  73. package/dist/vendor/adapters/core/src/persistence/trace-store.d.ts +0 -85
  74. package/dist/vendor/adapters/core/src/persistence/trace-store.js +0 -125
  75. package/dist/vendor/adapters/core/src/policy-compiler.d.ts +0 -2
  76. package/dist/vendor/adapters/core/src/policy-compiler.js +0 -195
  77. package/dist/vendor/adapters/core/src/policy.d.ts +0 -156
  78. package/dist/vendor/adapters/core/src/policy.js +0 -704
  79. package/dist/vendor/adapters/core/src/repo-analyzer.d.ts +0 -53
  80. package/dist/vendor/adapters/core/src/repo-analyzer.js +0 -263
  81. package/dist/vendor/adapters/core/src/rollback.d.ts +0 -15
  82. package/dist/vendor/adapters/core/src/rollback.js +0 -253
  83. package/dist/vendor/adapters/core/src/routing.d.ts +0 -82
  84. package/dist/vendor/adapters/core/src/routing.js +0 -336
  85. package/dist/vendor/adapters/core/src/test-integrity.d.ts +0 -64
  86. package/dist/vendor/adapters/core/src/test-integrity.js +0 -197
  87. package/dist/vendor/adapters/core/src/trajectory.d.ts +0 -18
  88. package/dist/vendor/adapters/core/src/trajectory.js +0 -295
package/dist/resources.js CHANGED
@@ -769,174 +769,174 @@ function inferAgentNextStep(loop, verification) {
769
769
  }
770
770
  function buildMcpUsageGuide(runsRoot) {
771
771
  const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
772
- return `# Martin Loop MCP Usage
773
-
774
- Discovery revision: \`${metadata.discoveryRevision}\`
775
- Server version: \`${metadata.serverVersion}\`
776
- Runs root: \`${runsRoot}\`
777
-
778
- Martin Loop exposes governed coding workflows over MCP. Use the server health and run-store views to decide when to preflight, execute, inspect, or escalate.
779
-
780
- ## Recommended Flow
781
-
782
- 1. Read \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\` or call \`martin_doctor\` to confirm the environment and run-store visibility.
783
- 2. Use the \`martin_governed_coding_kickoff\` prompt to frame a governed coding request.
784
- 3. Call \`martin_preflight\` before \`martin_run\` when the task or safety envelope is non-trivial.
785
- 4. After execution, inspect \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\`, \`martin://runs/{loopId}\`, and \`martin://runs/{loopId}/verification\`.
786
- 5. For low-context agents, read \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`, or \`${MARTIN_STATIC_RESOURCE_URIS.latestReceipt}\` before asking for full JSON. Treat \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\` as an optional derived view.
787
- 6. Read \`${MARTIN_STATIC_RESOURCE_URIS.triage}\` or call \`martin_triage_runs\` to prioritize which run needs attention first.
788
- 7. Use \`martin_debug_failed_run\` when a loop exits failed, budget-bound, or escalated.
789
-
790
- ## Current Martin MCP Surface
791
-
792
- - Tools: \`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\`
793
- - Static resources: \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\`, \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\`, \`${MARTIN_STATIC_RESOURCE_URIS.triage}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestReceipt}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestBudgetStatus}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestVerifierEvidence}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestRollbackEvidence}\`, \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`, \`${MARTIN_STATIC_RESOURCE_URIS.mcpUsageGuide}\`, \`${MARTIN_STATIC_RESOURCE_URIS.agentStartGuide}\`, \`${MARTIN_STATIC_RESOURCE_URIS.publishReadinessGuide}\`
794
- - Resource templates: \`martin://runs/{loopId}\`, \`martin://runs/{loopId}/attempts/{attemptIndex}\`, \`martin://runs/{loopId}/verification\`
795
- - Prompts: \`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\`
796
-
797
- ## Notes
798
-
799
- - Discovery helpers read the existing Martin run-store; they do not create new schema.
800
- - Verification history is derived from persisted \`verification.completed\` evidence in loop records and ledgers.
801
- - Attempt inspection stays aligned with the same loop selectors used by \`martin_status\` and \`martin_inspect\`.
772
+ return `# Martin Loop MCP Usage
773
+
774
+ Discovery revision: \`${metadata.discoveryRevision}\`
775
+ Server version: \`${metadata.serverVersion}\`
776
+ Runs root: \`${runsRoot}\`
777
+
778
+ Martin Loop exposes governed coding workflows over MCP. Use the server health and run-store views to decide when to preflight, execute, inspect, or escalate.
779
+
780
+ ## Recommended Flow
781
+
782
+ 1. Read \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\` or call \`martin_doctor\` to confirm the environment and run-store visibility.
783
+ 2. Use the \`martin_governed_coding_kickoff\` prompt to frame a governed coding request.
784
+ 3. Call \`martin_preflight\` before \`martin_run\` when the task or safety envelope is non-trivial.
785
+ 4. After execution, inspect \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\`, \`martin://runs/{loopId}\`, and \`martin://runs/{loopId}/verification\`.
786
+ 5. For low-context agents, read \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`, or \`${MARTIN_STATIC_RESOURCE_URIS.latestReceipt}\` before asking for full JSON. Treat \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\` as an optional derived view.
787
+ 6. Read \`${MARTIN_STATIC_RESOURCE_URIS.triage}\` or call \`martin_triage_runs\` to prioritize which run needs attention first.
788
+ 7. Use \`martin_debug_failed_run\` when a loop exits failed, budget-bound, or escalated.
789
+
790
+ ## Current Martin MCP Surface
791
+
792
+ - Tools: \`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\`
793
+ - Static resources: \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\`, \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\`, \`${MARTIN_STATIC_RESOURCE_URIS.triage}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestReceipt}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestBudgetStatus}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestVerifierEvidence}\`, \`${MARTIN_STATIC_RESOURCE_URIS.latestRollbackEvidence}\`, \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`, \`${MARTIN_STATIC_RESOURCE_URIS.mcpUsageGuide}\`, \`${MARTIN_STATIC_RESOURCE_URIS.agentStartGuide}\`, \`${MARTIN_STATIC_RESOURCE_URIS.publishReadinessGuide}\`
794
+ - Resource templates: \`martin://runs/{loopId}\`, \`martin://runs/{loopId}/attempts/{attemptIndex}\`, \`martin://runs/{loopId}/verification\`
795
+ - Prompts: \`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\`
796
+
797
+ ## Notes
798
+
799
+ - Discovery helpers read the existing Martin run-store; they do not create new schema.
800
+ - Verification history is derived from persisted \`verification.completed\` evidence in loop records and ledgers.
801
+ - Attempt inspection stays aligned with the same loop selectors used by \`martin_status\` and \`martin_inspect\`.
802
802
  `;
803
803
  }
804
804
  function buildAgentStartGuide(runsRoot) {
805
805
  const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
806
- return `# Agent Start Here
807
-
808
- Discovery revision: \`${metadata.discoveryRevision}\`
809
- Server version: \`${metadata.serverVersion}\`
810
- Runs root: \`${runsRoot}\`
811
-
812
- Use Martin Loop as the local governor before you spend agent tokens or retry a failed coding loop.
813
-
814
- ## Cheap Default Flow
815
-
816
- 1. Read \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\` first. It is the smallest "what should I do now?" payload.
817
- 2. If no runs exist, call \`martin_doctor\`, then \`martin_preflight\`.
818
- 3. If a run exists, read \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\` before reading full run JSON.
819
- 4. If the verifier failed, use prompt \`martin_debug_failed_run\` or \`martin_triage\`.
820
- 5. If you need a shareable receipt, read \`${MARTIN_STATIC_RESOURCE_URIS.latestReceipt}\` first. Generate or inspect \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\` only when a visual artifact is explicitly required.
821
-
822
- ## Install Profiles
823
-
824
- - \`minimal\` (default): doctor, preflight, list, triage, dossier. Good for low tool bloat.
825
- - \`diagnostic\`: read-only inspection tools for debugging without execution.
826
- - \`full-local\`: all local tools, including \`martin_run\`.
827
- - \`github-review\`: review-oriented local profile for PR drafting and reviewer evidence.
828
- - \`starter\` and \`full\`: compatibility aliases.
829
-
830
- ## Copy-Paste Agent Rule
831
-
832
- Before running or retrying an autonomous coding task, call Martin. Prefer compact resources first, then full dossiers only when the compact receipt says more evidence is needed. Never claim success unless Martin shows verifier-backed completion or a clear blocked reason.
806
+ return `# Agent Start Here
807
+
808
+ Discovery revision: \`${metadata.discoveryRevision}\`
809
+ Server version: \`${metadata.serverVersion}\`
810
+ Runs root: \`${runsRoot}\`
811
+
812
+ Use Martin Loop as the local governor before you spend agent tokens or retry a failed coding loop.
813
+
814
+ ## Cheap Default Flow
815
+
816
+ 1. Read \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\` first. It is the smallest "what should I do now?" payload.
817
+ 2. If no runs exist, call \`martin_doctor\`, then \`martin_preflight\`.
818
+ 3. If a run exists, read \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\` before reading full run JSON.
819
+ 4. If the verifier failed, use prompt \`martin_debug_failed_run\` or \`martin_triage\`.
820
+ 5. If you need a shareable receipt, read \`${MARTIN_STATIC_RESOURCE_URIS.latestReceipt}\` first. Generate or inspect \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\` only when a visual artifact is explicitly required.
821
+
822
+ ## Install Profiles
823
+
824
+ - \`minimal\` (default): doctor, preflight, list, triage, dossier. Good for low tool bloat.
825
+ - \`diagnostic\`: read-only inspection tools for debugging without execution.
826
+ - \`full-local\`: all local tools, including \`martin_run\`.
827
+ - \`github-review\`: review-oriented local profile for PR drafting and reviewer evidence.
828
+ - \`starter\` and \`full\`: compatibility aliases.
829
+
830
+ ## Copy-Paste Agent Rule
831
+
832
+ Before running or retrying an autonomous coding task, call Martin. Prefer compact resources first, then full dossiers only when the compact receipt says more evidence is needed. Never claim success unless Martin shows verifier-backed completion or a clear blocked reason.
833
833
  `;
834
834
  }
835
835
  function buildCommandMapGuide(runsRoot) {
836
836
  const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
837
- return `# Martin Command Map
838
-
839
- Discovery revision: \`${metadata.discoveryRevision}\`
840
- Server version: \`${metadata.serverVersion}\`
841
- Runs root: \`${runsRoot}\`
842
-
843
- Use this guide when an IDE or agent needs to know which Martin surface to call next.
844
-
845
- ## Default Governed Sequence
846
-
847
- 1. \`martin_doctor\` — confirm environment and visibility.
848
- 2. \`martin_plan\` — propose the bounded approach without spending a run.
849
- 3. \`martin_preflight\` — turn the plan into an explicit contract.
850
- 4. \`martin_run\` — execute only after the contract is safe.
851
- 5. \`martin_dossier\` — inspect what happened and what Martin prevented.
852
- 6. \`martin_eval\` — convert the result into review posture when needed.
853
-
854
- ## When To Use Which Surface
855
-
856
- - Need the smallest next action: \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`
857
- - Need a quick receipt: \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`
858
- - Need the structured receipt source of truth: \`${MARTIN_STATIC_RESOURCE_URIS.latestReceipt}\`
859
- - Need an optional visual proof object: \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\`
860
- - Need a full run review: \`martin_dossier\`
861
- - Need to decide whether to retry: \`martin_triage_runs\`
862
- - Need IDE setup guidance: \`${MARTIN_STATIC_RESOURCE_URIS.ideOnboardingGuide}\`
837
+ return `# Martin Command Map
838
+
839
+ Discovery revision: \`${metadata.discoveryRevision}\`
840
+ Server version: \`${metadata.serverVersion}\`
841
+ Runs root: \`${runsRoot}\`
842
+
843
+ Use this guide when an IDE or agent needs to know which Martin surface to call next.
844
+
845
+ ## Default Governed Sequence
846
+
847
+ 1. \`martin_doctor\` — confirm environment and visibility.
848
+ 2. \`martin_plan\` — propose the bounded approach without spending a run.
849
+ 3. \`martin_preflight\` — turn the plan into an explicit contract.
850
+ 4. \`martin_run\` — execute only after the contract is safe.
851
+ 5. \`martin_dossier\` — inspect what happened and what Martin prevented.
852
+ 6. \`martin_eval\` — convert the result into review posture when needed.
853
+
854
+ ## When To Use Which Surface
855
+
856
+ - Need the smallest next action: \`${MARTIN_STATIC_RESOURCE_URIS.agentNextStep}\`
857
+ - Need a quick receipt: \`${MARTIN_STATIC_RESOURCE_URIS.latestSummary}\`
858
+ - Need the structured receipt source of truth: \`${MARTIN_STATIC_RESOURCE_URIS.latestReceipt}\`
859
+ - Need an optional visual proof object: \`${MARTIN_STATIC_RESOURCE_URIS.latestProofCard}\`
860
+ - Need a full run review: \`martin_dossier\`
861
+ - Need to decide whether to retry: \`martin_triage_runs\`
862
+ - Need IDE setup guidance: \`${MARTIN_STATIC_RESOURCE_URIS.ideOnboardingGuide}\`
863
863
  `;
864
864
  }
865
865
  function buildIdeOnboardingGuide(runsRoot) {
866
866
  const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
867
- return `# Martin IDE Onboarding
868
-
869
- Discovery revision: \`${metadata.discoveryRevision}\`
870
- Server version: \`${metadata.serverVersion}\`
871
- Runs root: \`${runsRoot}\`
872
-
873
- Use this guide after the MCP server is installed so the host naturally uses MartinLoop during real work.
874
-
875
- ## IDE Default Flow
876
-
877
- 1. Read \`${MARTIN_STATIC_RESOURCE_URIS.agentStartGuide}\`
878
- 2. Read \`${MARTIN_STATIC_RESOURCE_URIS.operatingRulesGuide}\`
879
- 3. Use prompt \`martin_start\` or \`martin_governed_coding_kickoff\`
880
- 4. Call \`martin_doctor\`
881
- 5. Call \`martin_plan\`
882
- 6. Call \`martin_preflight\`
883
- 7. Only then call \`martin_run\`
884
-
885
- ## Goal
886
-
887
- MartinLoop should become the normal path for coding work in the host, not a manual extra step the human has to remember.
867
+ return `# Martin IDE Onboarding
868
+
869
+ Discovery revision: \`${metadata.discoveryRevision}\`
870
+ Server version: \`${metadata.serverVersion}\`
871
+ Runs root: \`${runsRoot}\`
872
+
873
+ Use this guide after the MCP server is installed so the host naturally uses MartinLoop during real work.
874
+
875
+ ## IDE Default Flow
876
+
877
+ 1. Read \`${MARTIN_STATIC_RESOURCE_URIS.agentStartGuide}\`
878
+ 2. Read \`${MARTIN_STATIC_RESOURCE_URIS.operatingRulesGuide}\`
879
+ 3. Use prompt \`martin_start\` or \`martin_governed_coding_kickoff\`
880
+ 4. Call \`martin_doctor\`
881
+ 5. Call \`martin_plan\`
882
+ 6. Call \`martin_preflight\`
883
+ 7. Only then call \`martin_run\`
884
+
885
+ ## Goal
886
+
887
+ MartinLoop should become the normal path for coding work in the host, not a manual extra step the human has to remember.
888
888
  `;
889
889
  }
890
890
  function buildOperatingRulesGuide(runsRoot) {
891
891
  const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
892
- return `# Martin Operating Rules
893
-
894
- Discovery revision: \`${metadata.discoveryRevision}\`
895
- Server version: \`${metadata.serverVersion}\`
896
- Runs root: \`${runsRoot}\`
897
-
898
- Use these rules inside the IDE or MCP host as the default MartinLoop operating posture.
899
-
900
- ## Required Sequence Before Real Work
901
-
902
- 1. \`martin_doctor\`
903
- 2. \`martin_plan\`
904
- 3. \`martin_preflight\`
905
- 4. \`martin_run\`
906
- 5. \`martin_dossier\`
907
-
908
- ## Enforcement Rule
909
-
910
- Do not execute real coding work through MartinLoop until doctor and preflight have both been used for the current task.
911
-
912
- ## Completion Rule
913
-
914
- Do not claim success until MartinLoop shows verifier-backed completion or an explicit blocked reason backed by evidence.
892
+ return `# Martin Operating Rules
893
+
894
+ Discovery revision: \`${metadata.discoveryRevision}\`
895
+ Server version: \`${metadata.serverVersion}\`
896
+ Runs root: \`${runsRoot}\`
897
+
898
+ Use these rules inside the IDE or MCP host as the default MartinLoop operating posture.
899
+
900
+ ## Required Sequence Before Real Work
901
+
902
+ 1. \`martin_doctor\`
903
+ 2. \`martin_plan\`
904
+ 3. \`martin_preflight\`
905
+ 4. \`martin_run\`
906
+ 5. \`martin_dossier\`
907
+
908
+ ## Enforcement Rule
909
+
910
+ Do not execute real coding work through MartinLoop until doctor and preflight have both been used for the current task.
911
+
912
+ ## Completion Rule
913
+
914
+ Do not claim success until MartinLoop shows verifier-backed completion or an explicit blocked reason backed by evidence.
915
915
  `;
916
916
  }
917
917
  function buildPublishReadinessGuide(runsRoot) {
918
918
  const metadata = buildMartinDiscoveryMetadata(MARTIN_MCP_PACKAGE_VERSION);
919
- return `# Martin MCP Publish Readiness
920
-
921
- Discovery revision: \`${metadata.discoveryRevision}\`
922
- Server version: \`${metadata.serverVersion}\`
923
- Runs root: \`${runsRoot}\`
924
-
925
- Use this guide when reviewing whether the public MCP package is ready to publish, promote, or hand off for registry submission.
926
-
927
- ## Review Areas
928
-
929
- 1. Environment health: confirm \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\` shows a sane working directory, runs root, and engine availability for the target mode.
930
- 2. Discovery surface: verify tools, prompts, static resources, and resource templates are all discoverable and named consistently.
931
- 3. Run evidence: inspect \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\` and, when relevant, \`martin://runs/{loopId}/verification\` to confirm verification outcomes are explainable from persisted data.
932
- 4. Packaging lane: run the MCP package test, build, and smoke-pack commands before calling the package publish-ready.
933
- 5. Findings-first reporting: call out missing schema, integration gaps, triage-critical runs, and verification blockers before summarizing strengths.
934
-
935
- ## Evidence Expectations
936
-
937
- - Prefer concrete run IDs, attempt indices, and verification summaries over vague statements.
938
- - Distinguish local package validation from live registry readiness.
939
- - If a discovery helper exists but is not yet wired into the server, report that as an integration gap instead of treating the capability as fully shipped.
919
+ return `# Martin MCP Publish Readiness
920
+
921
+ Discovery revision: \`${metadata.discoveryRevision}\`
922
+ Server version: \`${metadata.serverVersion}\`
923
+ Runs root: \`${runsRoot}\`
924
+
925
+ Use this guide when reviewing whether the public MCP package is ready to publish, promote, or hand off for registry submission.
926
+
927
+ ## Review Areas
928
+
929
+ 1. Environment health: confirm \`${MARTIN_STATIC_RESOURCE_URIS.serverHealth}\` shows a sane working directory, runs root, and engine availability for the target mode.
930
+ 2. Discovery surface: verify tools, prompts, static resources, and resource templates are all discoverable and named consistently.
931
+ 3. Run evidence: inspect \`${MARTIN_STATIC_RESOURCE_URIS.recentRuns}\` and, when relevant, \`martin://runs/{loopId}/verification\` to confirm verification outcomes are explainable from persisted data.
932
+ 4. Packaging lane: run the MCP package test, build, and smoke-pack commands before calling the package publish-ready.
933
+ 5. Findings-first reporting: call out missing schema, integration gaps, triage-critical runs, and verification blockers before summarizing strengths.
934
+
935
+ ## Evidence Expectations
936
+
937
+ - Prefer concrete run IDs, attempt indices, and verification summaries over vague statements.
938
+ - Distinguish local package validation from live registry readiness.
939
+ - If a discovery helper exists but is not yet wired into the server, report that as an integration gap instead of treating the capability as fully shipped.
940
940
  `;
941
941
  }
942
942
  async function buildModeStatusResource() {
package/dist/server.js CHANGED
File without changes
@@ -105,6 +105,11 @@ function discoverCommonInstallDirectories(command) {
105
105
  if (localAppData) {
106
106
  dirs.push(join(localAppData, "OpenAI", "Codex", "bin"));
107
107
  }
108
+ // Claude Code native installer places binary at %USERPROFILE%\.local\bin
109
+ const userProfile = process.env.USERPROFILE ?? process.env.HOMEPATH;
110
+ if (userProfile) {
111
+ dirs.push(join(userProfile, ".local", "bin"));
112
+ }
108
113
  // Scoop
109
114
  if (home) {
110
115
  dirs.push(join(home, "scoop", "shims"));
@@ -161,8 +166,13 @@ function isOnPathDirectly(command, resolvedPath) {
161
166
  * Returns a platform-specific one-liner install command for a known CLI.
162
167
  */
163
168
  function suggestInstallCommand(command) {
169
+ if (command === "claude") {
170
+ const installCmd = process.platform === "win32"
171
+ ? "irm https://claude.ai/install.ps1 | iex"
172
+ : "curl -fsSL https://claude.ai/install.sh | bash";
173
+ return `Install with: ${installCmd}`;
174
+ }
164
175
  const npmInstalls = {
165
- claude: "npm install -g @anthropic-ai/claude-code",
166
176
  codex: "npm install -g @openai/codex",
167
177
  gemini: "npm install -g @google/gemini-cli"
168
178
  };
@@ -11,14 +11,14 @@
11
11
  *
12
12
  * MCP tools and integration tests use the same factories.
13
13
  */
14
- import type { MartinAdapter } from "../core/index.js";
14
+ import type { MartinAdapter, MartinAdapterRequest } from "../core/index.js";
15
15
  import { type SpawnLike } from "./cli-bridge.js";
16
16
  /**
17
17
  * Given a prompt string, returns the full argv array to pass to spawn().
18
18
  * Example for Claude: () => ["--output-format", "json", "--print"]
19
19
  * Example for Codex: () => ["exec", "--sandbox", "workspace-write", "-"]
20
20
  */
21
- export type CliArgsBuilder = (prompt: string) => string[];
21
+ export type CliArgsBuilder = (prompt: string, request: MartinAdapterRequest) => string[];
22
22
  export type CliStdinBuilder = (prompt: string) => string | undefined;
23
23
  export interface AgentCliAdapterOptions {
24
24
  /** The executable to spawn (e.g. "claude", "codex"). */