{
  "openapi": "3.1.0",
  "info": {
    "title": "Loop Scope Agent Specification Auditor",
    "version": "0.1.0",
    "summary": "Heuristic audit of a software brief before a coding agent spends tokens.",
    "description": "Spike, not a paid offer. POST a brief (optional plan, acceptance criteria, constraints). Receive structured gaps, risks, ambiguities, suggested tests, questions, and a confidence score. Deterministic heuristics only; no model vendor. Payment is not open. Stripe Payment Links, Bitcoin Lightning invoices, and HTTP 402 for machine clients are documented next steps — none are live. MCP publish is out of scope for this spike. Loop XXI does not take custody of customer funds."
  },
  "servers": [
    { "url": "https://loopxxi.com" }
  ],
  "paths": {
    "/api/loop-scope": {
      "get": {
        "operationId": "discoverLoopScopeAuditor",
        "summary": "Service discovery",
        "responses": {
          "200": {
            "description": "Discovery document including payment status not_open.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Discovery" }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "auditSpecification",
        "summary": "Audit a specification",
        "description": "Preview processing is disabled by default pending access and abuse-boundary review. Check discovery access.status before submitting. A disabled preview returns 503 without analyzing the specification.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/AuditRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Structured audit.",
            "content": {
              "application/json": {
                "schema": { "$ref": "https://loopxxi.com/downloads/loop-scope-auditor.schema.json" }
              }
            }
          },
          "400": { "description": "Invalid JSON or body." },
          "405": { "description": "Method not allowed." },
          "413": { "description": "Field too large." },
          "422": { "description": "Missing or invalid brief/fields." },
          "429": { "description": "Rate limited. Retry-After: 60." },
          "503": { "description": "Auditor preview unavailable; do not retry until discovery reports preview access." }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AuditRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["brief"],
        "properties": {
          "brief": { "type": "string", "minLength": 12, "maxLength": 20000 },
          "plan": { "type": "string", "maxLength": 20000 },
          "acceptance_criteria": {
            "oneOf": [
              { "type": "string", "maxLength": 20000 },
              { "type": "array", "maxItems": 50, "items": { "type": "string", "maxLength": 4000 } }
            ]
          },
          "constraints": {
            "oneOf": [
              { "type": "string", "maxLength": 20000 },
              { "type": "array", "maxItems": 50, "items": { "type": "string", "maxLength": 4000 } }
            ]
          },
          "agent_id": { "type": "string", "maxLength": 120 }
        }
      },
      "Discovery": {
        "type": "object",
        "required": ["ok", "service", "payment"],
        "properties": {
          "ok": { "type": "boolean" },
          "service": { "type": "string" },
          "version": { "type": "string" },
          "status": { "const": "spike" },
          "method": { "const": "heuristic" },
          "model": { "type": ["string", "null"] },
          "payment": {
            "type": "object",
            "properties": {
              "status": { "const": "not_open" },
              "next_steps": { "type": "array", "items": { "type": "string" } }
            }
          },
          "mcp": { "type": "object" },
          "docs": { "type": "object" }
        }
      }
    }
  },
  "x-loopxxi": {
    "payment_status": "not_open",
    "mcp_status": "not_published",
    "human_landing": "/tools/loop-scope",
    "indexable": false
  }
}
