Skip to main content

MRS-S: The Single Format

MRS uses one syntax for all operations. There is no separate “working format”—agents receive and return valid MRS-S. See: /mrs-s/overview and /MRS-Specification-RFC#4-mrs-s-the-canonical-format

File Types

  • MIME type: application/vnd.mrs+sexpr
  • Extensions: .mrs or .mrs-s
  • Encoding: UTF-8 (BOM should not be used)
See: /MRS-Specification-RFC#14-mime-types-and-file-extensions

Minimal MRS-S Skeleton

(mrs-s 1.0
  (meta
    :title "Untitled")
  (parts
    (part violin-1 :name "Violin 1" :abbr "Vln. 1" :staves [treble]))
  (measures
    (measure 
      :id #uuid "018c3f40-0001-7890-abcd-ef1234567890"
      :number 1
      :beat-start 0
      :time 4/4
      (violin-1
        (v1
          (: 0 C4.q :id #uuid "018c3f2a-0001-..." :at 0)
          (: 1 D4.q :id #uuid "018c3f2a-0002-..." :at 1)
          (: 2 E4.q :id #uuid "018c3f2a-0003-..." :at 2)
          (: 3 F4.q :id #uuid "018c3f2a-0004-..." :at 3)))))
  (spans))
Key points:
  • Every measure has :id (UUID) and :number (display)
  • Every event has :id and :at (absolute position)
See: /MRS-Specification-RFC#4-2-document-structure

Working Set Envelope for Agent Tasks

For agent operations, the orchestrator extracts a Working Set Envelope with context:
(working-set
  :version 1.0
  :source-hash "sha256:..."
  
  :scope
    (:measures #uuid "018c3f40-0001-..." #uuid "018c3f40-0008-...")
    (:parts [violin-1 flute-1])
  :display-hint (:measures 1 8)
  
  :context "Add countermelody to flute"
  
  :content
    (meta :time 4/4 :key C :mode minor :tempo 132)
    (parts
      (part violin-1 :name "Violin 1" :abbr "Vln. 1" :staves [treble])
      (part flute-1 :name "Flute 1" :abbr "Fl. 1" :staves [treble]))
    (measures
      (measure 
        :id #uuid "018c3f40-0001-..."
        :number 1
        :beat-start 0
        (violin-1 (v1 (: 0 C4.q :id #uuid "..." :at 0) ...))
        (flute-1 (v1))))  ; Empty — target for agent
  
  :context-near
    :reduction :melodic-skeleton
    :content (measures ...)
  
  :synopsis-ref "sha256:...")
Key features:
  • Scope uses UUIDs — not measure numbers
  • :display-hint provides human-readable numbers
  • Context rings provide surrounding material
  • Synopsis reference for global awareness
See: /working-set-envelope and /MRS-Specification-RFC#5-working-set-envelope

Agent Workflow (Extract → Edit → Replace)

  1. Extract: Create Working Set Envelope with UUID scope and context
  2. Send to agent: Agent receives valid MRS-S with context rings
  3. Agent returns: Valid MRS-S fragment for the modified scope
  4. Replace: Orchestrator does trivial substitution + validation
See: /extract-replace-protocol and /MRS-Specification-RFC#9-extract-replace-protocol