SuperAPI AI Directory

webnovel-init

Writing & research

View repository

Updated 10-15 17:03

About this skill

Project Initialization (Deep Mode)

Goals

  • Collect sufficient information through structured interaction to avoid "generate first, then rework."
  • Produce a deployable skeleton:.webnovel/state.json、设定集/*、大纲/总纲.md、.webnovel/idea_bank.json、.story-system/MASTER_SETTING.json。
  • Ensure that subsequent /webnovel-plan and /webnovel-write can run directly.

Execution Principles

  1. Collect first, then generate; if the sufficiency gate has not been passed, do not execute webnovel.py init。
  2. Ask questions in waves, and in each round ask only for information that is "currently missing and will block the next step"; do not repeatedly ask about what the user has already made clear, and let the user adjudicate conflicts.
  3. Reference book breakdowns return only structured results; before user confirmation, they must not be written to idea_bank.json、.story-system、设定集、大纲、正文、.webnovel/state.json or any canon/read model file.

Reference Loading Strategy

Path description:references/ refers to skills/webnovel-init/references/;../../references/ refers to shared references. For detailed collection fields, see references/init-collection-schema.md(read by section as needed, collect item by item; for required items, the "sufficiency gate" prevails).

Step Trigger Reference
Step 1 always references/system-data-flow.md、references/genre-tropes.md
Genre/selling point collection always ../../references/genre-profiles.md(read only the current genre section)
Character stalling Flat characters references/worldbuilding/character-design.md
Worldview/power As needed references/worldbuilding/faction-systems.md、references/worldbuilding/power-systems.md、references/worldbuilding/world-rules.md、references/worldbuilding/setting-consistency.md
Creative constraints Step 6 references/creativity/creativity-constraints.md(section: for collection read ## 一、创意包 Schema (Idea Package)、## 六、硬约束驱动创意 (Hard Constraints)、## 八、评分系统 (Scoring System), for score display read ### 8.1 五维评分)、references/creativity/selling-points.md(section:## 9. 核心卖点定位模板 skeleton, supplement as needed with ### 1.3 核心卖点黄金公式、## 7. 实战检查清单); for composite genres read creative-combination.md; for stalling read inspiration-collection.md; for genre hits read anti-trope-*.md
Naming Start naming python -X utf8 "${SCRIPTS_DIR}/reference_search.py" --skill init --table 命名规则 --query "{命名对象} {题材}" --genre {题材}

Read the above long detailed rules as needed (creative constraints, anti-cliche library, worldview design guide, selling point templates), and do not inline their entries.

Tool Strategy

  • Read/Grep: read project context and reference files.
  • Bash: execute webnovel.py init, file existence checks, and minimal validation.
  • Agent: split parallel subtasks; when in Step 1.5 the user chooses reference book breakdown as the inspiration source, call webnovel-writer:deconstruction-agent。
  • AskUserQuestion: adjudication of key disagreements, candidate selection, final confirmation.
  • WebSearch/WebFetch: use only when the user requests market trends/platform风向, creative constraints require time-sensitive evidence, or genre information is clearly uncertain; search first, then fetch to verify.

Interaction Flow (Deep)

Step 1: Pre-check and Context Loading

Environment setup (before bash command execution):

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

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

Must do:

  • Confirm the current directory is writable; confirm the entry script ${SCRIPTS_DIR}/webnovel.py exists (only plugin directories are supported).
  • Before initialization, do not use where to resolve WORKSPACE_ROOT as the book project root; when the new project does not yet exist, where may hit an old pointer or old project.
  • Print only the workspace and script directory, and confirm that the generation target will be in a book-title-sanitized subdirectory under the workspace.
  • Load minimal references:references/system-data-flow.md、references/genre-tropes.md;templates/genres/ Read only as needed after the genre is selected.

Output: the "known information list" and "to-be-collected list" before entering Deep collection.

Step 1.5: Inspiration Source Inquiry (Optional)

Before entering story core collection, you must first use AskUserQuestion or ask directly to confirm whether the user provides an inspiration source. Do not default to book breakdown, and do not treat reference works as a required item.

Suggested question:

你这本书的灵感来源想从哪里开始?可以直接说原创想法,也可以提供参考作品做拆书提炼。若要拆书,请给参考书名+平台,并尽量提供章节摘录或文本路径;没有参考也可以直接跳过。

Acceptable sources: original ideas, reference work breakdowns (book title/platform/chapter excerpts/text paths), market trends, genre templates/anti-trope libraries/existing premise fragments.

When the user chooses reference work breakdown and provides a text path or chapter excerpts, you must use Agent tool call webnovel-writer:deconstruction-agent, and the init main flow must not verbally substitute for the breakdown result.

Use the Agent tool to run `webnovel-writer:deconstruction-agent`.

Prompt: reference_title={reference_title}; reference_source={reference_source}; reference_text_path={reference_text_path}; reference_text_excerpt={reference_text_excerpt}; analysis_mode={quick|deep|auto}; init_goal={当前初始化故事方向或空}; target_genre={题材或空}。只返回 init_reference_research JSON 对象,不写任何文件,不创建目录,不写 .story-system、.webnovel、设定集、大纲、正文、idea_bank.json、state.json 或任何 canon/read model 文件。

After the call, the main flow must record a SubagentRun summary (for the final report only, not written into canon):

{
  "name": "deconstruction-agent",
  "user_label": "参考作品拆解",
  "status": "completed | partial | failed | skipped",
  "problems": [],
  "auto_handled": [],
  "needs_user_action": false,
  "duration_ms": 0,
  "outputs": []
}

quality.passed=false、confidence < 0.85, insufficient input, unreadable text, degraded quick mode, or incomplete output, you must write problems, and make the final report enter "recommend confirmation / must handle".

Processing rules:

  • When there is only the book title/platform and no text or excerpts, first ask whether excerpts/paths can be provided; if they cannot be provided, treat the reference book only as a "directional clue", and do not fabricate its golden three chapters, characters, settings, or plot facts.
  • After receiving the returned init_reference_research JSON, only use reader_promise、opening_hook_patterns、cool_point_loops、protagonist_patterns、antagonist_pressure_patterns、pacing_notes、borrowable_structures、differentiation_requirements、init_candidates、quality。
  • First check quality:quality.passed=false、confidence < 0.85 or warnings when non-empty, you must not fold the candidates into the creative constraint package; you may only present the risks and required supplementary materials to the user for confirmation.
  • do_not_copy and canon_contamination_warnings must enter the known information list as red lines for subsequent creative generation.
  • Step 2-6 may only use patterns that the user has confirmed and that have been transformed into this book's differentiated expression; it is forbidden to write the reference book's characters, settings, organizations, locations, cheats, or plot facts as-is into the generated project files.

Step 2: Story core and commercial positioning

Required: book title, genre (supports A+B composite), target scale (total word count or total chapter count), one-sentence story, core conflict, target readers/platform.

Canonical genre set (written into project_info.genre): urban, xuanhuan, xianxia, fantasy, science fiction, historical, suspense, game, ancient romance, modern romance, fantasy romance, period, farming, quick transmigration, derivative.

Subdivided presets / tropes / forms may be freely input; the initialization script will map them to canonical and load templates by taxonomy (examples: cultivation, system flow, rule-based horror, palace intrigue and household intrigue, esports, apocalypse). Prioritize letting the user describe freely and then confirm with secondary structuring; when stuck, give 2-4 candidate directions.

Step 3: Character skeleton and relationship conflict

Required: protagonist name, protagonist desire, protagonist flaw (will make him pay a price), protagonist structure (single/multiple protagonists), romance line configuration (none/single female lead/multiple female leads), villain layering (small/medium/large) and a one-sentence mirror confrontation. Optional: protagonist archetype tags, division of labor among multiple protagonists.

Step 4: Cheat and fulfillment mechanism

Required: cheat type (may be "no cheat"), name/system name (leave blank if none), style, visibility, irreversible cost (must have a cost or an explicit "none + reason"), growth rhythm. Conditionally required: for system flow, give system personality + upgrade rhythm; for rebirth, give rebirth time point + memory completeness; for inheritance/artifact spirit, give assistance boundaries + action limits.

Step 5: Worldview and power rules

Required: world scale (single city/multiple domains/continent/multiple realms), power system type, faction landscape, social classes and resource distribution. Genre-related: currency system and exchange rules, sect/organization hierarchy, realm chain and minor realms.

Step 6: Creative constraint package (differentiation core)

Process:

  1. Summarize the inspiration sources already confirmed in Step 1.5: original ideas, reference breakdown results, market trends, genre templates, or anti-trope libraries.
  2. Load anti-cliché libraries based on genre mapping (at most 2 primary relevant libraries).
  3. Generate 2-3 creative packages, each containing: a one-sentence selling point, 1 anti-cliché rule, 2-3 hard constraints, a one-sentence protagonist flaw driver, a one-sentence villain mirror, and an opening hook.
  4. Three-question screening: Why must this genre be written this way? Would it collapse if the protagonist were replaced with a conventional one? Can the selling point be stated clearly in one sentence without hitting a template?
  5. Display the five-dimensional score (see references/creativity/creativity-constraints.md in 8.1 五维评分) to assist decision-making.
  6. The user selects the final plan, or rejects it and gives a reason.

Note:

  • If the user requests "close to the current market," external retrieval may be triggered and a timestamp marked.
  • If reference breakdowns are used, when presenting candidates you must indicate the reference source, transformation method, non-replicable items, and differentiation requirements; before the user explicitly confirms, do not write into idea_bank.json or any generated project file.

Step 7: Consistency restatement and final confirmation

You must output an "initialization summary draft" and have the user confirm: story core (genre/one-sentence story/core conflict), protagonist core (desire/flaw), cheat core (ability and cost), world core (scale/power/factions), creative constraint core (anti-cliché + hard constraints).

Confirmation rules: if the user has not explicitly confirmed, do not execute generation; if the user changes only part, return to the corresponding Step for minimal re-collection.

Sufficiency gate (must pass)

Before the following conditions are met, it is forbidden to execute webnovel.py init:

  1. Book title and genre (may be composite) are determined.
  2. Target scale is calculable (at least one of word count or chapter count).
  3. Protagonist name + desire + flaw are complete.
  4. World scale + power system type are complete.
  5. Cheat type is determined ("no cheat" is allowed).
  6. Creative constraints are determined: 1 anti-cliché rule + at least 2 hard constraints, or the user explicitly refuses and the reason is recorded.

Project directory safety rules (mandatory)

  • project_root Must be generated by safely sanitizing the book title:PROJECT_ROOT="${WORKSPACE_ROOT}/${PROJECT_SLUG}"; if the sanitized result is empty or starts with . , automatically prefix with proj-。
  • It is forbidden to generate project files under the plugin directory (${CLAUDE_PLUGIN_ROOT}); it is forbidden to directly treat WORKSPACE_ROOT as PROJECT_ROOT, unless the user explicitly specifies that the current directory is the book project root.
  • Before initialization, you must display and confirm WORKSPACE_ROOT、PROJECT_SLUG、PROJECT_ROOT。
PROJECT_SLUG="$(python -X utf8 -c "import re,sys; title=sys.argv[1].strip(); slug=re.sub(r'[\\\\/:*?\"<>|]+','',title); slug=re.sub(r'\\s+','-',slug).strip('-'); print(('proj-' + slug) if (not slug or slug.startswith('.')) else slug)" "{title}")"
PROJECT_ROOT="${WORKSPACE_ROOT}/${PROJECT_SLUG}"
echo "WORKSPACE_ROOT=${WORKSPACE_ROOT}"
echo "PROJECT_SLUG=${PROJECT_SLUG}"
echo "PROJECT_ROOT=${PROJECT_ROOT}"

Execute generation

1) Run the initialization script

All parameters come from the collection object above (book title/genre/protagonist/cheat/worldview/villain/creative constraints, etc.), mapped field by field to webnovel.py init 's --* options; for the complete field list see references/init-collection-schema.md, and you can use python "${SCRIPTS_DIR}/webnovel.py" init --help to verify option names.

python "${SCRIPTS_DIR}/webnovel.py" init \
  "${PROJECT_ROOT}" "{title}" "{genre}" \
  --protagonist-name "{protagonist_name}" \
  --target-words {target_words} --target-chapters {target_chapters} \
  --protagonist-desire "{protagonist_desire}" --protagonist-flaw "{protagonist_flaw}" \
  --golden-finger-type "{gf_type}" --gf-irreversible-cost "{gf_irreversible_cost}" \
  --world-scale "{world_scale}" --power-system-type "{power_system_type}" \
  --core-selling-points "{core_points}"
  # 其余字段(结构/感情线/反派/势力/货币/境界/原型/读者/平台等)按采集对象继续追加对应 --* 选项

2) Write idea_bank.json

Write .webnovel/idea_bank.json, and the content must be consistent with the final selected plan:

{
  "selected_idea": {"title": "", "one_liner": "", "anti_trope": "", "hard_constraints": []},
  "constraints_inherited": {"anti_trope": "", "hard_constraints": [], "protagonist_flaw": "", "antagonist_mirror": "", "opening_hook": ""}
}

3) Patch the master outline

大纲/总纲.md Must be completed: one-sentence story, core main line/subplot, creative constraints (anti-cliché, hard constraints, protagonist flaw, villain mirror), villain layering, key payoff milestones (2-3 items).

4) Generate the pre-writing contract tree (Story System initialization)

Immediately after init is completed, generate MASTER_SETTING so that subsequent plans have tone/taboo references. Do not pass --chapterhere (only generate MASTER_SETTING.json and anti_patterns.json), and do not pass --emit-runtime-contracts(No volume/chapter-level data yet); when the plan is broken down into specific chapters, generate the volume/chapter/review contracts.

GENRE="$(python -X utf8 -c "import json,os; root=os.environ['PROJECT_ROOT']; s=json.load(open(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 "${PROJECT_ROOT}" \
  story-system "${GENRE}" --genre "${GENRE}" --persist --format json

Verification and Delivery

test -f "${PROJECT_ROOT}/.webnovel/state.json"
find "${PROJECT_ROOT}/设定集" -maxdepth 1 -type f -name "*.md"
test -f "${PROJECT_ROOT}/大纲/总纲.md"
test -f "${PROJECT_ROOT}/.webnovel/idea_bank.json"
test -f "${PROJECT_ROOT}/.story-system/MASTER_SETTING.json"
test "$(basename "${PROJECT_ROOT}")" = "${PROJECT_SLUG}"

Success criteria:

  • state.json exists and title/genre/target_words/target_chapters are not empty.
  • Core setting collection files exist:世界观.md、力量体系.md、主角卡.md; for a single protagonist, do not generate 主角组.md,heroine_config=无女主 do not generate 女主卡.md。
  • By default, do not generate 金手指设计.md、复合题材-融合逻辑.md、爽点规划.md or empty directories; these use the protagonist card, worldview, and volume outline as the source of truth.
  • 总纲.md has the core mainline and constraint fields filled in;idea_bank.json has been written and is consistent with the final selected plan.
  • .story-system/MASTER_SETTING.json exists and route.primary_genre is not empty.

Failure handling (minimal rollback)

Trigger: key files missing; key fields of the master outline missing; constraints enabled but idea_bank.json missing or inconsistent.

Recovery: only fill in the missing fields, do not re-ask everything; only rerun the minimal steps (files missing -> rerun webnovel.py init; master outline missing fields -> only patch the master outline; idea_bank inconsistent -> only rewrite that file); verify again, and end after everything passes.

Author-friendly process prompts and recovery contract

Before initialization begins, first explain what this session will go through: collect the story core -> confirm creative constraints -> generate the project skeleton -> write the initial story archive -> verify whether planning can begin. Process prompts should use the author's language and should not directly output raw JSON, tracebacks, or long command logs; technical details should be written to .webnovel/logs/run_last.log:

python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" run-log \
  --event init-progress \
  --payload-json "{\"stage\": \"init\"}" \
  --format text

Process prompts should be no more than two lines each, stating only the current action and its impact, for example "Generating the project skeleton: this will create the setting collection, master outline, and initial story archive." Low-interruption confirmation strategy: by default, continue collecting and generating; only the core settings, adoption of reference breakdowns, project directory safety, and the final plan before writing to canon require the user's decision.

When user adjudication is needed, use limited options and explain the impact of each option; for example, keep the current settings / modify part / pause initialization. When stuck, you must explain the blocker, what has been completed, and recovery suggestions, for example "The setting collection has been generated, but the Story System initial archive is missing; rerunning /webnovel-init will only fill in the missing files."

Only for unrecoverable failures should the final report prompt .webnovel/logs/run_last.log; normally only keep logs and do not disturb the author. At the end, you must call the author report helper:

python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" user-report \
  --stage init \
  --format text

Author-friendly final report contract

The final reply must be author-facing and must not output raw JSON, tracebacks, or long command logs. Use a fixed three-part structure and begin with a one-sentence overall status:

总状态:已完成 / 部分完成 / 需要你处理 / 未完成。

一、产生的文件与完成情况
- ...

二、过程中遇到的问题与异常耗时
- 已自动处理:...
- 建议确认:...
- 必须处理:...

三、下一步建议
- ...

Must report:

  • Project directory,.webnovel/state.json、.webnovel/idea_bank.json。
  • 设定集/世界观.md、设定集/力量体系.md、设定集/主角卡.md、设定集/反派设计.md。
  • 大纲/总纲.md、.story-system/MASTER_SETTING.json。
  • whether reference work breakdowns were used; cases where canon was not written before user confirmation.
  • Whether missing information affects subsequent /webnovel-plan。

Exception classification:

  • Automatically handled: scripts filling in directories, rerunning minimal initialization steps, regenerating missing non-content files, etc.
  • Suggested confirmation: reference breakdown quality is slightly low, candidate ideas need the user to take another look.
  • Must handle: core settings unconfirmed, project directory unsafe, key files still missing.

Next-step suggestions must use task-oriented language + copyable commands, for example:

- 接下来可以规划第一卷:
  /webnovel-plan 1

Do not write token statistics; if troubleshooting is needed, only provide the log path or suggest running /webnovel-doctor。