{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/mmerterden/multi-agent-pipeline/pipeline/schemas/pr-request.schema.json",
  "title": "PR request",
  "description": "What an unattended Phase 4 leaves instead of pushing and opening a PR. Written only through `scripts/pr-request.mjs write`, at <autopilot root>/pr-requests/<session id>.json (lib/pr-request-location.mjs). The autopilot runner reads it, verifies it against the branch it can see, and is the only process that pushes and creates the PR. Every field is data: the runner passes title and body to the forge as text and never executes or interprets them. The body has passed the outbound gate before the file was written and is scanned again by `validate`.",
  "type": "object",
  "additionalProperties": false,
  "required": ["branch", "base", "title", "body", "draft", "repo"],
  "properties": {
    "branch": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "pattern": "^[A-Za-z0-9._/-]+$",
      "description": "The local branch holding the run's commits. Never a protected branch (main, master, develop) and never the base; `validate` enforces both."
    },
    "base": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "pattern": "^[A-Za-z0-9._/-]+$",
      "description": "The branch the PR targets."
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "description": "PR title in the repo's commit convention."
    },
    "body": {
      "type": "string",
      "minLength": 1,
      "maxLength": 65536,
      "description": "PR description in Markdown, the section set of channels/pr.md. No auto-close keywords (Closes/Fixes/Resolves #N)."
    },
    "draft": {
      "const": true,
      "description": "Always true. An unattended PR is opened as a draft so a person decides when it is ready."
    },
    "repo": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
      "description": "owner/name of the repository the PR is opened on."
    }
  }
}
