For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: 让 context-agent 成为唯一写前入口,代码层只准备 research 底稿,最终由 context-agent 按示例直接写出给 Step 2 使用的写作任务书。
Architecture: 不再引入模板生成器。extract_chapter_context.py 继续负责组装 research 底稿;context-agent 基于底稿、固定守则和文档内示例,直接产出最终写作任务书;webnovel-write 的 Step 2 只消费这份任务书,不再自己补规则或拼中间块。
Tech Stack: Python 3、pytest、Markdown agent/skill prompt、webnovel.py CLI
webnovel-writer/scripts/extract_chapter_context.py
webnovel-writer/scripts/data_modules/tests/test_extract_chapter_context.py
webnovel-writer/agents/context-agent.md
webnovel-writer/skills/webnovel-write/SKILL.md
webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py
webnovel-writer/skills/webnovel-write/evals/evals.json
docs/guides/commands.md
/webnovel-write 描述webnovel-writer/scripts/data_modules/writing_brief_renderer.pywebnovel-writer/scripts/data_modules/tests/test_writing_brief_renderer.pyFiles:
webnovel-writer/scripts/data_modules/writing_brief_renderer.pywebnovel-writer/scripts/data_modules/tests/test_writing_brief_renderer.pywebnovel-writer/scripts/extract_chapter_context.pyModify: webnovel-writer/scripts/data_modules/tests/test_extract_chapter_context.py
[ ] Step 1: 删除生成器文件
git rm webnovel-writer/scripts/data_modules/writing_brief_renderer.py
git rm webnovel-writer/scripts/data_modules/tests/test_writing_brief_renderer.py
[ ] Step 2: 移除 extract_chapter_context.py 中的生成器调用
# webnovel-writer/scripts/extract_chapter_context.py
# 删除:
from data_modules.writing_brief_renderer import render_writer_brief
# 删除:
def _plugin_root() -> Path: ...
def _load_fixed_guides() -> Dict[str, str]: ...
def _extract_book_title(project_root: Path, state: Dict[str, Any]) -> str: ...
def _extract_chapter_title(outline: str, chapter_num: int) -> str: ...
# build_chapter_context_payload 保留为底稿输出:
return {
"chapter": chapter_num,
"outline": outline,
"previous_summaries": prev_summaries,
"state_summary": state_summary,
"context_contract_version": contract_context.get("context_contract_version"),
"context_weight_stage": contract_context.get("context_weight_stage"),
"story_contract": contract_context.get("story_contract", {}),
"runtime_status": contract_context.get("runtime_status", {}),
"latest_commit": contract_context.get("latest_commit", {}),
"prewrite_validation": contract_context.get("prewrite_validation", {}),
"reader_signal": contract_context.get("reader_signal", {}),
"genre_profile": contract_context.get("genre_profile", {}),
"writing_guidance": contract_context.get("writing_guidance", {}),
"plot_structure": plot_structure,
"long_term_memory": contract_context.get("long_term_memory", {}),
"scene": contract_context.get("scene", {}),
"core": contract_context.get("core", {}),
"rag_assist": rag_assist,
}
[ ] Step 3: 删除 writer_brief 相关测试,恢复旧文本输出断言
# webnovel-writer/scripts/data_modules/tests/test_extract_chapter_context.py
# 删除:
def test_build_chapter_context_payload_includes_writer_brief(...): ...
def test_render_text_returns_writer_brief_instead_of_old_audit_sections(...): ...
# 保留:
def test_render_text_contains_writing_guidance_section(...): ...
def test_render_text_contains_contract_first_runtime_section(...): ...
[ ] Step 4: 跑测试确认底稿链恢复正常
Run:
python -m pytest webnovel-writer/scripts/data_modules/tests/test_extract_chapter_context.py -q --no-cov
Expected:
全部通过,0 失败
[ ] Step 5: 提交这一块
git add webnovel-writer/scripts/extract_chapter_context.py \
webnovel-writer/scripts/data_modules/tests/test_extract_chapter_context.py
git commit -m "refactor: keep chapter context as research draft only"
context-agent 直接按示例输出写作任务书Files:
webnovel-writer/agents/context-agent.mdModify: webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py
[ ] Step 1: 先补静态测试,锁住示例驱动输出
# webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py
def test_context_agent_loads_fixed_guides_and_outputs_writer_brief():
text = (AGENTS_DIR / "context-agent.md").read_text(encoding="utf-8")
assert "core-constraints.md" in text
assert "anti-ai-guide.md" in text
assert "写作任务书" in text
assert "### 示例" in text
assert "你现在要写《凡人修仙传》第47章《坊市试探》。" in text
assert "Step 2 直写提示词" not in text
assert "Context Contract" not in text
[ ] Step 2: 改 context-agent.md
### webnovel-writer/agents/context-agent.md
## 8. 输出格式
最终只输出一份写作任务书。
任务书固定写成五段,每一段该织入哪些数据源见下方说明和示例。
### 1. 开篇委托
### 2. 这一章的故事
### 3. 这章的人物
### 4. 这章怎么写更顺
### 5. 这章收在哪里
### 示例
你现在要写《凡人修仙传》第47章《坊市试探》。
...
让读者带着"这个人到底是谁"翻到下一章。
[ ] Step 3: 跑静态测试
Run:
python -m pytest webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py -q --no-cov
Expected:
相关断言全部通过
[ ] Step 4: 提交这一块
git add webnovel-writer/agents/context-agent.md \
webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py
git commit -m "feat: make context agent write briefs from example"
/webnovel-write 主链Files:
webnovel-writer/skills/webnovel-write/SKILL.mdwebnovel-writer/skills/webnovel-write/evals/evals.jsondocs/guides/commands.mdModify: webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py
[ ] Step 1: 先补静态测试,锁住新流程
# webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py
def test_webnovel_write_skill_routes_step2_through_writing_brief():
text = (SKILLS_DIR / "webnovel-write" / "SKILL.md").read_text(encoding="utf-8")
assert "写作任务书" in text
assert "context-agent" in text
assert "Step 0.5" not in text
assert 'cat "${SKILL_ROOT}/../../references/shared/core-constraints.md"' not in text
assert 'cat "${SKILL_ROOT}/references/anti-ai-guide.md"' not in text
[ ] Step 2: 改 webnovel-write/SKILL.md
### Step 1:调用 Context Agent 生成写作任务书
### Step 2:起草正文
硬要求:
- Step 2 只根据 Step 1 生成的写作任务书起草正文
- Step 2 不再直接加载 `core-constraints.md`
- Step 2 不再直接加载 `anti-ai-guide.md`
- Step 2 不再自己拼中间块或旧版直写块
[ ] Step 3: 改 eval 和命令文档
// webnovel-writer/skills/webnovel-write/evals/evals.json
"expected_output": "完成 Step 1 到 Step 6 的完整流程,由 context-agent 先生成写作任务书,再起草第4章正文..."
### docs/guides/commands.md
执行完整章节创作流程(`context-agent` 先 research 并生成写作任务书 → 按任务书起草正文 → 审查 → 润色 → 数据落盘)。
[ ] Step 4: 跑静态测试
Run:
python -m pytest webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py -q --no-cov
Expected:
相关断言全部通过
[ ] Step 5: 提交这一块
git add webnovel-writer/skills/webnovel-write/SKILL.md \
webnovel-writer/skills/webnovel-write/evals/evals.json \
docs/guides/commands.md \
webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py
git commit -m "feat: make write step consume only final brief"
Files:
webnovel-writer/scripts/data_modules/tests/test_extract_chapter_context.pyTest: webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py
[ ] Step 1: 跑回归测试
Run:
python -m pytest \
webnovel-writer/scripts/data_modules/tests/test_extract_chapter_context.py \
webnovel-writer/scripts/data_modules/tests/test_prompt_integrity.py \
-q --no-cov
Expected:
全部通过,0 失败
Run:
rg -n "Step 0\\.5|writing_brief_renderer|test_writing_brief_renderer|Context Contract|Step 2 直写提示词|cat \\\"\\$\\{SKILL_ROOT\\}/../../references/shared/core-constraints.md\\\"|cat \\\"\\$\\{SKILL_ROOT\\}/references/anti-ai-guide.md\\\"" \
webnovel-writer \
docs/guides/commands.md
Expected:
除计划文档历史记录外,无业务代码残留
这份计划覆盖当前真实方案:
context-agent 直接按示例写任务书/webnovel-write Step 2 只消费任务书anti-ai-guide.md 与 core-constraints.md 继续存在,但由 context-agent 吸收后转写