10 KiB
10 KiB
ai-exchange Session
Current Goal
从现在开始只推进交易模块交付,优先把运行清单、部署纪律和市场验证前准备补齐,不再扩展 Training 新能力。
Current Branch
main
Last Updated
2026-05-04 UTC
Completed In Last Session
- 已完成
P1-1:historical compatibility repair 已新增liquidity reference migrationplanning/apply path,支持 dry-run、显式 apply 和 conflict protection,不再只有 safe merge 与人工判断。 - 已完成
P1-2:signal evidence 已补齐sweep_id / displacement_id / liquidity_target_id,交易主线默认已切到 strict evidence,而不是 minimal default。 - 已完成
P1-3:execution settlement 已升级为显式 observation 驱动状态机,支持backtest_projection与manualsource,并新增settlement_source / fill_state / position_state / close_reason。 - 已完成
P1-4:主运行链、signal scripts、backtest、dashboard 已支持bias_tf / setup_tf / trigger_tf多 timeframe 入口,并在 backtest summary 中新增by_timeframe维度。 - 已经新增
scripts/run_trading_delivery_rehearsal.py,把P0所需的 checklist drift check、historical repair 决策、database readiness / auto-backfill / pipeline、deploy / health-check、post-deploy observe 串成一个单一编排入口。 - 已把高风险 liquidity 引用迁移在
P0阶段的默认策略固化为 explicit defer:如果仍出现liquidity_reference_migration_groups,rehearsal 会直接阻断,而不是继续停留在人工口头约定。 - 已为 rehearsal 入口补 focused tests,确认 safe repair pending、reference migration defer、quality gate failure、deploy/health-check 路径都有稳定的脚本化判定。
- 已经把交易模块交付前 checklist 锁成可执行单一来源:新增
scripts/check_trading_delivery_readiness.py,并把 preflight / database gate / deploy / observe / rollback 的固定命令顺序同步到README.md与RUNBOOK.md。 - 已经用 focused tests 把这套 checklist 固化:新增
tests/unit/test_trading_delivery_readiness.py,扩展tests/unit/test_documentation_consistency.py和scripts/run_offline_checks.py,避免运行清单再次依赖聊天记忆漂移。 - 已把历史兼容 safe repair 的文档语义纠正到当前实现:
--apply-safe-repairs现在包含 signal invalidations、MSS/FVG meta,以及 liquidity safe merges;needs_sweep_reference_migration/keep_version_history仍保留人工决策边界。 - 已经完成交易主线的主要规则与验证增强,包括:MSS/FVG richer state、execution/backtest/report lifecycle contract、backtest
by_symbol、FVG candidate priority convergence,以及历史兼容安全修复脚本。 - 已经在真实数据库上执行了历史兼容安全修复:
signal_invalidations=11、mss_meta=4、fvg_meta=1189,再次 dry-run 后这三类候选修复已全部清零。 - 已把
liquidityduplicate groups 程序化分类成四类:safe_auto_merge_unreferenced_superset、safe_exact_duplicate_with_duplicate_sweeps、needs_sweep_reference_migration、keep_version_history。 - 已在真实数据库上执行 liquidity safe merges:共处理
8组,其中1组未引用超集重复、7组 exact duplicate 且 duplicate sweep 完全同构;再次 dry-run 后仅剩5组keep_version_history。 - 训练侧的 quality / selector / generator 原型已完成,但从本轮开始这些不再是当前开发主线。
Current Working State
git status --short --branchnow shows## main...origin/mainwith local changes inRUNBOOK.md,SESSION.md,TASKS.md, the signal/report/frontend/backtest/execution/training files touched in recent sessions, plus unrelated untracked content underdocs/AI_Legal_Content_Intelligence_Upgrade_Plan_v1.mdandlegal_content/.originnow uses SSH:gitea-water:yuqei/ai-exchange.git; SSH auth for this host alias works from the current shell user.- MSS candidates now carry
meta.stateandmeta.status_reason; accepted structures useretest_held, rejected structures useretest_not_observed, and invalidated structures useold_control_reclaimed. - MSS persistence now records the latest structure state even when
accepted = false, so downstream consumers no longer read stale accepted-only MSS rows. - MSS detection still collapses duplicate same-direction displacement context at the same
end_tsto one deterministic candidate, preferring the highest event id. - Signal-side MSS/FVG fetches now include the latest downstream state regardless of actionability, with deterministic same-timestamp tie-breaks.
validate_signal_contextnow returns explicit downstream structure outcomes plus richer MSS/FVG state reasons instead of a single coarse non-actionable result.- Signal metadata now exposes
structure_state,mss_state,mss_status_reason,fvg_status_reason,fvg_touch_count, and FVGdata_quality_warnings. /signalsAPI rows now normalize key signal context fields to top-level output keys and addinvalidations_normalizedplussignal_context, so API consumers no longer need to inspect nestedmetafor either structure-state reasons or normalized invalidations.- Intraday reports now expose structure
state/status_reason, FVGstatus_reason, and signal-side richer structure context directly in the report payload. - Post-trade review reports now expose a
signal_contextblock with richer structure-state, normalized invalidations, and data-quality fields. - Execution audit, execution settlement, post-trade review, and backtest summary now share the same lifecycle vocabulary for
missed,invalidated_before_entry,tp1_reached,tp2_closed, andstopped_out. - Backtest summary now exposes top-level
lifecycle_statesin addition to the older rawoutcomesbuckets. - Backtest summary now also exposes
by_symbol, usinginstruments.symbolwhen available via repository join andsignal_symbolin outcome metadata downstream. - Dashboard backtest cards now show a compact symbol-scope summary derived from
summary.by_symbol. - Training case list/detail/export surfaces now expose a public read-only
qualityobject with deterministicscore,rank, andsignals. - Training dashboard case cards and case detail now display the derived quality signal directly, while progress/attempt flows remain unchanged.
- Training case list/export service/API surfaces now also support stable selector inputs for
quality_rank,min_quality_score, andsort_by. - The generator prototype now exists as an offline-only flow: trading-derived seed JSON -> public Training draft package JSON, with empty
answercontent and no database writes. - Signal-side FVG selection is now explicit and deterministic: exact MSS displacement match wins, otherwise newest same-direction wins, otherwise newest overall wins.
- Historical compatibility repair now exists as a script-backed path: default dry-run scan, optional safe apply for signal invalidations plus MSS/FVG meta plus liquidity safe merges, and explicit manual-review boundaries for
needs_sweep_reference_migration/keep_version_history. - Historical compatibility repair now also supports explicit liquidity reference migration apply for executable duplicate-pool groups, with sweep timestamp conflict blocking instead of blind migration.
- 交易模块交付前 checklist 现在已经被
README.md/RUNBOOK.md/scripts/check_trading_delivery_readiness.py/ offline checks 四处对齐,真实部署步骤不再只存在于聊天上下文里。 P0功能层面的闭环现在已经不再缺少编排入口:run_trading_delivery_rehearsal.py已经能把 freshness、historical repair、pipeline quality gate、deploy、health-check、post-deploy observe 串起来。P1功能层面的闭环现在也已经补齐:strict signal evidence、execution observation state machine、liquidity reference migration executor、多 timeframe runtime/backtest breakdown 都已落地并通过验证。- 当前真正阻碍交易模块进入市场验证的,已经从“缺脚本/缺流程”收缩成“目标环境 scripted rehearsal 结果尚未转绿”,尤其是 freshness 和 quality gate 是否通过。
TASKS.md已重新切回交易模块交付优先,不再把 Training 继续当作当前 in-progress 主线。- FVG state metadata in the dirty worktree still includes
last_touch_ts,touch_count,status_reason, and gap warnings. - Replay-backed no-lookahead backtest mode remains present and validation is green.
scripts/run_dev.pystill starts the persistent local API/dashboard dev server usingAI_ICT_API_HOST/AI_ICT_API_PORT.- Earlier doc cleanup remains in the worktree:
docs/root contains current requirement/engineering docs, historical material is underdocs/archive/, and generic workflow helpers are underdocs/workflow/. .hermes/andgeckodriver.logare ignored local artifacts.
Exact Next Step
直接在目标环境执行 scripted rehearsal:
- 跑
.venv/bin/python scripts/run_trading_delivery_rehearsal.py,让 freshness、historical repair、pipeline、deploy、health-check、post-deploy observe 按单一入口执行; - 根据 rehearsal 输出判断 freshness 与 quality gate 是否已经转绿;
- 只有当 rehearsal 结果转绿后,才进入真实市场验证;否则再决定是否进入更高风险的
sweep_event pool_id引用迁移执行器。
Validation Commands
.venv/bin/python3 -m unittest discover -s tests/unit -p "test_*.py"
.venv/bin/python3 scripts/run_offline_checks.py
.venv/bin/python3 scripts/check_local_demo_readiness.py
.venv/bin/python3 scripts/check_trading_delivery_readiness.py
.venv/bin/python3 scripts/run_trading_delivery_rehearsal.py
Risks Or Open Questions
- 剩余
5组keep_version_history类型 liquidity 记录目前被有意保留;如果后面仍要继续清理,就不再是 safe repair,而是更高风险的 sweep 引用迁移工程。 - 交易模块虽然已经有了稳定的 checklist、rehearsal 编排入口、P1 实现闭环与回滚边界,但真正的目标环境 rehearsal 结果还没转绿,部署纪律和市场验证门禁仍需要一次实跑确认。
- 当前本地工作区还有未跟踪的法务内容草稿,不属于交易交付主线,后续应避免把它们混入交易模块发布。