{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/boshu2/agentops/docs/contracts/repo-execution-profile.schema.json",
  "title": "Repo Execution Profile",
  "description": "Schema for repo-local execution profiles consumed by orchestration skills such as /evolve and /rpi.",
  "type": "object",
  "required": [
    "schema_version",
    "startup_reads",
    "goals_source",
    "validation_commands",
    "tracker_commands",
    "definition_of_done"
  ],
  "properties": {
    "schema_version": {
      "type": "integer",
      "const": 1,
      "description": "Schema version for forward compatibility."
    },
    "startup_reads": {
      "type": "array",
      "description": "Ordered repo files that bootstrap an autonomous run before work selection begins.",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "goals_source": {
      "type": "object",
      "description": "Canonical and compatibility goal sources for the repo.",
      "required": [
        "primary"
      ],
      "properties": {
        "primary": {
          "type": "string",
          "minLength": 1
        },
        "compatibility_mirrors": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "default": []
        }
      },
      "additionalProperties": false
    },
    "validation_commands": {
      "type": "array",
      "description": "Ordered validation bundle the repo expects before landing substantive work.",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "tracker_commands": {
      "type": "object",
      "description": "Repo-scoped tracker command wrappers and shell policy.",
      "required": [
        "ready",
        "show",
        "update",
        "close"
      ],
      "properties": {
        "shell_prefix": {
          "type": "string",
          "minLength": 1
        },
        "ready": {
          "type": "string",
          "minLength": 1
        },
        "show": {
          "type": "string",
          "minLength": 1
        },
        "update": {
          "type": "string",
          "minLength": 1
        },
        "close": {
          "type": "string",
          "minLength": 1
        },
        "doctor": {
          "type": "string",
          "minLength": 1
        },
        "vc_status": {
          "type": "string",
          "minLength": 1
        },
        "dolt_commit": {
          "type": "string",
          "minLength": 1
        },
        "dolt_push": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "work_selection_order": {
      "type": "array",
      "description": "Preferred source ladder for autonomous work selection.",
      "items": {
        "type": "string",
        "enum": [
          "harvested",
          "beads",
          "goal",
          "directive",
          "testing",
          "validation",
          "bug-hunt",
          "drift",
          "feature"
        ]
      },
      "default": [
        "harvested",
        "beads",
        "goal",
        "directive",
        "testing",
        "validation",
        "bug-hunt",
        "drift",
        "feature"
      ]
    },
    "definition_of_done": {
      "type": "object",
      "description": "Concrete predicates that determine when a cycle or full autonomous run can stop.",
      "required": [
        "predicates"
      ],
      "properties": {
        "predicates": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "required_validations": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "default": []
        },
        "require_clean_git": {
          "type": "boolean",
          "default": false
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
