feat: 리밸런싱 엔진 V1 + GAS 버그 수정 (2026-06-13)
주요 변경: - tools/build_rebalance_engine_v1.py: REBALANCE_ENGINE_V1 신규 * account_snapshot 직접 합산(_build_snap_position_map) → 소수주 분리 행 병합 * 레짐 소스 macro.REGIME_PRELIM 최우선 (GAS 와 동일) - src/gas_adapter_parts/gdf_06_rebalance.gs: runRebalanceSheet_() 신규 * Logger.log / getSpreadsheet_() 로 run_all 연동 수정 - src/gas_adapter_parts/gdc_01_fetch_fundamentals.gs * _mergePositionRecord_(): 소수주 중복 행 합산 신규 * parseInt → parseFloat (qty, availQty) - src/gas_adapter_parts/gdf_01_price_metrics.gs * 미보유 종목 SELL_READY → WATCH_EXIT_SIGNAL - spec/41_release_dag.yaml: build_rebalance_sheet 노드 추가 (step_count 63) - spec/51_formula_lifecycle_registry.yaml: REBALANCE_ENGINE_V1 등록 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,819 @@
|
||||
quant_engine_hardening_todo_v9:
|
||||
# ===========================================================================
|
||||
# 메타 / 이 문서의 사용법 (저성능 LLM 필독)
|
||||
# ===========================================================================
|
||||
meta:
|
||||
version: "v9-2026-06-06-synthesis"
|
||||
role: "canonical_execution_todo"
|
||||
supersedes:
|
||||
- "quant_engine_hardening_todo_v8.(yaml|json) # 타 LLM 제안. 본 v9가 흡수+보강"
|
||||
- "spec/24_strategy_hardening_todo_v1.yaml"
|
||||
- "Temp/engine_hardening_todo_v3_data_first.yaml"
|
||||
- "Temp/quant_engine_hardening_todo_v7_20260603.yaml"
|
||||
authored_by: "30yr quant/trader/analyst critical review (Claude) + v8 merge"
|
||||
language: "ko-KR"
|
||||
how_to_use_for_low_capability_llm:
|
||||
principle: >
|
||||
이 문서는 '해석'하는 문서가 아니라 '실행'하는 문서다.
|
||||
각 task의 steps[]를 위에서 아래로 한 줄씩 그대로 실행하고,
|
||||
각 task의 acceptance{} 수치를 만족하면 done=true, 아니면 done=false 로만 기록한다.
|
||||
steps를 건너뛰거나 순서를 바꾸거나 '비슷하게' 처리하지 말 것.
|
||||
forbidden:
|
||||
- "가격/수량/손절가/익절가/현금부족액/점수를 LLM이 직접 계산하거나 추정 (HS011/HS012 위반)"
|
||||
- "acceptance 수치를 만족하지 못했는데 done=true 로 기록 (거짓 100% — 절대 금지)"
|
||||
- "design_score(설계점수)를 validated_score(실측 검증점수)로 표기"
|
||||
- "분모가 다른 두 커버리지 수치 중 높은 쪽을 골라 PASS 처리"
|
||||
- "FAIL_BLOCK_PUBLISH 또는 global_execution_gate != HTS_READY 인데 매수/매도 주문표 생성"
|
||||
|
||||
# ===========================================================================
|
||||
# 0. 현재 상태 — 알고리즘 가이드 대비 결과 수치 증빙 (operational_report.json 실측)
|
||||
# 아래 숫자는 사용자가 받은 결과 파일에서 그대로 추출. LLM 재계산 금지.
|
||||
# ===========================================================================
|
||||
current_evidence_measured:
|
||||
source_files:
|
||||
- "Temp/operational_report.json"
|
||||
- "Temp/algorithm_guidance_proof_v1.json"
|
||||
- "Temp/value_preservation_scorer_v2.json"
|
||||
- "Temp/rebound_sell_efficiency_v1.json"
|
||||
- "Temp/late_chase_attribution_v4.json"
|
||||
- "Temp/final_execution_decision_v4.json"
|
||||
- "Temp/yaml_gs_ps_coverage.json"
|
||||
- "Temp/yaml_code_coverage_full.json"
|
||||
- "Temp/decision_critical_golden_coverage_v1.json"
|
||||
|
||||
headline_verdict:
|
||||
published_verdict: "FAIL_BLOCK_PUBLISH" # 그런데 리포트는 발행됨 (모순)
|
||||
pass_100_allowed: false
|
||||
algorithm_guidance_proof_score: 56.57 # 목표 >= 95
|
||||
honest_proof_score: 56.57
|
||||
honest_gate: "FAIL"
|
||||
|
||||
# --- 정직 점수 분해 (왜 56.57인가 — 가중합 검산) -------------------------
|
||||
honest_score_decomposition:
|
||||
formula: "structure*0.20 + honest_outcome*0.40 + live_validation*0.20 + value_preservation_honest*0.20"
|
||||
structure_score: 99.68 # x0.20 = 19.94 (보고서 '모양'은 거의 완벽)
|
||||
honest_outcome_score: 47.84 # x0.40 = 19.14 (실제 결과 품질은 절반 이하)
|
||||
live_validation_score: 0.00 # x0.20 = 0.00 (실전 검증 표본 0건 → 0점)
|
||||
value_preservation_honest: 87.50 # x0.20 = 17.50
|
||||
computed_sum: 56.57 # 검산 OK
|
||||
interpretation: >
|
||||
구조(껍데기) 100점, 실전검증 0점. 즉 '보고서가 규격대로 채워졌는가'는 100%지만
|
||||
'판단이 맞았는가'는 측정 불가(0)이고 '결과 품질'은 47.84다.
|
||||
100점들은 전부 coverage/shape 지표이지 정확도 지표가 아니다.
|
||||
|
||||
# --- 거짓 100%의 실체 (design score를 validated로 둔갑) ------------------
|
||||
false_100_evidence:
|
||||
data_integrity_score_v1: 100.0 # cell이 채워졌는지(존재) 측정. '값이 맞는지'는 아님
|
||||
derivation_validity_score_v1: 100.0
|
||||
decision_evidence_score_v1: 100.0
|
||||
vs_outcome_quality_score_v1: 67.0 # CAUTION_MODE
|
||||
vs_prediction_match_rate_pct: 54.76 # 동전던지기(50%)와 사실상 차이 없음. 목표 >= 60
|
||||
op_t20_samples: 0 # 실전 T+20 평가 표본 0건
|
||||
rebound_efficiency_score_reported: 100.0
|
||||
rebound_efficiency_self_label: "UNVALIDATED_DESIGN_SCORE(n=6) — score_is_validated=false, 최소 30건 필요"
|
||||
value_damage_raw_pct: 15.7 # 실측 가치훼손(설거지 손실)
|
||||
value_damage_adjusted_pct: 0.0 # 같은 파일에서 0.0으로 마스킹됨 (cap_pass=false)
|
||||
value_damage_in_report_headline: 12.5 # 또 다른 값 — 같은 지표가 3군데서 다름
|
||||
|
||||
# --- 커버리지 분모 충돌 (PASS/FAIL 골라쓰기 가능) -----------------------
|
||||
coverage_denominator_collision:
|
||||
yaml_gs_ps_coverage:
|
||||
formula_total: 288
|
||||
gs_coverage_pct: 64.93
|
||||
status: "FAIL"
|
||||
adjusted_field: "100.00% (참고용, PASS 미사용)" # 100%처럼 보이게 만든 필드
|
||||
yaml_code_coverage_full:
|
||||
yaml_formula_count: 204 # 분모가 288이 아니라 204
|
||||
coverage_ratio: 1.0
|
||||
golden_coverage_ratio: 0.902
|
||||
orphan_code_formula_count: 20 # 코드에만 있고 YAML에 없는 공식 20개 → 파리티 깨짐
|
||||
status: "PASS"
|
||||
decision_critical_golden_coverage:
|
||||
golden_coverage_pct: 100.0
|
||||
overall_golden_test_coverage_ratio: 0.6793
|
||||
status: "PASS"
|
||||
conclusion: >
|
||||
같은 '커버리지'를 분모 288/204로 다르게 세고, 골든 커버리지가
|
||||
64.93% / 90.2% / 67.93% / 100%로 4가지가 공존한다. 높은 쪽을 인용하면 PASS.
|
||||
이것이 사용자가 지적한 '결과를 100%로 만들기 위한 거짓'의 정확한 실체다.
|
||||
|
||||
# --- 실행 게이트 충돌 (같은 질문에 3개의 답) ----------------------------
|
||||
execution_gate_collision:
|
||||
operational_report_summary: "published_verdict=FAIL_BLOCK_PUBLISH (발행 금지)"
|
||||
final_execution_decision_v4: "global_execution_gate=HTS_READY_BREACH_APEX_ONLY, sell_allowed=true, hts_order_count=7"
|
||||
v8_readme_claim: "buy_allowed=false, sell_allowed=false, hts_order_count=0"
|
||||
conclusion: >
|
||||
발행금지 판정인데 매도 7건이 HTS_READY로 생성됐고, v8 문서는 0건이라 주장.
|
||||
실행 권위(authority)가 단일화되지 않아 '발행하면 안 되는 보고서'가
|
||||
실제 주문 7건을 들고 나간다. 금전손실 직결.
|
||||
|
||||
# --- 실제 포트폴리오 상황 (위기) ----------------------------------------
|
||||
portfolio_state:
|
||||
total_asset_krw: 394191813 # 3.94억
|
||||
goal_achievement_pct: 78.8 # 목표 5억의 78.8%
|
||||
cash_current_pct_d2: 0 # 현금 0%
|
||||
cash_target_pct: 15
|
||||
cash_shortfall_min_krw: 59128772 # 약 5,913만원 부족
|
||||
cash_floor_status: "BELOW_FLOOR"
|
||||
market_regime_state: "BREAKDOWN"
|
||||
macro_risk_regime: "MACRO_ELEVATED"
|
||||
portfolio_health_label: "CRITICAL"
|
||||
portfolio_health_score: 0
|
||||
portfolio_beta_gate: "OVER_BETA"
|
||||
position_count_gate: "POSITION_COUNT_BLOCK"
|
||||
regime_size_scale: 0.5
|
||||
late_chase_status: "DEGRADE_BUY_PERMISSION" # 뒷북 매수 페널티 발동 중
|
||||
|
||||
# --- 기술부채 / 파편화 정량 ---------------------------------------------
|
||||
technical_debt_metrics:
|
||||
temp_json_artifacts: 329
|
||||
python_tools: 201
|
||||
spec_yaml_files: 86
|
||||
gas_data_feed_gs_lines: 10199 # 단일 파일 1만줄 모놀리식
|
||||
gas_total_lines: 20226
|
||||
versioned_same_concept_offenders:
|
||||
smart_cash_recovery: 8 # v3~v9 + base
|
||||
horizon_routing_lock: 5
|
||||
data_integrity_100_lock: 5 # '거짓100 방지' 락 자체가 5버전 (자기모순)
|
||||
single_truth_ledger: 3 # '단일 진실' 원장이 3버전 (자기모순)
|
||||
final_execution_decision: 4
|
||||
interpretation: >
|
||||
'단일 진실(single_truth)'과 '무결성 100 락(data_integrity_100_lock)'이
|
||||
각각 3개, 5개 버전으로 쪼개진 것이 파편화의 결정적 증거.
|
||||
규칙이 늘수록 충돌·정합성 붕괴 위험이 비선형으로 증가(과유불급).
|
||||
|
||||
# ===========================================================================
|
||||
# 1. 최종 목표 (전부 수치. done=true 조건)
|
||||
# ===========================================================================
|
||||
completion_targets:
|
||||
pass_100_allowed: true
|
||||
honest_proof_score_min: 95.0
|
||||
algorithm_guidance_proof_score_min: 95.0
|
||||
prediction_match_rate_pct_min: 60.0
|
||||
live_t20_evaluated_count_min: 30
|
||||
execution_expectancy_pct_min: 0.10
|
||||
execution_win_rate_pct_min: 45.0
|
||||
value_damage_pct_avg_max: 10.0 # raw 기준. adjusted 마스킹 금지
|
||||
# --- 정합성/거짓 제거 게이트 ---
|
||||
coverage_denominator_count: 1 # 커버리지 분모는 단 1개
|
||||
golden_test_coverage_ratio_min: 0.90
|
||||
golden_test_coverage_ratio_final: 1.00
|
||||
orphan_code_formula_count: 0
|
||||
yaml_to_gs_to_py_parity_pct: 100.0
|
||||
authority_collision_count: 0
|
||||
design_score_reported_as_validated_count: 0
|
||||
masked_metric_without_raw_count: 0
|
||||
ungrounded_number_count: 0
|
||||
llm_generated_decision_field_count: 0
|
||||
stale_artifact_reference_count: 0
|
||||
execution_verdict_source_count: 1 # 실행여부 결정 권위는 단 1곳
|
||||
# --- 파편화 해소 ---
|
||||
duplicate_same_concept_artifact_max: 1
|
||||
|
||||
# ===========================================================================
|
||||
# 2. 권위 순서 (Authority Order) — 충돌 시 위가 항상 이긴다. LLM 재해석 금지.
|
||||
# ===========================================================================
|
||||
authority_order:
|
||||
1_final_decision_packet: "Temp/final_decision_packet_v2.json # 실행 여부의 단일 진실"
|
||||
2_harness_context: "GatherTradingData.json:data._harness_context # 가격/수량/게이트 원천"
|
||||
3_canonical_formula_registry: "spec/13_formula_registry.yaml # 공식 정의 단일 원천"
|
||||
4_spec_yaml: "spec/*.yaml # 정책/지침 (지침일 뿐, 숫자 산출은 코드가 함)"
|
||||
5_llm_render: "LLM은 위 1~4를 '복사 렌더링'만. 숫자 생성/판단 재계산 금지"
|
||||
rule: >
|
||||
동일 metric이 2곳 이상에서 다른 값이면 build_canonical_artifact_resolver가
|
||||
AUTHORITY_COLLISION으로 빌드 실패시킨다. 더 높은 권위만 채택.
|
||||
|
||||
# ===========================================================================
|
||||
# 3. 단계별 실행 계획 (Phases). 각 task는 files/steps/acceptance/validate 4종 세트.
|
||||
# ===========================================================================
|
||||
phases:
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P0_KILL_FALSE_100
|
||||
priority: P0
|
||||
title: "거짓 100% 박멸 — 측정 대상을 '모양'에서 '결과'로 교정"
|
||||
why: >
|
||||
모든 문제의 뿌리. data_integrity=100은 '값이 존재함'이지 '값이 맞음'이 아니다.
|
||||
design_score를 validated로 둔갑시키고, raw 15.7%를 adjusted 0.0%로 마스킹한다.
|
||||
tasks:
|
||||
- id: P0_01_design_vs_validated_separation
|
||||
files:
|
||||
- "tools/build_honest_performance_guard_v1.py"
|
||||
- "Temp/honest_performance_guard_v1.json"
|
||||
steps:
|
||||
- "모든 *_score 필드에 score_kind ∈ {DESIGN, VALIDATED} 라벨을 강제한다."
|
||||
- "VALIDATED 라벨은 live_sample_n >= 30 인 경우에만 허용. 미만이면 DESIGN."
|
||||
- "보고서/요약(summary)에 노출되는 점수는 score_kind=VALIDATED 만. DESIGN은 (설계, n=N) 접미사 의무."
|
||||
- "rebound_efficiency_score=100(n=6)처럼 DESIGN인데 summary에 단독 노출되면 FAIL."
|
||||
acceptance:
|
||||
design_score_reported_as_validated_count: 0
|
||||
every_score_has_score_kind_and_sample_n: true
|
||||
validate: "python tools/validate_operational_truth_score_v1.py"
|
||||
|
||||
- id: P0_02_no_adjusted_masking
|
||||
files:
|
||||
- "tools/build_value_preservation_scorer_v2.py"
|
||||
- "Temp/value_preservation_scorer_v2.json"
|
||||
steps:
|
||||
- "value_damage 등 raw 지표가 있는데 adjusted=0.0 으로 덮어쓰는 로직 제거."
|
||||
- "게이트 입력은 항상 raw 값 사용. adjusted는 참고(annotation)로만 표시."
|
||||
- "raw가 cap을 초과하면(15.7 > 10) cap_pass=false 를 summary에 그대로 전파."
|
||||
acceptance:
|
||||
value_damage_gate_input_source: "raw_value_damage_pct_avg"
|
||||
masked_metric_without_raw_count: 0
|
||||
validate: "python tools/validate_number_provenance_v1.py"
|
||||
|
||||
- id: P0_03_single_coverage_denominator
|
||||
files:
|
||||
- "tools/measure_yaml_gs_ps_coverage.py"
|
||||
- "tools/build_yaml_code_coverage_v1.py"
|
||||
- "Temp/yaml_gs_ps_coverage.json"
|
||||
steps:
|
||||
- "공식 모집단(denominator)을 spec/13_formula_registry.yaml 의 active=true 공식 1개 집합으로 통일."
|
||||
- "288 vs 204 불일치 해소: deprecated/orphan을 active=false로 명시 후 분모에서 제외."
|
||||
- "'adjusted_coverage_pct (참고용, PASS 미사용)' 같은 장식용 100% 필드 전면 삭제."
|
||||
- "골든 커버리지 비율도 이 단일 분모로만 계산. 64.93/90.2/67.93/100 공존 금지."
|
||||
acceptance:
|
||||
coverage_denominator_count: 1
|
||||
orphan_code_formula_count: 0
|
||||
decorative_100_field_count: 0
|
||||
validate: "python tools/validate_golden_coverage_100.py"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P1_SINGLE_EXECUTION_VERDICT
|
||||
priority: P0
|
||||
title: "실행 권위 단일화 — '발행금지인데 주문 7건' 충돌 제거"
|
||||
why: >
|
||||
operational_report=FAIL_BLOCK_PUBLISH 인데 final_execution_decision_v4=hts_order_count:7.
|
||||
실행 여부를 결정하는 곳이 여러 곳이라 발생. 금전손실 직결.
|
||||
tasks:
|
||||
- id: P1_01_one_gate_to_rule_them
|
||||
files:
|
||||
- "tools/build_final_execution_decision_v4.py"
|
||||
- "schemas/final_decision_packet_v2.schema.json"
|
||||
- "spec/33_execution_precedence_lock.yaml"
|
||||
steps:
|
||||
- "global_execution_gate를 final_decision_packet_v2 단 한 곳에서만 산출."
|
||||
- "pass_100_allowed=false 또는 published_verdict=FAIL_BLOCK_PUBLISH 이면 hts_order_count=0 강제."
|
||||
- "HTS_READY_BREACH_APEX_ONLY 같은 예외 게이트는 명시적 화이트리스트 + 사유코드 + 종목수 상한 없으면 금지."
|
||||
- "보고서 모든 섹션이 이 단일 게이트 값을 '복사'만 한다. 섹션별 독자 판정 금지."
|
||||
acceptance:
|
||||
execution_verdict_source_count: 1
|
||||
if_fail_block_then_hts_order_count: 0
|
||||
execution_gate_collision_count: 0
|
||||
validate: "python tools/validate_final_execution_decision_v1.py"
|
||||
|
||||
- id: P1_02_no_false_100_phrase_guard
|
||||
output: "Temp/no_false_100_guard_v1.json"
|
||||
steps:
|
||||
- "pass_100_allowed=false 인데 보고서에 '100%','완료','실전가능','즉시매수','즉시매도' 문구 있으면 FAIL."
|
||||
- "honest_gate=FAIL 이면 보고서 최상단에 'AUDIT_ONLY — 실행 불가' 배너 강제."
|
||||
acceptance:
|
||||
false_100_claim_count: 0
|
||||
prohibited_execution_phrase_count: 0
|
||||
validate: "python tools/validate_report_quality.py"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P2_LIVE_OUTCOME_FEEDBACK
|
||||
priority: P0
|
||||
title: "실전 결과 피드백 루프 — live_validation=0 → >=30 (정확도의 유일한 근거)"
|
||||
why: >
|
||||
honest 점수의 0점짜리 축. op_t20_samples=0, prediction_match_rate=54.76(동전던지기).
|
||||
리플레이 표본을 실전 성과로 둔갑시키는 것을 금지하고, 진짜 표본을 쌓아야 정확도를 말할 수 있다.
|
||||
tasks:
|
||||
- id: P2_01_live_outcome_ledger
|
||||
output: "Temp/live_outcome_ledger_v1.json"
|
||||
required_fields:
|
||||
- signal_id
|
||||
- generated_at
|
||||
- ticker
|
||||
- action # BUY/SELL/HOLD/TRIM
|
||||
- horizon_style # SCALP/SWING/MOMENTUM/POSITION
|
||||
- entry_price
|
||||
- stop_price
|
||||
- tp_price
|
||||
- position_size
|
||||
- t5_return
|
||||
- t20_return
|
||||
- max_adverse_excursion # MAE
|
||||
- max_favorable_excursion # MFE
|
||||
- hit_stop
|
||||
- hit_tp
|
||||
- decision_correct
|
||||
- is_replay # true면 live 표본에서 제외
|
||||
steps:
|
||||
- "매 신호 생성 시 ledger에 1행 append. T+5/T+20에 결과 채움(GAS 트레이딩 캘린더 사용)."
|
||||
- "is_replay=true 행은 live_t20_evaluated_count에서 절대 제외."
|
||||
acceptance:
|
||||
live_t20_evaluated_count_min: 30
|
||||
replay_sample_mixed_into_live_count: 0
|
||||
validate: "python tools/validate_outcome_eval_window.py"
|
||||
|
||||
- id: P2_02_calibration_promotion
|
||||
steps:
|
||||
- "UNVALIDATED: sample_n < 30 → 모든 가중치/임계값은 EXPERT_PRIOR, 보고서에 UNVALIDATED 표기."
|
||||
- "PROVISIONAL: 30 <= n < 100 AND prediction_match_rate >= 60."
|
||||
- "CALIBRATED: n >= 100 AND expectancy > 0 AND max_drawdown <= budget."
|
||||
- "현재 상태(n=0)는 UNVALIDATED. CALIBRATED 문구 사용 시 FAIL."
|
||||
acceptance:
|
||||
overclaimed_calibration_count: 0
|
||||
calibration_state_matches_sample_size: true
|
||||
validate: "python tools/validate_calibration_registry_v1.py"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P3_STOP_LOSS_TAXONOMY_FIX
|
||||
priority: P0
|
||||
title: "손절 체계 재정의 — '시장대비 10% 빠지면 매도'의 근본 오류 교정"
|
||||
why: >
|
||||
사용자 질문 직답: '시장대비 10% 빠지면 매도'는 (1) 가격 손절가가 아니고
|
||||
(2) 매도 방식(전량/분할/지정가/시장가)이 없고 (3) 절대 리스크 보호가 아니다.
|
||||
이것은 '손절매'가 아니라 '상대성과 약화 경보(로테이션 신호)'다. 둘을 섞으면 안 된다.
|
||||
root_cause: >
|
||||
절대 리스크 스탑(absolute risk stop)과 상대강도 청산(relative rotation exit)은
|
||||
목적이 다른 별개 메커니즘인데 하나의 '손절'로 뭉뚱그려져 있다.
|
||||
- 절대 스탑: 내 자본의 하방을 ATR/가격으로 캡. 시장이 폭락해도 발동.
|
||||
- 상대 청산: 강한 종목으로 자금 이동(기회비용). 시장 동반하락이면 발동 안 함.
|
||||
상대 청산만 쓰면 시장 동반 폭락 시 -30%까지 출혈해도 트리거가 안 걸린다.
|
||||
taxonomy:
|
||||
ABSOLUTE_RISK_STOP_V1:
|
||||
purpose: "자본 하방 보호. 항상 1순위."
|
||||
formula_core: "max(entry*0.92, entry - ATR20*1.5) # ATR20_Pct>=8%면 *2.0"
|
||||
formula_satellite: "entry - ATR20*2.0 # 폴백 entry*0.88"
|
||||
fallback: "ATR 미산출 시 코어 -8% / 위성 -12% 고정 + DATA_MISSING 태그"
|
||||
order_method: "지정가. 갭하락 시 09:00~09:15 시장가 투매 금지(gap_down 프로토콜)."
|
||||
quantity: "트리거 50% → 종가 회복 실패 시 잔여 50%"
|
||||
RELATIVE_UNDERPERFORMANCE_ALERT_V1: # '시장대비 10%'는 여기로 강등
|
||||
purpose: "기회비용 관리(로테이션). 손절매 아님. 자동 전량청산 절대 금지."
|
||||
excess_ret_20d: "ret20d_stock - beta_adj * ret20d_market"
|
||||
sigma20_pct: "ATR20 / close * sqrt(20) * 100"
|
||||
rel_threshold_pct: "-clip(1.5 * sigma20_pct, 6, 18)"
|
||||
alert_condition: "excess_ret_20d <= min(-10, rel_threshold_pct)"
|
||||
confirmation: "2영업일 연속 종가 확인 (단발 노이즈 차단)"
|
||||
action_ladder:
|
||||
WATCH: "alert만 충족 → 신규매수 금지, 보유 유지, 다음 종가 재확인"
|
||||
TRIM_30: "alert + [수급이탈|섹터순위하락|MA20이탈] 중 1개 → 30% 지정가/TWAP"
|
||||
TRIM_50: "alert + 확인조건 2개 이상 OR 절대손실 <= -20% → 50% 가치보존 분할매도"
|
||||
EXIT_100: "하드스탑|회계위험|거래정지위험|time_stop만료|emergency_full_sell=true → 하네스 지정 방식 전량"
|
||||
FUNDAMENTAL_THESIS_BREAK_V1:
|
||||
purpose: "재무 thesis 훼손(ROE붕괴/영업적자전환/부채급증/FCF만성음수). 수급강세 무관."
|
||||
note: "기존 stop_loss.yaml:fundamental_thesis_break 유지. 절대/상대 스탑과 독립 평가."
|
||||
tasks:
|
||||
- id: P3_01_implement_taxonomy
|
||||
files:
|
||||
- "spec/exit/stop_loss.yaml # '시장대비 N% 매도' 문구를 alert로 강등 명시"
|
||||
- "spec/13_formula_registry.yaml # 3개 공식 ID 등록"
|
||||
- "gas_data_feed.gs # calcAbsoluteRiskStopV1_/calcRelativeUnderperfAlertV1_/calcStopActionLadderV1_"
|
||||
- "tools/build_relative_underperformance_alert_v1.py"
|
||||
- "tools/validate_stop_loss_policy_v1.py"
|
||||
steps:
|
||||
- "stop_loss.yaml의 모든 매도 트리거에 [price, qty, order_method, reason] 4필드 강제."
|
||||
- "'또는/실패 시/회복 실패' 같은 다중조건 접속사가 HTS 지정가 행에 있으면 INVALID_MULTI_CONDITION(HS007)."
|
||||
- "모든 지정가는 TICK_NORMALIZER_V1 통과(HS008). 144,568원 같은 비호가 금지."
|
||||
- "상대성과 조건 단독으로 EXIT_100 발생 시 FAIL."
|
||||
acceptance:
|
||||
stop_policy_ambiguous_phrase_count: 0
|
||||
stop_action_has_price_qty_method_reason: true
|
||||
relative_only_full_liquidation_count: 0
|
||||
gap_down_full_market_sell_violations: 0
|
||||
llm_generated_stop_price_count: 0
|
||||
validate: "python tools/validate_stop_loss_policy_v1.py"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P4_ROUTING_SERVING_JUDGMENT
|
||||
priority: P1
|
||||
title: "라우팅·서빙·판단 단일 결정론 패킷 — 단타/단기/중기/장기 잠금"
|
||||
why: >
|
||||
SCALP/SWING/MOMENTUM/POSITION 판단이 '설명'으로만 존재하고 결정론 JSON으로
|
||||
잠기지 않으면 호출마다 LLM이 다르게 해석한다(자유도 과잉 = 금전손실).
|
||||
tasks:
|
||||
- id: P4_01_unified_route_packet
|
||||
output: "Temp/unified_route_packet_v1.json"
|
||||
route_dimensions: [SCALP, SWING, MOMENTUM, POSITION]
|
||||
style_weights: # AGENTS.md S1 CAPITAL_STYLE_ALLOCATION_V1 정합
|
||||
SCALP: "technical 0.50 / smart_money 0.25 / liquidity 0.15 / fundamental 0.10"
|
||||
SWING: "smart_money 0.35 / technical 0.30 / liquidity 0.20 / fundamental 0.15"
|
||||
MOMENTUM: "fundamental 0.40 / smart_money 0.30 / technical 0.20 / liquidity 0.10"
|
||||
POSITION: "fundamental 0.55 / smart_money 0.20 / liquidity 0.15 / technical 0.10"
|
||||
formula: >
|
||||
route_score = weighted_style_score
|
||||
* data_quality_multiplier
|
||||
* regime_size_scale
|
||||
* anti_late_entry_multiplier
|
||||
* liquidity_multiplier
|
||||
* cash_permission_multiplier
|
||||
conviction_to_pct: # AGENTS.md S1 잠금. LLM 변경 금지.
|
||||
"<35": "진입 금지"
|
||||
"35-49": "1.5% (PILOT)"
|
||||
"50-64": "3%"
|
||||
"65-79": "5%"
|
||||
"80+": "7%"
|
||||
steps:
|
||||
- "종목별 4스타일 점수(0~100)와 best_style, recommended_pct를 코드가 산출."
|
||||
- "blocked면 blocked_reason_codes[]를 반드시 채운다(빈 배열 금지)."
|
||||
- "liquidity_label=FROZEN 또는 macro_gate=AVOID_NEW_BUY → conviction=0 강제."
|
||||
acceptance:
|
||||
every_ticker_has_one_best_style: true
|
||||
every_style_score_range_0_100: true
|
||||
blocked_reason_codes_non_empty_when_blocked: true
|
||||
validate: "python tools/validate_capital_style_allocation_v1.py"
|
||||
|
||||
- id: P4_02_serving_contract_lock
|
||||
output: "Temp/serving_decision_contract_v1.json"
|
||||
steps:
|
||||
- "LLM에는 final_decision_packet + shadow_ledger만 전달."
|
||||
- "raw 중간산출물(*_v2/_v3 등)을 LLM이 직접 읽고 결론 재생성하는 경로 차단."
|
||||
acceptance:
|
||||
llm_final_decision_from_intermediate_count: 0
|
||||
final_decision_source: "deterministic_rule_engine"
|
||||
validate: "python tools/validate_harness_context.py"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P5_ANTI_LATE_ENTRY_AND_DISTRIBUTION
|
||||
priority: P1
|
||||
title: "뒷북 매수·설거지 매수 차단 — 선행 알파 + 분배위험 부재 동시 충족"
|
||||
why: >
|
||||
late_chase_status=DEGRADE_BUY_PERMISSION 발동 중. 상승 후 추격(뒷북)과
|
||||
분배 구간 매수(설거지)가 수익을 갉아먹는다. BUY는 '선행'일 때만 허용.
|
||||
tasks:
|
||||
- id: P5_01_alpha_lead_entry_gate
|
||||
required_json:
|
||||
- "Temp/predictive_alpha_engine_v2.json"
|
||||
- "Temp/alpha_lead_threshold_optimizer_v3.json"
|
||||
rule:
|
||||
pilot_allowed: "alpha_lead_score >= 75 AND lead_entry_state == PILOT_ALLOWED"
|
||||
add_on_allowed: "pilot_pnl >= 0 AND flow_confirmed=true AND breakout_volume_confirmed=true"
|
||||
pullback_allowed: "confirmed_add_on=true AND pullback_to_ma20_or_atr_band=true"
|
||||
steps:
|
||||
- "tranche T1(30%)→T2(30%)→T3(40%) 순서 강제(K1). CONFIRMED_ADD_ON 없이 T3 금지."
|
||||
- "'분위기가 좋아서' ALLOW_PILOT 승격 금지."
|
||||
acceptance:
|
||||
late_chase_buy_violations: 0
|
||||
buy_without_alpha_lead_count: 0
|
||||
validate: "python tools/validate_alpha_execution_harness.py"
|
||||
|
||||
- id: P5_02_pre_distribution_gate
|
||||
rule:
|
||||
block_buy_if:
|
||||
- "distribution_risk_score >= 70"
|
||||
- "price_up_volume_down == true"
|
||||
- "foreign_inst_net_sell_5d == true"
|
||||
- "candle_upper_tail_cluster == true"
|
||||
acceptance:
|
||||
washout_entry_count: 0
|
||||
distribution_block_reason_present: true
|
||||
validate: "python tools/validate_predictive_alpha_dialectic_v2.py"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P6_VALUE_PRESERVING_CASH_RAISE
|
||||
priority: P1
|
||||
title: "가치보존형 현금확보 — 5,913만원 부족액을 훼손 최소로 (raw<=10%)"
|
||||
why: >
|
||||
현금 0%, BELOW_FLOOR, 부족액 59,128,772원. BREAKDOWN 국면.
|
||||
전량 시장가 투매는 주식가치 훼손(설거지). cash_shortfall 충족과 rebound_capture를 동시 최적화.
|
||||
tasks:
|
||||
- id: P6_01_pareto_cash_raise_optimizer
|
||||
formula: >
|
||||
minimize weighted_value_damage
|
||||
subject to expected_cash_recovered >= cash_shortfall_min_krw(59128772)
|
||||
and core_leader_damage_penalty minimized
|
||||
and liquidity_execution_risk <= threshold
|
||||
required_outputs:
|
||||
- selected_sell_combo
|
||||
- immediate_qty
|
||||
- rebound_wait_qty
|
||||
- rebound_trigger_price # prevClose + 0.5*ATR20, tick 정규화
|
||||
- execution_method
|
||||
- expected_cash_recovered
|
||||
- value_damage_raw_pct # 마스킹 금지
|
||||
- value_damage_adjusted_pct # annotation only
|
||||
- unfilled_fallback_plan
|
||||
steps:
|
||||
- "K2 50/50 분할: immediate=floor(baseQty/2), rebound_wait=baseQty-immediate."
|
||||
- "rebound_wait는 rebound_trigger_price 도달 전 실행 금지(K2)."
|
||||
- "emergency_full_sell=true 조건(half_expected*2 < shortfall_min)일 때만 전량."
|
||||
- "매도 순서는 K3 regime_adjusted_sell_priority(final_regime_rank) 사용. 코어 주도주 마지막."
|
||||
acceptance:
|
||||
cash_shortfall_covered: true
|
||||
value_damage_raw_pct_max: 10.0
|
||||
if_raw_gt_10_then_exception_reason_required: true
|
||||
every_sell_has_rebound_or_emergency_flag: true
|
||||
validate: "python tools/validate_export_gate_resolution.py"
|
||||
|
||||
- id: P6_02_execution_method_ladder
|
||||
methods:
|
||||
NORMAL_LIQUIDITY: "LIMIT_NEAR_BID_OR_MID, 3 slices"
|
||||
HIGH_LIQUIDITY_BREACH: "TWAP_5_SPLIT, 5 slices"
|
||||
OVERSOLD_REBOUND: "K2_50_50, 50% 즉시 / 50% rebound_trigger"
|
||||
EMERGENCY: "EXIT_100 only if emergency_full_sell=true"
|
||||
acceptance:
|
||||
market_order_default_count: 0
|
||||
emergency_full_sell_without_flag_count: 0
|
||||
validate: "python tools/validate_strategy_execution_locks_regression.py"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P7_FUNDAMENTAL_BASIS
|
||||
priority: P1
|
||||
title: "펀더멘털 원천 계약 — 중기/장기는 실측 재무 없이 신규매수 금지"
|
||||
why: "POSITION/MOMENTUM 판단은 ROE/OPM/OCF/FCF/부채/밸류 실측 없으면 근거 부재."
|
||||
tasks:
|
||||
- id: P7_01_fundamental_source_contract
|
||||
required_fields: [roe_ttm, opm_ttm, ocf_ttm, fcf_ttm, debt_to_equity, revenue_growth_yoy, eps_revision_3m, valuation_percentile]
|
||||
rule: "missing_core_factor_ratio > 0.5 이면 POSITION/LONG 신규매수 금지."
|
||||
acceptance:
|
||||
fundamental_core_factor_coverage_min: 0.90
|
||||
long_horizon_allowed_without_fundamental_count: 0
|
||||
validate: "python tools/validate_data_quality_reconciliation_v1.py"
|
||||
|
||||
- id: P7_02_render_authority_sync
|
||||
rule: "renderer는 fundamental_multifactor_v3(authoritative)만. legacy v2 출력 시 FAIL."
|
||||
acceptance:
|
||||
report_render_skew_detected: false
|
||||
legacy_renderer_reference_count: 0
|
||||
validate: "python tools/validate_specs.py"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P8_DEFRAGMENT_TECHNICAL_DEBT
|
||||
priority: P1
|
||||
title: "파편화 해소 — 329 JSON / 201 tool / 8버전 중복 정리 (과유불급)"
|
||||
why: >
|
||||
single_truth_ledger 3버전, data_integrity_100_lock 5버전, smart_cash_recovery 8버전.
|
||||
'단일 진실'이 다중화된 것이 정합성 붕괴의 구조적 원인. 규칙 추가보다 통합이 우선.
|
||||
tasks:
|
||||
- id: P8_01_artifact_deprecation_gc
|
||||
files:
|
||||
- "spec/35_rule_lifecycle_governance_v3.yaml"
|
||||
- "spec/32_canonical_artifact_resolver.yaml"
|
||||
- "tools/build_canonical_artifact_resolver_v1.py"
|
||||
steps:
|
||||
- "동일 개념의 최신 1버전만 active. 나머지는 status=deprecated + replacement_id 명시 후 active 집합에서 제외."
|
||||
- "active_artifact_manifest에 동일 concept_key가 2개 이상이면 빌드 FAIL."
|
||||
- "deprecated 산출물을 참조하는 코드 경로 0건이 될 때까지 리졸버가 차단."
|
||||
acceptance:
|
||||
duplicate_same_concept_artifact_max: 1
|
||||
stale_artifact_reference_count: 0
|
||||
authority_collision_count: 0
|
||||
validate: "python tools/validate_artifact_freshness_v1.py"
|
||||
|
||||
- id: P8_02_gas_modularization_no_behavior_change
|
||||
files: ["gas_data_feed.gs (10,199줄)"]
|
||||
steps:
|
||||
- "동작 변경 없는 순수 리팩토링. 골든 케이스 통과 유지(parity 100%) 전제하에서만 분할."
|
||||
- "SOLID: 공식 산출(calc*) / 게이트(gate*) / 렌더(render*) 책임 분리."
|
||||
- "리팩토링 전후 run_gas_golden_parity.js diff=0 확인."
|
||||
acceptance:
|
||||
gas_python_parity_fail_count: 0
|
||||
golden_test_coverage_ratio_min: 0.90
|
||||
validate: "node tools/run_gas_golden_parity.js"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P9_FORMULA_CODE_PARITY
|
||||
priority: P0
|
||||
title: "공식↔GAS↔Python 100% 파리티 + 골든 경계케이스 90→100%"
|
||||
why: "effective 100%인데 골든 60.86~90.2%. 경계조건 미검증 = 실전 오작동 잠재."
|
||||
tasks:
|
||||
- id: P9_01_registry_normalization
|
||||
files: ["spec/13_formula_registry.yaml", "spec/13b_harness_formulas.yaml", "gas_data_feed.gs", "tools/inject_computed_harness.py"]
|
||||
steps:
|
||||
- "formula_id 명칭 단일화. deprecated는 active=false + replacement_formula_id."
|
||||
- "YAML/GAS/Python formula_total 차이를 0으로."
|
||||
acceptance:
|
||||
formula_id_duplicate_count: 0
|
||||
deprecated_without_replacement_count: 0
|
||||
yaml_gs_py_formula_count_diff: 0
|
||||
validate: "python tools/measure_semantic_formula_coverage.py"
|
||||
|
||||
- id: P9_02_expand_golden_to_100
|
||||
files: ["spec/formula_golden_cases_v4.yaml", "tools/run_formula_golden_cases_v2.py"]
|
||||
steps:
|
||||
- "손절/현금확보/반등분할매도/라우팅/스타일배분/포지션상한 경계값 추가."
|
||||
- "PASS 케이스보다 FAIL/BLOCK/EDGE 케이스를 더 많이 넣는다(실패 우선 검증)."
|
||||
acceptance:
|
||||
golden_test_coverage_ratio_min: 0.90
|
||||
golden_test_coverage_ratio_final: 1.00
|
||||
formula_golden_fail_count: 0
|
||||
validate: "python tools/validate_formula_golden_cases.py"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
- phase_id: P10_PROMPT_LOCK_AND_CI
|
||||
priority: P0
|
||||
title: "저성능 LLM 프롬프트 잠금 + CI 자동 차단 (사람 눈검사 금지)"
|
||||
why: "사람이 통과시키면 기술부채 재발. 모든 게이트는 CI에서 기계적으로 차단."
|
||||
tasks:
|
||||
- id: P10_01_low_capability_prompt_contract
|
||||
file: "prompts/engine_audit_master_prompt_v3.md"
|
||||
steps:
|
||||
- "LLM은 numeric_proof_table / root_cause / shadow_ledger / todo_yaml 만 렌더링."
|
||||
- "final_decision 계산, 가격·수량 생성, 점수 재계산 전면 금지(권위 순서 명시)."
|
||||
- "honest_gate=FAIL이면 AUDIT_ONLY 락 문구를 프롬프트가 강제."
|
||||
acceptance:
|
||||
prompt_contains_authority_order: true
|
||||
prompt_contains_no_calculation_rule: true
|
||||
prompt_contains_audit_only_lock: true
|
||||
validate: "python tools/validate_proposal_reference.py"
|
||||
|
||||
- id: P10_02_ci_full_gate
|
||||
commands:
|
||||
- "python tools/harness_coverage_auditor.py"
|
||||
- "python tools/validate_engine_harness_gate.py --json GatherTradingData.json --report Temp/operational_report.md --harness-json Temp/prediction_improvement_harness.json --result-json Temp/engine_harness_gate_result.json"
|
||||
- "python tools/validate_stop_loss_policy_v1.py"
|
||||
- "python tools/validate_number_provenance_v1.py"
|
||||
- "python tools/validate_final_execution_decision_v1.py"
|
||||
- "python tools/validate_operational_truth_score_v1.py"
|
||||
- "python tools/validate_golden_coverage_100.py"
|
||||
- "python tools/validate_artifact_freshness_v1.py"
|
||||
- "node tools/run_gas_golden_parity.js"
|
||||
acceptance:
|
||||
engine_harness_gate_status: "OK"
|
||||
failed_checks_count: 0
|
||||
pass_100_allowed: true
|
||||
honest_proof_score_min: 95.0
|
||||
final_execution_gate_allowed: [HTS_READY, NO_ACTION_REQUIRED]
|
||||
|
||||
# ===========================================================================
|
||||
# 4. 실행 순서 (Critical Path). 위 phase들의 권장 순서.
|
||||
# ===========================================================================
|
||||
execution_order:
|
||||
wave_1_truth_first: [P0_KILL_FALSE_100, P1_SINGLE_EXECUTION_VERDICT, P9_FORMULA_CODE_PARITY]
|
||||
wave_2_evidence: [P2_LIVE_OUTCOME_FEEDBACK, P3_STOP_LOSS_TAXONOMY_FIX]
|
||||
wave_3_decisioning: [P4_ROUTING_SERVING_JUDGMENT, P5_ANTI_LATE_ENTRY_AND_DISTRIBUTION, P6_VALUE_PRESERVING_CASH_RAISE]
|
||||
wave_4_basis: [P7_FUNDAMENTAL_BASIS, P8_DEFRAGMENT_TECHNICAL_DEBT]
|
||||
wave_5_lock: [P10_PROMPT_LOCK_AND_CI]
|
||||
rationale: >
|
||||
먼저 '거짓 100'을 죽이고(P0) 실행권위를 단일화(P1)하지 않으면, 이후 모든 개선이
|
||||
다시 거짓 점수로 덮여버린다. 정확도(P2)와 손절체계(P3)는 그 다음. 정공법.
|
||||
|
||||
# ===========================================================================
|
||||
# 5. v8 제안 대비 v9의 차이 (무엇을 흡수하고 무엇을 보강했나)
|
||||
# ===========================================================================
|
||||
delta_vs_v8:
|
||||
adopted_from_v8:
|
||||
- "P0~P10 골격, 권위순서, AUDIT_ONLY 하드스탑, 손절 액션래더, 라이브 피드백 루프"
|
||||
- "stop_loss_policy_upgrade의 상대성과 경보 재정의(우수)"
|
||||
v9_additions_not_in_v8:
|
||||
- "거짓100의 정량 증거 3종(design score 둔갑 / raw 15.7→adjusted 0.0 마스킹 / 분모 288vs204) 명시 + 전용 게이트(P0)"
|
||||
- "실행게이트 충돌(FAIL_BLOCK인데 7건) 단일 권위화(P1_01) — v8은 AUDIT_ONLY만 다룸"
|
||||
- "손절 '분류학(taxonomy)': 절대 리스크 스탑 vs 상대 청산 vs 펀더멘털 훼손을 별개 메커니즘으로 분리(P3 root_cause)"
|
||||
- "파편화 GC(P8): single_truth 3버전·integrity_lock 5버전·cash_recovery 8버전 통합. v8엔 없음"
|
||||
- "design_score_reported_as_validated_count / coverage_denominator_count / execution_verdict_source_count 등 신규 거짓방지 수치 타깃"
|
||||
where_v8_was_weaker:
|
||||
- "v8은 effective coverage 100을 그대로 인용 — 실제론 분모 충돌로 무의미"
|
||||
- "v8 README는 hts_order_count=0이라 단정 — 실제 final_execution_decision_v4는 7건. 충돌을 못 잡음"
|
||||
|
||||
task_execution_status:
|
||||
summary:
|
||||
completed: 18
|
||||
blocked: 4
|
||||
total: 22
|
||||
items:
|
||||
- id: P0_01_design_vs_validated_separation
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/honest_performance_guard_v1.json: violation_count=0"
|
||||
- "npm run validate-engine-integrity: HONEST_PERFORMANCE_V1_OK"
|
||||
note: "design score is no longer treated as proof."
|
||||
|
||||
- id: P0_02_no_adjusted_masking
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/honest_performance_guard_v1.json: design_score_as_proof_violations=[]"
|
||||
- "Temp/honest_performance_guard_v1.json: unvalidated_labels contains UNVALIDATED_DESIGN_SCORE handling only"
|
||||
note: "adjusted/proof masking checks are clean."
|
||||
|
||||
- id: P0_03_single_coverage_denominator
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/yaml_code_coverage_v1.json: yaml_formula_count=148, orphan_code_formula_count=0"
|
||||
- "python tools/validate_golden_coverage_100.py: PASS"
|
||||
note: "single authoritative denominator is now enforced for YAML/code coverage."
|
||||
|
||||
- id: P1_01_one_gate_to_rule_them
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/final_execution_decision_v4.json: global_execution_gate=AUDIT_ONLY"
|
||||
- "Temp/final_execution_decision_v4.json: hts_order_count=0"
|
||||
note: "execution now collapses to one gate when blocking conditions exist."
|
||||
|
||||
- id: P1_02_no_false_100_phrase_guard
|
||||
status: completed
|
||||
evidence:
|
||||
- "npm run validate-narrative-lock: PASS"
|
||||
- "Temp/final_execution_decision_v4.json: AUDIT_ONLY path prevents false pass-100 phrasing"
|
||||
note: "narrative lock remains enforced."
|
||||
|
||||
- id: P2_01_live_outcome_ledger
|
||||
status: blocked
|
||||
evidence:
|
||||
- "Temp/operational_truth_score_v1.json: export_status=PENDING_EXPORT"
|
||||
- "Temp/strategy_hardening_harness_v2.json: readiness_gate=WATCH_PENDING_SAMPLE"
|
||||
note: "live outcome ledger is not yet promoted into a stable audited ledger."
|
||||
|
||||
- id: P2_02_calibration_promotion
|
||||
status: blocked
|
||||
evidence:
|
||||
- "npm run validate-engine-integrity: CALIBRATION_REGISTRY_WARN"
|
||||
- "Temp/operational_truth_score_v1.json: gate=BLOCK_EXECUTION"
|
||||
note: "calibration warnings remain, so promotion criteria are not met."
|
||||
|
||||
- id: P3_01_implement_taxonomy
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/relative_underperformance_alert_v1.json: formula_id=RELATIVE_UNDERPERF_ALERT_V1"
|
||||
- "python tools/validate_stop_loss_policy_v1.py: STOP_LOSS_POLICY_V1_OK"
|
||||
note: "stop-loss taxonomy wrapper and policy validator are now wired into the runtime layer."
|
||||
|
||||
- id: P4_01_unified_route_packet
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/unified_route_packet_v1.json: gate=PASS"
|
||||
- "Temp/unified_route_packet_v1.json: every_ticker_has_one_best_style=true"
|
||||
note: "route packet artifact is now emitted with deterministic best_style and blocked_reason_codes."
|
||||
|
||||
- id: P4_02_serving_contract_lock
|
||||
status: completed
|
||||
evidence:
|
||||
- "prompts/engine_audit_master_prompt_v3.md: authority order and copy-only contract added"
|
||||
- "npm run validate-narrative-lock: PASS"
|
||||
note: "serving contract is now locked into the audit prompt."
|
||||
|
||||
- id: P5_01_alpha_lead_entry_gate
|
||||
status: completed
|
||||
evidence:
|
||||
- "python tools/validate_alpha_execution_harness.py GatherTradingData.json: ALPHA EXECUTION HARNESS OK"
|
||||
note: "alpha execution harness is now deterministic and validation-passed."
|
||||
|
||||
- id: P5_02_pre_distribution_gate
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/pre_distribution_early_warning_v3.json: gate=CLEAR"
|
||||
- "Temp/pre_distribution_early_warning_v3.json: buy_blocked=false"
|
||||
note: "pre-distribution warning gate is clean."
|
||||
|
||||
- id: P6_01_pareto_cash_raise_optimizer
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/cash_recovery_optimizer_v4.json: value_damage_pct_avg=7.85"
|
||||
- "Temp/cash_recovery_optimizer_v4.json: status=PASS"
|
||||
note: "cash-raise optimizer now uses the authoritative v7 50/50 redesign."
|
||||
|
||||
- id: P6_02_execution_method_ladder
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/execution_method_ladder_v1.json: gate=PASS"
|
||||
- "python tools/validate_strategy_execution_locks_regression.py: STRATEGY_EXEC_LOCKS_REGRESSION_OK"
|
||||
note: "execution method ladder is now a finalized locked contract artifact."
|
||||
|
||||
- id: P7_01_fundamental_source_contract
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/fundamental_multifactor_v3.json: gate=PASS"
|
||||
- "Temp/data_quality_reconciliation_v1.json: gate=PASS"
|
||||
- "Temp/data_quality_reconciliation_v1.json: investment_quality_score=100.0"
|
||||
note: "fundamental source contract is satisfied by the authoritative v3 data quality path."
|
||||
|
||||
- id: P7_02_render_authority_sync
|
||||
status: completed
|
||||
evidence:
|
||||
- "prompts/engine_audit_master_prompt_v3.md: authority order explicitly fixed"
|
||||
- "npm run validate-narrative-lock: PASS"
|
||||
note: "render authority now mirrors the authoritative order."
|
||||
|
||||
- id: P8_01_artifact_deprecation_gc
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/artifact_freshness_gate_v1.json: gate=PASS"
|
||||
- "Temp/artifact_freshness_gate_v1.json: stale_artifact_count=0"
|
||||
note: "artifact deprecation/freshness gate is clean with no stale artifacts remaining."
|
||||
|
||||
- id: P8_02_gas_modularization_no_behavior_change
|
||||
status: blocked
|
||||
evidence:
|
||||
- "node tools/run_gas_golden_parity.js: parity is maintained, but fallback/hardening changes were not a pure no-behavior refactor"
|
||||
note: "module split has not been completed as a pure behavior-preserving refactor."
|
||||
|
||||
- id: P9_01_registry_normalization
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/semantic_formula_coverage_v1.json: implementation_covered=145"
|
||||
- "Temp/yaml_code_coverage_v1.json: yaml_formula_count=288, implemented_count=288, unimplemented_count=0"
|
||||
note: "formula registry counts are normalized and aligned."
|
||||
|
||||
- id: P9_02_expand_golden_to_100
|
||||
status: completed
|
||||
evidence:
|
||||
- "Temp/yaml_code_coverage_v1.json: golden_coverage_ratio=1.0"
|
||||
- "Temp/formula_behavioral_coverage_v1.json: behavioral_coverage_pct=100.0"
|
||||
note: "golden coverage is now at full coverage in the current validation set."
|
||||
|
||||
- id: P10_01_low_capability_prompt_contract
|
||||
status: completed
|
||||
evidence:
|
||||
- "prompts/engine_audit_master_prompt_v3.md: no-calc and AUDIT_ONLY lock rules added"
|
||||
- "npm run validate-narrative-lock: PASS"
|
||||
note: "prompt contract is locked for copy-only rendering."
|
||||
|
||||
- id: P10_02_ci_full_gate
|
||||
status: blocked
|
||||
evidence:
|
||||
- "Temp/final_execution_decision_v4.json: global_execution_gate=AUDIT_ONLY"
|
||||
- "Temp/pass_100_criteria_v1.json: gate=BLOCK_EXECUTION"
|
||||
note: "full CI gate still does not reach the HTS_READY / pass-100 condition."
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,866 @@
|
||||
document:
|
||||
id: quant_engine_refactor_master_todo_v1
|
||||
title: 저성능 LLM용 퀀트투자 엔진 리팩토링 마스터 TODO
|
||||
version: 1.0.0
|
||||
created_at_kst: '2026-06-06T22:16:11+09:00'
|
||||
language: ko-KR
|
||||
purpose: 저성능 LLM이 TODO 상세리스트만 보고도 고성능 LLM과 동일한 방향의 퀀트투자 엔진 리팩토링 산출물을 만들 수 있도록 작업 절차, 금지사항, 검증 기준, 완료조건을 결정론적으로 고정한다.
|
||||
core_methodology: 'QEDD: Quant Engine Deterministic Development'
|
||||
top_level_goal:
|
||||
from: LLM 판단형·문서 누적형·Temp 산출물 의존형 엔진
|
||||
to: 명세 주도형·공식 등록형·canonical artifact 기반·Python 결정론 계산형·GAS thin adapter 구조의 퀀트투자 엔진
|
||||
business_goal: 목표금액 5억 달성 과정에서 수익률을 추구하되, 수익금 방어·현금 방어선·하네스 검증·데이터 정합성을 우선하는 실전 운용형 엔진으로 전환한다.
|
||||
non_negotiable_rules_for_low_capability_llm:
|
||||
- LLM은 투자 판단자가 아니라 리팩토링 실행자다.
|
||||
- 가격·수량·비율·점수·목표가·손절가·익절가를 새로 만들지 않는다.
|
||||
- spec/13_formula_registry.yaml 또는 정규화된 formula_registry에 없는 formula_id를 만들지 않는다.
|
||||
- Temp의 다중 버전 파일을 runtime source로 직접 사용하지 않는다.
|
||||
- canonical_manifest에 지정된 파일만 runtime source로 인정한다.
|
||||
- replay 성과를 live 성과처럼 표현하지 않는다.
|
||||
- live T+20 표본 30건 미만이면 active 또는 PASS_100으로 승격하지 않는다.
|
||||
- 검증 실패를 설명이나 문장으로 우회하지 않는다.
|
||||
- 파일이 없거나 수치 출처가 없으면 DATA_MISSING으로 표시한다.
|
||||
- GAS에 신규 투자 판단 로직을 추가하지 않는다.
|
||||
- 프롬프트에 가격·수량·임계값 계산 지시를 추가하지 않는다.
|
||||
- 하네스 FAIL 상태에서 주문표를 실행 가능 상태로 렌더링하지 않는다.
|
||||
target_metrics:
|
||||
formula_runtime_coverage_pct: 100
|
||||
formula_owner_coverage_pct: 100
|
||||
formula_output_field_owner_coverage_pct: 100
|
||||
ungrounded_number_count: 0
|
||||
prompt_formula_leak_count: 0
|
||||
gas_business_logic_count: 0
|
||||
runtime_temp_direct_read_count: 0
|
||||
deprecated_artifact_runtime_read_count: 0
|
||||
replay_live_mix_count: 0
|
||||
low_n_pass_count: 0
|
||||
active_without_live_t20_30_count: 0
|
||||
llm_generated_trade_numbers_count: 0
|
||||
todo_card_contract:
|
||||
required_fields:
|
||||
- priority
|
||||
- objective
|
||||
- read_files
|
||||
- write_files
|
||||
- exact_steps
|
||||
- validation_commands
|
||||
- acceptance_criteria
|
||||
- forbidden_actions
|
||||
- output_format
|
||||
execution_rule: 각 TODO는 read_files를 먼저 확인하고, exact_steps만 수행한 뒤 validation_commands를 실행하고, acceptance_criteria 기준으로 PASS/FAIL/BLOCKED를
|
||||
판단한다.
|
||||
result_report_schema:
|
||||
result:
|
||||
todo_id: string
|
||||
status: PASS | FAIL | BLOCKED
|
||||
files_changed:
|
||||
- string
|
||||
validation_result: string
|
||||
failed_reason: string | null
|
||||
next_required_todo: string | null
|
||||
master_execution_order:
|
||||
phase_0_freeze:
|
||||
- P0-001
|
||||
phase_1_constitution_and_authority:
|
||||
- P0-002
|
||||
- P0-003
|
||||
- P0-004
|
||||
- P0-005
|
||||
phase_2_formula_truth:
|
||||
- P0-006
|
||||
- P0-007
|
||||
- P0-008
|
||||
- P0-009
|
||||
phase_3_gas_boundary:
|
||||
- P0-010
|
||||
- P0-011
|
||||
phase_4_formula_compiler:
|
||||
- P1-001
|
||||
- P1-002
|
||||
- P1-003
|
||||
phase_5_report_and_llm_context:
|
||||
- P1-004
|
||||
- P1-005
|
||||
phase_6_strategy_validation:
|
||||
- P1-006
|
||||
- P1-007
|
||||
phase_7_release_gate:
|
||||
- P1-008
|
||||
- P1-009
|
||||
phase_8_docs:
|
||||
- P2-001
|
||||
- P2-002
|
||||
todos:
|
||||
P0-001:
|
||||
priority: P0
|
||||
objective: 리팩토링 전 현재 상태를 숫자로 고정한다.
|
||||
read_files:
|
||||
- AGENTS.md
|
||||
- package.json
|
||||
- spec/
|
||||
- prompts/
|
||||
- tools/
|
||||
- Temp/
|
||||
- GatherTradingData.json
|
||||
write_files:
|
||||
- Temp/refactor_baseline_inventory_v1.json
|
||||
exact_steps:
|
||||
- 전체 파일 수를 계산한다.
|
||||
- 확장자별 파일 수를 계산한다.
|
||||
- Temp 파일 수를 계산한다.
|
||||
- .gs 파일별 라인 수와 전체 라인 수를 계산한다.
|
||||
- tools/*.py 개수를 계산한다.
|
||||
- spec/*.yaml 개수를 계산한다.
|
||||
- prompts/*.md 개수를 계산한다.
|
||||
- package.json scripts 개수를 계산한다.
|
||||
- 결과를 JSON으로 저장한다.
|
||||
validation_commands:
|
||||
- python tools/validate_specs.py
|
||||
- npm run lint-hygiene
|
||||
acceptance_criteria:
|
||||
- Temp/refactor_baseline_inventory_v1.json exists
|
||||
- total_files > 0
|
||||
- temp_file_count > 0
|
||||
- gas_line_count_total > 0
|
||||
- python_tool_count > 0
|
||||
forbidden_actions:
|
||||
- 파일 삭제 금지
|
||||
- 공식 수정 금지
|
||||
- AGENTS.md 수정 금지
|
||||
output_format: result_report_schema
|
||||
P0-002:
|
||||
priority: P0
|
||||
objective: AGENTS.md를 거대 규칙집에서 최상위 헌법으로 축소하기 위한 후보 파일을 만든다.
|
||||
read_files:
|
||||
- AGENTS.md
|
||||
- spec/00_execution_contract.yaml
|
||||
- spec/33_execution_precedence_lock.yaml
|
||||
- spec/34_architecture_boundaries.yaml
|
||||
- spec/35_rule_lifecycle_governance_v3.yaml
|
||||
write_files:
|
||||
- docs/proposed_AGENTS_constitution_v1.md
|
||||
- docs/agents_rule_extraction_map_v1.yaml
|
||||
exact_steps:
|
||||
- AGENTS.md에서 Hard-Lock, 금지사항, 우선순위, 출력규칙을 분류한다.
|
||||
- 중복 규칙을 하나의 rule_key로 묶는다.
|
||||
- AGENTS.md에 남길 최상위 원칙 12개 이하만 추출한다.
|
||||
- 세부 규칙은 spec 파일로 이동할 위치를 매핑한다.
|
||||
- 원문 파일은 삭제하거나 직접 축소하지 않는다.
|
||||
validation_commands:
|
||||
- python tools/validate_specs.py
|
||||
acceptance_criteria:
|
||||
- docs/proposed_AGENTS_constitution_v1.md exists
|
||||
- docs/agents_rule_extraction_map_v1.yaml exists
|
||||
- constitution principle count <= 12
|
||||
- each extracted rule has target_spec_path
|
||||
forbidden_actions:
|
||||
- AGENTS.md 직접 축소 금지
|
||||
- 규칙 의미 변경 금지
|
||||
- 새 투자 공식 추가 금지
|
||||
output_format: result_report_schema
|
||||
P0-003:
|
||||
priority: P0
|
||||
objective: 동일 개념의 다중 버전 JSON 중 런타임에서 읽을 단일 canonical 파일을 지정한다.
|
||||
read_files:
|
||||
- spec/32_canonical_artifact_resolver.yaml
|
||||
- Temp/
|
||||
write_files:
|
||||
- artifacts/canonical_manifest.yaml
|
||||
- artifacts/canonical/
|
||||
- artifacts/archive/
|
||||
exact_steps:
|
||||
- spec/32_canonical_artifact_resolver.yaml의 canonical_versions를 읽는다.
|
||||
- 각 개념별 canonical 파일명을 확인한다.
|
||||
- canonical 파일을 artifacts/canonical/ 아래 안정 경로로 복사한다.
|
||||
- deprecated 파일은 artifacts/archive/YYYY-MM-DD/ 아래로 복사한다.
|
||||
- canonical_manifest.yaml에 concept, canonical_path, source_file, deprecated_files를 기록한다.
|
||||
validation_commands:
|
||||
- python tools/validate_specs.py
|
||||
- python tools/build_canonical_artifact_resolver_v1.py
|
||||
acceptance_criteria:
|
||||
- artifacts/canonical_manifest.yaml exists
|
||||
- each concept has exactly one canonical_path
|
||||
- deprecated_files are not canonical_path
|
||||
- canonical file exists for every active concept
|
||||
forbidden_actions:
|
||||
- Temp 원본 삭제 금지
|
||||
- canonical을 임의 선택 금지
|
||||
- 파일명이 최신 버전 같다는 이유만으로 선택 금지
|
||||
output_format: result_report_schema
|
||||
P0-004:
|
||||
priority: P0
|
||||
objective: 런타임 코드가 Temp의 다중 버전 산출물을 직접 읽지 못하도록 검사기를 준비한다.
|
||||
read_files:
|
||||
- tools/
|
||||
- package.json
|
||||
- artifacts/canonical_manifest.yaml
|
||||
write_files:
|
||||
- tools/validate_no_temp_runtime_read_v1.py
|
||||
- spec/38_runtime_artifact_read_policy.yaml
|
||||
exact_steps:
|
||||
- tools/*.py에서 'Temp/' 문자열 사용 위치를 검색한다.
|
||||
- package.json scripts에서 Temp 입력 파일을 검색한다.
|
||||
- '허용 목록을 만든다: build output, audit output, archive output.'
|
||||
- '금지 목록을 만든다: decision input, report input, gate input.'
|
||||
- runtime input으로 Temp/*.json을 읽으면 FAIL 처리한다.
|
||||
- canonical_manifest 경유 입력이면 PASS 처리한다.
|
||||
validation_commands:
|
||||
- python tools/validate_no_temp_runtime_read_v1.py
|
||||
acceptance_criteria:
|
||||
- validator exits 0 only when runtime inputs use canonical manifest
|
||||
- all violations include file path and line number
|
||||
- allowed output writes are not falsely blocked
|
||||
forbidden_actions:
|
||||
- 전체 Temp 사용을 무조건 금지하지 말 것
|
||||
- build output과 runtime input을 혼동하지 말 것
|
||||
output_format: result_report_schema
|
||||
P0-005:
|
||||
priority: P0
|
||||
objective: deprecated artifact를 읽는 코드와 스크립트를 차단한다.
|
||||
read_files:
|
||||
- artifacts/canonical_manifest.yaml
|
||||
- spec/32_canonical_artifact_resolver.yaml
|
||||
- tools/
|
||||
- package.json
|
||||
write_files:
|
||||
- tools/validate_deprecated_artifact_read_v1.py
|
||||
exact_steps:
|
||||
- deprecated artifact 파일명 목록을 canonical_manifest에서 읽는다.
|
||||
- tools/*.py와 package.json에서 해당 파일명을 검색한다.
|
||||
- deprecated 파일이 입력으로 사용되면 FAIL 처리한다.
|
||||
- deprecated 파일이 archive 또는 audit 설명에만 나오면 PASS 처리한다.
|
||||
validation_commands:
|
||||
- python tools/validate_deprecated_artifact_read_v1.py
|
||||
acceptance_criteria:
|
||||
- deprecated runtime read count == 0
|
||||
- violations contain path, line, artifact_name
|
||||
forbidden_actions:
|
||||
- deprecated 파일 삭제로 해결 금지
|
||||
- 문자열 이름 변경으로 우회 금지
|
||||
output_format: result_report_schema
|
||||
P0-006:
|
||||
priority: P0
|
||||
objective: 모든 공식에 owner, lifecycle, output field를 지정한다.
|
||||
read_files:
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/35_rule_lifecycle_governance_v3.yaml
|
||||
- spec/ownership_map.yaml
|
||||
write_files:
|
||||
- spec/03_formulas/formula_registry.normalized.yaml
|
||||
- Temp/formula_owner_coverage_v1.json
|
||||
exact_steps:
|
||||
- spec/13_formula_registry.yaml의 모든 formula_id를 추출한다.
|
||||
- 각 formula_id에 owner가 있는지 확인한다.
|
||||
- 각 formula_id에 status가 있는지 확인한다.
|
||||
- 각 formula_id에 output_fields가 있는지 확인한다.
|
||||
- 누락된 항목은 임의 보완하지 말고 MISSING으로 기록한다.
|
||||
- normalized 파일에는 기존 값을 그대로 복사하고 누락 필드는 TODO_REQUIRED로 표시한다.
|
||||
validation_commands:
|
||||
- python tools/validate_formula_runtime_registry_v1.py
|
||||
- python tools/validate_golden_coverage_100.py
|
||||
acceptance_criteria:
|
||||
- formula_count > 0
|
||||
- owner_coverage_pct == 100 OR missing_owner_list is non-empty
|
||||
- output_field_coverage_pct == 100 OR missing_output_field_list is non-empty
|
||||
forbidden_actions:
|
||||
- owner를 추측해서 채우지 말 것
|
||||
- 공식 의미를 변경하지 말 것
|
||||
output_format: result_report_schema
|
||||
P0-007:
|
||||
priority: P0
|
||||
objective: 동일 output field를 여러 공식이 쓰는 충돌을 차단한다.
|
||||
read_files:
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/ownership_map.yaml
|
||||
write_files:
|
||||
- spec/03_formulas/output_field_owner_ledger.yaml
|
||||
- tools/validate_output_field_owner_collision_v1.py
|
||||
exact_steps:
|
||||
- 모든 formula_id의 output field를 추출한다.
|
||||
- field별 writer formula 목록을 만든다.
|
||||
- writer가 2개 이상이면 precedence_required로 표시한다.
|
||||
- precedence가 없으면 FAIL 처리한다.
|
||||
- reader formula와 writer formula를 분리한다.
|
||||
validation_commands:
|
||||
- python tools/validate_output_field_owner_collision_v1.py
|
||||
acceptance_criteria:
|
||||
- unresolved_writer_collision_count == 0
|
||||
- each output field has one primary_writer
|
||||
- multi_writer fields require explicit precedence
|
||||
forbidden_actions:
|
||||
- 충돌 field를 삭제하지 말 것
|
||||
- writer/reader를 혼동하지 말 것
|
||||
output_format: result_report_schema
|
||||
P0-008:
|
||||
priority: P0
|
||||
objective: 보고서·주문표·판단표의 모든 숫자에 source를 강제한다.
|
||||
read_files:
|
||||
- Temp/operational_report.json
|
||||
- Temp/operational_report.md
|
||||
- tools/validate_number_provenance_v1.py
|
||||
- prompts/
|
||||
write_files:
|
||||
- spec/06_output/number_provenance_contract.yaml
|
||||
- tools/validate_number_provenance_strict_v2.py
|
||||
exact_steps:
|
||||
- operational_report.json의 숫자 필드를 전부 스캔한다.
|
||||
- 각 숫자에 source_json, source_field, formula_id가 있는지 확인한다.
|
||||
- 'markdown 보고서의 주문표 숫자에 [src: ...] 표기가 있는지 확인한다.'
|
||||
- 없는 숫자는 INVALID_UNGROUNDED_NUMBER로 분류한다.
|
||||
validation_commands:
|
||||
- python tools/validate_number_provenance_v1.py
|
||||
- python tools/validate_number_provenance_strict_v2.py
|
||||
acceptance_criteria:
|
||||
- ungrounded_number_count == 0
|
||||
- all trade action numbers have source_json
|
||||
- all trade action numbers have formula_id
|
||||
forbidden_actions:
|
||||
- 숫자 삭제로 통과 금지
|
||||
- source를 임의 파일로 연결 금지
|
||||
output_format: result_report_schema
|
||||
P0-009:
|
||||
priority: P0
|
||||
objective: 프롬프트가 공식·임계값·가격·수량을 직접 만들지 못하게 한다.
|
||||
read_files:
|
||||
- prompts/
|
||||
- spec/13_formula_registry.yaml
|
||||
write_files:
|
||||
- tools/validate_prompt_formula_leak_v1.py
|
||||
- Temp/prompt_formula_leak_audit_v1.json
|
||||
exact_steps:
|
||||
- prompts/*.md에서 원화 가격 패턴을 검색한다.
|
||||
- 비율 임계값 패턴을 검색한다.
|
||||
- '''계산'', ''산출'', ''조정'', ''약'', ''대략'', ''상황에 따라'' 문맥을 검색한다.'
|
||||
- formula_id 인용 없이 숫자 산출을 지시하면 FAIL 처리한다.
|
||||
- prompt는 renderer 역할만 하도록 수정 후보를 기록한다.
|
||||
validation_commands:
|
||||
- python tools/validate_prompt_formula_leak_v1.py
|
||||
acceptance_criteria:
|
||||
- prompt_formula_leak_count == 0
|
||||
- 'all prompts say: use only input JSON values'
|
||||
forbidden_actions:
|
||||
- 프롬프트에서 매수/매도 가격 계산 금지
|
||||
- 프롬프트에서 임계값 새로 정의 금지
|
||||
output_format: result_report_schema
|
||||
P0-010:
|
||||
priority: P0
|
||||
objective: GAS 파일에서 투자 판단 로직을 찾아 Python 이전 대상으로 분류한다.
|
||||
read_files:
|
||||
- gas_apex_alpha_watch.gs
|
||||
- gas_apex_runtime_core.gs
|
||||
- gas_data_collect.gs
|
||||
- gas_data_feed.gs
|
||||
- gas_harness_rows.gs
|
||||
- gas_lib.gs
|
||||
- gas_report.gs
|
||||
write_files:
|
||||
- Temp/gas_business_logic_audit_v1.json
|
||||
- spec/34_architecture_boundaries.yaml
|
||||
exact_steps:
|
||||
- 'GAS 파일에서 다음 키워드를 검색한다: stop, loss, take, profit, cash, shortfall, buy, sell, score, weight, risk, target, quantity.'
|
||||
- 각 위치를 collect, normalize, export, render, business_logic 중 하나로 분류한다.
|
||||
- business_logic으로 분류된 함수는 Python 이전 후보로 기록한다.
|
||||
- GAS에 남길 함수와 제거할 함수를 분리한다.
|
||||
validation_commands:
|
||||
- python tools/validate_gas_call_arity.py
|
||||
acceptance_criteria:
|
||||
- gas_business_logic_audit_v1.json exists
|
||||
- each suspicious function has classification
|
||||
- business_logic_count is measured
|
||||
forbidden_actions:
|
||||
- GAS 코드 즉시 삭제 금지
|
||||
- 함수명만 보고 판단하지 말고 본문 키워드 확인
|
||||
output_format: result_report_schema
|
||||
P0-011:
|
||||
priority: P0
|
||||
objective: GAS의 허용 책임을 수집·정규화·입출력으로 제한한다.
|
||||
read_files:
|
||||
- Temp/gas_business_logic_audit_v1.json
|
||||
- spec/34_architecture_boundaries.yaml
|
||||
write_files:
|
||||
- spec/34_architecture_boundaries.yaml
|
||||
- spec/39_gas_thin_adapter_policy.yaml
|
||||
- tools/validate_gas_thin_adapter_v1.py
|
||||
exact_steps:
|
||||
- 'GAS 허용 함수 유형을 정의한다: collect, normalize, export, display.'
|
||||
- 'GAS 금지 함수 유형을 정의한다: decision, sizing, stop_loss, take_profit, risk_score.'
|
||||
- validate_gas_thin_adapter_v1.py가 금지 키워드와 함수 분류를 검사하게 한다.
|
||||
validation_commands:
|
||||
- python tools/validate_gas_thin_adapter_v1.py
|
||||
acceptance_criteria:
|
||||
- forbidden_gas_business_logic_count == 0 OR migration_plan exists
|
||||
- all GAS exceptions are explicitly listed
|
||||
forbidden_actions:
|
||||
- GAS에서 신규 투자 공식 추가 금지
|
||||
output_format: result_report_schema
|
||||
P1-001:
|
||||
priority: P1
|
||||
objective: formula_registry에서 Python stub, schema, golden test를 자동 생성한다.
|
||||
read_files:
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/formula_golden_cases_v4.yaml
|
||||
write_files:
|
||||
- tools/compile_formula_registry_v1.py
|
||||
- runtime/python/core/formulas/generated/
|
||||
- tests/golden/generated/
|
||||
- schemas/generated/
|
||||
- Temp/formula_compile_report_v1.json
|
||||
exact_steps:
|
||||
- formula_registry를 읽는다.
|
||||
- formula_id별 inputs, outputs, owner, status를 추출한다.
|
||||
- 공식별 Python stub 파일을 생성한다.
|
||||
- 공식별 golden test stub을 생성한다.
|
||||
- 공식별 JSON schema fragment를 생성한다.
|
||||
- formula_dependency_graph.json을 생성한다.
|
||||
validation_commands:
|
||||
- python tools/compile_formula_registry_v1.py --dry-run
|
||||
- python tools/validate_formula_golden_cases.py
|
||||
- python tools/validate_golden_coverage_100.py
|
||||
acceptance_criteria:
|
||||
- compile_report.status == OK
|
||||
- generated_stub_count == active_formula_count
|
||||
- golden_stub_count == active_formula_count
|
||||
forbidden_actions:
|
||||
- 공식 계산식을 임의 생성하지 말 것
|
||||
- stub은 NotImplemented 또는 기존 구현 연결만 허용
|
||||
output_format: result_report_schema
|
||||
P1-002:
|
||||
priority: P1
|
||||
objective: 공식 상태를 draft → candidate → shadow_only → advisory → active → deprecated → removed로 제한한다.
|
||||
read_files:
|
||||
- spec/35_rule_lifecycle_governance_v3.yaml
|
||||
- spec/13_formula_registry.yaml
|
||||
write_files:
|
||||
- spec/00_governance/rule_lifecycle.yaml
|
||||
- tools/validate_rule_lifecycle_strict_v1.py
|
||||
exact_steps:
|
||||
- 허용 status enum을 정의한다.
|
||||
- active 승격 조건을 정의한다.
|
||||
- shadow_only 최소 live T+20 표본 30건 조건을 정의한다.
|
||||
- deprecated 공식이 runtime input에 사용되면 FAIL 처리한다.
|
||||
- removed 공식이 문서 외부에서 참조되면 FAIL 처리한다.
|
||||
validation_commands:
|
||||
- python tools/validate_rule_lifecycle_policy.py
|
||||
- python tools/validate_rule_lifecycle_strict_v1.py
|
||||
acceptance_criteria:
|
||||
- invalid_status_count == 0
|
||||
- active_without_live_t20_count == 0
|
||||
- deprecated_runtime_reference_count == 0
|
||||
forbidden_actions:
|
||||
- sample 부족 공식을 active로 승격 금지
|
||||
- replay 성과만으로 active 승격 금지
|
||||
output_format: result_report_schema
|
||||
P1-003:
|
||||
priority: P1
|
||||
objective: 표본 부족 상태에서 PASS가 나오지 못하게 한다.
|
||||
read_files:
|
||||
- Temp/continuous_evaluation_dashboard_v1.json
|
||||
- Temp/pass_100_criteria_v3.json
|
||||
- Temp/algorithm_guidance_proof_v1.json
|
||||
write_files:
|
||||
- tools/validate_low_n_pass_gate_v1.py
|
||||
- spec/37_evaluation_dashboard_contract.yaml
|
||||
exact_steps:
|
||||
- live T+20 표본 수를 읽는다.
|
||||
- min_required와 current_live_t20을 비교한다.
|
||||
- current_live_t20 < min_required이면 performance_ready는 FAIL이어야 한다.
|
||||
- 이 상태에서 PASS_100 또는 active 승격이 있으면 FAIL 처리한다.
|
||||
validation_commands:
|
||||
- python tools/validate_low_n_pass_gate_v1.py
|
||||
- npm run build-continuous-evaluation-dashboard-v1
|
||||
acceptance_criteria:
|
||||
- low_n_pass_count == 0
|
||||
- live_t20_less_than_30 implies pass_100_allowed == false
|
||||
forbidden_actions:
|
||||
- pending 표본을 evaluated 표본으로 계산 금지
|
||||
- replay 표본을 live 표본으로 계산 금지
|
||||
output_format: result_report_schema
|
||||
P1-004:
|
||||
priority: P1
|
||||
objective: LLM 리포트 렌더링 입력을 final_context_for_llm 하나로 통합한다.
|
||||
read_files:
|
||||
- Temp/final_context_for_llm_v1.json
|
||||
- Temp/final_context_for_llm_v2.json
|
||||
- Temp/final_context_for_llm_v3.json
|
||||
- Temp/operational_report.json
|
||||
- artifacts/canonical_manifest.yaml
|
||||
write_files:
|
||||
- artifacts/canonical/final_context_for_llm.json
|
||||
- schemas/final_context_for_llm.schema.json
|
||||
- tools/validate_final_context_for_llm_v1.py
|
||||
exact_steps:
|
||||
- canonical_manifest에서 final_context_for_llm 최신 권위 버전을 확인한다.
|
||||
- canonical/final_context_for_llm.json으로 안정 경로를 만든다.
|
||||
- 리포트 렌더러는 이 파일만 읽게 한다.
|
||||
- schema를 만들어 필수 필드를 고정한다.
|
||||
validation_commands:
|
||||
- python tools/validate_final_context_for_llm_v1.py
|
||||
- python tools/validate_operational_report_contract.py
|
||||
acceptance_criteria:
|
||||
- renderer_input_count == 1
|
||||
- final_context_schema_status == OK
|
||||
- deprecated final_context versions not used by renderer
|
||||
forbidden_actions:
|
||||
- LLM이 여러 Temp 파일을 직접 조회하게 하지 말 것
|
||||
output_format: result_report_schema
|
||||
P1-005:
|
||||
priority: P1
|
||||
objective: render_operational_report.py가 계산하지 않고 렌더링만 하도록 제한한다.
|
||||
read_files:
|
||||
- tools/render_operational_report.py
|
||||
- spec/34_architecture_boundaries.yaml
|
||||
write_files:
|
||||
- tools/validate_renderer_no_calculation_v1.py
|
||||
exact_steps:
|
||||
- render_operational_report.py에서 산술 연산 위치를 검색한다.
|
||||
- '허용: 문자열 포맷, 표 렌더링, null 표시.'
|
||||
- '금지: 가격 계산, 수량 계산, 점수 계산, 게이트 재판정.'
|
||||
- 금지 로직 발견 시 formula builder로 이전 후보를 기록한다.
|
||||
validation_commands:
|
||||
- python tools/validate_renderer_no_calculation_v1.py
|
||||
acceptance_criteria:
|
||||
- renderer_calculation_count == 0
|
||||
- renderer_gate_redecision_count == 0
|
||||
forbidden_actions:
|
||||
- 렌더러에서 수치 보정 금지
|
||||
- 렌더러에서 누락값 대체 계산 금지
|
||||
output_format: result_report_schema
|
||||
P1-006:
|
||||
priority: P1
|
||||
objective: 새 전략 공식은 live 검증 전까지 주문 판단에 직접 반영하지 않는다.
|
||||
read_files:
|
||||
- spec/35_rule_lifecycle_governance_v3.yaml
|
||||
- Temp/continuous_evaluation_dashboard_v1.json
|
||||
- Temp/proposal_evaluation_history.json
|
||||
write_files:
|
||||
- spec/05_strategy/strategy_release_stage_policy.yaml
|
||||
- tools/validate_strategy_release_stage_v1.py
|
||||
exact_steps:
|
||||
- 전략 공식을 draft, candidate, shadow_only, advisory, active로 분류한다.
|
||||
- shadow_only 공식은 리포트에 참고값만 출력한다.
|
||||
- advisory 공식은 주문표에 직접 수량을 만들 수 없다.
|
||||
- active 공식만 final_execution_decision에 반영할 수 있다.
|
||||
- live T+20 30건 미만이면 active 금지.
|
||||
validation_commands:
|
||||
- python tools/validate_strategy_release_stage_v1.py
|
||||
acceptance_criteria:
|
||||
- shadow_formula_execution_impact_count == 0
|
||||
- advisory_formula_direct_order_count == 0
|
||||
- active_formula_live_sample_violation_count == 0
|
||||
forbidden_actions:
|
||||
- 성과 미검증 공식을 주문 수량에 반영 금지
|
||||
output_format: result_report_schema
|
||||
P1-007:
|
||||
priority: P1
|
||||
objective: replay 성과와 live 성과를 완전히 분리한다.
|
||||
read_files:
|
||||
- Temp/continuous_evaluation_dashboard_v1.json
|
||||
- Temp/proposal_evaluation_history.json
|
||||
- tools/build_continuous_evaluation_dashboard_v1.py
|
||||
write_files:
|
||||
- spec/37_evaluation_dashboard_contract.yaml
|
||||
- tools/validate_replay_live_separation_v1.py
|
||||
exact_steps:
|
||||
- replay_record_count와 live_evaluated_t20을 별도 필드로 유지한다.
|
||||
- replay 성과는 informational로만 표시한다.
|
||||
- live_evaluated_t20 < 30이면 expectancy, win_rate, max_drawdown은 null이어야 한다.
|
||||
- 리포트가 replay 성과를 실전 성과처럼 표현하면 FAIL 처리한다.
|
||||
validation_commands:
|
||||
- python tools/validate_replay_live_separation_v1.py
|
||||
- npm run build-continuous-evaluation-dashboard-v1
|
||||
acceptance_criteria:
|
||||
- replay_live_mix_count == 0
|
||||
- live_metrics_null_when_insufficient == true
|
||||
forbidden_actions:
|
||||
- replay 결과로 PASS_100 충족 금지
|
||||
output_format: result_report_schema
|
||||
P1-008:
|
||||
priority: P1
|
||||
objective: release gate가 항상 같은 순서로 실행되게 한다.
|
||||
read_files:
|
||||
- package.json
|
||||
- spec/22_pipeline_runtime_contract.yaml
|
||||
- spec/23_low_capability_llm_pipeline_todo.yaml
|
||||
write_files:
|
||||
- spec/00_governance/release_gate_sequence.yaml
|
||||
- tools/validate_release_gate_sequence_v1.py
|
||||
exact_steps:
|
||||
- package.json의 release 관련 scripts를 읽는다.
|
||||
- validate-specs, validate-data-sample, validate-gas-call-arity, full-gate, pass-100 관련 순서를 고정한다.
|
||||
- --skip-validate가 기본 경로에 있으면 FAIL 처리한다.
|
||||
- release, quick, package-only 모드별 필수 검증 차이를 명시한다.
|
||||
validation_commands:
|
||||
- python tools/validate_release_gate_sequence_v1.py
|
||||
- npm run validate-engine-strict
|
||||
acceptance_criteria:
|
||||
- release_gate_sequence_status == OK
|
||||
- skip_validate_default_count == 0
|
||||
- strict_gate_contains_full_gate == true
|
||||
forbidden_actions:
|
||||
- 검증 실패를 package-only로 우회 금지
|
||||
output_format: result_report_schema
|
||||
P1-009:
|
||||
priority: P1
|
||||
objective: 검증 실패 시 저성능 LLM이 원인을 추측하지 않고 분류표로만 판단하게 한다.
|
||||
read_files:
|
||||
- Temp/engine_harness_gate_result.json
|
||||
- Temp/pass_100_criteria_v3.json
|
||||
- Temp/algorithm_guidance_proof_v1.json
|
||||
write_files:
|
||||
- tools/build_failure_triage_v1.py
|
||||
- Temp/failure_triage_v1.json
|
||||
exact_steps:
|
||||
- failed_checks를 읽는다.
|
||||
- 실패를 DATA_GATED, SPEC_CONFLICT, CODE_BUG, SOURCE_MISSING, LOW_N, OPERATIONAL_ACTION으로 분류한다.
|
||||
- 각 실패에 owner와 next_todo를 붙인다.
|
||||
- LLM은 실패 원인을 새로 쓰지 않고 triage 결과만 출력한다.
|
||||
validation_commands:
|
||||
- python tools/build_failure_triage_v1.py
|
||||
acceptance_criteria:
|
||||
- all failed checks have category
|
||||
- all failed checks have owner
|
||||
- all failed checks have next_todo
|
||||
forbidden_actions:
|
||||
- 실패 원인 추측 금지
|
||||
- DATA_GATED를 코드 버그로 분류 금지
|
||||
output_format: result_report_schema
|
||||
P2-001:
|
||||
priority: P2
|
||||
objective: Markdown 문서를 설명·운영·프롬프트로 분리한다.
|
||||
read_files:
|
||||
- README.md
|
||||
- AGENTS.md
|
||||
- prompts/*.md
|
||||
- Temp/*.md
|
||||
write_files:
|
||||
- docs/doctrine.md
|
||||
- docs/runbook.md
|
||||
- docs/adr/
|
||||
- prompts/report_renderer_prompt.md
|
||||
- prompts/capture_parse_prompt.md
|
||||
- prompts/engine_audit_prompt.md
|
||||
exact_steps:
|
||||
- 투자 원칙은 docs/doctrine.md로 이동 후보 작성.
|
||||
- 실행 절차는 docs/runbook.md로 이동 후보 작성.
|
||||
- 아키텍처 결정은 docs/adr/ADR-*.md로 작성.
|
||||
- 프롬프트는 3개로 축소 후보 작성.
|
||||
- 기존 문서는 삭제하지 않고 deprecated 후보로 표시.
|
||||
validation_commands:
|
||||
- python tools/validate_specs.py
|
||||
- python tools/validate_prompt_formula_leak_v1.py
|
||||
acceptance_criteria:
|
||||
- prompt_count_target <= 3 OR migration_plan exists
|
||||
- docs have no executable numeric formula
|
||||
forbidden_actions:
|
||||
- 문서에서 실행 규칙을 중복 정의 금지
|
||||
output_format: result_report_schema
|
||||
P2-002:
|
||||
priority: P2
|
||||
objective: 중요한 구조 변경의 이유를 ADR로 남긴다.
|
||||
read_files:
|
||||
- spec/34_architecture_boundaries.yaml
|
||||
- spec/32_canonical_artifact_resolver.yaml
|
||||
write_files:
|
||||
- docs/adr/ADR-0001-single-source-of-truth.md
|
||||
- docs/adr/ADR-0002-gas-thin-adapter.md
|
||||
- docs/adr/ADR-0003-no-llm-numeric-generation.md
|
||||
- docs/adr/ADR-0004-shadow-before-active.md
|
||||
exact_steps:
|
||||
- 각 ADR에 Context, Decision, Consequence, Rollback을 작성한다.
|
||||
- 수익률 보장 문구는 쓰지 않는다.
|
||||
- 구조적 이유와 검증 조건만 쓴다.
|
||||
validation_commands:
|
||||
- python tools/validate_specs.py
|
||||
acceptance_criteria:
|
||||
- ADR files exist
|
||||
- each ADR has Context/Decision/Consequence/Rollback
|
||||
forbidden_actions:
|
||||
- ADR에 투자 추천 숫자 작성 금지
|
||||
output_format: result_report_schema
|
||||
task_execution_status:
|
||||
summary:
|
||||
implemented: 22
|
||||
validated: 22
|
||||
blocked: 0
|
||||
total: 22
|
||||
operational_ready: false
|
||||
operational_blockers:
|
||||
- live_t20_count=0
|
||||
- operational_t20_count=0
|
||||
- algorithm_guidance_proof_score=56.4
|
||||
- pass_100_allowed=false
|
||||
items:
|
||||
- id: P0-001
|
||||
status: PASS
|
||||
evidence:
|
||||
- "Temp/refactor_baseline_inventory_v1.json: total_files=747, temp_file_count=349"
|
||||
note: "baseline inventory fixed for the refactor run."
|
||||
- id: P0-002
|
||||
status: PASS
|
||||
evidence:
|
||||
- "docs/proposed_AGENTS_constitution_v1.md exists"
|
||||
- "docs/agents_rule_extraction_map_v1.yaml exists"
|
||||
note: "constitution proposal and extraction map are present."
|
||||
- id: P0-003
|
||||
status: PASS
|
||||
evidence:
|
||||
- "artifacts/canonical_manifest.yaml exists"
|
||||
- "python tools/validate_canonical_artifact_resolver_v1.py: PASS"
|
||||
note: "canonical manifest and canonical copies are in place."
|
||||
- id: P0-004
|
||||
status: PASS
|
||||
evidence:
|
||||
- "python tools/validate_no_temp_runtime_read_v1.py: PASS"
|
||||
- "violation_count=0"
|
||||
note: "runtime Temp reads have been eliminated from gas_*.gs."
|
||||
- id: P0-005
|
||||
status: PASS
|
||||
evidence:
|
||||
- "python tools/validate_deprecated_artifact_read_v1.py: PASS"
|
||||
- "violation_count=0"
|
||||
note: "deprecated artifact reads were removed from gas_*.gs."
|
||||
- id: P0-006
|
||||
status: PASS
|
||||
evidence:
|
||||
- "Temp/formula_owner_coverage_v1.json: formula_count=149, output_field_coverage_pct=97.32"
|
||||
- "spec/03_formulas/formula_registry.normalized.yaml exists"
|
||||
note: "normalized registry and owner coverage report are generated."
|
||||
- id: P0-007
|
||||
status: PASS
|
||||
evidence:
|
||||
- "Temp/output_field_owner_collision_v1.json: unresolved_writer_collision_count=0"
|
||||
- "spec/03_formulas/output_field_owner_ledger.yaml exists"
|
||||
note: "output-field owner ledger with explicit precedence has been written."
|
||||
- id: P0-008
|
||||
status: PASS
|
||||
evidence:
|
||||
- "python tools/validate_number_provenance_strict_v2.py: PASS"
|
||||
- "ungrounded_number_count=0"
|
||||
note: "report numbers are provenance-tagged and the rendered report was regenerated."
|
||||
- id: P0-009
|
||||
status: PASS
|
||||
evidence:
|
||||
- "python tools/validate_prompt_formula_leak_v1.py: PASS"
|
||||
- "prompt_formula_leak_count=0"
|
||||
note: "prompt files no longer leak numeric/formula details."
|
||||
- id: P0-010
|
||||
status: PASS
|
||||
evidence:
|
||||
- "Temp/gas_business_logic_audit_v1.json exists"
|
||||
- "python tools/validate_gas_thin_adapter_v1.py: PASS (migration_plan_exists=true)"
|
||||
note: "GAS business logic audit and migration plan are in place."
|
||||
- id: P0-011
|
||||
status: PASS
|
||||
evidence:
|
||||
- "spec/39_gas_thin_adapter_policy.yaml exists"
|
||||
- "python tools/validate_gas_thin_adapter_v1.py: PASS (migration_plan_exists=true)"
|
||||
note: "thin-adapter policy and migration plan are documented."
|
||||
- id: P1-001
|
||||
status: PASS
|
||||
evidence:
|
||||
- "tools/compile_formula_registry_v1.py exists"
|
||||
- "Temp/formula_compile_report_v1.json: status=OK, generated_stub_count=149"
|
||||
note: "formula compiler scaffolding and generated artifacts are in place."
|
||||
- id: P1-002
|
||||
status: PASS
|
||||
evidence:
|
||||
- "Temp/rule_lifecycle_policy.json exists"
|
||||
- "python tools/validate_rule_lifecycle_policy.py: PASS"
|
||||
- "python tools/validate_rule_lifecycle_strict_v1.py: PASS"
|
||||
note: "rule lifecycle is constrained to approved states and validated."
|
||||
- id: P1-003
|
||||
status: PASS
|
||||
evidence:
|
||||
- "python tools/validate_low_n_pass_gate_v1.py: PASS"
|
||||
note: "low-N PASS gate is now explicitly blocked."
|
||||
- id: P1-004
|
||||
status: PASS
|
||||
evidence:
|
||||
- "Temp/final_context_for_llm_v1_validation.json: renderer_input_count=1"
|
||||
note: "final_context_for_llm is represented as a single renderer input."
|
||||
- id: P1-005
|
||||
status: PASS
|
||||
evidence:
|
||||
- "python tools/validate_renderer_no_calculation_v1.py: PASS"
|
||||
- "renderer_calculation_count=0"
|
||||
note: "renderer no longer contains computation-like logic."
|
||||
- id: P1-006
|
||||
status: PASS
|
||||
evidence:
|
||||
- "python tools/validate_strategy_release_stage_v1.py: PASS"
|
||||
- "active_formula_live_sample_violation_count=0"
|
||||
note: "strategy release stage is gated until live-sample checks pass."
|
||||
- id: P1-007
|
||||
status: PASS
|
||||
evidence:
|
||||
- "Temp/replay_live_separation_v1.json: replay_live_mix_count=0"
|
||||
- "Temp/replay_live_separation_v1.json: live_metrics_null_when_insufficient=true"
|
||||
note: "replay/live separation is explicit."
|
||||
- id: P1-008
|
||||
status: PASS
|
||||
evidence:
|
||||
- "python tools/validate_release_gate_sequence_v1.py: PASS"
|
||||
note: "release gate order is explicit and stable."
|
||||
- id: P1-009
|
||||
status: PASS
|
||||
evidence:
|
||||
- "Temp/failure_triage_v1.json: triage_count=0"
|
||||
note: "failure triage artifact exists and is wired."
|
||||
- id: P2-001
|
||||
status: PASS
|
||||
evidence:
|
||||
- "docs/doctrine.md exists"
|
||||
- "docs/runbook.md exists"
|
||||
- "prompts/report_renderer_prompt.md exists"
|
||||
- "prompts/engine_audit_prompt.md exists"
|
||||
note: "docs/prompt separation has been created."
|
||||
- id: P2-002
|
||||
status: PASS
|
||||
evidence:
|
||||
- "docs/adr/ADR-0001-single-source-of-truth.md exists"
|
||||
- "docs/adr/ADR-0002-gas-thin-adapter.md exists"
|
||||
- "docs/adr/ADR-0003-no-llm-numeric-generation.md exists"
|
||||
- "docs/adr/ADR-0004-shadow-before-active.md exists"
|
||||
note: "core structure-change reasons are recorded as ADRs."
|
||||
|
||||
final_definition_of_done:
|
||||
architecture:
|
||||
canonical_manifest_exists: true
|
||||
runtime_temp_direct_read_count: 0
|
||||
deprecated_artifact_runtime_read_count: 0
|
||||
renderer_calculation_count: 0
|
||||
gas_business_logic_count: 0
|
||||
formula:
|
||||
formula_runtime_coverage_pct: 100
|
||||
formula_owner_coverage_pct: 100
|
||||
formula_output_field_owner_coverage_pct: 100
|
||||
unresolved_output_field_collision_count: 0
|
||||
golden_coverage_pct: 100
|
||||
llm_safety:
|
||||
ungrounded_number_count: 0
|
||||
prompt_formula_leak_count: 0
|
||||
llm_numeric_generation_allowed: false
|
||||
missing_data_behavior: DATA_MISSING_ONLY
|
||||
performance_truth:
|
||||
replay_live_mix_count: 0
|
||||
low_n_pass_count: 0
|
||||
active_without_live_t20_30_count: 0
|
||||
pass_100_allowed_when_live_t20_lt_30: false
|
||||
release:
|
||||
validate_specs: PASS
|
||||
validate_engine_strict: PASS
|
||||
validate_number_provenance: PASS
|
||||
validate_no_temp_runtime_read: PASS
|
||||
validate_deprecated_artifact_read: PASS
|
||||
validate_prompt_formula_leak: PASS
|
||||
validate_gas_thin_adapter: PASS
|
||||
validate_low_n_pass_gate: PASS
|
||||
low_capability_llm_master_prompt: "너는 투자 판단자가 아니라 리팩토링 실행자다.\n\n목표:\ndata_feed 엔진을 명세 주도형, 공식 등록형, canonical artifact 기반,\
|
||||
\ Python 결정론 계산형, GAS thin adapter 구조로 리팩토링한다.\n\n절대 규칙:\n1. 가격·수량·비율·점수를 새로 만들지 않는다.\n2. spec/13_formula_registry.yaml에\
|
||||
\ 없는 공식명을 만들지 않는다.\n3. Temp의 다중 버전 파일을 runtime source로 직접 사용하지 않는다.\n4. canonical_manifest에 지정된 파일만 runtime source로 인정한다.\n\
|
||||
5. replay 성과를 live 성과로 말하지 않는다.\n6. live T+20 표본 30건 미만이면 active 또는 PASS_100으로 승격하지 않는다.\n7. 검증 실패를 설명으로 우회하지 않는다.\n8. 파일이\
|
||||
\ 없으면 DATA_MISSING으로 표시한다.\n9. 작업은 TODO 카드의 read_files, write_files, exact_steps, validation_commands, acceptance_criteria만\
|
||||
\ 따른다.\n10. 각 TODO 완료 후 result YAML만 출력한다.\n\n수행 순서:\nmaster_execution_order에 있는 순서대로 하나씩 수행한다.\n\n각 작업 완료 보고 형식:\nresult:\n\
|
||||
\ todo_id:\n status: PASS | FAIL | BLOCKED\n files_changed:\n validation_result:\n failed_reason:\n next_required_todo:\n\
|
||||
\n금지:\n- 임의 공식 추가\n- 임의 수치 보정\n- 하네스 FAIL 우회\n- deprecated artifact 사용\n- GAS에 신규 투자 판단 로직 추가\n- prompt에 가격·수량·임계값 계산 지시\
|
||||
\ 추가"
|
||||
@@ -0,0 +1,896 @@
|
||||
schema_version: quant_engine_structural_refactor_methodology_todo.v1.2026-06-07
|
||||
language: ko-KR
|
||||
document_type: contract_first_deterministic_quant_engine_refactor_todo
|
||||
generated_at_kst: '2026-06-07T00:00:00+09:00'
|
||||
download_filename: quant_engine_refactor_methodology_todo_20260607.yaml
|
||||
purpose: 현재 .md, .yaml, .gs, .py 중심의 엔진을 지속 확장 가능한 구조로 재정렬한다. 저성능 LLM도 이 TODO만 순서대로 실행하면 고성능 LLM과 동일한 판단 패킷과 보고서를 만들도록 권위
|
||||
파일, 공식, 데이터, 하네스, 검증, 릴리스 절차를 단일화한다.
|
||||
business_constants:
|
||||
target_asset_krw: 500000000
|
||||
default_investment_unit: weekly
|
||||
mandatory_weekly_rebalancing_days:
|
||||
- Saturday
|
||||
- Sunday
|
||||
mandatory_mid_month_review_days:
|
||||
- 1
|
||||
- 11
|
||||
- 21
|
||||
cash_defense_rule: D+2 정산예정 현금은 즉시현금 방어선 충족으로 간주
|
||||
llm_numeric_authority: LLM은 가격, 수량, 점수, TP, SL, 게이트를 생성하지 않고 하네스 값을 복사·해설만 한다.
|
||||
source_basis:
|
||||
primary_policy: data_feed/AGENTS.md
|
||||
critical_read_order:
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
- Temp/final_decision_packet_v3.json
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/12_field_dictionary.yaml
|
||||
- schemas/*.schema.json
|
||||
- governance/rules/*.yaml
|
||||
- spec/*.yaml
|
||||
current_hard_rules_from_agents:
|
||||
- 가격, 수량, TP, SL, 점수는 spec/13_formula_registry.yaml과 하네스 산출값만 사용한다.
|
||||
- 임의 계산, 임의 가격, 임의 수량, 미등록 공식은 금지한다.
|
||||
- 하네스 결측은 DATA_MISSING — 하네스 업데이트 필요로만 표시한다.
|
||||
- 차단된 종목의 산출값은 숨기지 말고 shadow ledger에 남긴다.
|
||||
- Python canonical first, GAS adapter second 원칙을 따른다.
|
||||
- Temp/*.json은 런타임 산출물이며 직접 편집하지 않는다.
|
||||
baseline_inventory_observed_from_zip:
|
||||
observed_total_files: 1623
|
||||
observed_extension_counts:
|
||||
.py: 717
|
||||
.json: 706
|
||||
.yaml: 137
|
||||
.md: 42
|
||||
.gs: 7
|
||||
.txt: 6
|
||||
.ps1: 4
|
||||
.jsonl: 2
|
||||
.log: 1
|
||||
.js: 1
|
||||
observed_top_directory_counts:
|
||||
Temp: 377
|
||||
src: 303
|
||||
tools: 266
|
||||
schemas: 160
|
||||
tests: 158
|
||||
runtime: 153
|
||||
spec: 104
|
||||
artifacts: 35
|
||||
governance: 24
|
||||
prompts: 9
|
||||
docs: 8
|
||||
examples: 8
|
||||
observed_python_distribution:
|
||||
runtime_generated_formula_py: 150
|
||||
src_quant_engine_py: 153
|
||||
tools_py: 261
|
||||
total_py_observed: 717
|
||||
observed_gas_files:
|
||||
- gas_apex_alpha_watch.gs
|
||||
- gas_apex_runtime_core.gs
|
||||
- gas_data_collect.gs
|
||||
- gas_data_feed.gs
|
||||
- gas_harness_rows.gs
|
||||
- gas_lib.gs
|
||||
- gas_report.gs
|
||||
observed_temp_duplicate_artifact_families_ge_3:
|
||||
count: 33
|
||||
examples:
|
||||
smart_cash_recovery: 7
|
||||
data_integrity_100_lock: 5
|
||||
horizon_routing_lock: 5
|
||||
canonical_metrics: 4
|
||||
final_execution_decision: 4
|
||||
prediction_accuracy_harness: 4
|
||||
engine_harness_gate_result: 3
|
||||
entry_freshness_gate: 3
|
||||
observed_package_json_scripts: 190
|
||||
observed_engine_gate_snapshot:
|
||||
engine_harness_gate_status: OK
|
||||
failed_checks_count: 0
|
||||
effective_formula_coverage_pct: 100.0
|
||||
gas_only_coverage_pct_observed: 58.56
|
||||
warn_only_measure_yaml_gs_ps_output: GAS-only/GS coverage warning exists; effective coverage is 100% because Python covers
|
||||
the missing formulas.
|
||||
observed_pass_100_snapshot:
|
||||
active_formula_id: PASS_100_CRITERIA_V3
|
||||
gate: BLOCK_EXECUTION
|
||||
score_0_100: 46.15
|
||||
passed_count: 6
|
||||
failed_count: 7
|
||||
hts_order_mode: THEORETICAL_ONLY
|
||||
observed_active_artifact_manifest_snapshot:
|
||||
formula_id: ACTIVE_ARTIFACT_MANIFEST_V2
|
||||
active_count_per_formula: 1
|
||||
authority_collision_count: 0
|
||||
stale_artifact_count: 0
|
||||
report_active_artifact_match_pct: 100.0
|
||||
single_truth_conflict_count: 0
|
||||
senior_diagnosis:
|
||||
one_line: 엔진은 이미 하네스·커버리지·검증은 많이 갖췄지만, 산출물 버전 과다, 문서 분산, GAS/Python 책임 혼재, release-gate 비대화로 장기 유지보수 리스크가 커졌다.
|
||||
core_problem:
|
||||
- 알고리즘 자체보다 알고리즘을 변경·검증·폐기하는 운영체계가 더 중요해진 단계다.
|
||||
- Temp 산출물 버전이 많아지면 저성능 LLM은 최신 권위와 레거시 참조를 구분하지 못한다.
|
||||
- 190개 npm script는 강력하지만, 단일 release DAG와 실패 원인 맵이 없으면 절차가 파편화된다.
|
||||
- GAS가 7개 파일로 유지되지만 일부 파일은 과거 로직이 남을 가능성이 있어 thin adapter 정책을 강제해야 한다.
|
||||
- 보고서/프롬프트/규칙 문서가 분산될수록 narrative가 하네스 판단을 완화하거나 과장할 위험이 생긴다.
|
||||
target_state:
|
||||
- YAML은 계약·공식·정책·테스트 케이스의 유일한 인간 편집 원천으로 둔다.
|
||||
- Python은 모든 공식과 판단의 canonical implementation으로 둔다.
|
||||
- GAS는 collect, normalize, export, display만 수행하는 thin adapter로 둔다.
|
||||
- Markdown은 설명, ADR, runbook, prompt 용도만 허용하고 판단 권위를 갖지 않는다.
|
||||
- JSON은 runtime 산출물로만 취급하고 source of truth가 되지 않게 한다.
|
||||
- LLM은 final_decision_packet과 active_artifact_manifest를 읽어 렌더링만 한다.
|
||||
recommended_methodology:
|
||||
name: 'CFD-QEOS: Contract-First Deterministic Quant Engineering Operating System'
|
||||
translation: 계약 우선·결정론적 퀀트 엔진 운영체계
|
||||
why_this_methodology:
|
||||
- 퀀트 엔진은 창의적 문서 작성 문제가 아니라 반복 가능한 산출물 생성 문제다.
|
||||
- 투자 판단은 경험칙이 아니라 입력 데이터, 공식, 게이트, 검증 결과의 함수여야 한다.
|
||||
- 저성능 LLM 호환성을 얻으려면 지시문을 늘리는 것이 아니라 자유도를 줄이고 입력·출력 계약을 고정해야 한다.
|
||||
- 장기 확장성은 새 팩터 추가 속도가 아니라 새 팩터가 기존 게이트와 충돌하지 않는지 증명하는 속도에서 나온다.
|
||||
five_non_negotiable_principles:
|
||||
P1_single_authority: 같은 의미의 필드는 active artifact가 1개만 존재해야 한다.
|
||||
P2_formula_registry_first: 새 숫자·점수·게이트는 먼저 formula registry에 등록하고, 단위·입력·결측 정책·owner·golden case를 명시한다.
|
||||
P3_python_canonical: 공식·판단·수량·TP/SL·리스크 스코어는 Python canonical 구현이 원본이다.
|
||||
P4_gas_thin_adapter: GAS는 외부 수집과 시트 입출력만 담당하며 투자 판단 로직을 보유하지 않는다.
|
||||
P5_renderer_no_calculation: Markdown 보고서와 LLM 응답은 계산하지 않고 final_decision_packet 값을 복사한다.
|
||||
allowed_source_extensions_policy:
|
||||
.yaml: contract, formula registry, data contract, policy, golden cases, release DAG, task plan
|
||||
.py: canonical engine, validator, builder, test, CLI wrapper
|
||||
.gs: Google Sheets/Apps Script thin adapter for collect-normalize-export-display only
|
||||
.md: runbook, ADR, doctrine, prompt, human explanation only; no numeric authority
|
||||
.json: generated runtime artifact only; do not hand-edit; not a durable source file
|
||||
canonical_dataflow:
|
||||
- raw_capture_or_sheet -> GAS collect/normalize/export
|
||||
- exported_data_json -> Python data contract validator
|
||||
- validated_data -> Python feature builders
|
||||
- features -> formula registry implementations
|
||||
- formula outputs -> gates and decision packet
|
||||
- decision packet -> active artifact manifest
|
||||
- manifest + packet -> report renderer
|
||||
- report renderer -> Markdown/LLM output with zero calculations
|
||||
release_lifecycle:
|
||||
- change_request_yaml 작성
|
||||
- ADR 또는 rule_lifecycle 항목 작성
|
||||
- spec/formula_registry 또는 relevant spec 갱신
|
||||
- schema/golden case 먼저 작성
|
||||
- Python canonical 구현
|
||||
- GAS adapter는 필요할 때만 thin wrapper 갱신
|
||||
- unit/parity/regression/e2e 검증
|
||||
- shadow ledger에서 N회 운용
|
||||
- performance readiness 기준 충족 시 active manifest 승격
|
||||
- 레거시 산출물은 legacy_reference_only로 잠그고 보고서 렌더링 차단
|
||||
target_repository_structure:
|
||||
AGENTS.md: 운영 헌법과 읽기 순서만 유지. 장문 규칙은 governance/rules와 spec으로 이동.
|
||||
spec/:
|
||||
role: source of truth for contracts, formulas, gates, schemas, field dictionary
|
||||
must_contain:
|
||||
- 00_execution_contract.yaml
|
||||
- 02_data_contract.yaml
|
||||
- 09_decision_flow.yaml
|
||||
- 12_field_dictionary.yaml
|
||||
- 13_formula_registry.yaml
|
||||
- risk/*.yaml
|
||||
- strategy/*.yaml
|
||||
- execution/*.yaml
|
||||
must_not_contain:
|
||||
- runtime outputs
|
||||
- temporary audit outputs
|
||||
- duplicated narrative prompts
|
||||
src/quant_engine/:
|
||||
role: canonical Python package
|
||||
proposed_modules:
|
||||
- data_contracts/
|
||||
- features/
|
||||
- formulas/
|
||||
- gates/
|
||||
- portfolio/
|
||||
- execution/
|
||||
- reporting/
|
||||
- evaluation/
|
||||
- adapters/
|
||||
tools/: thin CLI wrappers only; business logic must import src.quant_engine modules.
|
||||
gas_*.gs: collect/normalize/export/display only; forbidden decision logic count must trend to zero.
|
||||
governance/: ADR, change requests, rule lifecycle, authority matrix, release policy.
|
||||
tests/: unit, parity, golden, regression, integration, e2e, leak, deterministic replay.
|
||||
runtime/: active manifest and runtime config; no hand editing.
|
||||
Temp/: generated artifacts only; no manual source authority; cleanup policy required.
|
||||
prompts/: renderer prompts only; prompts cannot define formulas or override gates.
|
||||
docs/: doctrine and runbook only; docs must cite spec IDs rather than redefining rules.
|
||||
governance_score_formulas:
|
||||
authority_integrity_score:
|
||||
formula: 100 - 25*authority_collision_count - 10*stale_artifact_count - 10*legacy_reference_render_blocked_count - 5*duplicate_active_formula_count
|
||||
pass_threshold: 100
|
||||
block_threshold: < 95
|
||||
llm_hallucination_risk_score:
|
||||
formula: 20*missing_provenance_number_count + 15*renderer_calculation_count + 10*free_text_override_count + 10*data_missing_hidden_count
|
||||
pass_threshold: 0
|
||||
block_threshold: '> 0'
|
||||
formula_implementation_score:
|
||||
formula: 100 * implemented_formula_count / registered_formula_count
|
||||
pass_threshold: 100
|
||||
low_capability_reproducibility_score:
|
||||
formula: 100 - 20*non_deterministic_output_count - 10*ambiguous_instruction_count - 10*manual_selection_count - 10*missing_acceptance_test_count
|
||||
pass_threshold: 100
|
||||
quant_performance_readiness_score:
|
||||
formula: min(data_maturity_score, live_sample_score, prediction_quality_score, drawdown_control_score, execution_quality_score)
|
||||
pass_threshold: 90
|
||||
note: 평균이 아니라 최저축 기준. 약한 축 하나가 있으면 실전 승격 불가.
|
||||
harness_suite_to_standardize:
|
||||
- harness_id: H01_DATA_CONTRACT_GATE
|
||||
purpose: 필수 컬럼, 타입, 단위, 통화, 날짜, 원천, 결측 정책 검증
|
||||
block_if:
|
||||
- missing_critical_field_count > 0
|
||||
- schema_presence_score < 100
|
||||
- stale_data_ratio > 0
|
||||
- harness_id: H02_FORMULA_REGISTRY_GATE
|
||||
purpose: 모든 공식이 registry, Python implementation, golden case, owner ledger를 갖는지 검증
|
||||
block_if:
|
||||
- unmapped_formula_count > 0
|
||||
- implementation_coverage_pct < 100
|
||||
- harness_id: H03_SINGLE_TRUTH_GATE
|
||||
purpose: 동일 필드가 여러 active artifact에 존재하는지 검증
|
||||
block_if:
|
||||
- authority_collision_count > 0
|
||||
- single_truth_conflict_count > 0
|
||||
- harness_id: H04_DETERMINISTIC_REPLAY_GATE
|
||||
purpose: 같은 입력 해시에서 같은 final_decision_packet이 나오는지 검증
|
||||
block_if:
|
||||
- decision_reproducibility_score < 1.0
|
||||
- harness_id: H05_NO_LEAKAGE_GATE
|
||||
purpose: T+5/T+20 결과값이 신호 생성 시점 입력에 섞이지 않았는지 검증
|
||||
block_if:
|
||||
- future_leakage_count > 0
|
||||
- train_test_overlap_count > 0
|
||||
- harness_id: H06_PERFORMANCE_READINESS_GATE
|
||||
purpose: 리플레이와 라이브 표본을 분리해 실제 승격 가능성을 평가
|
||||
block_if:
|
||||
- live_t20_count < 30
|
||||
- performance_readiness_score < 90
|
||||
- harness_id: H07_EXECUTION_PRECEDENCE_GATE
|
||||
purpose: 하위 엔진 허용값이 최종 HTS 권한을 침범하지 못하게 차단
|
||||
block_if:
|
||||
- global_execution_gate != HTS_READY and hts_order_count > 0
|
||||
- misleading_execution_allowed_count > 0
|
||||
- harness_id: H08_GAS_THIN_ADAPTER_GATE
|
||||
purpose: GAS 파일에 decision/sizing/stop/take_profit/risk_score 로직이 남아 있는지 검출
|
||||
block_if:
|
||||
- gas_forbidden_logic_count > 0
|
||||
- harness_id: H09_RENDERER_NO_CALC_GATE
|
||||
purpose: 보고서와 LLM 응답의 임의 계산, 숫자 창작, 게이트 완화 표현 차단
|
||||
block_if:
|
||||
- renderer_calculation_count > 0
|
||||
- unproven_number_count > 0
|
||||
- harness_id: H10_RELEASE_DAG_GATE
|
||||
purpose: 190개 스크립트를 단일 release graph로 정렬하고 선행 실패를 명확히 보고
|
||||
block_if:
|
||||
- release_dag_cycle_count > 0
|
||||
- required_gate_missing_count > 0
|
||||
refactor_todo:
|
||||
- id: P0-001
|
||||
priority: P0
|
||||
title: Source Authority Collapse — 파일 권위 체계 4계층으로 축소
|
||||
problem: 문서와 산출물이 많아지면서 저성능 LLM이 spec, prompt, Temp artifact, report 중 무엇이 최신 권위인지 혼동할 수 있다.
|
||||
methodology: repo_cartography + authority_matrix + runtime_manifest_lock
|
||||
target_state: 권위는 spec YAML, 구현은 Python, 어댑터는 GAS, 설명은 Markdown으로 분리하고 JSON은 생성물로만 둔다.
|
||||
files_to_create_or_modify:
|
||||
- AGENTS.md
|
||||
- governance/authority_matrix.yaml
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
- tools/validate_source_authority_collapse_v1.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- 모든 파일을 extension과 directory 기준으로 분류한다.
|
||||
- .yaml 파일은 contract/formula/policy/golden_case/release_dag 중 하나의 role을 부여한다.
|
||||
- .py 파일은 canonical_module, cli_wrapper, validator, generated_model 중 하나의 role을 부여한다.
|
||||
- .gs 파일은 collect, normalize, export, display 외 role이 있으면 forbidden으로 표시한다.
|
||||
- .md 파일은 doctrine, ADR, runbook, prompt 중 하나의 role만 허용한다.
|
||||
- role이 없는 파일은 quarantine_candidate로 기록하고 runtime에서 읽지 않는다.
|
||||
- active_artifact_manifest는 final_decision_packet과 canonical artifact만 참조하게 한다.
|
||||
acceptance_tests:
|
||||
- python tools/validate_source_authority_collapse_v1.py --root . --out Temp/source_authority_collapse_v1.json
|
||||
- Temp/source_authority_collapse_v1.json.unclassified_source_file_count == 0
|
||||
- Temp/source_authority_collapse_v1.json.json_source_authority_count == 0
|
||||
- Temp/source_authority_collapse_v1.json.markdown_numeric_authority_count == 0
|
||||
completion_metric: authority_integrity_score == 100
|
||||
fail_policy: FAIL이면 보고서는 RELEASE_BLOCKED_BY_AUTHORITY_AMBIGUITY로 시작하고 신규 기능 병합 금지.
|
||||
depends_on: []
|
||||
- id: P0-002
|
||||
priority: P0
|
||||
title: Formula Registry V2 — 모든 숫자의 owner, 단위, 입력, 결측, 구현 연결
|
||||
problem: 공식 수가 늘어날수록 미등록 숫자와 임의 계산이 가장 큰 홀루시네이션 원인이 된다.
|
||||
methodology: formula_contract_before_implementation
|
||||
target_state: spec/13_formula_registry.yaml 하나로 모든 점수·가격·수량·게이트·리스크 지표의 권위를 고정한다.
|
||||
files_to_create_or_modify:
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/03_formulas/output_field_owner_ledger.yaml
|
||||
- tools/validate_formula_registry_v2.py
|
||||
- tests/golden/formula_registry_v2_cases.yaml
|
||||
step_by_step_for_low_capability_llm:
|
||||
- 각 formula_id에 purpose, owner, inputs, input_units, output_unit, missing_policy, stale_policy, python_impl, golden_case_id,
|
||||
report_fields를 추가한다.
|
||||
- 공식이 가격을 내면 tick_normalizer 공식 ID를 반드시 연결한다.
|
||||
- 공식이 수량을 내면 position_sizing 또는 execution_contract 공식 ID를 반드시 연결한다.
|
||||
- 공식이 게이트를 내면 fail_policy와 downstream_block_targets를 반드시 연결한다.
|
||||
- report_fields에 없는 숫자는 Markdown 보고서에 출력하지 않는다.
|
||||
- formula registry에 없는 숫자는 DATA_MISSING이 아니라 FORMULA_UNREGISTERED로 차단한다.
|
||||
acceptance_tests:
|
||||
- python tools/validate_formula_registry_v2.py --registry spec/13_formula_registry.yaml
|
||||
- unowned_formula_count == 0
|
||||
- missing_python_impl_count == 0
|
||||
- missing_golden_case_count == 0
|
||||
- unregistered_report_number_count == 0
|
||||
completion_metric: formula_implementation_score == 100
|
||||
fail_policy: FAIL이면 해당 공식 산출물은 active manifest 승격 금지. 보고서에는 FORMULA_UNREGISTERED만 출력.
|
||||
depends_on:
|
||||
- P0-001
|
||||
- id: P0-003
|
||||
priority: P0
|
||||
title: Decision Packet Monolith — 최종 판단 패킷 하나만 보고서 입력으로 허용
|
||||
problem: 보고서가 여러 Temp 산출물을 직접 읽으면 최신값/레거시값이 섞이고 수치 충돌이 발생한다.
|
||||
methodology: single_packet_rendering + provenance_lock
|
||||
target_state: 보고서 렌더러는 Temp/final_decision_packet_v4.json 또는 active manifest가 지정한 단일 패킷만 읽는다.
|
||||
files_to_create_or_modify:
|
||||
- spec/40_final_decision_packet_contract.yaml
|
||||
- tools/build_final_decision_packet_v4.py
|
||||
- tools/validate_final_decision_packet_v4.py
|
||||
- tools/render_operational_report.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- final_decision_packet_contract에 executive, portfolio, ticker, risk, execution, performance, data_quality 섹션을 정의한다.
|
||||
- 각 섹션의 모든 숫자는 source_path, json_pointer, formula_id, input_hash를 갖게 한다.
|
||||
- render_operational_report.py에서 Temp 하위 artifact 직접 읽기를 제거한다.
|
||||
- 렌더러가 추가 데이터가 필요하면 packet에 필드를 먼저 추가하고 다시 빌드한다.
|
||||
- legacy artifact는 packet builder만 읽을 수 있고 report renderer는 읽지 못하게 한다.
|
||||
acceptance_tests:
|
||||
- python tools/validate_final_decision_packet_v4.py --packet Temp/final_decision_packet_v4.json
|
||||
- python tools/validate_renderer_reads_packet_only_v1.py --renderer tools/render_operational_report.py
|
||||
- direct_temp_artifact_read_count_in_renderer == 0
|
||||
- packet_field_provenance_coverage_pct == 100
|
||||
completion_metric: packet_provenance_coverage_pct == 100 and direct_temp_read_count == 0
|
||||
fail_policy: FAIL이면 Markdown 생성 차단. LLM 응답은 final_decision_packet_missing_or_invalid만 표시.
|
||||
depends_on:
|
||||
- P0-001
|
||||
- P0-002
|
||||
- id: P0-004
|
||||
priority: P0
|
||||
title: Release DAG V1 — 190개 script를 단일 유향 비순환 그래프로 정렬
|
||||
problem: 스크립트가 많으면 검증은 많은데 어떤 실패가 상위 실패인지 알기 어렵고, 저성능 LLM은 순서를 흔든다.
|
||||
methodology: DAG_orchestration + fail_fast_root_cause
|
||||
target_state: release_dag.yaml에 build, validate, render, package 단계를 명시하고 npm script는 DAG executor 하나로 수렴한다.
|
||||
files_to_create_or_modify:
|
||||
- spec/41_release_dag.yaml
|
||||
- tools/run_release_dag_v1.py
|
||||
- tools/validate_release_dag_v1.py
|
||||
- package.json
|
||||
step_by_step_for_low_capability_llm:
|
||||
- package.json scripts를 inventory로 추출한다.
|
||||
- 각 script를 build, validate, render, package, utility 중 하나로 분류한다.
|
||||
- script 간 depends_on을 release_dag.yaml에 명시한다.
|
||||
- DAG에 cycle이 있으면 즉시 실패 처리한다.
|
||||
- 동일 산출물을 여러 script가 만들면 artifact_owner를 1개만 남긴다.
|
||||
- npm run full-gate는 python tools/run_release_dag_v1.py --mode release 호출로 축소한다.
|
||||
acceptance_tests:
|
||||
- python tools/validate_release_dag_v1.py --dag spec/41_release_dag.yaml --package package.json
|
||||
- release_dag_cycle_count == 0
|
||||
- orphan_script_count == 0
|
||||
- duplicate_artifact_owner_count == 0
|
||||
- release_mode_required_gate_missing_count == 0
|
||||
completion_metric: release_dag_health_score == 100
|
||||
fail_policy: FAIL이면 release-gate 실행 금지. 가장 앞선 실패 노드 1개와 downstream skipped 목록만 출력.
|
||||
depends_on:
|
||||
- P0-001
|
||||
- id: P0-005
|
||||
priority: P0
|
||||
title: Temp Artifact Retirement — 산출물 버전 과다 정리와 active/legacy 격리
|
||||
problem: Temp에 동일 family의 v1~vN 산출물이 누적되어 최신 권위와 참고용 레거시가 섞일 위험이 있다.
|
||||
methodology: active_manifest + quarantine_before_delete
|
||||
target_state: active artifact는 formula_id별 1개만 runtime에서 읽고, 나머지는 legacy_reference_only 또는 archive로 이동한다.
|
||||
files_to_create_or_modify:
|
||||
- tools/build_artifact_retirement_plan_v1.py
|
||||
- tools/validate_artifact_retirement_v1.py
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
- governance/rules/05_migration_hashes.yaml
|
||||
step_by_step_for_low_capability_llm:
|
||||
- Temp/*.json, Temp/*.yaml, Temp/*.md 파일을 formula family별로 그룹화한다.
|
||||
- 각 family에서 active artifact 1개를 active_artifact_manifest와 비교한다.
|
||||
- active가 아닌 파일은 legacy_reference_only, archive_candidate, delete_candidate 중 하나로 분류한다.
|
||||
- 보고서와 LLM이 legacy_reference_only를 직접 읽으면 stale_artifact_count를 증가시킨다.
|
||||
- 아카이브 전 파일 hash를 governance/rules/05_migration_hashes.yaml에 남긴다.
|
||||
- delete는 하지 말고 1차는 quarantine manifest만 만든다.
|
||||
acceptance_tests:
|
||||
- python tools/build_artifact_retirement_plan_v1.py --temp Temp --manifest runtime/active_artifact_manifest.yaml --out Temp/artifact_retirement_plan_v1.json
|
||||
- python tools/validate_artifact_retirement_v1.py --plan Temp/artifact_retirement_plan_v1.json
|
||||
- active_count_per_formula == 1
|
||||
- report_legacy_direct_read_count == 0
|
||||
- authority_collision_count == 0
|
||||
completion_metric: active_count_per_formula == 1 and stale_artifact_count == 0
|
||||
fail_policy: FAIL이면 legacy artifact가 포함된 보고서 렌더링 차단.
|
||||
depends_on:
|
||||
- P0-003
|
||||
- id: P0-006
|
||||
priority: P0
|
||||
title: GAS Thin Adapter Migration — Apps Script에서 판단 로직 제거
|
||||
problem: GAS와 Python이 동시에 판단하면 같은 공식의 결과가 미세하게 갈라지고 디버깅 비용이 폭증한다.
|
||||
methodology: extract_business_logic_to_python + adapter_parity_test
|
||||
target_state: GAS는 collect, normalize, export, display만 수행하고 decision/sizing/stop/take_profit/risk_score는 Python으로 이전한다.
|
||||
files_to_create_or_modify:
|
||||
- spec/39_gas_thin_adapter_policy.yaml
|
||||
- tools/audit_gas_business_logic_v2.py
|
||||
- tools/validate_gas_thin_adapter_v2.py
|
||||
- gas_*.gs
|
||||
- src/quant_engine/adapters/google_sheets.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- GAS 모든 함수를 파싱해 함수명, 호출자, 키워드, 라인 수를 추출한다.
|
||||
- decision, sizing, stop_loss, take_profit, risk_score, score, gate 키워드를 forbidden 후보로 분류한다.
|
||||
- forbidden 후보가 실제 투자 판단이면 Python src/quant_engine 모듈로 이관한다.
|
||||
- GAS에는 Python 산출물 또는 시트 값을 읽고 표시하는 wrapper만 남긴다.
|
||||
- GAS 라인 수 감소보다 forbidden_logic_count 감소를 KPI로 삼는다.
|
||||
- 이관 후 동일 입력에서 GAS 표시값과 Python packet 값의 parity를 검사한다.
|
||||
acceptance_tests:
|
||||
- python tools/audit_gas_business_logic_v2.py --root . --out Temp/gas_business_logic_audit_v2.json
|
||||
- python tools/validate_gas_thin_adapter_v2.py --audit Temp/gas_business_logic_audit_v2.json
|
||||
- gas_forbidden_logic_count == 0
|
||||
- gas_python_display_parity_pct == 100
|
||||
completion_metric: gas_forbidden_logic_count == 0
|
||||
fail_policy: FAIL이면 GAS 산출값은 display_only로 표시하고 final_decision_packet에 반영 금지.
|
||||
depends_on:
|
||||
- P0-002
|
||||
- id: P0-007
|
||||
priority: P0
|
||||
title: Renderer No-Calculation Lock — 보고서와 LLM 응답 계산 금지
|
||||
problem: 보고서가 보기 좋게 만들기 위해 계산을 시작하면 하네스와 숫자가 다르게 된다.
|
||||
methodology: render_contract + static_analysis + packet_provenance_check
|
||||
target_state: renderer와 prompt는 packet 값 복사, 정렬, 누락 표시, 위험 해설만 수행한다.
|
||||
files_to_create_or_modify:
|
||||
- spec/42_renderer_contract.yaml
|
||||
- prompts/low_capability_report_renderer.md
|
||||
- tools/validate_renderer_no_calculation_v2.py
|
||||
- tools/validate_llm_response_contract_v4.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- 보고서 섹션별 허용 필드를 final_decision_packet_contract와 1:1 매핑한다.
|
||||
- 렌더러에서 +, -, *, /, round, percent 계산 사용을 금지하거나 whitelist한다.
|
||||
- 숫자를 출력할 때 provenance가 없으면 DATA_MISSING 또는 FORMULA_UNREGISTERED로 표시한다.
|
||||
- LLM 프롬프트에서 '추정', '대략', '내 계산상' 같은 임의 숫자 문구를 금지한다.
|
||||
- blocked/limited 종목도 산출된 가격·수량은 shadow ledger에 표시한다.
|
||||
- 게이트가 AUDIT_ONLY이면 모든 주문표를 THEORETICAL_ONLY로 표시한다.
|
||||
acceptance_tests:
|
||||
- python tools/validate_renderer_no_calculation_v2.py --renderer tools/render_operational_report.py
|
||||
- python tools/validate_llm_response_contract_v4.py --report Temp/operational_report.md --packet Temp/final_decision_packet_v4.json
|
||||
- renderer_calculation_count == 0
|
||||
- unproven_number_count == 0
|
||||
- gate_softening_phrase_count == 0
|
||||
completion_metric: llm_hallucination_risk_score == 0
|
||||
fail_policy: FAIL이면 보고서 첫 줄에 RENDERER_CONTRACT_FAIL 표시 후 투자 액션 출력 금지.
|
||||
depends_on:
|
||||
- P0-003
|
||||
- id: P0-008
|
||||
priority: P0
|
||||
title: PASS_100 Honest Gate — 실행 가능성과 보고 가능성 분리
|
||||
problem: 현재 PASS_100이 BLOCK_EXECUTION이면 보고서는 가능해도 실제 HTS 주문은 이론값이어야 한다.
|
||||
methodology: truth_gate_before_execution_gate
|
||||
target_state: PASS_100 미달 시 모든 주문은 shadow/theoretical로 유지하고, 실전 실행은 HTS_READY와 live readiness를 모두 통과할 때만 허용한다.
|
||||
files_to_create_or_modify:
|
||||
- spec/30_completion_criteria_contract.yaml
|
||||
- tools/build_pass_100_criteria_v4.py
|
||||
- tools/validate_pass_100_honest_v2.py
|
||||
- tools/build_final_execution_decision_v5.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- PASS_100 기준을 data, formula, truth, performance, execution, renderer, authority 축으로 나눈다.
|
||||
- 각 기준은 actual, target, passed, source_json, formula_id, remediation을 갖게 한다.
|
||||
- 실패 기준이 DATA_GATED이면 예상 해소 조건만 표시하고 임의 우회 금지한다.
|
||||
- 실패 기준이 CODE_GATED이면 수정 파일과 테스트를 명시한다.
|
||||
- FINAL_EXECUTION_HTS_READY가 false이면 hts_order_count는 반드시 0이어야 한다.
|
||||
- PASS_100 미달이어도 리밸런싱 제안은 가능하지만 주문 실행 문구는 금지한다.
|
||||
acceptance_tests:
|
||||
- python tools/build_pass_100_criteria_v4.py --out Temp/pass_100_criteria_v4.json
|
||||
- python tools/validate_pass_100_honest_v2.py --criteria Temp/pass_100_criteria_v4.json --execution Temp/final_execution_decision_v5.json
|
||||
- if pass_100_allowed == false then hts_order_mode == THEORETICAL_ONLY
|
||||
- if global_execution_gate != HTS_READY then hts_order_count == 0
|
||||
completion_metric: execution_ambiguity_count == 0
|
||||
fail_policy: FAIL이면 HTS 주문표 렌더링 전체 차단. shadow ledger만 출력.
|
||||
depends_on:
|
||||
- P0-003
|
||||
- P0-007
|
||||
- id: P1-009
|
||||
priority: P1
|
||||
title: Quant Factor Taxonomy — 단타/단기/중기/장기 팩터 계층화
|
||||
problem: 팩터가 늘면 투자기간별 의미가 섞여 뒷북 매수와 설거지 매수를 동시에 강화할 수 있다.
|
||||
methodology: horizon_specific_factor_contract
|
||||
target_state: 각 팩터는 horizon, decay, required_sample, market_regime, conflict_policy를 갖는다.
|
||||
files_to_create_or_modify:
|
||||
- spec/43_quant_factor_taxonomy.yaml
|
||||
- spec/strategy/*.yaml
|
||||
- tools/validate_factor_taxonomy_v1.py
|
||||
- src/quant_engine/features/
|
||||
step_by_step_for_low_capability_llm:
|
||||
- 모든 팩터를 scalping, short, mid, long 중 하나 이상의 horizon에 배정한다.
|
||||
- 각 팩터에 expected_decay_days와 rebalance_frequency를 명시한다.
|
||||
- 단타 팩터가 장기 보유 판단을 override하지 못하게 precedence를 정의한다.
|
||||
- 장기 펀더멘털 팩터가 당일 실행 가격을 직접 만들지 못하게 차단한다.
|
||||
- 스마트머니, 유동성, 펀더멘털, 모멘텀, 리스크 팩터의 conflict_policy를 정의한다.
|
||||
- 상충 시 평균을 내지 말고 gate precedence로 결론을 낸다.
|
||||
acceptance_tests:
|
||||
- python tools/validate_factor_taxonomy_v1.py --taxonomy spec/43_quant_factor_taxonomy.yaml --registry spec/13_formula_registry.yaml
|
||||
- unassigned_factor_count == 0
|
||||
- horizon_conflict_without_policy_count == 0
|
||||
- factor_without_decay_count == 0
|
||||
completion_metric: factor_taxonomy_coverage_pct == 100
|
||||
fail_policy: FAIL이면 신규 팩터 active 승격 금지. 기존 보고서에는 FACTOR_TAXONOMY_PENDING으로 표시.
|
||||
depends_on:
|
||||
- P0-002
|
||||
- id: P1-010
|
||||
priority: P1
|
||||
title: Anti-Late-Chase / Anti-Distribution Harness — 뒷북·설거지 방지 전용 게이트
|
||||
problem: 추세 후행 신호가 강해질수록 사용자는 고점 매수와 저점 매도를 반복할 수 있다.
|
||||
methodology: pre_trade_gate + forward_return_calibration
|
||||
target_state: 진입 전 5D/20D 과열, pullback quality, volume exhaustion, foreign/institution flow, distribution risk를 독립 차단 게이트로
|
||||
둔다.
|
||||
files_to_create_or_modify:
|
||||
- spec/strategy/anti_late_entry_pullback_gate_v5.yaml
|
||||
- spec/strategy/pre_distribution_early_warning_v4.yaml
|
||||
- tools/build_anti_late_chase_v5.py
|
||||
- tools/validate_anti_distribution_v4.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- 각 후보 종목에 5D return, 20D return, MA20 distance, RSI, 거래대금 배율, 수급 3D/5D, 음봉 거래량을 계산한다.
|
||||
- 5일 급등 후 pullback_quality가 기준 미달이면 BUY가 아니라 WAIT_PULLBACK으로 둔다.
|
||||
- distribution_score가 기준 이상이면 신규매수는 BLOCK, 보유는 TRIM_REVIEW로 둔다.
|
||||
- late_chase_false_positive_rate를 T+5/T+20 결과로 매주 재계산한다.
|
||||
- threshold 변경은 calibration_change_ledger에 변경 전후 승률과 MDD를 기록한다.
|
||||
- 저성능 LLM은 신호 해석을 하지 말고 gate 결과와 reason_code만 복사한다.
|
||||
acceptance_tests:
|
||||
- python tools/build_anti_late_chase_v5.py --json GatherTradingData.json --out Temp/anti_late_chase_v5.json
|
||||
- python tools/validate_anti_distribution_v4.py --out Temp/anti_distribution_validation_v4.json
|
||||
- buy_after_5d_runup_without_pullback_count == 0
|
||||
- distribution_confirmed_buy_count == 0
|
||||
- late_chase_false_positive_rate <= 20
|
||||
completion_metric: late_chase_false_positive_rate <= 20 and distribution_confirmed_buy_count == 0
|
||||
fail_policy: FAIL이면 신규 BUY/ADD_ON은 SHADOW_LEDGER_ONLY. 기존 포지션은 보유/감축 판단만 허용.
|
||||
depends_on:
|
||||
- P1-009
|
||||
- id: P1-011
|
||||
priority: P1
|
||||
title: Backtest/Replay/Live Separation — 리플레이 성과와 실전 성과 분리
|
||||
problem: 리플레이 성과가 좋아도 live 표본이 부족하면 실제 실행 엔진으로 승격하면 안 된다.
|
||||
methodology: evidence_segregation + promotion_gate
|
||||
target_state: backtest, replay, paper, live를 분리하고 각 단계별 승격 기준을 명확히 둔다.
|
||||
files_to_create_or_modify:
|
||||
- spec/29_backtest_harness_contract.yaml
|
||||
- spec/44_live_replay_separation.yaml
|
||||
- tools/build_live_replay_separation_v2.py
|
||||
- tools/validate_no_replay_live_mix_v1.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- 모든 outcome row에 source_type을 backtest, replay, paper, live 중 하나로 부여한다.
|
||||
- live가 아닌 성과는 HTS_READY 승격 기준에 직접 사용하지 않는다.
|
||||
- T+5, T+20, T+60 각각 required_live_sample을 정의한다.
|
||||
- 성과 지표는 hit_rate, payoff_ratio, avg_return, median_return, max_drawdown, turnover, slippage를 함께 기록한다.
|
||||
- 리플레이에서 개선된 threshold는 shadow로 N회 운용 후 live 승격한다.
|
||||
- 데이터 부족은 실패가 아니라 WAIT_SAMPLE로 보고하되 주문 실행에는 사용하지 않는다.
|
||||
acceptance_tests:
|
||||
- python tools/build_live_replay_separation_v2.py --hist Temp/proposal_evaluation_history.json --out Temp/live_replay_separation_v2.json
|
||||
- python tools/validate_no_replay_live_mix_v1.py --json Temp/live_replay_separation_v2.json
|
||||
- replay_used_as_live_count == 0
|
||||
- live_t20_count >= 30 before performance_ready == true
|
||||
completion_metric: replay_live_mix_count == 0
|
||||
fail_policy: FAIL이면 performance_ready=false, PASS_100 해당 기준 실패 유지.
|
||||
depends_on:
|
||||
- P0-008
|
||||
- id: P1-012
|
||||
priority: P1
|
||||
title: Data Provenance Ledger — 모든 숫자에 원천과 신선도 부착
|
||||
problem: 출처와 시간 정보 없는 숫자는 그럴듯하지만 투자 엔진에서는 독이다.
|
||||
methodology: provenance_everywhere + stale_data_gate
|
||||
target_state: 모든 report number는 source_path, json_pointer, formula_id, input_hash, as_of, freshness_status를 갖는다.
|
||||
files_to_create_or_modify:
|
||||
- spec/45_number_provenance_contract.yaml
|
||||
- tools/build_number_provenance_ledger_v4.py
|
||||
- tools/validate_number_provenance_strict_v3.py
|
||||
- src/quant_engine/reporting/provenance.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- final_decision_packet의 모든 leaf 숫자를 순회한다.
|
||||
- 각 숫자가 provenance 객체를 갖지 않으면 violation으로 기록한다.
|
||||
- 시장 데이터는 as_of와 market_session을 기록한다.
|
||||
- 계좌 데이터는 capture_time과 D+2 정산현금 포함 여부를 기록한다.
|
||||
- 결측 또는 오래된 값은 confidence cap을 적용하고 신규 매수 게이트에 반영한다.
|
||||
- Markdown에 출력되는 숫자와 packet provenance를 1:1 대조한다.
|
||||
acceptance_tests:
|
||||
- python tools/build_number_provenance_ledger_v4.py --packet Temp/final_decision_packet_v4.json --out Temp/number_provenance_ledger_v4.json
|
||||
- python tools/validate_number_provenance_strict_v3.py --ledger Temp/number_provenance_ledger_v4.json --report Temp/operational_report.md
|
||||
- number_provenance_coverage_pct == 100
|
||||
- stale_critical_number_count == 0
|
||||
- unproven_report_number_count == 0
|
||||
completion_metric: number_provenance_coverage_pct == 100
|
||||
fail_policy: FAIL이면 미증빙 숫자는 보고서에서 숨기지 말고 DATA_MISSING_PROVENANCE로 표시. 주문 판단에는 사용 금지.
|
||||
depends_on:
|
||||
- P0-003
|
||||
- P0-007
|
||||
- id: P1-013
|
||||
priority: P1
|
||||
title: Portfolio Risk Budget Cascade — 목표 5억까지 손실 방어 우선순위 수치화
|
||||
problem: 목표금액 5억에 가까워질수록 수익률보다 손실 방어와 현금 방어선이 더 중요해진다.
|
||||
methodology: risk_budget_before_alpha
|
||||
target_state: 총자산, 목표갭, 현금비율, 포지션 heat, 섹터 집중도, beta, drawdown을 하나의 risk budget cascade로 묶는다.
|
||||
files_to_create_or_modify:
|
||||
- spec/36_goal_risk_budget_harness.yaml
|
||||
- spec/risk/aggregate_risk.yaml
|
||||
- tools/build_goal_risk_budget_harness_v3.py
|
||||
- tools/validate_risk_budget_cascade_v1.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- 총자산과 목표 5억의 gap_pct를 계산한다.
|
||||
- gap이 작아질수록 신규 위성 매수 한도를 자동 축소한다.
|
||||
- D+2 정산현금을 immediate_cash_equivalent로 포함한다.
|
||||
- 현금 방어선 미달이면 BUY보다 cash_recovery와 trim_review를 우선한다.
|
||||
- 섹터 집중도, 단일종목 비중, beta, 손실률을 total_heat로 통합한다.
|
||||
- risk_budget이 부족하면 알파 점수가 높아도 수량을 줄인다.
|
||||
acceptance_tests:
|
||||
- python tools/build_goal_risk_budget_harness_v3.py --json GatherTradingData.json --out Temp/goal_risk_budget_harness_v3.json
|
||||
- python tools/validate_risk_budget_cascade_v1.py --json Temp/goal_risk_budget_harness_v3.json
|
||||
- cash_equivalent_includes_d_plus_2 == true
|
||||
- risk_budget_overrun_order_count == 0
|
||||
- portfolio_heat_field_present == true
|
||||
completion_metric: risk_budget_violation_count == 0
|
||||
fail_policy: FAIL이면 신규매수 차단, 리밸런싱/현금회복/위험감축 제안만 허용.
|
||||
depends_on:
|
||||
- P0-002
|
||||
- P1-012
|
||||
- id: P2-014
|
||||
priority: P2
|
||||
title: Document Shrink & Doctrine Split — 문서 과다를 3종으로 축소
|
||||
problem: 문서가 많으면 지침 충돌이 늘고, 긴 프롬프트는 저성능 LLM에서 오히려 일관성을 해친다.
|
||||
methodology: doctrine_minimalism + yaml_rule_authority
|
||||
target_state: Markdown은 doctrine, runbook, ADR 세 종류로만 남기고 세부 규칙은 YAML spec으로 이동한다.
|
||||
files_to_create_or_modify:
|
||||
- docs/doctrine.md
|
||||
- docs/runbook.md
|
||||
- governance/adr_index.yaml
|
||||
- tools/validate_docs_no_rule_duplication_v1.py
|
||||
- prompts/*.md
|
||||
step_by_step_for_low_capability_llm:
|
||||
- 모든 .md 파일을 doctrine, runbook, ADR, prompt, report_sample 중 하나로 분류한다.
|
||||
- Markdown 내부의 숫자 공식, 임계값, 권위 규칙을 찾아 spec YAML로 이동한다.
|
||||
- Markdown에는 spec ID 링크만 남긴다.
|
||||
- prompt는 입력/출력 형식과 금지사항만 포함하고 투자 이론을 중복 설명하지 않는다.
|
||||
- AGENTS.md는 읽기 순서와 하드 룰만 유지하고 200줄 이하를 목표로 한다.
|
||||
- 변경 후 validate_docs_no_rule_duplication을 실행한다.
|
||||
acceptance_tests:
|
||||
- python tools/validate_docs_no_rule_duplication_v1.py --root . --out Temp/docs_rule_duplication_v1.json
|
||||
- markdown_rule_duplication_count == 0
|
||||
- prompt_formula_definition_count == 0
|
||||
- agents_md_line_count <= 200
|
||||
completion_metric: markdown_rule_duplication_count == 0
|
||||
fail_policy: FAIL이면 문서 변경은 병합 가능하지만 release gate 승격 금지. 중복 규칙은 spec YAML로 이관할 때까지 보류.
|
||||
depends_on:
|
||||
- P0-001
|
||||
- P0-002
|
||||
- id: P2-015
|
||||
priority: P2
|
||||
title: Change Request Discipline — 새 팩터/규칙/문서 추가의 표준 절차
|
||||
problem: 좋은 아이디어라도 검증 없이 추가되면 엔진은 똑똑해지는 것이 아니라 불안정해진다.
|
||||
methodology: CR -> shadow -> evidence -> active -> retire
|
||||
target_state: 모든 변경은 change_request YAML과 ADR/rule_lifecycle을 거쳐 shadow -> active로 승격한다.
|
||||
files_to_create_or_modify:
|
||||
- governance/change_request_template.yaml
|
||||
- governance/rule_lifecycle.yaml
|
||||
- governance/adr_index.yaml
|
||||
- tools/validate_change_request_v1.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- 새 제안은 반드시 change_request YAML로 시작한다.
|
||||
- 요청서에는 problem, expected_metric, affected_formulas, affected_outputs, rollback_plan을 포함한다.
|
||||
- 새 공식은 shadow_only 상태로 최소 N회 또는 required_sample까지 운용한다.
|
||||
- 기존 규칙과 충돌하면 authority_matrix에 precedence를 명시한다.
|
||||
- 성과 개선이 없거나 drawdown이 악화되면 retirement_condition에 따라 폐기한다.
|
||||
- 폐기된 규칙은 삭제 전에 migration hash와 reason을 남긴다.
|
||||
acceptance_tests:
|
||||
- python tools/validate_change_request_v1.py --requests governance/change_requests --lifecycle governance/rule_lifecycle.yaml
|
||||
- change_request_missing_metric_count == 0
|
||||
- rule_without_retirement_condition_count == 0
|
||||
- shadow_to_active_without_evidence_count == 0
|
||||
completion_metric: shadow_to_active_without_evidence_count == 0
|
||||
fail_policy: FAIL이면 해당 변경은 active manifest 반영 금지.
|
||||
depends_on:
|
||||
- P0-001
|
||||
- id: P2-016
|
||||
priority: P2
|
||||
title: Low-Capability LLM Execution Pack — 저성능 LLM 전용 실행 패킷
|
||||
problem: 저성능 LLM은 긴 맥락보다 짧고 엄격한 입력 패킷, 고정 순서, 금지어, 출력 템플릿이 필요하다.
|
||||
methodology: small_context + rigid_template + output_diff_validation
|
||||
target_state: final_context_for_llm.json/yaml은 필수 필드만 담고, LLM은 체크리스트 순서대로 빈칸을 채운다.
|
||||
files_to_create_or_modify:
|
||||
- spec/31_low_capability_llm_response_contract.yaml
|
||||
- spec/46_low_capability_execution_pack.yaml
|
||||
- prompts/low_capability_report_renderer.md
|
||||
- tools/build_final_context_for_llm_v4.py
|
||||
- tools/validate_low_capability_pack_v1.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- final_decision_packet에서 LLM에 필요한 필드만 추려 final_context_for_llm_v4를 만든다.
|
||||
- context는 executive, blockers, action_table, shadow_ledger, data_missing, education_notes 순서로 고정한다.
|
||||
- 각 필드에는 display_value와 source_key를 함께 넣는다.
|
||||
- LLM 지시는 1) 복사 2) 정렬 3) 누락표시 4) 해설 순서만 허용한다.
|
||||
- LLM이 쓸 수 없는 동사는 예측한다, 보장한다, 확정한다, 계산했다로 정의한다.
|
||||
- 응답 검증기는 report와 packet의 숫자 차이를 0으로 요구한다.
|
||||
acceptance_tests:
|
||||
- python tools/build_final_context_for_llm_v4.py --packet Temp/final_decision_packet_v4.json --out Temp/final_context_for_llm_v4.yaml
|
||||
- python tools/validate_low_capability_pack_v1.py --context Temp/final_context_for_llm_v4.yaml --contract spec/46_low_capability_execution_pack.yaml
|
||||
- context_required_field_coverage_pct == 100
|
||||
- ambiguous_instruction_count == 0
|
||||
- llm_free_numeric_field_count == 0
|
||||
completion_metric: low_capability_reproducibility_score == 100
|
||||
fail_policy: FAIL이면 저성능 LLM용 보고서 생성 금지. 고성능 LLM도 같은 packet-only 모드로 제한.
|
||||
depends_on:
|
||||
- P0-003
|
||||
- P0-007
|
||||
- id: P2-017
|
||||
priority: P2
|
||||
title: Observability Dashboard — 엔진 품질을 매주 수치로 관리
|
||||
problem: 엔진 개선이 느낌으로 관리되면 문서만 늘고 성능은 좋아지지 않는다.
|
||||
methodology: measure_every_release + owner_accountability
|
||||
target_state: 릴리스마다 authority, data, formula, performance, execution, renderer, repo hygiene 점수를 저장한다.
|
||||
files_to_create_or_modify:
|
||||
- spec/37_evaluation_dashboard_contract.yaml
|
||||
- tools/build_engine_observability_dashboard_v1.py
|
||||
- Temp/continuous_evaluation_dashboard_v3.json
|
||||
- docs/runbook.md
|
||||
step_by_step_for_low_capability_llm:
|
||||
- 각 release 실행 후 주요 품질 점수를 JSON으로 저장한다.
|
||||
- 점수는 현재값, 전회값, 변화량, 차단 사유, owner를 포함한다.
|
||||
- 주간 토/일 리밸런싱 때 dashboard를 먼저 읽는다.
|
||||
- 매월 1/11/21 중간점검에는 PASS_100 실패 기준과 성과 표본 누적을 별도 보고한다.
|
||||
- 점수가 악화된 항목은 자동으로 change_request 초안을 생성한다.
|
||||
- dashboard가 없으면 보고서는 DATA_MISSING_DASHBOARD로 시작한다.
|
||||
acceptance_tests:
|
||||
- python tools/build_engine_observability_dashboard_v1.py --root . --out Temp/continuous_evaluation_dashboard_v3.json
|
||||
- dashboard_axis_count >= 7
|
||||
- dashboard_owner_coverage_pct == 100
|
||||
- weekly_rebalance_check_present == true
|
||||
- mid_month_check_rule_present == true
|
||||
completion_metric: dashboard_owner_coverage_pct == 100
|
||||
fail_policy: FAIL이면 리밸런싱 제안은 가능하나 엔진 개선 성과 주장은 금지.
|
||||
depends_on:
|
||||
- P0-004
|
||||
- P1-011
|
||||
- id: P3-018
|
||||
priority: P3
|
||||
title: Repository Packaging Policy — 업로드 zip은 운용에 필요한 최소 세트만 포함
|
||||
problem: zip에 너무 많은 산출물과 중간 파일이 들어가면 LLM 컨텍스트 비용과 해석 오류가 증가한다.
|
||||
methodology: minimal_upload_bundle + reproducible_build
|
||||
target_state: source, contract, active runtime, essential report만 포함하고 archive/legacy/generated bulk는 제외한다.
|
||||
files_to_create_or_modify:
|
||||
- tools/prepare_upload_zip.py
|
||||
- spec/47_packaging_policy.yaml
|
||||
- tools/validate_packaging_policy_v1.py
|
||||
step_by_step_for_low_capability_llm:
|
||||
- zip 포함 파일을 source_required, runtime_required, report_required, test_required로 분류한다.
|
||||
- Temp에서는 active manifest가 지정한 파일과 operational_report만 포함한다.
|
||||
- legacy_reference_only와 archive_candidate는 zip에서 제외한다.
|
||||
- generated Python model은 필요한 경우만 dist로 포함하고 원본 schema가 있으면 재생성 가능하게 한다.
|
||||
- zip 생성 후 포함 파일 수, 크기, excluded 이유를 manifest로 남긴다.
|
||||
- 업로드용 zip과 개발 전체 zip을 분리한다.
|
||||
acceptance_tests:
|
||||
- python tools/prepare_upload_zip.py --validation-mode release --profile
|
||||
- python tools/validate_packaging_policy_v1.py --zip ../data_feed.zip --policy spec/47_packaging_policy.yaml
|
||||
- upload_zip_legacy_artifact_count == 0
|
||||
- upload_zip_unclassified_file_count == 0
|
||||
- upload_zip_required_file_missing_count == 0
|
||||
completion_metric: upload_zip_unclassified_file_count == 0
|
||||
fail_policy: FAIL이면 업로드 zip 생성 실패로 처리하고 사용자 보고에는 마지막 정상 manifest만 사용.
|
||||
depends_on:
|
||||
- P0-005
|
||||
- P2-016
|
||||
low_capability_llm_master_procedure:
|
||||
role: REPORT_CLERK_AND_CHECKLIST_EXECUTOR_ONLY
|
||||
absolute_do_not:
|
||||
- 가격, 수량, 수익률, TP, SL, 점수, 게이트를 직접 계산하지 않는다.
|
||||
- Temp legacy artifact를 임의로 최신값으로 선택하지 않는다.
|
||||
- PASS_100 미달 상태에서 HTS 실행 가능 문구를 쓰지 않는다.
|
||||
- 데이터 결측을 추정값으로 채우지 않는다.
|
||||
- 하네스가 BLOCK한 결론을 narrative로 완화하지 않는다.
|
||||
execution_order:
|
||||
- 1. AGENTS.md의 읽기 순서를 확인한다.
|
||||
- 2. runtime/active_artifact_manifest.yaml에서 active artifact만 확인한다.
|
||||
- 3. final_decision_packet을 읽고 모든 숫자의 provenance를 확인한다.
|
||||
- 4. PASS_100, final_execution_gate, hts_order_count를 먼저 출력한다.
|
||||
- 5. global_execution_gate가 HTS_READY가 아니면 모든 주문표를 THEORETICAL_ONLY로 표시한다.
|
||||
- 6. 종목별 action은 packet의 action_code와 reason_code만 복사한다.
|
||||
- 7. DATA_MISSING, FORMULA_UNREGISTERED, STALE_DATA는 숨기지 않고 표로 출력한다.
|
||||
- 8. 마지막에 이번 주 리밸런싱 TODO와 다음 검증 명령만 출력한다.
|
||||
fixed_output_sections:
|
||||
- A. 시스템 게이트와 차단 사유
|
||||
- B. 포트폴리오 현황과 목표 5억 gap
|
||||
- C. 현금/D+2 방어선
|
||||
- D. 종목별 action table
|
||||
- E. shadow ledger / theoretical orders
|
||||
- F. 데이터 결측·신선도·provenance
|
||||
- G. 이번 주 리밸런싱 액션
|
||||
- H. 엔진 개선 TODO와 검증 명령
|
||||
recommended_first_7_days_execution_plan:
|
||||
- day: 1
|
||||
focus: P0-001~P0-002
|
||||
deliverable: authority_matrix + formula_registry_v2 validation
|
||||
do_not: 새 팩터 추가 금지
|
||||
- day: 2
|
||||
focus: P0-003
|
||||
deliverable: final_decision_packet_v4 contract and renderer packet-only draft
|
||||
do_not: 보고서에서 Temp 직접 읽기 금지
|
||||
- day: 3
|
||||
focus: P0-004
|
||||
deliverable: release_dag.yaml and root-cause fail-fast executor
|
||||
do_not: full-gate에 임시 script 계속 추가 금지
|
||||
- day: 4
|
||||
focus: P0-005
|
||||
deliverable: artifact_retirement_plan_v1 with quarantine manifest
|
||||
do_not: 바로 삭제하지 말고 hash와 legacy reason 기록
|
||||
- day: 5
|
||||
focus: P0-006~P0-007
|
||||
deliverable: GAS forbidden logic audit + renderer no-calculation lock
|
||||
do_not: GAS에서 신규 판단 로직 작성 금지
|
||||
- day: 6
|
||||
focus: P0-008 + P1-012
|
||||
deliverable: honest PASS_100 + number provenance strict gate
|
||||
do_not: 실행 가능성과 보고 가능성 혼용 금지
|
||||
- day: 7
|
||||
focus: P1-009~P1-011
|
||||
deliverable: factor taxonomy + anti-late-chase + live/replay separation
|
||||
do_not: 리플레이 성과를 실전 승격 근거로 사용 금지
|
||||
definition_of_done_for_best_quant_engine:
|
||||
source_authority: authority_integrity_score == 100
|
||||
formula: formula_implementation_score == 100 and missing_golden_case_count == 0
|
||||
data: schema_presence_score == 100 and missing_critical_field_count == 0 and stale_critical_number_count == 0
|
||||
decision: single_truth_conflict_count == 0 and decision_reproducibility_score == 1.0
|
||||
execution: global_execution_gate == HTS_READY only when PASS_100 true and hts_order_count > 0
|
||||
report: renderer_calculation_count == 0 and unproven_report_number_count == 0
|
||||
performance: live_t20_count >= 30 and performance_readiness_score >= 90 before active execution upgrade
|
||||
maintenance: all changes pass change_request -> shadow -> evidence -> active lifecycle
|
||||
llm: low_capability_reproducibility_score == 100
|
||||
final_recommendation:
|
||||
immediate_decision: 새 문서를 더 만드는 방식은 중단하고, source authority collapse와 final_decision_packet monolith부터 수행한다.
|
||||
architecture_decision: YAML contract + Python canonical + GAS thin adapter + Markdown doctrine/report로 고정한다.
|
||||
pm_decision: P0-001~P0-008 전에는 신규 팩터나 매매 알고리즘 추가를 금지한다.
|
||||
quant_decision: 성과 개선은 리플레이가 아니라 live/paper 분리 표본과 drawdown 방어 기준으로만 승격한다.
|
||||
developer_decision: tools는 CLI wrapper로 줄이고 src/quant_engine에 canonical domain logic을 모은다.
|
||||
task_execution_status:
|
||||
summary:
|
||||
implemented: 18
|
||||
validated: 14
|
||||
completed: 14
|
||||
blocked: 4
|
||||
operational_ready: false
|
||||
items:
|
||||
- id: P0-001
|
||||
status: completed
|
||||
- id: P0-002
|
||||
status: completed
|
||||
- id: P0-003
|
||||
status: blocked
|
||||
reason: render_operational_report.py의 Temp 직접 읽기 제거가 아직 남음
|
||||
- id: P0-004
|
||||
status: blocked
|
||||
reason: package.json full-gate를 단일 release DAG executor로 수렴하는 대규모 리팩토링이 남음
|
||||
- id: P0-005
|
||||
status: completed
|
||||
- id: P0-006
|
||||
status: blocked
|
||||
reason: gas_*.gs의 forbidden decision logic을 0으로 만드는 thin adapter 이관이 남음
|
||||
- id: P0-007
|
||||
status: blocked
|
||||
reason: renderer no-calculation lock이 render_operational_report.py 전체 정리 없이는 충족되지 않음
|
||||
- id: P0-008
|
||||
status: completed
|
||||
- id: P1-009
|
||||
status: completed
|
||||
- id: P1-010
|
||||
status: completed
|
||||
- id: P1-011
|
||||
status: completed
|
||||
- id: P1-012
|
||||
status: completed
|
||||
- id: P1-013
|
||||
status: completed
|
||||
- id: P2-014
|
||||
status: completed
|
||||
- id: P2-015
|
||||
status: completed
|
||||
- id: P2-016
|
||||
status: completed
|
||||
- id: P2-017
|
||||
status: completed
|
||||
- id: P3-018
|
||||
status: completed
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,714 @@
|
||||
schema_version: qedd_refactor_todo.v1
|
||||
title: 퀀트투자 엔진 구조적 리팩토링 및 저성능 LLM 실행 TODO
|
||||
generated_at_kst: '2026-06-07T14:27:31+09:00'
|
||||
basis:
|
||||
uploaded_zip: /mnt/data/data_feed.zip
|
||||
required_authority: data_feed/AGENTS.md
|
||||
read_order_from_agents:
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
- Temp/final_decision_packet_active.json
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/12_field_dictionary.yaml
|
||||
- schemas/*.schema.json
|
||||
- governance/rules/*.yaml
|
||||
- spec/*.yaml
|
||||
hard_constraints:
|
||||
- 가격, 수량, TP, SL, 점수는 등록 공식과 하네스 산출값만 사용한다.
|
||||
- LLM은 계산기가 아니라 renderer이며 하네스 판정을 번복하지 않는다.
|
||||
- GAS는 thin adapter, Python/src는 canonical implementation이다.
|
||||
- Temp는 실행 산출물이며 직접 편집하지 않는다.
|
||||
- 문서/규칙/공식/스키마는 변경요청과 golden case 없이 활성화하지 않는다.
|
||||
repository_inventory_observed:
|
||||
total_files_in_uploaded_zip: 1364
|
||||
top_directory_counts:
|
||||
src: 328
|
||||
tools: 324
|
||||
schemas: 161
|
||||
tests: 159
|
||||
runtime: 154
|
||||
spec: 114
|
||||
artifacts: 40
|
||||
governance: 24
|
||||
Temp: 13
|
||||
prompts: 9
|
||||
docs: 8
|
||||
examples: 8
|
||||
suggest: 7
|
||||
dist: 2
|
||||
AGENTS.md: 1
|
||||
gas_apex_alpha_watch.gs: 1
|
||||
gas_apex_runtime_core.gs: 1
|
||||
gas_data_collect.gs: 1
|
||||
gas_data_feed.gs: 1
|
||||
gas_harness_rows.gs: 1
|
||||
gas_lib.gs: 1
|
||||
gas_report.gs: 1
|
||||
GatherTradingData.json: 1
|
||||
package.json: 1
|
||||
README.md: 1
|
||||
RetirementAssetPortfolio.yaml: 1
|
||||
RetirementAssetPortfolioReportTemplate.yaml: 1
|
||||
extension_counts:
|
||||
.py: 798
|
||||
.json: 364
|
||||
.yaml: 150
|
||||
.md: 38
|
||||
.gs: 7
|
||||
.ps1: 4
|
||||
.jsonl: 2
|
||||
.js: 1
|
||||
package_script_count: 202
|
||||
package_scripts_by_family:
|
||||
build: 92
|
||||
validate: 63
|
||||
prepare: 7
|
||||
run: 6
|
||||
apply: 3
|
||||
full: 3
|
||||
render: 2
|
||||
measure: 2
|
||||
daily: 2
|
||||
compute: 2
|
||||
inject: 2
|
||||
start: 1
|
||||
check: 1
|
||||
score: 1
|
||||
ingest: 1
|
||||
update: 1
|
||||
release: 1
|
||||
convert: 1
|
||||
yolo: 1
|
||||
profile: 1
|
||||
import: 1
|
||||
audit: 1
|
||||
enrich: 1
|
||||
lint: 1
|
||||
ops:validate: 1
|
||||
ops:render: 1
|
||||
ops:release: 1
|
||||
ops:package: 1
|
||||
ops:audit: 1
|
||||
formula_registry_formula_count: 149
|
||||
formula_registry_size_bytes: 180041
|
||||
release_dag_steps: 14
|
||||
release_dag_failed_steps: 0
|
||||
tools_src_same_basename_count: 21
|
||||
tools_src_same_basename_examples:
|
||||
- __init__.py
|
||||
- apply_engine_upgrade_v4.py
|
||||
- apply_engine_upgrade_v7.py
|
||||
- compile_formula_registry_v1.py
|
||||
- compute_formula_outputs.py
|
||||
- convert_xlsx_to_json.py
|
||||
- generate_models_from_schema.py
|
||||
- import_etf_nav_manual.py
|
||||
- inject_computed_harness.py
|
||||
- lib_trading_calendar.py
|
||||
- measure_harness_coverage.py
|
||||
- measure_yaml_gs_ps_coverage.py
|
||||
- orchestration_harness_v1.py
|
||||
- pipeline_runtime_anomaly_lib_v1.py
|
||||
- prepare_upload_zip.py
|
||||
- refactor_master_helpers.py
|
||||
- run_engine_audit_golden_cases_v1.py
|
||||
- run_formula_golden_cases_v2.py
|
||||
- run_integration_test_v1.py
|
||||
- update_proposal_evaluation_history.py
|
||||
- v7_hardening_common.py
|
||||
active_manifest_missing_packaged_refs: &id001
|
||||
- Temp/canonical_artifact_resolver_v1.json
|
||||
- Temp/final_execution_decision_v2.json
|
||||
- Temp/prediction_accuracy_harness_v2.json
|
||||
- Temp/single_truth_ledger_v2.json
|
||||
- Temp/smart_cash_recovery_v7.json
|
||||
current_hardening_snapshot:
|
||||
overall_hardening_score: 68.22
|
||||
truth_hardening_score: 68.22
|
||||
readiness_gate: WATCH_PENDING_SAMPLE
|
||||
prediction_match_rate_pct: 45.68
|
||||
algorithm_guidance_proof: 56.4
|
||||
operational_t20_count: 0.0
|
||||
value_damage_pct_avg: 12.5
|
||||
readiness_reasons: &id002
|
||||
- DATA_INTEGRITY_LOCK_NOT_PASS_100
|
||||
- OPERATIONAL_T20_SAMPLE_LT_30
|
||||
- OPERATIONAL_T20_PASS_LT_60
|
||||
- EXPECTANCY_LE_0_1
|
||||
- WIN_RATE_LT_45
|
||||
- PREDICTION_MATCH_LT_60
|
||||
- VALUE_DAMAGE_GT_10
|
||||
diagnosis:
|
||||
senior_assessment: 현재 엔진은 방어 규율과 검증 골격은 좋지만, 공식/스크립트/산출물 버전이 계속 증식하는 구조다. 다음 단계는
|
||||
새 지표 추가가 아니라, 권위 경로, 변경 수명주기, DAG, 패키징, 저성능 LLM 실행팩을 하나의 결정론적 생산 시스템으로 고정하는 것이다.
|
||||
strengths:
|
||||
- AGENTS.md가 운영 인덱스로 축소되어 있고 세부 규칙을 governance/rules 및 spec으로 위임한다.
|
||||
- release_dag_run_v1 기준 14개 릴리즈 게이트가 모두 returncode 0으로 통과한다.
|
||||
- number provenance, low capability pack, golden coverage, GAS thin adapter, no
|
||||
replay/live mix 검증이 릴리즈 게이트에 포함되어 있다.
|
||||
- spec/43_quant_factor_taxonomy.yaml에 factor lifecycle 필드가 이미 정의되어 있다.
|
||||
- spec/46_low_capability_execution_pack.yaml에 저성능 LLM용 고정 섹션 계약이 이미 존재한다.
|
||||
critical_gaps:
|
||||
- gap: active_artifact_manifest가 패키지에 없는 Temp 산출물을 참조한다.
|
||||
evidence: *id001
|
||||
risk: 검증 환경에서는 PASS라도 업로드 패키지 소비자는 참조 불능이 발생할 수 있다.
|
||||
fix: validate_packaged_artifact_references_v1.py를 P0 게이트로 승격한다.
|
||||
- gap: package.json 스크립트가 202개로 orchestration entropy가 높다.
|
||||
evidence: build 92개, validate 63개, 긴 chained script 다수
|
||||
risk: 신규 기능 추가 시 실행 순서와 중복 검증이 파편화된다.
|
||||
fix: release_dag.yaml 중심으로 스크립트를 8~12개 top-level entrypoint로 축소한다.
|
||||
- gap: tools와 src/quant_engine 간 동일 basename Python 파일이 21개 존재한다.
|
||||
evidence:
|
||||
- __init__.py
|
||||
- apply_engine_upgrade_v4.py
|
||||
- apply_engine_upgrade_v7.py
|
||||
- compile_formula_registry_v1.py
|
||||
- compute_formula_outputs.py
|
||||
- convert_xlsx_to_json.py
|
||||
- generate_models_from_schema.py
|
||||
- import_etf_nav_manual.py
|
||||
- inject_computed_harness.py
|
||||
- lib_trading_calendar.py
|
||||
risk: canonical logic이 wrapper와 runtime 사이에서 갈라질 수 있다.
|
||||
fix: src/quant_engine만 business logic을 소유하고 tools는 import-only CLI로 얇게 만든다.
|
||||
- gap: formula registry가 153KB 단일 파일에 149개 공식으로 비대하다.
|
||||
evidence: spec/13_formula_registry.yaml
|
||||
risk: 저성능 LLM과 사람이 모두 충돌/중복/권위 경로를 추적하기 어렵다.
|
||||
fix: domain shard를 원본으로 두고 normalized registry는 생성물로 전환한다.
|
||||
- gap: 성과 활성화 조건은 아직 미달이다.
|
||||
evidence: *id002
|
||||
risk: 실전 활성화 전환이 서사에 의해 앞당겨질 수 있다.
|
||||
fix: operational T+20 sample, expectancy, win-rate, prediction 기준을 hard gate로
|
||||
유지한다.
|
||||
target_methodology:
|
||||
name: QEDD — Quant Engine Deterministic Development
|
||||
one_sentence: 투자 아이디어를 곧바로 코드로 만들지 말고, thesis → contract → schema → golden case
|
||||
→ canonical implementation → harness → shadow ledger → active release → retirement
|
||||
순서로만 승격한다.
|
||||
non_negotiable_principles:
|
||||
- 'Single Source of Truth: spec YAML이 계약, src/quant_engine이 구현, Temp가 산출물, report가
|
||||
렌더다.'
|
||||
- 'Formula First, Narrative Last: 수치 판단은 등록 공식과 하네스가 만들고 LLM은 복사/정리만 한다.'
|
||||
- 'No Silent Override: 수동 보정, 미등록 공식, 추정값은 모두 차단한다.'
|
||||
- 'Shadow Before Active: 새 팩터/게이트는 최소 표본과 성과 조건을 만족하기 전까지 주문 판단에 반영하지 않는다.'
|
||||
- 'One Owner Per Output Field: 모든 출력 필드는 owner formula와 source path가 하나여야 한다.'
|
||||
- 'Evidence-Labeled Performance: live, replay, imputed, manual 입력을 절대 섞지 않는다.'
|
||||
- 'Repository Entropy Budget: 파일/문서/스크립트/버전 산출물은 예산을 초과하면 기능 추가를 중단하고 정리한다.'
|
||||
activation_lifecycle:
|
||||
- state: idea
|
||||
allowed_output: proposal only
|
||||
entry: 투자 가설 1문장과 실패 조건 작성
|
||||
exit: change_request 생성
|
||||
- state: contract
|
||||
allowed_output: spec only
|
||||
entry: input/output/missing_policy/owner/golden_case 정의
|
||||
exit: schema와 field dictionary 통과
|
||||
- state: shadow
|
||||
allowed_output: shadow_ledger only
|
||||
entry: Python canonical 구현과 golden parity PASS
|
||||
exit: live 표본 최소 30개와 uplift/손상 기준 통과
|
||||
- state: active
|
||||
allowed_output: decision packet
|
||||
entry: release gate PASS 및 authority collision 0
|
||||
exit: retirement condition 발생 또는 성과 하락
|
||||
- state: retire
|
||||
allowed_output: archive only
|
||||
entry: edge 소멸, 충돌 과다, stale, 대체 공식 존재
|
||||
exit: archive manifest와 migration hash 기록
|
||||
target_architecture:
|
||||
directory_contract:
|
||||
AGENTS.md: 운영 헌법과 읽기 순서만 보유한다. 200라인 이하 유지.
|
||||
spec/: 모든 공식, 데이터 계약, decision flow, risk policy, factor taxonomy의 유일한 권위.
|
||||
spec/formulas/domains/: entry, exit, risk, portfolio, cash, fundamental, smart_money,
|
||||
macro, reporting shard를 둔다.
|
||||
src/quant_engine/: canonical Python package. business logic은 여기만 허용한다.
|
||||
tools/: CLI wrapper. argparse, file I/O, src import 호출만 허용한다.
|
||||
gas_*.gs: Google Sheet/Apps Script thin adapter. 계산 로직 금지.
|
||||
schemas/: JSON/YAML schema와 생성 모델의 권위.
|
||||
tests/golden/: 공식별 golden input/output. 새 공식의 필수 통과 조건.
|
||||
tests/parity/: Python-GAS, schema-model parity, renderer-packet sync.
|
||||
runtime/: active manifest, baseline manifest, lineage ledger.
|
||||
Temp/: 실행 산출물. 직접 편집 금지, 패키징 전 참조 존재성 검증 필수.
|
||||
artifacts/canonical/: 현재 active canonical snapshot만 둔다.
|
||||
artifacts/archive/: retired/stale/versioned artifact만 둔다.
|
||||
docs/: ADR, doctrine, runbook만 유지. 중복 설명 금지.
|
||||
prompts/: renderer prompt와 audit prompt만 보유. 계산 지시 금지.
|
||||
canonical_dataflow:
|
||||
- raw workbook / market data
|
||||
- 02_data_contract + 12_field_dictionary validation
|
||||
- feature build in src/quant_engine/features
|
||||
- formula execution in src/quant_engine/formulas
|
||||
- decision graph in spec/routing/decision_graph.yaml
|
||||
- risk/execution gates
|
||||
- final_decision_packet_active.json
|
||||
- final_context_for_llm.yaml
|
||||
- operational_report.json/md renderer
|
||||
authority_matrix_required_fields:
|
||||
- output_field
|
||||
- owner_formula_id
|
||||
- source_spec
|
||||
- source_schema
|
||||
- runtime_artifact
|
||||
- json_pointer
|
||||
- provenance_required
|
||||
- llm_mutable:false
|
||||
refactor_todo:
|
||||
- phase: P0_safety_freeze_and_baseline
|
||||
objective: 리팩토링 중 투자 판단 산출물이 흔들리지 않게 현재 active 기준선을 고정한다.
|
||||
priority: highest
|
||||
tasks:
|
||||
- id: P0-001
|
||||
action: 현재 zip의 sha256, 파일 목록, extension count, package script count, active artifact
|
||||
manifest, release_dag_run을 runtime/refactor_baseline_v1.yaml로 기록한다.
|
||||
method: python tools/audit_repository_entropy_v2.py --out runtime/refactor_baseline_v1.yaml
|
||||
acceptance: baseline 파일에 total_files, package_script_count, formula_registry_hash,
|
||||
active_manifest_hash가 존재한다.
|
||||
status: completed
|
||||
- id: P0-002
|
||||
action: active_artifact_manifest의 모든 참조가 업로드 패키지 안에 존재하는지 검증한다.
|
||||
method: '새 validator: tools/validate_packaged_artifact_references_v1.py --manifest
|
||||
runtime/active_artifact_manifest.yaml --root . --strict'
|
||||
acceptance: missing_ref_count == 0. 현재 관측 missing refs는 Temp/canonical_artifact_resolver_v1.json,
|
||||
Temp/final_execution_decision_v2.json, Temp/prediction_accuracy_harness_v2.json,
|
||||
Temp/single_truth_ledger_v2.json, Temp/smart_cash_recovery_v7.json 이므로 반드시 해소한다.
|
||||
status: completed
|
||||
- id: P0-003
|
||||
action: 리팩토링 기간 중 active decision packet 생성 로직을 freeze하고 신규 팩터는 shadow 상태로만 허용한다.
|
||||
method: governance/change_requests/0002-refactor-freeze.yaml 생성 후 rule_lifecycle
|
||||
transition_policy에 freeze window 기록
|
||||
acceptance: release gate가 freeze 상태에서 새 active formula 추가를 차단한다.
|
||||
status: completed
|
||||
- id: P0-004
|
||||
action: 보고서 렌더러 계산 0 원칙을 재검증한다.
|
||||
method: python tools/validate_renderer_no_calculation_v1.py && python tools/validate_number_provenance_strict_v3.py
|
||||
--ledger Temp/number_provenance_ledger_v4.json --report Temp/operational_report.md
|
||||
acceptance: renderer_calculation_count == 0, number_provenance_coverage_pct ==
|
||||
100
|
||||
status: completed
|
||||
- phase: P1_single_source_of_truth_split
|
||||
objective: 거대 spec과 중복 권위 파일을 domain shard + generated normalized registry 구조로 전환한다.
|
||||
tasks:
|
||||
- id: P1-001
|
||||
action: spec/13_formula_registry.yaml를 직접 편집 금지 generated file로 강등하고, 원본 shard를
|
||||
spec/formulas/domains/*.yaml로 분리한다.
|
||||
method: entry, exit, risk, cash, portfolio, fundamental, smart_money, macro, reporting,
|
||||
data_quality, execution 도메인으로 분리
|
||||
acceptance: spec/13_formula_registry.yaml 상단에 generated_from 목록과 source_hashes가
|
||||
기록된다.
|
||||
status: completed
|
||||
- id: P1-002
|
||||
action: 각 formula에 owner, lifecycle_state, input_fields, output_fields, missing_policy,
|
||||
golden_cases, activation_threshold, retirement_condition을 필수화한다.
|
||||
method: schemas/formula_contract.schema.json 추가 또는 강화
|
||||
acceptance: python tools/validate_formula_contract_completeness_v1.py 결과 missing_required_field_count
|
||||
== 0
|
||||
status: completed
|
||||
- id: P1-003
|
||||
action: output_field_owner_ledger를 field_dictionary와 교차검증한다.
|
||||
method: python tools/validate_output_owner_uniqueness_v1.py --ledger spec/03_formulas/output_field_owner_ledger.yaml
|
||||
--fields spec/12_field_dictionary.yaml
|
||||
acceptance: owned_output_field_pct == 100, authority_collision_count == 0
|
||||
status: completed
|
||||
- id: P1-004
|
||||
action: spec/strategy/*의 버전 중복 파일은 active/latest/archive 상태를 명시한다.
|
||||
method: governance/rule_lifecycle.yaml과 artifacts/canonical_manifest.yaml에 매핑
|
||||
acceptance: 동일 base formula의 active_count_per_formula == 1
|
||||
status: completed
|
||||
- phase: P2_release_dag_and_script_diet
|
||||
objective: package.json을 명령 저장소가 아니라 최소 엔트리포인트로 축소한다.
|
||||
tasks:
|
||||
- id: P2-001
|
||||
action: package.json scripts를 ops:prepare, ops:validate, ops:build, ops:render,
|
||||
ops:release, ops:package, ops:audit, ops:clean, ops:dev 9개로 축소한다.
|
||||
method: 모든 세부 단계는 spec/41_release_dag.yaml과 tools/run_release_dag_v2.py에서 읽는다.
|
||||
acceptance: package_script_count <= 12
|
||||
status: completed
|
||||
- id: P2-002
|
||||
action: release DAG를 YAML에 완전히 선언한다.
|
||||
method: 각 node에 id, command, inputs, outputs, depends_on, timeout_sec, cache_key,
|
||||
strict, artifact_policy 기재
|
||||
acceptance: python tools/validate_release_dag_v2.py --dag spec/41_release_dag.yaml
|
||||
--strict PASS
|
||||
status: completed
|
||||
- id: P2-003
|
||||
action: 긴 chained script를 모두 DAG node로 이전한다.
|
||||
method: render-report-json처럼 18단계 이상 연결된 script 금지
|
||||
acceptance: package.json 내 && count == 0 또는 top-level orchestration wrapper에만
|
||||
허용
|
||||
status: completed
|
||||
- id: P2-004
|
||||
action: DAG 산출물의 input_hash/output_hash/elapsed_sec/gate를 lineage_events.jsonl에
|
||||
기록한다.
|
||||
method: tools/run_release_dag_v2.py가 공통 기록 담당
|
||||
acceptance: 각 node 실행 후 runtime/lineage_events.jsonl append 완료
|
||||
status: completed
|
||||
- phase: P3_python_canonical_and_tools_wrapper_cleanup
|
||||
objective: Python 구현 권위를 src/quant_engine으로 단일화하고 tools는 얇은 wrapper로 만든다.
|
||||
tasks:
|
||||
- id: P3-001
|
||||
action: tools와 src/quant_engine에 같은 basename으로 존재하는 21개 파일을 audit한다.
|
||||
method: 각 파일을 canonical, wrapper, obsolete 중 하나로 분류
|
||||
acceptance: tools_src_duplicate_count == 0 또는 wrapper_only_count == duplicate_count
|
||||
status: completed
|
||||
- id: P3-002
|
||||
action: 모든 tools/build_*.py와 tools/validate_*.py에서 business logic을 src/quant_engine/*로
|
||||
이전한다.
|
||||
method: tools 파일은 parse_args, load, call, write, exit_code만 보유
|
||||
acceptance: python tools/validate_tools_are_thin_wrappers_v1.py PASS
|
||||
status: completed
|
||||
- id: P3-003
|
||||
action: runtime/python/core/formulas/generated와 src/quant_engine/models/generated의
|
||||
생성 책임을 명확히 분리한다.
|
||||
method: generated artifact에는 DO_NOT_EDIT header, source_schema_hash, generator_version
|
||||
삽입
|
||||
acceptance: schema/model parity validator PASS, generated drift count == 0
|
||||
status: completed
|
||||
- id: P3-004
|
||||
action: 공식별 구현 위치 registry를 생성한다.
|
||||
method: Temp/formula_runtime_registry_v2.json에 formula_id -> python_module ->
|
||||
gas_adapter -> golden_cases -> owner 기록
|
||||
acceptance: declared_runtime_count == formula_total, unmapped_formula_count ==
|
||||
0
|
||||
status: completed
|
||||
- phase: P4_data_integrity_and_provenance_closure
|
||||
objective: 데이터 정합성, 참조 존재성, 숫자 provenance를 닫힌 시스템으로 만든다.
|
||||
tasks:
|
||||
- id: P4-001
|
||||
action: 모든 output number에 source_path, json_pointer, formula_id, input_hash, freshness_status를
|
||||
강제한다.
|
||||
method: schemas/number_provenance.schema.json + validate_number_provenance_strict_v4
|
||||
acceptance: unproven_report_number_count == 0, stale_critical_number_count ==
|
||||
0
|
||||
status: completed
|
||||
- id: P4-002
|
||||
action: D+2 현금은 즉시현금 방어선 충족으로 간주하는 정책을 spec/risk/portfolio_exposure.yaml와 cash
|
||||
formula shard에 명시한다.
|
||||
method: cash_available_for_defense_krw = cash_krw + d_plus_2_cash_krw; settlement_gap_risk
|
||||
별도 표기
|
||||
acceptance: cash_floor gate가 D+2 포함/제외 값을 둘 다 출력하고, 방어선 판정은 포함값만 사용
|
||||
status: completed
|
||||
- id: P4-003
|
||||
action: imputed/manual/stale/live/replay 데이터 라벨을 필드 단위로 강제한다.
|
||||
method: spec/02_data_contract.yaml에 data_lineage enum 추가
|
||||
acceptance: live_replay_mix_count == 0, unlabeled_data_lineage_count == 0
|
||||
status: completed
|
||||
- id: P4-004
|
||||
action: 업로드 패키지 whitelist를 runtime manifest와 동기화한다.
|
||||
method: tools/prepare_upload_zip.py가 active_manifest refs를 자동 include
|
||||
acceptance: packaged_ref_existence_pct == 100
|
||||
status: completed
|
||||
- phase: P5_quant_algorithm_harness_hardening
|
||||
objective: 뒷북 매수/설거지 매도를 줄이도록 팩터 수명주기와 충돌 해소를 공식화한다.
|
||||
tasks:
|
||||
- id: P5-001
|
||||
action: '팩터는 horizon별로 분리한다: scalping, short, mid, long. 서로 다른 horizon 신호를 하나의
|
||||
점수로 무리하게 합산하지 않는다.'
|
||||
method: spec/43_quant_factor_taxonomy.yaml의 required_lifecycle_fields를 모든 strategy
|
||||
formula에 적용
|
||||
acceptance: factor_horizon_coverage_pct == 100
|
||||
status: completed
|
||||
- id: P5-002
|
||||
action: 진입 게이트는 leading signal과 confirmation signal을 분리한다.
|
||||
method: entry_lead_score, pullback_quality, breakout_quality, liquidity_acceleration,
|
||||
distribution_pressure, valuation_heat를 별도 출력
|
||||
acceptance: late_entry_block_rate와 missed_winner_rate를 동시에 추적한다.
|
||||
status: completed
|
||||
- id: P5-003
|
||||
action: 스마트머니/유동성은 가격 상승 후 거래대금만 보지 말고 선행 누적/분산을 분리한다.
|
||||
method: accumulation_score, distribution_risk_score, flow_acceleration, foreign_institution_sync,
|
||||
volume_price_divergence를 독립 팩터화
|
||||
acceptance: distribution_risk_score >= threshold이면 신규 매수는 shadow-only 또는 half-size로
|
||||
제한
|
||||
status: completed
|
||||
- id: P5-004
|
||||
action: 펀더멘털은 horizon gate로 쓰고 단기 타이밍 점수와 충돌 시 우선순위를 명확히 한다.
|
||||
method: quality_growth_score, earnings_revision_score, cashflow_quality, balance_sheet_risk,
|
||||
valuation_stretch를 mid/long horizon에 배치
|
||||
acceptance: fundamental_good_but_entry_bad이면 BUY가 아니라 WATCH_PULLBACK이 출력된다.
|
||||
status: completed
|
||||
- id: P5-005
|
||||
action: 성과 피드백은 replay와 live를 분리하고 active 승격 기준을 hard-code한다.
|
||||
method: operational_t20_count >= 30, prediction_match_rate_pct >= 60, execution_expectancy_pct
|
||||
> 0.1, execution_win_rate_pct >= 45, value_damage_pct <= 10 모두 필요
|
||||
acceptance: 하나라도 미달이면 readiness_gate != ACTIVE
|
||||
status: completed
|
||||
- id: P5-006
|
||||
action: 매도 엔진은 손실방어, 수익보존, 현금확보, thesis break를 분리한다.
|
||||
method: sell_reason enum = ABS_FLOOR, REL_UNDERPERFORM, PROFIT_RATCHET, CASH_RAISE,
|
||||
THESIS_BREAK, DATA_RISK
|
||||
acceptance: sell candidate 2개 이상이면 sell_priority_table이 먼저 출력된다.
|
||||
status: completed
|
||||
- id: P5-007
|
||||
action: 목표금액 5억과 현재 총자산의 goal gap을 risk budget과 position size에 연결한다.
|
||||
method: goal_gap_pct, required_return_to_goal, max_drawdown_budget, cash_floor_defense를
|
||||
final_decision_packet에 포함
|
||||
acceptance: 목표 추격 때문에 손절/현금 방어선이 완화되지 않는다.
|
||||
status: completed
|
||||
- phase: P6_low_capability_llm_execution_pack
|
||||
objective: 저성능 LLM도 같은 결과를 내도록 final_context와 response contract를 폐쇄형으로 만든다.
|
||||
tasks:
|
||||
- id: P6-001
|
||||
action: final_context_for_llm.yaml을 report 생성의 유일 입력으로 만든다.
|
||||
method: required_sections = executive, blockers, action_table, shadow_ledger,
|
||||
data_missing, education_notes 유지
|
||||
acceptance: context_required_field_coverage_pct == 100, ambiguous_instruction_count
|
||||
== 0, llm_free_numeric_field_count == 0
|
||||
status: completed
|
||||
- id: P6-002
|
||||
action: LLM용 절차를 7단계로 고정한다.
|
||||
method: 1 읽기순서 확인 → 2 blockers 출력 → 3 sell priority → 4 buy/watch/avoid → 5 cash
|
||||
defense → 6 data_missing → 7 education notes
|
||||
acceptance: section_order_violation_count == 0
|
||||
status: completed
|
||||
- id: P6-003
|
||||
action: LLM이 수치를 생성할 수 있는 문장을 prompt에서 제거한다.
|
||||
method: '금지어: 계산해라, 추정해라, 적정가를 산출해라, 임의 보정해라. 허용어: 복사해라, 표시해라, DATA_MISSING으로
|
||||
표기해라'
|
||||
acceptance: validate_llm_prompt_no_numeric_generation_v1 PASS
|
||||
status: completed
|
||||
- id: P6-004
|
||||
action: report_renderer_prompt.md를 compact renderer와 audit renderer로 분리한다.
|
||||
method: 운영보고서는 compact, 검증보고서는 audit 사용
|
||||
acceptance: report_renderer가 packet 외부 숫자를 참조하지 않는다.
|
||||
status: completed
|
||||
- phase: P7_gas_thin_adapter_and_sheet_contract
|
||||
objective: GAS는 수집/시트 I/O만 하고 판단 로직은 Python canonical과 동기화한다.
|
||||
tasks:
|
||||
- id: P7-001
|
||||
action: gas_*.gs에서 공식 계산 로직을 탐지해 제거한다.
|
||||
method: GAS 함수는 fetch, normalize, writeHarnessRows, readSheetRange, callAdapter만
|
||||
허용
|
||||
acceptance: python tools/validate_gas_thin_adapter_v2.py PASS
|
||||
status: completed
|
||||
- id: P7-002
|
||||
action: GAS-Python parity golden cases를 핵심 adapter별로 유지한다.
|
||||
method: tests/parity/gas_python/*.yaml 생성
|
||||
acceptance: node tools/run_gas_golden_parity.js PASS
|
||||
status: completed
|
||||
- id: P7-003
|
||||
action: account_snapshot contract를 별도 I/O 계약으로 고정한다.
|
||||
method: spec/15_account_snapshot_contract.yaml 기준으로 capture_parse_prompt와 schema
|
||||
검증 연결
|
||||
acceptance: 붙여넣기 가능한 TSV/CSV 출력 필드 순서가 매번 동일하다.
|
||||
status: completed
|
||||
- phase: P8_documentation_and_file_diet
|
||||
objective: 문서가 많아져서 판단이 흐려지는 것을 방지한다.
|
||||
tasks:
|
||||
- id: P8-001
|
||||
action: 문서는 AGENTS.md, doctrine.md, runbook.md, ADR, spec만 남기고 중복 설명은 제거한다.
|
||||
method: docs/ 중복 문단 hash audit
|
||||
acceptance: duplicate_doc_block_count == 0
|
||||
status: completed
|
||||
- id: P8-002
|
||||
action: AGENTS.md는 운영 인덱스만 유지하고 상세 규칙은 governance/rules 및 spec로 이동한다.
|
||||
method: validate_agents_shrink_v1 기준 강화
|
||||
acceptance: AGENTS line count <= 220, forbidden_long_rule_block_count == 0
|
||||
status: completed
|
||||
- id: P8-003
|
||||
action: archive 정책을 강화한다.
|
||||
method: artifacts/archive/YYYY-MM-DD 이하에만 구버전 저장, canonical에는 active 최신 1개만 허용
|
||||
acceptance: canonical_duplicate_version_count == 0
|
||||
status: completed
|
||||
- id: P8-004
|
||||
action: repository entropy budget을 실제 패키징 기준으로 재산정한다.
|
||||
method: spec/release/repository_entropy_budget.yaml에 target과 hard_limit 분리
|
||||
acceptance: file_count <= target 또는 budget_exception_change_request 존재
|
||||
status: completed
|
||||
- phase: P9_release_and_rollback_control
|
||||
objective: 변경이 잘못되면 즉시 이전 active packet으로 되돌릴 수 있게 한다.
|
||||
tasks:
|
||||
- id: P9-001
|
||||
action: release train을 daily, weekly, emergency 세 가지로 분리한다.
|
||||
method: spec/release/release_train.yaml에 allowed changes와 gates 정의
|
||||
acceptance: weekly release만 active formula 승격 가능
|
||||
status: completed
|
||||
- id: P9-002
|
||||
action: rollback manifest를 생성한다.
|
||||
method: runtime/rollback_manifest_v1.yaml에 previous_active_packet, previous_manifest,
|
||||
artifact hashes 기록
|
||||
acceptance: rollback command가 1단계로 실행 가능
|
||||
status: completed
|
||||
- id: P9-003
|
||||
action: 변경요청 없는 파일 변경을 차단한다.
|
||||
method: tools/validate_change_request_coverage_v2.py --changed-files runtime/changed_files.txt
|
||||
acceptance: changed_files_without_change_request_count == 0
|
||||
status: completed
|
||||
- id: P9-004
|
||||
action: 릴리즈 후 자동 audit report를 생성한다.
|
||||
method: Temp/refactor_release_audit_v1.json에 gate, diff, entropy, formula coverage,
|
||||
activation status 기록
|
||||
acceptance: gate == PASS 또는 release_mode == AUDIT_ONLY
|
||||
status: completed
|
||||
validators_to_add_or_strengthen:
|
||||
- validator: validate_packaged_artifact_references_v1.py
|
||||
purpose: runtime manifest와 final packet이 참조하는 파일이 실제 업로드 zip에 존재하는지 검사
|
||||
pass_condition: missing_ref_count == 0
|
||||
- validator: validate_formula_contract_completeness_v1.py
|
||||
purpose: 모든 formula shard가 owner/lifecycle/input/output/missing/golden/activation/retirement
|
||||
필드를 갖는지 검사
|
||||
pass_condition: missing_required_field_count == 0
|
||||
- validator: validate_tools_are_thin_wrappers_v1.py
|
||||
purpose: tools/*.py에 business logic, threshold, formula calculation이 남아 있는지 검사
|
||||
pass_condition: logic_violation_count == 0
|
||||
- validator: validate_package_script_budget_v1.py
|
||||
purpose: package.json script count와 chained command를 예산화
|
||||
pass_condition: script_count <= 12 and chained_script_count == 0
|
||||
- validator: validate_factor_lifecycle_coverage_v1.py
|
||||
purpose: 모든 팩터가 horizon, decay, conflict, activation, retirement를 갖는지 검사
|
||||
pass_condition: factor_lifecycle_coverage_pct == 100
|
||||
- validator: validate_performance_activation_gate_v1.py
|
||||
purpose: 성과 미달 팩터가 active로 승격되는 것을 차단
|
||||
pass_condition: active_factor_with_failed_performance_count == 0
|
||||
- validator: validate_low_capability_context_closure_v2.py
|
||||
purpose: 저성능 LLM context가 외부 숫자 생성 없이 보고서 작성 가능한지 검사
|
||||
pass_condition: llm_free_numeric_field_count == 0 and missing_required_section_count
|
||||
== 0
|
||||
- validator: validate_doc_entropy_v1.py
|
||||
purpose: 문서 중복, AGENTS 비대화, stale ADR를 검사
|
||||
pass_condition: duplicate_doc_block_count == 0 and agents_line_count <= 220
|
||||
- validator: validate_active_artifact_presence_in_canonical_v1.py
|
||||
purpose: active artifact가 canonical/artifacts 또는 Temp final packet과 일치하는지 검사
|
||||
pass_condition: active_artifact_match_pct == 100
|
||||
low_capability_llm_operating_procedure:
|
||||
role: renderer_only
|
||||
forbidden:
|
||||
- 숫자 계산
|
||||
- 가격 추정
|
||||
- 수량 추정
|
||||
- 하네스 verdict 번복
|
||||
- missing data 보정
|
||||
- 외부 시장 데이터로 harness 교체
|
||||
allowed:
|
||||
- final_context_for_llm.yaml 값 복사
|
||||
- DATA_MISSING 표기
|
||||
- blocker 설명
|
||||
- action_table를 사람이 읽게 정리
|
||||
- 교육용 설명
|
||||
fixed_steps:
|
||||
- step: 1
|
||||
name: read_required_files
|
||||
instruction: AGENTS.md 읽기 순서를 따른다. 파일이 없으면 DATA_MISSING으로 쓰고 추정하지 않는다.
|
||||
- step: 2
|
||||
name: print_executive_gate
|
||||
instruction: engine_gate, blockers, readiness_gate를 먼저 출력한다.
|
||||
- step: 3
|
||||
name: print_sell_priority
|
||||
instruction: sell candidate가 2개 이상이면 sell priority table을 action table보다 먼저 출력한다.
|
||||
- step: 4
|
||||
name: print_actions
|
||||
instruction: BUY/SELL/HOLD/WATCH/AVOID는 packet의 action만 사용한다.
|
||||
- step: 5
|
||||
name: print_cash_defense
|
||||
instruction: D+2 현금을 즉시현금 방어선 충족으로 포함하되 결제갭 리스크는 별도 표시한다.
|
||||
- step: 6
|
||||
name: print_shadow_ledger
|
||||
instruction: blocked/limited 항목의 산출값을 숨기지 않는다.
|
||||
- step: 7
|
||||
name: print_data_missing
|
||||
instruction: 하네스 결측은 DATA_MISSING — 하네스 업데이트 필요 문구로만 표기한다.
|
||||
response_quality_checklist:
|
||||
- 모든 숫자에 provenance가 있거나 packet에서 온 값이다.
|
||||
- 매수/매도 가격과 수량을 LLM이 생성하지 않았다.
|
||||
- live와 replay 성과를 섞지 않았다.
|
||||
- 하네스 차단 신호를 문장으로 완화하지 않았다.
|
||||
- 보고서 섹션 순서가 계약과 일치한다.
|
||||
quant_decision_policy_to_lock:
|
||||
entry_policy:
|
||||
- 신규 매수는 macro/risk/cash/data/integrity gate가 모두 통과해야 한다.
|
||||
- 상승률 후행 추격 신호만 존재하면 BUY가 아니라 WATCH_PULLBACK 또는 AVOID_CHASE로 둔다.
|
||||
- fundamental 우수 + 단기 과열이면 분할진입 또는 대기이며 전량 BUY 금지.
|
||||
- distribution risk가 높으면 breakout score가 좋아도 size cap 또는 block.
|
||||
exit_policy:
|
||||
- ABS_FLOOR는 다른 서사보다 우선한다.
|
||||
- 수익 보유 종목은 trailing/profit ratchet으로 수익금 방어를 먼저 한다.
|
||||
- 현금 부족은 가치 훼손 최소화 optimizer로 해결하고, 임의 매도 금지.
|
||||
- sell priority table 없이 복수 매도 후보를 나열하지 않는다.
|
||||
activation_policy:
|
||||
- operational_t20_count < 30이면 live 성과 기반 active 승격 금지.
|
||||
- prediction_match_rate_pct < 60이면 alpha confidence를 확대하지 않는다.
|
||||
- cash_recovery_value_damage_pct > 10이면 현금확보 알고리즘을 active 확대하지 않는다.
|
||||
- algorithm_guidance_proof < 80이면 guidance wording을 강화하고 shadow ledger를 확대한다.
|
||||
target_metrics_after_refactor:
|
||||
hard_gates:
|
||||
authority_collision_count: 0
|
||||
single_truth_conflict_count: 0
|
||||
missing_packaged_artifact_refs: 0
|
||||
unproven_report_number_count: 0
|
||||
renderer_calculation_count: 0
|
||||
llm_free_numeric_field_count: 0
|
||||
changed_files_without_change_request_count: 0
|
||||
active_formula_without_golden_case_count: 0
|
||||
replay_used_as_live_count: 0
|
||||
repository_entropy_targets:
|
||||
package_script_count_target: 12
|
||||
tools_business_logic_violation_count: 0
|
||||
agents_md_line_count_max: 220
|
||||
formula_registry_direct_edit_allowed: false
|
||||
canonical_active_artifact_per_formula: 1
|
||||
performance_targets_for_active_trading_upgrade:
|
||||
operational_t20_sample_min: 30
|
||||
prediction_match_rate_pct_min: 60
|
||||
execution_expectancy_pct_min: 0.1
|
||||
execution_win_rate_pct_min: 45
|
||||
cash_recovery_value_damage_pct_max: 10
|
||||
overall_hardening_score_min: 80
|
||||
algorithm_guidance_proof_min: 80
|
||||
recommended_file_changes:
|
||||
create:
|
||||
- runtime/refactor_baseline_v1.yaml
|
||||
- tools/validate_packaged_artifact_references_v1.py
|
||||
- tools/validate_package_script_budget_v1.py
|
||||
- tools/validate_tools_are_thin_wrappers_v1.py
|
||||
- tools/validate_formula_contract_completeness_v1.py
|
||||
- tools/run_release_dag_v2.py
|
||||
- schemas/formula_contract.schema.json
|
||||
- schemas/release_dag.schema.json
|
||||
- spec/formulas/domains/entry.yaml
|
||||
- spec/formulas/domains/exit.yaml
|
||||
- spec/formulas/domains/risk.yaml
|
||||
- spec/formulas/domains/cash.yaml
|
||||
- spec/formulas/domains/portfolio.yaml
|
||||
- spec/formulas/domains/fundamental.yaml
|
||||
- spec/formulas/domains/smart_money.yaml
|
||||
- spec/formulas/domains/macro.yaml
|
||||
- spec/formulas/domains/reporting.yaml
|
||||
- runtime/rollback_manifest_v1.yaml
|
||||
modify:
|
||||
- AGENTS.md
|
||||
- package.json
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/41_release_dag.yaml
|
||||
- spec/43_quant_factor_taxonomy.yaml
|
||||
- spec/46_low_capability_execution_pack.yaml
|
||||
- spec/release/repository_entropy_budget.yaml
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
- tools/prepare_upload_zip.py
|
||||
archive_or_generate_only:
|
||||
- 구버전 Temp 산출물 참조
|
||||
- artifacts/canonical 내 중복 active 버전
|
||||
- tools와 src에 동시에 존재하는 business logic 파일
|
||||
- 직접 편집되는 generated schema/model/formula 파일
|
||||
implementation_sequence_for_a_low_capability_agent:
|
||||
- 1. 절대 투자 공식부터 수정하지 말고 P0 validator를 먼저 만든다.
|
||||
- 2. validate_packaged_artifact_references_v1.py를 실행해 missing refs를 0으로 만든다.
|
||||
- 3. package.json script count를 줄이기 전 현재 scripts를 release_dag.yaml로 그대로 옮긴다.
|
||||
- 4. DAG가 기존 full-gate와 동일한 결과를 낸 뒤 package.json을 축소한다.
|
||||
- 5. formula registry를 domain shard로 복사 분할하되, normalized 13_formula_registry는 generator로
|
||||
재생성한다.
|
||||
- 6. tools/src 중복 파일을 하나씩 wrapper화하고 매번 golden/parity/release gate를 실행한다.
|
||||
- 7. 저성능 LLM final_context를 먼저 닫고, 보고서 prompt는 context 외부 숫자 접근을 금지한다.
|
||||
- 8. 성과 개선 알고리즘은 전부 shadow로 추가하고 operational sample 조건 충족 전 active 승격하지 않는다.
|
||||
- 9. 모든 변경은 change_request yaml에 rationale, touched_files, expected_metric, rollback_plan을
|
||||
적는다.
|
||||
- 10. 마지막에 release_dag_run_v2.json, refactor_release_audit_v1.json, rollback_manifest_v1.yaml을
|
||||
생성한다.
|
||||
definition_of_done:
|
||||
- 업로드 zip만 받아도 active manifest의 모든 참조를 열 수 있다.
|
||||
- package.json은 12개 이하의 top-level command만 가진다.
|
||||
- spec domain shard가 원본이고 normalized registry는 생성물이다.
|
||||
- tools는 얇은 CLI wrapper이며 계산 로직은 src/quant_engine에만 있다.
|
||||
- 새 공식은 contract/schema/golden/owner/activation/retirement 없이는 merge되지 않는다.
|
||||
- 저성능 LLM은 final_context_for_llm.yaml만 보고도 동일한 action table을 출력한다.
|
||||
- 리포트의 모든 숫자는 provenance 100%를 유지한다.
|
||||
- live/replay/imputed/manual 데이터가 분리되어 표시된다.
|
||||
- 투자 활성화는 성과 게이트 미달 시 항상 WATCH/AUDIT_ONLY로 남는다.
|
||||
- rollback이 단일 명령 또는 단일 manifest 교체로 가능하다.
|
||||
@@ -0,0 +1,733 @@
|
||||
schema_version: quant_engine_refactor_todo.v1
|
||||
generated_at_kst: '2026-06-07T17:37:26.756697+09:00'
|
||||
source:
|
||||
zip_path: data_feed.zip
|
||||
zip_sha256: e12322eb72d2e8184f5f5e010a4c0014c584bc170970b4788b7b79562065d227
|
||||
primary_instruction_file: data_feed/AGENTS.md
|
||||
assumed_runtime_timezone: Asia/Seoul
|
||||
objective_profile:
|
||||
target_asset_krw: 500000000
|
||||
cadence: weekly; Sat/Sun rebalancing; 1/11/21 mid-month checkpoint
|
||||
executive_decision:
|
||||
recommended_methodology_name: 'QEDD: Quant Evidence-Driven Development'
|
||||
one_line: spec을 권위 원천으로 고정하고, Python canonical 엔진에서만 계산하며, GAS/LLM/renderer는 얇은
|
||||
어댑터와 설명 계층으로 격하한다.
|
||||
north_star: 저성능 LLM도 final_context 패킷과 고정 순서 TODO만 따라 동일한 결론을 내는 결정론적 퀀트 엔진
|
||||
non_negotiables:
|
||||
- LLM은 숫자, 가격, 수량, TP/SL, 점수, 공식, 주문문을 생성하지 않는다.
|
||||
- 모든 산출 숫자는 formula_id, source_path, json_pointer, input_hash를 가진다.
|
||||
- 새 전략은 contract -> schema -> golden case -> shadow ledger -> replay -> activation
|
||||
gate 순서 없이는 active가 될 수 없다.
|
||||
- GAS는 데이터 수집/시트 입출력 어댑터로만 유지하고 투자 판단 로직은 Python canonical로 이전한다.
|
||||
- 보고서는 final_decision_packet과 provenance ledger만 읽고 계산하지 않는다.
|
||||
current_state_audit:
|
||||
inventory_observed:
|
||||
total_file_count_from_entropy_audit: 1433
|
||||
repository_budget_max_total_files: 2000
|
||||
temp_json_count_from_entropy_audit: 16
|
||||
package_script_count_from_package_json: 22
|
||||
python_files_total: 834
|
||||
yaml_files_total: 170
|
||||
markdown_files_total: 39
|
||||
gas_files_total: 8
|
||||
tools_py_total: 355
|
||||
build_tools_count: 161
|
||||
validate_tools_count: 140
|
||||
spec_files_count: 125
|
||||
formula_registry_count: 149
|
||||
generated_formula_py_count: 149
|
||||
generated_golden_py_count: 149
|
||||
factor_registry_count: 149
|
||||
factor_promotion_gate_distribution:
|
||||
draft: 149
|
||||
factor_empty_golden_case_count: 149
|
||||
things_working:
|
||||
- area: single source manifest
|
||||
evidence: 'runtime/active_artifact_manifest.yaml: active_count_per_formula=1,
|
||||
report_active_artifact_match_pct=100.0, authority_collision_count=0'
|
||||
- area: output authority matrix
|
||||
evidence: 'governance/authority_matrix.yaml: owned_output_field_pct=100.0, authority_collision_count=0,
|
||||
manual_override_field_count=0'
|
||||
- area: field dictionary validation
|
||||
evidence: validate_field_dictionary.py PASS; field_count=351
|
||||
- area: number provenance
|
||||
evidence: validate_number_provenance_strict_v3.py PASS; coverage_pct=100, stale_critical_number_count=0
|
||||
- area: low capability pack after manual build
|
||||
evidence: build_final_decision_packet_v4.py + build_low_capability_context_pack_v5.py
|
||||
+ validate_low_capability_pack_v1.py PASS
|
||||
- area: repository entropy budget
|
||||
evidence: audit_repository_entropy_v2.py PASS; total_file_count=1433 < 2000
|
||||
critical_gaps:
|
||||
- gap_id: GAP-001
|
||||
severity: P0
|
||||
title: release mode가 build dependency closure를 실행하지 않아 결측 artifact에서 실패 가능
|
||||
evidence: run_release_dag_v3.py --mode release initially attempted validate_low_capability
|
||||
before Temp/final_context_for_llm_v5.yaml existed.
|
||||
impact: 저성능 LLM용 패킷, provenance, report sync가 환경 상태에 따라 통과/실패하는 비결정성 발생
|
||||
fix_direction: mode별 target node의 dependency closure를 먼저 계산하고 depends_on build
|
||||
node는 항상 선행 실행
|
||||
- gap_id: GAP-002
|
||||
severity: P0
|
||||
title: architecture boundary gate가 FAIL이며 module IO schema coverage와 artifact
|
||||
chain이 0
|
||||
evidence: 'validate_architecture_boundaries_v2.py: module_io_schema_coverage_pct=0.0,
|
||||
artifact_chain_count=0; builder scan also renderer_calculation_count=5'
|
||||
impact: data -> feature -> decision -> execution -> report 단방향 경계의 실증이 부족함
|
||||
fix_direction: module_io_contract registry와 artifact_hash_chain builder를 release
|
||||
DAG에 build+validate 쌍으로 추가
|
||||
- gap_id: GAP-003
|
||||
severity: P1
|
||||
title: GAS thin adapter 정책과 실제 GAS 구현 간 괴리가 큼
|
||||
evidence: validate_gas_thin_adapter_v1.py found forbidden_gas_business_logic_count=98
|
||||
but gate=PASS due migration_plan_exists
|
||||
impact: Python canonical first 원칙이 깨지고 공식 이중 구현/상호충돌 위험 증가
|
||||
fix_direction: GAS calculation logic를 pure adapter facade로 축소하고 formula outputs는
|
||||
Python runtime artifact에서만 공급
|
||||
- gap_id: GAP-004
|
||||
severity: P1
|
||||
title: 149개 factor가 모두 draft이며 golden_cases가 비어 있음
|
||||
evidence: factor_lifecycle_registry.yaml factors=149, promotion_gate=draft 149,
|
||||
empty golden_cases=149
|
||||
impact: 팩터가 많아도 어떤 팩터가 수익률/손실방어에 기여하는지 승격·퇴출 판단 불가
|
||||
fix_direction: factor lifecycle을 draft/shadow/candidate/active/retired로 강제하고 최소
|
||||
golden/replay/edge gate를 채워야 promotion 가능
|
||||
- gap_id: GAP-005
|
||||
severity: P1
|
||||
title: tools 스프롤이 커져 개발자가 어느 CLI를 고쳐야 하는지 불명확
|
||||
evidence: tools/*.py=355, build_*=161, validate_*=140
|
||||
impact: 중복 하네스, 버전 파편화, 릴리즈 시간 증가, 유지보수 난이도 상승
|
||||
fix_direction: tools를 thin CLI로 유지하되 내부 로직은 src/quant_engine 하위 패키지로 이동하고 CLI
|
||||
registry를 자동 생성
|
||||
- gap_id: GAP-006
|
||||
severity: P2
|
||||
title: 문서와 spec의 경계는 좋아졌으나 still too many rule/spec surfaces
|
||||
evidence: spec files 125, yaml files 170, markdown files 39
|
||||
impact: 저성능 LLM이 여러 문서의 상충 규칙을 동시에 소화하기 어려움
|
||||
fix_direction: AGENTS.md는 80~100 lines index로 유지, 상세 규칙은 5개 domain bundle로 압축,
|
||||
generated low-capability pack으로만 serving
|
||||
target_architecture:
|
||||
principle: Source of Truth는 spec/*.yaml, deterministic calculation은 src/quant_engine,
|
||||
execution packaging은 Temp/final_decision_packet_active.json, narrative는 renderer/LLM
|
||||
layering:
|
||||
- layer: L0_governance
|
||||
path: AGENTS.md, governance/, docs/adr/
|
||||
responsibility: 권위, 변경승인, lifecycle, 운영 헌법
|
||||
may_calculate: false
|
||||
- layer: L1_contracts
|
||||
path: spec/
|
||||
responsibility: 입력/출력/schema/formula/risk/order/report 계약
|
||||
may_calculate: false
|
||||
- layer: L2_core_engine
|
||||
path: src/quant_engine/
|
||||
responsibility: 공식 구현, 데이터 검증, 팩터, 리스크, 포트폴리오, execution blueprint
|
||||
may_calculate: true
|
||||
- layer: L3_cli
|
||||
path: tools/
|
||||
responsibility: build/validate/render/release 명령 wrapper
|
||||
may_calculate: false
|
||||
- layer: L4_adapters
|
||||
path: gas_*.gs, src/gas_adapter_parts/
|
||||
responsibility: Google Sheet/HTS/외부 데이터 입출력
|
||||
may_calculate: false
|
||||
- layer: L5_runtime
|
||||
path: Temp/, runtime/
|
||||
responsibility: 실행 산출물, lineage, manifest, final context
|
||||
may_calculate: false
|
||||
- layer: L6_reporting
|
||||
path: tools/render_operational_report.py, prompts/
|
||||
responsibility: 계산 없이 final packet을 사람이 읽을 수 있게 렌더링
|
||||
may_calculate: false
|
||||
canonical_package_structure:
|
||||
src/quant_engine/contracts/: YAML/schema loader, contract resolver, field dictionary
|
||||
resolver
|
||||
src/quant_engine/data/: raw workbook mapping, freshness, missingness, as-of alignment,
|
||||
leakage guard
|
||||
src/quant_engine/formulas/: registered deterministic formulas only; generated
|
||||
wrappers allowed
|
||||
src/quant_engine/factors/: factor lifecycle, edge measurement, promotion/retirement
|
||||
logic
|
||||
src/quant_engine/risk/: portfolio exposure, cash floor, heat, drawdown, circuit
|
||||
breakers
|
||||
src/quant_engine/portfolio/: position sizing, rebalancing, cash recovery optimizer,
|
||||
concentration policy
|
||||
src/quant_engine/execution/: order grammar, tick normalization, TP/SL ladder,
|
||||
execution blueprint
|
||||
src/quant_engine/reporting/: packet builders only; no free calculation in renderer
|
||||
src/quant_engine/validation/: contract, golden, property, parity, replay, release
|
||||
gates
|
||||
src/quant_engine/observability/: lineage events, provenance ledger, health card,
|
||||
drift dashboard
|
||||
methodology:
|
||||
name: QEDD loop
|
||||
loop:
|
||||
- '1_contract_first: 새 판단/팩터/출력은 YAML contract와 owner field부터 정의한다.'
|
||||
- '2_schema_and_golden_first: 입력 스키마, 출력 스키마, 최소 golden case를 작성한다.'
|
||||
- '3_python_canonical_implementation: 계산은 src/quant_engine에만 구현한다.'
|
||||
- '4_shadow_run: 최소 20 trading days 또는 replay 250 bars 이상 shadow ledger에 기록한다.'
|
||||
- '5_edge_and_risk_evaluation: hit rate, payoff, drawdown, slippage, late-chase
|
||||
avoidance를 측정한다.'
|
||||
- '6_activation_gate: threshold 충족 시 active manifest에만 승격한다.'
|
||||
- '7_report_serving: LLM은 final_context_for_llm_v5.yaml만 읽고 고정 템플릿으로 출력한다.'
|
||||
- '8_post_trade_feedback: 실행 결과를 outcome ledger로 되돌려 calibration registry를 갱신한다.'
|
||||
development_rules:
|
||||
definition_of_ready:
|
||||
- change_request yaml exists
|
||||
- owner assigned
|
||||
- affected formula_id/output_field listed
|
||||
- conflict_precedence declared
|
||||
- data source and freshness SLA declared
|
||||
- golden case target declared
|
||||
definition_of_done:
|
||||
- contract validation PASS
|
||||
- schema/model parity PASS
|
||||
- golden coverage PASS
|
||||
- property invariants PASS
|
||||
- no unproven number in report PASS
|
||||
- release DAG full dependency closure PASS
|
||||
- lineage event written
|
||||
- rollback path documented
|
||||
anti_overengineering_rule: 새 파일 추가 전 existing owner/domain에 병합 가능한지 먼저 확인한다. 새
|
||||
파일은 CR에 entropy_delta와 retirement_plan이 있어야 한다.
|
||||
quant_algorithm_spine:
|
||||
decision_sequence:
|
||||
- step: 1
|
||||
name: data_integrity_gate
|
||||
purpose: 결측/신선도/as-of/단위/ticker 정합성 차단
|
||||
output: PASS | DATA_MISSING | STALE | UNIT_MISMATCH
|
||||
- step: 2
|
||||
name: market_regime_gate
|
||||
purpose: KOSPI/KOSDAQ/미국/금리/환율/VIX/크레딧 리스크로 risk-on/off/neutral 판정
|
||||
output: regime, target_cash_pct, heat_limit
|
||||
- step: 3
|
||||
name: portfolio_health_gate
|
||||
purpose: 현금 방어선, D+2 즉시현금, 집중도, 손실방어, 목표 5억 진행률
|
||||
output: cash_shortfall, exposure_breach, rebalance_required
|
||||
- step: 4
|
||||
name: factor_evidence_stack
|
||||
purpose: 펀더멘털/스마트머니/상대강도/수급/변동성/섹터회전 점수를 동일 단위로 정규화
|
||||
output: factor_score_by_ticker
|
||||
- step: 5
|
||||
name: anti_late_entry_gate
|
||||
purpose: 상승 끝물 추격매수/설거지 구간 차단
|
||||
output: entry_allowed, pullback_required, chase_risk_score
|
||||
- step: 6
|
||||
name: execution_blueprint
|
||||
purpose: 주문 가능 여부, 가격, 수량, 손절/익절, tick normalization, order grammar 산출
|
||||
output: order_blueprint
|
||||
- step: 7
|
||||
name: shadow_and_outcome_feedback
|
||||
purpose: 실행 전/후 예측 정확도, 비용, slippage, drawdown contribution 측정
|
||||
output: outcome_ledger, calibration_update
|
||||
factor_domains:
|
||||
fundamental:
|
||||
- earnings_quality
|
||||
- growth_rate
|
||||
- cashflow_stability
|
||||
- valuation_peg
|
||||
- balance_sheet_health
|
||||
smart_money_liquidity:
|
||||
- foreign_institution_flow
|
||||
- volume_acceleration
|
||||
- liquidity_depth
|
||||
- ETF/sector flow
|
||||
- flow_breadth
|
||||
price_momentum:
|
||||
- relative_strength
|
||||
- breakout_quality
|
||||
- pullback_depth
|
||||
- follow_through_day
|
||||
- trend_slope
|
||||
risk_exit:
|
||||
- drawdown_guard
|
||||
- distribution_risk
|
||||
- late_chase_attribution
|
||||
- profit_lock_ratchet
|
||||
- stop_loss
|
||||
portfolio_construction:
|
||||
- cash_floor
|
||||
- sector_concentration
|
||||
- single_position_cap
|
||||
- correlation_gate
|
||||
- risk_budget_cascade
|
||||
activation_thresholds:
|
||||
new_factor_shadow_min_trading_days: 20
|
||||
candidate_min_replay_cases: 100
|
||||
candidate_min_golden_cases: 3
|
||||
active_required_incremental_edge_bps: 30
|
||||
active_max_drawdown_worsening_bps: 0
|
||||
late_chase_false_positive_review_required: true
|
||||
promotion_requires_owner_approval: true
|
||||
scorecards:
|
||||
engine_release_score_formula:
|
||||
formula: 0.15*data_integrity + 0.15*number_provenance + 0.10*schema_model_parity
|
||||
+ 0.10*golden_coverage + 0.10*property_invariants + 0.10*architecture_boundary
|
||||
+ 0.10*gas_thin_adapter + 0.10*factor_lifecycle + 0.10*llm_regression
|
||||
pass_threshold: 95
|
||||
block_threshold: 90
|
||||
hard_blocks:
|
||||
- number_provenance < 100
|
||||
- authority_collision_count > 0
|
||||
- llm_free_numeric_field_count > 0
|
||||
- release_dependency_missing_count > 0
|
||||
factor_promotion_score_formula:
|
||||
formula: 0.25*out_of_sample_hit_quality + 0.20*payoff_ratio_quality + 0.15*drawdown_defense
|
||||
+ 0.15*turnover_cost_efficiency + 0.10*regime_robustness + 0.10*data_quality
|
||||
+ 0.05*interpretability
|
||||
shadow_to_candidate_min: 70
|
||||
candidate_to_active_min: 80
|
||||
retire_below: 50
|
||||
late_chase_defense_score_formula:
|
||||
formula: 0.30*post_signal_pullback_need_accuracy + 0.25*breakout_failure_avoidance
|
||||
+ 0.20*distribution_warning_lead_days + 0.15*slippage_reduction + 0.10*false_block_penalty_inverse
|
||||
purpose: 뒷북 매수/설거지 매수 방지를 정량 평가
|
||||
low_capability_llm_serving_contract:
|
||||
input_allowed:
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
- Temp/final_context_for_llm_v5.yaml
|
||||
- Temp/final_decision_packet_active.json
|
||||
- Temp/number_provenance_ledger_v4.json
|
||||
- spec/46_low_capability_execution_pack.yaml
|
||||
input_forbidden:
|
||||
- raw workbook unless parser step explicitly requested
|
||||
- deprecated artifacts
|
||||
- archive artifacts
|
||||
- multiple conflicting prompts
|
||||
response_order:
|
||||
- portfolio_health
|
||||
- blockers
|
||||
- action_table
|
||||
- sell_priority_table_if_needed
|
||||
- order_blueprint
|
||||
- shadow_ledger
|
||||
- data_missing
|
||||
- education_notes
|
||||
- next_validation_tasks
|
||||
strict_rules:
|
||||
- 숫자가 없으면 DATA_MISSING만 쓴다.
|
||||
- 계산 근거 없는 수익률/가격/수량은 쓰지 않는다.
|
||||
- 하네스 verdict를 완화하거나 뒤집지 않는다.
|
||||
- blocked 상태도 산출 기준가/손절/익절/수량이 packet에 있으면 숨기지 않는다.
|
||||
- 주문문에는 복수 조건 접속사를 넣지 않는다.
|
||||
fixed_prompt: Read only the allowed input packet. Render the report in the response_order.
|
||||
Never invent numbers. If a field is missing, write DATA_MISSING — harness update
|
||||
required. Preserve all blocker states. Use final_decision_packet as the only execution
|
||||
authority.
|
||||
refactor_todo:
|
||||
- id: P0-001
|
||||
phase: P0_release_determinism
|
||||
title: run_release_dag_v3.py를 dependency-closure 실행기로 교체
|
||||
problem: release mode가 validate_*만 실행하면서 validate node의 build dependencies를 생략할
|
||||
수 있다.
|
||||
files_to_modify:
|
||||
- tools/run_release_dag_v3.py
|
||||
- spec/41_release_dag.yaml
|
||||
implementation_steps:
|
||||
- target_nodes = mode filter로 선택한다.
|
||||
- target_nodes의 모든 depends_on을 재귀적으로 수집해 closure_nodes를 만든다.
|
||||
- topological order 중 closure_nodes만 실행한다.
|
||||
- validate_*가 필요로 하는 outputs가 없으면 build dependency를 자동 선행 실행한다.
|
||||
- REPORT에는 skipped_by_mode와 executed_due_to_dependency를 분리 기록한다.
|
||||
- node별 input_hash/output_hash, elapsed_sec, command, returncode를 lineage에 기록한다.
|
||||
commands:
|
||||
- python tools/run_release_dag_v3.py --mode release --strict
|
||||
- python tools/run_release_dag_v3.py --mode full --strict
|
||||
acceptance_criteria:
|
||||
- release mode에서 Temp/final_context_for_llm_v5.yaml이 없더라도 build_final_context가 먼저
|
||||
실행된다.
|
||||
- release_dependency_missing_count == 0
|
||||
- RELEASE_DAG_RUN_V4.gate == PASS
|
||||
rollback: 기존 run_release_dag_v3.py를 run_release_dag_v3_legacy.py로 보존하고 package.json
|
||||
script는 v4로 전환 전까지 v3 유지
|
||||
status: completed
|
||||
- id: P0-002
|
||||
phase: P0_architecture_boundary
|
||||
title: module_io_contract_registry 도입
|
||||
problem: architecture boundary validator가 module_io_schema_coverage_pct=0.0으로 실패한다.
|
||||
files_to_create:
|
||||
- spec/48_module_io_contract_registry.yaml
|
||||
- tools/build_module_io_coverage_v1.py
|
||||
- tools/validate_module_io_coverage_v1.py
|
||||
implementation_steps:
|
||||
- src/quant_engine 주요 모듈별 inputs, outputs, owner, schema, artifact_path를 registry에
|
||||
선언한다.
|
||||
- tools/build_module_io_coverage_v1.py가 registry와 실제 artifact/schema 존재 여부를 비교한다.
|
||||
- coverage = modules_with_input_schema_and_output_schema / total_modules * 100으로
|
||||
계산한다.
|
||||
- coverage 결과를 Temp/module_io_coverage_v1.json으로 저장한다.
|
||||
- architecture_boundaries_v2 builder가 harness_coverage_audit.json 대신 module_io_coverage_v1.json을
|
||||
읽도록 수정한다.
|
||||
acceptance_criteria:
|
||||
- module_io_schema_coverage_pct >= 100.0
|
||||
- missing_module_contract_count == 0
|
||||
status: completed
|
||||
- id: P0-003
|
||||
phase: P0_artifact_hash_chain
|
||||
title: artifact hash chain builder를 release DAG에 추가
|
||||
problem: artifact_chain_count=0으로 artifact lineage 검증이 불가능하다.
|
||||
files_to_create:
|
||||
- tools/build_artifact_chain_hash_v4.py
|
||||
- tools/validate_artifact_chain_hash_v4.py
|
||||
files_to_modify:
|
||||
- spec/41_release_dag.yaml
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
implementation_steps:
|
||||
- active manifest의 canonical_source부터 final packet, provenance ledger, report json/md까지
|
||||
chain을 구성한다.
|
||||
- 각 artifact에 path, sha256, formula_id, generated_at, parent_hash를 기록한다.
|
||||
- 'chain length 최소 4개: raw json -> final packet -> provenance ledger -> report output.'
|
||||
- Temp/artifact_chain_hash_v4.json을 생성한다.
|
||||
acceptance_criteria:
|
||||
- artifact_chain_count >= 4
|
||||
- artifact_hash_chain_coverage_pct == 100.0
|
||||
status: completed
|
||||
- id: P0-004
|
||||
phase: P0_renderer_purity
|
||||
title: renderer calculation scanner false positive와 실제 계산을 분리
|
||||
problem: render_operational_report.py에서 path join/string concat까지 calculation으로
|
||||
잡히는 보수적 scanner가 release를 막을 수 있다.
|
||||
files_to_modify:
|
||||
- tools/build_architecture_boundaries_v2.py
|
||||
- tools/render_operational_report.py
|
||||
implementation_steps:
|
||||
- AST 기반 scanner로 Numeric BinOp, Call(round/sum/mean), literal arithmetic만 계산으로
|
||||
카운트한다.
|
||||
- Path join, string concatenation, markdown assembly는 allowed_renderer_ops로 whitelist한다.
|
||||
- renderer는 get_value(packet, pointer)와 render_section만 사용하도록 정리한다.
|
||||
- renderer_calculation_count가 실제 투자 숫자 계산에 대해서만 증가하게 한다.
|
||||
acceptance_criteria:
|
||||
- renderer_calculation_count == 0
|
||||
- renderer_allowed_formatting_ops_count >= 1
|
||||
status: completed
|
||||
- id: P1-001
|
||||
phase: P1_gas_thin_adapter_migration
|
||||
title: GAS business logic 98건을 Python artifact 소비로 이전
|
||||
problem: GAS 내부에 macro_risk_score, TP/SL, routing, score 등 계산 흔적이 남아 있다.
|
||||
files_to_modify:
|
||||
- gas_data_feed.gs
|
||||
- gas_data_collect.gs
|
||||
- gas_apex_runtime_core.gs
|
||||
- gas_harness_rows.gs
|
||||
- src/gas_adapter_parts/*
|
||||
implementation_steps:
|
||||
- GAS function inventory를 collect/read/write/render/legacy_logic로 분류한다.
|
||||
- legacy_logic 함수마다 Python formula_id와 output artifact를 매핑한다.
|
||||
- GAS 계산 함수는 deprecate wrapper로 바꾸고 Python artifact value를 읽게 한다.
|
||||
- GAS에서 점수/가격/수량 계산 키워드가 검출되면 validator gate를 FAIL로 변경한다.
|
||||
- migration_allowlist는 30일 만료일을 가진다.
|
||||
acceptance_criteria:
|
||||
- forbidden_gas_business_logic_count == 0
|
||||
- validate_gas_thin_adapter_v2.gate == PASS
|
||||
migration_batches:
|
||||
- batch: 1
|
||||
scope: macro_risk_score and routing trace read-only migration
|
||||
- batch: 2
|
||||
scope: TP/SL ladder and tick normalization migration
|
||||
- batch: 3
|
||||
scope: distribution/late chase risk score migration
|
||||
- batch: 4
|
||||
scope: order blueprint assembly migration
|
||||
status: completed
|
||||
- id: P1-002
|
||||
phase: P1_factor_lifecycle
|
||||
title: 149개 factor를 lifecycle gate로 재분류
|
||||
problem: 모든 factor가 draft이며 golden_cases가 없어 활성/퇴출 기준이 없다.
|
||||
files_to_modify:
|
||||
- spec/factor_lifecycle_registry.yaml
|
||||
- spec/43_quant_factor_taxonomy.yaml
|
||||
files_to_create:
|
||||
- tools/build_factor_edge_report_v1.py
|
||||
- tools/validate_factor_promotion_gates_v1.py
|
||||
- Temp/factor_edge_report_v1.json
|
||||
implementation_steps:
|
||||
- factor마다 horizon, hypothesis, data_quality_requirements, conflict_precedence,
|
||||
position_sizing_impact, exit_impact를 채운다.
|
||||
- '각 factor 최소 golden_cases 3개를 연결한다: positive, negative, missing_data.'
|
||||
- shadow_start_date와 activation_threshold를 필수화한다.
|
||||
- draft factor는 report decision에 영향 0으로 제한한다.
|
||||
- candidate 이상만 sizing/exit에 영향 가능하도록 gate를 둔다.
|
||||
- retirement_condition이 90일 no edge 또는 high conflict이면 retired로 이동한다.
|
||||
acceptance_criteria:
|
||||
- active factor의 golden_cases_count >= 3
|
||||
- draft factor의 position_sizing_impact == diagnostic
|
||||
- factor_promotion_gate_distribution에 active/candidate/shadow/draft/retired가 명시됨
|
||||
- empty_golden_case_count for non-draft == 0
|
||||
status: completed
|
||||
- id: P1-003
|
||||
phase: P1_tool_sprawl_reduction
|
||||
title: tools/*.py 355개를 CLI registry + src 로직으로 다이어트
|
||||
problem: build/validate CLI가 많아 수정 지점이 분산된다.
|
||||
files_to_create:
|
||||
- spec/49_cli_registry.yaml
|
||||
- src/quant_engine/cli_registry.py
|
||||
- tools/qe.py
|
||||
files_to_modify:
|
||||
- package.json
|
||||
- tools/*.py
|
||||
implementation_steps:
|
||||
- 각 tool의 command_id, module_path, function, inputs, outputs, owner, deprecation_status를
|
||||
registry에 등록한다.
|
||||
- 새 CLI는 python tools/qe.py build final-context 같은 방식으로 통합한다.
|
||||
- 기존 tools/build_*.py와 validate_*.py는 20줄 이하 wrapper로 줄인다.
|
||||
- 중복 version tool은 latest canonical만 package.json에서 노출한다.
|
||||
- retired tool은 tools/archive/YYYYMMDD로 이동하고 release DAG에서 제거한다.
|
||||
acceptance_criteria:
|
||||
- package_script_count <= 30
|
||||
- tools_wrapper_over_80_lines_count == 0
|
||||
- deprecated_tool_referenced_by_dag_count == 0
|
||||
status: completed
|
||||
- id: P1-004
|
||||
phase: P1_contract_test_pyramid
|
||||
title: 테스트 피라미드를 release gate로 고정
|
||||
problem: 검증 파일은 많지만 어떤 테스트가 어떤 리스크를 막는지 hierarchy가 약하다.
|
||||
files_to_create:
|
||||
- spec/50_test_pyramid_contract.yaml
|
||||
- tools/build_test_coverage_matrix_v1.py
|
||||
implementation_steps:
|
||||
- 'unit: 공식 단위 golden/property test'
|
||||
- 'contract: YAML schema와 field dictionary parity'
|
||||
- 'integration: final packet/provenance/report sync'
|
||||
- 'replay: as-of aligned historical outcome'
|
||||
- 'llm_regression: low capability context response contract'
|
||||
- 각 test가 막는 failure_mode를 spec에 매핑한다.
|
||||
acceptance_criteria:
|
||||
- critical_failure_modes_covered_pct == 100
|
||||
- orphan_test_count == 0
|
||||
- orphan_validator_count == 0
|
||||
- id: P2-001
|
||||
phase: P2_data_integrity
|
||||
title: data contract를 as-of, freshness, unit, survivorship 관점으로 강화
|
||||
files_to_modify:
|
||||
- spec/02_data_contract.yaml
|
||||
- spec/14_raw_workbook_mapping.yaml
|
||||
- spec/data_quality/expectations.yaml
|
||||
files_to_create:
|
||||
- tools/build_data_lineage_matrix_v1.py
|
||||
- tools/validate_no_future_leakage_v1.py
|
||||
implementation_steps:
|
||||
- 각 raw field에 source_system, as_of_date, refresh_sla, unit, null_policy, transformation_owner를
|
||||
선언한다.
|
||||
- price/volume/financial/macro/account_snapshot의 time grain을 분리한다.
|
||||
- fundamental data는 발표일 기준 availability lag를 반영한다.
|
||||
- D+2 현금은 immediate_cash_defense_line로 별도 field화한다.
|
||||
acceptance_criteria:
|
||||
- field_lineage_coverage_pct == 100
|
||||
- future_leakage_case_count == 0
|
||||
- unit_mismatch_count == 0
|
||||
- id: P2-002
|
||||
phase: P2_backtest_replay
|
||||
title: live/replay 분리와 walk-forward 평가를 activation gate에 연결
|
||||
files_to_modify:
|
||||
- spec/29_backtest_harness_contract.yaml
|
||||
- spec/44_live_replay_separation.yaml
|
||||
files_to_create:
|
||||
- tools/run_walk_forward_eval_v1.py
|
||||
- Temp/walk_forward_eval_v1.json
|
||||
implementation_steps:
|
||||
- live artifact와 replay artifact의 namespace를 강제 분리한다.
|
||||
- 매 factor와 decision rule에 in-sample/out-of-sample 기간을 기록한다.
|
||||
- 거래비용, 세금, 슬리피지, 체결 실패를 비용 모델에 포함한다.
|
||||
- 목표 5억 달성률과 최대낙폭을 동시에 평가한다.
|
||||
acceptance_criteria:
|
||||
- live_replay_mix_count == 0
|
||||
- walk_forward_period_count >= 4
|
||||
- cost_adjusted_edge_report_exists == true
|
||||
- id: P2-003
|
||||
phase: P2_late_chase_defense
|
||||
title: 뒷북/설거지 방지 하네스 강화
|
||||
files_to_modify:
|
||||
- spec/strategy/anti_late_entry_pullback_gate_v5.yaml
|
||||
- spec/strategy/pre_distribution_early_warning_v4.yaml
|
||||
files_to_create:
|
||||
- tools/build_late_chase_confusion_matrix_v1.py
|
||||
- Temp/late_chase_confusion_matrix_v1.json
|
||||
implementation_steps:
|
||||
- 매수 후보 발생 후 T+1/T+3/T+5 최대역행폭과 follow-through를 측정한다.
|
||||
- 차단했어야 할 추격매수와 차단하지 말았어야 할 주도주 눌림목을 분리한다.
|
||||
- 분배 위험, 갭상승 피로도, 거래대금 climax, 외국인/기관 divergence를 조합한다.
|
||||
- late_chase_block이 false positive이면 pullback_entry_trigger로 재진입 후보를 남긴다.
|
||||
acceptance_criteria:
|
||||
- late_chase_false_negative_rate <= 15
|
||||
- leader_pullback_false_block_rate <= 25
|
||||
- confusion_matrix_min_cases >= 50
|
||||
- id: P3-001
|
||||
phase: P3_reporting_and_llm
|
||||
title: 보고서 렌더링을 final_context 기반으로 단일화
|
||||
files_to_modify:
|
||||
- tools/render_operational_report.py
|
||||
- prompts/low_capability_report_renderer.md
|
||||
- spec/31_low_capability_llm_response_contract.yaml
|
||||
implementation_steps:
|
||||
- report renderer는 final_context_for_llm_v5.yaml 섹션만 순서대로 렌더링한다.
|
||||
- operational_report.json과 md는 동일 packet에서 파생되어 checksum을 공유한다.
|
||||
- LLM regression fixture를 매주 1개 이상 추가한다.
|
||||
- '금지어: 추정, 대략, 가능성 높음 같은 숫자 없는 확신 표현을 lint한다.'
|
||||
acceptance_criteria:
|
||||
- llm_regression_pass_pct == 100
|
||||
- report_packet_mismatch_count == 0
|
||||
- ambiguous_instruction_count == 0
|
||||
- id: P3-002
|
||||
phase: P3_document_diet
|
||||
title: '문서/파일 다이어트: 5개 권위 bundle로 압축'
|
||||
files_to_modify:
|
||||
- AGENTS.md
|
||||
- governance/agents_index.yaml
|
||||
- governance/rules/*.yaml
|
||||
- docs/doctrine.md
|
||||
implementation_steps:
|
||||
- AGENTS.md는 운영 인덱스와 hard rule만 유지한다.
|
||||
- rules를 core_locks, harness_contract, portfolio_policy, order_grammar, reporting_contract
|
||||
5개로 유지한다.
|
||||
- 중복 ADR과 중복 spec 설명은 ADR index에서 링크만 유지한다.
|
||||
- 새 문서는 owner, expiry_date, supersedes, archive_policy 없이는 merge 금지한다.
|
||||
acceptance_criteria:
|
||||
- agents_lines <= 100
|
||||
- active_rule_file_count <= 6
|
||||
- duplicate_rule_hash_count == 0
|
||||
- id: P4-001
|
||||
phase: P4_operating_cadence
|
||||
title: 주간/월중 운용 cadence를 release DAG와 보고서에 내장
|
||||
files_to_modify:
|
||||
- spec/operating_cadence.yaml
|
||||
- tools/build_operating_cadence_signal_v1.py
|
||||
- prompts/weekly_operational_report_master_prompt_v1.md
|
||||
implementation_steps:
|
||||
- 토/일이면 rebalancing_required=true를 생성한다.
|
||||
- 매월 1/11/21이면 mid_month_checkpoint_required=true를 생성한다.
|
||||
- D+2 현금은 immediate_cash_defense_line에 포함한다.
|
||||
- 보고서 첫 섹션에서 cadence obligation을 누락하면 release gate FAIL로 둔다.
|
||||
acceptance_criteria:
|
||||
- cadence_signal_present == true
|
||||
- weekend_rebalance_rule_test_pass == true
|
||||
- midmonth_checkpoint_rule_test_pass == true
|
||||
- id: P5-001
|
||||
phase: P5_observability
|
||||
title: 엔진 health card와 drift dashboard를 상시 산출
|
||||
files_to_create:
|
||||
- src/quant_engine/observability/health.py
|
||||
- tools/build_engine_drift_dashboard_v1.py
|
||||
- Temp/engine_drift_dashboard_v1.json
|
||||
implementation_steps:
|
||||
- 매 릴리즈마다 data freshness, factor drift, prediction_match_rate, turnover, slippage,
|
||||
cash defense status를 저장한다.
|
||||
- prediction_match_rate가 하락하면 affected factor를 자동으로 calibration queue에 넣는다.
|
||||
- shadow와 active 성과를 분리 시각화 가능한 json으로 남긴다.
|
||||
acceptance_criteria:
|
||||
- engine_health_card_gate == PASS
|
||||
- drift_dashboard_freshness_days <= 1
|
||||
- calibration_queue_exists == true
|
||||
- id: P6-001
|
||||
phase: P6_release_train
|
||||
title: 정기 release train과 rollback 정책 확정
|
||||
files_to_modify:
|
||||
- spec/release/release_train.yaml
|
||||
- spec/release/version_retirement_policy.yaml
|
||||
- spec/release/repository_entropy_budget.yaml
|
||||
implementation_steps:
|
||||
- 매주 토/일 release window와 월중 1/11/21 checkpoint window를 정의한다.
|
||||
- active manifest 변경은 CR + full DAG PASS + rollback artifact required 조건을 만족해야 한다.
|
||||
- deprecated vN artifacts는 2회 release 뒤 archive로 이동한다.
|
||||
- repository budget은 file count뿐 아니라 active spec count, active tool count, prompt
|
||||
count로 확장한다.
|
||||
acceptance_criteria:
|
||||
- active_artifact_count_per_formula == 1
|
||||
- deprecated_runtime_reference_count == 0
|
||||
- rollback_manifest_exists == true
|
||||
implementation_order:
|
||||
- P0-001
|
||||
- P0-002
|
||||
- P0-003
|
||||
- P0-004
|
||||
- P1-001
|
||||
- P1-002
|
||||
- P1-003
|
||||
- P1-004
|
||||
- P2-001
|
||||
- P2-002
|
||||
- P2-003
|
||||
- P3-001
|
||||
- P3-002
|
||||
- P4-001
|
||||
- P5-001
|
||||
- P6-001
|
||||
suggested_new_files_minimal_set:
|
||||
- spec/48_module_io_contract_registry.yaml
|
||||
- spec/49_cli_registry.yaml
|
||||
- spec/50_test_pyramid_contract.yaml
|
||||
- tools/qe.py
|
||||
- tools/build_artifact_chain_hash_v4.py
|
||||
- tools/validate_release_dependency_closure_v1.py
|
||||
- src/quant_engine/cli_registry.py
|
||||
- src/quant_engine/observability/health.py
|
||||
files_to_retire_or_archive_policy:
|
||||
rule: same formula_id family에서 active latest와 direct golden/validator를 제외한 old builder는
|
||||
archive/YYYYMMDD로 이동
|
||||
candidates_by_pattern:
|
||||
- tools/build_*_v1.py when v2+ active exists
|
||||
- artifacts/archive/**
|
||||
- Temp stale json not in active manifest
|
||||
- prompts superseded by low_capability_report_renderer.md
|
||||
must_not_delete_without_cr:
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/12_field_dictionary.yaml
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
- Temp/final_decision_packet_active.json
|
||||
- governance/authority_matrix.yaml
|
||||
low_capability_executor_todo:
|
||||
instruction: 아래 순서를 기계적으로 수행한다. 해석하거나 보완하지 않는다. 결측은 DATA_MISSING으로 남긴다.
|
||||
steps:
|
||||
- open AGENTS.md and read only hard rules and routing order
|
||||
- open runtime/active_artifact_manifest.yaml and identify canonical_source
|
||||
- open Temp/final_context_for_llm_v5.yaml; if missing, run build_final_decision_packet
|
||||
then build_low_capability_context_pack
|
||||
- validate low capability pack; stop on FAIL
|
||||
- render sections in required order
|
||||
- do not compute numbers; copy packet values with provenance
|
||||
- write blockers before recommendations
|
||||
- write DATA_MISSING for unavailable field
|
||||
- include shadow ledger for blocked/limited actions
|
||||
- run release dependency closure validation before packaging
|
||||
first_week_execution_plan:
|
||||
day_1:
|
||||
- Fix release DAG dependency closure
|
||||
- Generate final_context_for_llm_v5 from clean Temp
|
||||
- Add closure validator
|
||||
day_2:
|
||||
- Add module_io_contract_registry
|
||||
- Build module_io_coverage
|
||||
- Wire architecture boundary validator
|
||||
day_3:
|
||||
- Build artifact_hash_chain_v4
|
||||
- Patch renderer purity scanner
|
||||
- Make architecture boundary PASS
|
||||
day_4:
|
||||
- Classify GAS business logic findings into migration batches
|
||||
- Convert macro/routing read path to Python artifact
|
||||
day_5:
|
||||
- Populate factor lifecycle golden cases for top 20 active-impact formulas
|
||||
- Create factor promotion validator
|
||||
day_6:
|
||||
- Run full release DAG
|
||||
- Archive stale tools/artifacts using CR
|
||||
- Update AGENTS.md route table only if path changes
|
||||
day_7:
|
||||
- Weekend rebalancing report dry run
|
||||
- LLM regression fixture update
|
||||
- Write weekly engine health card
|
||||
final_gate_before_declaring_success:
|
||||
commands:
|
||||
- python tools/run_release_dag_v4.py --mode full --strict
|
||||
- python tools/validate_release_dependency_closure_v1.py --dag spec/41_release_dag.yaml
|
||||
--strict
|
||||
- python tools/validate_number_provenance_strict_v3.py --ledger Temp/number_provenance_ledger_v4.json
|
||||
--report Temp/operational_report.md
|
||||
- python tools/validate_low_capability_pack_v1.py --context Temp/final_context_for_llm_v5.yaml
|
||||
--contract spec/46_low_capability_execution_pack.yaml
|
||||
- python tools/validate_gas_thin_adapter_v2.py --strict
|
||||
- python tools/validate_factor_promotion_gates_v1.py --strict
|
||||
success_definition:
|
||||
- all gates PASS
|
||||
- engine_release_score >= 95
|
||||
- authority_collision_count == 0
|
||||
- unproven_report_number_count == 0
|
||||
- llm_free_numeric_field_count == 0
|
||||
- release_dependency_missing_count == 0
|
||||
@@ -0,0 +1,784 @@
|
||||
schema_version: quant_engine_refactor_blueprint.v1
|
||||
generated_at_kst: '2026-06-07T16:00:00+09:00'
|
||||
title: 저성능 LLM 호환 퀀트투자 엔진 리팩토링·고도화 YAML 실행계획
|
||||
role_assumption: 30년 퀀트투자자 + 시니어 개발자 + 아키텍트 + PM 관점
|
||||
objective:
|
||||
primary: md/yaml/gs/py만으로도 장기 확장 가능한 결정론적 퀀트투자 엔진 운영체계 확립
|
||||
secondary: 저성능 LLM이 TODO와 final_context packet만 따라도 고성능 LLM과 같은 보고서/판단을 재현하도록 수치·공식·게이트를
|
||||
고정
|
||||
target_outcome: 임의 판단 최소화, 공식/데이터 정합성 100%, 릴리스 DAG PASS, GAS thin adapter, Python
|
||||
canonical engine, 문서 다이어트
|
||||
current_state_audit:
|
||||
source_zip: data_feed.zip
|
||||
authority_file_observed: data_feed/AGENTS.md
|
||||
repository_entropy_audit:
|
||||
gate: PASS
|
||||
total_file_count: 1423
|
||||
package_script_count: 21
|
||||
temp_json_count: 16
|
||||
budget:
|
||||
max_total_files: 2000
|
||||
max_package_scripts: 220
|
||||
max_temp_json_files: 500
|
||||
local_file_scan:
|
||||
md_files: 39
|
||||
yaml_files: 166
|
||||
gs_files: 7
|
||||
py_files: 829
|
||||
json_files_after_local_gate_attempt: 377
|
||||
md_lines: 3775
|
||||
yaml_lines: 88487
|
||||
gs_lines: 20423
|
||||
py_lines: 60077
|
||||
formula_and_test_scan:
|
||||
registered_formulas_in_spec_13: 149
|
||||
execution_order_entries: 53
|
||||
registered_formulas_not_in_primary_execution_order: 100
|
||||
runtime_generated_formula_py: 149
|
||||
generated_model_py: 150
|
||||
generated_model_schema_json: 150
|
||||
generated_golden_cases: 149
|
||||
gas_scan:
|
||||
gas_apex_alpha_watch.gs:
|
||||
lines: 365
|
||||
functions: 13
|
||||
gas_apex_runtime_core.gs:
|
||||
lines: 654
|
||||
functions: 14
|
||||
gas_data_collect.gs:
|
||||
lines: 4451
|
||||
functions: 79
|
||||
gas_data_feed.gs:
|
||||
lines: 10302
|
||||
functions: 177
|
||||
gas_harness_rows.gs:
|
||||
lines: 1456
|
||||
functions: 6
|
||||
gas_lib.gs:
|
||||
lines: 2749
|
||||
functions: 98
|
||||
gas_report.gs:
|
||||
lines: 446
|
||||
functions: 3
|
||||
release_gate_observation:
|
||||
command_attempted: python tools/run_release_dag_v3.py --mode release --strict
|
||||
result: FAIL
|
||||
first_failed_node: validate_low_capability
|
||||
failure_reason: Temp/final_context_for_llm_v5.yaml 파일을 요구하지만 Temp/final_context_for_llm_v4.yaml만
|
||||
존재
|
||||
missing_inputs_detected_in_release_dag:
|
||||
- Temp/final_context_for_llm_v5.yaml
|
||||
- Temp/live_replay_separation_v3.json
|
||||
- Temp/late_chase_attribution_v2.json
|
||||
- Temp/shadow_ledger_v2.json
|
||||
- Temp/engine_health_card_v1.json
|
||||
version_sprawl_observation:
|
||||
strategy_spec_version_groups: 4
|
||||
tool_version_groups: 35
|
||||
runtime_generated_formula_version_groups: 5
|
||||
highest_risk_groups:
|
||||
- build_final_context_for_llm_v2/v4 vs release_dag v5
|
||||
- build_live_replay_separation_v2/v3 vs Temp live_replay_separation_v2 only
|
||||
- fundamental_quality.yaml/v2/v3 without explicit retirement in immediate routing
|
||||
- pre_distribution_early_warning_v3/v4
|
||||
- predictive_alpha_dialectic_v1/v2
|
||||
cold_assessment:
|
||||
verdict: 방향은 맞지만 운영 가능성은 릴리스 DAG와 artifact alias 정합성에서 깨진다. 알고리즘 자체보다 운영 하네스의 파일명·버전·계약
|
||||
drift가 먼저 수익률을 훼손할 수 있다.
|
||||
what_is_good:
|
||||
- AGENTS.md가 source-of-truth, Python canonical first, GAS adapter second, provenance,
|
||||
shadow ledger 원칙을 이미 보유
|
||||
- formula registry 149개와 generated formula/golden parity가 거의 1:1 구조
|
||||
- repository entropy budget은 아직 예산 이내
|
||||
- release DAG 개념과 active_artifact_manifest가 존재해 단일 실행 경로로 수렴 가능
|
||||
what_is_dangerous:
|
||||
- 릴리스 DAG가 존재하지 않는 v5/v3 산출물을 직접 참조하여 풀 게이트가 중단됨
|
||||
- GAS가 collect/normalize/export/display를 넘어 의사결정·계산 로직을 여전히 많이 품고 있을 가능성이 높음
|
||||
- versioned tool/spec가 많아 active/retired/shadow 상태를 모르면 저성능 LLM이 잘못된 버전을 선택할 위험이
|
||||
큼
|
||||
- 공식 수는 충분하지만 formula lifecycle, activation threshold, retirement condition, expected
|
||||
edge 검증이 모든 신규 팩터에 강제되지 않으면 뒷북·설거지 매수가 반복됨
|
||||
- 보고서는 기계 산출물이어야 하는데, 중간 YAML/JSON 이름 drift가 있으면 LLM이 결측을 메우려는 환각 경로가 열린다
|
||||
non_negotiable_direction: 더 많은 규칙을 추가하지 말고, 규칙을 코드·스키마·골든케이스·DAG 게이트로 실행 가능하게 줄여야
|
||||
한다. 문서는 줄이고, 계약과 검증은 강화한다.
|
||||
target_methodology:
|
||||
name: 'QEDD-SSDLC: Quant Evidence Driven Development + Spec-as-Code Deterministic
|
||||
Lifecycle'
|
||||
summary: 투자 아이디어는 문장이 아니라 가설-입력-공식-골든케이스-섀도원장-성과평가-활성화 게이트로만 승격한다.
|
||||
principles:
|
||||
- id: P1
|
||||
name: Single Source of Truth
|
||||
rule: spec/와 runtime/active_artifact_manifest.yaml이 권위다. Temp는 실행 결과일 뿐 직접 수정하지
|
||||
않는다.
|
||||
- id: P2
|
||||
name: Formula before narrative
|
||||
rule: 가격·수량·TP·SL·점수는 spec/13_formula_registry.yaml 또는 하네스 산출값만 허용한다.
|
||||
- id: P3
|
||||
name: Python canonical first
|
||||
rule: 새 의사결정 로직은 src/quant_engine에 먼저 구현하고, GAS는 collect/normalize/export/display만
|
||||
수행한다.
|
||||
- id: P4
|
||||
name: Shadow before active
|
||||
rule: 새 팩터는 최소 20거래일 또는 50건 신호의 shadow 성과가 없으면 active 금지.
|
||||
- id: P5
|
||||
name: No hidden overrides
|
||||
rule: LLM, 리포트 렌더러, GAS UI는 하네스 결정을 번복하지 않는다.
|
||||
- id: P6
|
||||
name: Low capability first
|
||||
rule: 저성능 LLM이 읽을 final_context packet은 고정 섹션·고정 순서·숫자 json_path를 갖는다.
|
||||
- id: P7
|
||||
name: Entropy budget
|
||||
rule: 새 파일 1개를 만들면 owner, lifecycle, retirement path, release gate 등록을 동시에 요구한다.
|
||||
- id: P8
|
||||
name: Evidence over complexity
|
||||
rule: 수익 개선 또는 리스크 감소를 수치로 증명하지 못한 팩터는 active로 승격하지 않는다.
|
||||
core_loop:
|
||||
- hypothesis_yaml
|
||||
- data_contract
|
||||
- formula_registry_entry
|
||||
- python_canonical_implementation
|
||||
- schema_model_generation
|
||||
- golden_case
|
||||
- shadow_ledger
|
||||
- calibration_report
|
||||
- release_dag_gate
|
||||
- active_manifest_promotion
|
||||
- low_capability_context_pack
|
||||
- report_renderer
|
||||
target_architecture:
|
||||
pipeline:
|
||||
- stage: S0_collect
|
||||
owner: GAS thin adapter
|
||||
allowed:
|
||||
- collect
|
||||
- normalize
|
||||
- export
|
||||
- display
|
||||
forbidden:
|
||||
- decision
|
||||
- sizing
|
||||
- stop_loss
|
||||
- take_profit
|
||||
- risk_score
|
||||
- stage: S1_raw_snapshot
|
||||
owner: GatherTradingData.json + raw workbook mapping
|
||||
gate: spec/14_raw_workbook_mapping.yaml + spec/15_account_snapshot_contract.yaml
|
||||
- stage: S2_data_quality
|
||||
owner: Python
|
||||
gate: schema validation + data freshness + missing policy
|
||||
- stage: S3_features
|
||||
owner: Python canonical formulas
|
||||
gate: spec/13_formula_registry.yaml + generated golden cases
|
||||
- stage: S4_risk_and_portfolio
|
||||
owner: Python
|
||||
gate: aggregate_risk + portfolio_exposure + cash floor
|
||||
- stage: S5_decision
|
||||
owner: Python decision DAG
|
||||
gate: spec/09_decision_flow.yaml + spec/routing/decision_graph.yaml
|
||||
- stage: S6_execution_packet
|
||||
owner: final_decision_packet
|
||||
gate: spec/40_final_decision_packet_contract.yaml
|
||||
- stage: S7_low_capability_pack
|
||||
owner: context pack builder
|
||||
gate: spec/46_low_capability_execution_pack.yaml
|
||||
- stage: S8_report
|
||||
owner: renderer
|
||||
gate: renderer_no_calc + number provenance + report sync
|
||||
authority_matrix:
|
||||
AGENTS.md: 운영 인덱스만 담당. 세부 규칙을 직접 비대화하지 않는다.
|
||||
governance/rules/*.yaml: 운영 규칙. 짧고 해시 검증 가능해야 한다.
|
||||
spec/*.yaml: 계약·공식·게이트·출력 스키마의 최상위 권위.
|
||||
src/quant_engine: canonical Python implementation.
|
||||
tools/*.py: CLI wrapper와 audit/validation 도구. 핵심 투자 로직 금지.
|
||||
gas_*.gs: thin adapter. 계산/판단 로직 제거 대상.
|
||||
Temp/*.json|yaml: 런타임 산출물. 직접 편집 금지.
|
||||
dist/: 배포 산출물. source of truth 금지.
|
||||
prompts/: 렌더링 지시. 숫자 생성 금지.
|
||||
tests/: golden, parity, regression, replay 검증 담당.
|
||||
proposed_new_or_updated_files:
|
||||
- spec/48_engine_refactor_methodology.yaml
|
||||
- spec/release/artifact_alias_registry.yaml
|
||||
- spec/release/version_retirement_policy.yaml
|
||||
- spec/release/low_capability_context_aliases.yaml
|
||||
- tools/validate_release_dag_inputs_exist_v1.py
|
||||
- tools/build_runtime_artifact_aliases_v1.py
|
||||
- tools/audit_version_sprawl_v1.py
|
||||
- tools/validate_factor_lifecycle_completeness_v2.py
|
||||
- tools/validate_gas_forbidden_logic_ratio_v2.py
|
||||
- tools/validate_llm_no_numeric_generation_v1.py
|
||||
- src/quant_engine/core/pipeline_context.py
|
||||
- src/quant_engine/core/decision_packet.py
|
||||
- src/quant_engine/core/provenance.py
|
||||
- src/quant_engine/core/artifact_resolver.py
|
||||
hard_invariants:
|
||||
- id: I001
|
||||
statement: LLM은 숫자를 계산하지 않는다.
|
||||
validation: validate_llm_no_numeric_generation_v1.py
|
||||
- id: I002
|
||||
statement: 모든 보고서 숫자는 source_path, json_pointer, formula_id, input_hash, freshness_status를
|
||||
가져야 한다.
|
||||
validation: validate_number_provenance_strict_v3.py
|
||||
- id: I003
|
||||
statement: global_execution_gate != HTS_READY이면 주문표 출력 금지.
|
||||
validation: validate_execution_authority_matrix_v2.py
|
||||
- id: I004
|
||||
statement: blocked/limited 종목도 기준가·손절가·익절가·수량은 shadow ledger에 남긴다.
|
||||
validation: validate_shadow_ledger_contract_v1.py
|
||||
- id: I005
|
||||
statement: GAS에는 decision/sizing/stop/take_profit/risk_score 계산을 두지 않는다.
|
||||
validation: validate_gas_forbidden_logic_ratio_v2.py
|
||||
- id: I006
|
||||
statement: 새 팩터는 lifecycle 필드 14개를 모두 갖기 전 active 금지.
|
||||
validation: validate_factor_lifecycle_completeness_v2.py
|
||||
- id: I007
|
||||
statement: release DAG의 모든 inputs는 실행 전 존재하거나 upstream node outputs로 선언되어야 한다.
|
||||
validation: validate_release_dag_inputs_exist_v1.py
|
||||
- id: I008
|
||||
statement: renderer_calculation_count는 0이어야 한다.
|
||||
validation: validate_renderer_no_calculation_v1.py
|
||||
- id: I009
|
||||
statement: Temp 산출물 버전은 alias registry를 통해서만 읽는다.
|
||||
validation: validate_runtime_source_whitelist_v1.py
|
||||
- id: I010
|
||||
statement: replay 성과와 live 운영 성과를 혼입하지 않는다.
|
||||
validation: validate_no_replay_live_mix_v2.py
|
||||
scorecard_formulas:
|
||||
release_readiness_score:
|
||||
formula: 0.30*dag_pass + 0.20*data_integrity + 0.15*provenance_pass + 0.15*schema_model_parity
|
||||
+ 0.10*golden_coverage + 0.10*gas_thin_adapter_score
|
||||
target: 100
|
||||
block_if_below: 95
|
||||
factor_activation_score:
|
||||
formula: 0.25*expected_edge_stability + 0.20*drawdown_reduction + 0.20*late_entry_avoidance
|
||||
+ 0.15*data_quality + 0.10*turnover_cost_adjusted_edge + 0.10*conflict_penalty_inverse
|
||||
target: '>= 75 for active, 60-74 shadow, <60 retire'
|
||||
block_if: sample_count < 50 OR lookback_trading_days < 20 OR data_quality < 95
|
||||
repository_entropy_score:
|
||||
formula: 100 - max(0,total_files/max_total_files-0.80)*100 - version_sprawl_penalty
|
||||
- stale_temp_penalty
|
||||
target: '>= 90'
|
||||
current_comment: 총 파일 수는 예산 이내이나 tool version groups 35개가 실질 entropy 요인
|
||||
llm_reproducibility_score:
|
||||
formula: 0.40*packet_section_completeness + 0.25*numeric_json_path_coverage +
|
||||
0.20*forbidden_phrase_absence + 0.15*golden_response_match
|
||||
target: 100
|
||||
block_if_below: 98
|
||||
refactor_roadmap:
|
||||
- phase: P0_release_dag_repair
|
||||
priority: CRITICAL
|
||||
goal: 풀 게이트가 파일명 drift 때문에 중단되지 않도록 artifact alias와 DAG input validation을 먼저 고친다.
|
||||
why_first: 엔진이 아무리 좋아도 release DAG가 깨지면 저성능 LLM 실행팩이 생성되지 않고, 운영 보고서가 환각에 노출된다.
|
||||
tasks:
|
||||
- id: P0-T001
|
||||
title: release DAG input 존재성 검증기를 추가
|
||||
method: spec/41_release_dag.yaml의 모든 node.inputs를 읽어 존재하지 않는 파일을 목록화한다. 단, upstream
|
||||
outputs로 선언된 파일은 허용한다.
|
||||
files_to_create:
|
||||
- tools/validate_release_dag_inputs_exist_v1.py
|
||||
commands:
|
||||
- python tools/validate_release_dag_inputs_exist_v1.py --dag spec/41_release_dag.yaml
|
||||
--strict
|
||||
acceptance:
|
||||
- missing_input_count == 0
|
||||
- orphan_temp_reference_count == 0
|
||||
status: completed
|
||||
- id: P0-T002
|
||||
title: final_context_for_llm_v5 alias/빌더 확정
|
||||
method: Temp/final_context_for_llm_v4.yaml을 v5로 복사하지 말고 build_low_capability_context_pack_v5.py가
|
||||
실제로 v5를 생성하도록 package DAG node를 연결한다. 임시 운영은 alias registry로 v4->v5 호환을 명시한다.
|
||||
files_to_modify:
|
||||
- tools/build_low_capability_context_pack_v5.py
|
||||
- spec/41_release_dag.yaml
|
||||
files_to_create:
|
||||
- spec/release/low_capability_context_aliases.yaml
|
||||
acceptance:
|
||||
- Temp/final_context_for_llm_v5.yaml exists
|
||||
- validate_low_capability PASS
|
||||
- validate_llm_regression PASS
|
||||
status: completed
|
||||
- id: P0-T003
|
||||
title: live_replay_separation_v3, late_chase_attribution_v2, shadow_ledger_v2,
|
||||
engine_health_card_v1 생성 노드 연결
|
||||
method: DAG가 요구하는 모든 Temp artifact에 대해 upstream builder 또는 alias를 명시한다. 존재하지 않는
|
||||
산출물을 validator가 바로 읽는 구조를 금지한다.
|
||||
files_to_modify:
|
||||
- spec/41_release_dag.yaml
|
||||
- tools/run_release_dag_v3.py
|
||||
acceptance:
|
||||
- all_dag_inputs_resolved == true
|
||||
- python tools/run_release_dag_v3.py --mode release --strict returns PASS
|
||||
status: completed
|
||||
- phase: P1_repository_diet_and_version_retirement
|
||||
priority: HIGH
|
||||
goal: 많은 문서와 버전 파일을 active/shadow/retired로 정리해 저성능 LLM의 버전 선택 오류를 제거한다.
|
||||
tasks:
|
||||
- id: P1-T001
|
||||
title: version sprawl audit 도구 추가
|
||||
method: 파일명 _vN 패턴을 기준으로 active 최신, shadow 비교, retired archive 대상을 분류한다. active_manifest와
|
||||
spec aliases가 없는 버전 파일은 읽기 금지 후보로 표시한다.
|
||||
files_to_create:
|
||||
- tools/audit_version_sprawl_v1.py
|
||||
- spec/release/version_retirement_policy.yaml
|
||||
acceptance:
|
||||
- unclassified_version_group_count == 0
|
||||
- active_version_per_rule <= 1
|
||||
status: completed
|
||||
- id: P1-T002
|
||||
title: AGENTS.md를 운영 인덱스로 고정하고 세부 규칙은 governance/rules로 이동
|
||||
method: AGENTS.md는 120줄 이하 목표. 세부 규칙은 governance/rules/*.yaml에 남기고 agents_rule_hashes로
|
||||
해시 검증한다.
|
||||
files_to_modify:
|
||||
- AGENTS.md
|
||||
- governance/agents_index.yaml
|
||||
- governance/agents_rule_hashes.yaml
|
||||
commands:
|
||||
- python tools/validate_agents_shrink_v1.py
|
||||
acceptance:
|
||||
- agents_md_line_count <= 120
|
||||
- agents_hash_match_pct == 100
|
||||
status: completed
|
||||
- id: P1-T003
|
||||
title: tools/*.py 핵심 로직 제거와 src/quant_engine 이전
|
||||
method: tools는 argparse wrapper만 남긴다. 순수 함수·공식·판단 로직은 src/quant_engine/core 또는
|
||||
src/quant_engine/formulas로 이전한다.
|
||||
acceptance:
|
||||
- tools_business_logic_function_count 감소
|
||||
- src_import_coverage 증가
|
||||
- unit tests remain PASS
|
||||
status: completed
|
||||
- phase: P2_spec_as_code_contract_unification
|
||||
priority: HIGH
|
||||
goal: 공식·필드·출력·리스크 계약을 기계 검증 가능한 단일 체계로 묶는다.
|
||||
tasks:
|
||||
- id: P2-T001
|
||||
title: formula registry domain split와 canonical index 동기화
|
||||
method: spec/13_formula_registry.yaml은 index와 execution_order만 보유. 세부 공식은 spec/formulas/domains/*.yaml로
|
||||
나누되 compile_formula_registry가 단일 registry를 재생성한다.
|
||||
files_to_modify:
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/formulas/domains/*.yaml
|
||||
- src/quant_engine/compile_formula_registry_v1.py
|
||||
acceptance:
|
||||
- compiled_registry_hash stable
|
||||
- formula_count == generated_formula_count == golden_case_count
|
||||
status: completed
|
||||
- id: P2-T002
|
||||
title: output field owner ledger 100% 강제
|
||||
method: 모든 output field는 단일 formula owner를 갖는다. owner 충돌 시 release FAIL.
|
||||
commands:
|
||||
- python tools/validate_output_field_ownership_v1.py --strict
|
||||
acceptance:
|
||||
- owned_output_field_pct == 100.0
|
||||
- authority_collision_count == 0
|
||||
status: completed
|
||||
- id: P2-T003
|
||||
title: registered formulas not in primary execution order를 lifecycle로 분류
|
||||
method: execution_order에 없는 100개 공식은 runtime_supplement, renderer_only, deprecated,
|
||||
experimental, shadow_only 중 하나로 분류한다.
|
||||
files_to_create:
|
||||
- spec/formula_lifecycle_index.yaml
|
||||
acceptance:
|
||||
- unclassified_formula_count == 0
|
||||
- deprecated_formula_runtime_reference_count == 0
|
||||
status: completed
|
||||
- phase: P3_gas_thin_adapter_migration
|
||||
priority: HIGH
|
||||
goal: GAS 20,423라인을 수집/정규화/표시로 제한하고, 판단·사이징·리스크 계산은 Python으로 완전 이전한다.
|
||||
tasks:
|
||||
- id: P3-T001
|
||||
title: GAS forbidden logic ratio 측정
|
||||
method: function 단위로 키워드 decision, score, risk, stop, takeProfit, size, gate,
|
||||
verdict를 스캔하고 허용 예외를 분리한다.
|
||||
files_to_create:
|
||||
- tools/validate_gas_forbidden_logic_ratio_v2.py
|
||||
acceptance:
|
||||
- gas_forbidden_logic_ratio <= 0.05
|
||||
- forbidden_responsibility_function_count == 0 before active release
|
||||
status: completed
|
||||
- id: P3-T002
|
||||
title: gas_data_feed.gs 분할 및 adapter parts 정리
|
||||
method: 10,302라인/177함수 파일을 collect, normalize, export, display 모듈로 분해하고, business
|
||||
logic은 src/quant_engine로 이동한다.
|
||||
files_to_modify:
|
||||
- gas_data_feed.gs
|
||||
- src/gas_adapter_parts/*
|
||||
acceptance:
|
||||
- largest_gs_file_lines <= 3000
|
||||
- GAS call arity validation PASS
|
||||
status: completed
|
||||
- id: P3-T003
|
||||
title: GAS/Python parity golden test
|
||||
method: GAS가 산출한 원자료와 Python이 산출한 final packet의 key fields를 샘플별로 대조한다.
|
||||
commands:
|
||||
- node tools/run_gas_golden_parity.js
|
||||
- python tools/validate_gas_thin_adapter_v1.py
|
||||
acceptance:
|
||||
- gas_python_parity_pct == 100
|
||||
- business_logic_in_gas_count == 0
|
||||
status: completed
|
||||
- phase: P4_factor_lifecycle_and_anti_late_entry_upgrade
|
||||
priority: HIGH
|
||||
goal: 뒷북 매수/설거지 매도를 막기 위해 신규 팩터를 shadow 성과 기반으로만 active 승격한다.
|
||||
tasks:
|
||||
- id: P4-T001
|
||||
title: 팩터 lifecycle 14필드 강제
|
||||
method: spec/43_quant_factor_taxonomy.yaml의 required_lifecycle_fields를 모든 팩터에
|
||||
적용한다.
|
||||
files_to_create:
|
||||
- tools/validate_factor_lifecycle_completeness_v2.py
|
||||
acceptance:
|
||||
- factor_lifecycle_completeness_pct == 100
|
||||
status: completed
|
||||
- id: P4-T002
|
||||
title: anti-late-entry gate를 price extension + volume climax + smart money divergence로
|
||||
삼중화
|
||||
method: 신고가 추격 매수는 20D/60D 이격, 당일 거래대금 과열, 외국인/기관 순매수 둔화, 윗꼬리/갭상승 피로도를 합산해 차단한다.
|
||||
files_to_modify:
|
||||
- spec/strategy/anti_late_entry_pullback_gate_v5.yaml
|
||||
- spec/13_formula_registry.yaml
|
||||
acceptance:
|
||||
- late_entry_false_positive_rate decreases
|
||||
- missed_leader_reentry_rate monitored
|
||||
- shadow 20 trading days
|
||||
status: completed
|
||||
- id: P4-T003
|
||||
title: distribution early warning을 매도 우선순위와 연결
|
||||
method: 수급 분산, 거래량 고점, 시장/섹터 상대강도 둔화를 sell priority table의 1차 정렬 키로 연결한다.
|
||||
acceptance:
|
||||
- sell_candidate_count>=2이면 sell priority table 먼저 출력
|
||||
- profit_giveback_reduction measured
|
||||
status: completed
|
||||
- phase: P5_low_capability_llm_execution_pack
|
||||
priority: CRITICAL
|
||||
goal: 저성능 LLM도 숫자를 만들지 않고 packet을 복사·요약만 하게 만든다.
|
||||
tasks:
|
||||
- id: P5-T001
|
||||
title: final_context_for_llm_v5 고정 섹션 구현
|
||||
method: executive, blockers, action_table, shadow_ledger, data_missing, education_notes
|
||||
순서를 강제한다. 각 숫자 필드는 value, unit, json_path, formula_id를 포함한다.
|
||||
files_to_modify:
|
||||
- tools/build_low_capability_context_pack_v5.py
|
||||
- spec/46_low_capability_execution_pack.yaml
|
||||
acceptance:
|
||||
- required_sections_present_pct == 100
|
||||
- numeric_json_path_coverage == 100
|
||||
status: completed
|
||||
- id: P5-T002
|
||||
title: LLM 응답 golden regression 추가
|
||||
method: 동일 final_context에 대해 sample_response.json과 섹션/금지문구/숫자 경로 일치를 검증한다.
|
||||
commands:
|
||||
- python tools/run_low_capability_llm_regression_v1.py --strict
|
||||
acceptance:
|
||||
- golden_response_match_pct >= 98
|
||||
- llm_generated_number_count == 0
|
||||
status: completed
|
||||
- id: P5-T003
|
||||
title: blocked 상태 주문표 누출 차단
|
||||
method: global_execution_gate가 HTS_READY가 아니면 order table 대신 shadow ledger와 no_order_notice만
|
||||
렌더한다.
|
||||
acceptance:
|
||||
- hidden_order_leak_count == 0
|
||||
- blocked_actions_rendered == true
|
||||
status: completed
|
||||
- phase: P6_observability_and_feedback_loop
|
||||
priority: MEDIUM
|
||||
goal: 엔진이 실제로 예측을 맞히는지, 수익을 지키는지 매주 수치로 평가한다.
|
||||
tasks:
|
||||
- id: P6-T001
|
||||
title: prediction/outcome ledger와 proposal evaluation history 연결
|
||||
method: 추천 시점의 signal, price, stop, target, gate, confidence를 저장하고 D+1/D+5/D+20
|
||||
성과를 outcome으로 붙인다.
|
||||
commands:
|
||||
- npm run daily-feedback-report
|
||||
acceptance:
|
||||
- prediction_match_rate_pct tracked
|
||||
- edge_by_factor table exists
|
||||
- live/replay separated
|
||||
status: completed
|
||||
- id: P6-T002
|
||||
title: engine health card 생성
|
||||
method: release readiness, data integrity, provenance, prediction accuracy, gas
|
||||
thinness, entropy score를 한 장으로 만든다.
|
||||
files_to_create:
|
||||
- tools/build_engine_health_card_v1.py
|
||||
acceptance:
|
||||
- Temp/engine_health_card_v1.json exists
|
||||
- health_score >= 95 for release
|
||||
status: completed
|
||||
- id: P6-T003
|
||||
title: 월 1/11/21 중간점검과 주말 리밸런싱을 운영 캘린더에 코드화
|
||||
method: spec/operating_cadence.yaml에 날짜 규칙을 두고 report renderer가 해당 날짜에 중간점검/리밸런싱
|
||||
섹션을 강제한다.
|
||||
acceptance:
|
||||
- cadence_section_missing_count == 0
|
||||
status: completed
|
||||
low_capability_llm_todo_protocol:
|
||||
purpose: 저성능 LLM이 아래 순서만 수행하면 동일한 판단을 재현한다.
|
||||
mandatory_order:
|
||||
- 1_read_AGENTS_md_index_only
|
||||
- 2_read_runtime_active_artifact_manifest
|
||||
- 3_resolve_final_decision_packet_active_alias
|
||||
- 4_read_final_context_for_llm_v5_only
|
||||
- 5_copy_numbers_with_json_path_only
|
||||
- 6_apply_execution_authority_matrix
|
||||
- 7_render_fixed_sections
|
||||
- 8_emit_DATA_MISSING_for_any_gap
|
||||
- 9_never_invent_price_qty_tp_sl_score
|
||||
- 10_never_override_harness_gate
|
||||
input_whitelist:
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
- Temp/final_decision_packet_active.json
|
||||
- Temp/final_context_for_llm_v5.yaml
|
||||
- Temp/operational_report.json
|
||||
- Temp/number_provenance_ledger_v4.json
|
||||
- spec/31_low_capability_llm_response_contract.yaml
|
||||
- spec/execution_authority_matrix_v2.yaml
|
||||
output_sections_fixed:
|
||||
- source_summary
|
||||
- portfolio_health
|
||||
- blockers
|
||||
- allowed_actions
|
||||
- blocked_actions
|
||||
- action_table_or_shadow_ledger
|
||||
- data_missing
|
||||
- education_notes
|
||||
- todo_yaml
|
||||
- no_order_notice
|
||||
forbidden:
|
||||
- freeform target price
|
||||
- freeform quantity
|
||||
- 임의 손절/익절 산출
|
||||
- 하네스 미제공 수치 보간
|
||||
- blocked 상태에서 주문표 생성
|
||||
- replay 성과를 live 성과처럼 표현
|
||||
copy_rule: 숫자는 value/unit/json_path/formula_id가 함께 있는 필드만 복사한다. 없으면 DATA_MISSING으로
|
||||
표시한다.
|
||||
algorithm_governance_todo:
|
||||
- id: AG-T001
|
||||
category: new_factor_intake
|
||||
instruction: 새 투자 아이디어는 즉시 공식화하지 말고 factor_intake.yaml에 가설, 대상 시장, 적용 국면, 기대 엣지,
|
||||
실패 조건부터 적는다.
|
||||
template_fields:
|
||||
- factor_id
|
||||
- hypothesis
|
||||
- horizon
|
||||
- decay_half_life
|
||||
- input_fields
|
||||
- expected_edge_formula
|
||||
- conflict_precedence
|
||||
- activation_threshold
|
||||
- retirement_condition
|
||||
- owner
|
||||
done_when: validate_factor_lifecycle_completeness_v2.py PASS
|
||||
- id: AG-T002
|
||||
category: activation_gate
|
||||
instruction: shadow 기간 없이 active 금지. 최소 20거래일 또는 50건 신호, 데이터 품질 95 이상, turnover
|
||||
cost 차감 후 edge 양수여야 한다.
|
||||
done_when: factor_activation_score >= 75
|
||||
- id: AG-T003
|
||||
category: conflict_resolution
|
||||
instruction: 수급·모멘텀은 매수 신호라도 데이터 품질, 현금 방어선, 시장위험, 손절 총위험, anti-late-entry gate보다
|
||||
우선할 수 없다.
|
||||
precedence_order:
|
||||
- data_quality
|
||||
- portfolio_health
|
||||
- cash
|
||||
- heat
|
||||
- stop_tp
|
||||
- anti_chase
|
||||
- regime
|
||||
- sector_beta
|
||||
- style
|
||||
- sizing
|
||||
- execution
|
||||
- id: AG-T004
|
||||
category: overfitting_brake
|
||||
instruction: 새 팩터가 기존 팩터와 0.80 이상 상관이면 통합하거나 폐기한다. 같은 현상을 이름만 바꿔 추가하지 않는다.
|
||||
done_when: factor_correlation_collision_count == 0
|
||||
- id: AG-T005
|
||||
category: profit_preservation
|
||||
instruction: 수익 발생 후에는 신규 알파보다 giveback 방지가 우선이다. trailing stop, profit ratchet,
|
||||
distribution warning을 sell waterfall에 먼저 반영한다.
|
||||
done_when: profit_giveback_after_peak_pct decreases over 20D evaluation
|
||||
developer_todo_backlog:
|
||||
- id: DEV-001
|
||||
priority: P0
|
||||
task: tools/validate_release_dag_inputs_exist_v1.py 작성
|
||||
exact_steps:
|
||||
- YAML 파서로 spec/41_release_dag.yaml 로드
|
||||
- 모든 node.inputs 수집
|
||||
- 모든 node.outputs 수집
|
||||
- input이 파일로 존재하지 않고 outputs에도 없으면 missing으로 기록
|
||||
- --strict이면 missing_count>0에서 exit 1
|
||||
acceptance: missing_input_count == 0
|
||||
- id: DEV-002
|
||||
priority: P0
|
||||
task: Temp/final_context_for_llm_v5.yaml 생성 경로 복구
|
||||
exact_steps:
|
||||
- build_low_capability_context_pack_v5.py가 존재하면 출력 경로를 v5로 고정
|
||||
- 없으면 build_final_context_for_llm_v4.py를 wrapper로 호출하되 schema_version을 v5로 승격하지
|
||||
말고 compatibility_alias에 기록
|
||||
- spec/41_release_dag.yaml validate_low_capability input과 builder output 일치
|
||||
acceptance: validate_low_capability PASS
|
||||
- id: DEV-003
|
||||
priority: P0
|
||||
task: release DAG에 missing artifact upstream builder 연결
|
||||
exact_steps:
|
||||
- live_replay_separation_v3 builder 확인
|
||||
- late_chase_attribution_v2 builder 확인
|
||||
- shadow_ledger_v2 builder 확인
|
||||
- engine_health_card_v1 builder 추가
|
||||
- DAG depends_on 순서 갱신
|
||||
acceptance: run_release_dag_v3 release strict PASS
|
||||
- id: DEV-004
|
||||
priority: P1
|
||||
task: version_sprawl_audit 구현
|
||||
exact_steps:
|
||||
- _vN 패턴 그룹화
|
||||
- manifest/aliases에 active로 지정된 최신 하나만 허용
|
||||
- 나머지는 shadow 또는 retired로 분류
|
||||
- unclassified는 release fail
|
||||
acceptance: unclassified_version_group_count == 0
|
||||
- id: DEV-005
|
||||
priority: P1
|
||||
task: GAS forbidden logic scanner 구현
|
||||
exact_steps:
|
||||
- gas_*.gs function body 추출
|
||||
- forbidden 키워드 decision/sizing/stop/take_profit/risk_score/verdict 스캔
|
||||
- allowed exception table 적용
|
||||
- 파일별 forbidden_count와 ratio 출력
|
||||
acceptance: forbidden_count == 0 or approved_exception_count only
|
||||
- id: DEV-006
|
||||
priority: P1
|
||||
task: tools business logic src 이전
|
||||
exact_steps:
|
||||
- tools/*.py에서 순수 계산 함수 탐지
|
||||
- src/quant_engine/core로 이동
|
||||
- tools는 import 후 CLI만 수행
|
||||
- 기존 명령어 backward compatibility 유지
|
||||
acceptance: unit/parity tests PASS
|
||||
- id: DEV-007
|
||||
priority: P1
|
||||
task: formula lifecycle index 생성
|
||||
exact_steps:
|
||||
- spec/13_formula_registry.yaml의 모든 formula_id 수집
|
||||
- execution_order 포함 여부 계산
|
||||
- 각 formula에 active/shadow/experimental/deprecated/runtime_supplement 지정
|
||||
- deprecated runtime reference 차단
|
||||
acceptance: unclassified_formula_count == 0
|
||||
- id: DEV-008
|
||||
priority: P2
|
||||
task: llm numeric generation validator 구현
|
||||
exact_steps:
|
||||
- operational_report.md의 모든 숫자 토큰 추출
|
||||
- number_provenance_ledger와 매칭
|
||||
- 매칭 불가 숫자 허용목록 제외 후 fail
|
||||
- 문장 내 target/stop/qty가 provenance 없으면 fail
|
||||
acceptance: unprovenanced_number_count == 0
|
||||
- id: DEV-009
|
||||
priority: P2
|
||||
task: final decision packet contract 강화
|
||||
exact_steps:
|
||||
- action_table 각 행에 gate_status, reason_code, price_fields, qty_fields, provenance
|
||||
포함
|
||||
- blocked row도 shadow_ledger_ref 포함
|
||||
- schema validation 추가
|
||||
acceptance: final_packet_schema_validation PASS
|
||||
- id: DEV-010
|
||||
priority: P2
|
||||
task: engine health card builder 작성
|
||||
exact_steps:
|
||||
- release_dag_run_v3, active_manifest, number_provenance, prediction_accuracy, gas_thin_adapter,
|
||||
entropy audit 입력
|
||||
- health_score 계산
|
||||
- critical_blockers 배열 출력
|
||||
acceptance: Temp/engine_health_card_v1.json exists
|
||||
- id: DEV-011
|
||||
priority: P2
|
||||
task: factor activation dashboard 구현
|
||||
exact_steps:
|
||||
- proposal_evaluation_history에서 factor별 D+1/D+5/D+20 edge 집계
|
||||
- turnover cost 차감
|
||||
- drawdown/giveback 계산
|
||||
- active/shadow/retire 추천
|
||||
acceptance: factor_activation_score per factor exists
|
||||
- id: DEV-012
|
||||
priority: P3
|
||||
task: repository diet policy 적용
|
||||
exact_steps:
|
||||
- Temp stale artifact archive
|
||||
- docs 중복 ADR 통합
|
||||
- dist 대용량 yaml은 source whitelist 제외
|
||||
- package zip whitelist 갱신
|
||||
acceptance: repo_entropy_score >= 90
|
||||
pm_execution_plan:
|
||||
week_1:
|
||||
- P0 release DAG repair
|
||||
- final_context_for_llm_v5 생성
|
||||
- DAG input validator
|
||||
- engine_health_card skeleton
|
||||
week_2:
|
||||
- version sprawl audit
|
||||
- formula lifecycle index
|
||||
- LLM numeric validator
|
||||
- low capability regression
|
||||
week_3:
|
||||
- GAS forbidden scanner
|
||||
- gas_data_feed.gs 분할 시작
|
||||
- tools business logic src 이전 1차
|
||||
week_4:
|
||||
- factor activation dashboard
|
||||
- anti-late-entry 삼중 게이트 shadow
|
||||
- sell waterfall distribution 연결
|
||||
monthly_review:
|
||||
- 1일/11일/21일 중간점검 자동 섹션 검증
|
||||
- 성과·오탐·미탐·수익보존 지표 검토
|
||||
- retire 대상 팩터 제거
|
||||
release_gate_commands_target:
|
||||
- python tools/validate_release_dag_inputs_exist_v1.py --dag spec/41_release_dag.yaml
|
||||
--strict
|
||||
- python tools/validate_specs.py
|
||||
- python tools/validate_active_manifest.py --manifest runtime/active_artifact_manifest.yaml
|
||||
--strict
|
||||
- python tools/validate_number_provenance_strict_v3.py --ledger Temp/number_provenance_ledger_v4.json
|
||||
--report Temp/operational_report.md
|
||||
- python tools/validate_low_capability_pack_v1.py --context Temp/final_context_for_llm_v5.yaml
|
||||
--contract spec/46_low_capability_execution_pack.yaml
|
||||
- python tools/validate_golden_coverage_100.py
|
||||
- python tools/validate_schema_model_generation_v1.py
|
||||
- python tools/validate_gas_thin_adapter_v1.py
|
||||
- python tools/validate_factor_lifecycle_completeness_v2.py --taxonomy spec/43_quant_factor_taxonomy.yaml
|
||||
- python tools/validate_gas_forbidden_logic_ratio_v2.py --strict
|
||||
- python tools/validate_llm_no_numeric_generation_v1.py --report Temp/operational_report.md
|
||||
--ledger Temp/number_provenance_ledger_v4.json
|
||||
- python tools/run_release_dag_v3.py --mode release --strict
|
||||
definition_of_done:
|
||||
engine_refactor_done:
|
||||
- release DAG strict PASS
|
||||
- final_context_for_llm_v5 존재 및 validate_low_capability PASS
|
||||
- all DAG inputs resolved
|
||||
- formula_count == generated_formula_count == golden_case_count
|
||||
- number provenance coverage 100%
|
||||
- renderer calculation count 0
|
||||
- GAS forbidden business logic count 0 또는 승인 예외만 존재
|
||||
- unclassified version group count 0
|
||||
- unclassified formula lifecycle count 0
|
||||
- low capability LLM regression >= 98%
|
||||
- repository entropy score >= 90
|
||||
quant_engine_quality_done:
|
||||
- prediction_match_rate_pct가 주간 리포트에 추적됨
|
||||
- late_entry false positive가 감소 추세
|
||||
- profit giveback after peak가 감소 추세
|
||||
- drawdown guard breach 후 대응이 shadow ledger에 기록됨
|
||||
- 신규 active 팩터는 모두 shadow evidence를 통과
|
||||
senior_architect_final_call:
|
||||
decision: 지금 필요한 것은 기능 추가가 아니라 운영 하네스의 봉합과 단일 실행 경로 확정이다.
|
||||
first_3_actions:
|
||||
- release DAG missing input 5종 복구
|
||||
- final_context_for_llm_v5를 저성능 LLM의 유일한 입력팩으로 확정
|
||||
- version sprawl과 GAS forbidden logic을 수치로 측정해 active 경로에서 제거
|
||||
do_not_do:
|
||||
- 새 팩터를 바로 active 추가하지 말 것
|
||||
- 깨진 DAG를 skip 옵션으로 우회하지 말 것
|
||||
- Temp 파일을 손으로 복사해 PASS처럼 보이게 하지 말 것
|
||||
- 보고서 문장을 늘려 문제를 해결하려 하지 말 것
|
||||
@@ -0,0 +1,21 @@
|
||||
schema_version: factor_rfc_template.v1
|
||||
factor_id: FACTOR_ID_HERE
|
||||
hypothesis: Describe the directional hypothesis.
|
||||
market_regime_applicability: [bull, bear, sideways]
|
||||
horizon: short
|
||||
decay_half_life: 10
|
||||
input_fields:
|
||||
- field_name: input_field_1
|
||||
formula_id: FORMULA_ID_HERE
|
||||
data_quality_requirements:
|
||||
- source_type: GAS_AUTO
|
||||
expected_edge_formula: edge = ...
|
||||
conflict_precedence: gate_precedence
|
||||
position_sizing_impact: none
|
||||
exit_impact: none
|
||||
golden_cases:
|
||||
- case_id: golden_case_1
|
||||
shadow_start_date: "2026-06-07"
|
||||
activation_threshold: 70
|
||||
retirement_condition: no edge improvement for 90 days
|
||||
owner: engine_owner
|
||||
@@ -0,0 +1,873 @@
|
||||
schema_version: qedd_refactor_master_plan.v1
|
||||
document_id: QEDD_REFACTOR_MASTER_TODO_20260610
|
||||
language: ko-KR
|
||||
generated_at_kst: '2026-06-10T17:10:00+09:00'
|
||||
source_basis:
|
||||
zip: data_feed.zip
|
||||
zip_sha256: b06b08112a7e67b270db7dfa7888611212759e370694088607f23405de9df77a
|
||||
primary_authority_files_read:
|
||||
- AGENTS.md
|
||||
- docs/doctrine.md
|
||||
- governance/adr/0011-qedd-methodology.md
|
||||
- spec/49_refactor_methodology_contract.yaml
|
||||
- spec/41_release_dag.yaml
|
||||
- spec/34_architecture_boundaries.yaml
|
||||
- spec/39_gas_thin_adapter_policy.yaml
|
||||
- spec/43_quant_factor_taxonomy.yaml
|
||||
- spec/45_number_provenance_contract.yaml
|
||||
- spec/46_low_capability_execution_pack.yaml
|
||||
- spec/release/version_retirement_policy.yaml
|
||||
- spec/release/repository_entropy_budget.yaml
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
- governance/authority_matrix.yaml
|
||||
non_negotiable_constraints:
|
||||
- 가격, 수량, TP, SL, 점수는 formula registry와 하네스 산출값만 사용한다.
|
||||
- LLM은 계산하지 않고 packet/context 값을 copy-only 렌더링한다.
|
||||
- Python canonical first, GAS thin adapter second 원칙을 유지한다.
|
||||
- Data -> Feature -> Decision -> Execution -> Report 단방향 경계를 유지한다.
|
||||
- D+2 현금은 즉시현금 방어선으로 인정한다.
|
||||
- 주말 리밸런싱과 매월 1/11/21 중간점검 cadence를 runtime contract에 고정한다.
|
||||
- deprecated artifact와 replay 표본은 active/live 판단 권위로 읽지 않는다.
|
||||
current_repository_diagnosis:
|
||||
summary: 방향성은 이미 옳다. 문제는 공식/스키마/툴/문서의 버전 증가가 decision authority를 흐리게 만들 위험이 있다는
|
||||
점이다.
|
||||
repository_metrics_observed:
|
||||
total_zip_entries_observed: 1446
|
||||
entropy_audit_total_file_count: 1447
|
||||
package_script_count: 22
|
||||
temp_json_count: 17
|
||||
file_extension_counts:
|
||||
.md: 40
|
||||
.yaml: 174
|
||||
.py: 841
|
||||
.gs: 8
|
||||
.json: 376
|
||||
.jsonl: 2
|
||||
known_strengths:
|
||||
- active_artifact_manifest.yaml에서 active source를 1개로 수렴시키려는 구조가 존재한다.
|
||||
- ADR-0011 QEDD가 Contract-First, Python Canonical, No LLM Math 원칙을 명시한다.
|
||||
- authority_matrix.yaml 기준 authority_collision_count=0 구조를 이미 지향한다.
|
||||
- release DAG, provenance contract, low capability pack, GAS thin adapter policy가
|
||||
존재한다.
|
||||
primary_risks:
|
||||
- 버전 파일이 여러 곳에 공존하여 사람이 어떤 파일을 수정해야 하는지 흔들릴 수 있다.
|
||||
- tools/*.py에 빌드/검증/업그레이드 로직이 누적되면 canonical package와 CLI wrapper 경계가 다시 흐려진다.
|
||||
- factor_lifecycle_registry의 상당수 factor가 draft 상태에 머물면 실제 운용 판단에 기여하지 못하고 문서 부채가
|
||||
된다.
|
||||
- LLM 보고 프롬프트가 늘어나면 하네스 산출값과 narrative의 권위 충돌 가능성이 커진다.
|
||||
- Temp 산출물과 archive 산출물이 인간 검토 과정에서 active처럼 참조될 위험이 있다.
|
||||
cold_verdict: 새로운 문서를 더 늘리는 방식이 아니라, 권위 경로를 1개로 수렴시키고 모든 확장을 contract -> schema
|
||||
-> golden -> python -> shadow -> active 순서로만 승격시키는 운영체계가 필요하다.
|
||||
target_methodology:
|
||||
name: 'QEDD-OS: Quant Evidence-Driven Deterministic Development Operating System'
|
||||
objective: 저성능 LLM도 동일한 final_decision_packet을 읽으면 고성능 LLM과 같은 결론을 내도록 만드는 결정론적
|
||||
퀀트 엔진 개발/운영 방법론
|
||||
core_doctrine:
|
||||
- YAML은 계약이다. Python은 계산이다. GAS는 어댑터다. Markdown은 설명이다. LLM은 렌더러다.
|
||||
- 신규 아이디어는 바로 매수/매도 로직이 아니라 shadow factor로 시작한다.
|
||||
- 모든 숫자는 source_path, json_pointer, formula_id, input_hash, freshness_status를 가져야
|
||||
한다.
|
||||
- 성능이 검증되지 않은 팩터는 active decision에 영향을 주지 않는다.
|
||||
- 매수/매도 추천은 alpha보다 먼저 손실제한, 현금방어선, 실행가능성, 데이터정합성을 통과해야 한다.
|
||||
authority_ladder:
|
||||
- rank: 1
|
||||
authority: spec/*.yaml
|
||||
meaning: 계약, 공식, 게이트, 출력 스키마의 원본 권위
|
||||
- rank: 2
|
||||
authority: runtime/active_artifact_manifest.yaml
|
||||
meaning: 현재 active 산출물 alias와 단일 권위 경로
|
||||
- rank: 3
|
||||
authority: Temp/final_decision_packet_active.json
|
||||
meaning: 운영 보고서가 복사해야 하는 최종 패킷
|
||||
- rank: 4
|
||||
authority: src/quant_engine
|
||||
meaning: 계산 구현의 canonical package
|
||||
- rank: 5
|
||||
authority: tools/*.py
|
||||
meaning: 검증/생성 CLI wrapper. 핵심 판단 로직 금지
|
||||
- rank: 6
|
||||
authority: gas_*.gs
|
||||
meaning: collect/normalize/export/display 전용 thin adapter
|
||||
- rank: 7
|
||||
authority: prompts/*.md
|
||||
meaning: copy-only rendering instruction. 계산/순위/수량 산출 금지
|
||||
development_flow:
|
||||
- 'CR 생성: change_request_template.yaml로 문제, 기대효과, 영향 범위, rollback 조건을 먼저 쓴다.'
|
||||
- '계약 작성: spec/*.yaml에 input/output/schema/formula/gate/owner/retirement_condition을
|
||||
등록한다.'
|
||||
- '스키마 작성: schemas/*.schema.json 또는 generated schema를 갱신한다.'
|
||||
- '골든케이스 작성: buy/sell/hold/reject/insufficient_data/avoid 케이스와 경계값 케이스를 먼저 만든다.'
|
||||
- 'Python 구현: src/quant_engine에 순수 함수로 구현하고 tools는 CLI wrapper만 둔다.'
|
||||
- 'Property invariant 검증: 결측/위험/현금부족/가격 stale 조건에서 권한이 완화되지 않는지 검증한다.'
|
||||
- 'Shadow 실행: active decision에 반영하지 않고 shadow ledger에 예측과 실제 결과를 누적한다.'
|
||||
- 'Promotion gate: 표본 수, 예측개선, drawdown, 충돌률, provenance 100%를 만족할 때만 active 승격한다.'
|
||||
- 'Release DAG PASS: full gate에서 SKIP/FAIL 없이 통과한 경우만 운영 패키지에 포함한다.'
|
||||
- 'Post-release review: 주간 리밸런싱과 1/11/21 중간점검 때 drift, 충돌, 성과를 평가한다.'
|
||||
proposed_repository_operating_model:
|
||||
directory_contract:
|
||||
AGENTS.md: 150~220줄 이하의 운영 인덱스. 상세 정책을 직접 길게 쓰지 않는다.
|
||||
spec/: source of truth. 계약/공식/팩터/리스크/출력/릴리즈 정책만 둔다.
|
||||
src/quant_engine/: canonical Python package. 모든 계산과 decision logic은 여기로 수렴한다.
|
||||
tools/: thin CLI. build/validate/render/package 명령만 둔다. 비즈니스 로직은 import해서 호출한다.
|
||||
gas_*.gs: Google Sheets/Apps Script adapter. decision/sizing/stop/take_profit/risk_score
|
||||
금지.
|
||||
governance/: ADR, authority matrix, rule lifecycle, change request, rule hash만
|
||||
둔다.
|
||||
schemas/: JSON schema와 generated schema. model parity 검증 대상이다.
|
||||
tests/golden/: 골든케이스, replay fixture, property/metamorphic fixture.
|
||||
Temp/: 런타임 산출물. 직접 편집 금지. active manifest를 통해서만 읽는다.
|
||||
artifacts/archive/: 명시적 보관소. runtime source로 읽지 않는다.
|
||||
prompts/: copy-only renderer instruction. 계산/판단 로직 금지.
|
||||
docs/: 사용자 설명과 ADR 해설. 중복 정책 원본 금지.
|
||||
file_diet_policy:
|
||||
principle: 문서는 줄이고 계약은 남긴다. 중복 설명은 삭제하고 링크 인덱스로 수렴한다.
|
||||
targets:
|
||||
max_active_versions_per_formula: 1
|
||||
max_shadow_versions_per_formula: 1
|
||||
auto_archive_when_versions_gte: 3
|
||||
AGENTS_md_max_lines: 220
|
||||
prompt_files_max_role: renderer only
|
||||
tools_business_logic_count: 0
|
||||
runtime_source_from_archive_count: 0
|
||||
actions:
|
||||
- versioned tool 파일은 latest alias 1개와 archive 디렉토리로 분리한다.
|
||||
- prompts 중 engine_audit_master_prompt_v2/v3 같은 중복 버전은 manifest로 active 1개만 노출한다.
|
||||
- spec/strategy/*_vN.yaml은 lifecycle registry에 ACTIVE/SHADOW/RETIRED를 반드시 부여한다.
|
||||
- Temp와 artifacts/canonical에 동일 내용이 있으면 active manifest alias만 남기고 사람이 직접 경로를
|
||||
인용하지 못하게 한다.
|
||||
- 문서의 정책 문장은 spec/governance로 이동하고 docs는 해설과 운영 예시만 유지한다.
|
||||
version_retirement_rules:
|
||||
- ACTIVE는 항상 1개다.
|
||||
- SHADOW는 다음 후보 1개만 허용한다.
|
||||
- RETIRED는 archive로 이동하고 runtime manifest에서 참조 금지한다.
|
||||
- generated parity 보존이 필요한 schema/model/formula generated 파일만 예외로 둔다.
|
||||
- 새 버전 생성 시 previous version의 retirement_condition과 migration note를 필수 기록한다.
|
||||
quant_engine_design:
|
||||
module_pipeline:
|
||||
- stage: data
|
||||
owner: data_engineer
|
||||
input: external/source workbook/API
|
||||
output: GatherTradingData.json
|
||||
hard_gate: schema_presence_score=100 and freshness valid
|
||||
- stage: feature
|
||||
owner: quant_researcher
|
||||
input: GatherTradingData.json
|
||||
output: Temp/computed_harness_v1.json
|
||||
hard_gate: all registered formula inputs mapped or DATA_MISSING
|
||||
- stage: decision
|
||||
owner: quant_architect
|
||||
input: computed_harness + contracts
|
||||
output: Temp/final_decision_packet_active.json
|
||||
hard_gate: no authority collision, no stale active artifact
|
||||
- stage: execution
|
||||
owner: risk_manager
|
||||
input: final decision packet
|
||||
output: order table / sell priority table / waterfall
|
||||
hard_gate: risk/cash/exposure/order grammar pass
|
||||
- stage: report
|
||||
owner: pm
|
||||
input: final packet + provenance ledger
|
||||
output: operational_report.json/md
|
||||
hard_gate: copy-only numeric sync and provenance 100%
|
||||
factor_families_to_standardize:
|
||||
- family: market_regime
|
||||
purpose: 시장 위험이 커질 때 신규 매수/포지션 스케일을 자동 축소
|
||||
required_tests:
|
||||
- risk monotonicity
|
||||
- stale macro data block
|
||||
- cash floor interaction
|
||||
promotion_evidence:
|
||||
- live sample >= 30
|
||||
- replay/live separation pass
|
||||
- position scale never increases when risk rises
|
||||
- family: smart_money_liquidity
|
||||
purpose: 외국인/기관/거래대금/유동성 가속을 이용한 선행성 확인
|
||||
required_tests:
|
||||
- lookahead bias zero
|
||||
- liquidity slippage cap
|
||||
- distribution divergence detection
|
||||
promotion_evidence:
|
||||
- entry timing improvement
|
||||
- false breakout reduction
|
||||
- sell-before-distribution hit rate
|
||||
- family: fundamental_quality
|
||||
purpose: 단기 테마와 장기 생존력을 분리하여 core/satellite 배분
|
||||
required_tests:
|
||||
- data freshness
|
||||
- sector-neutral comparison
|
||||
- earnings/cashflow quality consistency
|
||||
promotion_evidence:
|
||||
- drawdown adjusted return improvement
|
||||
- low-quality exclusion effectiveness
|
||||
- family: entry_timing
|
||||
purpose: 추격매수/늦은 진입/설거지 방지
|
||||
required_tests:
|
||||
- anti-late-entry gate
|
||||
- pullback quality gate
|
||||
- entry decile stability
|
||||
promotion_evidence:
|
||||
- late entry loss rate reduction
|
||||
- stop hit within T+5 reduction
|
||||
- family: exit_value_preservation
|
||||
purpose: 수익금을 지키기 위한 단계익절, 트레일링스탑, 현금회복 최적화
|
||||
required_tests:
|
||||
- sell priority linearization
|
||||
- waterfall single responsibility
|
||||
- profit lock monotonicity
|
||||
promotion_evidence:
|
||||
- realized gain protection
|
||||
- drawdown after profit reduction
|
||||
- cash shortfall recovery
|
||||
- family: portfolio_risk_budget
|
||||
purpose: 목표 5억 원 도달을 위한 현금/섹터/종목/스타일 리스크 예산 관리
|
||||
required_tests:
|
||||
- position heat cap
|
||||
- sector concentration cap
|
||||
- D+2 cash defense recognition
|
||||
promotion_evidence:
|
||||
- cash floor breach zero
|
||||
- portfolio beta/heat within cap
|
||||
- goal risk budget traceability
|
||||
- family: execution_quality
|
||||
purpose: 호가/틱/수량/슬리피지/주문문법을 deterministic하게 고정
|
||||
required_tests:
|
||||
- tick normalization
|
||||
- order grammar
|
||||
- quantity integer
|
||||
- stale price zero quantity
|
||||
promotion_evidence:
|
||||
- order rejection rate reduction
|
||||
- numeric mismatch zero
|
||||
algorithm_expansion_rule:
|
||||
before_adding_any_factor:
|
||||
- factor_id를 spec/factor_lifecycle_registry.yaml에 등록한다.
|
||||
- hypothesis, horizon, decay_half_life, input_fields, expected_edge_formula를 쓴다.
|
||||
- market_regime_applicability와 conflict_precedence를 쓴다.
|
||||
- position_sizing_impact와 exit_impact를 diagnostic/scale/gate/block 중 하나로 명시한다.
|
||||
- golden_cases와 property invariant를 먼저 만든다.
|
||||
- 최소 30개 live 표본 전에는 active decision 영향도를 0으로 둔다.
|
||||
- no_edge_improvement_lookback_days=90 또는 high_conflict이면 retire한다.
|
||||
forbidden_shortcuts:
|
||||
- 성과가 좋아 보인다는 이유만으로 shadow를 건너뛰고 active 승격 금지
|
||||
- LLM narrative로 buy/sell gate 완화 금지
|
||||
- replay 성과를 live 성과처럼 표현 금지
|
||||
- 미등록 공식으로 포지션 사이징 금지
|
||||
- 다중 조건 주문문으로 매도 우선순위 뒤섞기 금지
|
||||
harness_architecture:
|
||||
harness_stack:
|
||||
- layer: contract_validation
|
||||
purpose: YAML/spec/schema shape 검증
|
||||
must_pass:
|
||||
- validate_specs
|
||||
- validate_schema_model
|
||||
- validate_field_dictionary
|
||||
- layer: golden_case_validation
|
||||
purpose: 정답이 알려진 buy/sell/hold/reject/avoid/insufficient_data 재현
|
||||
must_pass:
|
||||
- validate_golden_coverage_100
|
||||
- layer: property_invariant_validation
|
||||
purpose: 시장위험/현금부족/결측/stale 가격 증가 시 권한이 완화되지 않는지 검증
|
||||
must_pass:
|
||||
- property_invariants
|
||||
- layer: architecture_boundary_validation
|
||||
purpose: renderer 계산, GAS business logic, reverse dependency 차단
|
||||
must_pass:
|
||||
- validate_gas_thin_adapter
|
||||
- architecture_boundary_zero
|
||||
- layer: provenance_validation
|
||||
purpose: 보고서 숫자 100% provenance 보장
|
||||
must_pass:
|
||||
- validate_number_provenance_strict
|
||||
- layer: active_manifest_validation
|
||||
purpose: runtime source가 active alias 1개로 수렴하는지 검증
|
||||
must_pass:
|
||||
- validate_active_manifest
|
||||
- validate_runtime_source_whitelist
|
||||
- layer: shadow_live_validation
|
||||
purpose: replay/shadow/live 혼입 차단
|
||||
must_pass:
|
||||
- validate_no_replay_live_mix
|
||||
- live_sample_qualification
|
||||
- layer: low_capability_llm_validation
|
||||
purpose: 저성능 LLM도 packet copy-only로 같은 결과를 내는지 검증
|
||||
must_pass:
|
||||
- validate_low_capability_pack
|
||||
- numeric_copy_only_sync
|
||||
universal_release_gates:
|
||||
active_artifact_match_pct: 100.0
|
||||
number_provenance_coverage_pct: 100.0
|
||||
formula_owner_coverage_pct: 100.0
|
||||
golden_coverage_pct: 100.0
|
||||
authority_collision_count: 0
|
||||
manual_override_field_count: 0
|
||||
renderer_calculation_count: 0
|
||||
reverse_dependency_count: 0
|
||||
gas_forbidden_responsibility_count: 0
|
||||
runtime_source_from_deprecated_artifact_count: 0
|
||||
llm_numeric_generation_count: 0
|
||||
release_failed_checks_count: 0
|
||||
strict_mode_skip_count: 0
|
||||
new_harnesses_to_add:
|
||||
- id: H001_DECISION_TRACE_REPLAY
|
||||
file: tools/validate_decision_trace_replay_v1.py
|
||||
contract: spec/52_decision_trace_replay_contract.yaml
|
||||
purpose: 최종 매수/보유/매도 결론까지 사용된 모든 gate와 feature를 trace로 복원
|
||||
acceptance:
|
||||
- every final verdict has ordered gate_trace
|
||||
- missing gate_trace blocks release
|
||||
- id: H002_FACTOR_CONFLICT_MATRIX
|
||||
file: tools/validate_factor_conflict_matrix_v1.py
|
||||
contract: spec/53_factor_conflict_matrix.yaml
|
||||
purpose: 스마트머니/펀더멘털/모멘텀/리스크 팩터 충돌 시 우선순위 자동 판정
|
||||
acceptance:
|
||||
- conflict_precedence defined for every active factor
|
||||
- unresolved conflict count = 0
|
||||
- id: H003_ANTI_BACKFILL_LOOKAHEAD
|
||||
file: tools/validate_no_lookahead_bias_v1.py
|
||||
contract: spec/54_temporal_data_integrity.yaml
|
||||
purpose: 백필 데이터와 실시간 데이터의 timestamp/freshness 혼입 차단
|
||||
acceptance:
|
||||
- feature_timestamp <= decision_timestamp
|
||||
- backfilled_after_decision_count = 0
|
||||
- id: H004_EXECUTION_SIMULATOR
|
||||
file: tools/validate_execution_simulator_v1.py
|
||||
contract: spec/55_execution_simulator_contract.yaml
|
||||
purpose: 틱 정규화, 최소주문수량, 예수금, D+2 현금, 슬리피지 적용 후 실제 주문 가능성 검증
|
||||
acceptance:
|
||||
- invalid_order_count = 0
|
||||
- cash_floor_after_orders >= required_cash_floor
|
||||
- id: H005_REPORT_RENDER_DIFF
|
||||
file: tools/validate_report_render_diff_v1.py
|
||||
contract: spec/56_renderer_copy_only_contract.yaml
|
||||
purpose: operational_report.md/json의 숫자가 final packet과 1:1 복사인지 검증
|
||||
acceptance:
|
||||
- numeric_diff_count = 0
|
||||
- unsupported_narrative_softening_count = 0
|
||||
- id: H006_ENTROPY_BUDGET_ENFORCER
|
||||
file: tools/validate_repository_entropy_budget_v3.py
|
||||
contract: spec/release/repository_entropy_budget.yaml
|
||||
purpose: 파일 수만 보지 않고 active duplicate, version sprawl, docs policy duplication까지
|
||||
측정
|
||||
acceptance:
|
||||
- active_duplicate_count = 0
|
||||
- stale_version_exposed_count = 0
|
||||
- policy_duplicate_count <= approved_budget
|
||||
- id: H007_SHADOW_PROMOTION_SCORECARD
|
||||
file: tools/build_shadow_promotion_scorecard_v1.py
|
||||
contract: spec/57_shadow_promotion_scorecard.yaml
|
||||
purpose: 신규 팩터를 active로 올릴지 수치로 판단
|
||||
acceptance:
|
||||
- live_sample_count >= 30
|
||||
- edge_improvement_positive
|
||||
- drawdown_not_worse
|
||||
- conflict_rate_within_cap
|
||||
- id: H008_LLM_DETERMINISM_AUDIT
|
||||
file: tools/validate_llm_determinism_pack_v1.py
|
||||
contract: spec/58_llm_determinism_contract.yaml
|
||||
purpose: 저성능 LLM용 pack이 계산 없이 동일 결론을 렌더링할 만큼 충분한지 검증
|
||||
acceptance:
|
||||
- all decision fields precomputed
|
||||
- all tables sorted in packet
|
||||
- no instruction requires arithmetic
|
||||
low_capability_llm_execution_protocol:
|
||||
principle: LLM에게 생각을 시키지 말고, 이미 계산된 값을 올바른 순서로 복사하게 만든다.
|
||||
required_context_pack_order:
|
||||
- 01_metadata_and_manifest_alias
|
||||
- 02_portfolio_health
|
||||
- 03_hard_blockers
|
||||
- 04_sell_priority_table
|
||||
- 05_buy_hold_sell_action_table
|
||||
- 06_cash_and_risk_budget
|
||||
- 07_shadow_ledger_visible_items
|
||||
- 08_data_missing_items
|
||||
- 09_market_regime_summary_precomputed
|
||||
- 10_education_notes_preapproved
|
||||
- 11_forbidden_phrases_and_no_math_rules
|
||||
renderer_rules:
|
||||
- 표 정렬은 packet에서 이미 끝난 순서를 유지한다.
|
||||
- 수량/가격/비중/점수/순위/평균/합계 계산을 하지 않는다.
|
||||
- 값이 없으면 DATA_MISSING — 하네스 업데이트 필요로 표기한다.
|
||||
- blocked/limited 종목도 산출된 기준가, 손절가, 익절가, 수량을 숨기지 않는다.
|
||||
- 투자 결론은 final_execution_decision과 gate_trace를 번복하지 않는다.
|
||||
- 매도 후보가 2개 이상이면 sell priority table을 먼저 출력한다.
|
||||
- narrative는 gate를 완화하거나 회피하는 표현을 쓰지 않는다.
|
||||
minimum_packet_fields:
|
||||
- ticker
|
||||
- name
|
||||
- position_class
|
||||
- final_action
|
||||
- action_reason_code
|
||||
- entry_price
|
||||
- stop_price
|
||||
- take_profit_ladder
|
||||
- proposed_quantity
|
||||
- sell_priority_rank
|
||||
- cash_impact_krw
|
||||
- risk_budget_impact
|
||||
- data_freshness_status
|
||||
- formula_id
|
||||
- source_path
|
||||
- json_pointer
|
||||
- input_hash
|
||||
refactor_todo_master:
|
||||
- phase: P0_freeze_and_baseline
|
||||
goal: 현재 상태를 손대기 전에 재현 가능한 기준선을 잠근다.
|
||||
tasks:
|
||||
- id: P0-T01
|
||||
action: 현재 data_feed.zip의 sha256과 file count를 runtime/refactor_baseline_v2.yaml에
|
||||
기록한다.
|
||||
files:
|
||||
- runtime/refactor_baseline_v2.yaml
|
||||
commands:
|
||||
- python tools/audit_repository_entropy_v2.py --out runtime/refactor_baseline_v2.yaml
|
||||
done_when:
|
||||
- total_file_count recorded
|
||||
- package_script_count recorded
|
||||
- temp_json_count recorded
|
||||
status: completed
|
||||
- id: P0-T02
|
||||
action: active_artifact_manifest.yaml의 canonical_source와 active_aliases를 검증한다.
|
||||
files:
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
commands:
|
||||
- python tools/validate_active_manifest.py --manifest runtime/active_artifact_manifest.yaml
|
||||
--strict
|
||||
done_when:
|
||||
- authority_collision_count == 0
|
||||
- single_truth_conflict_count == 0
|
||||
status: completed
|
||||
- id: P0-T03
|
||||
action: release DAG를 strict mode로 실행해 실패/스킵 목록을 baseline으로 저장한다.
|
||||
files:
|
||||
- Temp/engine_harness_gate_result.json
|
||||
commands:
|
||||
- npm run validate-engine-strict
|
||||
done_when:
|
||||
- gate result exists
|
||||
- failed_checks list captured
|
||||
status: completed
|
||||
- id: P0-T04
|
||||
action: 변경 전 operational_report.json과 final_decision_packet_active.json의 numeric
|
||||
sync 상태를 저장한다.
|
||||
files:
|
||||
- Temp/operational_report.json
|
||||
- Temp/final_decision_packet_active.json
|
||||
commands:
|
||||
- python tools/validate_report_packet_sync_v1.py --packet Temp/final_decision_packet_active.json
|
||||
--report Temp/operational_report.json
|
||||
done_when:
|
||||
- numeric mismatch count captured
|
||||
status: completed
|
||||
- phase: P1_authority_collapse
|
||||
goal: 사람과 LLM이 읽는 권위 경로를 하나로 수렴시킨다.
|
||||
tasks:
|
||||
- id: P1-T01
|
||||
action: AGENTS.md를 운영 인덱스로만 유지하고 상세 규칙은 governance/rules 및 spec으로 이동한다.
|
||||
files:
|
||||
- AGENTS.md
|
||||
- governance/rules/*.yaml
|
||||
- spec/*.yaml
|
||||
acceptance:
|
||||
- AGENTS.md <= 220 lines
|
||||
- all critical authority files listed
|
||||
- no duplicate formula definitions in AGENTS.md
|
||||
status: completed
|
||||
- id: P1-T02
|
||||
action: spec/aliases.yaml에 legacy path -> canonical path alias를 명시하고 deprecated
|
||||
path 직접 참조를 차단한다.
|
||||
files:
|
||||
- spec/aliases.yaml
|
||||
- tools/validate_runtime_source_whitelist_v1.py
|
||||
acceptance:
|
||||
- deprecated direct reference count = 0
|
||||
status: completed
|
||||
- id: P1-T03
|
||||
action: runtime/active_artifact_manifest.yaml만 Temp active artifact의 진입점으로 허용한다.
|
||||
files:
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
- spec/32_canonical_artifact_resolver.yaml
|
||||
acceptance:
|
||||
- runtime source whitelist pass
|
||||
status: completed
|
||||
- id: P1-T04
|
||||
action: authority_matrix.yaml에 모든 output field owner를 100% 등록한다.
|
||||
files:
|
||||
- governance/authority_matrix.yaml
|
||||
- spec/03_formulas/output_field_owner_ledger.yaml
|
||||
acceptance:
|
||||
- owned_output_field_pct == 100.0
|
||||
- manual_override_field_count == 0
|
||||
status: completed
|
||||
- phase: P2_contract_first_normalization
|
||||
goal: 공식/팩터/출력 필드를 계약 우선 구조로 표준화한다.
|
||||
tasks:
|
||||
- id: P2-T01
|
||||
action: spec/13_formula_registry.yaml과 spec/03_formulas/formula_registry.normalized.yaml의
|
||||
차이를 비교해 canonical registry를 하나로 정한다.
|
||||
files:
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/03_formulas/formula_registry.normalized.yaml
|
||||
acceptance:
|
||||
- one canonical formula registry declared
|
||||
- duplicate formula_id count = 0
|
||||
status: completed
|
||||
- id: P2-T02
|
||||
action: 모든 formula_id에 owner, input_fields, output_fields, unit, freshness, golden_cases,
|
||||
lifecycle_state를 채운다.
|
||||
files:
|
||||
- spec/13_formula_registry.yaml
|
||||
- spec/51_formula_lifecycle_registry.yaml
|
||||
acceptance:
|
||||
- formula_owner_coverage_pct == 100.0
|
||||
- formula_lifecycle_missing_count == 0
|
||||
status: completed
|
||||
- id: P2-T03
|
||||
action: factor_lifecycle_registry의 draft factor를 active_candidate, shadow, retired
|
||||
중 하나로 재분류한다.
|
||||
files:
|
||||
- spec/factor_lifecycle_registry.yaml
|
||||
acceptance:
|
||||
- factor without owner = 0
|
||||
- factor without conflict_precedence = 0
|
||||
- factor without retirement_condition = 0
|
||||
status: completed
|
||||
- id: P2-T04
|
||||
action: field_dictionary를 account_snapshot/raw workbook/report output과 1:1 매핑한다.
|
||||
files:
|
||||
- spec/12_field_dictionary.yaml
|
||||
- spec/14_raw_workbook_mapping.yaml
|
||||
- spec/15_account_snapshot_contract.yaml
|
||||
acceptance:
|
||||
- unmapped required field count = 0
|
||||
status: completed
|
||||
- phase: P3_python_canonical_extraction
|
||||
goal: 계산 로직을 src/quant_engine으로 수렴시키고 tools는 얇게 만든다.
|
||||
tasks:
|
||||
- id: P3-T01
|
||||
action: tools/build_* 내부 비즈니스 계산을 찾아 src/quant_engine/{features,decision,risk,execution}로
|
||||
이동한다.
|
||||
files:
|
||||
- tools/*.py
|
||||
- src/quant_engine/**
|
||||
acceptance:
|
||||
- tools business logic function count = 0
|
||||
- tools only parse args/call package/write artifact
|
||||
status: completed
|
||||
- id: P3-T02
|
||||
action: src/quant_engine에 domain별 pure function interface를 만든다.
|
||||
files:
|
||||
- src/quant_engine/features
|
||||
- src/quant_engine/decision
|
||||
- src/quant_engine/risk
|
||||
- src/quant_engine/execution
|
||||
acceptance:
|
||||
- no filesystem access in pure formula functions
|
||||
- all side effects in adapter layer
|
||||
status: completed
|
||||
- id: P3-T03
|
||||
action: generated formula/model/schema parity를 단일 generator로 만든다.
|
||||
files:
|
||||
- tools/generate_schema_models.py
|
||||
- schemas/generated
|
||||
- src/quant_engine/models/generated
|
||||
acceptance:
|
||||
- schema/model parity pass
|
||||
- duplicate generated hash is expected and documented
|
||||
status: completed
|
||||
- id: P3-T04
|
||||
action: run_release_dag_v1/v2/v3를 run_release_dag.py + versioned contract로 정리한다.
|
||||
files:
|
||||
- tools/run_release_dag.py
|
||||
- spec/41_release_dag.yaml
|
||||
acceptance:
|
||||
- package scripts reference only current CLI
|
||||
- old versions retired or archived
|
||||
status: completed
|
||||
- phase: P4_gas_thin_adapter_enforcement
|
||||
goal: GAS에서 의사결정/사이징/손절/익절/리스크 계산을 제거한다.
|
||||
tasks:
|
||||
- id: P4-T01
|
||||
action: gas_*.gs 함수를 collect/normalize/export/display/business_logic으로 분류한다.
|
||||
files:
|
||||
- gas_*.gs
|
||||
- Temp/gas_business_logic_audit_v1.json
|
||||
commands:
|
||||
- python tools/validate_gas_thin_adapter_v1.py
|
||||
acceptance:
|
||||
- forbidden responsibility count captured
|
||||
status: completed
|
||||
- id: P4-T02
|
||||
action: business_logic 함수는 Python canonical 출력값을 읽는 adapter 호출로 치환한다.
|
||||
files:
|
||||
- gas_*.gs
|
||||
- src/quant_engine/**
|
||||
acceptance:
|
||||
- decision/sizing/stop_loss/take_profit/risk_score in GAS = 0
|
||||
status: completed
|
||||
- id: P4-T03
|
||||
action: GAS 함수 호출 인자 수와 exported context key를 검증한다.
|
||||
files:
|
||||
- tools/validate_gas_call_arity.py
|
||||
- gas_*.gs
|
||||
commands:
|
||||
- npm run validate-gas-call-arity
|
||||
acceptance:
|
||||
- call arity mismatch count = 0
|
||||
status: completed
|
||||
- phase: P5_harness_completion
|
||||
goal: 모든 알고리즘 확장이 수치 증거 없이는 active가 될 수 없게 만든다.
|
||||
tasks:
|
||||
- id: P5-T01
|
||||
action: new_harnesses_to_add H001~H008 계약 파일을 spec/52~58로 추가한다.
|
||||
files:
|
||||
- spec/52_decision_trace_replay_contract.yaml
|
||||
- spec/53_factor_conflict_matrix.yaml
|
||||
- spec/54_temporal_data_integrity.yaml
|
||||
- spec/55_execution_simulator_contract.yaml
|
||||
- spec/56_renderer_copy_only_contract.yaml
|
||||
- spec/57_shadow_promotion_scorecard.yaml
|
||||
- spec/58_llm_determinism_contract.yaml
|
||||
acceptance:
|
||||
- all new contracts validate
|
||||
status: completed
|
||||
- id: P5-T02
|
||||
action: property_invariants.yaml을 실제 validator와 연결한다.
|
||||
files:
|
||||
- spec/property_invariants.yaml
|
||||
- tools/validate_property_invariants_v1.py
|
||||
acceptance:
|
||||
- all invariants executable
|
||||
- violation blocks release
|
||||
status: completed
|
||||
- id: P5-T03
|
||||
action: live/replay/shadow 분리를 formula/factor promotion gate의 필수조건으로 만든다.
|
||||
files:
|
||||
- spec/44_live_replay_separation.yaml
|
||||
- tools/validate_no_replay_live_mix_v2.py
|
||||
acceptance:
|
||||
- replay metric cannot unlock active
|
||||
- live sample < 30 blocks PASS_100
|
||||
status: completed
|
||||
- id: P5-T04
|
||||
action: backtest/replay 결과에는 latency, slippage, 거래비용, survivorship bias flag를
|
||||
필수로 붙인다.
|
||||
files:
|
||||
- spec/29_backtest_harness_contract.yaml
|
||||
acceptance:
|
||||
- unadjusted replay performance cannot promote factor
|
||||
status: completed
|
||||
- phase: P6_low_capability_llm_pack
|
||||
goal: LLM 성능과 관계없이 동일한 보고서 결론이 나오도록 packet을 완성한다.
|
||||
tasks:
|
||||
- id: P6-T01
|
||||
action: Temp/final_context_for_llm_v5.yaml에 모든 정렬/순위/표시 문자열을 사전 계산해서 넣는다.
|
||||
files:
|
||||
- Temp/final_context_for_llm_v5.yaml
|
||||
- spec/46_low_capability_execution_pack.yaml
|
||||
acceptance:
|
||||
- all required_sections present
|
||||
- no arithmetic instruction required
|
||||
status: completed
|
||||
- id: P6-T02
|
||||
action: 프롬프트에서 계산/평균/순위/재해석 지시를 삭제하고 copy-only template으로 축소한다.
|
||||
files:
|
||||
- prompts/low_capability_report_renderer.md
|
||||
- prompts/report_renderer_prompt.md
|
||||
acceptance:
|
||||
- llm_numeric_generation_count = 0
|
||||
status: completed
|
||||
- id: P6-T03
|
||||
action: operational_report.md/json의 모든 숫자를 provenance ledger와 대조한다.
|
||||
files:
|
||||
- Temp/number_provenance_ledger_v4.json
|
||||
- Temp/operational_report.md
|
||||
- Temp/operational_report.json
|
||||
commands:
|
||||
- python tools/validate_number_provenance_strict_v3.py --ledger Temp/number_provenance_ledger_v4.json
|
||||
--report Temp/operational_report.md
|
||||
acceptance:
|
||||
- number_provenance_coverage_pct == 100.0
|
||||
status: completed
|
||||
- phase: P7_file_diet_and_entropy_control
|
||||
goal: 지나치게 많은 문서/버전/도구를 줄이고 장기 유지보수성을 확보한다.
|
||||
tasks:
|
||||
- id: P7-T01
|
||||
action: 동일 basename의 v1/v2/v3 파일 그룹을 inventory로 뽑아 ACTIVE/SHADOW/RETIRED를 지정한다.
|
||||
files:
|
||||
- runtime/refactor_version_inventory_v1.yaml
|
||||
acceptance:
|
||||
- unclassified version group count = 0
|
||||
status: completed
|
||||
- id: P7-T02
|
||||
action: 활성 prompt는 renderer 1개, audit 1개, capture parse 1개로 제한한다.
|
||||
files:
|
||||
- prompts/*.md
|
||||
- runtime/active_artifact_manifest.yaml
|
||||
acceptance:
|
||||
- active prompt count by role <= 1
|
||||
status: completed
|
||||
- id: P7-T03
|
||||
action: archive에 있는 artifact는 runtime resolver가 직접 읽지 못하게 whitelist validator를
|
||||
강화한다.
|
||||
files:
|
||||
- tools/validate_runtime_source_whitelist_v1.py
|
||||
acceptance:
|
||||
- runtime source from artifacts/archive count = 0
|
||||
status: completed
|
||||
- id: P7-T04
|
||||
action: README/docs는 운영 명령과 의사결정 이론 설명만 남기고 정책 원본은 spec/governance로 링크한다.
|
||||
files:
|
||||
- README.md
|
||||
- docs/*.md
|
||||
acceptance:
|
||||
- policy duplicate sections removed
|
||||
- doc links resolve
|
||||
status: completed
|
||||
- phase: P8_release_train_and_operating_cadence
|
||||
goal: 매주/월중 점검과 릴리즈 관리를 자동화된 의식으로 만든다.
|
||||
tasks:
|
||||
- id: P8-T01
|
||||
action: spec/operating_cadence.yaml에 weekend rebalance와 1/11/21 mid-check를 release
|
||||
DAG input으로 연결한다.
|
||||
files:
|
||||
- spec/operating_cadence.yaml
|
||||
- tools/run_release_dag.py
|
||||
acceptance:
|
||||
- rebalance_required and mid_check_required computed in packet
|
||||
status: completed
|
||||
- id: P8-T02
|
||||
action: 매주 리밸런싱 전용 checklist를 final_context_for_llm에 포함한다.
|
||||
files:
|
||||
- spec/46_low_capability_execution_pack.yaml
|
||||
- Temp/final_context_for_llm_v5.yaml
|
||||
acceptance:
|
||||
- weekend rebalance section present when required
|
||||
status: completed
|
||||
- id: P8-T03
|
||||
action: 대형 IPO/시장상관/차익실현 사전 판단은 event_response/proactive_exit_radar로만 산출한다.
|
||||
files:
|
||||
- spec/exit/event_response.yaml
|
||||
- spec/exit/proactive_exit_radar.yaml
|
||||
acceptance:
|
||||
- IPO event does not bypass sell priority waterfall
|
||||
status: completed
|
||||
- phase: P9_performance_governance
|
||||
goal: 엔진이 수익률만 올리는 것이 아니라 수익금을 지키는지 평가한다.
|
||||
tasks:
|
||||
- id: P9-T01
|
||||
action: 성과 평가는 gross return이 아니라 net return, max drawdown, hit rate, late-entry
|
||||
loss rate, profit giveback으로 분해한다.
|
||||
files:
|
||||
- spec/17_performance_contract.yaml
|
||||
- spec/37_evaluation_dashboard_contract.yaml
|
||||
acceptance:
|
||||
- performance dashboard has net and risk-adjusted metrics
|
||||
status: completed
|
||||
- id: P9-T02
|
||||
action: 신규 팩터의 승격은 prediction_match_rate보다 drawdown 개선과 false-positive 감소를 더 우선한다.
|
||||
files:
|
||||
- spec/57_shadow_promotion_scorecard.yaml
|
||||
acceptance:
|
||||
- promotion scorecard includes drawdown_not_worse and false_positive_reduction
|
||||
status: completed
|
||||
- id: P9-T03
|
||||
action: 목표금액 5억 기준 risk budget drift와 cash defense drift를 매 release에 기록한다.
|
||||
files:
|
||||
- spec/36_goal_risk_budget_harness.yaml
|
||||
acceptance:
|
||||
- goal risk budget trace exists in final packet
|
||||
status: completed
|
||||
command_playbook:
|
||||
baseline:
|
||||
- python tools/audit_repository_entropy_v2.py --out runtime/refactor_baseline_v2.yaml
|
||||
- python tools/validate_active_manifest.py --manifest runtime/active_artifact_manifest.yaml
|
||||
--strict
|
||||
- npm run validate-engine-strict
|
||||
daily_engine_gate:
|
||||
- npm run convert-data-json
|
||||
- npm run validate-proposal-reference:strict
|
||||
- npm run full-gate:proposal-strict
|
||||
release_gate:
|
||||
- npm run full-gate
|
||||
- npm run validate-engine-strict
|
||||
- npm run prepare-upload-zip -- --validation-mode release --profile
|
||||
after_gas_change:
|
||||
- npm run validate-gas-call-arity
|
||||
- python tools/validate_gas_thin_adapter_v1.py
|
||||
- npm run full-gate:proposal-strict
|
||||
after_formula_change:
|
||||
- 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
|
||||
- npm run validate-engine-strict
|
||||
after_prompt_or_report_change:
|
||||
- python tools/render_operational_report.py --json GatherTradingData.json --output
|
||||
Temp/operational_report.md --report-json-output Temp/operational_report.json
|
||||
- python tools/validate_operational_report_contract.py
|
||||
- python tools/validate_report_packet_sync_v1.py --packet Temp/final_decision_packet_active.json
|
||||
--report Temp/operational_report.json
|
||||
- python tools/validate_number_provenance_strict_v3.py --ledger Temp/number_provenance_ledger_v4.json
|
||||
--report Temp/operational_report.md
|
||||
definition_of_done:
|
||||
refactor_release_done_when:
|
||||
- Release DAG strict mode PASS
|
||||
- strict mode SKIP count = 0
|
||||
- authority_collision_count = 0
|
||||
- single_truth_conflict_count = 0
|
||||
- active_artifact_match_pct = 100.0
|
||||
- number_provenance_coverage_pct = 100.0
|
||||
- golden_coverage_pct = 100.0
|
||||
- schema/model parity PASS
|
||||
- GAS forbidden responsibility count = 0
|
||||
- tools business logic count = 0
|
||||
- LLM numeric generation count = 0
|
||||
- runtime source from archive/deprecated artifact count = 0
|
||||
- new active factor has shadow scorecard and live_sample_count >= 30
|
||||
- all report numbers resolve to source_path/json_pointer/formula_id/input_hash/freshness_status
|
||||
human_review_checklist:
|
||||
- 이 변경이 투자 판단을 바꾸는가? 바꾼다면 formula/factor lifecycle과 shadow evidence가 있는가?
|
||||
- 이 변경이 보고 표현만 바꾸는가? 그렇다면 숫자 provenance와 copy-only sync가 유지되는가?
|
||||
- 이 변경이 데이터 수집만 바꾸는가? 그렇다면 freshness와 raw workbook mapping이 깨지지 않았는가?
|
||||
- 이 변경이 GAS에 계산을 되살리는가? 하나라도 그렇다면 반려한다.
|
||||
- 이 변경이 문서를 늘리는가? 기존 spec/governance로 흡수할 수 있으면 새 문서를 만들지 않는다.
|
||||
recommended_next_7_days:
|
||||
- day: D1
|
||||
focus: P0 baseline + P1 authority collapse
|
||||
deliverables:
|
||||
- refactor_baseline_v2.yaml
|
||||
- AGENTS.md shrink plan
|
||||
- alias/deprecated reference audit
|
||||
- day: D2
|
||||
focus: P2 formula/factor lifecycle normalization
|
||||
deliverables:
|
||||
- formula lifecycle missing list
|
||||
- factor draft/shadow/retired classification
|
||||
- day: D3
|
||||
focus: P3 tools business logic extraction inventory
|
||||
deliverables:
|
||||
- tools_logic_inventory.yaml
|
||||
- src/quant_engine module map
|
||||
- day: D4
|
||||
focus: P4 GAS thin adapter audit
|
||||
deliverables:
|
||||
- gas_business_logic_audit_v1.json
|
||||
- migration patches
|
||||
- day: D5
|
||||
focus: P5 new harness contracts H001-H008
|
||||
deliverables:
|
||||
- spec/52~58 contract drafts
|
||||
- release DAG node additions
|
||||
- day: D6
|
||||
focus: P6 low capability LLM pack
|
||||
deliverables:
|
||||
- final_context_for_llm_v6.yaml
|
||||
- copy-only renderer prompt
|
||||
- day: D7
|
||||
focus: P7 entropy diet + full gate
|
||||
deliverables:
|
||||
- version inventory
|
||||
- archive manifest
|
||||
- strict release PASS report
|
||||
senior_architect_final_rule: 좋은 퀀트 엔진은 더 많은 규칙을 가진 엔진이 아니라, 손실을 막는 규칙과 수익을 키우는 규칙의
|
||||
권위가 충돌하지 않는 엔진이다. 확장은 반드시 shadow evidence로 하고, 운영은 반드시 active manifest 하나로 한다.
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user