# About Mirli for agent authors

Why Mirli's MCP server behaves as it does, for anyone writing an agent, a skill or a prompt that drives it. The
behaviour itself is specified in the [MCP server reference](https://mirli.app/docs/mcp/index.md); the call orders are in
[Sequence story calls](https://mirli.app/docs/agents-story-calls/index.md).

## One render at a time

Mirli runs models on the user's own machine, which has one GPU, so the server runs jobs one after another. Five
parallel `generate` calls do not finish faster than five sequential ones; they queue. Several takes of one idea belong
in one call as `variations`.

The same reason makes long calls normal. A tool that renders blocks until the file exists, which is seconds for a short
effect and minutes for a voiced script. Progress notifications exist so that a client can keep such a call alive
instead of timing it out.

## Paths instead of payloads

Results carry absolute file paths rather than audio, so the agent can use its ordinary file tools from there: copy a
take into a project, pass it to ffmpeg. The path is only meaningful on the machine Mirli runs on, which is also why the
stdio bridge, which only relays HTTP, returns a URL instead.

## An empty model list is not a fault

The user chooses and downloads the models that fit their machine and their licence needs, so an install with no
model yet is a normal state. `generate` then says so in an error meant to be shown to the user. Retrying cannot
change it; only the user can, on the **Models** page.

## Why prompts describe what is heard

The sound models respond to physical description (material, action, space, distance) and largely ignore mood words.
"Scary sound" gives noise, while "low metallic groan of a ship's hull under pressure, distant" gives something
usable. `enhance_prompt` exists for the cases where an agent only has the abstract idea.

## Why performance is not in the text

A text-to-speech model reads every character it is given. A stage direction in brackets is spoken, not obeyed. Each
model family instead exposes its own controls, such as an exaggeration or emotion setting, and Mirli passes them
through as `delivery`. Because the names differ per family and an unknown name is accepted without complaint, the only
reliable source is the `delivery` list that `list_models` reads from the engine itself.

A voice also belongs to the model it was made on. A cloned voice read on another family does not sound like the
person, which is why each line is read on its own voice's model unless the agent overrides it.

## Why a story instead of one read

`speak` returns one finished file, which is right for a single line. A script changes: a line gets rewritten, a voice
recast, a beat moved. A story keeps every line as its own clip on a timeline, so one line can be re-read without
touching the rest, and the user can open the same story in the studio and keep working by hand.

## Why the open studio goes through the page

`studio_apply` does not write to the database. It hands the actions to the studio page, which runs them through the
handlers its own buttons use. That is what puts an agent's edits on the user's undo stack, and why every id is checked
against what the page actually shows: an action that names a clip the user deleted a moment ago is dropped instead of
resurrecting it. Deletes are held by default, and the tool's description tells the model to confirm them with the
user first.

## How devices reach the export

The device rack's audio graph lives in the app and runs during the studio's playback. The server stores each lane's
chain so an agent's changes reach the studio, and the export renders the same chain with the server's own DSP. Each
device follows the algorithm the studio uses, so the exported file sounds like playback, though not bit-for-bit.
