Bläddra i källkod

docs: update README for v0.4 — spinoff writing, style cloning, post-write validator

Bump version to 0.4.0. Add v0.4 update section (zh + en) covering:
- Spinoff writing with canon import and 4 audit dimensions
- Style cloning from real novels (statistical + LLM guide)
- Post-write validator (11 deterministic rules + auto spot-fix)
- Audit-revise loop hardening (spot-fix default, AI marker guard, temp lock)
- Dimension count 26→32, scheduler rewrite, web search for auditor

Update roadmap, command table, project structure, and revise mode list.
majx_mac 8 månader sedan
förälder
incheckning
937d5b4866
5 ändrade filer med 174 tillägg och 16 borttagningar
  1. 79 5
      README.en.md
  2. 92 8
      README.md
  3. 1 1
      package.json
  4. 1 1
      packages/cli/package.json
  5. 1 1
      packages/core/package.json

+ 79 - 5
README.en.md

@@ -20,6 +20,75 @@
 
 
 Open-source multi-agent system that autonomously writes, audits, and revises novels — with human review gates that keep you in control.
 Open-source multi-agent system that autonomously writes, audits, and revises novels — with human review gates that keep you in control.
 
 
+## v0.4 Update
+
+Spinoff writing + style cloning + post-write validator + audit-revise hardening.
+
+### Spinoff Writing
+
+Create prequels, sequels, side-stories, or what-if branches from existing books. Spinoffs share the parent's world and characters but have independent plot lines.
+
+```bash
+inkos import canon my-prequel --from main-novel   # Import parent canon
+inkos write next my-prequel                        # Writer auto-reads canon constraints
+```
+
+Generates `story/parent_canon.md` containing the parent's world rules, character snapshots (with information boundaries), key event timeline, and foreshadowing state. The auditor auto-activates 4 spinoff-specific dimensions:
+
+| Dimension | Checks |
+|-----------|--------|
+| Canon Event Conflict | Whether spinoff events contradict the parent's canon constraints |
+| Future Info Leak | Whether characters reference information revealed after the divergence point |
+| Cross-Book World Consistency | Whether the spinoff violates parent world rules (power systems, geography, factions) |
+| Spinoff Foreshadowing Isolation | Whether the spinoff oversteps by resolving parent foreshadowing |
+
+Auto-activates when `parent_canon.md` is detected. No extra configuration needed.
+
+### Style Cloning
+
+Feed in a real novel excerpt. The system extracts a statistical fingerprint + generates a qualitative style guide, then injects both into every chapter's Writer prompt.
+
+```bash
+inkos style analyze reference.txt                      # Analyze: sentence length, TTR, rhetorical features
+inkos style import reference.txt my-book --name "Author"  # Import style into book
+```
+
+Produces two files:
+- `style_profile.json` — statistical fingerprint (sentence/paragraph length distribution, vocabulary diversity, rhetorical density)
+- `style_guide.md` — LLM-generated qualitative guide (rhythm, tone, word preferences, taboos)
+
+The Writer reads the style guide every chapter; the Auditor cross-checks against it in the style dimension.
+
+### Post-Write Validator
+
+11 deterministic rules, zero LLM cost, fires immediately after each chapter:
+
+- Banned sentence patterns, dash prohibition, transition word density limits
+- High-fatigue word caps, meta-narration detection, report terminology in prose
+- Author sermonizing, collective shock cliches, consecutive "le" (了) character runs
+- Paragraph length checks (mobile-reading friendly), book-level prohibitions
+
+When the validator finds error-level violations, it auto-triggers `spot-fix` mode for targeted repair before the LLM audit even runs.
+
+### Audit-Revise Loop Hardening
+
+Real testing showed `rewrite` mode introduces 6x more AI markers than the original text. Now:
+
+- Auto-revise mode changed from `rewrite` to `spot-fix` (only fixes flagged sentences, leaves everything else untouched)
+- Post-revise AI marker guard: if revision increases AI tell count, the revision is discarded
+- Re-audit temperature locked to 0 (deterministic pass/fail gating)
+- `polish` mode boundaries strengthened (no adding paragraphs, renaming entities, or changing causality)
+
+### Other v0.4 Changes
+
+- Audit dimensions expanded from 26 to 32 (+4 spinoff dims + sensitive word check + reader expectation management)
+- Auditor web search: era-research genres can call DuckDuckGo to verify real events/people/geography
+- Scheduler rewrite: AI-paced (15min cycles), parallel book processing, immediate retry, daily cap
+- New `spot-fix` revise mode (targeted repair)
+- `additionalAuditDimensions` in `book_rules.md` now supports name-string matching
+
+---
+
 ## v0.3 Update
 ## v0.3 Update
 
 
 Three-layer rule separation + cross-chapter memory + AIGC detection + Webhook.
 Three-layer rule separation + cross-chapter memory + AIGC detection + Webhook.
@@ -112,13 +181,13 @@ fatigueWordsOverride: ["pupils constricted", "disbelief"]   # Override genre def
 
 
 Protagonist personality lock, numerical caps, custom prohibitions, fatigue word overrides — each book's rules are independent, without affecting the genre template.
 Protagonist personality lock, numerical caps, custom prohibitions, fatigue word overrides — each book's rules are independent, without affecting the genre template.
 
 
-### 26-Dimension Audit
+### 32-Dimension Audit
 
 
-Auditing is broken down into 26 dimensions, with genre-appropriate subsets auto-enabled:
+Auditing is broken down into 32 dimensions, with genre-appropriate subsets auto-enabled:
 
 
 OOC check, timeline, setting conflicts, foreshadowing, pacing, writing style, information leaking, vocabulary fatigue, broken interest chains, side character intelligence drops, side character tool-ification, hollow payoffs, dialogue authenticity, padding detection, knowledge base contamination, POV consistency, power scaling collapse, numerical verification, era research, paragraph uniformity, hedge word density, formulaic transitions, list-like structure, subplot stagnation, flat emotional arc, monotonous pacing
 OOC check, timeline, setting conflicts, foreshadowing, pacing, writing style, information leaking, vocabulary fatigue, broken interest chains, side character intelligence drops, side character tool-ification, hollow payoffs, dialogue authenticity, padding detection, knowledge base contamination, POV consistency, power scaling collapse, numerical verification, era research, paragraph uniformity, hedge word density, formulaic transitions, list-like structure, subplot stagnation, flat emotional arc, monotonous pacing
 
 
-Xuanhuan/Xianxia: all 26 dimensions. Urban: 24 dimensions (including era research). Horror: 22 dimensions. Dims 20-23 (AI-tell detection) use a pure rule engine — no LLM calls consumed.
+Dims 20-23 (AI-tell detection) + dim 27 (sensitive words) use a pure rule engine — no LLM calls. Dims 28-31 (spinoff) auto-activate when `parent_canon.md` is detected. Dim 32 (reader expectation management) is always on.
 
 
 ### De-AI-ification
 ### De-AI-ification
 
 
@@ -135,7 +204,7 @@ Vocabulary fatigue audit + AI-tell audit (dims 20-23) provide dual detection. St
 ### Other
 ### Other
 
 
 - Supports OpenAI + Anthropic native + all OpenAI-compatible endpoints
 - Supports OpenAI + Anthropic native + all OpenAI-compatible endpoints
-- Reviser supports polish / rewrite / rework / anti-detect modes
+- Reviser supports polish / rewrite / rework / anti-detect / spot-fix modes
 - Genres without numerical systems skip resource ledger generation
 - Genres without numerical systems skip resource ledger generation
 - All commands support `--json` structured output for OpenClaw / external agent integration
 - All commands support `--json` structured output for OpenClaw / external agent integration
 - Auto-detect book-id when project has only one book
 - Auto-detect book-id when project has only one book
@@ -317,6 +386,7 @@ inkos up                          # Daemon mode
 | `inkos detect [id] [n]` | AIGC detection (`--all` for all chapters, `--stats` for statistics) |
 | `inkos detect [id] [n]` | AIGC detection (`--all` for all chapters, `--stats` for statistics) |
 | `inkos style analyze <file>` | Analyze reference text to extract style fingerprint |
 | `inkos style analyze <file>` | Analyze reference text to extract style fingerprint |
 | `inkos style import <file> [id]` | Import style fingerprint into a book |
 | `inkos style import <file> [id]` | Import style fingerprint into a book |
+| `inkos import canon [id] --from <parent>` | Import parent canon for spinoff writing |
 | `inkos update` | Update to latest version |
 | `inkos update` | Update to latest version |
 | `inkos up / down` | Start/stop daemon |
 | `inkos up / down` | Start/stop daemon |
 
 
@@ -385,8 +455,12 @@ TypeScript monorepo managed with pnpm workspaces.
 - [x] Pluggable radar (RadarSource interface)
 - [x] Pluggable radar (RadarSource interface)
 - [x] External agent integration (OpenClaw, etc.)
 - [x] External agent integration (OpenClaw, etc.)
 - [x] Genre customization + per-book rules (genre CLI + book_rules.md)
 - [x] Genre customization + per-book rules (genre CLI + book_rules.md)
-- [x] 26-dimension continuity audit (including AI-tell detection)
+- [x] 32-dimension continuity audit (including AI-tell detection + spinoff dims)
 - [x] De-AI-ification rules + style fingerprint injection
 - [x] De-AI-ification rules + style fingerprint injection
+- [x] Spinoff writing (canon import + 4 audit dimensions + info boundary control)
+- [x] Style cloning (statistical fingerprint + LLM style guide + Writer injection)
+- [x] Post-write validator (11 hard rules + auto spot-fix)
+- [x] Audit-revise loop hardening (AI marker guard + temperature lock)
 - [x] Multi-LLM provider (OpenAI + Anthropic + compatible endpoints)
 - [x] Multi-LLM provider (OpenAI + Anthropic + compatible endpoints)
 - [x] AIGC detection + anti-detect rewrite pipeline
 - [x] AIGC detection + anti-detect rewrite pipeline
 - [x] Webhook notifications + smart scheduler (quality gates)
 - [x] Webhook notifications + smart scheduler (quality gates)

+ 92 - 8
README.md

@@ -20,6 +20,85 @@
 
 
 Agent 写小说。写、审、改,全程接管。
 Agent 写小说。写、审、改,全程接管。
 
 
+## v0.4 更新
+
+番外写作 + 文风仿写 + 写后验证器 + 审计闭环加固。
+
+### 番外写作(Spinoff)
+
+基于已有书创建前传、后传、外传或 if 线。番外和正传共享世界观和角色,但有独立剧情线。
+
+```bash
+inkos import canon 烈焰前传 --from 吞天魔帝   # 导入正传正典到番外
+inkos write next 烈焰前传                     # 写手自动读取正典约束
+```
+
+导入后生成 `story/parent_canon.md`,包含正传的世界规则、角色快照(含信息边界)、关键事件时间线、伏笔状态。写手在动笔前参照正典,审计员自动激活 4 个番外专属维度:
+
+| 维度 | 审查内容 |
+|------|----------|
+| 正传事件冲突 | 番外事件是否与正典约束表矛盾 |
+| 未来信息泄露 | 角色是否引用了分歧点之后才揭示的信息 |
+| 世界规则跨书一致性 | 番外是否违反正传世界规则(力量体系、地理、阵营) |
+| 番外伏笔隔离 | 番外是否越权回收正传伏笔 |
+
+检测到 `parent_canon.md` 自动激活,无需额外配置。
+
+### 文风仿写
+
+喂入真人小说片段,系统提取统计指纹 + 生成风格指南,后续每章自动注入写手 prompt。
+
+```bash
+inkos style analyze 参考小说.txt                     # 分析:句长、TTR、修辞特征
+inkos style import 参考小说.txt 吞天魔帝 --name 某作者  # 导入文风到书
+```
+
+产出两个文件:
+- `style_profile.json` — 统计指纹(句长分布、段落长度、词汇多样性、修辞密度)
+- `style_guide.md` — LLM 生成的定性风格指南(节奏、语气、用词偏好、禁忌)
+
+写手每章读取风格指南,审计员在文风维度对照检查。
+
+### 写后验证器
+
+11 条确定性规则,零 LLM 成本,每章写完立刻触发:
+
+| 规则 | 说明 |
+|------|------|
+| 禁止句式 | 「不是……而是……」 |
+| 禁止破折号 | 「——」 |
+| 转折词密度 | 仿佛/忽然/竟然等,每 3000 字 ≤ 1 次 |
+| 高疲劳词 | 题材疲劳词单章每词 ≤ 1 次 |
+| 元叙事 | 编剧旁白式表述 |
+| 报告术语 | 分析框架术语不入正文 |
+| 作者说教 | 显然/不言而喻等 |
+| 集体反应 | 「全场震惊」类套话 |
+| 连续了字 | ≥ 4 句连续含「了」 |
+| 段落过长 | ≥ 2 个段落超 300 字 |
+| 本书禁忌 | book_rules.md 中的禁令 |
+
+验证器发现 error 级违规时,自动触发 `spot-fix` 模式定点修复,不等 LLM 审计。
+
+### 审计-修订闭环加固
+
+实测发现 `rewrite` 模式引入 6 倍 AI 标记词,现在:
+
+- 自动修订模式从 `rewrite` 改为 `spot-fix`(只改问题句,不碰其余正文)
+- 修订后对比 AI 标记数,如果修订反而增多 AI 痕迹,丢弃修订保留原文
+- 再审温度锁 0(消除审计随机性,同一章不再出现 0-6 个 critical 的波动)
+- `polish` 模式加固边界(禁止增删段落、改人名、加新情节)
+
+### 其他 v0.4 变更
+
+- 审计维度从 26 扩展到 32(+4 番外维度 + dim 27 敏感词 + dim 32 读者期待管理)
+- 审计员联网搜索:年代考据题材可调用 DuckDuckGo 核实真实事件/人物/地理
+- 调度器重写:AI 节奏(默认 15 分钟一轮)、并行书处理、立即重试、每日上限
+- 修订者新增 `spot-fix` 模式(定点修复)
+- `book_rules.md` 的 `additionalAuditDimensions` 支持中文名称匹配
+- 全部 5 个题材激活 dim 24-26(支线停滞/弧线平坦/节奏单调)
+
+---
+
 ## v0.3 更新
 ## v0.3 更新
 
 
 创作规则三层分离 + 跨章记忆 + AIGC 检测 + Webhook。
 创作规则三层分离 + 跨章记忆 + AIGC 检测 + Webhook。
@@ -112,13 +191,13 @@ fatigueWordsOverride: ["瞳孔骤缩", "不可置信"]   # 覆盖题材默认
 
 
 主角人设锁定、数值上限、自定义禁令、疲劳词覆盖——每本书的规则独立调整,不影响题材模板。
 主角人设锁定、数值上限、自定义禁令、疲劳词覆盖——每本书的规则独立调整,不影响题材模板。
 
 
-### 26 维度审计
+### 32 维度审计
 
 
-审计细化为 26 个维度,按题材自动启用对应的子集:
+审计细化为 32 个维度,按题材自动启用对应的子集:
 
 
-OOC检查、时间线、设定冲突、伏笔、节奏、文风、信息越界、词汇疲劳、利益链断裂、配角降智、配角工具人化、爽点虚化、台词失真、流水账、知识库污染、视角一致性、战力崩坏、数值检查、年代考据、段落等长、套话密度、公式化转折、列表式结构、支线停滞、弧线平坦、节奏单调
+OOC检查、时间线、设定冲突、战力崩坏、数值检查、伏笔、节奏、文风、信息越界、词汇疲劳、利益链断裂、年代考据、配角降智、配角工具人化、爽点虚化、台词失真、流水账、知识库污染、视角一致性、段落等长、套话密度、公式化转折、列表式结构、支线停滞、弧线平坦、节奏单调、敏感词检查、正传事件冲突、未来信息泄露、世界规则跨书一致性、番外伏笔隔离、读者期待管理
 
 
-玄幻/仙侠全 26 维度,都市 24 维度(含年代考据),恐怖 22 维度。其中 dim 20-23(AI 痕迹)由纯规则引擎检测,不消耗 LLM 调用。
+dim 20-23(AI 痕迹)+ dim 27(敏感词)由纯规则引擎检测,不消耗 LLM 调用。dim 28-31(番外维度)检测到 `parent_canon.md` 自动激活。dim 32(读者期待管理)始终开启。
 
 
 ### 去 AI 味
 ### 去 AI 味
 
 
@@ -135,7 +214,7 @@ OOC检查、时间线、设定冲突、伏笔、节奏、文风、信息越界
 ### 其他
 ### 其他
 
 
 - 支持 OpenAI + Anthropic 原生 + 所有 OpenAI 兼容接口
 - 支持 OpenAI + Anthropic 原生 + 所有 OpenAI 兼容接口
-- 修订者支持 polish / rewrite / rework / anti-detect 四种模式
+- 修订者支持 polish / rewrite / rework / anti-detect / spot-fix 五种模式
 - 无数值系统的题材不生成资源账本
 - 无数值系统的题材不生成资源账本
 - 所有命令支持 `--json` 结构化输出,OpenClaw / 外部 Agent 可直接解析
 - 所有命令支持 `--json` 结构化输出,OpenClaw / 外部 Agent 可直接解析
 - book-id 自动检测:项目只有一本书时省略 book-id
 - book-id 自动检测:项目只有一本书时省略 book-id
@@ -317,6 +396,7 @@ inkos up                       # 守护进程模式
 | `inkos detect [id] [n]` | AIGC 检测(`--all` 全部章节,`--stats` 统计) |
 | `inkos detect [id] [n]` | AIGC 检测(`--all` 全部章节,`--stats` 统计) |
 | `inkos style analyze <file>` | 分析参考文本提取文风指纹 |
 | `inkos style analyze <file>` | 分析参考文本提取文风指纹 |
 | `inkos style import <file> [id]` | 导入文风指纹到指定书 |
 | `inkos style import <file> [id]` | 导入文风指纹到指定书 |
+| `inkos import canon [id] --from <parent>` | 导入正传正典到番外书 |
 | `inkos update` | 更新到最新版本 |
 | `inkos update` | 更新到最新版本 |
 | `inkos up / down` | 启动/停止守护进程 |
 | `inkos up / down` | 启动/停止守护进程 |
 
 
@@ -376,9 +456,9 @@ inkos up                       # 守护进程模式
 inkos/
 inkos/
 ├── packages/
 ├── packages/
 │   ├── core/              # Agent 运行时、管线、状态管理
 │   ├── core/              # Agent 运行时、管线、状态管理
-│   │   ├── agents/        # architect, writer, continuity, reviser, radar, ai-tells, detector, style-analyzer
+│   │   ├── agents/        # architect, writer, continuity, reviser, radar, ai-tells, post-write-validator, sensitive-words, detector, style-analyzer
 │   │   ├── pipeline/      # runner, agent (tool-use), scheduler, detection-runner
 │   │   ├── pipeline/      # runner, agent (tool-use), scheduler, detection-runner
-│   │   ├── state/         # 基于文件的状态管理器(7 真相文件 + 快照)
+│   │   ├── state/         # 基于文件的状态管理器(7+ 真相文件 + 快照)
 │   │   ├── llm/           # OpenAI + Anthropic 双 SDK 接口 (流式)
 │   │   ├── llm/           # OpenAI + Anthropic 双 SDK 接口 (流式)
 │   │   ├── notify/        # Telegram, 飞书, 企业微信, Webhook
 │   │   ├── notify/        # Telegram, 飞书, 企业微信, Webhook
 │   │   └── models/        # Zod schema 校验
 │   │   └── models/        # Zod schema 校验
@@ -403,12 +483,16 @@ TypeScript 单仓库,pnpm workspaces 管理。
 - [x] 可插拔雷达(RadarSource 接口)
 - [x] 可插拔雷达(RadarSource 接口)
 - [x] 外部 Agent 集成(OpenClaw 等)
 - [x] 外部 Agent 集成(OpenClaw 等)
 - [x] 题材自定义 + 单本书规则(genre CLI + book_rules.md)
 - [x] 题材自定义 + 单本书规则(genre CLI + book_rules.md)
-- [x] 26 维度连续性审计(含 AI 痕迹检测)
+- [x] 32 维度连续性审计(含 AI 痕迹检测 + 番外维度)
 - [x] 去 AI 味铁律 + 文风指纹注入
 - [x] 去 AI 味铁律 + 文风指纹注入
 - [x] 多 LLM provider(OpenAI + Anthropic + 兼容接口)
 - [x] 多 LLM provider(OpenAI + Anthropic + 兼容接口)
 - [x] AIGC 检测 + 反检测改写管线
 - [x] AIGC 检测 + 反检测改写管线
 - [x] Webhook 通知 + 智能调度(质量门控)
 - [x] Webhook 通知 + 智能调度(质量门控)
 - [x] 跨章节连贯性(章节摘要 + 支线/情感/角色矩阵)
 - [x] 跨章节连贯性(章节摘要 + 支线/情感/角色矩阵)
+- [x] 番外写作(正典导入 + 4 维度审计 + 信息边界管控)
+- [x] 文风仿写(统计指纹 + LLM 风格指南 + 写手注入)
+- [x] 写后验证器(11 条硬规则 + 自动 spot-fix)
+- [x] 审计-修订闭环加固(AI 标记守卫 + 温度锁)
 - [ ] `packages/studio` Web UI 审阅编辑界面
 - [ ] `packages/studio` Web UI 审阅编辑界面
 - [ ] 多模型路由(不同 agent 用不同模型)
 - [ ] 多模型路由(不同 agent 用不同模型)
 - [ ] 自定义 agent 插件系统
 - [ ] 自定义 agent 插件系统

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "inkos",
   "name": "inkos",
-  "version": "0.3.6",
+  "version": "0.4.0",
   "private": true,
   "private": true,
   "description": "Multi-agent novel production system",
   "description": "Multi-agent novel production system",
   "license": "MIT",
   "license": "MIT",

+ 1 - 1
packages/cli/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "@actalk/inkos",
   "name": "@actalk/inkos",
-  "version": "0.3.6",
+  "version": "0.4.0",
   "description": "InkOS CLI — multi-agent novel production system",
   "description": "InkOS CLI — multi-agent novel production system",
   "type": "module",
   "type": "module",
   "bin": {
   "bin": {

+ 1 - 1
packages/core/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "@actalk/inkos-core",
   "name": "@actalk/inkos-core",
-  "version": "0.3.6",
+  "version": "0.4.0",
   "description": "InkOS core: models, agents, pipeline, LLM integration",
   "description": "InkOS core: models, agents, pipeline, LLM integration",
   "type": "module",
   "type": "module",
   "main": "dist/index.js",
   "main": "dist/index.js",