{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:agentic-awesome-skills:schema:stack-manifest:v2",
  "title": "AAS agent-owned stack manifest v2",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "name", "catalog", "targets", "profile", "skills"],
  "properties": {
    "schemaVersion": { "const": 2 },
    "name": { "type": "string", "minLength": 1, "maxLength": 128, "pattern": "^[A-Za-z0-9][A-Za-z0-9._ -]*$" },
    "catalog": { "$ref": "#/$defs/catalogIdentity" },
    "targets": {
      "type": "array",
      "minItems": 1,
      "maxItems": 8,
      "uniqueItems": true,
      "items": { "$ref": "#/$defs/target" }
    },
    "profile": {
      "type": "object",
      "additionalProperties": false,
      "required": ["goals", "languages", "frameworks", "constraints"],
      "properties": {
        "goals": {
          "type": "array",
          "minItems": 1,
          "maxItems": 32,
          "uniqueItems": true,
          "items": { "type": "string", "minLength": 1, "maxLength": 128 }
        },
        "projectType": { "type": "string", "minLength": 1, "maxLength": 256 },
        "languages": { "$ref": "#/$defs/profileValues" },
        "frameworks": { "$ref": "#/$defs/profileValues" },
        "constraints": { "$ref": "#/$defs/profileValues" }
      }
    },
    "skills": {
      "type": "array",
      "maxItems": 128,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id"],
        "properties": { "id": { "$ref": "#/$defs/id" } }
      }
    }
  },
  "$defs": {
    "digest": { "type": "string", "pattern": "^sha256-[a-f0-9]{64}$" },
    "id": { "type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)*$" },
    "catalogIdentity": {
      "type": "object",
      "additionalProperties": false,
      "required": ["package", "version", "integrity"],
      "properties": {
        "package": { "type": "string", "minLength": 1, "maxLength": 214, "pattern": "^(@[a-z0-9][a-z0-9._-]*/)?[a-z0-9][a-z0-9._-]*$" },
        "version": { "type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[0-9A-Za-z][0-9A-Za-z.+-]*$" },
        "integrity": { "$ref": "#/$defs/digest" }
      }
    },
    "target": {
      "type": "object",
      "additionalProperties": false,
      "required": ["host", "scope"],
      "properties": {
        "host": { "enum": ["codex", "claude"] },
        "scope": { "enum": ["project", "user"] }
      }
    },
    "profileValues": { "type": "array", "maxItems": 32, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "maxLength": 128 } }
  }
}
