SuperAPI AI Directory

webnovel-resume

Office & productivity

View repository

Updated 10-16 06:23

About this skill

Task Resume Skill

Project Root Guard (must be confirmed first)

  • Claude Code's "workspace root" is not necessarily equal to the "book project root". Common structure: the workspace is D:\wk\xiaoshuo, and the book project is D:\wk\xiaoshuo\凡人资本论。
  • The real book project root must be resolved first (it must contain .webnovel/state.json), and all subsequent read/write paths are based on that directory.

Environment setup (before executing bash commands):

export WORKSPACE_ROOT="${CLAUDE_PROJECT_DIR:-$PWD}"

if [ -z "${CLAUDE_PLUGIN_ROOT}" ] || [ ! -d "${CLAUDE_PLUGIN_ROOT}/skills/webnovel-resume" ]; then
  echo "ERROR: 未设置 CLAUDE_PLUGIN_ROOT 或缺少目录: ${CLAUDE_PLUGIN_ROOT}/skills/webnovel-resume" >&2
  exit 1
fi
export SKILL_ROOT="${CLAUDE_PLUGIN_ROOT}/skills/webnovel-resume"

if [ -z "${CLAUDE_PLUGIN_ROOT}" ] || [ ! -d "${CLAUDE_PLUGIN_ROOT}/scripts" ]; then echo "ERROR: CLAUDE_PLUGIN_ROOT is not set or directory is missing: ${CLAUDE_PLUGIN_ROOT}/scripts" >&2 exit 1 fi export SCRIPTS_DIR="${CLAUDE_PLUGIN_ROOT}/scripts"

export PROJECT_ROOT="$(python "${SCRIPTS_DIR}/webnovel.py" --project-root "${WORKSPACE_ROOT}" where)"


## Workflow Checklist

Copy and track progress:

Task resume progress:

  • Step 1: Load the resume protocol (cat "${SKILL_ROOT}/references/workflow-resume.md")
  • Step 2: Load the data specification (cat "${SKILL_ROOT}/references/system-data-flow.md")
  • Step 3: Confirm sufficient context
  • Step 4: Detect interruption status
  • Step 5: Present resume options (AskUserQuestion)
  • Step 6: Execute resume
  • Step 7: Continue the task (optional)

---

## Reference Loading Levels (strict, lazy)

- L0: 不加载任何参考,直到确认存在中断恢复需求。
- L1: 只加载恢复协议主文件。
- L2: 仅在数据一致性检查时加载数据规范。

### L1 (minimum)
- [workflow-resume.md](references/workflow-resume.md)

### L2 (conditional)
- [system-data-flow.md](references/system-data-flow.md)(仅在需要核对状态字段/恢复策略时)

## Step 1: 加载恢复协议(必须执行)

```bash
cat "${SKILL_ROOT}/references/workflow-resume.md"

Core principles(apply after reading):

  • No intelligent continuation: high risk of context loss
  • Must detect before resuming: do not guess the interruption point
  • Must have user confirmation: do not resume automatically

Step 2: Load the data specification

cat "${SKILL_ROOT}/references/system-data-flow.md"

Step 3: Confirm sufficient context

Checklist:

  • Resume protocol understood
  • Step difficulty grading known
  • State structure understood
  • The "delete and restart" vs "intelligent continuation" principle is clear

If anything is missing → return to the corresponding Step

Step difficulty grading (from workflow-resume.md)

Step Difficulty Resume strategy
Step 1 ⭐ Re-execute directly
Step 1.5 ⭐ Redesign
Step 2A ⭐⭐ Delete the half-finished work and start over
Step 2B ⭐⭐ Continue adapting or return to 2A
Step 3 ⭐⭐⭐ User decides: re-review or skip
Step 4 ⭐⭐ Continue polishing or delete and rewrite
Step 5 ⭐⭐ Re-run (idempotent)
Step 6 ⭐⭐⭐ Check the staging area, decide to commit/roll back

Step 4: Detect interruption status

python "${SCRIPTS_DIR}/webnovel.py" --project-root "$PROJECT_ROOT" workflow detect

Output situation:

  • No interruption → end the process and notify the user
  • Interruption detected → continue to Step 5

Step 5: Present resume options (must be executed)

Present to the user:

  • Task command and parameters
  • Interruption time and elapsed duration
  • Completed steps
  • Current (interrupted) step
  • Remaining steps
  • Resume options and risk levels

Example output:

🔴 检测到中断任务:

任务:/webnovel-write 7
中断位置:Step 2 - 章节内容生成中

已完成:
  ✅ Step 1: 上下文加载

未完成:
  ⏸️ Step 2: 章节内容(已写1500字)
  ⏹️ Step 3-7: 未开始

恢复选项:
A) 删除半成品,从Step 1重新开始(推荐)
B) 回滚到Ch6,放弃Ch7所有进度

请选择(A/B):

Step 6: Execute resume

Option A - Delete and restart(recommended):

python "${SCRIPTS_DIR}/webnovel.py" --project-root "$PROJECT_ROOT" workflow cleanup --chapter {N} --confirm
python "${SCRIPTS_DIR}/webnovel.py" --project-root "$PROJECT_ROOT" workflow clear

Option B - Git rollback:

git -C "$PROJECT_ROOT" reset --hard ch{N-1:04d}
python "${SCRIPTS_DIR}/webnovel.py" --project-root "$PROJECT_ROOT" workflow clear

Step 7: Continue the task (optional)

If the user chooses to continue immediately:

/{original_command} {original_args}

Special scenarios

Interruption at Step 6 (high cost)

恢复选项:
A) 重新执行双章审查(成本:~$0.15)⚠️
B) 跳过审查,继续下一章(可后续补审)

Interruption at Step 4 (partial state)

⚠️ state.json 可能部分更新

A) 检查并修复 state.json
B) 回滚到上一章(安全)

Long interruption (>1 hour)

⚠️ 中断已超过1小时

上下文丢失风险高
建议重新开始而非续写

Prohibited actions

  • ❌ Intelligently continue half-finished content
  • ❌ Automatically choose a resume strategy
  • ❌ Skip interrupt detection
  • ❌ Fix state.json without verification