From 8bc413275017cb71b633a907eda376794641c901 Mon Sep 17 00:00:00 2001 From: iomgaa Date: Tue, 7 Jul 2026 10:28:14 -0400 Subject: [PATCH] feat(evolution): __init__.py public API + ARCHITECTURE.md Protocol update --- core/evolution/__init__.py | 45 +++++++++++++++++++++++++++++++++++ research-wiki/ARCHITECTURE.md | 8 ++++--- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/core/evolution/__init__.py b/core/evolution/__init__.py index e69de29..0a463ac 100644 --- a/core/evolution/__init__.py +++ b/core/evolution/__init__.py @@ -0,0 +1,45 @@ +"""core/evolution/ — 自进化循环决策内核。 + +诊断、进化、门控、补丁的纯决策逻辑。 +只依赖 Protocol 接口和标准库,可搬到无 adapters 的环境用假实现原样运行。 +""" + +from core.evolution.diagnose import run_diagnosis +from core.evolution.evolve import ( + edit_budget_at, + evolve_single_skill, + evolve_single_tool, + evolve_system_prompt, + resolve_skill_file, +) +from core.evolution.gate import compute_e_value, gate_decision, probation_verdict +from core.evolution.patch import ( + append_to_appendix, + apply_patch_with_report, + extract_appendix_notes, + momentum_inner, + replace_appendix_notes, + replace_momentum, +) +from core.evolution.validate import classify_quadrants, compute_accuracy, pair_block + +__all__ = [ + "append_to_appendix", + "apply_patch_with_report", + "classify_quadrants", + "compute_accuracy", + "compute_e_value", + "edit_budget_at", + "evolve_single_skill", + "evolve_single_tool", + "evolve_system_prompt", + "extract_appendix_notes", + "gate_decision", + "momentum_inner", + "pair_block", + "probation_verdict", + "replace_appendix_notes", + "replace_momentum", + "resolve_skill_file", + "run_diagnosis", +] diff --git a/research-wiki/ARCHITECTURE.md b/research-wiki/ARCHITECTURE.md index d3cae31..0e4a528 100644 --- a/research-wiki/ARCHITECTURE.md +++ b/research-wiki/ARCHITECTURE.md @@ -213,11 +213,13 @@ project_root/ **Evolution 专属端口(`core/evolution/protocols.py`):** +core/ 侧 Protocol 只读——core/ 返回结果 dataclass,写入由 app/harness/ 编排层执行。写方法保留在 app/ 侧的实现类中。 + | Protocol | 关键方法 | 职责 | |----------|---------|------| -| `SkillStore` | `read_skill()`, `write_skill()`, `list_versions()` | 版本化技能存储 | -| `PromptStore` | `read_prompt()`, `write_prompt()` | 版本化提示词存储 | -| `RunLog` | `insert()`, `query()` | 实验日志 | +| `SkillStore` | `read_skill()`, `list_skill_files()` | 版本化技能读取(只读) | +| `PromptStore` | `read_prompt()`, `list_prompt_files()` | 版本化提示词读取(只读) | +| `RunLog` | `get_predictions()`, `get_traces()` | 实验日志查询(只读) | ### 3.2 应用层端口(`app/ports.py`)