# Overview

> How Flow splits music, layout, house style, and project structure into four sublanguages.

Canonical page: [https://docs.score.miso.fm/flow/](https://docs.score.miso.fm/flow/)

Flow is a plain-text language for describing and editing musical scores. Every Flow document is valid input to the engine, and every line of a document is also an edit.

## The Four Sublanguages

Flow separates musical content from engraving overrides, visual house rules, and multi-number show metadata.

| Sublanguage | Line Prefix | Scope | Page |
| --- | --- | --- | --- |
| Flow Notation | Bare (no prefix) | Notes, rhythms, marks, lyrics, harmony, frame changes, and musical edits | [Flow Notation](https://docs.score.miso.fm/flow/notation/) |
| Flow Layout | `layout <book>` | Per-book line/page breaks, spacing, nudges, visibility, condensing, and turn warnings | [Flow Layout](https://docs.score.miso.fm/flow/layout/) |
| Flow Style | `style` | Built-in and custom house styles, typography, spacing parameters, and book-level overrides | [Flow Style](https://docs.score.miso.fm/flow/style/) |
| Flow Project | `project` or `in <N>:` | Credits, books, players, numbering, acts, segues, dates, and multi-number fan-out | [Flow Project](https://docs.score.miso.fm/flow/project/) |

A separate `link` authoring layer (`link col`, `link as`, `link rhythm`, `link slashes`, `link cue`, `link own`) keeps one staff dynamically following another; the score document stores the derived notes, which stay linked until you edit the source or detach them with `link own`.

## A Complete Example

This excerpt from the demo show *Quill Street* combines project metadata, house style, Flow Notation, and a per-book layout turn warning:

```text
# Show metadata (Flow Project)
project credit composer Ilse Varnham
project date 2026-11-28
project version "Rehearsal draft"

# House style (Flow Style)
style house "miso"

# Opening number (Flow Notation)
staff Nell Nell treble sung
staff Rd1 Flute treble
staff Tpt1 "Trumpet in Bb" treble sounds M2 down
bars 4
1 time 4/4
1 key F
1 tempo Brightly q=152
1-2 Nell: R
3 Rd1: c'4--:mf a-- bb-- g-- | e2:turn r
4 Tpt1: c2->:mf c4-. r

# Piano-Conductor book layout (Flow Layout)
layout pc turn 4 V.S.
```

## Envelope, Chaining, and Comments

The envelope carries Flow lines across edits and agent turns.

- **Bare vs. prefixed lines:** Flow Notation lines stand bare. Flow Layout, Flow Style, and Flow Project lines start with `layout`, `style`, or `project`.
- **Sequential edits (`then`):** Place `then` on a line by itself to end one edit and start the next. Bar numbers remain fixed within a single edit and renumber after `then`.
- **Comments (`#`):** Lines starting with `#` are ignored by the parser. Trailing comments on an operation line are refused.

```text
10 insert 1
then
12@4 Vln pitch Bb
```

In this example, `10 insert 1` adds a bar after bar 10. After `then`, the former bar 11 is bar 12, so `12@4 Vln pitch Bb` alters beat 4 of that bar.

## Non-Edit Replies

When no score edit should be applied, an automated assistant or agent outputs a standalone comment reply instead of operations. Replies never appear alongside operations in the same response.

| Reply | Meaning |
| --- | --- |
| `# ask: <question>` | The request is ambiguous or omits required information. |
| `# alt: <line> \|\| <line>` | One candidate reading per line, with multi-line readings joined by `\|\|`. Omit `# alt:` lines for open questions. |
| `# no edit` | Nothing to change — a remark, a playing note, or the score already matches the request. |
| `# out of scope: musical_decision` | Requires a musical judgment from a person. |
| `# out of scope: not_in_flow` | Requests an action outside Flow's scope. |

```text
# ask: Which E in bar 12 of Violin 1 should become E-flat?
# alt: 12@n1 Vln1 pitch Eb
# alt: 12@n3 Vln1 pitch Eb
# alt: 12@n1 Vln1 pitch Eb || 12@n3 Vln1 pitch Eb
```

## Deterministic Validation

The engine refuses malformed lines with exact diagnostics and never silently guesses. Common refusals include:

- Wrong bar duration for the active meter (`these notes add up to 3.5 quarter notes but the bar holds 4 (4/4)`).
- Numeric octaves instead of letter-case octaves (`C5` is refused because `5` is not a length; write `c`).
- Missing colon on bar lines (`1 Vln d8 e` is refused; write `1 Vln: d8 e`).
- Unclosed hairpins or dangling ties (`:<` without a closing `:!`, or `~` with no matching following pitch).
- Missing staff clef, opening time signature, or opening key signature.
