日期:2026-06-05 状态:草案 v1 定位:把 Webnovel Writer 从 Claude Code 专用插件演进为跨宿主、多 agent、可验证的写作插件 参考样本:Superpowers、PostHog AI Plugin、Shopify AI Toolkit、Compound Engineering、wshobson/agents
当前 Webnovel Writer 已具备一套完整的 Claude Code 插件形态:
webnovel-writer/
├── .claude-plugin/plugin.json
├── agents/
│ ├── context-agent.md
│ ├── data-agent.md
│ ├── deconstruction-agent.md
│ └── reviewer.md
├── skills/
│ ├── webnovel-init/
│ ├── webnovel-plan/
│ ├── webnovel-write/
│ ├── webnovel-review/
│ ├── webnovel-query/
│ ├── webnovel-learn/
│ └── webnovel-dashboard/
├── scripts/
├── references/
├── templates/
├── genres/
└── dashboard/
核心能力已经不是问题:
skills/ 定义写作工作流入口agents/ 承载写前组装、审查、数据提取、参考书拆解等 subagentscripts/ 负责项目初始化、Story System、索引、记忆、审查落库、Dashboard.story-system/ 与 .webnovel/ 已形成主链事实源与投影层真正的问题是:这些能力目前默认运行在 Claude Code 的插件语义里,文档和流程里存在多处 Claude Code 耦合。
当前 skills/agents 中主要耦合点:
| 类型 | 现状 | 问题 |
|---|---|---|
| 插件根路径 | 大量使用 CLAUDE_PLUGIN_ROOT |
Codex、OpenCode 等宿主使用 PLUGIN_ROOT 或不同机制 |
| 项目根路径 | 大量使用 CLAUDE_PROJECT_DIR |
非 Claude 宿主未必提供该变量 |
| 工具名 | Read / Write / Edit / Grep / Bash / Agent / AskUserQuestion |
各宿主工具名、调用语义不同 |
| subagent 调度 | 明确写 Agent(...) |
Codex、Gemini、OpenCode、Copilot 都有不同 subagent 入口 |
| slash 命令 | README 与 docs 默认 /webnovel-* |
非 Claude 宿主可能以 skill、command TOML、prompt entry 或插件命令暴露 |
| skill 体积 | 部分 SKILL.md 很长 |
Codex 等宿主对 skill body 有更严格的有效上下文预算 |
| hooks | 当前未形成跨宿主 bootstrap | 不同宿主启动注入能力差异较大 |
本 spec 解决的是多智能体适配最终形态,包含两层含义:
webnovel-context-agent、webnovel-reviewer、webnovel-data-agent、webnovel-deconstruction-agent 能在不同宿主的 agent/subagent 能力中被正确调度,能力不足时有明确降级规则;旧名只作为迁移 alias。本 spec 不只是“补几个 manifest”,而是规定最终状态下:
一套源内容,多宿主消费
skills/、agents/、scripts/、references/、templates/、dashboard/ 是唯一业务事实源。保留 Claude Code 现有体验
/webnovel-init、/webnovel-plan、/webnovel-write、/webnovel-review、/webnovel-query、/webnovel-dashboard 继续可用。Codex / Cursor / Copilot 原生插件优先
.codex-plugin/plugin.json 加载 plugin root 下的 skills/。[agents.<name>] TOML 配置注册可 spawn_agent 的写作角色。.cursor-plugin/plugin.json 加载 plugin root 下的 skills/、agents/、hooks。plugin.json 或 .github/plugin/plugin.json 加载 agents/、skills/、hooks。Gemini / OpenCode / Copilot 使用生成/同步适配
gemini-extension.json、skills/、agents/、commands/。.opencode/agents / .opencode/skills / opencode.json,JS plugin 只承担 hooks 或自定义工具。subagent 调度语义平台化
webnovel-context-agent”,不写死 Agent(...)。using-webnovel-writer 与 adapter 负责。Python runtime 可移植
CLAUDE_PLUGIN_ROOT 单一变量。有验收矩阵
webnovel-write 多 agent 链。Superpowers 的核心做法:
skills/ 是共享源.claude-plugin/、.codex-plugin/、.cursor-plugin/、gemini-extension.json 是薄适配层using-superpowers 作为 bootstrap skillreferences/*-tools.md适合 Webnovel Writer 借鉴的点:
PostHog 的核心做法:
skills 与 .mcp.json${CLAUDE_PLUGIN_ROOT:-$PLUGIN_ROOT} 兼容 Claude/Codex 环境变量.md 为源,生成 Gemini TOML适合 Webnovel Writer 借鉴的点:
Shopify 的核心做法:
skills/ + scripts + assets适合 Webnovel Writer 借鉴的点:
Compound Engineering 的核心做法:
适合 Webnovel Writer 借鉴的点:
wshobson/agents 的核心做法:
plugins/ 是唯一源tools/adapters/ 生成 Codex、Gemini、OpenCode、Copilot 等宿主产物适合 Webnovel Writer 借鉴的点:
SKILL.md 应瘦身,细节移入 references/调研日期:2026-06-05。以下只记录官方文档或官方仓库能确认的能力,不用旧版经验推断。
| 宿主 | 当前 subagent 状态 | 插件/分发状态 | 对 Webnovel Writer 的结论 |
|---|---|---|---|
| Claude Code | 原生 subagents。agents/*.md 支持 YAML frontmatter;内置 Explore、Plan、general-purpose;插件 agents/ 会被递归扫描;/agents 可管理;普通 subagent 不能再 spawn subagent,fork/agent teams 是更高级路径 |
原生 plugins 支持 skills、agents、hooks、MCP | 继续一级支持。源 agents/*.md 可以作为 Claude 原生事实源 |
| Codex CLI / App | features.multi_agent 是 stable 且默认开启;工具为 spawn_agent、send_input、resume_agent、wait_agent、close_agent;支持 agents.max_threads、agents.max_depth、agents.<name>.config_file、agents.<name>.description、agents.<name>.nickname_candidates;hooks 支持 SubagentStart / SubagentStop |
原生 .codex-plugin/plugin.json 支持 skills、hooks、MCP、apps;agent role 走 Codex TOML config 层 |
不再视为 skills-only。最终必须生成 Codex agent role config,webnovel-write 可作为 full-agent 验收目标 |
| Cursor | 原生 subagents 可在 editor、CLI、Cloud Agent 中使用;自定义 agent 文件位于 .cursor/agents/ 或 ~/.cursor/agents/;Agent 会把 custom subagents 暴露为可用工具;Cursor 2.5 起 subagent 可在具备 Task 权限时启动 child subagents |
Cursor plugins 可打包 rules、skills、agents、commands、MCP、hooks;.cursor-plugin/plugin.json 是目标分发形态 |
原生支持 full-agent。要同时提供 plugin agents path 与 .cursor/agents generated fallback |
| Gemini CLI | 原生 subagents 默认开启;显式调用用 @agent_name;custom agents 位于 .gemini/agents/*.md 或 ~/.gemini/agents/*.md;agent frontmatter 支持 name、description、tools、mcpServers、model、temperature、max_turns、timeout_mins;subagent 不能再调用 subagent;extensions 可打包 subagents |
原生 extensions 可包含 gemini-extension.json、GEMINI.md、skills、agents、commands |
确认有原生 subagent。生成 Gemini extension root,full-agent 可顺序执行,但不要设计嵌套 subagent |
| OpenCode | 原生 agents 分 primary 和 subagent;subagent 可自动调用或 @agent 调用;Markdown agents 位于 .opencode/agents/ 或 ~/.config/opencode/agents/;permission.task 控制可调用哪些 subagent |
JS/TS plugins 用于 hooks、custom tools、事件;agents/skills 走配置和原生目录 | 生成 .opencode/agents 与 opencode.json 是主路径,JS plugin 只做 bootstrap/hook/custom tool |
| GitHub Copilot CLI | 原生 custom agents;内置 Explore、Task、General-purpose、Code-review;模型可把任务委托给 subsidiary subagent process;支持 /agent、自然语言指定、copilot --agent=<name>;插件 agents 使用 .agent.md 文件,内置工具含 task、read_agent、list_agents |
原生 plugin.json 支持 agents、skills、commands、hooks、mcpServers、lspServers;manifest 可在 .plugin/、根 plugin.json、.github/plugin/、.claude-plugin/ |
不再以 Claude compatibility 为第一路径。最终生成 Copilot native plugin,Claude metadata 仅 fallback |
来源:
https://code.claude.com/docs/en/sub-agents.md、https://code.claude.com/docs/en/plugins.mdhttps://developers.openai.com/codex/config-reference、https://developers.openai.com/codex/plugins/buildhttps://cursor.com/docs/subagents、https://cursor.com/docs/pluginshttps://github.com/google-gemini/gemini-cli/blob/main/docs/core/subagents.mdhttps://opencode.ai/docs/agents/、https://opencode.ai/docs/plugins/https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-plugin-reference、https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/invoke-custom-agents以下目录是唯一业务事实源:
webnovel-writer/skills/
webnovel-writer/agents/
webnovel-writer/scripts/
webnovel-writer/references/
webnovel-writer/templates/
webnovel-writer/genres/
webnovel-writer/dashboard/
任何宿主适配产物都不得成为新的业务事实源。
禁止:
skills-codex/agents-gemini/适配层只允许处理:
适配层不得处理:
最终形态下,skill 正文应优先写动作语义:
| 不推荐 | 推荐 |
|---|---|
使用 Read 工具读取文件 |
读取文件 |
使用 Bash 运行命令 |
运行命令 |
使用 Grep 搜索 |
搜索 |
使用 Agent 工具调用 webnovel-reviewer |
调用 webnovel-reviewer subagent |
使用 AskUserQuestion 询问用户 |
向用户确认 |
Claude Code 专用工具名只允许出现在:
allowed-toolsusing-webnovel-writer/references/claude-tools.mdwebnovel-write 的核心规则不是“必须调用 Claude 的 Agent 工具”,而是:
必须把写前组装、审查、事实提取交给隔离上下文的专门 subagent,不得由主流程口头替代。
因此最终 skill 应表达为:
调用 `webnovel-context-agent` subagent 生成写作任务书。
按当前宿主的 subagent 调度方式执行;若当前宿主不支持 subagent,进入兼容模式或阻断。
平台如何执行由 tool mapping 决定。
最终形态下,每个 SKILL.md 应成为入口与导航,不应承载完整长篇协议。
目标结构:
skills/webnovel-write/
├── SKILL.md # 入口、决策树、步骤摘要、引用加载策略
└── references/
├── protocol.md # 完整写章协议
├── agent-contracts.md # context/reviewer/data-agent 输入输出契约
├── failure-recovery.md # 失败补跑与恢复
└── ...
SKILL.md 推荐控制在 8 KB 以内;长内容进入 references/。
不同宿主能力不一致。最终形态不假装能力一致。
| 场景 | 处理 |
|---|---|
| 宿主支持 subagent | 正常多 agent 链 |
| 宿主不支持 subagent,但用户只查询/学习/启动 dashboard | 正常执行 |
宿主不支持 subagent,用户要 webnovel-write |
默认阻断,提示需要支持 subagent 的宿主;允许显式 --single-agent 兼容模式 |
| 宿主不支持 hooks | 不依赖 hooks 自动注入;通过 context file / command / skill 入口加载 |
| 宿主不支持 slash command | 暴露为 skill 或 command TOML |
最终仓库根目录:
.
├── .claude-plugin/
│ └── marketplace.json
├── .cursor-plugin/
│ └── marketplace.json
├── .agents/
│ └── plugins/
│ └── marketplace.json # Codex marketplace registry,可选
├── docs/
├── scripts/
│ └── generate_harness_artifacts.py # 新增:生成宿主产物
├── tests/
│ └── harness/
│ ├── test_manifests.py
│ ├── test_portability.py
│ └── test_generated_artifacts.py
├── webnovel-writer/
└── README.md
说明:
.codex-plugin/plugin.json。scripts/,避免混入插件 runtime scripts。最终 plugin root 仍然是:
webnovel-writer/
最终结构:
webnovel-writer/
├── .claude-plugin/
│ └── plugin.json
├── .codex-plugin/
│ └── plugin.json
├── .cursor-plugin/
│ └── plugin.json
├── .opencode/
│ └── plugins/
│ └── webnovel-writer.js
├── hooks/
│ ├── hooks.json
│ ├── hooks-cursor.json
│ ├── run-hook.cmd
│ └── session-start
├── skills/
│ ├── using-webnovel-writer/
│ │ ├── SKILL.md
│ │ └── references/
│ │ ├── claude-tools.md
│ │ ├── codex-tools.md
│ │ ├── cursor-tools.md
│ │ ├── gemini-tools.md
│ │ ├── opencode-tools.md
│ │ └── copilot-tools.md
│ ├── webnovel-init/
│ ├── webnovel-plan/
│ ├── webnovel-write/
│ ├── webnovel-review/
│ ├── webnovel-query/
│ ├── webnovel-learn/
│ └── webnovel-dashboard/
├── agents/
│ ├── webnovel-context-agent.md
│ ├── webnovel-data-agent.md
│ ├── webnovel-deconstruction-agent.md
│ └── webnovel-reviewer.md
├── scripts/
├── references/
├── templates/
├── genres/
├── dashboard/
├── AGENTS.md
├── CLAUDE.md
├── GEMINI.md
└── README.md
当前 agent 名称:
context-agent
data-agent
deconstruction-agent
reviewer
最终建议改为插件作用域名称:
webnovel-context-agent
webnovel-data-agent
webnovel-deconstruction-agent
webnovel-reviewer
原因:
reviewer、context-agent 冲突兼容策略:
Claude Code 继续作为一级支持宿主。
源文件:
.claude-plugin/marketplace.json
webnovel-writer/.claude-plugin/plugin.json
webnovel-writer/skills/
webnovel-writer/agents/
webnovel-writer/hooks/hooks.json
安装:
claude plugin marketplace add lingfengQAQ/webnovel-writer --scope user
claude plugin install webnovel-writer@webnovel-writer-marketplace --scope user
要求:
allowed-tools frontmatter 可保留。Agent 工具由 Claude Code 原生处理。hooks/session-start 注入短 bootstrap。Codex 使用原生 plugin manifest。
新增:
webnovel-writer/.codex-plugin/plugin.json
最小 manifest:
{
"name": "webnovel-writer",
"version": "6.0.0",
"description": "Long-form Chinese webnovel writing system with skills, agents, story state, RAG, and review workflows.",
"author": { "name": "lingfengQAQ" },
"homepage": "https://github.com/lingfengQAQ/webnovel-writer",
"repository": "https://github.com/lingfengQAQ/webnovel-writer",
"license": "GPL-3.0",
"keywords": ["webnovel", "writing", "skills", "agents", "rag"],
"skills": "./skills/",
"hooks": "./hooks/hooks.json",
"interface": {
"displayName": "Webnovel Writer",
"shortDescription": "Long-form webnovel planning, writing, review, and story-state workflows",
"longDescription": "Plan, write, review, query, and maintain long-form Chinese webnovel projects with story state, memory, RAG, and agent workflows.",
"developerName": "lingfengQAQ",
"category": "Writing",
"capabilities": ["Interactive", "Read", "Write"],
"defaultPrompt": [
"初始化一个新的网文项目",
"写下一章并更新故事状态",
"查询当前项目里的角色和伏笔状态"
]
}
}
Codex 支持级别:
| 能力 | 方式 |
|---|---|
| skills | 原生 .codex-plugin/plugin.json 指向 ./skills/ |
| hooks | 可选;用户需信任 hook |
| agents | 通过 [agents.<name>] TOML 注册可 spawn_agent 的角色 |
| commands | 不单独维护;需要时由 skills 或 generated command-skill 暴露 |
| tool mapping | using-webnovel-writer/references/codex-tools.md |
Codex agent 配置由 adapter 生成,提交源模板,不手写分叉业务文档。
推荐生成:
config/codex/webnovel-writer-agents.toml
config/codex/agents/
├── webnovel-context-agent.toml
├── webnovel-data-agent.toml
├── webnovel-deconstruction-agent.toml
└── webnovel-reviewer.toml
示例:
[features]
multi_agent = true
[agents]
max_threads = 6
max_depth = 1
[agents.webnovel-context-agent]
description = "Assemble chapter writing briefs from outline, contracts, memory, and review feedback."
config_file = "agents/webnovel-context-agent.toml"
nickname_candidates = ["Context"]
[agents.webnovel-reviewer]
description = "Review drafted chapters and return structured blocking/non-blocking issues."
config_file = "agents/webnovel-reviewer.toml"
nickname_candidates = ["Reviewer"]
Codex 多 agent 要求:
features.multi_agent 是稳定能力,默认开启。spawn_agent、send_input、resume_agent、wait_agent、close_agent。webnovel-write 需要当前环境未禁用 multi-agent,且 agents.max_depth / agents.max_threads 足以顺序调用三个写作 subagent。webnovel-query、webnovel-learn、webnovel-dashboard 可执行webnovel-review 可进入单 reviewer prompt 兼容模式webnovel-write 默认阻断,除非用户显式选择 --single-agentCursor 使用 Cursor plugin manifest。
新增:
.cursor-plugin/marketplace.json
webnovel-writer/.cursor-plugin/plugin.json
webnovel-writer/hooks/hooks-cursor.json
Cursor plugin manifest:
{
"name": "webnovel-writer",
"displayName": "Webnovel Writer",
"description": "长篇网文创作系统(skills + agents + data chain + RAG)",
"version": "6.0.0",
"author": { "name": "lingfengQAQ" },
"homepage": "https://github.com/lingfengQAQ/webnovel-writer",
"repository": "https://github.com/lingfengQAQ/webnovel-writer",
"license": "GPL-3.0",
"keywords": ["webnovel", "cursor", "skills", "agents", "rag"],
"skills": "./skills/",
"agents": "./agents/",
"hooks": "./hooks/hooks-cursor.json"
}
要求:
skills/ 与 agents/,不生成复制目录。additional_context。/add-plugin webnovel-writer。Gemini CLI 最终采用生成 extension root 方式,不直接把仓库根当 Gemini extension 根。
原因:
gemini-extension.json 与 GEMINI.md 在 extension root。agents/。webnovel-write 必须由主流程顺序调度 webnovel-context-agent、webnovel-reviewer、webnovel-data-agent,不得设计嵌套 agent 树。生成产物:
dist/gemini/webnovel-writer/
├── gemini-extension.json
├── GEMINI.md
├── skills/
│ ├── webnovel-writer__using-webnovel-writer/
│ ├── webnovel-writer__webnovel-init/
│ ├── webnovel-writer__webnovel-plan/
│ ├── webnovel-writer__webnovel-write/
│ ├── webnovel-writer__webnovel-review/
│ ├── webnovel-writer__webnovel-query/
│ ├── webnovel-writer__webnovel-learn/
│ └── webnovel-writer__webnovel-dashboard/
├── agents/
│ ├── webnovel-writer__webnovel-context-agent.md
│ ├── webnovel-writer__webnovel-data-agent.md
│ ├── webnovel-writer__webnovel-deconstruction-agent.md
│ └── webnovel-writer__webnovel-reviewer.md
├── commands/
│ ├── webnovel-init.toml
│ ├── webnovel-plan.toml
│ ├── webnovel-write.toml
│ ├── webnovel-review.toml
│ ├── webnovel-query.toml
│ ├── webnovel-learn.toml
│ └── webnovel-dashboard.toml
├── scripts/
├── references/
├── templates/
├── genres/
└── dashboard/
gemini-extension.json:
{
"name": "webnovel-writer",
"description": "Long-form Chinese webnovel writing system.",
"version": "6.0.0",
"contextFileName": "GEMINI.md"
}
Gemini tool mapping:
| 源语义 | Gemini |
|---|---|
| 读取文件 | read_file |
| 写入文件 | write_file |
| 编辑文件 | replace |
| 搜索 | grep_search |
| 运行命令 | run_shell_command |
| 向用户确认 | ask_user 或直接提问 |
| 调用 subagent | @webnovel-writer__agent-name |
OpenCode 使用原生 .opencode/agents / .opencode/skills / opencode.json 作为主路径,JS/TS plugin 只用于 hooks、custom tools、事件监听或 bootstrap。
新增:
webnovel-writer/.opencode/plugins/webnovel-writer.js
最终行为:
.opencode/ 或安装目录。mode: subagent。opencode.json 或 Markdown frontmatter 配置 permission.task,控制 primary agent 能调用哪些 subagent。生成产物:
dist/opencode/webnovel-writer/
├── .opencode/
│ ├── plugins/
│ │ └── webnovel-writer.js
│ ├── skills/
│ ├── agents/
│ │ ├── webnovel-context-agent.md
│ │ ├── webnovel-data-agent.md
│ │ ├── webnovel-deconstruction-agent.md
│ │ └── webnovel-reviewer.md
│ └── commands/
└── opencode.json
示例 agent frontmatter:
---
description: Assemble chapter writing briefs from outline, contracts, memory, and review feedback.
mode: subagent
permission:
read: allow
grep: allow
bash:
"python*": allow
edit: deny
---
OpenCode tool mapping:
| 源语义 | OpenCode |
|---|---|
| 读取文件 | read |
| 写入文件 | write |
| 编辑文件 | edit |
| 搜索 | grep |
| 运行命令 | bash |
| 任务跟踪 | todowrite |
| 调用 subagent | task 或 @agent |
Copilot CLI 使用原生 plugin manifest 和原生 custom agents。Claude plugin compatibility 只作为旧版本 fallback,不作为第一路径。
原生 manifest 可以位于 plugin root plugin.json,也可以放在 .github/plugin/plugin.json。为避免和 Claude/Codex/Cursor manifest 混杂,Webnovel Writer 推荐由 adapter 生成 Copilot dist。
最终生成产物:
dist/copilot/webnovel-writer/
├── plugin.json
├── agents/
│ ├── webnovel-context-agent.agent.md
│ ├── webnovel-data-agent.agent.md
│ ├── webnovel-deconstruction-agent.agent.md
│ └── webnovel-reviewer.agent.md
├── skills/
├── commands/
└── hooks/
支持策略:
plugin.json 声明 agents、skills、commands、hooks,默认目录即可时可省略路径字段。*.agent.md 文件,文件名决定 agent ID;必须带 webnovel- 前缀,避免和 Copilot 内置 explore、task、code-review、general-purpose 冲突。task tool;需要读取 agent 定义时使用 read_agent,需要枚举时使用 list_agents。.claude-plugin/plugin.json,adapter 可生成 compatibility manifest,但必须标记为 fallback。~/.agents/skills,避免 shadowing 其他宿主插件。这两类宿主如果已支持 Claude Code plugin compatibility,则使用 Claude plugin metadata 作为第一路径。
策略:
新增:
skills/using-webnovel-writer/SKILL.md
职责:
webnovel-* skill。不职责:
新增:
hooks/session-start
hooks/run-hook.cmd
hooks/hooks.json
hooks/hooks-cursor.json
注入内容应短,不应把完整系统文档灌进上下文。
推荐注入:
<important>
Webnovel Writer is installed.
When the user asks to initialize, plan, write, review, query, learn from, or inspect a Chinese webnovel project, load the relevant webnovel-* skill.
For platform-specific tool and subagent mappings, load using-webnovel-writer.
</important>
Claude / Cursor / Codex hook 输出格式按宿主区分:
| 宿主 | 输出字段 |
|---|---|
| Claude Code | hookSpecificOutput.additionalContext |
| Cursor | additional_context |
| Codex / SDK 标准 | additionalContext |
hooks 只负责启动提示,不作为唯一入口。Gemini/OpenCode/Copilot 不能依赖 hooks 存在。
最终新增:
webnovel-writer/AGENTS.md
webnovel-writer/CLAUDE.md
webnovel-writer/GEMINI.md
职责:
skills/using-webnovel-writer/。GEMINI.md 应引用:
@./skills/using-webnovel-writer/SKILL.md
@./skills/using-webnovel-writer/references/gemini-tools.md
最终所有 skill bash 片段必须使用统一变量:
export WEBNOVEL_PLUGIN_ROOT="${WEBNOVEL_PLUGIN_ROOT:-${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-}}}"
export WORKSPACE_ROOT="${WORKSPACE_ROOT:-${CLAUDE_PROJECT_DIR:-$PWD}}"
if [ -z "${WEBNOVEL_PLUGIN_ROOT}" ] || [ ! -d "${WEBNOVEL_PLUGIN_ROOT}/scripts" ]; then
echo "ERROR: 未找到 Webnovel Writer 插件根目录" >&2
exit 1
fi
export SCRIPTS_DIR="${WEBNOVEL_PLUGIN_ROOT}/scripts"
export PROJECT_ROOT="$(python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${WORKSPACE_ROOT}" where)"
禁止在新增文档中继续直接使用:
${CLAUDE_PLUGIN_ROOT}/scripts
除非是在兼容说明或历史迁移章节。
最终应扩展或新增:
webnovel-writer/scripts/runtime_compat.py
职责:
建议 CLI:
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" runtime-info --format json
输出:
{
"plugin_root": ".../webnovel-writer",
"workspace_root": "...",
"project_root": "...",
"scripts_dir": ".../webnovel-writer/scripts",
"dashboard_dir": ".../webnovel-writer/dashboard",
"platform_env": {
"PLUGIN_ROOT": true,
"CLAUDE_PLUGIN_ROOT": false,
"CLAUDE_PROJECT_DIR": false
}
}
跨宿主不改变 Python 依赖策略:
python -m pip install -r requirements.txt
但 skill 中必须把“安装依赖”写成可重复、可失败恢复的步骤:
每个 skill 最终结构:
skills/<skill-name>/
├── SKILL.md
├── references/
│ ├── protocol.md
│ ├── failure-recovery.md
│ └── ...
├── scripts/ # 仅 skill 私有脚本,公共脚本仍放 plugin scripts/
└── assets/ # 可选
SKILL.md 必须包含:
SKILL.md 不应包含:
Claude 源 frontmatter 可保留:
---
name: webnovel-write
description: Use when writing a publishable webnovel chapter from an existing project outline and story runtime.
allowed-tools: Read Write Edit Grep Bash Agent
---
要求:
description 必须包含明确触发条件。allowed-tools 视为 Claude-only 字段;adapter 对 Codex/Gemini/OpenCode 可剥离或映射。webnovel-write 是多 agent 适配核心。
最终正文不应写:
必须使用 `Agent` 工具调用 `webnovel-context-agent`
应写:
必须调用 `webnovel-context-agent` subagent 生成写作任务书。
按当前宿主的 subagent 调度方式执行;如果当前宿主不支持 subagent,见 `using-webnovel-writer` 的降级策略。
Agent(...) 示例移入:
skills/using-webnovel-writer/references/claude-tools.md
webnovel-review 最终应支持两种模式:
| 模式 | 条件 | 行为 |
|---|---|---|
| full-agent | 宿主支持 subagent | 调用 webnovel-reviewer,主流程只落库和汇总 |
| compatibility | 宿主不支持 subagent | 主流程临时扮演 reviewer,但必须输出同一 JSON schema,并在报告中标记兼容模式 |
兼容模式只允许用于 review,不允许替代 webnovel-write 的完整多 agent 链。
webnovel-init 涉及 webnovel-deconstruction-agent、用户确认、Web 搜索/网页抓取。
最终要求:
AskUserQuestion。webnovel-deconstruction-agent subagent”。Dashboard 是最易跨宿主的 skill。
最终要求:
WEBNOVEL_PLUGIN_ROOT。源 agent 继续使用 Markdown + YAML frontmatter:
---
name: webnovel-context-agent
description: Use before chapter drafting to assemble a writing brief from outline, contracts, memory, and review feedback.
tools: Read, Grep, Bash
model: inherit
---
正文写:
不写:
Agent(...) 调用样例四个核心 agent 的输出契约必须稳定。
| Agent | 输出 |
|---|---|
webnovel-context-agent |
五段式写作任务书 |
webnovel-reviewer |
严格 JSON issues 列表 |
webnovel-data-agent |
fulfillment_result.json、disambiguation_result.json、extraction_result.json 所需内容 |
webnovel-deconstruction-agent |
严格 init_reference_research JSON |
这些输出契约写入:
skills/webnovel-write/references/agent-contracts.md
skills/webnovel-init/references/agent-contracts.md
skills/webnovel-review/references/agent-contracts.md
Agent adapter 负责把源 agent 转为宿主格式。
| 宿主 | 输出 |
|---|---|
| Claude Code | agents/*.md 原样 |
| Cursor | plugin root agents/*.md 原样;同时可生成 .cursor/agents/<agent>.md fallback |
| Codex | config/codex/webnovel-writer-agents.toml 与 config/codex/agents/<agent>.toml,内容可合并进受信任项目的 .codex/config.toml |
| Gemini | dist/gemini/webnovel-writer/agents/webnovel-writer__<agent>.md,工具名映射,禁止嵌套 subagent |
| OpenCode | dist/opencode/webnovel-writer/.opencode/agents/<agent>.md,mode: subagent 与 permission.task 映射 |
| Copilot | dist/copilot/webnovel-writer/agents/<agent>.agent.md |
源 agent 使用:
model: inherit
不在源 agent 中写 sonnet、opus、haiku 作为强要求。
需要高能力模型的场景写在正文:
该 agent 需要较强推理能力;若宿主支持选择模型,优先使用当前可用的高能力模型。
新增:
scripts/generate_harness_artifacts.py
命令:
python -X utf8 scripts/generate_harness_artifacts.py --target codex
python -X utf8 scripts/generate_harness_artifacts.py --target gemini
python -X utf8 scripts/generate_harness_artifacts.py --target opencode
python -X utf8 scripts/generate_harness_artifacts.py --target copilot
python -X utf8 scripts/generate_harness_artifacts.py --target all
python -X utf8 scripts/generate_harness_artifacts.py --check
生成器负责:
生成器不负责:
生成产物统一进入:
dist/<harness>/webnovel-writer/
dist/ 默认 gitignored。
需要提交的只有:
例外:
.codex-plugin/plugin.json.cursor-plugin/plugin.json这些小型原生 manifest 可以提交。
CI 必须运行:
python -X utf8 scripts/generate_harness_artifacts.py --target all
python -X utf8 scripts/generate_harness_artifacts.py --check
若生成产物与提交的 manifest/registry 不一致,CI 失败。
新增:
skills/using-webnovel-writer/references/
├── claude-tools.md
├── codex-tools.md
├── cursor-tools.md
├── gemini-tools.md
├── opencode-tools.md
└── copilot-tools.md
| 源语义 | Claude | Codex | Gemini | OpenCode | Copilot |
|---|---|---|---|---|---|
| 读取文件 | Read |
native read | read_file |
read |
view |
| 写文件 | Write |
native write | write_file |
write |
create |
| 编辑文件 | Edit |
native edit | replace |
edit |
edit |
| 搜索文本 | Grep |
native search | grep_search |
grep |
grep |
| 运行命令 | Bash |
shell command | run_shell_command |
bash |
bash |
| 网页搜索 | WebSearch |
web search if enabled | google_web_search |
web search if enabled | no guaranteed equivalent |
| 抓取网页 | WebFetch |
web fetch if enabled | web_fetch |
web fetch if enabled | web_fetch |
| 询问用户 | AskUserQuestion / direct |
direct / structured input if available | ask_user |
direct | direct |
| 调用 subagent | Agent / Task |
spawn_agent + send_input + resume_agent + wait_agent + close_agent |
@agent |
task / @agent,受 permission.task 控制 |
task |
| 读取/枚举 agent | /agents |
[agents.<name>] config |
.gemini/agents / extension agents/ |
.opencode/agents |
read_agent / list_agents |
| 任务跟踪 | TodoWrite |
plan/update if available | write_todos if available |
todowrite |
todos/sql if available |
新增或修改 skill 时:
rg、python、git 这类 shell 命令可以直接写。最终 webnovel-write 编排:
主流程
1. 解析环境与项目根
2. preflight
3. placeholder-scan
4. 刷新 Story System runtime contracts
5. 调用 webnovel-context-agent
-> 输出五段式写作任务书
6. 主流程根据任务书起草正文
7. 调用 webnovel-reviewer
-> 输出 review_results.json
8. blocking issue 修复循环
9. 润色与排版
10. 调用 webnovel-data-agent
-> 输出 commit artifacts
11. chapter-commit
12. backup
核心不变:
webnovel-context-agent 负责写前 research 与任务书。webnovel-reviewer 负责可验证问题。webnovel-data-agent 负责事实提取与 artifacts。完整写章链要求:
webnovel-context-agent、webnovel-reviewer、webnovel-data-agent 三个角色完成各自任务。不要求:
宿主差异必须在 adapter 与验收中显式处理:
| 宿主 | 约束 |
|---|---|
| Claude Code | 普通 subagent 不再 spawn subagent;webnovel-write 必须由主流程顺序调度 |
| Codex | 受 features.multi_agent、agents.max_depth、agents.max_threads 限制;默认 depth=1 足够主流程调一级 subagent |
| Cursor | Cursor 2.5 起 child subagent 需要 Task 权限;Webnovel Writer 默认仍按一级顺序调度 |
| Gemini | subagent 不能调用 subagent;只允许主流程显式 @agent 顺序调用 |
| OpenCode | primary/subagent 调用由 permission.task 控制;adapter 必须生成允许列表 |
| Copilot | 通过 task 委托,必要时用 read_agent / list_agents 确认 agent 可见 |
为低能力宿主预留 --single-agent,但默认不启用。
允许场景:
禁止场景:
/webnovel-write 自动降级。兼容模式输出必须标记:
{
"compatibility_mode": "single-agent",
"missing_capability": "subagent",
"requires_manual_review": true
}
当前 sync_plugin_version.py 需要扩展,覆盖:
webnovel-writer/.claude-plugin/plugin.json
webnovel-writer/.codex-plugin/plugin.json
webnovel-writer/.cursor-plugin/plugin.json
.claude-plugin/marketplace.json
.cursor-plugin/marketplace.json
README.md
dist manifest templates
命令保持:
python -X utf8 webnovel-writer/scripts/sync_plugin_version.py --version X.Y.Z --release-notes "..."
新增:
docs/operations/multi-harness-release.md
docs/guides/install-codex.md
docs/guides/install-cursor.md
docs/guides/install-gemini.md
docs/guides/install-opencode.md
docs/guides/install-copilot.md
README 快速开始保留 Claude Code 作为推荐路径,但增加:
其他宿主安装:Codex / Cursor / Gemini CLI / OpenCode / Copilot
优先级:
.codex-plugin/plugin.json,后续申请目录。.cursor-plugin marketplace。新增测试:
tests/harness/test_manifest_validity.py
tests/harness/test_skill_frontmatter.py
tests/harness/test_agent_frontmatter.py
tests/harness/test_portability_lint.py
tests/harness/test_generated_artifacts.py
检查:
SKILL.md 有 name / description。name / description / model。CLAUDE_PLUGIN_ROOT。SKILL.md 超过阈值时必须有 references/。新增:
python -X utf8 webnovel-writer/scripts/webnovel.py runtime-info --format json
python -X utf8 webnovel-writer/scripts/webnovel.py --project-root <fixture> preflight --format json
python -X utf8 webnovel-writer/scripts/webnovel.py --project-root <fixture> where
| 宿主 | 最低验收 |
|---|---|
| Claude Code | 安装插件;/webnovel-query 查询 fixture;/webnovel-review 审查 fixture;/webnovel-dashboard 启动 |
| Codex | plugin 可读;skills 可列出;[agents.webnovel-reviewer] 可加载;webnovel-query fixture 通过;webnovel-review 通过 spawn_agent full-agent 路径或明确 compatibility fallback |
| Cursor | plugin 可安装;skills/agents 可发现;.cursor/agents fallback 可生成;webnovel-query 与 webnovel-review 通过 |
| Gemini | 生成 extension;gemini extensions install <dist> 成功;extension agents/ 可发现;@webnovel-writer__webnovel-reviewer 或 command smoke 通过 |
| OpenCode | 生成 .opencode/agents / .opencode/skills / opencode.json;mode: subagent agent 可发现;permission.task 允许调用 reviewer;webnovel-dashboard 或 query 通过 |
| Copilot | 生成 native plugin.json 与 agents/*.agent.md;list_agents 可见;read_agent webnovel-reviewer 成功;query 或 review smoke 通过 |
完整写章验收只要求在支持 subagent 的宿主上通过。非 Claude 里优先选择 Codex 或 Cursor 做第一条 full-agent 绿线,再扩展到 Gemini/OpenCode/Copilot。
输入:
使用 Webnovel Writer 写第 4 章。项目在 agents/evals/files/test-project/。
通过条件:
webnovel-context-agent。webnovel-reviewer。review_results.json 存在且合法。webnovel-data-agent。chapter-commit 成功。在不支持 subagent 的宿主:
输入:
使用 Webnovel Writer 审查第 4 章。项目在 agents/evals/files/test-project/。
通过条件:
目标:不改变业务流程,先让 Codex/Cursor/Copilot 能发现 plugin,并让 Codex 具备 agent role 配置基线。
改动:
.codex-plugin/plugin.json.cursor-plugin/plugin.json.cursor-plugin/marketplace.json[agents.<name>] role config 模板hooks/session-startusing-webnovel-writerWEBNOVEL_PLUGIN_ROOT验收:
webnovel-reviewer agent role。目标:让 skills 成为跨宿主入口。
改动:
SKILL.md 到 references/protocol.mdRead tool / Bash tool / Agent toolAgent(...) 示例移入 claude-tools.mdcodex-tools.md、gemini-tools.md、opencode-tools.md验收:
目标:agent 名称全局唯一,调度语义平台化。
改动:
context-agent -> webnovel-context-agentdata-agent -> webnovel-data-agentdeconstruction-agent -> webnovel-deconstruction-agentreviewer -> webnovel-reviewer验收:
目标:生成宿主原生产物。
改动:
scripts/generate_harness_artifacts.py.opencode/agents、.opencode/skills、opencode.jsonplugin.json、agents/*.agent.md、skills/、commands/验收:
--target all 成功。目标:用真实宿主跑通核心任务。
验收顺序:
spawn_agent。| 风险 | 影响 | 缓解 |
|---|---|---|
| skill 过长导致宿主截断 | Codex/Gemini 行为不稳定 | SKILL.md 瘦身,references 渐进加载 |
| agent 调度语义不一致 | webnovel-write 链路断裂 |
平台 tool mapping + adapter + compatibility mode |
| hooks 需要用户信任 | bootstrap 不一定生效 | 不依赖 hooks 作为唯一入口 |
| plugin root 嵌套 | Gemini/OpenCode 安装复杂 | 生成 dist extension root |
| Python 依赖缺失 | scripts 失败 | preflight 明确诊断 |
| RAG API key 缺失 | init/write 部分能力不可用 | 按功能阻断,不影响 query/dashboard |
| 多份 manifest 版本漂移 | 发布混乱 | 扩展 version sync + CI |
| 旧 agent 名 shadowing | 调用错误 agent | 命名空间化 + alias 迁移 |
webnovel-write 默认不在无 subagent 宿主自动降级。webnovel-review 可以有 compatibility mode。webnovel- 前缀。CLAUDE_PLUGIN_ROOT 不再作为新文档主变量。最终完成时,必须满足:
skills/。webnovel-context-agent / webnovel-reviewer / webnovel-data-agent。skills/ / agents/。.cursor/agents fallback 可生成。agents/,且不生成嵌套 subagent 依赖。.opencode/agents、.opencode/skills、opencode.json,JS plugin 只作可选 hook/bootstrap。plugin.json 与 agents/*.agent.md。using-webnovel-writer 存在并包含所有宿主 tool mapping。WEBNOVEL_PLUGIN_ROOT 兼容变量。webnovel- 前缀。本 spec 完成后,可以继续评估:
webnovel.py 暴露为 MCP server。这些都不是本 spec 的前置条件。