Skip to main content
MRS uses progressive validation to catch errors before state mutation, provide specific feedback, and enable partial application when appropriate. See: /MRS-Specification-RFC#13-progressive-validation

Validation Pipeline

Operations are validated in stages. Each stage must pass before proceeding to the next.

Stage 1: Syntax Validation

Verifies operations are well-formed.

Syntax Errors

Stage 2: Reference Validation

Verifies all references are valid.

Reference Errors

Stage 3: Permission Validation

Verifies operations are within granted permissions.

Permission Errors

Stage 4: Musical Rule Validation

Verifies musical constraints are satisfied.

Structural Rules

Musical Rules

Constraint Rules

Severity Levels

Validation Results

All Pass

Errors Found

Warnings Only

Constraint Validation

Constraints from the Working Set Envelope are checked in Stage 4.

Range Constraint

Checks all pitches for clarinet-bb are within E3-C7.

Avoid Constraint

Checks for parallel fifths between the modified part and violin-1.

Prefer Constraint

Checks if downbeat notes are chord tones. Generates INFO if not satisfied.

Density Constraint

Checks notes per measure is between 2 and 8.

Partial Application

When some operations fail:

Best Practices

For Agent Implementers

  1. Validate operations locally before sending
  2. Use tmp-ids consistently within envelope
  3. Respect constraints from Working Set
  4. Handle partial success gracefully

For Orchestrator Implementers

  1. Run all stages; collect all errors
  2. Provide specific, actionable error messages
  3. Include operation index in errors
  4. Support configurable severity thresholds