{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "anu_v3_1_micro_refinement_target.schema.json",
  "title": "ANU v3.1 Micro Refinement Target",
  "description": "Input target for ANU-Codex micro refinement convergence loop. Source: ANU v3 master spec section 5.5. Used by utils/anu_codex_micro_refinement_loop.py.",
  "type": "object",
  "required": [
    "schema",
    "task_id",
    "target_kind",
    "allowed_write_paths",
    "forbidden_write_targets",
    "goal_condition",
    "round_limit_policy",
    "safety_gates"
  ],
  "properties": {
    "schema": {
      "type": "string",
      "const": "anu_v3.micro_refinement_target.v1"
    },
    "task_id": {
      "type": "string",
      "pattern": "^task-[0-9A-Za-z_+.-]+$"
    },
    "target_kind": {
      "type": "string",
      "enum": [
        "task_md",
        "predispatch_contract",
        "batch_plan",
        "regression_plan",
        "expected_files",
        "evidence_contract"
      ]
    },
    "allowed_write_paths": {
      "type": "array",
      "items": {"type": "string"}
    },
    "forbidden_write_targets": {
      "type": "array",
      "items": {"type": "string"}
    },
    "codex_findings_path": {
      "type": ["string", "null"]
    },
    "goal_condition": {
      "type": "string",
      "enum": ["CODEX_PASS_OR_PASS_WITH_RECOMMENDATIONS"]
    },
    "max_rounds": {
      "type": ["integer", "null"],
      "description": "Always null for micro refinement (hard cap 0 per ANCHOR-3)."
    },
    "round_limit_policy": {
      "type": "string",
      "enum": ["NO_HARD_CAP_FOR_MICRO_REFINEMENT"]
    },
    "safety_gates": {
      "type": "object",
      "description": "8-gate enforcement table. Key names are the verbatim 8 listed in task-2662 md '필수 구현 5'.",
      "required": [
        "critical_7",
        "security_high_or_critical",
        "permission_expansion",
        "github_write_required",
        "dev_bot_reactivation_required",
        "real_write_required",
        "forbidden_write_target",
        "scope_expansion"
      ],
      "additionalProperties": false,
      "properties": {
        "critical_7": {"type": "string", "enum": ["hold"]},
        "security_high_or_critical": {"type": "string", "enum": ["hold"]},
        "permission_expansion": {"type": "string", "enum": ["hold"]},
        "github_write_required": {"type": "string", "enum": ["hold"]},
        "dev_bot_reactivation_required": {"type": "string", "enum": ["hold"]},
        "real_write_required": {"type": "string", "enum": ["hold"]},
        "forbidden_write_target": {"type": "string", "enum": ["hold"]},
        "scope_expansion": {"type": "string", "enum": ["hold"]}
      }
    }
  },
  "additionalProperties": false
}
