{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openquarry.dev/schema/v1/strand.schema.json",
  "title": "StrandFrontmatter",
  "description": "Deprecated alias for thread.schema. Use thread.schema.json or thread.schema.yaml for new files.",
  "deprecated": true,
  "type": "object",
  "required": [
    "id",
    "slug",
    "title",
    "version",
    "contentType"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "slug": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$"
    },
    "title": {
      "type": "string"
    },
    "summary": {
      "type": "string",
      "description": "Deprecated alias retained for backward compatibility. Use extractiveSummary instead."
    },
    "extractiveSummary": {
      "type": "string",
      "description": "Deterministic summary generated by the static NLP pipeline (TF-IDF, n-grams)."
    },
    "aiSummary": {
      "type": "string",
      "description": "Optional abstractive summary produced by LLM providers."
    },
    "notes": {
      "description": "Curated notes: a list of short notes, or one note as text. The key keeps its name.",
      "oneOf": [
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        {
          "type": "string"
        }
      ]
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "contentType": {
      "type": "string",
      "description": "lesson to resource name a note's teaching role; markdown, code, data and media name its kind, as the corpus validator reads them.",
      "enum": [
        "lesson",
        "reference",
        "exercise",
        "assessment",
        "project",
        "discussion",
        "resource",
        "markdown",
        "code",
        "data",
        "media"
      ]
    },
    "difficulty": {
      "description": "One level, or the scores of the difficulty model.",
      "oneOf": [
        {
          "enum": [
            "beginner",
            "intermediate",
            "advanced",
            "expert"
          ]
        },
        {
          "type": "object",
          "properties": {
            "overall": {
              "enum": [
                "beginner",
                "intermediate",
                "advanced",
                "expert"
              ]
            },
            "cognitive": {
              "type": "number",
              "minimum": 1,
              "maximum": 10
            },
            "prerequisites": {
              "type": "number",
              "minimum": 0,
              "maximum": 10
            },
            "conceptual": {
              "type": "number",
              "minimum": 1,
              "maximum": 10
            }
          }
        }
      ]
    },
    "taxonomy": {
      "type": "object",
      "properties": {
        "subjects": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "topics": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "subject": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "topic": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "subtopic": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "concepts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "term": {
                "type": "string"
              },
              "weight": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            }
          }
        }
      }
    },
    "relationships": {
      "description": "Links to other notes: slugs grouped by kind, or a list of typed links. The key keeps its name.",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "prerequisites": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "requires": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "references": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "seeAlso": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "targetSlug": {
                "type": "string"
              },
              "target": {
                "type": "string"
              },
              "type": {
                "description": "The link types the app writes (its LinkType); the corpus uses follows, extends and references.",
                "enum": [
                  "extends",
                  "contrasts",
                  "supports",
                  "example-of",
                  "implements",
                  "questions",
                  "refines",
                  "applies",
                  "summarizes",
                  "prerequisite",
                  "related",
                  "follows",
                  "references",
                  "contradicts",
                  "updates",
                  "parallels",
                  "synthesizes",
                  "custom"
                ]
              },
              "strength": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "bidirectional": {
                "type": "boolean",
                "default": false
              }
            }
          }
        }
      ]
    },
    "teaches": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Ids of the skills this note teaches, for example qs/library/skill/slope; kept apart from the skills field."
    },
    "requires": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Ids of the skills this note assumes a reader already has."
    },
    "publishing": {
      "type": "object",
      "properties": {
        "status": {
          "enum": [
            "draft",
            "review",
            "published",
            "archived"
          ]
        },
        "license": {
          "type": "string",
          "default": "MIT"
        },
        "lastUpdated": {
          "type": "string"
        }
      }
    },
    "blocks": {
      "type": "array",
      "description": "Block-level tags and metadata for granular content organization. Auto-generated by NLP pipeline.",
      "items": {
        "type": "object",
        "required": [
          "id",
          "line",
          "type"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Heading slug (e.g., 'introduction') or generated block ID (e.g., 'block-42')"
          },
          "line": {
            "type": "integer",
            "minimum": 1,
            "description": "Starting line number in the markdown file"
          },
          "endLine": {
            "type": "integer",
            "minimum": 1,
            "description": "Ending line number (inclusive)"
          },
          "type": {
            "type": "string",
            "enum": [
              "heading",
              "paragraph",
              "code",
              "list",
              "blockquote",
              "table",
              "html"
            ],
            "description": "Markdown block type"
          },
          "headingLevel": {
            "type": "integer",
            "minimum": 1,
            "maximum": 6,
            "description": "Heading level (1-6) if type is 'heading'"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Accepted/confirmed tags for this block"
          },
          "suggestedTags": {
            "type": "array",
            "description": "Pending tag suggestions awaiting review",
            "items": {
              "type": "object",
              "required": [
                "tag",
                "confidence",
                "source"
              ],
              "properties": {
                "tag": {
                  "type": "string"
                },
                "confidence": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1,
                  "description": "Confidence score (0-1)"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "inline",
                    "nlp",
                    "llm",
                    "existing",
                    "user"
                  ],
                  "description": "How the tag was suggested: inline (explicit #hashtag), nlp (vocabulary/TF-IDF), llm (AI), existing (propagated), user (manual)"
                },
                "reasoning": {
                  "type": "string",
                  "description": "Optional explanation for AI-suggested tags"
                }
              }
            }
          },
          "worthiness": {
            "type": "object",
            "description": "Worthiness scoring for intelligent tagging prioritization",
            "properties": {
              "score": {
                "type": "number",
                "minimum": 0,
                "maximum": 1,
                "description": "Overall worthiness score (>=0.5 = worthy of tagging)"
              },
              "signals": {
                "type": "object",
                "description": "Individual signal scores contributing to worthiness",
                "properties": {
                  "topicShift": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "How much this block shifts topic from previous"
                  },
                  "entityDensity": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "Named entity density in this block"
                  },
                  "semanticNovelty": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "Semantic distance from document centroid"
                  },
                  "structuralImportance": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "Importance based on heading level, position"
                  }
                }
              }
            }
          },
          "extractiveSummary": {
            "type": "string",
            "description": "Auto-generated extractive summary of the block"
          },
          "warrantsIllustration": {
            "type": "boolean",
            "default": false,
            "description": "Whether this block would benefit from visual aids"
          }
        }
      }
    }
  }
}
