/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
/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:- 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:- 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:- Map tmp-ids to UUIDs in deterministic order
- Compute derived fields (
:at,:beat-start) - Update canonical score state (and export MRS-S if needed)
- Update structural index if needed
- Record transaction in audit trail
- 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
Partial Application
When some operations fail validation:- 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)