Skip to main content
The Working Set Envelope is the core mechanism for enabling context-aware agent workflows. It wraps a bounded MRS-S fragment with scope metadata, context rings, and synopsis access. See: /MRS-Specification-RFC#5-working-set-envelope

Key Principles

  • Agents receive valid MRS-S and return valid MRS-S—no separate syntax
  • Scopes use UUIDs—not measure numbers—for structural stability
  • Context rings provide surrounding material at reduced detail
  • Scope negotiation enables flexible conversational workflows

Structure

(working-set
  :version 1.0
  :source-hash "sha256:..."
  
  :scope
    (:measures #uuid "018c3f40-002d-..." #uuid "018c3f40-0034-...")
    (:parts [clarinet-1])
  :display-hint (:measures 45 52)  ; Informational only
  
  :context "Add countermelody to clarinet"
  
  :constraints
    ((range clarinet-1 E3 G6)
     (avoid parallel-fifths violin-1))
  
  :content
    ;; Full-detail MRS-S — writable
    (meta :time 4/4 :key C :mode minor)
    (parts ...)
    (measures ...)
    (spans ...)
  
  :context-near
    (:measures #uuid "..." #uuid "...")
    :reduction :melodic-skeleton
    :content (measures ...)  ; Reduced detail — read-only
  
  :context-far
    (:measures #uuid "..." #uuid "...")
    :reduction :harmonic-rhythm
    :content (measures ...)  ; Further reduced — read-only
  
  :synopsis-ref "sha256:...")

UUID-Based Scoping

All scope references use stable UUIDs:
:scope
  (:measures #uuid "018c3f40-002d-..." #uuid "018c3f40-0034-...")
  (:parts [clarinet-1])
:display-hint (:measures 45 52)  ; Human-readable, never used structurally
Measure numbers appear ONLY in :display-hint—never for structural reference.

Context Rings

Context rings provide surrounding material at graduated detail levels:
LevelContent
:fullEverything (no reduction)
:melodic-skeletonDownbeats, phrase boundaries, structural tones
:harmonic-rhythmChord roots, key changes, bass line
:structuralRehearsal marks, tempo changes, texture shifts only
All context ring content is read-only. Agents can read it but cannot modify it.

Agent Response

Agents return a working-set-response containing valid MRS-S:
(working-set-response
  :source-hash "sha256:..."
  :scope
    (:measures #uuid "018c3f40-002d-..." #uuid "018c3f40-0034-...")
    (:parts [clarinet-1])
  :display-hint (:measures 45 52)
  
  :content
    (measures
      (measure 
        :id #uuid "018c3f40-002d-..."
        :number 45
        :beat-start 487+1/4
        (clarinet-1
          (v1
            (: 0 Eb4.q :dyn mp :id #uuid "..." :at 487+1/4)
            ...))))
  
  :rationale "Created contrary motion...")

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 beat 487+3/4")
The orchestrator can grant, deny, or offer alternatives. See: /MRS-Specification-RFC#5-6-scope-negotiation-protocol