{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://antigravity.google/schemas/session.schema.json",
  "title": "AWF Session State Schema",
  "description": "Dynamic session state - changes frequently during work sessions",
  "version": "1.0.0",
  "type": "object",
  "required": [
    "updatedAt"
  ],
  "properties": {
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Last update timestamp"
    },
    "workingOn": {
      "type": "object",
      "description": "Current work in progress",
      "properties": {
        "feature": { "type": "string", "description": "Feature name" },
        "task": { "type": "string", "description": "Current task" },
        "status": {
          "type": "string",
          "enum": ["planning", "coding", "testing", "debugging", "reviewing"],
          "description": "Task status"
        },
        "currentPlanPath": {
          "type": "string",
          "description": "Path to current plan folder (e.g., plans/260117-1430-orders/)"
        },
        "currentPhase": {
          "type": "string",
          "description": "Current phase being worked on (e.g., phase-03)"
        },
        "files": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Files being modified"
        },
        "blockers": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Current blockers"
        },
        "notes": { "type": "string", "description": "Quick notes" }
      }
    },
    "pendingTasks": {
      "type": "array",
      "description": "Tasks to do next",
      "items": {
        "type": "object",
        "properties": {
          "task": { "type": "string" },
          "priority": { "type": "string", "enum": ["high", "medium", "low"] },
          "notes": { "type": "string" }
        },
        "required": ["task", "priority"]
      }
    },
    "recentChanges": {
      "type": "array",
      "description": "Recent changes in this session",
      "items": {
        "type": "object",
        "properties": {
          "timestamp": { "type": "string", "format": "date-time" },
          "type": { "type": "string", "enum": ["feature", "bugfix", "refactor", "config", "docs"] },
          "description": { "type": "string" },
          "files": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "errorsEncountered": {
      "type": "array",
      "description": "Errors encountered and solutions",
      "items": {
        "type": "object",
        "properties": {
          "error": { "type": "string" },
          "solution": { "type": "string" },
          "resolved": { "type": "boolean" }
        }
      }
    },
    "decisionsMade": {
      "type": "array",
      "description": "Technical decisions made this session",
      "items": {
        "type": "object",
        "properties": {
          "decision": { "type": "string" },
          "reason": { "type": "string" }
        }
      }
    },
    "skippedTests": {
      "type": "array",
      "description": "Tests that were skipped due to fix failures - blocks deploy!",
      "items": {
        "type": "object",
        "properties": {
          "test": { "type": "string", "description": "Test file name" },
          "reason": { "type": "string", "description": "Why it was skipped" },
          "date": { "type": "string", "format": "date-time" }
        },
        "required": ["test", "date"]
      }
    }
  }
}
