# Explicit machine schemas

These schemas are separately exported because they are explicit machine contracts in the release source. The loop `spec` is the advertised composition input subset; its nested objects remain unconstrained here and this export does not claim to be a complete runtime validation schema.

## `write_change_item`

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "path": {
          "type": "string"
        },
        "content": {
          "type": "string"
        }
      },
      "required": [
        "path",
        "content"
      ],
      "not": {
        "required": [
          "op"
        ]
      }
    },
    {
      "type": "object",
      "properties": {
        "path": {
          "type": "string"
        },
        "op": {
          "type": "string",
          "enum": [
            "create",
            "replace",
            "upsert"
          ]
        },
        "content": {
          "type": "string"
        },
        "base_sha": {
          "type": "string"
        }
      },
      "required": [
        "path",
        "op",
        "content"
      ]
    },
    {
      "type": "object",
      "properties": {
        "path": {
          "type": "string"
        },
        "op": {
          "type": "string",
          "enum": [
            "edit"
          ]
        },
        "content": {
          "type": "string"
        },
        "anchor": {
          "type": "string"
        },
        "mode": {
          "type": "string",
          "enum": [
            "replace_section",
            "append_to_section",
            "insert_after_heading",
            "delete_section"
          ]
        },
        "base_sha": {
          "type": "string"
        }
      },
      "required": [
        "path",
        "op",
        "content",
        "anchor",
        "mode"
      ]
    },
    {
      "type": "object",
      "properties": {
        "path": {
          "type": "string"
        },
        "op": {
          "type": "string",
          "enum": [
            "append"
          ]
        },
        "content": {
          "type": "string"
        },
        "base_sha": {
          "type": "string"
        }
      },
      "required": [
        "path",
        "op",
        "content"
      ]
    },
    {
      "type": "object",
      "properties": {
        "path": {
          "type": "string"
        },
        "op": {
          "type": "string",
          "enum": [
            "delete"
          ]
        },
        "base_sha": {
          "type": "string"
        }
      },
      "required": [
        "path",
        "op"
      ]
    }
  ]
}
```

## `loop_spec`

```json
{
  "type": "object",
  "properties": {
    "owner": {
      "type": "string"
    },
    "purpose": {
      "type": "string"
    },
    "version": {
      "type": "integer"
    },
    "supersedes": {
      "type": [
        "string",
        "null"
      ]
    },
    "rollout": {
      "type": "string",
      "enum": [
        "shadow"
      ]
    },
    "trigger": {
      "type": "object"
    },
    "inputs": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "nodes": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "quality": {
      "type": "object"
    },
    "escalation": {
      "type": "object"
    },
    "autonomy": {
      "type": "object"
    },
    "budget": {
      "type": "object"
    }
  },
  "required": [
    "purpose",
    "version",
    "trigger",
    "inputs",
    "nodes",
    "quality",
    "escalation",
    "autonomy",
    "budget"
  ]
}
```
