{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://redfirst.ai/press/schemas/agent-import.schema.json",
  "title": "Agent import — public shape",
  "description": "Buyer-safe public subset of the Agent Import contract (canon/AGENT_IMPORT.md, ratified 2026-07-17). An agent built elsewhere is appraised and mapped into a governed Red agent. This schema states the checkable shape — capture fields plus the governance every import must carry. It is not the internal engineering schema; internal field names are omitted on purpose. Maturity: designed, not built.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "source": {
      "type": "object",
      "additionalProperties": false,
      "description": "Where the agent came from and how it was captured.",
      "properties": {
        "platform": {
          "type": "string",
          "description": "Origin tool or platform (for example a custom GPT, a Gem, a Claude setup, an OpenClaw agent, a character card, or an automation flow)."
        },
        "method": {
          "type": "string",
          "enum": ["file", "api", "paste-back"],
          "description": "How it was brought in: file drop, connected API, or paste-back."
        },
        "captured_at": {
          "type": ["string", "null"],
          "description": "ISO-8601 capture time, when known."
        }
      },
      "required": ["platform", "method"]
    },
    "identity": {
      "type": "object",
      "additionalProperties": false,
      "description": "Name and short description taken from the source agent.",
      "properties": {
        "name": { "type": ["string", "null"] },
        "description": { "type": ["string", "null"] },
        "provenance": { "$ref": "#/$defs/Provenance" }
      },
      "required": ["provenance"]
    },
    "persona": {
      "type": "object",
      "additionalProperties": false,
      "description": "The instructions or persona text that defined the source agent.",
      "properties": {
        "text": { "type": ["string", "null"] },
        "provenance": { "$ref": "#/$defs/Provenance" }
      },
      "required": ["provenance"]
    },
    "knowledge": {
      "type": "array",
      "description": "Documents, notes, or links the source agent carried.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "title": { "type": ["string", "null"] },
          "type": { "type": ["string", "null"] },
          "note": { "type": ["string", "null"] },
          "provenance": { "$ref": "#/$defs/Provenance" }
        },
        "required": ["provenance"]
      }
    },
    "tools": {
      "type": "array",
      "description": "Actions or functions the source agent could call — rebound to governed tools on import.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": { "type": ["string", "null"] },
          "description": { "type": ["string", "null"] },
          "provenance": { "$ref": "#/$defs/Provenance" }
        },
        "required": ["provenance"]
      }
    },
    "model": {
      "type": "object",
      "additionalProperties": false,
      "description": "Model choice from the source, mapped to a Red-supported model.",
      "properties": {
        "provider": { "type": ["string", "null"] },
        "model": { "type": ["string", "null"] },
        "provenance": { "$ref": "#/$defs/Provenance" }
      },
      "required": ["provenance"]
    },
    "skills": {
      "type": "array",
      "description": "Reusable procedures or skills carried from the source.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": { "type": ["string", "null"] },
          "description": { "type": ["string", "null"] },
          "provenance": { "$ref": "#/$defs/Provenance" }
        },
        "required": ["provenance"]
      }
    },
    "schedule": {
      "type": "array",
      "description": "Recurring prompts or cadences from the source, mapped onto Schedule.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": { "type": ["string", "null"] },
          "cron": { "type": ["string", "null"] },
          "channel": { "type": ["string", "null"] },
          "provenance": { "$ref": "#/$defs/Provenance" }
        },
        "required": ["provenance"]
      }
    },
    "governance": {
      "type": "object",
      "additionalProperties": false,
      "description": "What every imported agent must carry once mapped into Red — the load-bearing buyer claim. Defaults are applied on import; first wake is approval-gated.",
      "properties": {
        "owner": {
          "type": "string",
          "description": "The person accountable for the agent after import."
        },
        "budget": {
          "type": "string",
          "description": "Spend limit attached to the agent (exhaustion pauses work and files an approval)."
        },
        "approval_route": {
          "type": "string",
          "description": "Who must approve before the imported agent wakes for the first time."
        },
        "scope": {
          "type": "string",
          "enum": ["private", "shared"],
          "description": "Whether the agent is one-to-one with its owner, or shared with a team."
        }
      },
      "required": ["owner", "budget", "approval_route", "scope"]
    },
    "notes": {
      "type": ["string", "null"],
      "description": "Capture uncertainty the appraisal step should surface for human review."
    }
  },
  "required": ["source", "governance"],
  "$defs": {
    "Provenance": {
      "type": "string",
      "enum": ["verbatim", "inferred"],
      "description": "verbatim = taken exactly from the source; inferred = parser or appraisal guess, flagged for human review on import."
    }
  }
}
