{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "forge-cli config",
    "type": "object",
    "additionalProperties": false,
    "definitions": {
        "personaModel": {
            "type": "object",
            "required": ["provider", "model"],
            "additionalProperties": false,
            "properties": {
                "provider": { "type": "string", "description": "pi provider id (anthropic, openai, google, ollama, openrouter, …)" },
                "model": { "type": "string", "description": "exact pi model id within that provider" },
                "description": { "type": "string" }
            }
        },
        "personaModelsMap": {
            "type": "object",
            "description": "persona name → {provider, model}. Names must match the Forge persona catalogue read from forge-cli's bundled vendored plugin (forge-cli/forge/personas/*.md). A reserved 'default' key applies to any persona without an entry.",
            "additionalProperties": { "$ref": "#/definitions/personaModel" }
        }
    },
    "properties": {
        "persona-models": { "$ref": "#/definitions/personaModelsMap" },
        "forgeCli": {
            "type": "object",
            "description": "Feature flags and rollout gates for forge-cli runtime behaviour.",
            "additionalProperties": false,
            "properties": {
                "skillCuration": {
                    "type": "object",
                    "description": "FORGE-S24 SKILL-CURATION pipeline (T08 retriever, T09 usage tracker, T10 curator subagent, T11 friction emitter). Default OFF — gated rollout per FORGE-S24-T12.",
                    "additionalProperties": false,
                    "properties": {
                        "enabled": {
                            "type": "boolean",
                            "default": false,
                            "description": "When false (default), every SKILL-CURATION module no-ops at entry and emits zero events / writes zero queue files. Promote to true on a per-project basis once the signal quality is observed in real-world runs."
                        }
                    }
                }
            }
        },
        "pipelines": {
            "type": "object",
            "description": "Per-pipeline overrides. Pipeline names match the Forge plugin's pipeline catalogue.",
            "additionalProperties": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "persona-models": { "$ref": "#/definitions/personaModelsMap" },
                    "phases": {
                        "type": "object",
                        "description": "Per-phase overrides keyed by role (e.g. 'implement', 'commit'). Roles must match the plugin's pipeline definition.",
                        "additionalProperties": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                                "model-override": {
                                    "description": "L4 — atomic per-phase override. Either a persona-models key by name (string) or an inline {provider, model}.",
                                    "oneOf": [
                                        { "type": "string" },
                                        { "$ref": "#/definitions/personaModel" }
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
