Docs menu

Ship

Using Midas from another harness

If Claude Code, Codex, or another agent runs Midas for you, add the rule set below. It tells that agent to leave the choice of model to Midas. On this page, the calling agent is the tool that runs Midas.

Midas picks the model for each task on its own. When the calling agent names a model, Midas stops choosing for that run. The same work can cost more than it should.

The calling agent's own model has no bearing on the run. Midas already sends reasoning-heavy tasks to a frontier model, so naming one adds nothing there and stops Midas from using smaller models for the rest.

Add the rule set

Copy this block into the instruction file your calling agent reads:

## Midas run rules

This section applies only to an agent that runs the `midas` CLI, and only when
the person asks it to use Midas. If you are Midas, ignore this section.

Midas picks the model for each task on its own. Do not choose for it. Your own
model or vendor is not a reason to prefer a model.

- Run the task with `midas run "<task>"`. Do not do the task yourself instead.
- Do not pass `--model`, `-m`, or `--variant` unless the person asks for that
  model or variant in that request. If they do, use it for that run only. A
  continued session keeps a pinned model, so start a new session after.
- Do not add or change `model` or `small_model` in a Midas config file, or
  `model` in an agent or command frontmatter, unless the person asks for that
  change.
- If a Midas config already pins a model, leave it and tell the person.
- Do not choose a model from `midas models`.
- Use `--agent plan` or `--agent plan-quick` when the task is planning. Do not
  pick an agent because of its model.
- If a run fails, retry it or narrow the task. Do not add a model flag.

Create the file if it does not exist, then paste the block into it. For Claude Code, use .claude/rules/midas.md in the project, or ~/.claude/rules/midas.md for every project. Use a rules file rather than CLAUDE.md, because Midas can read CLAUDE.md too.

For Codex, use AGENTS.md in the project, or ~/.codex/AGENTS.md for every project. The block tells Midas to ignore AGENTS.md. For any other agent, use its instruction file.

What naming a model changes

Midas can pick a smaller model for a file edit or a test fix, and a frontier model for planning, refactors, debugging, and long tool chains. When the calling agent names a model, Midas stops making that choice. If you continue a pinned session later, it keeps the model even with no flag.

The calling agent and the Midas run are separate. The calling agent covers its own usage, and each midas run bills the Midas wallet for the models Midas calls. Naming a frontier model moves the Midas side to a frontier rate, so the run can cost more than the work needs even when the calling agent looks cheap.

Check a run

A run where Midas picked the model records midas/auto as its model. This is for checking a run, not a value to pass.

  • midas export SESSION_ID shows the model recorded for one session. Replace SESSION_ID with an ID from midas session list.
  • midas stats --models --project "" shows the model totals for the current project.
  • A run that records a specific model was most likely pinned by a flag, config, frontmatter, or a pinned session that was continued. Planning runs are the exception, because plan and plan-quick record the model for their tier, so project totals can list more than one model.

When a different tier is needed

For planning, use a planner agent instead of naming a model. --agent plan uses the strongest plan tier, and --agent plan-quick uses the cheapest. Leave the build run to Midas.

When naming a model is legitimate

A person may name a model to reproduce a result, compare providers, or debug one model. That is a deliberate choice for one run, so the rule set lets the calling agent pass it when you ask in that request.