{
  "$id": "https://schema.rtemis.org/artifact/plan/v1/schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "rtemis plan artifact",
  "description": "One immutable version of an rtemis harness artifact holding an ordered list of rtemis configs, with a one-line summary. `name` and `version` say which revision of which artifact; `id` is a BLAKE3 digest over the RFC 8785 canonical form of `content`, so it says whether two versions are the same document.",
  "type": "object",
  "properties": {
    "id": {
      "description": "Digest of `content`, as `blake3:<hex>` over its RFC 8785 canonical form. The algorithm travels with the digest rather than being implied, so a later one can be introduced without rewriting what is already recorded -- the property `DataFingerprint` gets from carrying `algorithm` and `encoding` beside each hash.",
      "type": "string"
    },
    "type": {
      "description": "Which of the five this is.",
      "type": "string",
      "const": "plan"
    },
    "name": {
      "description": "The artifact's name within its study, stable across versions.",
      "type": "string"
    },
    "version": {
      "description": "Which revision this is, from 1, contiguous within a name.",
      "type": "integer",
      "minimum": 1
    },
    "created": {
      "description": "When this version was written, RFC 3339 in UTC.",
      "type": "string"
    },
    "origin": {
      "description": "Who authored this version.",
      "type": "string",
      "enum": ["user_edit", "agent_revision", "applied_patch", "run_result"]
    },
    "content": {
      "description": "An ordered list of configs, and a line saying what it is for. An ordered list rather than a graph. A sequence is a degenerate DAG, so this does not foreclose one.",
      "type": "object",
      "properties": {
        "summary": {
          "description": "One line describing what the plan does, for a reader deciding whether to approve it.",
          "type": "string"
        },
        "steps": {
          "description": "The steps, in the order they run.",
          "type": "array",
          "items": {
            "description": "One step of a plan: a config, and which schema it is written against.",
            "type": "object",
            "properties": {
              "step": {
                "description": "Position in the plan, from 1.",
                "type": "integer",
                "minimum": 1
              },
              "schema_id": {
                "description": "The `$id` of the schema `config` is written against.",
                "type": "string"
              },
              "config": {
                "description": "The config itself, as the document a client would send. Carries only the fields that were set: defaults live in `defaults/v1` and the record reports what they resolved to."
              }
            },
            "additionalProperties": false,
            "required": ["step", "schema_id", "config"]
          }
        }
      },
      "additionalProperties": false,
      "required": ["summary", "steps"]
    }
  },
  "additionalProperties": false,
  "required": ["id", "type", "name", "version", "created", "origin", "content"]
}
