{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://0xray.ai/schemas/features.schema.json",
  "title": "0xRay Features Configuration",
  "type": "object",
  "properties": {
    "version": { "type": "string" },
    "description": { "type": "string" },
    "memory_routing": {
      "type": "object",
      "properties": {
        "enabled": { "type": "boolean" },
        "provider": {
          "type": "string",
          "enum": ["null", "repertoire", "custom"]
        },
        "module_path": { "type": "string" },
        "config": { "type": "object" }
      },
      "required": ["enabled", "provider"],
      "if": {
        "properties": {
          "enabled": { "const": true },
          "provider": { "enum": ["repertoire", "custom"] }
        }
      },
      "then": {
        "required": ["module_path"]
      }
    },
    "multi_agent_orchestration": {
      "type": "object",
      "properties": {
        "enabled": { "type": "boolean" },
        "lead_dev_mode": { "type": "boolean" },
        "plan_stale_hours": {
          "type": "number",
          "minimum": 1,
          "description": "Archive lead-dev-plan when all todos still pending after N hours"
        },
        "plan_archive_marker_hours": {
          "type": "number",
          "minimum": 1,
          "description": "How long spawn-plan-stale persists after a stale plan was archived (hours)"
        },
        "confer_on_synthesis": {
          "type": "boolean",
          "description": "Opt in to the 3-agent confer quorum. A missing key stays off."
        },
        "confer": {
          "type": "object",
          "properties": {
            "enabled": { "type": "boolean" },
            "on_synthesis": { "type": "boolean" }
          },
          "description": "Mandatory researcher/architect-tools/code-review quorum"
        },
        "sibling_repos": {
          "type": "array",
          "items": {
            "oneOf": [
              { "type": "string" },
              {
                "type": "object",
                "properties": {
                  "path": { "type": "string" },
                  "label": { "type": "string" }
                },
                "required": ["path"]
              }
            ]
          },
          "description": "Sibling workspace roots (e.g. UI repo when MCP host is cwd)"
        },
        "user_asides": {
          "type": "object",
          "properties": {
            "enabled": { "type": "boolean" },
            "auto_provision_worktree": {
              "type": "boolean",
              "description": "Run guarded git worktree add on analyze-complexity aside intake when worktree+branch set"
            }
          }
        }
      }
    },
    "grok_postprocessor_light": {
      "type": "boolean",
      "description": "Opt-in lightweight postprocessor marker + activity.log on Grok write tools"
    },
    "inference_session_capture": {
      "type": "object",
      "description": "git post-commit → captureSessionInference when commit threshold is met",
      "properties": {
        "enabled": { "type": "boolean" },
        "min_commits": { "type": "integer", "minimum": 1 },
        "lookback_commits": { "type": "integer", "minimum": 1 }
      }
    },
    "inference": {
      "type": "object",
      "description": "Self-improvement cycle. A missing key is on. Explicit enabled false turns inference:run off unless --force.",
      "properties": {
        "description": { "type": "string" },
        "enabled": { "type": "boolean" },
        "workflow_dir": { "type": "string" },
        "reports_dir": { "type": "string" },
        "pattern_matching": {
          "type": "object",
          "properties": {
            "enabled": { "type": "boolean" },
            "confidence_threshold": { "type": "number" }
          }
        }
      }
    },
    "suit_temperament": {
      "type": "object",
      "description": "0xRay 4.0 — constitution always on; ceremony scales by host. Missing key = guided (existing consumers unchanged).",
      "properties": {
        "profile": {
          "type": "string",
          "enum": ["auto", "frontier", "guided", "strict"],
          "description": "auto = host_defaults (grok/cursor→frontier, hermes/opencode/openclaw→guided)"
        },
        "host_defaults": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "enum": ["frontier", "guided", "strict"]
          }
        }
      }
    },
    "goggles": {
      "type": "object",
      "description": "The suit keeps goggles on. enabled false fails wear and doctor.",
      "properties": {
        "enabled": { "type": "boolean" }
      },
      "required": ["enabled"]
    },
    "synthesis": {
      "type": "object",
      "properties": {
        "enabled": { "type": "boolean" },
        "every_n_gates": { "type": "integer", "minimum": 0 },
        "every_n_turns": { "type": "integer", "minimum": 0 },
        "every_n_todos_completed": { "type": "integer", "minimum": 0 },
        "reflection": {
          "type": "object",
          "properties": {
            "mode": { "type": "string", "enum": ["full", "minimal", "off"] },
            "triggers": { "type": "object" },
            "thresholds": { "type": "object" }
          }
        }
      }
    }
  },
  "additionalProperties": true
}