Bläddra i källkod

fix(cross-val): write story-system uses PROJECT_ROOT; data-agent drops runnable chapter-commit (+ test guard)

lingfengQAQ 2 veckor sedan
förälder
incheckning
203ccb4749

+ 2 - 7
webnovel-writer/agents/data-agent.md

@@ -19,15 +19,10 @@ python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "{project_root}" inde
 python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "{project_root}" index recent-appearances --limit 20
 python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "{project_root}" index get-aliases --entity "{entity_id}"
 python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "{project_root}" index get-by-alias --alias "{alias}"
-
-python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "{project_root}" chapter-commit \
-  --chapter {chapter} \
-  --review-result "{project_root}/.webnovel/tmp/review_results.json" \
-  --fulfillment-result "{project_root}/.webnovel/tmp/fulfillment_result.json" \
-  --disambiguation-result "{project_root}/.webnovel/tmp/disambiguation_result.json" \
-  --extraction-result "{project_root}/.webnovel/tmp/extraction_result.json"
 ```
 
+chapter-commit 由写章主流程运行,data-agent 不在此执行(见 §5 边界)。
+
 ## 3. 流程
 
 **A 加载**:project_root 由调用方传入(已过 preflight),Read 正文 + 查实体索引和别名。

+ 4 - 0
webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py

@@ -345,6 +345,10 @@ def test_data_agent_is_described_as_extraction_only_not_direct_write_mainline():
     assert "event_type" in text
     assert "subject" in text
     assert "直接写入 index.db 和 state.json" not in text
+    # data-agent 不得携带可运行的 chapter-commit 命令(commit 是主流程的事实提交入口,data-agent 只产 artifact)
+    assert not re.search(r"webnovel\.py[^\n]+chapter-commit", text), (
+        "data-agent.md 不应出现可运行的 webnovel.py ... chapter-commit 命令"
+    )
 
 
 # (已按 plan §12.2 退役) test_webnovel_write_data_agent_prompt_requires_extraction_schema:

+ 1 - 1
webnovel-writer/skills/webnovel-write/SKILL.md

@@ -61,7 +61,7 @@ genre 从 `.webnovel/state.json` 的初始化配置快照读取,用于刷新
 ```bash
 GENRE="$(python -X utf8 -c "import json,sys; s=json.load(open('${PROJECT_ROOT}/.webnovel/state.json',encoding='utf-8')); pi=s.get('project_info',{}); print(pi.get('genre') or s.get('project',{}).get('genre',''))")"
 
-python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${WORKSPACE_ROOT}" \
+python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" \
   story-system "${CHAPTER_GOAL}" --genre "${GENRE}" --chapter {chapter_num} --persist --emit-runtime-contracts --format both
 
 python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" \