{
  "name": "tasks",
  "description": "Ordered task list for the coordinator's own planning state. Persisted on the coordinator workstream so it survives restarts. Use to decompose work, mark progress, and link tasks to spawned children via `child_ws_id`. Actions: `add` (append), `update` (mutate title/status/child_ws_id by id), `remove` (by id), `reorder` (by id list), `list`. Status: `pending`, `in_progress`, `done`, `blocked`. Titles over 200 chars are rejected (error) rather than silently truncated. `child_ws_id` is a free-form label — not validated against the workstreams table, so it can point at a not-yet-spawned or already-closed id; cross-reference `list_workstreams` if you care.",
  "parameters": {
    "type": "object",
    "properties": {
      "action": {
        "type": "string",
        "description": "One of: add / update / remove / reorder / list.",
        "enum": ["add", "update", "remove", "reorder", "list"]
      },
      "title": {
        "type": "string",
        "description": "For 'add' and 'update': task title. Max 200 chars; longer titles are REJECTED (not truncated)."
      },
      "task_id": {
        "type": "string",
        "description": "For 'update' and 'remove': target task id."
      },
      "status": {
        "type": "string",
        "description": "For 'add' and 'update': pending / in_progress / done / blocked.",
        "enum": ["pending", "in_progress", "done", "blocked"]
      },
      "child_ws_id": {
        "type": "string",
        "description": "For 'add' and 'update': optional free-form ws_id label. NOT validated against the workstreams table — the coordinator owns the linkage semantics (pre-spawn placeholders and post-close references are both legal)."
      },
      "task_ids": {
        "type": "array",
        "items": { "type": "string" },
        "description": "For 'reorder': new ordering by task_id (must be a permutation of existing task_ids)."
      }
    },
    "required": ["action"]
  },
  "coordinator": true,
  "primary_key": "action"
}
