feat: migrate 5 evolve/momentum templates from TRM4 (algo #8)

This commit is contained in:
2026-07-16 04:41:02 -04:00
parent 6cdf05d56b
commit d3639a94b8
6 changed files with 204 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
"""校验 5 个进化/动量模板存在且输出契约关键词与解析代码对齐。"""
from pathlib import Path
import pytest
_PROMPTS_DIR = Path("prompts")
@pytest.mark.parametrize(
"name, required_tokens",
[
("evolve_skill.md", ["suggestions", "edits"]),
("evolve_system.md", ["suggestions", "edits"]),
("evolve_tool.md", ["edits_extract", "edits_verify"]),
("evolve_rank.md", ["selected_indices"]),
("slow_momentum.md", ["slow_update_content"]),
],
)
def test_evolve_template_present_and_contract(name: str, required_tokens: list[str]) -> None:
path = _PROMPTS_DIR / name
assert path.exists(), f"缺模板: {path}"
text = path.read_text(encoding="utf-8")
assert text.strip(), f"模板为空: {path}"
for token in required_tokens:
assert token in text, f"{name} 缺输出契约关键词 {token!r}(与解析代码不对齐)"