Skip to main content
The orchestrator is the central coordinator that makes AI-assisted composition and orchestration safe and reliable at scale. It maintains the canonical score state and mediates all agent operations through progressive validation and typed operations. Core principle: Agents read MRS-S; agents write MRS-Ops. Only the orchestrator applies changes to canonical state. See: /MRS-Specification-RFC#12-orchestrator-contract

Orchestrator Architecture

Orchestrator Responsibilities

Implementation note: “Canonical state” is a semantic concept. An orchestrator may store it as an MRS-S document, an event log plus snapshots, or a database/graph model with indexes. The contract is about behavior: deterministic application, validation, and exportable/auditable semantics.

Edit Lanes

Lanes are permission boundaries that determine what an agent may modify.

What Each Lane Controls

Lane Bundles

Common workflows grant multiple related lanes:

Bundle Selection by Task Type

Progressive Validation

Operations are validated in stages before application:

Stage 1: Syntax Validation

  • Operation is well-formed
  • Required fields present
  • Types correct

Stage 2: Reference Validation

  • All referenced UUIDs exist in source
  • All tmp-ids are unique within envelope
  • Cross-references between ops are valid

Stage 3: Permission Validation

  • Operation within granted lanes
  • Operation within granted scope
  • Operation type is allowed

Stage 4: Musical Rule Validation

  • Constraints satisfied (range, avoid parallel fifths)
  • Duration sums correct
  • Ties connect same pitches
See: /MRS-Specification-RFC#13-progressive-validation

Conflict Detection

The orchestrator uses source-hash to detect concurrent modifications:

Conflict Resolution Options

Transaction Model

Every change is recorded:
Transactions enable:
  • Audit trail: Who changed what, when
  • Rollback: Revert to previous state
  • Replay: Reconstruct state from transactions

Checkpoints and Locks

Lock approved decisions to prevent regression:
After checkpoint:
  • Agents cannot modify locked lanes
  • Validation rejects operations that touch locked content
  • Human approval required to unlock

Typical Checkpoint Flow

Operation Application

When validation passes, the orchestrator applies operations:
  1. Map tmp-ids to UUIDs in deterministic order
  2. Compute derived fields (:at, :beat-start)
  3. Update canonical score state (and export MRS-S if needed)
  4. Update structural index if needed
  5. Record transaction in audit trail
  6. Return result with id-mapping

Application Order

Operations are applied in the order received. Dependencies must be satisfied:
  • Create measure before creating events in it
  • Create events before creating spans that reference them
The orchestrator MAY reorder to satisfy dependencies if unambiguous.

Partial Application

When some operations fail validation:
Policy options:
  • All-or-nothing: Reject entire batch if any operation fails
  • Partial: Apply valid operations, return errors for invalid
  • Interactive: Pause for human decision on errors

Human Review Gates

Certain operations should trigger human review by default: In practice, a “review” is not just textual—musicians also need to audition. Implementations can pair semantic diffs with:
  • a rendered excerpt of the affected region, and/or
  • a playback preview (e.g., MIDI/rendered audio)
Human approval is recorded: