Skip to main content
Glama
MartinLoop — Stop Runaway Loops, Bad Code & Token Waste

MartinLoop — Stop Runaway Loops, Bad Code & Token Waste

martin_preflight

Read-onlyIdempotent

Validates a coding task's engine, verifier, path scope, and budget in a read-only preflight before execution to prevent unsafe or costly runs. Proceed only if allowed; otherwise fix the blocker.

Instructions

Read-only validation of the exact run contract before execution or spend. Use after planning and before martin_run to check engine, verifier, path scope, and budget. Do not use as execution or completion proof. Next: call martin_run if allowed, otherwise resolve the reported blocker.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "objective": "<objective>"
    },
    "name": "martin_preflight"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNoModel override passed to the CLI.
engineNoWhich agent CLI would be used. Defaults to claude.
maxUsdNoHard budget ceiling in USD.
contextNoOptional issue context carried into the run contract.
maxTokensNoMaximum total tokens across all attempts.
objectiveYesThe coding task to validate.
projectIdNo
maxMinutesNoEstimated wall-clock minutes allowed for the run contract.
policyPackNo
deniedPathsNoRepo-relative path globs Martin must never modify.
maxCommandsNoEstimated maximum commands allowed for the run contract.
workspaceIdNo
allowedPathsNoRepo-relative path globs Martin may modify.
maxIterationsNoMaximum number of loop attempts.
maxFilesChangedNoEstimated maximum files changed for the run contract.
verificationPlanNoCommands that must all exit 0 for completion.
workingDirectoryNoOptional repo-root override resolved under the MCP workspace root.
pricePerMTokenUsdNoExplicit conservative per-million-token pricing authority for a catalog-unknown OpenAI-compatible model.

Output Schema

NameRequiredDescriptionDefault
okYes
summaryYes
warningsYes
executionYes
readinessYes
normalizedYes
receiptScopeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.10.0
    • addedInput schema / properties / pricePerMTokenUsd
      Added value: +{
      +  "description": "Explicit conservative per-million-token pricing authority for a catalog-unknown OpenAI-compatible model.",
      +  "minimum": 0,
      +  "type": "number"
      +}
    • addedOutput schema / properties / execution / properties / pathScope / properties / hasWritableSurface
      Added value: +{
      +  "type": "boolean"
      +}
    • changedOutput schema / properties / execution / properties / pathScope / required
      Previous value: -[
      -  "repoRoot",
      -  "allowedPathsCount",
      -  "deniedPathsCount",
      -  "hasScopeConflicts"
      -]New value: +[
      +  "repoRoot",
      +  "allowedPathsCount",
      +  "deniedPathsCount",
      +  "hasScopeConflicts",
      +  "hasWritableSurface"
      +]
  2. Changed1 schema field changedv0.8.6
    • addedOutput schema / properties / execution / properties / codexDiagnostics
      Added value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "candidateProbeResults": {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "hostPlatform": {
      +      "type": "string"
      +    },
      +    "installKind": {
      +      "type": "string"
      +    },
      +    "invocationMode": {
      +      "type": "string"
      +    },
      +    "launchReady": {
      +      "type": "boolean"
      +    },
      +    "nativeInstallValid": {
      +      "type": "boolean"
      +    },
      +    "remediation": {
      +      "type": "string"
      +    },
      +    "sandboxCompatible": {
      +      "type": "boolean"
      +    },
      +    "sandboxMode": {
      +      "type": "string"
      +    },
      +    "selectedPath": {
      +      "type": "string"
      +    },
      +    "summary": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "launchReady",
      +    "summary"
      +  ],
      +  "type": "object"
      +}
  3. Changed1 schema field changedv0.5.6
    • changedOutput schema / properties / normalized / properties / budget / required
      Previous value: -[
      -  "maxUsd",
      -  "softLimitUsd",
      -  "maxIterations",
      -  "maxTokens"
      -]New value: +[
      +  "maxUsd",
      +  "softLimitUsd",
      +  "maxIterations"
      +]
  4. First observedv0.3.9

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and idempotentHint=true, and the description reinforces this by framing the call as happening 'before execution or spend' and warning it is not completion proof. It adds real behavioral context about the gating role of the check and the allow/block outcome, though it says nothing about latency, cost of the check itself, or how blockers are reported.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, each earning its place: identity, timing plus negative case, and next action. The purpose is front-loaded and the branching guidance comes last where an agent expects the handoff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 18-parameter gating tool with an output schema and read-only annotations, the description covers purpose, sequencing, exclusions, and the follow-up path, so an agent can decide and call it correctly. Minor gaps remain around what a 'blocker' looks like and whether validation is deterministic across calls, but nothing essential is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 83%, so the schema already documents nearly all of the 18 parameters. The description adds light grouping by naming the contract dimensions validated (engine, verifier, path scope, budget), which hints at which parameter clusters matter, but it provides no format, default, or constraint detail beyond the schema. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Read-only validation of the exact run contract') plus the scope it covers: engine, verifier, path scope, and budget. It also explicitly separates itself from martin_run by declaring what it is not (execution or completion proof), so an agent can distinguish it from the sibling without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit sequencing ('after planning and before martin_run'), an explicit exclusion ('Do not use as execution or completion proof'), and a branching next step ('call martin_run if allowed, otherwise resolve the reported blocker'). When-to-use, when-not-to-use, and the alternative are all stated rather than implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.