{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "work-item.json",
  "title": "Work Item",
  "description": "A trackable unit of work in the task management system.",
  "type": "object",
  "required": ["id", "title", "status", "owner", "created"],
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^w-\\d{4}-\\d{2}-\\d{2}(?:-[a-z]{2,12})?-\\d{3}$",
      "description": "Work item identifier. Two forms are permanently valid: legacy `w-YYYY-MM-DD-NNN` (pre-2026-08-12 items) and writer-scoped `w-YYYY-MM-DD-<author>-NNN` (post-R1 mints; author = /^[a-z]{2,12}$/ from operator/config/authors.json). New allocators must always emit the writer-scoped form — see packages/core/src/workItemId/index.mjs."
    },
    "projectId": {
      "type": ["string", "null"],
      "description": "Associated project identifier, or null if standalone"
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "description": "Short descriptive title"
    },
    "category": {
      "type": "string",
      "enum": ["feature", "bug", "chore", "discussion", "research"],
      "description": "Work item category"
    },
    "status": {
      "type": "string",
      "enum": ["draft", "planned", "in-progress", "blocked", "done", "archived"],
      "description": "Current workflow status"
    },
    "priority": {
      "type": "integer",
      "minimum": 0,
      "maximum": 3,
      "description": "Priority level: 0 (critical) to 3 (low)"
    },
    "owner": {
      "type": "string",
      "minLength": 1,
      "description": "Long-term accountability — who owns the outcome"
    },
    "assignee": {
      "type": "string",
      "description": "Whose move it is right now"
    },
    "created": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Creation date in YYYY-MM-DD format"
    },
    "updated": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Last update date in YYYY-MM-DD format"
    },
    "completedAt": {
      "type": ["string", "null"],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Completion date in YYYY-MM-DD format, or null"
    },
    "summary": {
      "type": "string",
      "description": "Longer description of the work item"
    },
    "blocked": {
      "type": ["string", "null"],
      "description": "Description of what is blocking this item, or null"
    },
    "links": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["label", "path"],
        "additionalProperties": false,
        "properties": {
          "label": {
            "type": "string",
            "description": "Display label for the link"
          },
          "path": {
            "type": "string",
            "description": "Relative path or URL"
          }
        }
      },
      "description": "Related links (docs, specs, PRs, etc.)"
    }
  }
}
