inkbone 0.0.0-stage → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +380 -0
  3. package/README.md +384 -2
  4. package/bin/inkbone.mjs +1049 -0
  5. package/configs/genres.json +591 -0
  6. package/configs/messages.json +336 -0
  7. package/configs/platforms.json +66 -0
  8. package/configs/presets.json +265 -0
  9. package/configs/severity.json +59 -0
  10. package/configs/zh-linguistics.json +1040 -0
  11. package/configs/zh-traditional.json +97 -0
  12. package/examples/claude-code-hooks.json +15 -0
  13. package/examples/mcp-config.json +12 -0
  14. package/package.json +62 -4
  15. package/prompts/00-style-architect.md +42 -0
  16. package/prompts/01-beat-planner.md +54 -0
  17. package/prompts/02-paratactic-renderer.md +63 -0
  18. package/prompts/03-targeted-rewriter.md +44 -0
  19. package/prompts/04-evidence-reviewer.md +39 -0
  20. package/prompts/05-reader-simulator.md +54 -0
  21. package/prompts/06-ledger-importer.md +41 -0
  22. package/prompts/07-chapter-settler.md +66 -0
  23. package/resources/bad_vs_good_cases.md +132 -0
  24. package/resources/eval/blind-read-instructions.md +18 -0
  25. package/resources/genre_playbooks/classical-xianxia.md +22 -0
  26. package/resources/genre_playbooks/general-clean.md +19 -0
  27. package/resources/genre_playbooks/historical-court.md +21 -0
  28. package/resources/genre_playbooks/light-fantasy.md +22 -0
  29. package/resources/genre_playbooks/mystery-thriller.md +22 -0
  30. package/resources/genre_playbooks/romance-emotional.md +20 -0
  31. package/resources/genre_playbooks/scifi-wasteland.md +21 -0
  32. package/resources/genre_playbooks/urban-realism.md +22 -0
  33. package/resources/genre_playbooks/wuxia-jianghu.md +21 -0
  34. package/resources/micro_techniques.md +77 -0
  35. package/skills/inkbone/LICENSE +21 -0
  36. package/skills/inkbone/README.md +385 -0
  37. package/skills/inkbone/SKILL.md +162 -0
  38. package/skills/inkbone/benchmarks/eval-set/README.md +49 -0
  39. package/skills/inkbone/benchmarks/eval-set/public-pairs.json +42 -0
  40. package/skills/inkbone/benchmarks/eval-set/seeds.json +42 -0
  41. package/skills/inkbone/bin/inkbone.mjs +1049 -0
  42. package/skills/inkbone/configs/genres.json +591 -0
  43. package/skills/inkbone/configs/messages.json +336 -0
  44. package/skills/inkbone/configs/platforms.json +66 -0
  45. package/skills/inkbone/configs/presets.json +265 -0
  46. package/skills/inkbone/configs/severity.json +59 -0
  47. package/skills/inkbone/configs/zh-linguistics.json +1040 -0
  48. package/skills/inkbone/configs/zh-traditional.json +97 -0
  49. package/skills/inkbone/package.json +64 -0
  50. package/skills/inkbone/prompts/00-style-architect.md +42 -0
  51. package/skills/inkbone/prompts/01-beat-planner.md +54 -0
  52. package/skills/inkbone/prompts/02-paratactic-renderer.md +63 -0
  53. package/skills/inkbone/prompts/03-targeted-rewriter.md +44 -0
  54. package/skills/inkbone/prompts/04-evidence-reviewer.md +39 -0
  55. package/skills/inkbone/prompts/05-reader-simulator.md +54 -0
  56. package/skills/inkbone/prompts/06-ledger-importer.md +41 -0
  57. package/skills/inkbone/prompts/07-chapter-settler.md +66 -0
  58. package/skills/inkbone/resources/bad_vs_good_cases.md +132 -0
  59. package/skills/inkbone/resources/eval/blind-read-instructions.md +18 -0
  60. package/skills/inkbone/resources/genre_playbooks/classical-xianxia.md +22 -0
  61. package/skills/inkbone/resources/genre_playbooks/general-clean.md +19 -0
  62. package/skills/inkbone/resources/genre_playbooks/historical-court.md +21 -0
  63. package/skills/inkbone/resources/genre_playbooks/light-fantasy.md +22 -0
  64. package/skills/inkbone/resources/genre_playbooks/mystery-thriller.md +22 -0
  65. package/skills/inkbone/resources/genre_playbooks/romance-emotional.md +20 -0
  66. package/skills/inkbone/resources/genre_playbooks/scifi-wasteland.md +21 -0
  67. package/skills/inkbone/resources/genre_playbooks/urban-realism.md +22 -0
  68. package/skills/inkbone/resources/genre_playbooks/wuxia-jianghu.md +21 -0
  69. package/skills/inkbone/resources/micro_techniques.md +77 -0
  70. package/skills/inkbone/src/aigc-guard.mjs +83 -0
  71. package/skills/inkbone/src/auditor.mjs +24 -0
  72. package/skills/inkbone/src/benchmark-runner.mjs +71 -0
  73. package/skills/inkbone/src/boundary-compiler.mjs +60 -0
  74. package/skills/inkbone/src/browser-doctor.mjs +30 -0
  75. package/skills/inkbone/src/calibrator.mjs +175 -0
  76. package/skills/inkbone/src/config-loader.mjs +233 -0
  77. package/skills/inkbone/src/continuity.mjs +5 -0
  78. package/skills/inkbone/src/core/aigc-guard.mjs +387 -0
  79. package/skills/inkbone/src/core/auditor.mjs +1074 -0
  80. package/skills/inkbone/src/core/boundary-compiler.mjs +526 -0
  81. package/skills/inkbone/src/core/browser-doctor.mjs +320 -0
  82. package/skills/inkbone/src/core/config-compiler.mjs +434 -0
  83. package/skills/inkbone/src/core/continuity.mjs +158 -0
  84. package/skills/inkbone/src/core/evidence-validator.mjs +77 -0
  85. package/skills/inkbone/src/core/exporter.mjs +423 -0
  86. package/skills/inkbone/src/core/formatter.mjs +241 -0
  87. package/skills/inkbone/src/core/ledger-manager.mjs +843 -0
  88. package/skills/inkbone/src/core/normalizer.mjs +517 -0
  89. package/skills/inkbone/src/core/profiler.mjs +686 -0
  90. package/skills/inkbone/src/core/rule-engine.mjs +1710 -0
  91. package/skills/inkbone/src/core/style-profiler.mjs +229 -0
  92. package/skills/inkbone/src/detector.mjs +270 -0
  93. package/skills/inkbone/src/doctor.mjs +430 -0
  94. package/skills/inkbone/src/evaluation.mjs +311 -0
  95. package/skills/inkbone/src/evidence-validator.mjs +15 -0
  96. package/skills/inkbone/src/exporter.mjs +142 -0
  97. package/skills/inkbone/src/formatter.mjs +34 -0
  98. package/skills/inkbone/src/importer.mjs +230 -0
  99. package/skills/inkbone/src/index.mjs +134 -0
  100. package/skills/inkbone/src/ledger-manager.mjs +22 -0
  101. package/skills/inkbone/src/mcp-server.mjs +950 -0
  102. package/skills/inkbone/src/normalizer.mjs +73 -0
  103. package/skills/inkbone/src/profiler.mjs +17 -0
  104. package/skills/inkbone/src/rule-engine.mjs +91 -0
  105. package/skills/inkbone/src/rule-stats.mjs +142 -0
  106. package/skills/inkbone/src/style-profiler.mjs +25 -0
  107. package/src/aigc-guard.mjs +83 -0
  108. package/src/auditor.mjs +24 -0
  109. package/src/benchmark-runner.mjs +71 -0
  110. package/src/boundary-compiler.mjs +60 -0
  111. package/src/browser-doctor.mjs +30 -0
  112. package/src/calibrator.mjs +175 -0
  113. package/src/config-loader.mjs +233 -0
  114. package/src/continuity.mjs +5 -0
  115. package/src/core/aigc-guard.mjs +387 -0
  116. package/src/core/auditor.mjs +1074 -0
  117. package/src/core/boundary-compiler.mjs +526 -0
  118. package/src/core/browser-doctor.mjs +320 -0
  119. package/src/core/config-compiler.mjs +434 -0
  120. package/src/core/continuity.mjs +158 -0
  121. package/src/core/evidence-validator.mjs +77 -0
  122. package/src/core/exporter.mjs +423 -0
  123. package/src/core/formatter.mjs +241 -0
  124. package/src/core/ledger-manager.mjs +843 -0
  125. package/src/core/normalizer.mjs +517 -0
  126. package/src/core/profiler.mjs +686 -0
  127. package/src/core/rule-engine.mjs +1710 -0
  128. package/src/core/style-profiler.mjs +229 -0
  129. package/src/detector.mjs +270 -0
  130. package/src/doctor.mjs +430 -0
  131. package/src/evaluation.mjs +311 -0
  132. package/src/evidence-validator.mjs +15 -0
  133. package/src/exporter.mjs +142 -0
  134. package/src/formatter.mjs +34 -0
  135. package/src/importer.mjs +230 -0
  136. package/src/index.mjs +134 -0
  137. package/src/ledger-manager.mjs +22 -0
  138. package/src/mcp-server.mjs +950 -0
  139. package/src/normalizer.mjs +73 -0
  140. package/src/profiler.mjs +17 -0
  141. package/src/rule-engine.mjs +91 -0
  142. package/src/rule-stats.mjs +142 -0
  143. package/src/style-profiler.mjs +25 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 InkBone Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,380 @@
1
+ # InkBone
2
+
3
+ **A living ledger, style contract, and zero-dependency QA engine for writing Chinese long-form fiction with LLMs.**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/inkbone?color=cb3837&label=npm)](https://www.npmjs.com/package/inkbone)
6
+ [![Online Playground](https://img.shields.io/badge/Live_Playground-Browser_Only_%C2%B7_Zero_Upload-2ea44f)](https://blankym.github.io/inkbone/)
7
+ [![test](https://github.com/blankym/inkbone/actions/workflows/test.yml/badge.svg)](https://github.com/blankym/inkbone/actions/workflows/test.yml)
8
+ [![Dependencies: 0](https://img.shields.io/badge/dependencies-0-orange.svg)](package.json)
9
+ [![Node.js ≥ 18](https://img.shields.io/badge/Node.js-%E2%89%A518-brightgreen.svg)](https://nodejs.org)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
11
+
12
+ [中文](README.md) · **[Live Playground & Browser Doctor](https://blankym.github.io/inkbone/)** · **[npm](https://www.npmjs.com/package/inkbone)** · **[Discussions](https://github.com/blankym/inkbone/discussions)** · 9 genre packs · Offline 280-Char AIGC Guard · Simplified + Traditional Chinese · Zero-Dep `.docx` / `.zip` Export · Full MCP Server · VS Code Extension · 80 tests
13
+
14
+ > **Language note:** Prompts, rule patterns, and CLI findings target **Chinese long-form fiction** (both Simplified and Traditional Chinese). This README documents the architecture and workflow in English.
15
+
16
+ ---
17
+
18
+ ## Pick Your Entry Point in 10 Seconds
19
+
20
+ | How you write | Fastest way to start | What you get immediately |
21
+ | :--- | :--- | :--- |
22
+ | **Web LLMs (DeepSeek / Claude / Gemini)**<br/>*(zero setup)* | Open **[Live Playground & Browser Doctor](https://blankym.github.io/inkbone/)** | Drop a chapter or an entire `chapters/` folder (**100% client-side, zero uploads**) → word-level highlights with **double-click inline editing**, cross-chapter echo ranking, **one-click targeted rewrite prompt**, and clean `.txt` / **submission `.docx`** / **bundled `.zip`** export |
23
+ | **Claude Code / Codex / Antigravity / OpenCode** | `npx skills add blankym/inkbone` | 8-stage fiction workflow + offline 280-char AIGC structural guard + spoiler-safe living ledger + local linting + 9 genre playbooks |
24
+ | **Claude Desktop / Cursor / Windsurf (MCP)** | Add `npx -y inkbone mcp` | One config loads **10 Tools + 8 Prompts + 11 Resources** — no separate skill setup needed |
25
+ | **VS Code / Cursor & Terminal CLI** | `npx inkbone audit ch01.md` or install [VS Code Extension](editors/vscode-inkbone/) | Clone-free CLI checkups, copyright-safe style profiling, live squiggly diagnostics, **character ledger Hover cards**, and **status-bar platform word-count delta** |
26
+
27
+ ---
28
+
29
+ ## Why InkBone?
30
+
31
+ Long-form LLM fiction usually breaks down around chapter 15:
32
+
33
+ - Setups planted in chapter 3 get forgotten or spoiled in narration forty chapters later, or a character killed in chapter 12 casually walks back into dialogue in chapter 38.
34
+ - Classical xianxia prose starts slipping in modern slang, impossible traditional time counts, and repetitive stock tics.
35
+ - Subject-dropped Chinese action sentences silently shift actors right after another character's line.
36
+ - Ask a model to review its own draft and it often invents quotes that never existed while nudging you to "add more sensory adjectives."
37
+
38
+ Longer prompts cannot enforce themselves once rules drift out of context. **InkBone separates generative drafting from deterministic verification**: staged prompts align pacing and voice before writing, while a zero-dependency local engine verifies lexicons, ledger boundaries, calendars, and subject chains line by line afterward.
39
+
40
+ ### Client-Side Playground & Whole-Book Browser Doctor (Zero Uploads)
41
+
42
+ ![InkBone Browser Playground: inline word-level highlights, rhythm strip, and one-click targeted rewrite prompt](docs/assets/playground-audit.png)
43
+
44
+ > **Tab 1 (Single Chapter Audit)** runs pure ES Modules inside your browser: drag-and-drop `.md`/`.txt`, automatic Simplified/Traditional Chinese rule switching, inline `<mark>` highlights, double-click inline editing, Golden-Three & **offline 280-char AIGC window guard (`--aigc-guard`)** toggles, paragraph rhythm strip, and a **one-click targeted rewrite prompt** ready to paste back into any web LLM.
45
+
46
+ ![InkBone Browser Doctor: multi-chapter sorting, cross-chapter echo detection, Top 10 clichés, and auto-mined ledger](docs/assets/playground-book-doctor.png)
47
+
48
+ > **Tab 4 (Browser Doctor)** accepts an entire `chapters/` directory: automatically sorts chapters (Arabic or Chinese numerals), scores cross-chapter echo rate and book-wide Top 10 clichés, exports an auto-mined `ledger.json`, and cleans chapters into platform-ready `.txt` bundles.
49
+
50
+ ### How It Differs from Pure-Prompt Writing Kits
51
+
52
+ | Area | Typical Prompt-Only Kits | InkBone v2.1 |
53
+ | :--- | :--- | :--- |
54
+ | **Register & Cliché Control** | Relies on LLM willpower; drifts after a few thousand characters | **Deterministic code linter** with 9 genre packs, Simplified/Traditional auto-detection, and project overrides |
55
+ | **Continuity & Anti-Spoiler** | Stuffs the entire outline into context and leaks twists early | **Living Ledger (`packet` + `settle` + `check-ledger`)**: redacts un-revealed `fullTruth` as `[REDACTED]` and guards against deceased characters reappearing |
56
+ | **Review Grounding** | Models hallucinate quotes and rewrite your voice | **`verify-review` hard gate**: rejects any review item missing verbatim text or giving stylistic meddling advice |
57
+ | **Friction & Privacy** | Locked to one IDE or requires cloud uploads | **Static zero-upload web app** + `npx` CLI + zero-dependency MCP server + VS Code linter |
58
+ | **Quality Metric** | Easily degenerates into gaming AIGC detectors | **Never edits to chase detector scores**; optimizes for human blind reading (`eval-pack` / `eval-score`) |
59
+
60
+ ---
61
+
62
+ ## See It Catch Real Issues in 30 Seconds
63
+
64
+ ```mermaid
65
+ flowchart LR
66
+ A["Pre-draft packet<br/>Redact un-revealed truth / flag due setups"] --> B["Scene-by-scene draft<br/>Stage 1-2"]
67
+ B --> C["Local linter audit / doctor<br/>Register / clichés / loops / subject chain / deceased guard"]
68
+ C --> D["Evidence review + verify-review<br/>Reject fake quotes & style meddling"]
69
+ D --> E["Targeted surgery Stage 4<br/>Edit flagged lines only"]
70
+ E --> F["Post-chapter settle + check-ledger<br/>Merge snapshots & setup states"]
71
+ F --> A
72
+ ```
73
+
74
+ Save a 9-line sample chapter (`ch01.md`):
75
+
76
+ ```markdown
77
+ 子时三刻,药园的木门被人拍响。
78
+
79
+ 陆青瞳孔骤缩,起身去开门。
80
+
81
+ 门外站着执事孙岳,雨水落到他身上就散成白雾。孙岳没进门,把一块铁牌丢在桌上:
82
+
83
+ “寅时十刻之前,把渠里的符拔干净。”
84
+
85
+ 孙岳转身靠在门柱上,合上了眼。从袖子里摸出一把小刀,挑开了渠边的泥。
86
+ ```
87
+
88
+ Add a character roster (`ledger.json`):
89
+
90
+ ```json
91
+ { "characterNames": ["陆青", "孙岳"] }
92
+ ```
93
+
94
+ Run directly via `npx` (Node.js 18+, no clone or API key needed):
95
+
96
+ ```bash
97
+ npx inkbone doctor ch01.md --genre classical-xianxia --ledger ledger.json --skip-length --lang en
98
+ ```
99
+
100
+ Output:
101
+
102
+ ```markdown
103
+ ## ch01.md
104
+ - **L3**: `cliche_pupil_shrink` (瞳孔骤缩)
105
+ - **L7**: `reg_impossible_ke_count` (寅时十刻)
106
+ - **L9**: `subject_ambiguity` (previous actor 孙岳: 从袖子里摸出一把小刀,挑开了渠边的泥。)
107
+ ```
108
+
109
+ - **Line 3**: flags a stock AI cliché in narration while leaving quoted dialogue untouched.
110
+ - **Line 7**: catches a calendar error (a traditional *shichen* only has 8 *ke*, never 10).
111
+ - **Line 9**: sees Sun Yue (`孙岳`) opened the prior sentence and warns that the following subjectless action reads as Sun Yue pulling the knife.
112
+
113
+ ### Before / After in Practice
114
+
115
+ ```markdown
116
+ Before (typical AI draft):
117
+ Forty-three-year-old veteran Zhou Jianmin ran the old-town delivery station and worried about cutting complaints before month-end. Taking a deep breath with a bitter smile, he pushed open the glass door so no one would see his unease.
118
+
119
+ After (cut resume dump, stock tics, and explanatory tail):
120
+ The complaint rate sat at 0.62%, well above the district cutoff. Zhou flattened the appeal sheets, pulled his yellow raincoat off the hook. Outside under the awning, Hu Fei tapped "decline" two rings into a dispatch alert.
121
+ ```
122
+
123
+ ### Reproducible Public Benchmark (4 Original Seeds)
124
+
125
+ Run `node scripts/run-public-eval.mjs` to reproduce [benchmarks/public-report.md](benchmarks/public-report.md) on the 4 original zero-copyright pairs in [benchmarks/eval-set/public-pairs.json](benchmarks/eval-set/public-pairs.json):
126
+
127
+ | Seed | Genre | Baseline (Errors / Warnings / Line Hits) | InkBone Revised (Errors / Warnings / Line Hits) |
128
+ | :--- | :--- | :---: | :---: |
129
+ | Herb Ditch (`xianxia-herb-ditch`) | `classical-xianxia` | 0 / 5 / 13 | 0 / 0 / 0 |
130
+ | Fog Harbor (`mystery-harbor-coroner`) | `mystery-thriller` | 1 / 5 / 12 | 0 / 0 / 0 |
131
+ | Delivery Station (`urban-delivery-station`) | `urban-realism` | 0 / 4 / 8 | 0 / 0 / 0 |
132
+ | Cooling-Off Day (`romance-cooling-off`) | `romance-emotional` | 0 / 3 / 14 | 0 / 0 / 0 |
133
+ | **Total (4 genres)** | — | **1 / 17 / 47** | **0 / 0 / 0** |
134
+
135
+ ---
136
+
137
+ ## 4 Ways to Get Started
138
+
139
+ ### Path 1: Browser Playground (Zero Setup)
140
+
141
+ Open **[https://blankym.github.io/inkbone/](https://blankym.github.io/inkbone/)**:
142
+
143
+ 1. **Single-Chapter Audit (Tab 1)**: paste or drop a `.md`/`.txt` chapter, pick a genre (Traditional Chinese switches automatically), inspect inline highlights and rhythm strip;
144
+ 2. **Targeted Rewrite**: click **Copy Targeted Rewrite Prompt** and paste it into DeepSeek / Claude / Gemini so the model only patches flagged line numbers;
145
+ 3. **Whole-Book Browser Doctor (Tab 4)**: select an entire `chapters/` folder to inspect cross-chapter echoes, book-wide Top 10 clichés, download an auto-mined `ledger.json`, or export clean `.txt` files for Qidian / Fanqie / Qimao / JJWXC.
146
+
147
+ ### Path 2: One-Line Agent Skill (`npx skills add`)
148
+
149
+ `skills/inkbone/` follows the open `agentskills` spec and bundles `SKILL.md`, the CLI, configs, 8 stage prompts, and craft playbooks:
150
+
151
+ ```bash
152
+ npx skills add blankym/inkbone
153
+ ```
154
+
155
+ Or copy offline:
156
+
157
+ ```bash
158
+ git clone https://github.com/blankym/inkbone.git
159
+ cp -R inkbone/skills/inkbone <your-skills-dir>/inkbone
160
+ ```
161
+
162
+ Then just talk to your agent:
163
+ - "Set up a mystery novel project with InkBone and generate `novel.json` and `ledger.json`."
164
+ - "Compile the chapter 12 packet from `ledger.json`, outline the scene beats, and settle the ledger once drafted."
165
+ - "Import `chapters/` into a ledger with auto-mined character names and run `doctor` across all volumes."
166
+
167
+ ### Path 3: Zero-Dependency MCP Server, Hooks & VS Code Extension
168
+
169
+ InkBone ships a **zero-dependency stdio MCP server** exposing:
170
+ - **10 Tools**: `inkbone_audit`, `inkbone_doctor`, `inkbone_aigc_check`, `inkbone_packet`, `inkbone_settle`, `inkbone_check_ledger`, `inkbone_verify_review`, `inkbone_normalize`, `inkbone_style_profile`, `inkbone_export`;
171
+ - **8 Stage Prompts**: `inkbone/style-architect` through `inkbone/chapter-settler` (passing `genre` automatically attaches the matching playbook);
172
+ - **11 Read-Only Resources**: `inkbone://playbooks/<genre>` (9 playbooks), micro-techniques guide, and 10 before/after cases.
173
+
174
+ Add to Claude Desktop / Cursor / Windsurf (see [examples/mcp-config.json](examples/mcp-config.json)):
175
+
176
+ ```json
177
+ {
178
+ "mcpServers": {
179
+ "inkbone": {
180
+ "command": "npx",
181
+ "args": ["-y", "inkbone", "mcp"]
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
187
+ - **Claude Code auto-gate**: run audits automatically on chapter edits via [examples/claude-code-hooks.json](examples/claude-code-hooks.json).
188
+ - **VS Code / Cursor real-time linter**: inline squigglies, Quick Fixes (strip asterisks / add to whitelist), rewrite prompt copy, and platform export in [editors/vscode-inkbone/](editors/vscode-inkbone/).
189
+
190
+ ### Path 4: Standalone CLI (`npx` / Global Install / Offline Clone)
191
+
192
+ Requires **Node.js 18+**, zero dependencies:
193
+
194
+ ```bash
195
+ # Run immediately via npx
196
+ npx inkbone --help
197
+
198
+ # Or install globally
199
+ npm install -g inkbone
200
+
201
+ # Or run offline from git clone (no npm install required)
202
+ git clone https://github.com/blankym/inkbone.git && cd inkbone
203
+ node bin/inkbone.mjs --help
204
+ ```
205
+
206
+ Four everyday workflows (replace `npx inkbone` with `inkbone` if installed globally):
207
+
208
+ 1. **30-second chapter check, offline 280-char AIGC window guard & rewrite prompt (Simplified + Traditional Chinese auto-detected)**
209
+ ```bash
210
+ npx inkbone audit ch01.md --genre urban-realism --format md --lang en --no-project --no-ledger --skip-length
211
+ npx inkbone aigc-check ch01.md
212
+ npx inkbone rewrite-prompt ch01.md --genre urban-realism --aigc-guard --lang en --no-project --no-ledger --skip-length
213
+ ```
214
+ 2. **Copyright-safe style profiling + living ledger loop**
215
+ ```bash
216
+ # Extracts statistics-only pacing profiles & customGates without copying source prose
217
+ npx inkbone style-profile ./ref-samples --out ./my-novel/style.json
218
+ npx inkbone init ./my-novel --genre classical-xianxia --title "BookTitle"
219
+ npx inkbone packet --ledger ./my-novel/ledger.json --chapter 4 --prev ./my-novel/ch03.md
220
+ npx inkbone settle --ledger ./my-novel/ledger.json --patch ./my-novel/ch04-settlement.json
221
+ npx inkbone check-ledger ./my-novel/ledger.json --current 4
222
+ ```
223
+ 3. **Batch ledger backfill & incremental long-form checkup (`--chapters` / `--changed`)**
224
+ ```bash
225
+ npx inkbone import-ledger ./my-novel/chapters --auto-characters --out ./my-novel/ledger.json --title "BookTitle"
226
+ npx inkbone backfill-prompt ./my-novel/chapters --ledger ./my-novel/ledger.json --batch-size 5 --limit 1
227
+ npx inkbone settle --ledger ./my-novel/ledger.json --patch ./my-novel/batch-settlement.json --batch
228
+ npx inkbone doctor ./my-novel/chapters --chapters 40-45 --lang en
229
+ npx inkbone doctor ./my-novel/chapters --changed --lang en
230
+ ```
231
+ 4. **Export clean chapters, editorial submission `.docx`, and `.zip` bundles (`qidian`, `fanqie`, `qimao`, `jjwxc`)**
232
+ ```bash
233
+ npx inkbone export ./my-novel/chapters --platform qimao --out ./dist/qimao --merge-out ./dist/vol1.txt --docx-out ./dist/submission.docx --zip-out ./dist/chapters.zip --outline ./my-novel/outline.md --title "BookTitle"
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Workflow & Core Engine
239
+
240
+ The `prompts/` directory defines eight stages (`00`–`07`), with CLI/MCP enforcing deterministic gates between stages:
241
+
242
+ 1. **Register contract (`00-style-architect.md`)**: derives the genre pack, three-tier character voice matrix, and banned terms into `novel.json`.
243
+ 2. **Beat plan (`01-beat-planner.md`)**: pulls spoiler-safe context via `packet`, lays out information placement and scene beats, and pauses for author sign-off before drafting. `check-outline` catches leftover `[待补充]` placeholders.
244
+ 3. **Drafting (`02-paratactic-renderer.md`)**: continues directly from the prior chapter's ending state without echoing the previous ending or copying beat-sheet prose.
245
+ 4. **Local audit (`audit` / `doctor`)**: reports blocking errors and line-level warnings (Chinese default, `--lang en` supported, auto Simplified/Traditional detection).
246
+ 5. **Grounded review (`04`, `05` + `verify-review` / `review-save`)**:
247
+ - `04-evidence-reviewer.md` audits causality, timelines, physics, and character motivation.
248
+ - `05-reader-simulator.md` runs two passes: a cold reader with zero lore context, and a genre veteran scanning for drag or register slips.
249
+ - `verify-review` rejects any item whose quote is absent from the chapter or whose feedback meddles with prose style.
250
+ 6. **Targeted revision (`03-targeted-rewriter.md`)**: edits only verified review items and flagged line numbers, then re-audits.
251
+ 7. **Post-chapter settlement & ledger health (`07-chapter-settler.md` + `settle` / `check-ledger`)**: non-destructively merges chapter summaries, 8-field character snapshots, and foreshadowing state transitions into `ledger.json`, flagging overdue setups before the next chapter starts.
252
+ 8. **Post-freeze scan (`detect`, optional)**: records one external scan after locking the chapter; never loops to chase detector scores.
253
+
254
+ ### What It Checks
255
+
256
+ | Area | Examples | Default level |
257
+ | :--- | :--- | :--- |
258
+ | Ledger, tactical props & world rules | Missing required anchors, premature spoilers before `revealChapter`, deprecated terms, opening echoing the prior ending; **deceased/departed characters acting or speaking outside flashbacks (`DECEASED_CHARACTER_APPEARANCE`)**; **short-term tactical props past `mustResolveByChapter` (`UNRESOLVED_TACTICAL_PROP`)**; **executable world-rule invariants (`WORLD_RULE_VIOLATION`)**; **numeric resource ledger balance continuity (`RESOURCE_LEDGER_MISMATCH`)** | `error` / `warning` |
259
+ | Format, length & calendar claims | Markdown asterisks, inline ledger notes like `(余13滴)`, mismatched quote-length claims; **intra-chapter lunar calendar span contradicting "half a month" claims (`CALENDAR_SPAN_CONTRADICTION`)** | `error` / `warning` |
260
+ | Golden-three opening retention | With `--golden-three`, flags slow openings (first 380 Han chars) that lack spoken dialogue and immediate conflict/action signals (`GOLDEN_OPENING_SLOW_START`) | `warning` |
261
+ | Model degeneration | Verbatim line/sentence loops, truncated endings, garbled characters, AI refusal/meta-leakage | `error` / `warning` |
262
+ | Subject continuity | Subjectless action right after another character's action; three consecutive paragraphs opening the same way | `warning` |
263
+ | Register & script variant | Modern slang in period settings, invalid traditional time counts, archaic phrasing in urban fiction; **auto Simplified/Traditional Chinese & HK/TW web-novel rules** | `warning` (escalates on high density) |
264
+ | Clichés & density | Stock micro-acting phrases, symmetric skeletons, panel dossier recitation, excessive similes/exclamation marks/ellipses, telegraphic over-compression guard | `warning` (escalates on high density) |
265
+ | Offline AIGC window guard | `aigc-check` or `--aigc-guard` scans 280-char windows for `N/A/Q/S/M` paragraph cadence entropy, sandwich-quote (`SSS`) streaks, U-shaped `的` starvation rebound, narration `这/那` demonstrative spikes, and `>=6`-char compound modifier bricks | `warning` / `info` |
266
+ | Statistical fingerprint | 20+ metrics (MATTR-50, sentence-length CV, cadence entropy, `的`-modifier density) compared against human reference ranges | `info` (diagnostic only) |
267
+
268
+ Warnings exit `0` for human judgment; hard errors and high-frequency blocking violations exit non-zero for CI. Pass `--strict` to fail on all gates.
269
+
270
+ ### Three-Layer Rules
271
+
272
+ `audit` and `doctor` walk upward from chapter files to discover `novel.json` and merge three rule layers:
273
+
274
+ 1. **Universal (`configs/zh-linguistics.json`, `configs/zh-traditional.json`)**: cross-genre clichés, filler phrases, punctuation, and Simplified/Traditional hygiene.
275
+ 2. **Genre (`configs/genres.json`)**: 9 built-in genre packs catching cross-genre register leakage.
276
+ 3. **Project (`novel.json` + `.inkbone-whitelist`)**: book-specific vocabulary, `customGates` from `style-profile`, literal whitelists, and `disabledRuleIds`.
277
+
278
+ Before promoting a rule above the project layer, run `npx inkbone rule-stats --human <human-corpus> --ai <ai-drafts>` to confirm human authors do not write the same pattern frequently.
279
+
280
+ ---
281
+
282
+ ## Built-in Fiction Craft Library (`resources/`)
283
+
284
+ Beyond deterministic linting, InkBone bundles practical plotting and editing guides (loaded on demand per stage so prompts stay lean):
285
+
286
+ - **[Micro-Techniques & Revision Lookup (`resources/micro_techniques.md`)](resources/micro_techniques.md)**: action-reaction "two-press, one-lift" beats, 80/20 climax framing, multi-purpose foreshadowing, post-climax three-part loot settlements, anti-bloat discipline, and a 9-symptom revision lookup table.
287
+ - **[10 Before/After Case Studies (`resources/bad_vs_good_cases.md`)](resources/bad_vs_good_cases.md)**: side-by-side rewrites covering micro-action trimming, late-in/early-out dialogue, dialogic panel/ledger delivery, anti-rebound cadence variety, and avoiding telegraphic over-compression.
288
+ - **[9 Genre Playbooks (`resources/genre_playbooks/`)](resources/genre_playbooks/)**: dedicated playbooks for xianxia, historical court, wuxia, mystery/thriller, urban realism, sci-fi wasteland, light fantasy, romance, and clean general fiction.
289
+
290
+ ---
291
+
292
+ ## Genre Packs & 27-Command Reference
293
+
294
+ <details>
295
+ <summary>Expand 9 built-in genre packs (run <code>npx inkbone genres</code> to inspect)</summary>
296
+
297
+ - `classical-xianxia`: classical cultivation and xianxia
298
+ - `historical-court`: historical intrigue and period drama
299
+ - `wuxia-jianghu`: traditional martial-arts fiction
300
+ - `mystery-thriller`: crime, folklore horror, and rule-based suspense
301
+ - `urban-realism`: contemporary urban, workplace, and realistic drama
302
+ - `scifi-wasteland`: sci-fi, cyberpunk, and post-apocalyptic survival
303
+ - `light-fantasy`: brisk light-novel / system comedy
304
+ - `romance-emotional`: historical and contemporary romance
305
+ - `general-clean`: neutral cross-genre baseline
306
+
307
+ </details>
308
+
309
+ | Group | Command | Purpose |
310
+ | :--- | :--- | :--- |
311
+ | Living ledger | `genres` / `init` | List all 9 genre packs / scaffold `novel.json` and `ledger.json` |
312
+ | | `import-ledger` / `backfill-prompt` | Scan existing chapters, mine candidate character names & merge ledger / emit batched `settle --batch` prompts for unsettled chapters |
313
+ | | `packet` | Compile spoiler-safe context with un-revealed `fullTruth` redacted and optional snapshot pruning |
314
+ | | `check-ledger` / `settle` | Validate ledger health, tactical props & resource balances / merge single or `--batch` settlement JSON cleanly |
315
+ | Format & QA | `normalize` / `check-outline` | Strip asterisks & normalize dashes / verify Stage 1 beat outlines |
316
+ | | `audit` / `doctor` | Single-chapter audit (Simplified/Traditional + deceased/world-rule/golden-three/`--aigc-guard` guards) / full or incremental checkup (`--chapters` / `--changed`) |
317
+ | | `aigc-check` / `rewrite-prompt` | Zero-token 280-char sliding-window AIGC structural & lexical guard / emit a copy-ready targeted rewrite prompt for web LLMs |
318
+ | Style & publish | `style-profile` / `export` | Copyright-safe statistical style profiler / clean `.txt`, **editorial `.docx`**, and **`.zip`** export for `qidian`, `fanqie`, `qimao`, `jjwxc` |
319
+ | Protocol | `mcp` | Start the zero-dependency stdio MCP server (10 tools, 8 prompts, 11 resources) |
320
+
321
+ <details>
322
+ <summary>Expand review, blind evaluation & rule calibration commands (11 advanced commands)</summary>
323
+
324
+ | Group | Command | Purpose |
325
+ | :--- | :--- | :--- |
326
+ | Review & blind eval | `verify-review` | Verify that review quotes exist verbatim in the chapter and reject style meddling |
327
+ | | `review-save` | Verify and archive a review JSON with chapter SHA-256 and model metadata |
328
+ | | `review-stats` | Compare issue counts and skip points across saved review revisions |
329
+ | | `eval-pack` | Build an anonymized X/Y blind reading packet alongside a private `key.json` |
330
+ | | `eval-score` | Tally blind reader ballots with win rates, sign-test p-values, and skip-quote verification |
331
+ | Calibration & logs | `profile` | Compute 20+ linguistic fingerprint metrics for a chapter |
332
+ | | `calibrate` | Generate statistics-only p10/median/p90 reference ranges from a human corpus |
333
+ | | `rule-stats` | Measure per-rule hit rates per 10k characters across human vs. AI texts |
334
+ | | `mine` | Extract 3/4-gram phrases overused in AI drafts compared to human prose |
335
+ | | `detect` | Run a single cached external scan (requires `.env` API key), record-only |
336
+ | | `benchmark` | Compare corpus metrics against manifest entries |
337
+
338
+ </details>
339
+
340
+ Run `npx inkbone --help` for daily commands, or `npx inkbone --help-all` for all 27 commands.
341
+
342
+ ---
343
+
344
+ ## Layout & Development
345
+
346
+ ```text
347
+ bin/ src/ CLI, zero-dependency core engine (AIGC window guard, style profiler, DOCX/ZIP exporter, Browser Doctor) & full MCP server
348
+ configs/ Universal rules, 9 genre packs, Traditional Chinese layer, 4 platform presets, gates & zh/en catalog
349
+ docs/ Browser-only static playground (double-click inline editing + AIGC window guard) & Browser Doctor (.docx / .zip export)
350
+ editors/ Standalone zero-dependency VS Code / Cursor real-time linter + ledger Hover cards & word-count status bar
351
+ examples/ MCP client config & Claude Code PostToolUse Hook templates
352
+ prompts/ 8 staged drafting, review & settlement prompts (00–07)
353
+ resources/ Before/after examples, micro-techniques, 9 genre playbooks, eval guide
354
+ benchmarks/ 4 original eval seeds, de-identified AIGC window calibration pairs & reproducible comparison report
355
+ evals/ Runtime-agnostic skill trigger eval set
356
+ skills/inkbone/ Generated self-contained skill package (do not edit directly)
357
+ tests/ 80 unit tests
358
+ ```
359
+
360
+ ```bash
361
+ npm test # Run all 80 tests (zero-Han-literal, 280-char AIGC guard, full MCP, zh-hant, DOCX/ZIP export, VS Code core, docs & skill sync)
362
+ npm run build:skill # Repackage skills/inkbone after editing sources/configs/prompts/README
363
+ npm run check:skill # Verify skills/inkbone matches sources (enforced in CI)
364
+ npm run build:docs # Sync browser playground docs/vendor after editing src/core or configs
365
+ npm run check:docs # Verify docs/vendor matches sources (enforced in CI)
366
+ ```
367
+
368
+ ## Contributing, Acknowledgments & License
369
+
370
+ Try a real draft in the **[Live Playground](https://blankym.github.io/inkbone/)**, and feel free to report false positives or propose new genre rules:
371
+
372
+ - **Discussions & Showcase**: [GitHub Discussions](https://github.com/blankym/inkbone/discussions)
373
+ - **Report False Positive / Propose Rule**: [Issue Forms](https://github.com/blankym/inkbone/issues/new/choose)
374
+ - **Community Link & Acknowledgment**: InkBone is 100% open source and appreciates the open-source sharing spirit and early testing feedback from the [LINUX DO](https://linux.do/) community ([https://linux.do/](https://linux.do/)).
375
+ - **Inspirations**:
376
+ - Chapter boundary isolation and verbatim-quote review checks inspired by [EthanYoQ/Pagekin](https://github.com/EthanYoQ/Pagekin)
377
+ - Chinese clause-trunk and symmetric-frame checks inspired by [LifelongLazyLearner/qu-ai-wei](https://github.com/LifelongLazyLearner/qu-ai-wei)
378
+ - Rhetorical density grading, degeneration detection, and meta-leak checks inspired by [zenstory-ai/oh-story-claudecode](https://github.com/zenstory-ai/oh-story-claudecode)
379
+
380
+ Released under the [MIT License](LICENSE), including all rule configurations and playbooks.