{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Facet frontmatter",
  "type": "object",
  "properties": {
    "name": {
      "description": "Display name of the facet.",
      "type": "string"
    },
    "polytoken": {
      "anyOf": [
        {
          "const": true
        },
        {
          "$ref": "#/$defs/FacetPolytokenFrontMatter"
        }
      ]
    }
  },
  "required": [
    "name"
  ],
  "$defs": {
    "FacetPolytokenFrontMatter": {
      "description": "Polytoken-specific facet controls.",
      "type": "object",
      "properties": {
        "model": {
          "description": "Model this facet uses, overriding the session default.",
          "type": [
            "string",
            "null"
          ]
        },
        "autonomous_hint": {
          "description": "Hint text Polytoken shows when suggesting this facet for autonomous use.",
          "type": [
            "string",
            "null"
          ]
        },
        "auto_facet_hint": {
          "description": "Backwards-compatible alias of `autonomous_hint`.",
          "type": [
            "string",
            "null"
          ]
        },
        "compaction_hint": {
          "description": "Guidance Polytoken uses when summarizing the conversation during\ncompaction. When set, this text helps the summarization preserve the\ncontext most relevant to this facet's purpose, so the compacted\nsummary retains what matters for the facet's work.",
          "type": [
            "string",
            "null"
          ]
        },
        "color": {
          "description": "Accent color for the facet, used in the sidebar and indicators.",
          "type": [
            "string",
            "null"
          ]
        },
        "color_light": {
          "description": "Accent color for the facet on light backgrounds.",
          "type": [
            "string",
            "null"
          ]
        },
        "color_dark": {
          "description": "Accent color for the facet on dark backgrounds.",
          "type": [
            "string",
            "null"
          ]
        },
        "fallback_models": {
          "description": "Models Polytoken tries, in order, if the primary model is unavailable.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "tools": {
          "description": "Tools this facet exposes, as tool names or `tag!` groups (for example\n`tag!ALL`).",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "tools_deny": {
          "description": "Tools to exclude after `tools` expands. Applied last.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "undeferred_tools": {
          "description": "Tools to always send in full, even under native-deferred tool loading.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "facet_transitions": {
          "description": "Rules for switching to other facets from this one, keyed by target facet\nname.",
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "$ref": "#/$defs/FacetTransitionFrontMatter"
          }
        },
        "skills_allow": {
          "description": "Skills this facet can invoke, as skill names or `tag!` groups.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "skills_deny": {
          "description": "Skills to exclude from `skills_allow`.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        }
      }
    },
    "FacetTransitionFrontMatter": {
      "type": "object",
      "properties": {
        "allowed": {
          "description": "Whether switching to the target facet is permitted.",
          "type": "boolean"
        },
        "condition": {
          "description": "Condition that must hold for the switch. Omit for an unconditional\nswitch.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "allowed"
      ]
    }
  }
}
