{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/roark/json-schema/roark-autoimprove-job-schema.json",
  "title": "AutoimproveJob",
  "description": "One Autoimprove job: Roark autonomously improving one agent toward one objective metric. Roark only ever changes the staging agent (a shadow clone by default); production changes exactly once, when verified changes are promoted.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/roark-autoimprove-api-openapi.yml#/components/schemas/AutoimproveJob",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "organizationId": {
      "type": "string",
      "format": "uuid"
    },
    "projectId": {
      "type": "string",
      "format": "uuid"
    },
    "agentId": {
      "type": "string",
      "format": "uuid"
    },
    "stagingAgentId": {
      "type": "string",
      "format": "uuid"
    },
    "stagingKind": {
      "type": "string",
      "enum": [
        "DESIGNATED",
        "SHADOW",
        "CHANNEL"
      ]
    },
    "customerIntegrationId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "objectiveMetricDefinitionId": {
      "type": "string",
      "format": "uuid"
    },
    "objectiveLabel": {
      "type": "string"
    },
    "targetValue": {
      "type": "number"
    },
    "baselineValue": {
      "type": [
        "number",
        "null"
      ]
    },
    "currentValue": {
      "type": [
        "number",
        "null"
      ]
    },
    "trigger": {
      "type": "string",
      "enum": [
        "ISSUE",
        "RUN_THRESHOLD_FAILED",
        "USER",
        "DEGRADATION"
      ]
    },
    "issueId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "objectiveId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "validationRunPlanId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "RUNNING",
        "NEEDS_INPUT",
        "PAUSED",
        "AWAITING_PROMOTE",
        "PROMOTED",
        "NO_FIX",
        "CANCELLED",
        "FAILED"
      ]
    },
    "workingMemory": {
      "type": [
        "string",
        "null"
      ]
    },
    "finalReport": {
      "type": [
        "string",
        "null"
      ]
    },
    "maxIterations": {
      "type": "integer"
    },
    "maxSimCalls": {
      "type": "integer"
    },
    "iterationCount": {
      "type": "integer"
    },
    "simCallsUsed": {
      "type": "integer"
    },
    "initiatedByUserId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "concludedAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "When the job reached a terminal status (ISO 8601)."
    },
    "createdAt": {
      "type": "string",
      "description": "When the job was created (ISO 8601)."
    },
    "updatedAt": {
      "type": "string",
      "description": "When the job last changed (ISO 8601)."
    }
  },
  "required": [
    "id",
    "organizationId",
    "projectId",
    "agentId",
    "stagingAgentId",
    "stagingKind",
    "customerIntegrationId",
    "objectiveMetricDefinitionId",
    "objectiveLabel",
    "targetValue",
    "baselineValue",
    "currentValue",
    "trigger",
    "issueId",
    "objectiveId",
    "validationRunPlanId",
    "status",
    "workingMemory",
    "finalReport",
    "maxIterations",
    "maxSimCalls",
    "iterationCount",
    "simCallsUsed",
    "initiatedByUserId",
    "concludedAt",
    "createdAt",
    "updatedAt"
  ]
}