{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.connectsoft.ai/reference/schemas/asset-manifests.schema.json",
  "title": "Asset manifests: agent, skill, tool descriptor, workflow definition, model profile",
  "description": "Authoring-time manifests kept in Git and compiled into release manifests by Asset Publication (BC-04). They mirror the architecture model's agent, skill, tool, workflow and model-profile entities.",
  "$defs": {
    "AgentManifest": {
      "type": "object",
      "required": [
        "id",
        "version",
        "name",
        "purpose",
        "modelProfile",
        "skills",
        "tools",
        "policies",
        "memoryPolicy",
        "budget",
        "inputs",
        "outputs"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]+$"
        },
        "version": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "cluster": {
          "type": "string"
        },
        "purpose": {
          "type": "string"
        },
        "instructionsRef": {
          "type": "string",
          "description": "Path of the system instructions in the repository."
        },
        "modelProfile": {
          "type": "string"
        },
        "fallbackProfiles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "skills": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "versionRange": {
                "type": "string"
              },
              "required": {
                "type": "boolean"
              }
            }
          }
        },
        "tools": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "approval"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "approval": {
                "enum": [
                  "autonomous",
                  "approval"
                ]
              }
            }
          }
        },
        "knowledge": {
          "type": "object",
          "properties": {
            "collections": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "graphs": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "classificationCeiling": {
              "type": "string"
            }
          }
        },
        "contextStrategy": {
          "type": "string"
        },
        "policies": {
          "type": "object",
          "required": [
            "maxSideEffectClass"
          ],
          "properties": {
            "maxSideEffectClass": {
              "type": "string"
            },
            "allowedScopes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "promptSafety": {
              "type": "string"
            },
            "sandbox": {
              "enum": [
                "required",
                "optional"
              ]
            },
            "network": {
              "enum": [
                "none",
                "restricted",
                "allow-list"
              ]
            }
          }
        },
        "memoryPolicy": {
          "type": "object",
          "required": [
            "read",
            "write"
          ],
          "properties": {
            "read": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "write": {
              "enum": [
                "none",
                "run",
                "promoted"
              ]
            },
            "retention": {
              "type": "string"
            }
          }
        },
        "budget": {
          "type": "object",
          "required": [
            "tokensPerRun",
            "costCapUsd",
            "timeCapMinutes"
          ],
          "properties": {
            "tokensPerRun": {
              "type": "integer"
            },
            "costCapUsd": {
              "type": "number"
            },
            "timeCapMinutes": {
              "type": "integer"
            }
          }
        },
        "inputs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "name",
              "descriptor"
            ]
          }
        },
        "outputs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "name",
              "descriptor"
            ]
          }
        },
        "evaluationSuite": {
          "type": "string"
        }
      }
    },
    "SkillManifest": {
      "type": "object",
      "required": [
        "id",
        "version",
        "name",
        "purpose",
        "inputs",
        "outputs"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "purpose": {
          "type": "string"
        },
        "cluster": {
          "type": "string"
        },
        "instructionsRef": {
          "type": "string"
        },
        "workflowRef": {
          "type": "string"
        },
        "examplesRef": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "scriptsRef": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "templatesRef": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "inputs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "name",
              "descriptor"
            ]
          }
        },
        "outputs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "name",
              "descriptor"
            ]
          }
        },
        "requires": {
          "type": "object",
          "properties": {
            "tools": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "modelCapabilities": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "knowledge": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "compatibility": {
          "type": "object",
          "properties": {
            "templates": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "libraries": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "tests": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "evaluations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "failureModes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "ToolDescriptor": {
      "type": "object",
      "required": [
        "id",
        "version",
        "name",
        "kind",
        "sideEffectClass",
        "inputSchema",
        "outputSchema",
        "authorization",
        "timeoutSeconds",
        "audit"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "kind": {
          "enum": [
            "mcp-server",
            "native",
            "connector",
            "computer-use",
            "browser"
          ]
        },
        "mcpServerId": {
          "type": "string"
        },
        "sideEffectClass": {
          "enum": [
            "read",
            "sandbox",
            "shared-write",
            "external",
            "production",
            "publication",
            "spend"
          ]
        },
        "inputSchema": {
          "type": "object"
        },
        "outputSchema": {
          "type": "object"
        },
        "authorization": {
          "type": "object",
          "properties": {
            "scopes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "secretRefs": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "timeoutSeconds": {
          "type": "integer"
        },
        "retry": {
          "type": "object",
          "properties": {
            "policy": {
              "type": "string"
            },
            "attempts": {
              "type": "integer"
            }
          }
        },
        "rateLimit": {
          "type": "object",
          "properties": {
            "perMinute": {
              "type": "integer"
            }
          }
        },
        "idempotency": {
          "enum": [
            "none",
            "key",
            "natural"
          ]
        },
        "audit": {
          "type": "object",
          "required": [
            "required"
          ],
          "properties": {
            "required": {
              "type": "boolean"
            },
            "fields": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "health": {
          "type": "object",
          "properties": {
            "check": {
              "type": "string"
            }
          }
        }
      }
    },
    "WorkflowDefinition": {
      "type": "object",
      "required": [
        "id",
        "version",
        "name",
        "steps",
        "inputs",
        "outputs"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "purpose": {
          "type": "string"
        },
        "inputs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "name",
              "descriptor"
            ]
          }
        },
        "outputs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "name",
              "descriptor"
            ]
          }
        },
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "kind"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "kind": {
                "enum": [
                  "agent",
                  "tool",
                  "human",
                  "condition",
                  "parallel",
                  "timer",
                  "sub-workflow",
                  "compensation"
                ]
              },
              "agent": {
                "type": "string"
              },
              "skill": {
                "type": "string"
              },
              "tool": {
                "type": "string"
              },
              "gate": {
                "enum": [
                  "none",
                  "approval",
                  "evaluation"
                ]
              },
              "sideEffectClass": {
                "type": "string"
              },
              "inputs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "outputs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "dependsOn": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "retry": {
                "type": "object"
              },
              "compensation": {
                "type": "string"
              },
              "timeout": {
                "type": "string"
              }
            }
          }
        },
        "approvals": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "events": {
          "type": "object",
          "properties": {
            "starts": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "emits": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "ModelProfile": {
      "type": "object",
      "required": [
        "id",
        "version",
        "name",
        "capabilities",
        "privacyClass",
        "providers",
        "limits"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "capabilities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "privacyClass": {
          "enum": [
            "public",
            "tenant",
            "restricted"
          ]
        },
        "providers": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "provider",
              "model"
            ],
            "properties": {
              "provider": {
                "type": "string"
              },
              "model": {
                "type": "string"
              },
              "deployment": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "adapter": {
                "type": "string"
              },
              "priority": {
                "type": "integer"
              }
            }
          }
        },
        "fallback": {
          "type": "string"
        },
        "limits": {
          "type": "object",
          "properties": {
            "contextWindow": {
              "type": "integer"
            },
            "reliableContext": {
              "type": "integer"
            },
            "maxOutputTokens": {
              "type": "integer"
            },
            "latencyClass": {
              "type": "string"
            },
            "costClass": {
              "type": "string"
            }
          }
        },
        "capabilityEvidence": {
          "type": "object",
          "description": "Scorecard reference from the capability registry (ADR-0021).",
          "properties": {
            "scorecardRef": {
              "type": "string"
            },
            "evaluatedAt": {
              "type": "string",
              "format": "date-time"
            }
          }
        },
        "license": {
          "type": "object",
          "properties": {
            "commercialUse": {
              "type": "boolean"
            },
            "redistribution": {
              "type": "boolean"
            },
            "fineTuning": {
              "type": "boolean"
            },
            "customerDeployment": {
              "type": "boolean"
            }
          }
        }
      }
    }
  },
  "oneOf": [
    {
      "$ref": "#/$defs/AgentManifest"
    },
    {
      "$ref": "#/$defs/SkillManifest"
    },
    {
      "$ref": "#/$defs/ToolDescriptor"
    },
    {
      "$ref": "#/$defs/WorkflowDefinition"
    },
    {
      "$ref": "#/$defs/ModelProfile"
    }
  ]
}
