Files
QuantEngineByItz/suggest/qedd_quant_engine_refactor_master_todo_20260610.yaml
T
kjh2064 ee3e799de1 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>
2026-06-13 13:20:14 +09:00

874 lines
36 KiB
YAML

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 하나로 한다.