Skip to content

Instrument Guide

Marianne uses instruments to execute scores. An instrument is any AI tool that can receive a prompt and produce output — Claude Code, Gemini CLI, Codex CLI, Aider, Goose, or any CLI tool you configure. The conductor assigns musicians (AI agents) to instruments and manages execution across all of them.

This guide covers how to use existing instruments, how to add your own, and how the instrument system works.


Quick Reference

# See what instruments are available
mzt instruments list

# Check if a specific instrument is ready
mzt instruments check gemini-cli

# Full environment health check
mzt doctor

Built-in Instruments

Marianne ships config-driven instrument profiles as YAML files. The profile selects a CLI or HTTP transport; provider-specific wire details remain inside the profile-driven execution layer.

Maintained Profiles

The maintained built-ins include:

Name Tool Auth
claude-code Claude Code CLI (claude) claude login
ollama Local OpenAI-compatible server Optional local auth
claude-code-ollama Claude Code CLI over local Ollama Profile-pinned local token

Agent Profiles

These ship as YAML profiles bundled with Marianne and are loaded at conductor startup:

Name Tool Auth
claude-code Claude Code CLI claude login
qwen-code Qwen Code CLI (qwen) Saved Qwen OAuth or OpenAI-compatible API credentials
openclaw OpenClaw CLI (openclaw agent exec) Saved client config and credentials
gemini-cli Google Gemini CLI GEMINI_API_KEY (primary), GOOGLE_API_KEY, or Google ADC/gcloud configuration; local override and live check required (below)
codex-cli OpenAI Codex CLI OPENAI_API_KEY or CODEX_API_KEY
antigravity Google Antigravity CLI (agy), Gemini CLI's successor; tmux-interactive by default, print mode delivers the prompt as one stream-json line on stdin Existing Google account/API configuration
cline-cli Cline CLI Provider API key
aider Aider Provider API key (OPENAI_API_KEY, etc.)
goose Block's Goose Provider API key

To check which instruments are available on your system:

mzt instruments list

Using Instruments in Scores

Gemini CLI authentication and readiness

The shipped Gemini profile stays execution_status: unsupported because the default individual-tier OAuth path returned UNSUPPORTED_CLIENT / IneligibleTierError on Pallas. Exporting a key alone does not enable that profile. Use GEMINI_API_KEY as the primary credential; existing GOOGLE_API_KEY, GOOGLE_APPLICATION_CREDENTIALS, GOOGLE_CLOUD_PROJECT, and CLOUDSDK_CONFIG configurations remain recognized auth signals. An auth signal in mzt doctor does not prove the credential works.

Before copying anything: a seat that differs from a builtin only in its model, timeout, interactive flag or reasoning level is an alias in the score (instruments: {seat: {profile: codex-cli, config: {model: …}}}), not a profile. A user-layer file is warranted only when the executable, output format, prompt delivery or error vocabulary differ from every builtin. A copy made for a model pin replaces the builtin whole and silently lacks every key the builtin gains afterwards (the first-output bound, quota vocabulary, cache token paths); on one venue three such copies carried over a thousand score references.

When the user layer is the right place, copy the entire shipped profile from a Marianne source checkout. Profiles replace one another by name; a YAML fragment containing only execution_status does not inherit the builtin's command or models. If a local copy already exists, review and edit it instead of overwriting it:

export GEMINI_API_KEY='<your Gemini API key>'
mkdir -p ~/.marianne/instruments
cp -n src/marianne/instruments/builtins/gemini-cli.yaml ~/.marianne/instruments/gemini-cli.yaml
uv run mzt instruments check gemini-cli --live

The live check sends a real prompt through the conductor's backend, even while the profile is marked unsupported, and spends a model call. Only after it succeeds, edit these fields in ~/.marianne/instruments/gemini-cli.yaml, retaining the rest of the copied profile:

execution_status: ready
execution_status_detail: "API-key prompt execution live-smoke verified on this host."

Then inspect readiness and regenerate the machine's class map:

uv run mzt doctor
uv run mzt instruments classes write --dry-run
uv run mzt instruments classes write
uv run mzt instruments classes check

Review the dry run before replacing an existing map. If the writer detects hand edits, it requires --force and backs up the old map. Same-named local overrides are probed and ranked in the shipped high-context, image, and video policies; image/video still require vision. The writer checks binary availability and declared readiness, so run the live check before enabling a profile. A failed smoke leaves the local profile unsupported.

Qwen Code

Install the client version used to verify this headless contract (Node.js 20+ required), then configure authentication before starting a score:

npm install -g @qwen-code/qwen-code@0.12.6
qwen --version
qwen

Complete the client's interactive login/setup once. Saved Qwen OAuth credentials remain accessible through HOME. For an OpenAI-compatible provider, configure Qwen's authentication settings and supply OPENAI_API_KEY, OPENAI_BASE_URL and optionally OPENAI_MODEL or QWEN_MODEL. Marianne passes those four provider variables and system variables; other provider families or custom credential variable names require an organization/venue profile override of cli.command.required_env. Provider access and billing depend on your account.

Use instrument: qwen-code directly or a named instrument for a model override. This example assigns the named override to sheet 1, while sheet 2 uses the client's configured model:

name: qwen-example
workspace: ./workspaces/qwen-example
instrument: qwen-code
instruments:
  coder:
    profile: qwen-code
    config:
      model: your-provider-model
sheet:
  size: 1
  total_items: 2
  per_sheet_instruments:
    1: coder
prompt:
  template: "Review the code and write findings for sheet {{ sheet_num }}."

The profile runs headlessly with --yolo --output-format json and sends the prompt over stdin. --yolo auto-approves tools, including file edits and shell commands: choose an appropriate workspace and permissions. Final text and input/output token usage are read from the terminal JSON result, including exit-zero error envelopes. Without a score model override, Qwen chooses its configured model; Marianne ships no assumed Qwen model prices or capacities.

This integration advertises tool use, file editing and shell access. It does not advertise Marianne schema output, MCP injection, interactive execution or vision support. A self-hosted model requires a separately running compatible provider and Qwen configuration; selecting this instrument does not host a model. The source contract is pinned to v0.12.6; live authenticated execution was unavailable on the implementation host. Source-derived fixtures and their immutable vendor references document the verified protocol separately from live access.

OpenClaw

Install the pinned client (npm install -g openclaw@2026.10.1) using its supported Node.js range (>=24.16.0 <25 || >=26.1.0), then complete openclaw onboard before running a score. This profile uses your saved client configuration and authentication through HOME; OPENCLAW_CONFIG_PATH and OPENCLAW_STATE_DIR overrides are passed explicitly. Other provider environment keys require a local cli.command.required_env override. Provider access and billing depend on your account; config files and saved credential stores remain accessible to the client.

Select instrument: openclaw directly or use a named per-sheet model override:

name: openclaw-example
workspace: ./workspaces/openclaw-example
instrument: openclaw
instruments:
  coder:
    profile: openclaw
    config:
      model: your-provider-model
sheet:
  size: 1
  total_items: 2
  per_sheet_instruments:
    1: coder
prompt:
  template: "Review the code and write findings for sheet {{ sheet_num }}."

The generated command is openclaw agent --json --message-file - exec with optional parent --model and --timeout flags. Upstream explicitly inherits these options in exec. Prompts use stdin (UTF-8, upstream limit 4 MiB), avoiding argv limits. Each turn uses temporary state and the sheet workspace as cwd; it does not contact a Gateway or deliver messages to channels. Without a model override, OpenClaw chooses its configured model. The native timeout is 600 seconds unless Marianne supplies a per-attempt deadline.

Workspace safety: exec defaults to the coding tool profile, workspace-only filesystem tools and full shell execution policy without an approval channel. Explicit client sandbox/tool policies take precedence. Use a trusted workspace and inspect your OpenClaw configuration; shell execution can have effects beyond filesystem tools' workspace restriction.

Final text comes from final, tokens from usage.input / usage.output when available, and errors from error.message. Exit 0 means success, 1 error, 2 timeout. This profile advertises tool use, file editing and shell access; it has no Marianne schema enforcement, MCP injection or interactive-mode contract. The contract is pinned to v2026.10.1; live authenticated execution was not verified on this host. See the synthetic fixtures and immutable upstream references for the verified source contract.

The instrument: Field

Specify which instrument to use with the instrument: field at the top level of your score:

name: my-score
workspace: ./workspaces/my-score

instrument: gemini-cli

sheet:
  size: 1
  total_items: 3

prompt:
  template: |
    Write a summary of {{ workspace }}/input.md

Legacy backend: scores: the old backend: block was removed (#347) and now fails at parse time. See the migration guide for the field-by-field conversion.

Capability classes

Use a class when the score needs a kind of instrument and each installation should choose its own profile chain:

instrument: strong
instrument_fallbacks: [local]

Marianne reads the packaged class map, then ~/.marianne/classes.yaml, then the venue's .marianne/classes.yaml relative to the reading process's working directory (the conductor's, not the score's, so under the shipped unit the conductor's venue file is $HOME/.marianne/classes.yaml; a score that depends on a different venue file beside it is refused at submit, GH #510). A higher layer replaces a class's entire ordered chain; null removes one. A score alias takes precedence over a registered profile, and a registered profile takes precedence over a class. The resolved class chain is saved with the job, so editing the map changes new jobs while an existing job keeps its original routes on resume. A chain may name profiles this machine lacks: the job is admitted and starts at the first entry that can run (mzt validate says which, as a V311 warning; when no entry is installed yet the same warning says so and names the install — the score is still admitted); only a class with no registered entry at all is refused (V310). Use mzt instruments classes show --json to inspect the winning layers and mzt instruments classes check to inspect current availability. mzt instruments classes write --if-absent creates a machine-specific user map without overwriting an existing one. The writer ranks shipped names using their effective user/venue overrides; an additional user or venue profile name joins a generated chain only where its own class_hints put it (class_hints: {strong: "after opencode"} in the profile YAML), so a machine with a working GLM or Gemini route gets it into the map without a hand edit. A hinted profile still has to pass the class's own probe; when it does not, the writer says why in the map's header comment and on the terminal (localbox: not seated in 'workhorse': lacks file_editing, tool_use (an http endpoint answers but has no filesystem; route it through opencode for file-writing classes)), so an empty workhorse: names its cause.

Class entries may select a model, but a score-level or sheet-level model cannot override a class primary. Use a score alias or named profile for a fixed model or a reviewed expected_route. instrument: cli is the deterministic shell profile.

Instrument Configuration

Pin the model on every model seat. A profile with default_model: null (claude-code, codex-cli) leaves the model to the harness, so an unpinned seat follows whatever the operator last selected in that CLI: the score does not say which model ran, cost cannot be priced from it, and a flagship default can drain a shared subscription limit. Set instrument_config.model, an alias config: {model: ...}, or a class/chain entry model. mzt validate notes it (V336, INFO) for every sheet and fallback that does not; it does not fail --strict.

Override instrument defaults with instrument_config::

instrument: gemini-cli
instrument_config:
  model: gemini-2.5-flash       # Use the cheaper model
  timeout_seconds: 600           # Shorter timeout

These overrides are flat key-value pairs that adjust the resolved instrument profile without replacing it.

GPT-5.6 is a model family played through the codex-cli instrument. Select a tier explicitly when the score needs one:

instrument: codex-cli
instrument_config:
  model: gpt-5.6-luna

If instrument_config.model is omitted, Marianne passes no --model flag and the installed Codex client chooses its configured default. Marianne does not implicitly default Codex to Luna, Terra, or Sol.


Adding Your Own Instruments

Any CLI tool that accepts a prompt and produces output can become a Marianne instrument. You write a YAML profile describing the tool's CLI interface and drop it in a directory Marianne scans.

Profile Directories

Marianne loads instrument profiles from three directories, in order:

  1. Built-in — shipped with Marianne (lowest precedence)
  2. Organization — ~/.marianne/instruments/ (shared across all projects)
  3. Venue — .marianne/instruments/ (project-specific, highest precedence)

Later directories override earlier ones on name collision. This lets you customize a built-in profile for your project without modifying Marianne's source.

Changing One Field of a Built-in: extends

A file with the same name replaces the built-in whole. A full copy keeps working but never gains the blocks the built-in adds later. Use extends instead. The file is merged over the profile of that name from a lower layer.

# ~/.marianne/instruments/claude-code.yaml
extends: claude-code
default_model: "glm-5.3[1m]"

Mappings merge key by key. Scalars and lists you write replace the base. An explicit null removes a key. name defaults to the base name. extends works only in organization and venue files, and the base must live in a layer below the file's own. A missing base, a cycle, or extends in a built-in is a load failure that mzt doctor reports. mzt doctor also lists the keys a whole copy of a built-in lacks.

Writing a Profile

Here is a minimal profile for a hypothetical CLI tool:

# ~/.marianne/instruments/my-tool.yaml

name: my-tool
display_name: "My Tool"
description: "Custom CLI agent for my project"
kind: cli

capabilities:
  - file_editing
  - shell_access

default_timeout_seconds: 1800

cli:
  command:
    executable: my-tool           # Binary name on PATH
    prompt_flag: "--prompt"       # How to pass the prompt
    auto_approve_flag: "--yes"    # How to skip confirmation dialogs
  output:
    format: text                  # Capture stdout as the result
  errors:
    rate_limit_patterns:
      - "rate.?limit"
      - "429"

Save it to ~/.marianne/instruments/my-tool.yaml, then verify:

mzt instruments check my-tool

Profile Reference

Top-Level Fields

Field Required Description
name Yes Unique identifier used in score YAML (instrument: my-tool)
display_name Yes Human-readable name for CLI output
description No Short description of the tool
kind Yes cli (v1) or http (v1.1+)
capabilities No Set of capability tags (see below)
models No List of available models with pricing and context windows
default_model No Model to use when none specified in the score
default_timeout_seconds No Default execution timeout (default: 1800)
class_hints No Where mzt instruments classes write seats this profile per class: {strong: "after opencode", fast: first} — first, last, after <profile> or before <profile>. Additional user/venue names need a hint; same-named overrides use shipped rankings unless a local hint changes them. All profiles still pass the class's capability and availability probe; a named anchor missing from the chain seats it last (GH #469)

Capability Tags

Capabilities describe what an instrument can do. They are informational in v1 and used by the conductor for instrument selection in future versions.

Tag Meaning
tool_use Can call external tools
file_editing Can read and write files
shell_access Can execute shell commands
vision Can process images
mcp Supports Model Context Protocol servers
structured_output Can produce JSON output
streaming Supports streaming responses
thinking Has extended reasoning/thinking mode
session_resume Can resume previous sessions
code_mode Supports code-mode techniques (v1.1+)

cli.command — How to Build the Command

Field Required Default Description
executable Yes Binary name (must be on PATH)
subcommand No Subcommand, e.g. exec for Codex
prompt_flag No Flag for the prompt (-p, --message). null = positional argument
model_flag No Flag for model selection (--model)
auto_approve_flag No Flag for auto-approval (--yolo, --yes)
output_format_flag No Flag for output format (--output-format, --json)
output_format_value No Value for output format flag (json). null = boolean flag
system_prompt_flag No Flag for system prompt
allowed_tools_flag No Deprecated and ignored (nothing ever read it); accepted so an older profile still loads. Use the profile's top-level tools: block (below).
mcp_config_flag No Flag for MCP server configuration
mcp_config_prefix_args No [] Args to add immediately before an active MCP config flag/path, such as --strict-mcp-config
mcp_config_workspace_path No Workspace-relative MCP config file path for CLIs that discover MCP servers from disk
mcp_config_workspace_merge_key No JSON key to merge generated MCP servers into when the workspace path is a broader settings file
timeout_flag No Flag for per-execution timeout
working_dir_flag No Flag for working directory. null = subprocess cwd
extra_flags No [] Fixed flags always appended
schema_extra_flags No Flags appended instead of extra_flags when the sheet runs in schema mode (response_format through json_schema_flag). Unset = schema sheets inherit extra_flags; [] = none. The shipped claude-code profile sends --effort high here because --effort max with --json-schema emits nothing until killed on Claude Code 2.1.307.
env No {} Environment variables. ${VAR} references expand from os.environ
required_env No null Parent variables allowed alongside system essentials and profile env. Missing or [] grants no additional variables.
inherit_env No false Explicit full-environment inheritance when required_env is null. An explicit list takes precedence. Exposes unrelated credentials.
supervise No true Launch the instrument under Marianne's Linux instrument supervisor: a child subreaper in the instrument's own process group. A grandchild whose parent exits (an agent's filesystem-search helper, a disowned shell) re-parents to the supervisor instead of init, and is ended and reaped when the instrument exits or the attempt is torn down. The supervisor also writes a JSON forensic report (forwarded-signal history, escalation decision) next to the transcript, which interactive attempts use to attribute a pane's death (GH #487). Set false only for an instrument the supervisor cannot wrap. Where the subreaper is unavailable (not Linux) the instrument is spawned directly and the backend's own descendant reaper (GH #406) is the only guard.
max_open_files No 4096 Soft RLIMIT_NOFILE the supervisor sets for the instrument and everything it spawns, so a runaway search or a leaking helper is bounded to its share of the host's file table (the conductor's own limit on a server is often 1,048,576). Never raised above the hard limit; null leaves the conductor's limit in place. Ignored when supervise is false.
io_priority No low I/O scheduling class the supervisor gives the instrument and everything it spawns: low (best-effort, lowest priority) keeps an agent's whole-disk search from stalling the conductor's own state reads; idle yields to every other process; inherit keeps the conductor's class. Ignored when supervise is false.
prompt_via_stdin No true Write the assembled prompt to the child's stdin instead of argv. Prompts routinely exceed 100 KB with prelude/cadenza injection, and Linux caps a single argv entry at 128 KiB (E2BIG, "Argument list too long" before the process starts). Set false only for a CLI that cannot read stdin
stdin_sentinel No What to put after prompt_flag when the prompt goes to stdin: - for Claude Code's -p -; "" keeps the flag with an empty value (Antigravity's -p ''). Unset = omit the flag entirely
json_schema_flag No Flag that makes the CLI enforce a JSON schema, e.g. Claude Code's --json-schema (the shipped claude-code profile declares it). With it, a sheet's instrument_config.response_format (type: json_schema) is honoured and the terminal JSON's structured_output becomes the result; without it, such a sheet is refused at dispatch and mzt validate warns V311. Requires output.format: json. Schema mode rides on the model calling Claude Code's StructuredOutput tool: measured 2026-10-21, Claude models did 3/3, while the GLM-5.3 route through Claude Code missed it 1 time in 3 (it answered in prose, which the parser refuses and the baton retries). Prove the model you route with mzt instruments check claude-code --live --model <m>. A CLI that prints an array of events for --output-format json (Claude Code with verbose: true in its settings) is read from its last type: result object
stdin_json_template No For a CLI whose only stdin path is a structured stream: this object is written as ONE JSON line with every "{prompt}" string replaced by the prompt (nested keys are walked). Antigravity: {event: user, message: {role: user, content: "{prompt}"}} with --input-format stream-json

Per-sheet toolset: tools:

A score sets instrument_config.tools (GH #534), a list of the harness's own tool names. A profile declares a top-level tools: block saying how the list is delivered:

Field Required Meaning
delivery Yes flag: <flag> <names joined into one argument>
flag Yes The switch that limits the tool definitions the model is given
join No (comma) comma or space
known No Tool names the harness accepts; a name outside it is refused (V337). Absent = any name passes through
interactive No (true) false when the interactive command has no such option

The flag must be the one that REMOVES tool definitions from the model's context, not one that only changes permissions. On Claude Code, claude --help (2.1.322) says --tools <tools...>: "Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use the default set, or specify tool names (e.g. "Bash,Edit,Read")." --allowedTools is "Comma or space-separated list of tool names to allow" and --disallowedTools "to deny": permission lists, so the builtin uses --tools. A default already in the fixed flags is replaced, never doubled, and a sheet that sets nothing builds the same command as before. An empty list is delivered as one empty argument (--tools "").

What each builtin declares, verified on 2026-11-11 from --help and --version only (no model was called, and the claude-code flag was not exercised with a model call in this change):

Profile Control Declared Verified from / why none
claude-code yes flag --tools, comma-joined, no known list claude --help, 2.1.322 (the help shows example names, not the full set)
claude-code-ollama yes same block same binary and flag; not exercised against a local model
antigravity none found none agy --help, 1.5.5: only --dangerously-skip-permissions (permissions) and --disable-slash-commands
codex-cli none found none codex exec --help, 0.166.0: no tool-list option
opencode none found none opencode run --help, 1.19.4: only --auto (permissions)
crush none found none crush --help and crush run --help, v0.98.2: no tool-list option
goose not equivalent none goose run --help, 1.30.0: --with-builtin adds extensions, not a per-tool list
gemini-cli permission only none gemini --help, 0.50.0: --allowed-tools skips confirmation (deprecated) and does not remove definitions
aider none found none aider --help, 0.86.2: only colour options mention tools
cline-cli, qwen-code, openclaw unverified none not installed where surveyed
cli, ollama (HTTP) n/a none a shell command, and an HTTP profile (tools: needs kind: cli)

"None found" means the help text lists no such option; a harness may still have one in a settings file, which this block cannot write.

The claude-code block, verbatim:

tools:
  delivery: flag
  flag: "--tools"
  join: comma

Reasoning effort: one vocabulary, each profile maps it

A score sets instrument_config.effort (GH #535) in Marianne's vocabulary, lowest first: minimal, low, medium, high, xhigh, max. The words are the ones Claude Code, Antigravity and Codex print for their reasoning control, plus minimal, "the least reasoning this seat offers", which OpenAI-family models and opencode variants name. none (reasoning off) and Codex's ultra (adds task delegation) are different requests and are not levels.

A profile declares a top-level effort: block that maps those words to its harness's own and says how the word is delivered:

Field Required Description
delivery Yes flag: <flag> <native> on the command. config_override: <flag> <key>=<native>. body_field: the HTTP request JSON gets <key> = native (kind: http only; a dotted key is a nested object)
flag flag, config_override The effort flag (--effort, --variant), or the override switch (codex -c)
key config_override, body_field Config key (codex model_reasoning_effort) or request-body path (reasoning_effort, reasoning.effort)
levels No ({}) Marianne level → native word. Several levels may share a word (minimal: low); a level left out is refused naming the mapped ones. {} = each model row decides
schema_levels No The Marianne levels a schema sheet (response_format) may use; unset = all mapped levels. The profile's own schema default must be a value one of them maps to
interactive No (true) false when the harness's interactive command has no such option; an interactive sheet that sets effort is then refused

A model row may carry effort_levels (same shape as levels), which replaces the profile's map when the sheet runs on that model; {} means that model has no reasoning control. This exists because a harness can run models with different controls: opencode models --verbose lists variants low, high, max for zai-coding-plan/glm-5.3 and none for glm-4.7.

A sheet with effort set gets the native word where the profile's fixed flags (extra_flags, schema_extra_flags, cli.interactive.extra_args) already carry a default, replaced in place and never doubled, or appended where none stands. A sheet that does not set it builds exactly the command it built before the block existed, on every profile. Every default already in those flag lists must be a native value the block maps, or the profile does not load.

What each builtin declares, verified on 2026-11-11 from --help, --version and the harness's local model catalog (no model was called, and no mapping other than claude-code's was exercised with a model call):

Profile Mapping Delivery shape Marianne levels accepted Verified from / why none
claude-code yes flag --effort all six (minimal runs as low); a schema sheet: minimal to high only. Default stays max (high on schema sheets) claude --help, 2.1.322
antigravity yes flag --effort all six (minimal runs as low) agy --help, 1.5.5
codex-cli yes config_override -c model_reasoning_effort=<v> all six (minimal runs as low); the o3 and o4-mini rows accept none codex exec --help, 0.166.0; levels from codex's local model catalog, in which o3 and o4-mini do not appear
opencode yes, per model flag --variant, interactive: false the three zai-coding-plan/glm-5.3 rows (glm-5.3, -flash, -highspeed): minimal, low, high, max; every other row none. Refused on interactive sheets (the TUI has no --variant) opencode run --help, 1.19.4; opencode models --verbose variants
crush yes, per model flag --reasoning-effort google/gemma-4-31b-it:free: minimal, low, medium, high; every other row none (qwen/qwen3-coder:free cannot reason) crush run --help, v0.98.2; crush's provider catalog
gemini-cli no none none gemini --help, 0.50.0 has no flag; the control is thinkingLevel in settings.json, and no delivery shape writes a settings file
aider no none none aider --help, 0.86.2 has --reasoning-effort but it passes values through to the configured model and provider; what they accept is unverified
goose no none none goose run --help, 1.30.0 lists no reasoning option
claude-code-ollama no none none the flag exists in Claude Code, but this profile's seam was verified without it
polystrata yes body_field reasoning_effort: minimal -> none, low, medium, high xhigh and max are refused PolyStrata AI_SETUP.md documents reasoning_effort: none\|low\|medium\|high (default high); not yet run against a live server
cline-cli, qwen-code, openclaw no none none not installed where surveyed, so no flag could be verified
cli no none none runs a shell command, not a model
ollama (HTTP) no none none the default llama3.1:8b has no reasoning control and Ollama was not installed to check. The body_field shape is implemented and tested with a made-up profile only

Antigravity also encodes a tier in some model slugs (gemini-3.8-flash-high). That is a model choice, made with model:; Marianne does not rewrite a slug from effort, because the slug is the model identity the baton keys concurrency, cost and guarded routes on. Both can be set; what the harness does when the flag and the slug disagree has not been verified.

The claude-code block, verbatim:

effort:
  delivery: flag
  flag: "--effort"
  levels: {minimal: low, low: low, medium: medium, high: high, xhigh: xhigh, max: max}
  schema_levels: [minimal, low, medium, high]

Your own profile under ~/.marianne/instruments/ or .marianne/instruments/ declares the same block, with no code change:

name: my-reasoner
kind: http
default_model: my-model
models:
  - {name: my-model, context_window: 128000, cost_per_1k_input: 0, cost_per_1k_output: 0}
effort:
  delivery: body_field
  key: reasoning_effort          # sent as {"reasoning_effort": "<native>"}
  levels: {low: low, medium: medium, high: high}
http:
  base_url: http://localhost:8080/v1
  schema_family: openai

Profiles replace one another whole, so a user-layer or venue copy of a builtin made before the block existed still works for every score that does not set effort, and refuses (V335, then dispatch) a score that does: copy the builtin's effort: block (and any row effort_levels), or delete the copy in favour of the builtin plus a score alias. Map only levels you have seen the harness accept in its own help or catalog, and run one sheet at each level before relying on it: mzt instruments check --live proves the profile's defaults, not each level. The only measurement so far is on Claude Code (one small task, three runs per level): Sonnet 5.5 spent about 2.3 times the reasoning tokens at max as at high, low/medium/high did not differ, and Haiku showed no usable effect. No saving is claimed for any other harness.

Environment the musician receives

CLI instruments receive only system essentials (PATH, HOME, USER, terminal/locale/temp settings and the listed XDG paths), variables named in cli.command.required_env, and profile env entries. Missing required_env and [] both grant no additional parent variables. The same policy applies to exec and interactive/tmux launches; panes replace the tmux server environment. Profile env entries expand ${VAR} from the parent and override allowed values.

To migrate a profile that relied on ambient credentials, declare the variables its CLI actually reads:

cli:
  command:
    executable: my-agent
    required_env: [MY_AGENT_API_KEY, HTTPS_PROXY]

Use required_env: [] for a CLI using its own credential store. As a temporary migration opt-out, cli.command.inherit_env: true inherits the full conductor environment when required_env is absent or null. An explicit required_env list (including []) still filters even with this opt-out. mzt doctor names ready agent profiles using full inheritance when credential-shaped variables are set, without printing values (GH #335).

The shipped aider, cline-cli, crush and shell cli profiles explicitly use required_env: []. Cline can use its configured settings; other tools may use their own credential stores where supported. For environment-based provider authentication, set cli.command.required_env in your local profile to the specific key names your selected provider needs (for example, [OPENAI_API_KEY] for an OpenAI route). Shell validation steps that need build credentials or other non-system variables must likewise declare them. No provider keys are granted automatically to these four profiles.

This filters environment variables only. HOME and XDG paths remain available; file-based credentials, daemon MCP children and hooks require separate isolation.

Every CLI and interactive instrument is also started with MARIANNE_SCRATCH set to the job's scratch root <workspace>/.marianne-scratch (created before launch). Anything an agent needs outside the workspace proper, such as a probe clone, a mutant tree or a git worktree, belongs under that path: the conductor deletes it when the job ends (workspace_lifecycle.scratch, GH #460). A clone made in a system temp directory has no owner once the sheet ends and is never reaped.

In any job, instruments also receive MARIANNE_MAILBOX (the shared inbox root, <scratch>/mailbox), MARIANNE_SHEET (this sheet's number), and a pre-created personal inbox. They matter in fan-out jobs with messaging enabled (sheet.fan_out_messaging: file, the default), where the prompt tells each musician its siblings and how to reach them: shell-capable musicians exchange messages with mzt mail send <sheet|all> "<text>" and poll with mzt mail read [--since]; see the CLI reference. A received message is data, not an instruction.

Operator hooks and detecting a musician (GH #536)

MARIANNE_SHEET is set in the environment of every sheet, headless and interactive, and is the supported way for a hook or wrapper to tell a musician from the operator's own session. Without a check, a user-level harness hook (a Claude Code SessionStart hook that loads memory files, say) runs in every sheet and its output is re-read on every request: one operator hook cost 212 of 278 musician sessions about 28 KB each.

#!/bin/sh
# Top of any user-level hook: do nothing inside a Marianne sheet.
[ -n "${MARIANNE_SHEET:-}" ] && exit 0

Security trade-off. Musicians run with auto-approval (--dangerously-skip-permissions), so the operator's PreToolUse and PostToolUse hooks (command guards, secret scanners, audit loggers) may be the only guardrail on a sheet. The builtin claude-code profile therefore does NOT disable hooks: the recommended fix for a noisy hook is the MARIANNE_SHEET check above. Claude Code merges hook lists across settings sources (an empty hooks.SessionStart passed through --settings did not stop a user-level SessionStart hook, measured on 2.1.322), so no per-event override exists. The only switch is all-or-nothing: the opt-in profile field cli.command.disable_hooks_args (Claude Code form: ["--settings", '{"disableAllHooks":true}']) in a profile copy, which disables EVERY operator hook in a musician, safety hooks included. (--setting-sources project,local and --bare would also drop the user-level gateway env and the login.) With the field unset the argv is unchanged.

mzt doctor lists the user-level hooks by event and program name only. It marks SessionStart and UserPromptSubmit hooks as adding to every sheet's context unless they check MARIANNE_SHEET, PreToolUse/PostToolUse/Stop hooks as running in musicians (intended for safety hooks), and warns when a profile disables all hooks while PreToolUse/PostToolUse hooks exist.

cli — Lifecycle bounds

Every CLI attempt is one process tree. The backend starts the instrument in its own session and process group; with command.supervise (the default on Linux) the direct child is the instrument supervisor, which shares that group and adopts every descendant whose parent exits. Teardown signals the group, the supervisor ends and reaps what it adopted, and the backend's descendant reaper settles anything the supervisor could not see. On Pallas (20 Oct 2026) eight bfs/ugrep searches from / outlived their sheets at ppid 1 for hours and saturated the disk; the supervisor is the fix, and the low I/O class bounds the damage a live search can do. For interactive (tmux) instruments, whose panes the baton tracks separately, the tracked group leader's kernel start ticks are captured at spawn time and re-verified before any group kill (GH #487): a stale tracking entry whose pgid has been recycled by an unrelated process is refused (logged, never signalled), so a missed deregistration can never route TERM→KILL into a live unrelated group. A probe gap (no recorded ticks, or an unreadable /proc entry) stays fail-open — it proceeds with the kill, per the #344 rule that a probe gap must never skip a legitimate one.

Field Default Description
post_exit_drain_grace_seconds 3.0 Maximum time to drain inherited pipes after the CLI parent exits
first_output_timeout_seconds unset Seconds the CLI may run with zero bytes on stdout and stderr before the attempt is ended as a stall (GH #434). A streaming agent emits its init event within seconds of a healthy start, so silence is a dead session, not thinking: the attempt ends with a Stale execution marker, the baton retries after 120 s and then falls back, and the sheet timeout is not burned. The shipped jsonl profiles (codex-cli, opencode, antigravity) set 90; json and text profiles leave it unset because they emit nothing until the end (claude-code's --output-format json is one: its stalls are bounded only by the sheet timeout until that profile moves to stream-json). A long silence AFTER the first byte is never struck by this bound.

Per-sheet instrument_config.first_output_timeout_seconds overrides this profile default (GH #502). Omit the key to inherit the profile; set a finite positive number to widen or narrow the first-output bound; set null to disable it for that sheet. The sheet timeout always caps execution, including when the override exceeds it or disables the first-output bound. Once any stdout or stderr byte arrives, only the sheet timeout governs. For example, under known backup or IO pressure a sheet can set instrument_config: {first_output_timeout_seconds: 240} without changing the shared profile or other concurrent sheets. This setting applies to CLI backends; HTTP and interactive backends warn and ignore it.

cli.output — How to Parse the Result

Field Required Default Description
format No text text, json, or jsonl
result_path No JSON dot-path to response text (result, response)
error_path No JSON dot-path to error message (error.message)
error_flag_path No JSON dot-path to a terminal boolean error flag; exactly true fails the attempt even at a successful exit code (unset preserves exit-code behavior; qwen-code uses is_error)
completion_event_type No For JSONL: event type signaling completion
event_type_key No type For JSONL: the key that carries each event's type (event for Antigravity's stream-json)
completion_event_filter No For JSONL: additional key-value filter
input_tokens_path No JSON dot-path to input token count
output_tokens_path No JSON dot-path to output token count
cache_read_tokens_path No JSON dot-path to the input tokens the provider served from its prompt cache (Anthropic usage.cache_read_input_tokens, OpenAI usage.cached_input_tokens). Billed at the cache rate; the first number a token-efficiency change moves. Unset records 0.
model_usage_path No JSON dot-path to an object keyed by model id (Claude Code modelUsage); the key with the most outputTokens is recorded as the attempt's observed model (model_observed), so a seat that named no model still shows what ran (GH #538)
cache_write_tokens_path No JSON dot-path to the input tokens written into the prompt cache this attempt (Anthropic usage.cache_creation_input_tokens, OpenAI usage.cache_write_input_tokens)

Interactive token usage (cli.interactive.usage, GH #533). A tmux session has no JSON stdout, so a profile declares where its harness writes a per-session usage record and the backend reads it when the sheet ends, on every outcome (completed, timeout, nudges exhausted, session lost). Keys: session_id_flag (launcher chooses the id; the backend passes a fresh UUID), record_path (path or glob with {session_id}, ~ expanded, newest match read), record_filter (path -> value a line must match), dedupe_key_path (one API response spans several lines; the last per key counts once), model_path and ignore_models (the observed model; lines of an ignored model carry no usage), and input_tokens_path, output_tokens_path, cache_read_tokens_path, cache_write_tokens_path (paths on a record line). Subagent lines are counted when they are in the same file; a subagent record in a separate file is not read. Only claude-code declares the block (claude-code-ollama has no interactive mode). A profile without it, or a missing, unreadable or empty record, yields an unmeasured sheet: cost_uncertain is set (the same flag as missing pricing), the token counts stay absent rather than 0, and mzt status warns that cost is unknown, not free. A user-layer claude-code.yaml replaces the builtin whole and needs its own usage: block.

Output format modes:

  • text — Stdout is the result. No structured parsing. Use this for tools without JSON output (like Aider).
  • json — Parse stdout as JSON. Extract the response via result_path (dot notation: key.subkey, key[0], key.* for wildcard).
  • jsonl — Split stdout into JSON lines. Find the completion event matching completion_event_type and completion_event_filter.

cli.errors — How to Detect Failures

Field Default Description
success_exit_codes [0] Exit codes that indicate success
rate_limit_patterns [] Regex patterns indicating rate limiting. Scanned against stderr, and for a json/jsonl output profile also against the error text of the structured stream's terminal record (error/message/codex_error_info keys, and the result text of a Claude Code terminal object with is_error: true), never against agent prose: Codex --json reports a quota refusal as the last JSONL record on stdout with an empty stderr, and Claude Code reports its weekly limit as api_error_status: 429 in its terminal result (GH #507)
auth_error_patterns [] Regex patterns indicating auth failures
unavailable_patterns [] Regex patterns in the harness's own startup refusal meaning it cannot run here at all: no provider configured, provider not found, backend not reachable (GH #389). A match types the attempt INSTRUMENT_UNAVAILABLE: the sheet advances its fallback chain on the first attempt without charging a retry, exactly as a missing binary does, instead of running to its timeout per misconfigured entry. The shipped goose, crush and opencode profiles carry their measured refusals (No provider configured, No providers configured, Provider not found / ProviderModelNotFoundError).
capacity_patterns [] Regex patterns indicating capacity/overload errors (retried)
timeout_patterns [] Regex patterns indicating timeout errors (retried)
crash_patterns [] Regex patterns indicating a process crash or fatal error
stale_patterns [] Regex patterns indicating a stale execution

These patterns are the instrument's own word on its failures. A rate_limit_patterns match pauses the instrument; an auth_error_patterns match types the result as a credential rejection, which is the only way text can produce AUTH_FAILURE (the built-in classifier's generic auth words are diagnosis only); an unavailable_patterns match types it as the route being unusable on this machine, the only way text can produce INSTRUMENT_UNAVAILABLE. First match wins in the order auth, unavailable, crash, stale, timeout, capacity, and every pattern is compiled when the profile loads, so a bad regex is refused there rather than mid-attempt. Keep them anchored to the instrument's real messages.

An interactive (tmux) attempt whose agent process ends without writing the completion marker fails as session_lost with the cause tmux recorded: the pane is created with remain-on-exit so the driver reads pane_dead_status / pane_dead_signal and the attempt's error reads agent process killed by SIGKILL before signalling completion or agent process exited with status N …. Only when tmux no longer holds the session at all (server gone, session killed by name) does it read agent session vanished …. The driver kills the session on every outcome, so a dead pane never outlives its attempt.

Because tmux's pane_dead_signal only ever shows the final signal — the supervisor's own escalation — a benign forwarded SIGHUP escalated after the grace was indistinguishable from an external SIGKILL. Under command.supervise the attempt's session_lost detail now carries the supervisor's forensics (GH #487): the report is written next to the transcript as <session>.supervisor.json, and the detail says supervisor forwarded SIGHUP (first at t=0.2s), child did not exit within 1.0s, escalated to SIGKILL when the supervisor ended the child, supervisor observed no forwarded signal — death not sent by the supervisor: external kill when the supervisor wrote a report but forwarded nothing (the strongest external-kill evidence a report can give), or no supervisor report — death not observed by the supervisor: external kill, or the supervisor died first when no report exists at all. A missing or malformed report never fails the attempt; forensics are evidence, not an error path. The backend also logs the report (interactive_supervisor_report with the forwarded signals and escalation fields) for observability on every supervised attempt.

models — Available Models

Each model entry describes capacity and pricing:

models:
  - name: gemini-2.5-pro
    context_window: 1000000      # Max context in tokens
    cost_per_1k_input: 0.00125   # USD per 1K input tokens
    cost_per_1k_output: 0.005    # USD per 1K output tokens
    cost_per_1k_cache_read: 0.000125   # USD per 1K input tokens served from the prompt cache
    cost_per_1k_cache_write: 0.0015625 # USD per 1K input tokens written to the cache (Anthropic bills 125%)
    max_output_tokens: 65536     # Max output tokens (null if unlimited)

A sheet is priced at the row of the model it is bound to (an alias pin, or the fallback's own model), then the profile's default model, then the first row; mzt status and the loop cost caps read that figure. Cache prices are optional: a row without them charges cache tokens at the input rate, so an unpriced row is never cheaper than before cache counts existed. mzt instruments prices reports every row that differs from models.dev, and --write updates the builtin rows (never your own profiles); run it when a provider reprices or before trusting a cost figure. The shipped rows were last reconciled on 2026-11-10.

Model metadata enables cost tracking in mzt status and context budget calculation. If you omit models, cost tracking shows $0.00 and context budget uses a conservative default. A declared context_window also bounds prompt preflight for any profile kind: when an instrument is given alongside the model, a model absent from the curated table resolves its effective input budget from the profile's declared window minus a 4,096-token output reservation (exact model-name match; curated table entries always win), so a small-declared model such as qwen3:8b (40,960 tokens) is advised against oversized prompts even though the instrument default is larger.

For an http profile the entry also bounds the request: the HTTP executor sends max_tokens of 16,384 by default (or the sheet's instrument_config.max_tokens), and caps it at the bound model's max_output_tokens, or its context_window when that is smaller. A local server refuses a max_tokens above its context with HTTP 400 before generating anything (PolyStrata, llama-server and Ollama with a small num_ctx all do), so declare the real context of a small local model and the first sheet runs instead of failing on the transport's guess. mzt instruments check <name> reads the loaded model's context from the server's GET /props (default_generation_settings.n_ctx, the field llama-server and PolyStrata share) and warns when the profile declares more; mzt validate says the same as V234 for the score's chain.


Claude Code over local Ollama

Use instrument: claude-code-ollama for the Claude Code agent harness with a local model: file edits, shell commands, and tool use run through claude. Use instrument: ollama for a raw HTTP prompt without filesystem or shell access. The two profiles coexist in the generated local and cheap chains, with ollama first and claude-code-ollama second.

Install Claude Code (claude on PATH), start ollama serve, and pull llama3.1:8b (the default) or qwen3:8b. Select a pulled tag with instrument_config.model. Configure Ollama's context size for your workload; profile context windows describe model ceilings, not the running server's allocation. The profile does not start the server or download models. Its CLI availability probe checks only the binary; a ready probe does not establish server connectivity or model presence.

The profile pins ANTHROPIC_BASE_URL=http://localhost:11434, ANTHROPIC_AUTH_TOKEN=local, and an empty ANTHROPIC_API_KEY via cli.command.env. It filters parent cloud-provider switches and credentials. For a different origin, copy the builtin to ~/.marianne/instruments/ under the same name and edit cli.command.env.ANTHROPIC_BASE_URL. You can use "${OLLAMA_HOST}" there with an exported full HTTP origin; the default profile uses the literal localhost URL. Shell-style ${VAR:-default} is not supported. Reload the conductor after changing a profile.

Ollama's Claude Code integration also provides ollama launch claude for interactive setup. Marianne invokes claude directly with the endpoint environment already set. Transport was verified with Claude Code 2.1.319 against a local mock Anthropic-compatible server on 2026-11-06. Real Ollama model tool calls and schema output remain unverified; support depends on the selected model. Vision, streaming, and thinking capabilities are not advertised by this profile.

http — OpenAI-compatible HTTP profiles (kind: http)

A profile with kind: http carries no cli: block. Instead it names an OpenAI-compatible chat-completions endpoint and the conductor dispatches requests through the shared HTTP executor (execution/instruments/openai_compat_backend.py). Only one wire contract exists today: schema_family: openai.

Field Required Description
base_url Yes API root, e.g. http://localhost:11434/v1 or https://openrouter.ai/api/v1
endpoint No Path appended to base_url (default /v1/chat/completions; set /chat/completions when base_url already ends in /v1)
schema_family Yes openai — the request/response contract the executor speaks
auth_env_var No Name of the environment variable holding the bearer token; omit for unauthenticated local servers
response_format No Opt-in structured output ({type: json_object} or {type: json_schema, json_schema: {...}}), forwarded unchanged; per-sheet instrument_config.response_format overrides it

The shipped ollama profile is the minimal shape (local, unauthenticated). Its default_model must be one the local server actually serves: mzt validate, mzt instruments classes check and dispatch preflight list the server's models (/v1/models) and report the profile unavailable, naming what is served, when the default is missing; set instrument_config.model in the score or default_model in a user copy of the profile to a pulled tag. A local server that does not answer at all is a reachability warning (V215), not a model miss; a loopback server that answers and serves the model makes the chain runnable for V215, the same as an installed CLI binary.

A profile in the project's .marianne/instruments/ is read by mzt validate, mzt instruments check and mzt instruments list from the directory you run them in, but the conductor loads its venue directory once, from the directory mzt start was run in. A score that binds a venue profile this conductor never loaded is refused at submit, naming both directories: start the conductor from the project directory, or put the profile in ~/.marianne/instruments/ and run mzt conductor reload.

name: ollama
display_name: "Ollama"
kind: http
default_model: llama3.1:8b
models:
  - name: llama3.1:8b
    context_window: 32768
    cost_per_1k_input: 0.0
    cost_per_1k_output: 0.0
http:
  base_url: http://localhost:11434/v1
  endpoint: /chat/completions
  schema_family: openai

A hosted OpenAI-compatible provider adds the token variable and real pricing:

name: openrouter
display_name: "OpenRouter"
kind: http
default_model: openai/gpt-5.3-codex
models:
  - name: openai/gpt-5.3-codex
    context_window: 272000
    cost_per_1k_input: 0.002
    cost_per_1k_output: 0.01
http:
  base_url: https://openrouter.ai/api/v1
  endpoint: /chat/completions
  schema_family: openai
  auth_env_var: OPENROUTER_API_KEY

HTTP results record model_requested, model_observed and model_echo_status (see "HTTP model-echo evidence" below), so a provider that silently serves a different model is visible in mzt status and the checkpoint.


Local PolyStrata

PolyStrata (MIT) is a local server that runs large sparse mixture-of-experts models (Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, GLM 5.3 Flash, Gemma 4 26B-A4B, Tiel Coder, ...) on one consumer GPU by keeping the hot experts in VRAM and the rest in system RAM. It is supported the way Ollama is: the builtin polystrata profile is a plain endpoint (http://127.0.0.1:8080/v1, OpenAI-compatible), not tied to any harness.

  1. Install and start PolyStrata yourself (Marianne downloads nothing): git clone https://github.com/VecSzn/PolyStrata, run its setup for one model, then the run-<model> script it prints. curl http://127.0.0.1:8080/health shows "loaded": true when it is ready.
  2. mzt instruments check polystrata lists the model ids the server serves. Use one of them as default_model (a user-layer file that extends: polystrata can change it, the port, or set http.auth_env_var for a key).
  3. Use it like any instrument: instrument: polystrata, an alias over it, or a seat in a class chain. Effort maps to PolyStrata's reasoning_effort (minimal -> none, low, medium, high).

An agent harness on PolyStrata. PolyStrata also serves the Anthropic (/v1/messages) and Responses (/v1/responses) APIs, so any harness profile that takes a base URL can drive it: write a user-layer file that extends: the harness profile and sets the harness's own base-URL variable (ANTHROPIC_BASE_URL for claude-code, OPENAI_BASE_URL for qwen-code, a provider entry for opencode, and so on). Claude Code asks for 32,000 output tokens per request, so set "fit_max_tokens": true in PolyStrata's strata-<model>.json. The general walk-through is Local server quickstart.

One model is loaded at a time, and the server answers one request at a time unless started with --parallel N; max_concurrent: 1 in the profile matches that. Never expose PolyStrata beyond this machine without an API key.

How the Instrument System Works

Loading Order

At conductor startup:

  1. Built-in YAML profiles are loaded from Marianne's bundled instruments directory
  2. Organization profiles from ~/.marianne/instruments/ override built-ins
  3. Venue profiles from .marianne/instruments/ override everything

The result is a single InstrumentRegistry mapping names to profiles. When a score references instrument: gemini-cli, the conductor looks up that name in the registry and selects the CLI or OpenAI-compatible HTTP executor from the profile's kind and protocol settings.

Score Resolution

When a score is submitted, the instrument is resolved:

  1. If the score has instrument: — look up the name in the registry
  2. If omitted — default to claude-code

The resolved profile produces a shared execution-contract instance that the conductor uses to execute sheets.

Optional reviewed local HTTP and separately reviewed remote routes

Embedding clients may submit JobRequest.expected_route, a frozen InstrumentRouteBinding. It is not a score field and grants no permission to send data. Absence retains ordinary dispatch and retry behavior. The current local guarded arm supports observable HTTP profiles on loopback. A separately reviewed remote arm supports HTTPS HTTP profiles and configured CLI profiles with an explicit provider and model flag. Neither arm supports movement, instrument-map, per-sheet instrument or fallback alternatives. Local review is not authorization for remote processing; the caller owns that separate purpose.

marianne.instruments.loader.capture_instrument_route_binding accepts the score path, instrument, reviewed score SHA-256, and an aware now timestamp. It uses the conductor's profile loader and hashes the winning raw profile bytes. Callers outside the conductor's directory must supply the matching organization_dir and venue_dir; no registry context is guessed. Model precedence is score instrument_config.model, then profile default_model. Provider is a declaration only; an undeclared provider stays None.

The score digest verifies the bytes read by this capture helper only. The route binding does not carry that digest and does not atomically pin a later submission's score bytes. Callers must not treat route equality as score or prompt custody, consent, or a reservation of model work.

route_identity compares exactly thirteen declared fields: arm, instrument, kind, profile origin/digest, effective model/provider, their declaration sources, and HTTP scheme/host/port/endpoint. None is a value, not a wildcard. Only resolved_at is excluded. The immutable expectation persists through job/sheet checkpoints and is rechecked on resume. Immediately before HTTP POST, the backend captures current resolver state off the event loop, compares it to both the expectation and its loaded profile, and verifies the actual outbound model and endpoint. Capture must precede request start by at most 60 seconds; completion must not precede start. Drift refuses the attempt.

Guarded requests use a fresh HTTP client with environment proxies disabled, redirect following disabled, and transport retries zero. The client is closed in finally and never enters the ordinary shared pool. Failed or partially validated guarded attempts are terminal, including rate limits; they do not automatically retry, heal, or fall back. Unguarded requests retain their existing pooled-client and retry behavior.

For guarded CLI execution the same resolver compares the reviewed raw profile and loaded command at entry and again immediately before subprocess spawn, after command preparation and any awaited workspace MCP lock/config work. The reviewed binding must be between zero and sixty seconds old at both checks; the actual argv must select the exact reviewed model once. Drift returns a terminal attempt_route_drift without spawning the CLI. Configured provider, profile and model are command-selection evidence only, not service identity, CLI executable-byte attestation, or server-model attestation. The binding's profile_origin is organization for ~/.marianne/instruments/ and venue only for a project .marianne/instruments/ that is not that directory, so the same profile file yields the same route identity from every working directory (a reviewed route captured in $HOME and dispatched from a project directory used to drift on origin alone, GH #493).

HTTP model-echo evidence

The legacy model value may fall back to the requested model; it is not proof that the service echoed a model. HTTP results now separately retain model_requested, model_observed, and model_echo_status through the musician into the authoritative sheet checkpoint. Status is observed for a nonempty response string (preserved verbatim), absent for a missing key, malformed for a non-string, or empty for an empty/whitespace-only string. Old checkpoints and unguarded non-HTTP results default all three fields to None. Guarded CLI results retain model_requested from the reviewed command, while model_observed and model_echo_status remain None: no HTTP echo was observed. Observer events expose the status only, not the observed/requested strings.

Consumers requiring model provenance must read the completed job's retained sheet metadata, not model-written content, logs, or the legacy model field. Missing metadata is unverified. A response model identifier is a server assertion; it does not attest the service's loaded weights.

The daemon records an absent or mismatched echo; it does not reject an otherwise successful response solely for that reason. Consumers that require an exact echo must compare the retained observed identifier with their expected effective model before accepting the response. Their review, authorization, and reservation checks remain outside this transport guard.

On the initial and resumed baton completion paths, the final checkpoint (including the completion timestamp and last-attempt evidence) is acknowledged by the existing ordered writer before completed/failed registry status and the completion event are published. Other lifecycle transitions and exception paths are not covered by this terminal-publication guarantee.

Command Construction

For CLI instruments, the PluginCliBackend builds the command from the profile:

[executable] [subcommand] [auto_approve_flag] [output_format_flag value]
[model_flag model_name] [prompt_flag] <prompt> [...extra_flags]

The prompt is passed via prompt_flag (or as a positional argument if prompt_flag is null) only when prompt_via_stdin is false; by default it is written to the child's stdin (raw text, or the stdin_json_template envelope) and argv carries at most prompt_flag + stdin_sentinel. A profile with prompt_via_stdin: false and no sentinel is kept in argv even above 32 KB (the backend logs plugin_cli_stdin_not_supported_for_large_prompt), and a prompt past the kernel's per-argument cap fails to spawn with E2BIG; give such a CLI a stdin contract instead. The backend handles output parsing, token extraction, and error detection based on the profile configuration.

Error Handling

Marianne classifies execution errors into categories:

  • RATE_LIMIT — Detected via rate_limit_patterns or HTTP 429. The conductor pauses the instrument and schedules a retry when it recovers. Rate limits do not count as failures. When a sheet's whole fallback chain is exhausted and an entry is rate limited with a known expiry (the provider's stated reset, e.g. resets 1:20pm (UTC), clamped to 24 h), the sheet waits for the earliest expiry and is redispatched to that entry rather than failing the job.
  • AUTH_FAILURE — The backend typed a credential rejection for the route: a CLI profile's own auth_error_patterns matched, an HTTP route returned 401/403, or an interactive session hit its login gate. The sheet leaves that instrument at once and advances its fallback chain. Auth-looking words in an agent's own output ("Permission denied (publickey)", a test asserting 403, a traceback's "line 403") are not a credential failure: that attempt is an ordinary execution error retried on the same instrument, with E502 kept as the diagnosis.
  • INSTRUMENT_UNAVAILABLE — The route cannot be used on this machine: the binary is not on PATH, the HTTP endpoint refuses the connection, or the harness started and refused in its own voice (a CLI profile's unavailable_patterns matched: No provider configured, Provider not found). The sheet advances its fallback chain on the first attempt without charging a retry (GH #418, #389); with no chain left it takes the ordinary bounded retry path. The circuit breaker still counts the failure.
  • TRANSIENT — Timeouts, killed processes, temporary failures. The conductor retries with exponential backoff.
  • EXECUTION_ERROR — Other non-zero exit codes. Retried up to max_retries.

Examples

Using Gemini CLI for a Research Score

name: research-with-gemini
workspace: ./workspaces/research

instrument: gemini-cli
instrument_config:
  model: gemini-2.5-flash    # Cheaper for research tasks

sheet:
  size: 1
  total_items: 3

prompt:
  template: |
    {% if sheet_num == 1 %}
    Research the topic and write an outline in {{ workspace }}/outline.md
    {% elif sheet_num == 2 %}
    Expand the outline into a full report at {{ workspace }}/report.md
    {% else %}
    Review and polish {{ workspace }}/report.md for clarity and accuracy
    {% endif %}

validations:
  - type: file_exists
    path: "{workspace}/report.md"
    condition: "sheet_num >= 2"

Custom Instrument for a Private Tool

# .marianne/instruments/internal-agent.yaml
name: internal-agent
display_name: "Internal Agent"
description: "Company internal coding agent"
kind: cli

capabilities:
  - file_editing
  - shell_access
  - tool_use

default_timeout_seconds: 3600

cli:
  command:
    executable: internal-agent
    prompt_flag: "--task"
    model_flag: "--model"
    auto_approve_flag: "--non-interactive"
    output_format_flag: "--format"
    output_format_value: "json"
    env:
      AGENT_TOKEN: "${INTERNAL_AGENT_TOKEN}"
  output:
    format: json
    result_path: "output.text"
    input_tokens_path: "usage.prompt_tokens"
    output_tokens_path: "usage.completion_tokens"
  errors:
    rate_limit_patterns:
      - "rate.?limit"
      - "throttled"
    auth_error_patterns:
      - "unauthorized"
      - "token.*expired"

Then use it in a score:

instrument: internal-agent

Troubleshooting

Instrument not found

mzt instruments check my-tool
  Binary: my-tool ✗ not found

The executable is not on your PATH. Either install the tool or specify the full path in your instrument profile's executable field.

Rate limits not detected

If your instrument hits rate limits but Marianne doesn't detect them, add the rate limit text to cli.errors.rate_limit_patterns. A gateway in front of the provider speaks its own vocabulary: the Z.AI plan behind ANTHROPIC_BASE_URL or the OpenCode Z.AI provider answers "Weekly/Monthly Limit Exhausted. Your limit will reset at 2026-11-12 06:24:25", which the built-in claude-code and opencode profiles recognise (GH #509). A user-layer profile is a full replacement of the built-in, not a merge: when you copy a built-in to change its model, copy its errors patterns and its interactive.*_screen_patterns whole, and re-copy them when the built-in gains one, or an interactive musician's first-turn quota screen is nudged as an idle agent and the empty session is rescued by the previous pass's files. Use regex:

errors:
  rate_limit_patterns:
    - "rate.?limit"           # matches "rate limit", "rate_limit"
    - "429"                   # HTTP status code in output
    - "quota.?exceeded"       # quota limit messages
    - "too.?many.?requests"   # common pattern

No cost tracking

If mzt status shows $0.00 for all sheets, your instrument profile likely has no models section with pricing. Add model entries with cost_per_1k_input and cost_per_1k_output to enable cost tracking. If the figure looks wrong rather than zero, mzt instruments prices shows which rows have drifted from the provider's current prices.

Token counts not extracted

If token usage is zero, check that cli.output.input_tokens_path and cli.output.output_tokens_path point to the correct JSON paths in your tool's output. Use the wildcard syntax (key.*) for nested structures where the exact key varies.

input_tokens is what the harness calls input; on Anthropic and OpenAI that excludes the tokens served from the prompt cache, which a long agentic sheet re-reads on every turn (one 23-turn Claude Code sheet on 2026-11-09 was 139,198 input and 1,025,216 cache-read tokens). Set cache_read_tokens_path and cache_write_tokens_path so mzt status can show the cache share; a profile without them reports 0 and the share is unknown, not zero.