{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/taskhold-com/json-schema/taskhold-com-task-schema.json",
  "title": "Task",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/taskhold-com-openapi.yml#/components/schemas/Task",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "todo",
        "in_progress",
        "blocked",
        "done"
      ]
    },
    "priority": {
      "type": "string",
      "enum": [
        "low",
        "medium",
        "high",
        "urgent"
      ]
    },
    "project_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "blocked_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "block_options": {
      "type": [
        "string",
        "null"
      ],
      "description": "While blocked: the offered choices as JSON text"
    },
    "block_recommended": {
      "type": [
        "integer",
        "null"
      ]
    },
    "block_if_no_answer": {
      "type": [
        "string",
        "null"
      ]
    },
    "blocked_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "When the current question was asked"
    },
    "completed_summary": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_by": {
      "type": "string",
      "enum": [
        "human",
        "agent"
      ]
    },
    "code_file_path": {
      "type": [
        "string",
        "null"
      ]
    },
    "code_line_number": {
      "type": [
        "integer",
        "null"
      ]
    },
    "parent_task_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Set on steps: the task they belong to"
    },
    "sort_order": {
      "type": "integer",
      "description": "Position among its siblings"
    },
    "progress": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Last reported percent (0-100)"
    },
    "progress_current": {
      "type": [
        "integer",
        "null"
      ]
    },
    "progress_total": {
      "type": [
        "integer",
        "null"
      ]
    },
    "progress_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "What the agent said it is doing now"
    },
    "overall_progress": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Progress including steps: done = 100; else the average of its steps; else the reported progress"
    },
    "subtask_counts": {
      "$ref": "#/$defs/SubtaskCounts"
    },
    "subtasks": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "A Task (one level, steps don't nest)"
      }
    },
    "agent_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "Which agent is on it"
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "last_activity_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Last time an agent touched it"
    },
    "labels": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Label"
      }
    },
    "notes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Note"
      }
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "repeat": {
      "oneOf": [
        {
          "$ref": "#/$defs/Repeat"
        },
        {
          "type": "null"
        }
      ],
      "description": "Single-task replies: the schedule it repeats on"
    },
    "repeat_note": {
      "type": "string",
      "description": "After a create or update with repeat: what happened, in a sentence"
    },
    "time_in_state": {
      "type": [
        "object",
        "null"
      ],
      "description": "Single-task replies: time worked (in progress), waited on the person (blocked, on the task or a step) and in To Do, from its status history",
      "properties": {
        "worked_ms": {
          "type": "integer"
        },
        "waited_ms": {
          "type": "integer"
        },
        "todo_ms": {
          "type": "integer"
        },
        "questions": {
          "type": "integer"
        },
        "running": {
          "type": "boolean"
        },
        "text": {
          "type": "string",
          "description": "e.g. worked 40m, waited on you 2h 10m, in To Do 1d"
        }
      }
    }
  },
  "$defs": {
    "Label": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "task_count": {
          "type": "integer",
          "description": "In GET /api/labels only"
        }
      }
    },
    "Note": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "task_id": {
          "type": "string",
          "format": "uuid"
        },
        "content": {
          "type": "string"
        },
        "created_by": {
          "type": "string",
          "enum": [
            "human",
            "agent"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "Repeat": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "summary": {
          "type": "string",
          "description": "e.g. Every Monday at 9:00 am"
        },
        "rule": {
          "type": "object",
          "description": "The schedule in the RepeatInput object form, with timezone"
        },
        "timezone": {
          "type": "string"
        },
        "paused": {
          "type": "boolean"
        },
        "next_run_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Null while paused"
        },
        "last_run_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "last_skipped_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Last run that made no copy because the previous one was still open"
        },
        "last_task_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "project": {
          "type": [
            "object",
            "null"
          ]
        },
        "title": {
          "type": "string"
        },
        "steps": {
          "type": "integer",
          "description": "Steps each copy gets"
        }
      }
    },
    "SubtaskCounts": {
      "type": "object",
      "properties": {
        "total": {
          "type": "integer"
        },
        "done": {
          "type": "integer"
        },
        "in_progress": {
          "type": "integer"
        },
        "blocked": {
          "type": "integer"
        },
        "todo": {
          "type": "integer"
        }
      }
    }
  }
}