{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/smry-ai/json-schema/smry-ai-feed-where-schema.json",
  "title": "FeedWhere",
  "description": "Entry selection predicate: fields AND together; omit a field to not filter on it. Source queries/mutations accept only collection and source; use query having for source-health filters.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/smry-ai-staging-openapi.json#/components/schemas/FeedWhere",
  "additionalProperties": false,
  "type": "object",
  "properties": {
    "discovered_after": {
      "minLength": 1,
      "maxLength": 64,
      "description": "When smry first saw the entry. Backfill makes old posts look new here, so use it for diffs, not for \"what's new\". Relative window (\"7d\", \"36h\", \"45m\", \"2w\"), \"now\", or ISO date.",
      "type": "string"
    },
    "discovered_before": {
      "minLength": 1,
      "maxLength": 64,
      "description": "Relative window (\"7d\", \"36h\", \"45m\", \"2w\"), \"now\", or ISO date.",
      "type": "string"
    },
    "published_after": {
      "minLength": 1,
      "maxLength": 64,
      "description": "When the source published the entry (entries with no publish date are excluded; use top-level since to include them). Relative window (\"7d\", \"36h\", \"45m\", \"2w\"), \"now\", or ISO date.",
      "type": "string"
    },
    "published_before": {
      "minLength": 1,
      "maxLength": 64,
      "description": "Relative window (\"7d\", \"36h\", \"45m\", \"2w\"), \"now\", or ISO date.",
      "type": "string"
    },
    "collection": {
      "minItems": 1,
      "maxItems": 20,
      "type": "array",
      "items": {
        "description": "A source-folder ID or its exact name (the legacy collection selector).",
        "anyOf": [
          {
            "minimum": 1,
            "type": "integer"
          },
          {
            "minLength": 1,
            "maxLength": 100,
            "type": "string"
          }
        ]
      }
    },
    "source": {
      "additionalProperties": false,
      "minProperties": 1,
      "type": "object",
      "properties": {
        "include": {
          "minItems": 1,
          "maxItems": 100,
          "type": "array",
          "items": {
            "description": "A source id (from any v2 response) or its title. Reads also accept a fragment that matches exactly one title.",
            "anyOf": [
              {
                "minimum": 1,
                "type": "integer"
              },
              {
                "minLength": 1,
                "maxLength": 500,
                "type": "string"
              }
            ]
          }
        },
        "exclude": {
          "minItems": 1,
          "maxItems": 100,
          "type": "array",
          "items": {
            "description": "A source id (from any v2 response) or its title. Reads also accept a fragment that matches exactly one title.",
            "anyOf": [
              {
                "minimum": 1,
                "type": "integer"
              },
              {
                "minLength": 1,
                "maxLength": 500,
                "type": "string"
              }
            ]
          }
        }
      }
    },
    "unread": {
      "description": "true = only unread entries, false = only read entries.",
      "type": "boolean"
    },
    "classification": {
      "additionalProperties": false,
      "description": "Choose semantic membership (match, nonmatch, unresolved) or the legacy delivery decision with optional assessment. Unresolved includes pending, insufficient evidence and degraded results. Requires exactly one source folder.",
      "type": "object",
      "properties": {
        "decision": {
          "anyOf": [
            {
              "const": "include",
              "type": "string"
            },
            {
              "const": "exclude",
              "type": "string"
            }
          ]
        },
        "membership": {
          "anyOf": [
            {
              "const": "match",
              "type": "string"
            },
            {
              "const": "nonmatch",
              "type": "string"
            },
            {
              "const": "unresolved",
              "type": "string"
            }
          ]
        },
        "assessment": {
          "anyOf": [
            {
              "const": "relevant",
              "type": "string"
            },
            {
              "const": "irrelevant",
              "type": "string"
            },
            {
              "const": "uncertain",
              "type": "string"
            }
          ]
        }
      }
    },
    "prompt": {
      "minLength": 1,
      "maxLength": 700,
      "description": "A natural-language rule evaluated against each story's title, summary and publisher. Only confirmed matches are returned. Results are cached per owner and rule; prompt_coverage reports pending, unclear and unavailable results. Supported by entry/aggregate queries, not checkpoint changes or consumers. Combine with other fields using AND. Save this predicate as a Collection for background matching of incoming stories.",
      "type": "string"
    },
    "match": {
      "minLength": 1,
      "maxLength": 500,
      "description": "Case-insensitive text match over title and summary. \"a OR b\" matches either.",
      "type": "string"
    }
  }
}