iomgaa
9eb9b86954
feat(question_gen): AnchorContext + 12 题型-层级映射常量
...
- AnchorContext frozen dataclass: 锚节点生成上下文(node_id, card_text, frame_paths, subtitle, distractor_texts)
- TaskTypeSpec frozen dataclass: 题型生成规格(level, needs_frames, frame_count, context_fields)
- TASK_TYPE_LEVEL_MAP: 12 种 Video-MME 题型 → 树层级 + 生成规格映射
- 11 项单元测试覆盖:映射完整性、值类型、层级合法性、frozen 不变性
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-09 05:10:58 -04:00
iomgaa
eb15ab315e
fix(config): _VIDEO_MME_TASK_TYPE_COUNT 11→12,Video-MME 实际有 12 种题型
...
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-09 05:08:05 -04:00
iomgaa
0b48b889e0
docs(wiki): 赛题生成工具设计 + 实现计划
...
design: synthesizer + factory + CLI 三模块架构
plan: 9 个 Task(前置修复 + synthesizer 4 步 + factory + CLI generate/calibrate + re-export)
calibrate: Fisher exact test 组合判定替代固定阈值
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-09 05:05:57 -04:00
iomgaa
8c383354c5
fix(detector): 移除 ongoing_actions/visible_entities 空字段检测 + 新增 repair sh
...
抽检确认这两个字段为空是合法内容状态(静物/黑帧/模糊帧),
VLM 重修也修不好,保留会导致断点续跑死循环。
L3 空字段检测缩减为 frame_summary + spatial_layout。
2026-07-09 00:54:27 -04:00
iomgaa
86573735aa
docs(wiki): apply Codex review fixes to main-figure design
2026-07-09 00:46:08 -04:00
iomgaa
8cb1158a2d
docs(wiki): paper main-figure design — self-evolving loop layout
2026-07-09 00:39:45 -04:00
iomgaa
d6bcf41336
fix(repair): Codex 审查修正 — progress 完成判据加严 + load_progress 防御增强
...
1. 保存 progress 前重新 detect_issues,只有 empty_field 清零才记 finished
(修复 L2/L1 空字段被检测但未修复仍写 finished 的问题)
2. load_progress 增加 AttributeError 捕获(防 JSON 非 dict 形态崩溃)
2026-07-09 00:30:23 -04:00
iomgaa
4612123ec4
style: ruff format telemetry + repair_trees, remove unused SRTEntry import
2026-07-09 00:25:36 -04:00
iomgaa
847def4a03
feat(repair): asyncio.Semaphore 并发 + 断点续跑 + CLI 参数
...
--concurrency 默认 16,--reaggregate-all 强制全量重聚合。
Semaphore 限视频并发数,视频内四步串行。progress 文件
asyncio.Lock + os.replace 原子写入。熔断阈值 max(.env, concurrency*2)。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-09 00:23:40 -04:00
iomgaa
afe80a8b32
feat(repair): 断点续跑 progress 文件管理
...
load_progress / save_progress(asyncio.Lock + os.replace 原子写入)
/ should_skip_video。支持并发安全的读改写和 --reaggregate-all 兜底。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-09 00:23:04 -04:00
iomgaa
8182cb86b1
feat(detector): 扩展空字段检测到 L2 event_description / L1 scene_summary
...
断点续跑判据需要 L2/L1 层的 empty_field 检测。零 LLM 成本。
2026-07-09 00:12:55 -04:00
iomgaa
f733c13dd1
fix(llm): call_id 移入重试循环,每 attempt 独立
...
消除重试时遥测主键冲突的根因。每次 attempt 独立记录,
parent_call_id 不受影响(循环外固定),更利于事后诊断重试轨迹。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-09 00:12:38 -04:00
iomgaa
5a91f392f0
fix(telemetry): INSERT OR IGNORE + WAL + try/except 三层防御加固
...
根治遥测写入主键冲突(UNIQUE constraint)和并发写锁(database is locked)
导致的异常冒泡,遥测侧信道错误不再污染 LLM 重试链。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-09 00:11:54 -04:00
iomgaa
dbc9d38cd7
plan(tree/repair): 三项改造实现计划(遥测加固+断点续跑+并发)
...
6 个 Task: telemetry 防御加固 → call_id 根因修复 → detector L2/L1 扩展
→ progress 管理 → 并发编排+CLI → lint+全量测试
2026-07-09 00:08:23 -04:00
iomgaa
8a49ef18e6
design(tree/repair): 建树修复管线熔断根因修复+断点续跑+并发改造设计
...
三事: (1)遥测防御性加固(INSERT OR IGNORE+WAL+busy_timeout+try/except不冒泡)
根治call_id重试复用导致的主键冲突污染重试与熔断器; (2)判据双轨
(detect重扫empty_field+progress文件)视频级断点续跑,首次用detect
自动接历史无需手补状态; (3)asyncio.Semaphore并发默认16,熔断阈值
max(5,concurrency*2),--concurrency走CLI避免与tree.concurrency串台
2026-07-08 23:52:48 -04:00
iomgaa
53286ac3ab
refactor: remove deprecated retriever module
...
RecursiveRetriever was a failed approach, not carried into TRM5.
- delete app/retriever/ (empty placeholder)
- drop retriever + train blocks from config/default.yaml
- renumber fidelity checklist 13->12 items (drop #4 , shift up)
- sync core-goal text, dir tree, module-interaction diagrams
across CLAUDE.md, ARCHITECTURE.md, overview.md, README.md
- reference/ kept intact as historical code
2026-07-08 23:09:30 -04:00
iomgaa
91281cb995
merge: feat/app-harness — app/harness/ 训练循环编排层(14 文件, 算法保真 #6/#10/#13)
2026-07-07 20:35:04 -04:00
iomgaa
9a42bbcf85
style(harness): ruff format batching.py + log.py
2026-07-07 20:34:48 -04:00
iomgaa
a668fc173c
feat(harness): __init__.py public API + lint fixes
2026-07-07 13:45:48 -04:00
iomgaa
d6e74f2734
feat(harness): runner.py — train loop orchestrator ( #13 algorithm fidelity)
...
Three-level nesting (epoch -> step -> per-skill), slow update 10-step
sequence, checkpoint/resume, early stop, probation accept/reject/rollback.
Key TRM4->TRM5 changes:
- sync -> async (all inference/diagnosis/evolve/validate awaited)
- LLMClient.from_env -> injected LLMProvider (DI via constructor)
- Direct DB/file access -> module functions (workspace/store/log)
- _TrainState as train() local, explicit param passing to helpers
Module-level pure functions extracted for testability:
resume_plan, _guard_infra_failures, _apply_batch_correctness,
_compute_total_steps, _should_early_stop, _format_applied_edits,
_fallback_summary, _write_skip_report, _outcome_to_quadrant_pairs,
_build_comparison_pairs, _batch_from_ids, _snapshot_current_skills.
Tests: 34 unit tests covering 13a-13e sub-tasks.
Radon: all functions Grade B or better.
2026-07-07 13:43:20 -04:00
iomgaa
6baddcc17d
feat(harness): validate.py — async 块序贯验证编排 + Probation 统一定义
2026-07-07 13:20:43 -04:00
iomgaa
8c9f7d2d37
feat(harness): checkpoint.py — TrainState 序列化 + 原子写 + 指纹校验
2026-07-07 13:13:37 -04:00
iomgaa
6b56fc8f98
feat(harness): inference.py — async run_inference + DI
2026-07-07 13:04:26 -04:00
iomgaa
49e272719e
feat(harness): momentum.py — async 慢更新动量生成
2026-07-07 13:01:04 -04:00
iomgaa
767ac55787
feat(harness): observation.py — 五张观测表 + step/epoch 报告
2026-07-07 12:55:12 -04:00
iomgaa
d7d8633dae
feat(harness): gate_ladder.py — 信息阶梯 + BaselineCache ( #6 算法保真)
2026-07-07 12:55:12 -04:00
iomgaa
48b423ef35
feat(harness): pools.py — 三池切分(test→validation→diagnosis)
2026-07-07 12:48:54 -04:00
iomgaa
ad8fc176d0
feat(harness): batching.py — FFD + round-robin mini-batch ( #10 算法保真)
2026-07-07 12:47:33 -04:00
iomgaa
461abf0329
feat(harness): workspace.py — Workspace lifecycle + VersionedSkillStore/PromptStore
...
- ResolvedPaths frozen dataclass: store_dir, videos_dir, questions_dir,
skills_dir, prompts_dir, workspace_dir, db_path, analyses_dir, runs_dir
- init_workspace: create ws + copy seed weights from store
- init_workspace_from_seed: create from seed with fail-fast questions check
- load_manifest / resolve_paths: manifest I/O + path resolution
(skills/prompts resolve to workspace, videos/questions to store)
- update_manifest: key whitelist validation
- record_run: idempotent history append + per-video wiki dirs
- read_best / update_best: best pointer independent of current
- list_video_ids: videos with tree.json
- archive_workspace: move to .archive/<name>-<ts>
- VersionedSkillStore: implements core/evolution/protocols.py::SkillStore
- VersionedPromptStore: implements core/evolution/protocols.py::PromptStore
- 21 tests all passing (incl. Protocol compliance checks)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 12:41:59 -04:00
iomgaa
6858da80c7
feat(harness): store.py — Store 版本操作 + Seed 管理
...
从 TRM4 core/workspace.py 拆出 Store + Seed 相关函数:
- _parse_version / list_versions / next_version / advance_version
- _write_meta / init_store
- init_seed / list_seeds / read_seed
- extract_run_db(保留原始 CREATE 语句重建主键约束)
- promote_to_seed(强校验版本一致 + 非 NULL + finally 清理)
26 个测试全部通过,radon 复杂度 A (2.83)。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 12:36:36 -04:00
iomgaa
fd76720dcf
feat(harness): HarnessLog SQLite wrapper + RunLogImpl readonly port
...
- HarnessLog: TRM4 direct port with WAL mode, threading.Lock, INSERT OR
IGNORE idempotent _runs, context manager (completed/failed), create_table
with auto run_id+timestamp, insert/insert_many/execute/query/log_event
- RunLogImpl: implements core/evolution/protocols.py::RunLog Protocol with
independent sqlite3.connect for read-only SELECT (no _runs pollution),
asyncio.to_thread wrapping for async interface
- _read_table: shared readonly helper with optional question_ids filtering,
graceful empty-list return for missing tables
- Tests: 17 cases covering thread safety, idempotent inserts, context
manager status, WAL mode, protocol compliance, readonly isolation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 12:29:29 -04:00
iomgaa
b47f634e61
fix(harness): Codex functional review 修复 — 命名/集成测试/delta_min/promote 消息
...
- _apply_env_overrides → _apply_env_var_overrides,docstring 明确从 os.environ 读取
- 新增 TestLoadConfigRealYaml:用真实 config/default.yaml 验证嵌套 harness 解析
- 新增 test_delta_min_negative_rejected:覆盖 gate_delta_min >= 0 校验
- 恢复 promote 模式独立错误消息(从合并分支分离回 TRM4 原始提示)
- 77 个单元测试全部通过,radon 全部 Grade B 或更好
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 12:23:27 -04:00
iomgaa
535bd320b0
fix(harness): 补充 train 模式 run_id 校验 + 拆分函数保持 radon Grade B
...
- _validate_mode_deps: 恢复 train 非 resume/fresh 时必须提供 run_id 校验
- 提取 _validate_train_run_id 用 early return 展平条件,避免 radon Grade C
- 合并 promote run_id 检查到 diagnose/evolve/promote 统一检查
- 新增 4 个测试:train+run_id / train+resume / train+fresh / train+baseline
- radon cc -n C 无输出(全部 Grade B 或更好)
- 74 个单元测试全部通过
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 12:14:28 -04:00
iomgaa
5e57cf19b6
refactor(harness): 拆分校验函数降低 radon 圈复杂度至 Grade B
...
- _validate: 拆出 _validate_mode(mode 依赖校验)+ _validate_basic(标量/枚举校验)
- _validate_gate: 拆为 _validate_gate_thresholds(e 值/净胜/方向)+ _validate_gate_ladder(阶梯/块序贯)
- load_config: 提取 _apply_env_overrides 函数
- radon cc -n C 无输出(全部 Grade B 或更好)
- 70 个单元测试全部通过
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 12:01:46 -04:00
iomgaa
ca02b5a91d
feat(harness): RunConfig frozen dataclass + 四层校验 + YAML/CLI/.env 三层加载
...
- RunConfig: 46 字段 frozen dataclass,从 TRM4 core/harness/config.py 迁移
- 四层校验链:_validate → _validate_edit_budget + _validate_minibatch + _validate_gate
- 新增 .env 覆盖层:工程配置(workspace_dir, store_dir)可通过 HARNESS_* 环境变量注入
- 合并优先级:CLI > .env > YAML(CLAUDE.md §4.5)
- load_config 支持嵌套 harness 段和扁平 YAML 两种格式
- run_id 改为默认空字符串(CLI-only 字段,YAML 不提供)
- resume/fresh 互斥校验不在 config 层(移至 runner.py)
- 70 个单元测试全部通过
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 11:57:35 -04:00
iomgaa
63ad68f737
feat(evolution): export dataclass types from __init__.py
2026-07-07 11:48:13 -04:00
iomgaa
2db612e0bb
docs: app/harness/ implementation plan — 15 tasks, algorithm fidelity #6/#10/#13, 120 TRM4 tips
2026-07-07 11:45:38 -04:00
iomgaa
af8081e9ed
docs: app/harness/ design — 14-module training loop orchestration layer
2026-07-07 11:28:29 -04:00
iomgaa
283ea27b51
merge: feat/tree-index — core/evolution/ extractable kernel + tree/search/question_gen modules
2026-07-07 10:29:54 -04:00
iomgaa
9ab6a89298
feat(evolution): __init__.py public API + ARCHITECTURE.md Protocol update
2026-07-07 10:28:14 -04:00
iomgaa
5c42e0309b
feat(evolution): evolve.py per-target evolution — skill/system/tool ( #9 )
2026-07-07 10:26:58 -04:00
iomgaa
2c5b4c819c
feat(evolution): evolve.py validation + helpers ( #9 )
2026-07-07 10:12:15 -04:00
iomgaa
c6a81f8504
feat(evolution): diagnose.py aggregation + case packs + run_diagnosis ( #8 )
2026-07-07 10:04:48 -04:00
iomgaa
fdbf9222ab
feat(evolution): diagnose.py metrics + attribution (Stage 1, #8 )
2026-07-07 09:55:22 -04:00
iomgaa
ebd83810aa
feat(evolution): validate.py — pure block validation decision functions ( #7 )
2026-07-07 09:47:45 -04:00
iomgaa
7f8ed56428
feat(evolution): patch.py — 补丁引擎移植(算法 #9),51 测试全通过
...
从 TRM4 core/harness/patch.py (427 行) 零修改移植到 core/evolution/patch.py。
包含:
- 7 个常量(APPENDIX/MOMENTUM marker + MAX_CHARS + HEADING)
- appendix 区:追加/提取/替换/边界检测,损坏态 ValueError
- momentum 区:替换/提取/边界检测,注入防护
- apply_patch_with_report:4 种 op(append/insert_after/replace/delete)
- 冻结区坐标判定(每条 edit 重算)、report 1-based index
- 51 个单元测试覆盖全部公共 API 及边缘场景
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 09:44:05 -04:00
iomgaa
57793fb0f8
feat(evolution): gate.py — CE-Gate e-process 纯函数 ( #5 算法保真)
...
从 TRM4 core/harness/eprocess.py 逐行迁移,零逻辑变更:
- compute_e_value: 截断 Beta 混合 e 值(log 空间 + betainc 对称性)
- gate_decision: 四出口优先级链(confirmed→directional→futility→exhaustion→continue)
- probation_verdict: 试用期非对称双向结算
- 常量保真: _WALD_WIN=ln1.4, _WALD_LOSS=ln0.6, _SHRINK_PSEUDO=4
仅变更: import 路径 + GateParams/GateVerdict 移至 types.py + 中文 docstring
14 tests 覆盖: e 值数学、边界校验、四出口路径、试用期三分支
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 09:38:21 -04:00
iomgaa
47c2de71a2
feat(core/evolution): protocols.py + types.py 基础层 — 18 个 dataclass + 3 个 Protocol
...
TRM4 诊断/进化/门控数据类型迁移至 TRM5 Clean Architecture 内核。
逐字段比对 TRM4 的 eprocess.py、diagnose.py、evolve.py 保真迁移。
types.py (18 个 dataclass):
- Gate: GateParams, GateVerdict (frozen, 原样迁移)
- 诊断: SpanMetrics, SkillStepAdherence, QuestionMetrics,
ErrorAttribution, CaseSample, SkillCasePack, SystemCasePack,
ToolCasePack, DiagnosisResult (全部 frozen=True)
- 进化: EvolutionRecord (mutable), RejectedEdit (frozen),
EvolutionResult (frozen, 移除 skills_version/prompts_version)
- 新增: PairResult, QuadrantClassification (块验证纯决策输出)
- 新增: DiagnosePrompts, EvolvePrompts (模板束, frozen)
protocols.py (3 个只读 Protocol):
- SkillStore, PromptStore (同步文件读取)
- RunLog (异步日志查询, 隔离 SQL)
变更理由:
- QuestionMetrics 由 TRM4 mutable 改为 frozen (一次性构造)
- ErrorAttribution 由 TRM4 mutable 改为 frozen (构造时填入全部字段)
- EvolutionResult 移除版本管理字段 (app/ 职责)
涉及算法: #5(CE-Gate), #8(诊断瀑布), #9(进化引擎)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 09:34:04 -04:00
iomgaa
8bbfbc9b8a
docs: core/evolution/ implementation plan — 9 tasks, TDD, algorithm fidelity checks
2026-07-07 07:55:21 -04:00
iomgaa
2761ca3e82
docs: core/evolution/ extractable kernel design — gate, patch, diagnose, evolve
2026-07-07 07:39:24 -04:00