diff --git a/.gitignore b/.gitignore index 3a7ba24..b73ee3d 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,7 @@ feature_meta .DS_Store data_provider/._config.json .gstack/ + +# ESS gate / engineering-loop working dirs(归档进 docs/runs/) +.gates/ +loop/ diff --git a/docs/AGENT_MEMORY.md b/docs/AGENT_MEMORY.md index a496c50..7ed4d37 100644 --- a/docs/AGENT_MEMORY.md +++ b/docs/AGENT_MEMORY.md @@ -22,14 +22,16 @@ - ECR-002 Reviewed:拆 `web/services/runtime/`、加深 analyze 契约 - ECR-003 Reviewed:主站威科夫叠层(`chanlun/analysis/wyckoff/` + `include_wyckoff`)→ `081a57a` - ECR-004 Reviewed:TR 评分硬化 + VP 少系列 + 阶段/门闩/单测(无币种参数) +- ECR-007 Final Approval / `276481e`:Wyckoff Live Structure(`live.py`);Confirmed ≠ Live;execution 仅 confirmed - 威科夫数据随主 analyze 默认返回;UI 开关仅显隐叠层 +- Live 观察:主图左下角 Cycle Summary(「形成中」= FORMING);无单独 Live 图层 ## 硬约束提醒 - `/api/analyze` 字段可增不可删 - 无 ADR 不改笔/段/中枢/买卖点语义 -- 威科夫为独立叠层(ECR-003);勿借机改缠论算法 -- 交易 L2+ → RISK_REVIEW + EXP;Live 须 Human +- 威科夫为独立叠层(ECR-003/007);勿借机改缠论算法 +- Live candidate **不得**进入 execution;交易 L2+ → RISK_REVIEW + EXP;Live 须 Human ## 已知债务 @@ -38,3 +40,4 @@ - 内存泄漏尚无自动化 heap/监听断言 - `macd_config` POST 写本地 global 的历史 quirks(未改) - 威科夫启发式参数未做 UI 调参 +- ECR-007 待 PR 合入 `dev` diff --git a/docs/PROJECT_PROFILE.md b/docs/PROJECT_PROFILE.md index db7cb96..999b07f 100644 --- a/docs/PROJECT_PROFILE.md +++ b/docs/PROJECT_PROFILE.md @@ -34,10 +34,11 @@ Trading System(缠论分析引擎 + 可视化 Web;Freqtrade 策略目录独 ## Active anchors -- ECR: ECR-002/003/004 Reviewed(威科夫 + 硬化) +- ECR: ECR-002/003/004 Reviewed;ECR-007 Final Approval(Live Structure,待合入 `dev`) - EXP: N/A - TRACEABILITY: `docs/TRACEABILITY.md` - Memory: `docs/AGENT_MEMORY.md` +- Loop archive: `docs/runs/LOOP-RUN-005/` ## Pointers diff --git a/docs/STATE/CURRENT.md b/docs/STATE/CURRENT.md index ba73cc9..ecbf8df 100644 --- a/docs/STATE/CURRENT.md +++ b/docs/STATE/CURRENT.md @@ -1,11 +1,11 @@ # STATE **owner:** idle -**active_ecr:** none(ECR-004 Reviewed;待本批提交合入) -**phase:** post-review +**active_ecr:** none(ECR-007 Final Approval;待合入 `dev`) +**phase:** post-approval **system_version:** v1.0.0 **strategy_version:** unchanged -**updated:** 2026-08-06 +**updated:** 2026-08-07 ## Recent @@ -16,8 +16,11 @@ | ECR-002 | L3 | Done (Reviewed) | runtime 包拆分 | | ECR-003 | L2 | Done (Reviewed) | `081a57a` 主站威科夫 | | ECR-004 | L2 | Done (Reviewed) | 威科夫硬化 / VP 减负 | +| ECR-007 | L2 | Done (Final Approval) | Live Structure · `276481e` · LOOP-RUN-005 | ## Notes -- ECR-004:**Approve**(14 passed);无币种独立参数 +- ECR-007:**FINAL_APPROVAL** · gate PASS · Confirmed ≠ Live ≠ execution +- 归档:`docs/runs/LOOP-RUN-005/` - 未请求新 system tag +- 分支 `feature/ECR-007-wyckoff-live-structure` 待 PR → `dev` diff --git a/docs/STATE/ECR-007.md b/docs/STATE/ECR-007.md index 8141e6b..eb52e15 100644 --- a/docs/STATE/ECR-007.md +++ b/docs/STATE/ECR-007.md @@ -7,4 +7,4 @@ loop: LOOP-RUN-005 gate: PASS decision: FINAL_APPROVAL implementation_commit: 276481e -notes: LOOP-RUN-005 DONE · Human Gate #2 Final Approval · archive to skills/engineering-loop/runs/ +notes: LOOP-RUN-005 DONE · Human Gate #2 Final Approval · archived to docs/runs/LOOP-RUN-005/ diff --git a/docs/TRACEABILITY.md b/docs/TRACEABILITY.md index 4a17987..73b0407 100644 --- a/docs/TRACEABILITY.md +++ b/docs/TRACEABILITY.md @@ -52,4 +52,4 @@ | ECR-007 | Confirmed + Live 分层 | BD-2026-007 / ENG-007 | `wyckoff/live.py` + `engine.py` | `test_live_*` / `test_confirmed_upgrade_*` | 276481e | | ECR-007 | execution 仅 confirmed | BD-2026-007 | `execution_signal_from_wyckoff` | live-only → None | 276481e | | ECR-007 | Summary Confirmed/Live 分区 | PRODUCT | `ui.js` | 人工 + 契约键 | 276481e | -| ECR-007 | LOOP-RUN-005 | — | — | Gate + Artifact | 276481e | +| ECR-007 | LOOP-RUN-005 | — | `docs/runs/LOOP-RUN-005/` | Gate + Artifact | 276481e | diff --git a/docs/runs/LOOP-RUN-005/ECR-007-gate-report.json b/docs/runs/LOOP-RUN-005/ECR-007-gate-report.json new file mode 100644 index 0000000..7ab795c --- /dev/null +++ b/docs/runs/LOOP-RUN-005/ECR-007-gate-report.json @@ -0,0 +1,18 @@ +{ + "ecr": "ECR-007", + "result": "PASS", + "ess_version": "v1.0", + "gate_version": "0.1.2", + "project_profile": "unknown", + "checks": { + "artifact": true, + "role_boundary": true, + "backend_boundary": true, + "traceability": true, + "tests": true + }, + "violations": [], + "errors": [], + "warnings": [], + "timestamp": "2026-08-06T19:14:19Z" +} diff --git a/docs/runs/LOOP-RUN-005/README.md b/docs/runs/LOOP-RUN-005/README.md new file mode 100644 index 0000000..0b6202a --- /dev/null +++ b/docs/runs/LOOP-RUN-005/README.md @@ -0,0 +1,18 @@ +# LOOP-RUN-005 — ECR-007 archive + +**Feature:** WYCKOFF-LIVE-STRUCTURE +**ECR:** ECR-007 · **BD:** BD-2026-007 +**Decision:** FINAL_APPROVAL · gate PASS +**Implementation:** `276481e` + +## Contents + +| Path | Note | +|------|------| +| `task.yaml` / `result.yaml` / `human_interventions.yaml` | Loop runner state | +| `ECR-007-gate-report.json` | ess-gate-check PASS | +| `artifacts/` | plan · gate · code_review · test_report | + +Code diff 以 git commit `276481e` 为准(未归档 192KB `diff.patch`)。 + +Working dirs `.gates/` / `loop/` 已忽略,勿再提交。 diff --git a/docs/runs/LOOP-RUN-005/artifacts/code_review_report.json b/docs/runs/LOOP-RUN-005/artifacts/code_review_report.json new file mode 100644 index 0000000..0c8ede5 --- /dev/null +++ b/docs/runs/LOOP-RUN-005/artifacts/code_review_report.json @@ -0,0 +1,12 @@ +{ + "stage": "code_reviewer", + "decision": "PASS", + "checks": { + "state_machine_boundary": "PASS", + "confidence_explainability": "PASS", + "backward_compatibility": "PASS", + "live_ne_execution": "PASS", + "confirmed_thresholds": "PASS" + }, + "artifact": "docs/HANDOFF/ECR-007-code-review.md" +} diff --git a/docs/runs/LOOP-RUN-005/artifacts/gate_report.json b/docs/runs/LOOP-RUN-005/artifacts/gate_report.json new file mode 100644 index 0000000..7ab795c --- /dev/null +++ b/docs/runs/LOOP-RUN-005/artifacts/gate_report.json @@ -0,0 +1,18 @@ +{ + "ecr": "ECR-007", + "result": "PASS", + "ess_version": "v1.0", + "gate_version": "0.1.2", + "project_profile": "unknown", + "checks": { + "artifact": true, + "role_boundary": true, + "backend_boundary": true, + "traceability": true, + "tests": true + }, + "violations": [], + "errors": [], + "warnings": [], + "timestamp": "2026-08-06T19:14:19Z" +} diff --git a/docs/runs/LOOP-RUN-005/artifacts/plan.yaml b/docs/runs/LOOP-RUN-005/artifacts/plan.yaml new file mode 100644 index 0000000..8a85520 --- /dev/null +++ b/docs/runs/LOOP-RUN-005/artifacts/plan.yaml @@ -0,0 +1,84 @@ +artifact_schema: + version: 1 + +# LOOP-RUN-005 Planner — domain-state complexity (observe Confirmed vs Live) + +layers: + - id: confirmed_engine + role: historical structure facts (range/phases/events) — thresholds UNCHANGED + - id: live_engine + role: FORMING candidates + confidence — independent of Confirmed writes + - id: lifecycle + role: UNKNOWN → FORMING → CONFIRMED → COMPLETED per cycle + - id: api_contract + role: analyze payload cycles[].confirmed / cycles[].live / top-level live mirror + - id: summary_ui + role: Confirmed vs Live partitioned Summary (observation only) + +delivery_constraints: + required: + - commit_exists_in_traceability_or_test_report + - bd_status_format_approved + - test_report_with_commands_result_date + - code_review_handoff + - out_of_scope_declared + - execution_source_confirmed_only + gate: + ecr: ECR-007 + command: ess-gate-check --ecr ECR-007 + +out_of_scope: + - execution signal automation / auto trading + - strategy / maker / decide_quotes / strategies/** + - lowering Confirmed Spring/SOS thresholds + - using Live candidate as Confirmed event or execution input + - Subagents / Adapter v0.2 / auto-retry + - chan algorithm (笔/线段/中枢) changes + +scope: + files: + - chanlun/analysis/wyckoff/live.py + - chanlun/analysis/wyckoff/engine.py + - chanlun/analysis/wyckoff/__init__.py + - chanlun/analysis/wyckoff/events.py + - chanlun/analysis/wyckoff/range.py + - tests/test_wyckoff.py + - web/api/analyze.py + - web/static/js/app/ui.js + - web/templates/index.html + - web/tests/test_analyze_contract.py + - tests/fixtures/analyze_contract_keys.json + - docs/notes/WYCKOFF-LIVE-STRUCTURE-001.md + - docs/ECR/ECR-007-wyckoff-live-structure.md + - docs/BACKEND_DESIGN/BD-2026-007-wyckoff-live-structure.md + - docs/ENGINEERING_SPEC/ECR-007-wyckoff-live-structure.md + - docs/HANDOFF/ECR-007-architect-to-engineer.md + - docs/HANDOFF/ECR-007-code-review.md + - docs/HANDOFF/ECR-007-engineer-to-reviewer.md + - docs/TEST_REPORT/ECR-007.md + - docs/STATE/ECR-007.md + - docs/TRACEABILITY.md + - docs/CHANGELOG/CHANGELOG.md + +boundary: + forbidden: + - strategies/ + - decide_quotes / maker + - Live → execution_signal + - ESS / Loop v1.1 / Adapter v0.1 + +acceptance: + - lifecycle + confirmed/live separation in analyze_wyckoff output + - event_candidates confirmed=false; not in top-level events unless Confirmed + - execution_signal_from_wyckoff source==confirmed; live-only → None + - Summary shows Confirmed vs Live partition + - pytest test_wyckoff + analyze_contract green + - ess-gate-check ECR-007 + +risks: | + Primary Guardian risk: Live candidate mistaken for execution signal. + Code Review: state machine boundary, confidence explainability, backward compat of phases/events. + +notes: | + Planner must name Confirmed / Live / Lifecycle / Event Candidate explicitly. + delivery_constraints include execution_source_confirmed_only. diff --git a/docs/runs/LOOP-RUN-005/artifacts/test_report.json b/docs/runs/LOOP-RUN-005/artifacts/test_report.json new file mode 100644 index 0000000..800364a --- /dev/null +++ b/docs/runs/LOOP-RUN-005/artifacts/test_report.json @@ -0,0 +1,10 @@ +{ + "stage": "validator", + "result": "PASS", + "commands": [ + "PYTHONPATH=. python -m pytest tests/test_wyckoff.py -q", + "PYTHONPATH=. python -m pytest web/tests/test_analyze_contract.py -q" + ], + "summary": "17 passed (9 wyckoff + 8 contract)", + "notes": "Live isolation + execution_signal confirmed-only" +} diff --git a/docs/runs/LOOP-RUN-005/human_interventions.yaml b/docs/runs/LOOP-RUN-005/human_interventions.yaml new file mode 100644 index 0000000..52486f0 --- /dev/null +++ b/docs/runs/LOOP-RUN-005/human_interventions.yaml @@ -0,0 +1,11 @@ +interventions: +- stage: START_AUTHORIZATION + reason: "authorize LOOP-RUN-005 ECR-007 Wyckoff Live Structure (supervised; Adapter v0.1 STABLE)" + note: "Human Gate #1 — Goal + Authorization merged" +- stage: FINAL_APPROVAL + reason: "LOOP-RUN-005 approved — proceed to --approve and archive" + note: "Human Gate #2" +notes: | + No Plan Mode; no mid-build confirm; no Subagents / Adapter v0.2 / auto-retry. + Live ≠ execution signal held; TR-COMMIT BLOCK→PASS retained as training signal. + Final Approval distinct from Start Authorization. diff --git a/docs/runs/LOOP-RUN-005/result.yaml b/docs/runs/LOOP-RUN-005/result.yaml new file mode 100644 index 0000000..4c65e14 --- /dev/null +++ b/docs/runs/LOOP-RUN-005/result.yaml @@ -0,0 +1,49 @@ +loop: + id: LOOP-RUN-005 + feature: ECR-007-WYCKOFF-LIVE-STRUCTURE + ecr: ECR-007 + current_state: DONE + retry_count: 0 +history: +- state: CREATED + timestamp: '2026-08-06T19:12:00Z' + actor: runner + result: INIT +- state: CREATED + timestamp: '2026-08-06T19:13:48Z' + actor: runner + result: PASS + detail: →PLANNING +- state: PLANNING + timestamp: '2026-08-06T19:13:48Z' + actor: runner + result: PASS + detail: →BUILDING +- state: BUILDING + timestamp: '2026-08-06T19:14:34Z' + actor: runner + result: PASS + detail: →VALIDATING +- state: VALIDATING + timestamp: '2026-08-06T19:14:34Z' + actor: runner + result: PASS + detail: →CODE_REVIEW +- state: CODE_REVIEW + timestamp: '2026-08-06T19:14:34Z' + actor: runner + result: PASS + detail: →GUARDING +- state: GUARDING + timestamp: '2026-08-06T19:14:34Z' + actor: runner + result: PASS + detail: →READY_FOR_APPROVAL +- state: READY_FOR_APPROVAL + timestamp: '2026-08-06T19:19:41Z' + actor: runner + result: APPROVED +- state: DONE + timestamp: '2026-08-06T19:19:41Z' + actor: runner + result: DONE diff --git a/docs/runs/LOOP-RUN-005/task.yaml b/docs/runs/LOOP-RUN-005/task.yaml new file mode 100644 index 0000000..d25b618 --- /dev/null +++ b/docs/runs/LOOP-RUN-005/task.yaml @@ -0,0 +1,77 @@ +# LOOP-RUN-005 — ECR-007 Wyckoff Live Structure +# Adapter v0.1 STABLE · single agent · supervised +# Human Gate #1: Start Authorization granted + +id: LOOP-RUN-005 +feature: ECR-007-WYCKOFF-LIVE-STRUCTURE +ecr: ECR-007 +project_profile: "2026.08" + +goal: | + 验证 Engineering Loop v1.1 + Adapter v0.1 在高领域状态复杂度 Feature 下的执行稳定性。 + 实现 Wyckoff Confirmed + Live Structure 分层,观察层与执行层严格隔离。 + +authorization: + approved_by: human + feature: ECR-007 + run: LOOP-RUN-005 + constraints: + - no_ess_change + - no_loop_v1_1_change + - no_adapter_v0_1_change + - single_agent + - supervised + - no_subagents + - no_auto_retry + - no_live_as_execution_signal + - no_confirmed_threshold_lowering + +constraints: + allowed: + - "chanlun/analysis/wyckoff/**" + - "tests/test_wyckoff.py" + - "tests/fixtures/**" + - "tests/generate_golden.py" + - "tests/test_golden_pipeline.py" + - "web/api/analyze.py" + - "web/api/pages.py" + - "web/static/js/app/**" + - "web/templates/index.html" + - "web/tests/**" + - "web/services/runtime/timeframes.py" + - "docs/**" + - "loop/**" + forbidden: + - "strategies/**" + - "**/decide_quotes*" + - "maker/**" + - "skills/engineering-spec-system/**" + - "docs/architecture/ENGINEERING-LOOP-V1.1.md" + notes: + - Confirmed detection thresholds UNCHANGED + - Live candidates must never replace Confirmed events + - execution_signal_from_wyckoff source must be confirmed only + +acceptance: + criteria: + - Confirmed logic unchanged (events.py confirm rules not relaxed) + - execution only consumes confirmed + - Live ≠ execution signal + - lifecycle transitions verifiable (UNKNOWN/FORMING/CONFIRMED/COMPLETED) + - API contract + Summary display Confirmed/Live separation + - Artifact chain complete + commands: + - "PYTHONPATH=. python -m pytest tests/test_wyckoff.py -q" + - "PYTHONPATH=. python -m pytest web/tests/test_analyze_contract.py -q" + +execution: + autonomy: supervised + adapter: none + +ess: + gate_command: "python ${ESS_ROOT}/scripts/ess-gate-check.py --project . --ecr ECR-007" + +observe: + planner_domain: Confirmed + Live + Lifecycle + Event Candidate + guardian_risk: live_candidate_must_not_become_execution_signal + human_gates: start_authorization + final_approval