{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agency.parts/bom.schema.json",
  "title": "agency.parts Agent Bill of Materials v1",
  "description": "A portable component plan exported by agency.parts. It records design choices and project references, not executable configuration or verified interoperability. Import resolves known references against the local catalog and resets review claims.",
  "type": "object",
  "required": ["schema", "name", "objective", "components", "additional_components", "review", "notice"],
  "additionalProperties": false,
  "properties": {
    "$schema": { "const": "https://agency.parts/bom.schema.json" },
    "schema": { "const": "agency.parts/bom/v1" },
    "name": { "type": "string", "minLength": 1, "maxLength": 100 },
    "objective": { "type": "string", "maxLength": 240 },
    "components": {
      "type": "object",
      "description": "One primary choice per core role. A null value is an unfilled slot.",
      "required": ["intelligence", "memory", "tools", "authority", "feedback"],
      "additionalProperties": false,
      "properties": {
        "intelligence": { "$ref": "#/$defs/slot" },
        "memory": { "$ref": "#/$defs/slot" },
        "tools": { "$ref": "#/$defs/slot" },
        "authority": { "$ref": "#/$defs/slot" },
        "feedback": { "$ref": "#/$defs/slot" }
      }
    },
    "additional_components": {
      "type": "array",
      "description": "Supporting components from any catalog category, with no duplicate IDs or repeats of core components.",
      "items": { "$ref": "#/$defs/component" },
      "uniqueItems": true,
      "maxItems": 48
    },
    "review": {
      "type": "object",
      "description": "Exports record that project licenses, integrations, and security have not been automatically reviewed.",
      "required": ["integration_verified", "licenses_verified", "security_reviewed", "authorization_required"],
      "additionalProperties": false,
      "properties": {
        "integration_verified": { "const": false },
        "licenses_verified": { "const": false },
        "security_reviewed": { "const": false },
        "authorization_required": { "const": true }
      }
    },
    "notice": { "type": "string" }
  },
  "$defs": {
    "slot": {
      "anyOf": [{ "$ref": "#/$defs/component" }, { "type": "null" }]
    },
    "component": {
      "type": "object",
      "required": ["id", "name", "category", "type", "description", "project_url"],
      "additionalProperties": false,
      "properties": {
        "id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
        "name": { "type": "string", "minLength": 1 },
        "category": {
          "enum": ["Identity", "Goals", "Perception", "Intelligence", "Memory", "World Model", "Planning", "Tools", "Authority", "Resources", "Action", "Feedback"]
        },
        "type": { "type": "string", "minLength": 1 },
        "description": { "type": "string" },
        "project_url": { "type": "string", "format": "uri", "pattern": "^https://" }
      }
    }
  }
}
