Skip to main content
MRS defines a protocol for agentic operations (AI-assisted composition/editing) centered on Working Set Envelopes with context rings and synopsis access. Core Principle: Agents receive valid MRS-S fragments with appropriate context and return valid MRS-S fragments. There is no separate syntax for agent I/O. See: /MRS-Specification-RFC#10-agent-operations

Task Definition

Task {
  id: TaskId
  type: TaskType
  instruction: String              ; Natural language instruction
  working_set: WorkingSetEnvelope  ; Scoped MRS-S with context
  synopsis: Synopsis?              ; Structural overview
  context: Map<String, Value>      ; Additional context
}

TaskType {
  compose      ; Create new content
  arrange      ; Adapt existing content
  harmonize    ; Add harmony to melody
  orchestrate  ; Assign to instruments
  analyze      ; Extract information
  correct      ; Fix errors
  transform    ; Apply transformation
  extend       ; Continue existing material
}
See: /MRS-Specification-RFC#10-2-task-definition

Sequential Workflow Model

Composition proceeds through sequential agent operations. Form and structure emerge through the creative process:
1. Initial sketch (melody agent)
   → orchestrator replaces
   
2. Harmonic elaboration (harmony agent)
   → orchestrator replaces
   
3. Structural extension (form agent)
   → may insert measures
   → orchestrator handles UUID assignment
   
4. Orchestration (orchestration agent)
   → orchestrator replaces
   
5. Refinement passes...
Each agent:
  • Receives current state in Working Set Envelope
  • Has context rings for surrounding material
  • Has synopsis access for global awareness
  • Returns valid MRS-S fragment
  • May request scope expansion via negotiation

Context-Aware Operations

Agents operate with full context:
(working-set
  :scope (:measures #uuid "..." #uuid "...") (:parts [clarinet-1])
  :display-hint (:measures 45 52)
  
  :content (measures ...)           ; Full detail, writable
  
  :context-near
    :reduction :melodic-skeleton
    :content (measures ...)         ; Reduced detail, read-only
  
  :context-far
    :reduction :harmonic-rhythm
    :content (measures ...)         ; Further reduced, read-only
  
  :synopsis-ref "sha256:...")

Constraint Language

Constraints specify rules generated content must satisfy:
  • Range constraints: Notes must fall within instrument range
  • Avoidance constraints: No parallel fifths, no voice crossing
  • Preference constraints: Chord tones on downbeats, stepwise motion
See: /MRS-Specification-RFC#10-4-constraint-language

Scope Negotiation

Agents can request scope adjustments:
(scope-request
  :reason "Phrase extends beyond current boundary"
  :current (:measures #uuid "..." #uuid "...")
  :requested (:measures #uuid "..." #uuid "...")
  :justification "Slur endpoint at measure boundary")
The orchestrator can grant, deny, or offer alternatives.

Orchestrator Pattern

The orchestrator maintains the full score and coordinates agent operations:
         ORCHESTRATOR (maintains full MRS-S)
         │         │         │         │
         ▼         ▼         ▼         ▼
    Harmony    Melody    Rhythm    Orch.
    Agent      Agent     Agent     Agent
Operations are sequential at the structural level, with context provided for each agent task.