allowed-tools: Read, Write, Edit, Grep, Bash, Task argument-hint: [章节号]
System Prompt: Write a webnovel chapter following the outline. Your task includes creating chapter content, applying anti-hallucination protocols (大纲即法律/设定即物理/发明需申报), designing cool-points (爽点), and maintaining pacing control with Strand Weave.
ABSOLUTE REQUIREMENTS - VIOLATION = FAILURE:
Why This Matters:
chapter_num: Chapter number to write (e.g., "45"). If not provided, ask the user.BEFORE Step 1, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py start-task \
--command webnovel-write \
--chapter {chapter_num}
Expected Output:
✅ 任务已启动: webnovel-write {"chapter_num": {N}}
Purpose:
.webnovel/workflow_state.json 状态追踪文件Why This Matters:
/webnovel-resume to detect interruptionsFORBIDDEN: Skipping this step or proceeding without successful initialization.
Before executing Step 1, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py start-step \
--step-id "Step 1" \
--step-name "Load Context"
YOU MUST execute these reads in parallel:
.webnovel/state.json - Get current protagonist state大纲/第X卷-详细大纲.md - Find this chapter's outline正文/ (if exist) - Get contextStep 1.4: Load Review Feedback (CONDITIONAL - CRITICAL)
IF the previous chapter was reviewed (i.e., (chapter_num - 1) % 2 == 0):
YOU MUST execute:
state.json → Check review_checkpoints array审查报告/Review_Ch{N-2}-{N-1}_YYYYMMDD.md)Example:
📋 Review Feedback Loaded (From Ch{N-2}-{N-1} Report):
🔴 Critical Issues to Avoid:
- 连续3章打脸型爽点(需变化爽点类型)
- Quest线已连续5章主导(需切换到Fire或Constellation)
- 战斗描写过于简略(需增加细节)
💡 Priority Recommendations:
1. 增加Fire线(慕容雪情感戏)比重
2. 引入Constellation线(家族关系变化)
3. 爽点类型建议:升级型 or 收获型
Purpose: Ensure the chapter-writer agent applies quality feedback, preventing defect accumulation.
Step 1.5: Load Reference Materials (CONDITIONAL - OPTIONAL)
When to Load:
references/cool-points-guide.md for爽点type overviewreferences/pacing-control.md for Strand Weave rulestemplates/genres/修仙.md (or相应题材)templates/golden-finger-templates.mdHow to Load (Example):
📚 Reference Materials Loaded:
- cool-points-guide.md (Refreshed 5 types of cool points: 打脸/升级/收获/扮猪吃虎/装逼打脸)
- golden-finger-templates.md (Reviewed system panel design for Lv.X → Lv.Y breakthrough)
Purpose:
IMPORTANT:
FORBIDDEN:
After completing Step 1, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py complete-step \
--step-id "Step 1"
Before executing Step 2, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py start-step \
--step-id "Step 2" \
--step-name "Generate Chapter Content"
THIS STEP IS NOT OPTIONAL. YOU MUST EXECUTE IT.
YOU MUST generate chapter content following the webnovel-writer skill protocols:
The webnovel-writer skill will automatically guide you to apply:
Context to Apply (from Step 1):
Outline Requirements (from 大纲):
Protagonist State (from state.json):
Previous Context (from 前2章):
Review Feedback (if loaded in Step 1.4 - CRITICAL):
Generation Process:
YOU MUST follow these steps while generating:
Pre-Writing Planning (think before writing):
- 本章目标: [从大纲提取]
- 爽点设计: [选择类型,避免连续3章同类型]
- Strand选择: [Quest/Fire/Constellation,根据history避免连续5章]
- 审查反馈应用: [如何规避Critical Issues + 应用Recommendations]
Content Generation (3000-5000 Chinese characters):
[NEW_ENTITY: 类型, 名称, 描述] tagsInteractive Adjustment (if user interrupts):
Self-Review (before saving):
Save Output:
File: 正文/第{N:04d}章.md
Format:
# 第 {N} 章:{标题}
{正文 3000-5000字}
---
## 本章统计
- **字数**: {实际字数}
- **爽点**: {类型}
- **主导Strand**: {quest/fire/constellation}
- **新角色**: {列表或"无"}
- **伏笔**: {列表或"无"}
CRITICAL Requirements:
FORBIDDEN:
After completing Step 2, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py complete-step \
--step-id "Step 2" \
--artifacts '{"chapter_file": {"path": "正文/第{N:04d}章.md", "exists": true, "word_count": {实际字数}, "status": "complete"}}'
Before executing Step 3 (if NEW_ENTITY tags exist), YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py start-step \
--step-id "Step 3" \
--step-name "Extract Entities"
IF you used [NEW_ENTITY] tags in the chapter:
python .claude/skills/webnovel-writer/scripts/extract_entities.py "正文/第{N:04d}章.md" --auto
After completing Step 3, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py complete-step \
--step-id "Step 3" \
--artifacts '{"entities_extracted": true}'
Before executing Step 4, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py start-step \
--step-id "Step 4" \
--step-name "Update State"
python .claude/skills/webnovel-writer/scripts/update_state.py \
--progress {chapter_num} {total_words} \
--protagonist-power "{新境界}" {新层数} "{新瓶颈}" \
--protagonist-location "{新地点}" {chapter_num}
Minimum required (if no power/location change):
python .claude/skills/webnovel-writer/scripts/update_state.py --progress {chapter_num} {total_words}
After completing Step 4, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py complete-step \
--step-id "Step 4" \
--artifacts '{"state_json_modified": true}'
CRITICAL: After Step 4, automatically run archive check:
python .claude/skills/webnovel-writer/scripts/archive_manager.py --auto-check
Purpose: 防止 state.json 无限增长(200万字长跑保障)
Archiving Strategy:
archive/characters.jsonarchive/plot_threads.jsonarchive/reviews.jsonTrigger Conditions (满足任一即执行):
Expected Output:
✅ 无需归档(触发条件未满足)
文件大小: 0.35 MB (阈值: 1.0 MB)
当前章节: 7 (每 10 章触发)
OR (if archiving triggered):
✅ 归档完成:
角色归档: 12 → characters.json
伏笔归档: 8 → plot_threads.json
报告归档: 5 → reviews.json
💾 文件大小: 1.2 MB → 0.8 MB (节省 0.4 MB)
IMPORTANT:
--restore-character "角色名" 恢复CRITICAL: After archiving, automatically update structured index in TWO steps:
Use Task tool to call metadata-extractor agent:
# Read chapter content
with open(f"正文/第{chapter_num:04d}章.md", 'r', encoding='utf-8') as f:
chapter_content = f.read()
# Call metadata-extractor agent
agent_output = Task(
subagent_type="metadata-extractor",
description="Extract chapter metadata",
prompt=f"Extract metadata from chapter {chapter_num}:\n\n{chapter_content}"
)
# Parse agent output (agent returns JSON in text block)
import re
import json
json_match = re.search(r'\{[\s\S]*\}', agent_output)
if json_match:
metadata_json = json_match.group(0)
# Save to temporary file (Windows-compatible)
import tempfile
with tempfile.NamedTemporaryFile(mode='w', suffix='.json', delete=False, encoding='utf-8') as tmp:
tmp.write(metadata_json)
metadata_file = tmp.name
else:
raise ValueError("Agent output missing JSON block")
What the agent does:
{"title": "...", "location": "...", "characters": [...], ...}Expected Output (from agent):
{
"title": "第七章 突破",
"location": "慕容家族",
"characters": ["林天", "慕容战天", "云长老"],
"word_count": 4521,
"hash": "abc123...",
"metadata_quality": "high"
}
Performance: ~1-2s (AI semantic analysis)
Pass agent's JSON file to structured_index.py (Windows-compatible):
python .claude/skills/webnovel-writer/scripts/structured_index.py \
--update-chapter {chapter_num} \
--metadata-file {metadata_file}
Why use --metadata-file instead of --metadata-json?
What this does:
Expected Output:
✅ 章节索引已更新:Ch7 - 第七章 突破
✅ 伏笔索引已同步:3 条活跃 + 2 条已回收
Performance: ~10ms (SQLite write)
Cleanup (after successful write):
import os
os.unlink(metadata_file) # Delete temporary file
Total Time: Step 4.6.1 (~1-2s) + Step 4.6.2 (~10ms) = ~1-2s per chapter
Accuracy Improvement:
Alternative Modes:
Direct JSON string (Linux/macOS only):
python structured_index.py --update-chapter {N} --metadata-json '{json_string}'
Fallback mode (if agent unavailable):
# Direct file-based extraction (legacy mode, 60% accuracy)
python structured_index.py --update-chapter {N} --metadata "正文/第{N:04d}章.md"
Query Examples (for future use):
# 查询地点相关章节(O(log n) vs O(n) 文件遍历)
python structured_index.py --query-location "血煞秘境"
# 查询紧急伏笔(超过 50 章未回收)
python structured_index.py --query-urgent-foreshadowing
# 模糊查询角色
python structured_index.py --fuzzy-search "姓李" "女弟子"
# 查看索引统计
python structured_index.py --stats
IMPORTANT:
Before executing Step 5, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py start-step \
--step-id "Step 5" \
--step-name "Git Backup"
python .claude/skills/webnovel-writer/scripts/backup_manager.py \
--chapter {chapter_num} \
--chapter-title "{章节标题}"
What this does: git add . + git commit + git tag ch{N:04d}
After completing Step 5, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py complete-step \
--step-id "Step 5" \
--artifacts '{"git_committed": true, "git_tag": "ch{N:04d}"}'
Before executing Step 6, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py start-step \
--step-id "Step 6" \
--step-name "Update Strand Tracker"
YOU MUST analyze which story strand dominated this chapter:
After determining the dominant strand, run:
python .claude/skills/webnovel-writer/scripts/update_state.py \
--strand-dominant {quest|fire|constellation} {chapter_num}
Example (Chapter 3 dominated by Quest):
python .claude/skills/webnovel-writer/scripts/update_state.py --strand-dominant quest 3
CRITICAL: This updates strand_tracker in state.json, tracking pacing balance to prevent monotonous pacing.
FORBIDDEN: Skipping strand_tracker update.
After completing Step 6, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py complete-step \
--step-id "Step 6" \
--artifacts '{"strand_tracker_updated": true, "dominant_strand": "{quest|fire|constellation}"}'
Before executing Step 7 (if chapter_num % 2 == 0), YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py start-step \
--step-id "Step 7" \
--step-name "Bi-Chapter Review"
IF chapter_num % 2 == 0 (every 2 chapters):
YOU MUST launch 5 review subagents in parallel using the Task tool.
For EACH subagent below, invoke Task tool with:
subagent_type: The subagent namedescription: Brief task (3-5 words)prompt: "Review chapters {N-1} and {N}. Read the chapter files from 正文/ directory and generate a structured report following your protocol."Required subagents (invoke all 5 in parallel):
After ALL 5 subagents return their reports:
Step 7.1: Consolidate Review Reports (MANDATORY)
Create consolidated report file:
# Save to: 审查报告/Review_Ch{N-1}-{N}_YYYYMMDD.md
Report structure (Markdown format):
# 双章审查报告 (Chapters {N-1}-{N})
> **审查日期**: YYYY-MM-DD
> **审查章节**: 第 {N-1}-{N} 章
> **审查员**: 5 个(爽点/一致性/节奏/OOC/连贯性)
## 1. 爽点密度检查 (High-Point Checker)
[Paste high-point-checker report here]
## 2. 设定一致性检查 (Consistency Checker)
[Paste consistency-checker report here]
## 3. 节奏平衡检查 (Pacing Checker)
[Paste pacing-checker report here]
## 4. 人物OOC检查 (OOC Checker)
[Paste ooc-checker report here]
## 5. 连贯性检查 (Continuity Checker)
[Paste continuity-checker report here]
## 综合评分 (Overall Score)
- **爽点密度**: X/10
- **设定一致性**: X/10
- **节奏平衡**: X/10
- **人物一致性**: X/10
- **连贯性**: X/10
- **总分**: XX/50
## 关键问题汇总 (Critical Issues)
- [List all critical/high severity issues from 5 reports]
## 改进建议 (Recommendations)
- [Top 3-5 actionable recommendations]
Step 7.2: Update state.json Review Checkpoint (MANDATORY)
python .claude/skills/webnovel-writer/scripts/update_state.py \
--add-review "{N-1}-{N}" "审查报告/Review_Ch{N-1}-{N}_YYYYMMDD.md"
Step 7.3: Present Summary to User
Output consolidated findings to user (see Final Output section below).
Purpose: Catch accumulating defects before they compound, and maintain quality audit trail.
CRITICAL:
Step 7.4: Interactive Fix Option (CONDITIONAL - CRITICAL)
IF the consolidated review report contains Critical Issues (🔴 severity: critical/high):
YOU MUST execute:
Extract Critical Issues from report:
Ask user for immediate fix:
🔴 审查发现 {count} 个Critical问题:
{列出Critical Issues清单}
是否立即修复当前章节?
A) 是,立即修复并重新审查
B) 否,记录到待修复清单,继续下一章
Handle user choice:
Choice A - 立即修复流程:
For each Critical Issue:
1. 定位问题章节段落
2. 应用修复(基于Recommendations)
3. 保存修改后的章节文件
4. 运行 backup_manager.py(新Git commit标记"修复版")
可选:重新调用5个审查员验证修复效果
输出:
✅ 修复完成:{count}个Critical Issues已解决
📋 新审查报告(如有):审查报告/Review_Ch{N-1}-{N}_FIXED_YYYYMMDD.md
Choice B - 延迟修复流程:
输出:
📋 审查报告已保存:审查报告/Review_Ch{N-1}-{N}_YYYYMMDD.md
💡 建议在后续章节创作时注意规避这些问题
💡 或者稍后手动修复这些章节
Purpose: 保存报告供后续参考,用户可选择稍后手动修复
IF no Critical Issues:
FORBIDDEN:
After completing Step 7, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py complete-step \
--step-id "Step 7" \
--artifacts '{"review_completed": true, "review_report_path": "审查报告/Review_Ch{N-1}-{N}_YYYYMMDD.md"}'
AFTER all steps complete successfully, YOU MUST run:
python .claude/skills/webnovel-writer/scripts/workflow_manager.py complete-task
Expected Output:
🎉 任务完成
Purpose:
current_task 状态last_stable_state 快照(for rollback reference)Why This Matters:
/webnovel-resume from detecting false interruptionsFORBIDDEN: Claiming chapter is complete without running this step.
✅ 第 {chapter_num} 章《{标题}》创作完成
📝 章节信息
- 章节: 第 {chapter_num} 章
- 标题: {标题}
- 字数: {实际字数} 字
- 爽点: {爽点类型}
📊 状态更新
- 总进度: {current_chapter}/{target_chapters} 章
- 总字数: {total_words}/{target_words} 字
- 完成度: {完成百分比}%
💪 主角状态
- 实力: {realm} {layer}层
- 位置: {location}
- 金手指: {golden_finger} Lv.{level}
🔧 系统操作
- ✅ state.json 已更新
- ✅ Git 备份已完成 (commit: {git_hash})
- ✅ strand_tracker 已更新 (dominant: {dominant_strand})
{IF chapter_num % 2 == 0}
🔍 双章审查
- ✅ 已调用5个审查员 (high-point/consistency/pacing/ooc/continuity)
- 📋 审查报告已保存: 审查报告/Review_Ch{N-1}-{N}_YYYYMMDD.md
- ✅ state.json review_checkpoints 已更新
{ENDIF}
Workflow Tracking:
workflow_manager.py start-task executed successfullystart-step/complete-step) executedworkflow_manager.py complete-task executed successfullyData Archiving (200万字长跑保障):
archive_manager.py --auto-check executed after Step 4Chapter Content:
正文/第{N:04d}章.md (3,000-5,000 chars)State Management:
update_state.py executed successfullybackup_manager.py executed successfullystrand_tracker updated in state.jsonQuality Control:
IF ANY CHECKBOX IS UNCHECKED → TASK IS NOT COMPLETE.
IF any script fails:
FORBIDDEN: Hiding script errors or claiming success when a step failed.