schema_version: v8_9_p1_adoption_plan.v1
meta:
  title: v8_9_p1_adoption_plan
  source_proposal: suggest/quant_investment_engine_v8_9_portfolio_optimizer_canonical_refactored.yaml
  predecessor: governance/todo/v8_9_p0_adoption_plan.yaml
  decision_basis: >
    P0(portfolio_transition_optimizer, sell lot Pareto, CE70/CE90/CVaR95 simulation) 완료 후
    사용자가 "로드맵에 따라 제안한 모든 작업을 순차적으로 진행"하도록 지시(2026-06-17).
    탐색 결과(에이전트 보고) 3개 항목 모두 spec 레벨 구현이 없음을 확인 — 신규 구현.
  scope:
    - sector_graph_engine_v8_9 (canonical sector ID, ETF lookthrough, factor residualization, leader lifecycle)
    - execution_plan_compiler_v8_9.broker_microstructure_packet (order_capacity formula)
    - model_governance_v8_9 (kill switches, promotion_ladder 자동화)

tasks:
  - id: P1-A.1
    title: SECTOR_EXPOSURE_GRAPH_V1 공식 정의
    output_file: spec/formulas/domains/sector.yaml (신규)
    detail: >
      canonical_sector_id 포맷(L1:L2:L3:L4), ETF lookthrough_weight_pct 산식,
      factor_beta_residualization(AI/반도체/전력 중복 베타 제거) 정의.
    depends_on: []

  - id: P1-A.2
    title: LEADER_LIFECYCLE_GATE_V1 공식 정의
    output_file: spec/formulas/domains/sector.yaml
    detail: CAPTAIN/CORE_LEADER/ENABLER/CYCLICAL_BETA/LAGGARD/DISTRIBUTION_RISK promotion/demotion 결정론적 상태머신.
    depends_on: [P1-A.1]

  - id: P1-A.3
    title: build_sector_exposure_graph_v1.py
    output_file: tools/build_sector_exposure_graph_v1.py
    depends_on: [P1-A.2]

  - id: P1-A.4
    title: schema + generated model (sector)
    output_file:
      - schemas/generated/sector_exposure_graph_v1.schema.json
      - src/quant_engine/models/generated/sector_exposure_graph_v1_schema.py
    depends_on: [P1-A.3]

  - id: P1-A.5
    title: sector golden case
    detail: V89_044(sector_overlap), V89_045(ETF_direct_overlap), V89_046(leader_distribution)
    output_file: tests/golden/generated/sector_exposure_graph_v1_golden.py
    depends_on: [P1-A.4]

  - id: P1-B.1
    title: EXECUTION_CAPACITY_LADDER_V1 공식 정의
    output_file: spec/formulas/domains/execution.yaml (신규)
    detail: >
      order_capacity_krw = min(planned_order_amount_krw, avg_trade_value_20d_krw*0.003,
      intraday_trade_value_krw*0.01, orderbook_top3_depth_krw*0.30).
      spread_bps, orderbook_top3_depth_krw 신규 필드.
    depends_on: []

  - id: P1-B.2
    title: build_execution_capacity_ladder_v1.py
    output_file: tools/build_execution_capacity_ladder_v1.py
    depends_on: [P1-B.1]

  - id: P1-B.3
    title: schema + generated model (execution)
    output_file:
      - schemas/generated/execution_capacity_ladder_v1.schema.json
      - src/quant_engine/models/generated/execution_capacity_ladder_v1_schema.py
    depends_on: [P1-B.2]

  - id: P1-B.4
    title: execution capacity golden case
    detail: V89_019(broker_packet_missing), V89_020(capacity_too_low), V89_022(spread_widens)
    output_file: tests/golden/generated/execution_capacity_ladder_v1_golden.py
    depends_on: [P1-B.3]

  - id: P1-C.1
    title: MODEL_GOVERNANCE_KILL_SWITCH_V1 공식 정의
    output_file: spec/formulas/domains/governance.yaml (신규)
    detail: >
      data_quarantine_rate_above_5pct, implementation_shortfall_above_2x_expected,
      T5_hit_rate_below_50pct_30trades, calibration_error_above_limit, drawdown_breach
      kill switch 조건 + promotion_ladder(AUDIT_ONLY→SHADOW→PILOT→LIVE_LIMITED→LIVE_FULL) 자동화.
    depends_on: []

  - id: P1-C.2
    title: build_model_governance_kill_switch_v1.py
    output_file: tools/build_model_governance_kill_switch_v1.py
    depends_on: [P1-C.1]

  - id: P1-C.3
    title: schema + generated model (governance)
    output_file:
      - schemas/generated/model_governance_kill_switch_v1.schema.json
      - src/quant_engine/models/generated/model_governance_kill_switch_v1_schema.py
    depends_on: [P1-C.2]

  - id: P1-C.4
    title: kill switch golden case
    detail: V89_035(hit_rate), V89_036(slippage), V89_037(quarantine_rate)
    output_file: tests/golden/generated/model_governance_kill_switch_v1_golden.py
    depends_on: [P1-C.3]

  - id: P1-4
    title: 전체 검증 스위트 재실행
    command: |
      python tools/validate_specs.py
      python tools/validate_golden_coverage_100.py
      python tools/validate_calibration_registry_v1.py
      python tools/validate_schema_model_generation_v1.py
      python tools/validate_agents_shrink_v1.py
    depends_on: [P1-A.5, P1-B.4, P1-C.4]
