/MRS-Specification-RFC#5-mrs-ops-the-mutation-protocol
Why Typed Operations?
Asking agents to emit complete MRS-S fragments creates failure modes:- Accidental omission: Agent returns less content → content silently deleted
- Calculation errors: Miscomputed
:atvalues, duration sums - Hallucinated references: IDs that don’t exist
- UUID management: Agent must generate valid, non-colliding UUIDs
- Explicit operations: Create, update, delete are distinct (no omission risk)
- Orchestrator-derived fields: Agent provides beat; orchestrator computes
:at - Temporary IDs: Agent uses tmp-ids; orchestrator assigns UUIDs
- Minimal surface: Only changed content in output
MRS-Ops Envelope
Operation Types
Create Event
Update Event
Delete Event
Create Span
- Existing UUIDs:
#uuid "018c3f2a-..." - Temporary IDs from same operation set:
"e1"
Update Span
:from, :to, :events) are immutable. To change endpoints, delete and recreate the span.
Delete Span
Create Measure
:number, and computes :beat-start.
Delete Measure
Instrument Change
Temporary ID Rules
- Tmp-ids MUST be strings starting with a letter:
"e1","span-a","m1" - Tmp-ids are scoped to a single MRS-Ops envelope
- Operations MAY reference each other’s tmp-ids within same envelope
- Orchestrator maps all tmp-ids to UUIDs before application
- Response includes the tmp-id → UUID mapping
Task-Adaptive Context Views
Context views provide task-relevant information beyond the edit scope. Unlike fixed rings, views are selected for the specific task.Melodic Reference
Harmonic Context
Orchestration Map
Phrase Structure
View Selection by Task Type
Example: Add Countermelody
Working Set Envelope (agent receives):Lane Bundles
Lane bundles grant permissions for common workflows:Constraint Language
Constraint violations are caught in progressive validation.