Repository Public
1<!--2ORIX Sonata3File: Documentation/manual/assistant.md4Author: Simon-Pierre Boucher5Contact: contact@spboucher.ai6-->7# The assistant89The assistant is optional. ORIX Sonata compiles, plays, analyses and exports without it,10offline and without an account. Nothing in this chapter is needed to make music.1112## Compose from a description1314Switch the space to **Compose**, describe the music in words — *"a gentle lullaby for piano in15F major, 3/4, about 30 seconds"* — and press **Compose** (⌘↩).16171. The first time, paste your Anthropic API key in the field shown there (or choose another18 provider in **Settings…**). The key goes to your login Keychain.192. The model receives your description and the **whole description of the Sonata language**20 shipped with the app: the normative specification, the grammar, the diagnostics reference,21 the source of the standard library, the reference of every instrument, effect and parameter,22 and three example programs — about 140 000 characters, the same files the tests compile.23 With Anthropic this text is marked cacheable, so repeated requests reuse it.243. What the model writes is compiled here by the real compiler. If it does not compile, the25 diagnostics (code, line, message) are sent back and the model corrects its program; at most26 four requests in all. A program that compiles but contains no note is sent back too.274. The piece is rendered offline so you see its real waveform and its measured length, peak28 and loudness, with the code underneath. If the render is too quiet (peak under −16 dBFS), the29 measurement is sent back once and the model raises the levels without changing the notes.3031Nothing is opened or changed by itself. **Open as a New Document** saves the piece in32`~/Library/Application Support/ORIX Sonata/Compositions/` (never over an existing file) and33opens it — press Play there to hear it, edit it, save it wherever you like.34**Replace This Document's Code** puts it in the current document as one undoable edit.3536In Compose mode your project is not sent: only your description and the language description.37The piece is as good as the model's musical judgement; the app guarantees that it compiles and38tells you what it measured, not that it is beautiful.3940## What it is4142A conversation, in the **Assistant** space, with a language model that can use six tools on the43open project:4445| Tool | What it does | What it cannot do |46|---|---|---|47| `read_project` | reads the Sonata sources of the project | read anything else on the Mac |48| `list_instruments` | lists engines, effects and standard instruments from the registry | — |49| `check` | compiles source it wrote and reads the diagnostics | save anything |50| `propose_patch` | proposes the full new text of one source file | apply it |51| `render_preview` | renders the composition offline and reads duration, peaks and loudness | hear or send audio |52| `inspect_spectrum` | measures the rendered audio of a track around a time | — |5354There is no shell, no file access, no network tool. Tool inputs are validated; an unknown tool55or a malformed input is refused and reported to the model. A request stops after eight rounds56of tools.5758## Proposals5960When the assistant wants to change your code it records a **proposal**. You see it on the right61as a diff, with a warning if the proposed text does not compile. Nothing changes until you press62**Accept**; accepting is one undoable edit (⌘Z). If you edited the file after the proposal was63made, accepting does nothing and says so: a proposal is never applied over newer text.6465The **Journal** lists every tool the assistant ran, with its input and the beginning of its66result, and every proposal you accepted or rejected.6768## Providers and keys6970Choose a provider in **Settings…** inside the space:7172- **Anthropic** — the Messages API. The default model is `claude-opus-5-5`; you can type another73 model identifier. Requests ask the API to retry on its default fallback model when a safety74 filter declines a request; a refusal is shown as a notice.75- **OpenAI**, **OpenRouter** — the Chat Completions API with function tools. Type the model you want.76- **Local model** — any OpenAI-compatible server on this Mac (for example an MLX server), by77 default at `http://127.0.0.1:8080/v1`. Requests to `127.0.0.1` or `localhost` never leave the78 machine, need no key and no consent. ORIX Sonata does not download or run a model itself.7980Keys are stored in your login Keychain (one item per provider), never in a project, a preference81file or a log. Remote addresses must use HTTPS.8283## Consent8485Before the first request to a remote provider, the space shows exactly what will be sent to86which host — your messages, the project's Sonata sources when the assistant reads them,87diagnostics and measured numbers — and waits for **Allow**. Consent is remembered per provider88and per host; changing the address asks again. Audio is never sent.8990## Limits you should know9192- Compose was run live against the Anthropic API (four runs, all ending with a piece that compiles; see93 `STATUS.md`). Chat mode and the other providers were tested against scripted providers and the real compiler only: request and response formats are covered by tests, an actual conversation with94 each provider has not been run.95- Answers are not streamed; a long answer appears when it is complete. **Stop** cancels.96- The model can be wrong about Sonata. It is instructed to compile what it writes; the diff and97 the compile warning on each proposal are there so you can judge before accepting.98