{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/raku-so/json-schema/raku-so-memory-update-schema.json",
  "title": "MemoryUpdate",
  "description": "Partial update for a memory.\n\nOnly provided fields are updated. If content changes, embedding is\nregenerated server-side. If content is not provided, embedding is\nNOT regenerated.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/raku-so-openapi.json#/components/schemas/MemoryUpdate",
  "properties": {
    "content": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 50000,
          "minLength": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Content"
    },
    "source": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 500
        },
        {
          "type": "null"
        }
      ],
      "title": "Source"
    },
    "memory_type": {
      "anyOf": [
        {
          "$ref": "#/$defs/MemoryType"
        },
        {
          "type": "null"
        }
      ]
    },
    "importance": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Importance"
    },
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Metadata"
    },
    "tags": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 20
        },
        {
          "type": "null"
        }
      ],
      "title": "Tags"
    },
    "confidence_score": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Confidence Score"
    },
    "source_type": {
      "anyOf": [
        {
          "$ref": "#/$defs/SourceType"
        },
        {
          "type": "null"
        }
      ]
    },
    "evidence_count": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Evidence Count"
    },
    "contradiction_count": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Contradiction Count"
    },
    "confidence_decay_rate": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Confidence Decay Rate"
    },
    "last_validated_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Validated At"
    },
    "valid_from": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Valid From"
    },
    "valid_to": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Valid To",
      "description": "ISO-8601: when this fact stopped being true"
    },
    "superseded_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Superseded By",
      "description": "ID of the memory that replaces this one"
    }
  },
  "type": "object",
  "$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."
    },
    "SourceType": {
      "type": "string",
      "enum": [
        "direct_data",
        "user_stated",
        "system_observed",
        "inference",
        "hearsay",
        "speculation",
        "corrected",
        "external_api",
        "derived"
      ],
      "title": "SourceType",
      "description": "Confidence source classification (v3.3).\n\nClassifies how a memory was obtained, informing confidence scoring.\nOrdering roughly tracks epistemic strength: direct_data and user_stated\nare high-trust; speculation and hearsay are low-trust."
    }
  }
}