{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/raku-so/json-schema/raku-so-recall-request-schema.json",
  "title": "RecallRequest",
  "description": "POST body for /api/v1/memories/recall — graph-enhanced retrieval.\n\nFuses three retrieval signals (vector + FTS5 + knowledge-graph traversal)\nwith normalized Reciprocal Rank Fusion, then ranks by the shared scoring\nblend (R2.60 — same formula as /search). ``max_hops`` bounds the\nrelationship expansion from the entities of the lexical/semantic hits.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/raku-so-openapi.json#/components/schemas/RecallRequest",
  "properties": {
    "query": {
      "type": "string",
      "maxLength": 2000,
      "minLength": 1,
      "title": "Query",
      "description": "Recall query text"
    },
    "limit": {
      "type": "integer",
      "maximum": 50.0,
      "minimum": 1.0,
      "title": "Limit",
      "description": "Max results",
      "default": 10
    },
    "max_hops": {
      "type": "integer",
      "maximum": 3.0,
      "minimum": 1.0,
      "title": "Max Hops",
      "description": "Graph relationship-hop depth",
      "default": 1
    },
    "filters": {
      "anyOf": [
        {
          "$ref": "#/$defs/RecallFilters"
        },
        {
          "type": "null"
        }
      ]
    },
    "weights": {
      "anyOf": [
        {
          "$ref": "#/$defs/SearchWeights"
        },
        {
          "type": "null"
        }
      ]
    },
    "rerank": {
      "type": "boolean",
      "title": "Rerank",
      "description": "Cross-encoder rerank of the top 2x-limit candidates (falls back to RRF order when the reranker is unavailable — see response.reranked)",
      "default": true
    }
  },
  "type": "object",
  "required": [
    "query"
  ],
  "$defs": {
    "MemoryType": {
      "type": "string",
      "enum": [
        "fact",
        "event",
        "preference",
        "procedure",
        "insight"
      ],
      "title": "MemoryType",
      "description": "Types of memory that can be stored.\n\nv2.0 taxonomy (migration 005):\n    observation → event, reflection → insight, instruction → procedure.\n    fact and preference unchanged."
    },
    "RecallFilters": {
      "properties": {
        "memory_types": {
          "items": {
            "$ref": "#/$defs/MemoryType"
          },
          "type": "array",
          "title": "Memory Types",
          "description": "Restrict results to these memory types (empty = all)"
        }
      },
      "type": "object",
      "title": "RecallFilters",
      "description": "Filters for the graph-enhanced recall pipeline."
    },
    "SearchWeights": {
      "properties": {
        "alpha": {
          "type": "number",
          "minimum": 0.0,
          "title": "Alpha",
          "description": "Recency weight",
          "default": 1.0
        },
        "beta": {
          "type": "number",
          "minimum": 0.0,
          "title": "Beta",
          "description": "Importance weight",
          "default": 1.0
        },
        "gamma": {
          "type": "number",
          "minimum": 0.0,
          "title": "Gamma",
          "description": "Relevance (vector similarity) weight",
          "default": 1.0
        },
        "delta": {
          "type": "number",
          "minimum": 0.0,
          "title": "Delta",
          "description": "Confidence weight (v3.3, defaults to 1.0)",
          "default": 1.0
        },
        "half_life_hours": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "title": "Half Life Hours",
          "description": "Recency half-life in hours (default 168 = 7 days)",
          "default": 168.0
        }
      },
      "type": "object",
      "title": "SearchWeights",
      "description": "Configurable scoring weights for the memory scoring formula.\n\nscore = alpha * recency + beta * importance + gamma * relevance + delta * confidence\n\nRecency uses exponential decay with a configurable half-life:\n    recency = 2 ^ (-hours_since_last_accessed / half_life_hours)\n\nDefault half-life of 168 hours (7 days) is more conservative than the\nStanford Generative Agents paper (~5.8 days via 0.995^h). Tune per\ndeployment — shorter half-lives for conversational context, longer\nfor reference facts.\n\nv3.3 adds delta (confidence) and half_life_hours. Graph scoring\nadded in May."
    }
  }
}