{
  "openapi": "3.1.0",
  "info": {
    "title": "Specky API",
    "version": "1.0.0-beta",
    "summary": "Public HTTP surface for AI agents and integrations.",
    "description": "Specky is an AI-native product workspace. The v1 REST surface mirrors the core workspace operations exposed through the Specky MCP server (https://www.specky.space/api/mcp). Authenticate with a workspace API key (`sk_live_…`) created in Specky → Settings → Developer.\n\n**Versioning.** The REST surface is versioned in the URL path (`/api/v1`). Additive changes ship without a new version. A breaking change gets a new version, and the old one keeps working for at least 90 days after it is announced. While an endpoint is on its way out, responses carry `Deprecation` (RFC 9745) and `Sunset` (RFC 8594) headers plus a `Link` header with `rel=\"deprecation\"`. No endpoint is deprecated today. Policy: https://www.specky.space/docs/api-versioning\n\n**Rate limits.** 120 requests per minute per credential, and per client IP without one. Every /api/v1 response carries `RateLimit-*` and `X-RateLimit-*` headers; a 429 adds `Retry-After`.\n\n**Errors.** Every 4xx and 5xx from /api/v1 is JSON with `error` (human-readable) and `code` (machine-readable).",
    "contact": { "name": "Specky Support", "email": "customer-support@specky.space", "url": "https://www.specky.space/for-agents" },
    "license": { "name": "Proprietary", "url": "https://www.specky.space/terms" }
  },
  "servers": [
    { "url": "https://www.specky.space", "description": "Production" }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    { "name": "Capture", "description": "Push signals into the Product Graph." },
    { "name": "Workspace", "description": "Read workspace state." },
    { "name": "Documents", "description": "Create and read documents." },
    { "name": "Insights", "description": "Customer/product insights." },
    { "name": "Opportunities", "description": "Opportunity Tree." },
    { "name": "Decisions", "description": "Decision Log." },
    { "name": "Experiments", "description": "Experiment Tracker." },
    { "name": "OKRs", "description": "OKR Tracker." },
    { "name": "Tickets", "description": "Engineering tickets." },
    { "name": "Execution", "description": "Provider-neutral coding-agent handoffs and status." },
    { "name": "Research", "description": "Alex JTBD interview campaigns." },
    { "name": "Workflows", "description": "Custom workflows." },
    { "name": "Webhooks", "description": "Outbound delivery events." },
    { "name": "Meta", "description": "Discovery and health." }
  ],
  "paths": {
    "/api/v1/product-context": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "Read confirmed product identity, principles, features, and workspace instructions",
        "operationId": "getProductContext",
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ProductContextResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/coding-brief": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "Build an implementation brief from current-product specs and evidence",
        "operationId": "getCodingBrief",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Feature, ticket, or problem the implementation should address.",
            "schema": { "type": "string", "minLength": 1, "maxLength": 500 }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 15, "default": 8 }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CodingBriefResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/search": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "Hybrid keyword search across the Product Graph and documents",
        "operationId": "searchWorkspace",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": { "type": "string" }
          },
          {
            "name": "source_types",
            "in": "query",
            "description": "Comma-separated list of source_type values (SLACK, JIRA, GONG, INSIGHT, …).",
            "schema": { "type": "string" }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 20 }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SearchResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/items/{id}": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "Fetch a document or graph node by id or partial name",
        "operationId": "readItem",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "document",
                "graph_node",
                "auto"
              ],
              "default": "auto"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ItemResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent-context": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "Read the central workspace build contract and product context",
        "description": "Returns the agent-safe workspace context that should be read before planning or implementing work. Integration credentials and unrelated preference keys are excluded.",
        "operationId": "getAgentContext",
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentContextResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/engineering-standards": {
      "get": {
        "tags": [
          "Execution"
        ],
        "summary": "Read the workspace engineering delivery standard",
        "description": "Returns the structured definition of done, review checklist, required checks, and escalation rules shared by Specky and coding agents.",
        "operationId": "getEngineeringStandards",
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/EngineeringStandardsResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/engineering-rules": {
      "get": {
        "tags": [
          "Execution"
        ],
        "summary": "List relevant engineering rules",
        "description": "Lists workspace-scoped MUST/SHOULD/MAY rules with optional collection, tag, language, framework, and query filters.",
        "operationId": "listEngineeringRules",
        "parameters": [
          {
            "name": "collection",
            "in": "query",
            "schema": { "type": "string" }
          },
          {
            "name": "tags",
            "in": "query",
            "description": "Comma-separated tags.",
            "schema": { "type": "string" }
          },
          {
            "name": "language",
            "in": "query",
            "schema": { "type": "string" }
          },
          {
            "name": "framework",
            "in": "query",
            "schema": { "type": "string" }
          },
          {
            "name": "q",
            "in": "query",
            "schema": { "type": "string" }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 200, "default": 100 }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/EngineeringRulesResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Execution"
        ],
        "summary": "Create an engineering rule",
        "description": "Creates a workspace-scoped engineering rule. Deactivate or update it through the id-specific endpoint; rules are never deleted from the engineering history.",
        "operationId": "createEngineeringRule",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/EngineeringRuleRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/EngineeringRuleResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/engineering-rules/{id}": {
      "post": {
        "tags": [
          "Execution"
        ],
        "summary": "Update or deactivate an engineering rule",
        "operationId": "updateEngineeringRule",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/EngineeringRuleUpdateRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/EngineeringRuleResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent-runs": {
      "get": {
        "tags": [
          "Execution"
        ],
        "summary": "List coding-agent execution runs",
        "description": "Returns provider-neutral handoff records for Cursor, Claude Code, Codex, Copilot, Cursor Cloud Agent, Modern.dev, Devin, Jules, and other agents. Each run includes separate CI and deployment signals; a merged pull request is not treated as proof of production deployment. Runs are always scoped to the authenticated workspace.",
        "operationId": "listAgentRuns",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "pending_assignment",
                "assigned",
                "awaiting_agent",
                "in_progress",
                "awaiting_review",
                "changes_requested",
                "passed",
                "failed",
                "blocked",
                "cancelled"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Ticket title, external issue id, provider, or destination.",
            "schema": { "type": "string" }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 25 }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentRunsResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent-runs/{id}": {
      "get": {
        "tags": [
          "Execution"
        ],
        "summary": "Read one coding-agent execution run",
        "operationId": "getAgentRun",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentRunResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent-runs/{id}/status": {
      "post": {
        "tags": [
          "Execution"
        ],
        "summary": "Report coding-agent execution status",
        "description": "Agents should call this after starting work and when they have a branch, pull request, checks, blocker, or final outcome.",
        "operationId": "updateAgentRun",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "queued",
                      "pending_assignment",
                      "assigned",
                      "awaiting_agent",
                      "in_progress",
                      "awaiting_review",
                      "changes_requested",
                      "passed",
                      "failed",
                      "blocked",
                      "cancelled"
                    ]
                  },
                  "note": { "type": "string" },
                  "branch": { "type": "string" },
                  "commit_sha": { "type": "string" },
                  "pull_request_url": { "type": "string", "format": "uri" },
                  "provider_agent_id": { "type": "string" },
                  "provider_run_id": { "type": "string" },
                  "checks": {
                    "type": "array",
                    "items": {}
                  },
                  "ci_status": {
                    "type": "string",
                    "enum": [
                      "not_reported",
                      "queued",
                      "in_progress",
                      "success",
                      "failure",
                      "cancelled",
                      "unknown"
                    ]
                  },
                  "ci_name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ci_url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri"
                  },
                  "ci_conclusion": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ci_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "deployment_status": {
                    "type": "string",
                    "enum": [
                      "not_reported",
                      "queued",
                      "in_progress",
                      "success",
                      "failure",
                      "cancelled",
                      "unknown"
                    ]
                  },
                  "deployment_environment": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "deployment_url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri"
                  },
                  "deployment_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "deployment_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "deployment_source": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "production_deployment_status": {
                    "type": "string",
                    "enum": [
                      "not_reported",
                      "queued",
                      "in_progress",
                      "success",
                      "failure",
                      "cancelled",
                      "unknown"
                    ]
                  },
                  "production_deployment_url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri"
                  },
                  "production_deployed_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "smoke_test_status": {
                    "type": "string",
                    "enum": [
                      "not_reported",
                      "queued",
                      "in_progress",
                      "success",
                      "failure",
                      "cancelled",
                      "unknown"
                    ]
                  },
                  "smoke_test_name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "smoke_test_url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri"
                  },
                  "smoke_test_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "feature_flag_status": {
                    "type": "string",
                    "enum": [
                      "not_reported",
                      "queued",
                      "in_progress",
                      "success",
                      "failure",
                      "cancelled",
                      "unknown"
                    ]
                  },
                  "feature_flag_name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "feature_flag_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "summary": { "type": "string" },
                  "blocked_reason": { "type": "string" },
                  "error": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentRunResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent-runs/{id}/validate-plan": {
      "post": {
        "tags": [
          "Execution"
        ],
        "summary": "Validate an agent plan before coding",
        "operationId": "validateAgentPlan",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ValidatePlanRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentReviewResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent-runs/{id}/validate-change": {
      "post": {
        "tags": [
          "Execution"
        ],
        "summary": "Validate changed files before reporting success",
        "operationId": "validateAgentChange",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ValidateChangeRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentReviewResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/documents": {
      "get": {
        "tags": [
          "Documents"
        ],
        "summary": "List documents",
        "operationId": "listDocuments",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "prd",
                "spec",
                "research",
                "roadmap",
                "notes",
                "all"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "review",
                "approved",
                "archived",
                "all"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DocumentsResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Documents"
        ],
        "summary": "Create a new document",
        "operationId": "createDocument",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateDocumentRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DocumentResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/signals": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "Recent graph signals",
        "operationId": "listRecentSignals",
        "parameters": [
          {
            "name": "source_type",
            "in": "query",
            "description": "One Product Graph source type.",
            "schema": { "type": "string" }
          },
          {
            "name": "source_types",
            "in": "query",
            "description": "Compatibility alias: comma-separated source types. Use source_type for a single value.",
            "schema": { "type": "string" }
          },
          {
            "name": "since",
            "in": "query",
            "description": "Only include signals created at or after this timestamp.",
            "schema": { "type": "string", "format": "date-time" }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }
          },
          {
            "name": "pagination",
            "in": "query",
            "description": "Defaults to bounded cursor pagination. Use offset for legacy pagination with an exact scoped total.",
            "schema": {
              "type": "string",
              "enum": [
                "cursor",
                "offset"
              ],
              "default": "cursor"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque next_cursor from the prior cursor-mode response. Reuse with the same workspace and filters.",
            "schema": { "type": "string" }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Legacy offset mode. Supplying offset selects offset pagination, which computes an exact total by scanning all matching signals.",
            "schema": { "type": "integer", "minimum": 0 }
          }
        ],
        "responses": {
          "200": {
            "description": "Cursor mode returns total: null, has_more, and next_cursor. A page can be short when the bounded scan window contains mostly hidden Google rows; continue while has_more is true. Offset mode returns the exact scoped total.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SignalsListResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Capture"
        ],
        "summary": "Create one signal, or up to 100 in a batch",
        "operationId": "createSignals",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/SignalCreateRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SignalCreateResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/inbox": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "PM Inbox items awaiting review",
        "operationId": "listInbox",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "approved",
                "dismissed",
                "all"
              ],
              "default": "pending"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/InboxResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/capture": {
      "post": {
        "tags": [
          "Capture"
        ],
        "summary": "Capture a signal into the Product Graph",
        "operationId": "captureSignal",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CaptureRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CaptureResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/insights": {
      "post": {
        "tags": [
          "Insights"
        ],
        "summary": "Record an insight",
        "operationId": "createInsight",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateInsightRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/InsightResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/opportunities": {
      "post": {
        "tags": [
          "Opportunities"
        ],
        "summary": "Add an opportunity",
        "operationId": "createOpportunity",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateOpportunityRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/OpportunityResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/decisions": {
      "post": {
        "tags": [
          "Decisions"
        ],
        "summary": "Log a decision",
        "operationId": "createDecision",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateDecisionRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DecisionResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/experiments": {
      "post": {
        "tags": [
          "Experiments"
        ],
        "summary": "Create an experiment",
        "operationId": "createExperiment",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateExperimentRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ExperimentResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/validation-pages": {
      "post": {
        "tags": [
          "Experiments"
        ],
        "summary": "Create a validation page for an existing experiment",
        "operationId": "createValidationPage",
        "description": "Generate a typed, shareable fake-door, waitlist, feature-interest, concierge, or prototype page. Pages are drafts unless publish is explicitly true.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateValidationPageRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ValidationPageResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/validation-pages/{id}/repository": {
      "post": {
        "tags": [
          "Experiments"
        ],
        "summary": "Deliver a published validation page to a GitHub branch",
        "operationId": "publishValidationPageToRepository",
        "description": "Creates or updates a specky/validation/... branch with a complete static fake-door page, validation.json, and README. The hosted validation URL remains the response destination. Set open_pull_request to true only when a draft PR is wanted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/PublishValidationPageRepositoryRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ValidationPageRepositoryResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "502": {
            "description": "Upstream provider failed",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/validation-pages/{id}/analytics": {
      "get": {
        "tags": [
          "Experiments"
        ],
        "summary": "Read validation-page experiment analytics",
        "operationId": "getValidationPageAnalytics",
        "description": "Returns active variant funnels, Wilson confidence intervals, sample-size readiness, privacy-safe UTM segments, guardrail status, and a cautious verdict. Small samples remain not_ready or inconclusive.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "from",
            "in": "query",
            "schema": { "type": "string", "format": "date-time" }
          },
          {
            "name": "to",
            "in": "query",
            "schema": { "type": "string", "format": "date-time" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ValidationPageAnalyticsResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/okrs": {
      "post": {
        "tags": [
          "OKRs"
        ],
        "summary": "Create an OKR",
        "operationId": "createOKR",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateOkrRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/OkrResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/tickets": {
      "post": {
        "tags": [
          "Tickets"
        ],
        "summary": "Persist a batch of engineering tickets",
        "operationId": "createTickets",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateTicketsRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/TicketsResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/research-sessions": {
      "post": {
        "tags": [
          "Research"
        ],
        "summary": "Start an Alex JTBD research session",
        "operationId": "startResearchSession",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/StartResearchRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ResearchSessionResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/workflows": {
      "get": {
        "tags": [
          "Workflows"
        ],
        "summary": "List custom workflows",
        "operationId": "listWorkflows",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 25 }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/BuiltInWorkflowsResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Run a built-in research workflow",
        "operationId": "executeBuiltInWorkflow",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/WorkflowExecuteRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/WorkflowExecuteResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/workflows/{id}/runs": {
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Queue a workflow execution",
        "operationId": "runWorkflow",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "parameters": {
                    "type": "object",
                    "additionalProperties": { "type": "string" }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/WorkflowRunResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "403": {
            "description": "Workspace edit access required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "413": {
            "description": "Request body too large",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "tags": [
          "Meta"
        ],
        "summary": "MCP JSON-RPC entrypoint",
        "description": "Send JSON-RPC 2.0 requests (single or batch) to drive the Specky MCP server. Methods: initialize, tools/list, tools/call, ping.",
        "operationId": "mcpJsonRpc",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "type": "object" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/McpJsonRpcResponse" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials. WWW-Authenticate points at the OAuth resource metadata.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "MCP discovery / SSE stream",
        "description": "Without `Accept: text/event-stream` → JSON server descriptor. With it → SSE keep-alive stream.",
        "operationId": "mcpDiscovery",
        "responses": {
          "200": {
            "description": "Descriptor or SSE stream",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/McpDiscoveryResponse" }
              },
              "text/event-stream": {
                "schema": { "type": "string" }
              }
            }
          }
        }
      }
    },
    "/.well-known/agents.json": {
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "Agent capability manifest",
        "operationId": "getAgentsManifest",
        "security": [],
        "responses": {
          "200": {
            "description": "Manifest",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentManifest" }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "tags": [
          "Meta"
        ],
        "summary": "LLM-friendly site index",
        "operationId": "getLlmsTxt",
        "security": [],
        "responses": {
          "200": {
            "description": "Plain-text index",
            "content": {
              "text/plain": {
                "schema": { "type": "string" }
              }
            }
          }
        }
      }
    },
    "/api/v1/experiment-methods": {
      "get": {
        "tags": [
          "Experiments"
        ],
        "summary": "List the experiment methods catalog",
        "operationId": "listExperimentMethods",
        "parameters": [
          {
            "name": "stage",
            "in": "query",
            "schema": { "type": "string" }
          },
          {
            "name": "risk",
            "in": "query",
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ExperimentMethodsResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "402": {
            "description": "A paid plan or module is required",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "404": {
            "description": "Resource or workspace not found",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "409": {
            "description": "Workspace product context changed; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            },
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimit-Limit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimit-Remaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimit-Reset" },
              "RateLimit-Policy": { "$ref": "#/components/headers/RateLimit-Policy" },
              "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" },
              "X-RateLimit-Remaining": { "$ref": "#/components/headers/X-RateLimit-Remaining" },
              "X-RateLimit-Reset": { "$ref": "#/components/headers/X-RateLimit-Reset" },
              "Retry-After": { "$ref": "#/components/headers/Retry-After" }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable; retry",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Error" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "sk_live_… or ext_…", "description": "Workspace API key from Specky → Settings → Developer. Sent as `Authorization: Bearer <token>`." }
    },
    "schemas": {
      "EngineeringRuleRequest": {
        "type": "object",
        "required": [
          "statement"
        ],
        "properties": {
          "statement": { "type": "string", "maxLength": 1000, "description": "Rule statement. Start with MUST, SHOULD, or MAY when possible." },
          "level": {
            "type": "string",
            "enum": [
              "mandatory",
              "recommended",
              "optional"
            ]
          },
          "collection": { "type": "string", "maxLength": 120 },
          "tags": {
            "type": "array",
            "maxItems": 20,
            "items": { "type": "string" }
          },
          "languages": {
            "type": "array",
            "maxItems": 20,
            "items": { "type": "string" }
          },
          "frameworks": {
            "type": "array",
            "maxItems": 20,
            "items": { "type": "string" }
          },
          "keywords": {
            "type": "array",
            "maxItems": 30,
            "items": { "type": "string" }
          },
          "must_include_files": {
            "type": "array",
            "maxItems": 20,
            "items": { "type": "string" }
          },
          "must_not_include_files": {
            "type": "array",
            "maxItems": 20,
            "items": { "type": "string" }
          },
          "provenance": { "type": "string", "maxLength": 300 },
          "enabled": { "type": "boolean", "default": true }
        }
      },
      "EngineeringRuleUpdateRequest": {
        "type": "object",
        "properties": {
          "statement": { "type": "string", "maxLength": 1000 },
          "level": {
            "type": "string",
            "enum": [
              "mandatory",
              "recommended",
              "optional"
            ]
          },
          "collection": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 120
          },
          "tags": {
            "type": "array",
            "maxItems": 20,
            "items": { "type": "string" }
          },
          "languages": {
            "type": "array",
            "maxItems": 20,
            "items": { "type": "string" }
          },
          "frameworks": {
            "type": "array",
            "maxItems": 20,
            "items": { "type": "string" }
          },
          "keywords": {
            "type": "array",
            "maxItems": 30,
            "items": { "type": "string" }
          },
          "must_include_files": {
            "type": "array",
            "maxItems": 20,
            "items": { "type": "string" }
          },
          "must_not_include_files": {
            "type": "array",
            "maxItems": 20,
            "items": { "type": "string" }
          },
          "provenance": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 300
          },
          "enabled": { "type": "boolean" }
        }
      },
      "ValidatePlanRequest": {
        "type": "object",
        "required": [
          "plan"
        ],
        "properties": {
          "plan": { "type": "string", "maxLength": 12000 },
          "collection": { "type": "string" },
          "tags": {
            "type": "array",
            "items": { "type": "string" }
          },
          "language": { "type": "string" },
          "framework": { "type": "string" },
          "query": { "type": "string" }
        }
      },
      "ValidateChangeRequest": {
        "type": "object",
        "required": [
          "changed_files"
        ],
        "properties": {
          "changed_files": {
            "type": "array",
            "maxItems": 200,
            "items": { "type": "string" }
          },
          "diff": { "type": "string", "maxLength": 80000 },
          "collection": { "type": "string" },
          "tags": {
            "type": "array",
            "items": { "type": "string" }
          },
          "language": { "type": "string" },
          "framework": { "type": "string" },
          "query": { "type": "string" }
        }
      },
      "CaptureRequest": {
        "type": "object",
        "required": [
          "content"
        ],
        "properties": {
          "content": { "type": "string", "maxLength": 10000 },
          "url": { "type": "string", "format": "uri" },
          "title": { "type": "string" },
          "source_type": {
            "type": "string",
            "enum": [
              "CHROME_EXTENSION",
              "COMPETITIVE_INTEL",
              "FEEDBACK",
              "MARKET_INTEL",
              "HIRING_INTEL"
            ],
            "default": "CHROME_EXTENSION"
          }
        }
      },
      "CreateDocumentRequest": {
        "type": "object",
        "required": [
          "title",
          "type",
          "content"
        ],
        "properties": {
          "title": { "type": "string" },
          "type": {
            "type": "string",
            "enum": [
              "prd",
              "spec",
              "research",
              "roadmap",
              "notes"
            ]
          },
          "content": { "type": "string", "description": "Full markdown content." }
        }
      },
      "CreateInsightRequest": {
        "type": "object",
        "required": [
          "title",
          "content"
        ],
        "properties": {
          "title": { "type": "string" },
          "content": { "type": "string" },
          "sentiment": {
            "type": "string",
            "enum": [
              "positive",
              "negative",
              "neutral"
            ],
            "default": "neutral"
          },
          "tags": {
            "type": "array",
            "items": { "type": "string" }
          },
          "evidence_node_ids": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      },
      "CreateOpportunityRequest": {
        "type": "object",
        "required": [
          "title",
          "description",
          "impact",
          "effort"
        ],
        "properties": {
          "title": { "type": "string" },
          "description": { "type": "string" },
          "impact": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "effort": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          },
          "parent_id": { "type": "string" }
        }
      },
      "CreateDecisionRequest": {
        "type": "object",
        "required": [
          "what",
          "rationale"
        ],
        "properties": {
          "what": { "type": "string" },
          "rationale": { "type": "string" },
          "outcome": {
            "type": "string",
            "enum": [
              "expected",
              "confirmed",
              "revised",
              "reversed"
            ],
            "default": "expected"
          },
          "decided_by": { "type": "string" },
          "evidence_node_ids": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      },
      "CreateExperimentRequest": {
        "type": "object",
        "required": [
          "hypothesis",
          "method"
        ],
        "properties": {
          "hypothesis": { "type": "string" },
          "method": {
            "type": "string",
            "enum": [
              "interview",
              "survey",
              "prototype",
              "a_b_test",
              "fake_door",
              "concierge",
              "wizard_of_oz",
              "analytics",
              "other"
            ]
          },
          "description": { "type": "string" },
          "success_criteria": { "type": "string" },
          "effort": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ],
            "default": "medium"
          },
          "time_to_run": { "type": "string" }
        }
      },
      "CreateValidationPageRequest": {
        "type": "object",
        "required": [
          "experiment_id"
        ],
        "properties": {
          "experiment_id": { "type": "string", "format": "uuid", "description": "The EXPERIMENT graph-node ID in the authenticated workspace." },
          "page_type": {
            "type": "string",
            "enum": [
              "fake_door",
              "waitlist",
              "feature_interest",
              "concierge",
              "prototype"
            ]
          },
          "publish": { "type": "boolean", "default": false, "description": "Publish after generation. Keep false until the copy and audience are reviewed." }
        }
      },
      "PublishValidationPageRepositoryRequest": {
        "type": "object",
        "properties": {
          "repo": { "type": "string", "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$", "description": "Optional owner/repo override. Defaults to the connected GitHub target." },
          "base_branch": { "type": "string", "description": "Optional base branch. Defaults to the configured or repository default branch." },
          "open_pull_request": { "type": "boolean", "default": false, "description": "Open a draft PR after writing the branch." }
        }
      },
      "CreateOkrRequest": {
        "type": "object",
        "required": [
          "objective"
        ],
        "properties": {
          "objective": { "type": "string" },
          "description": { "type": "string" },
          "quarter": { "type": "string" },
          "status": {
            "type": "string",
            "enum": [
              "on_track",
              "at_risk",
              "off_track"
            ],
            "default": "on_track"
          },
          "owner": { "type": "string" },
          "key_results": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "object",
              "required": [
                "title",
                "target"
              ],
              "properties": {
                "title": { "type": "string" },
                "target": { "type": "number" },
                "current": { "type": "number", "default": 0 }
              }
            }
          }
        }
      },
      "CreateTicketsRequest": {
        "type": "object",
        "required": [
          "feature_title",
          "tickets"
        ],
        "properties": {
          "feature_title": { "type": "string" },
          "tickets": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "type",
                "title",
                "description"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "epic",
                    "story",
                    "task"
                  ]
                },
                "title": { "type": "string" },
                "description": { "type": "string" },
                "priority": {
                  "type": "string",
                  "enum": [
                    "critical",
                    "high",
                    "medium",
                    "low"
                  ],
                  "default": "medium"
                },
                "estimate": { "type": "number" },
                "labels": {
                  "type": "array",
                  "items": { "type": "string" }
                }
              }
            }
          }
        }
      },
      "StartResearchRequest": {
        "type": "object",
        "required": [
          "topic",
          "research_question"
        ],
        "properties": {
          "topic": { "type": "string" },
          "research_question": { "type": "string" },
          "target_audience": { "type": "string" }
        }
      },
      "WebhookDelivery": {
        "type": "object",
        "description": "Body POSTed by Specky to subscribed webhook URLs. Each delivery carries `X-Specky-Event`, `X-Specky-Delivery-Id`, `X-Specky-Timestamp`, and `X-Specky-Signature` headers. Signature format: `t=<unix-sec>,v1=<hmac-sha256-hex>` over `<timestamp>.<rawBody>` with the per-webhook secret.",
        "properties": {
          "id": { "type": "string" },
          "event": {
            "type": "string",
            "enum": [
              "document.created",
              "insight.created",
              "ticket.created",
              "opportunity.created",
              "decision.created",
              "experiment.created",
              "experiment.page_response",
              "okr.created"
            ]
          },
          "workspace_id": { "type": "string", "format": "uuid" },
          "timestamp": { "type": "string", "format": "date-time" },
          "data": { "type": "object" }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "code"
        ],
        "properties": {
          "error": { "type": "string", "description": "Human-readable explanation." },
          "code": { "type": "string", "description": "Stable machine-readable code. Generic values: invalid_request, unauthorized, payment_required, forbidden, not_found, conflict, payload_too_large, rate_limited, internal_error, upstream_error, unavailable. Some failures use a more specific code such as module_required or PRODUCT_CONTEXT_CHANGED." },
          "ok": { "type": "boolean", "const": false },
          "message": { "type": "string", "description": "Tool error text, when a workspace tool failed." },
          "details": { "description": "Extra context. A validation issue list, or for gate failures an object such as { type, retryAfterSec, scope }." },
          "upgrade_url": { "type": "string", "format": "uri", "description": "Where a person can upgrade, on plan-gate failures." }
        },
        "description": "Returned by every 4xx and 5xx response from /api/v1.",
        "additionalProperties": true
      },
      "WorkspaceItemSummary": {
        "type": "object",
        "required": [
          "kind",
          "id"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "graph_node",
              "document"
            ]
          },
          "id": { "type": "string" },
          "source_type": { "type": "string" },
          "name": { "type": "string" },
          "title": { "type": "string" },
          "type": { "type": "string" },
          "status": { "type": "string" },
          "excerpt": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "DocumentSummary": {
        "type": "object",
        "required": [
          "id",
          "title"
        ],
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "title": { "type": "string" },
          "type": { "type": "string" },
          "status": { "type": "string" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "GraphRecord": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "name": { "type": "string" },
          "data": { "type": "object", "description": "Record fields.", "additionalProperties": true },
          "created_at": { "type": "string", "format": "date-time" }
        },
        "additionalProperties": true
      },
      "SignalSummary": {
        "type": "object",
        "required": [
          "id",
          "name",
          "source_type",
          "created_at"
        ],
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "name": { "type": "string" },
          "source_type": { "type": "string" },
          "content": { "type": "string" },
          "classification": { "type": "object", "description": "AI classification, when one was made.", "additionalProperties": true },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "InboxItem": {
        "type": "object",
        "required": [
          "id",
          "type",
          "title",
          "status"
        ],
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "type": { "type": "string" },
          "title": { "type": "string" },
          "summary": { "type": "string" },
          "confidence_score": {
            "type": [
              "number",
              "null"
            ]
          },
          "status": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "ExperimentMethod": {
        "type": "object",
        "required": [
          "id",
          "label"
        ],
        "properties": {
          "id": { "type": "string" },
          "label": { "type": "string" },
          "stage": { "type": "string" },
          "risk": { "type": "string" },
          "evidence": { "type": "string" },
          "action": { "type": "string" },
          "vouch": { "type": "boolean" },
          "guidance": { "type": "string" }
        }
      },
      "Principle": {
        "type": "object",
        "required": [
          "text"
        ],
        "properties": {
          "text": { "type": "string" }
        }
      },
      "AgentManifest": {
        "type": "object",
        "required": ["name", "homepage", "authentication", "interfaces"],
        "properties": {
          "schema_version": { "type": "string" },
          "name": { "type": "string" },
          "description": { "type": "string" },
          "homepage": { "type": "string", "format": "uri" },
          "authentication": { "type": "object", "additionalProperties": true },
          "interfaces": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
          "when_to_use": { "type": "object", "additionalProperties": true },
          "onboarding": { "type": "object", "additionalProperties": true },
          "rate_limits": { "type": "object", "additionalProperties": true }
        },
        "additionalProperties": true
      },
      "AgentReview": {
        "type": "object",
        "required": [
          "status",
          "findings"
        ],
        "properties": {
          "selectedRules": { "type": "array", "items": { "type": "string" } },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "needs_review",
              "blocked"
            ]
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "severity",
                "ruleId",
                "rule",
                "reason",
                "fix"
              ],
              "properties": {
                "severity": { "type": "string" },
                "ruleId": { "type": "string" },
                "rule": { "type": "string" },
                "reason": { "type": "string" },
                "fix": { "type": "string" }
              }
            }
          }
        },
        "description": "Engineering validation result.",
        "additionalProperties": true
      },
      "SignalPagination": {
        "type": "object",
        "required": [
          "mode",
          "limit",
          "has_more"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "cursor",
              "offset"
            ]
          },
          "total": {
            "type": [
              "integer",
              "null"
            ]
          },
          "limit": { "type": "integer" },
          "offset": {
            "type": [
              "integer",
              "null"
            ]
          },
          "has_more": { "type": "boolean" },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ProductContextResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "workspace_name",
          "product",
          "principles"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "workspace_name": { "type": "string" },
          "product": { "type": "object", "description": "Confirmed product identity.", "additionalProperties": true },
          "principles": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Principle" }
          },
          "custom_instructions": {
            "type": [
              "string",
              "null"
            ]
          },
          "product_epoch": { "type": "integer" }
        }
      },
      "CodingBriefResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "product",
          "principles",
          "matches"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "query": {
            "type": [
              "string",
              "null"
            ]
          },
          "product": { "type": "object", "description": "Confirmed product identity.", "additionalProperties": true },
          "principles": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Principle" }
          },
          "custom_instructions": {
            "type": [
              "string",
              "null"
            ]
          },
          "product_epoch": { "type": "integer" },
          "matches": {
            "type": "array",
            "items": { "type": "object", "description": "Approved spec or evidence matching the query.", "additionalProperties": true }
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "count",
          "results"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "count": { "type": "integer" },
          "results": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/WorkspaceItemSummary" }
          }
        }
      },
      "ItemResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "kind"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "kind": {
            "type": "string",
            "enum": [
              "document",
              "graph_node"
            ]
          },
          "document": { "type": "object", "description": "Present when kind is document: id, title, type, status, content, updated_at.", "additionalProperties": true },
          "node": { "type": "object", "description": "Present when kind is graph_node.", "additionalProperties": true }
        }
      },
      "AgentContextResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "context"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "workspace_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "context": { "type": "object", "description": "Workspace guidance for agents.", "additionalProperties": true }
        }
      },
      "EngineeringStandardsResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "engineering_standards"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "engineering_standards": { "type": "object", "description": "Workspace engineering standards.", "additionalProperties": true }
        }
      },
      "EngineeringRulesResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "count",
          "rules"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "count": { "type": "integer" },
          "rules": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/GraphRecord" }
          }
        }
      },
      "EngineeringRuleResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "rule"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "rule": { "$ref": "#/components/schemas/GraphRecord" }
        }
      },
      "AgentRunsResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "count",
          "runs"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "count": { "type": "integer" },
          "runs": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/GraphRecord" }
          }
        }
      },
      "AgentRunResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "run"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "run": { "$ref": "#/components/schemas/GraphRecord" }
        }
      },
      "AgentReviewResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "review",
          "run_id"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "review": { "$ref": "#/components/schemas/AgentReview" },
          "review_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "run_id": { "type": "string" }
        }
      },
      "DocumentsResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "count",
          "documents"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "count": { "type": "integer" },
          "documents": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/DocumentSummary" }
          }
        }
      },
      "DocumentResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "document"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "document": { "$ref": "#/components/schemas/DocumentSummary" }
        }
      },
      "InboxResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "count",
          "items"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "count": { "type": "integer" },
          "items": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/InboxItem" }
          }
        }
      },
      "CaptureResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "node_id"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "node_id": { "type": "string", "format": "uuid" }
        }
      },
      "InsightResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "insight"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "insight": {
            "type": "object",
            "required": [
              "id",
              "title"
            ],
            "properties": {
              "id": { "type": "string", "format": "uuid" },
              "title": { "type": "string" },
              "sentiment": { "type": "string" }
            }
          }
        }
      },
      "OpportunityResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "opportunity"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "opportunity": {
            "type": "object",
            "required": [
              "id",
              "title"
            ],
            "properties": {
              "id": { "type": "string", "format": "uuid" },
              "title": { "type": "string" },
              "impact": {},
              "effort": {}
            }
          }
        }
      },
      "DecisionResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "decision"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "decision": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": { "type": "string", "format": "uuid" },
              "what": { "type": "string" },
              "outcome": { "type": "string" }
            }
          }
        }
      },
      "ExperimentResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "experiment"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "experiment": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": { "type": "string", "format": "uuid" },
              "hypothesis": { "type": "string" },
              "method": { "type": "string" },
              "action": { "type": "string" },
              "vouch_url": { "type": "string", "format": "uri" }
            }
          },
          "next_step": { "type": "string" }
        }
      },
      "ValidationPageResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "page",
          "public_url"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "page": {
            "type": "object",
            "required": [
              "id",
              "slug",
              "status"
            ],
            "properties": {
              "id": { "type": "string", "format": "uuid" },
              "slug": { "type": "string" },
              "status": { "type": "string" },
              "page_type": { "type": "string" }
            }
          },
          "public_url": { "type": "string", "format": "uri" }
        }
      },
      "ValidationPageRepositoryResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "page_id",
          "delivery"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "page_id": { "type": "string", "format": "uuid" },
          "delivery": { "type": "object", "description": "Repository delivery: branch, commit, and hostedUrl.", "additionalProperties": true },
          "public_url": { "type": "string", "format": "uri" }
        }
      },
      "OkrResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "okr"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "okr": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": { "type": "string", "format": "uuid" },
              "objective": { "type": "string" }
            }
          }
        }
      },
      "TicketsResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "count"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "count": { "type": "integer" },
          "feature_title": { "type": "string" }
        }
      },
      "ResearchSessionResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "session_id",
          "share_url"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "session_id": { "type": "string", "format": "uuid" },
          "share_url": { "type": "string", "format": "uri" }
        }
      },
      "WorkflowRunResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "execution_id",
          "status"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "execution_id": { "type": "string", "format": "uuid" },
          "status": {
            "type": "string",
            "enum": [
              "queued"
            ]
          }
        }
      },
      "ExperimentMethodsResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "methods"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "methods": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/ExperimentMethod" }
          }
        }
      },
      "ValidationPageAnalyticsResponse": {
        "type": "object",
        "required": [
          "ok",
          "summary",
          "config"
        ],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "summary": { "type": "string", "description": "Human-readable result text." },
          "config": { "type": "object", "description": "Page metric configuration, including metric_name.", "additionalProperties": true }
        },
        "description": "Analytics report for the page.",
        "additionalProperties": true
      },
      "SignalsListResponse": {
        "type": "object",
        "required": [
          "signals",
          "pagination"
        ],
        "properties": {
          "signals": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/SignalSummary" }
          },
          "pagination": { "$ref": "#/components/schemas/SignalPagination" }
        }
      },
      "BuiltInWorkflowsResponse": {
        "type": "object",
        "required": [
          "workflows"
        ],
        "properties": {
          "workflows": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "description"
              ],
              "properties": {
                "id": { "type": "string" },
                "name": { "type": "string" },
                "description": { "type": "string" },
                "parameters": { "type": "object", "description": "Parameter schema.", "additionalProperties": true }
              }
            }
          }
        }
      },
      "SignalCreateResponse": {
        "type": "object",
        "required": [
          "success"
        ],
        "properties": {
          "success": { "type": "boolean" },
          "created": { "type": "integer", "description": "Present for batch requests." },
          "signal": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": { "type": "string", "format": "uuid" },
              "name": { "type": "string" },
              "created_at": { "type": "string", "format": "date-time" },
              "classification": { "type": "object", "description": "AI classification.", "additionalProperties": true },
              "classified": { "type": "boolean" }
            }
          },
          "signals": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id"
              ],
              "properties": {
                "id": { "type": "string", "format": "uuid" },
                "name": { "type": "string" },
                "created_at": { "type": "string", "format": "date-time" }
              }
            }
          }
        }
      },
      "WorkflowExecuteResponse": {
        "type": "object",
        "required": [
          "success",
          "workflow_id"
        ],
        "properties": {
          "success": { "type": "boolean" },
          "execution_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "workflow_id": { "type": "string" },
          "data": { "type": "object", "description": "Workflow output.", "additionalProperties": true },
          "execution_time_ms": { "type": "integer" }
        }
      },
      "SignalCreateRequest": {
        "type": "object",
        "required": [],
        "properties": {
          "content": { "type": "string", "minLength": 1, "maxLength": 10000, "description": "Required unless signals is sent." },
          "source": { "type": "string" },
          "source_type": {
            "type": "string",
            "enum": [
              "FEEDBACK",
              "SUPPORT",
              "SLACK",
              "GITHUB",
              "CUSTOM"
            ]
          },
          "metadata": { "type": "object", "description": "Free-form metadata.", "additionalProperties": true },
          "customer_id": { "type": "string" },
          "customer_email": { "type": "string", "format": "email" },
          "tags": {
            "type": "array",
            "items": { "type": "string" }
          },
          "signals": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "description": "Send up to 100 signals at once instead of a single content field.",
            "items": {
              "type": "object",
              "required": [
                "content"
              ],
              "properties": {
                "content": { "type": "string", "minLength": 1, "maxLength": 10000 },
                "source": { "type": "string" },
                "source_type": {
                  "type": "string",
                  "enum": [
                    "FEEDBACK",
                    "SUPPORT",
                    "SLACK",
                    "GITHUB",
                    "CUSTOM"
                  ]
                },
                "metadata": { "type": "object", "description": "Free-form metadata.", "additionalProperties": true },
                "customer_id": { "type": "string" },
                "customer_email": { "type": "string", "format": "email" },
                "tags": {
                  "type": "array",
                  "items": { "type": "string" }
                }
              }
            }
          }
        }
      },
      "WorkflowExecuteRequest": {
        "type": "object",
        "required": [
          "workflow_id",
          "params"
        ],
        "properties": {
          "workflow_id": { "type": "string", "description": "Built-in workflow id from GET /api/v1/workflows." },
          "params": { "type": "object", "description": "Parameters for that workflow.", "additionalProperties": true }
        }
      },
      "McpJsonRpcResponse": {
        "type": "object",
        "required": [
          "jsonrpc"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "enum": [
              "2.0"
            ]
          },
          "id": {
            "type": [
              "string",
              "integer",
              "null"
            ]
          },
          "result": { "type": "object", "description": "Method result.", "additionalProperties": true },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": { "type": "integer" },
              "message": { "type": "string" },
              "data": {}
            }
          }
        }
      },
      "McpDiscoveryResponse": {
        "type": "object",
        "required": [
          "server",
          "protocolVersion",
          "transport"
        ],
        "properties": {
          "server": {
            "type": "object",
            "required": [
              "name",
              "version"
            ],
            "properties": {
              "name": { "type": "string" },
              "version": { "type": "string" }
            }
          },
          "protocolVersion": { "type": "string" },
          "transport": {
            "type": "string",
            "enum": [
              "streamable-http"
            ]
          },
          "documentation": { "type": "string", "format": "uri" },
          "usage": { "type": "string" }
        }
      }
    },
    "headers": {
      "RateLimit-Limit": {
        "description": "Requests allowed per window.",
        "schema": { "type": "integer" }
      },
      "RateLimit-Remaining": {
        "description": "Requests left in this window.",
        "schema": { "type": "integer" }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the window resets.",
        "schema": { "type": "integer" }
      },
      "RateLimit-Policy": {
        "description": "Quota and window, for example 120;w=60.",
        "schema": { "type": "string" }
      },
      "X-RateLimit-Limit": {
        "description": "Same as RateLimit-Limit.",
        "schema": { "type": "integer" }
      },
      "X-RateLimit-Remaining": {
        "description": "Same as RateLimit-Remaining.",
        "schema": { "type": "integer" }
      },
      "X-RateLimit-Reset": {
        "description": "Unix epoch seconds when the window resets.",
        "schema": { "type": "integer" }
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying.",
        "schema": { "type": "integer" }
      }
    }
  },
  "externalDocs": { "description": "Specky API reference", "url": "https://www.specky.space/docs/api" }
}
