{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cogitae.ai/agents/schema-v1.json",
  "title": "Cogitae agent file, version 1",
  "description": "One Cogitae event agent. Cogitae ignores fields it does not recognize.",
  "type": "object",
  "required": ["format", "version", "name", "prompt", "trigger"],
  "properties": {
    "format": { "const": "cogitae-agent" },
    "version": { "const": 1 },
    "name": { "type": "string", "minLength": 1 },
    "description": { "type": "string" },
    "prompt": { "type": "string", "description": "The agent's instructions." },
    "model": { "type": "string", "description": "A model id to always use; leave it out to choose the model automatically." },
    "tools": { "type": "array", "items": { "type": "string" }, "description": "Tools the agent may use; leave it out for every tool." },
    "disallowedTools": { "type": "array", "items": { "type": "string" } },
    "trigger": {
      "type": "object",
      "required": ["source"],
      "properties": {
        "source": {
          "enum": ["timer", "fileSystem", "clipboard", "calendar", "network", "appLifecycle", "workspace", "agentLifecycle", "custom"]
        },
        "filter": {
          "type": "object",
          "properties": {
            "pathPatterns": { "type": "array", "items": { "type": "string" }, "description": "Globs; ~/ is the home folder. A bare folder matches everything below it." },
            "appBundleIds": { "type": "array", "items": { "type": "string" } },
            "contentTypes": { "type": "array", "items": { "type": "string" } },
            "networkInterfaces": { "type": "array", "items": { "type": "string" } },
            "calendarIds": { "type": "array", "items": { "type": "string" } },
            "agentRoles": { "type": "array", "items": { "type": "string" } },
            "agentTransitions": { "type": "array", "items": { "enum": ["spawned", "completed", "failed", "cancelled", "progress"] } },
            "customConditions": {
              "type": "object",
              "additionalProperties": { "type": "string" },
              "description": "A timer's schedule: {\"schedule\": \"every 2h\"}, \"at 09:00\", \"weekdays at 17:00\" or \"ct:MIN HOUR DOM MON DOW\"."
            }
          }
        }
      }
    },
    "modelSelection": {
      "type": "object",
      "properties": {
        "taskType": { "enum": ["mechanical", "comprehension", "code_generation", "code_reasoning", "agentic", "design", "scientific", "instruction_following"] },
        "minIntelligence": { "type": "integer", "minimum": 0, "maximum": 100 },
        "minCoding": { "type": "integer", "minimum": 0, "maximum": 100 },
        "policy": {
          "type": "object",
          "properties": {
            "accountTypes": { "type": "array", "items": { "enum": ["Anthropic", "Custom", "DeepSeek", "Google", "xAI", "Llama.cpp", "MistralAI", "MLX", "OpenAI", "OpenRouter"] } },
            "accountNames": { "type": "array", "items": { "type": "string" }, "description": "Accounts by name; an import is refused if one is missing." },
            "models": { "type": "array", "items": { "type": "string" } },
            "maxCostPerMillion": { "type": "number", "exclusiveMinimum": 0 }
          }
        }
      }
    },
    "parameters": {
      "type": "object",
      "properties": {
        "temperature": { "type": ["number", "string"] },
        "top_p": { "type": ["number", "string"] },
        "top_k": { "type": "integer" },
        "max_tokens": { "type": "integer", "minimum": 1 },
        "frequency_penalty": { "type": ["number", "string"] },
        "presence_penalty": { "type": ["number", "string"] },
        "repeat_penalty": { "type": ["number", "string"] },
        "min_p": { "type": ["number", "string"] },
        "stop_sequences": { "type": "array", "items": { "type": "string" } },
        "reasoning_effort": { "type": "string" },
        "verbosity": { "enum": ["low", "medium", "high"] },
        "json_schema_string": { "type": "string" }
      }
    },
    "actionPolicy": { "enum": ["notifyOnly", "askFirst", "actSilently", "actAndNotify"], "default": "askFirst" },
    "limits": {
      "type": "object",
      "properties": {
        "tokenBudget": { "type": "integer", "minimum": 1 },
        "cooldownSeconds": { "type": "integer", "minimum": 0 },
        "maxActivationsPerHour": { "type": "integer", "minimum": 1 },
        "maxContinuations": { "type": "integer", "minimum": 0 }
      }
    },
    "activeHours": {
      "type": "object",
      "required": ["startHour", "endHour", "daysOfWeek"],
      "properties": {
        "startHour": { "type": "integer", "minimum": 0, "maximum": 23 },
        "endHour": { "type": "integer", "minimum": 0, "maximum": 23 },
        "daysOfWeek": { "type": "array", "items": { "type": "integer", "minimum": 1, "maximum": 7 }, "description": "1 = Sunday to 7 = Saturday; empty means every day." }
      }
    },
    "workspaces": { "type": "array", "items": { "type": "string" }, "description": "Folders the agent needs; ~/ is the home folder." },
    "author": { "type": "string" },
    "homepage": { "type": "string" }
  }
}
