{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/taskhold-com/json-schema/taskhold-com-live-snapshot-schema.json",
  "title": "LiveSnapshot",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/taskhold-com-openapi.yml#/components/schemas/LiveSnapshot",
  "type": "object",
  "properties": {
    "cursor": {
      "type": "integer"
    },
    "active": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Task"
      }
    },
    "blocked": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Task"
      }
    },
    "recently_done": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Task"
      }
    },
    "projects": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Project"
      },
      "description": "Every active project with counts (the board's project chips)"
    },
    "no_project": {
      "type": "object",
      "description": "Counts by status of top-level tasks with no project (the board's No project chip)",
      "properties": {
        "todo": {
          "type": "integer"
        },
        "in_progress": {
          "type": "integer"
        },
        "blocked": {
          "type": "integer"
        },
        "done": {
          "type": "integer"
        }
      }
    },
    "up_next": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Task"
      }
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Event"
      }
    },
    "counts": {
      "type": "object",
      "properties": {
        "in_progress": {
          "type": "integer"
        },
        "blocked": {
          "type": "integer"
        },
        "todo": {
          "type": "integer"
        },
        "done_today": {
          "type": "integer"
        }
      }
    }
  },
  "$defs": {
    "Event": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "Increasing; use as the cursor"
        },
        "task_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "root_task_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "The top-level task (the task itself, or a step's parent)"
        },
        "type": {
          "type": "string",
          "enum": [
            "task.created",
            "task.status",
            "task.progress",
            "task.note",
            "task.updated",
            "task.deleted",
            "subtasks.planned"
          ]
        },
        "actor": {
          "type": "string",
          "enum": [
            "human",
            "agent",
            "system"
          ]
        },
        "actor_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "summary": {
          "type": "string",
          "description": "One line, readable as is"
        },
        "data": {
          "type": [
            "object",
            "null"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "task_title": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "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"
        }
      }
    },
    "Project": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "agent_notes": {
          "type": [
            "string",
            "null"
          ],
          "description": "Project notes for agents, written by the person (up to 4,000 characters)"
        },
        "color": {
          "type": "string"
        },
        "is_active": {
          "type": "boolean"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "counts": {
          "type": "object",
          "description": "GET /api/projects: top-level tasks by status",
          "properties": {
            "todo": {
              "type": "integer"
            },
            "in_progress": {
              "type": "integer"
            },
            "blocked": {
              "type": "integer"
            },
            "done": {
              "type": "integer"
            }
          }
        }
      }
    },
    "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"
        }
      }
    },
    "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"
            }
          }
        }
      }
    }
  }
}