{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Pattern",
  "description": "Schema for Claude Memory pattern objects",
  "type": "object",
  "required": ["description"],
  "oneOf": [
    { "required": ["pattern"] },
    { "required": ["name"] }
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the pattern"
    },
    "pattern": {
      "type": "string",
      "description": "Pattern name or title",
      "minLength": 1,
      "maxLength": 200
    },
    "name": {
      "type": "string",
      "description": "Alternative to pattern field",
      "minLength": 1,
      "maxLength": 200
    },
    "description": {
      "type": "string",
      "description": "Detailed description of the pattern",
      "minLength": 1,
      "maxLength": 2000
    },
    "priority": {
      "type": "string",
      "enum": ["low", "medium", "high", "critical"],
      "default": "medium",
      "description": "Pattern priority level"
    },
    "effectiveness": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 0.5,
      "description": "Effectiveness score between 0 and 1"
    },
    "status": {
      "type": "string",
      "enum": ["active", "resolved", "open"],
      "default": "active",
      "description": "Current status of the pattern"
    },
    "solution": {
      "type": ["string", "null"],
      "description": "Solution if pattern is resolved",
      "maxLength": 2000
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Creation timestamp in ISO format"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "Alternative timestamp field"
    }
  },
  "additionalProperties": false
}