inkos-multi-agent-novel-writing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

InkOS Multi-Agent Novel Writing

InkOS 多Agent小说创作系统

Skill by ara.so — Daily 2026 Skills collection
InkOS is a multi-agent CLI system that autonomously writes, audits, and revises novels. Agents handle the full pipeline: Writer → Validator → Auditor → Reviser, with human review gates at configurable checkpoints.
ara.so 开发的技能 —— 2026每日技能合集
InkOS是一款多Agent CLI系统,可自主完成小说的创作、审核与修订工作。各个Agent负责完整流程的不同环节:架构师Agent→写手Agent→验证器Agent→审核员Agent→修订员Agent,同时可在可配置的检查点设置人工审核节点。

Installation

安装

bash
npm install -g @actalk/inkos
bash
npm install -g @actalk/inkos

or run directly

或直接运行

npx @actalk/inkos --version

**Requirements:** Node.js ≥ 20.0.0
npx @actalk/inkos --version

**要求:** Node.js ≥ 20.0.0

Quick Start

快速开始

bash
undefined
bash
undefined

Create a new novel project

创建新的小说项目

inkos book create --title "吞天魔帝" --genre xuanhuan
inkos book create --title "吞天魔帝" --genre xuanhuan

Write the next chapter

撰写下一章

inkos write next 吞天魔帝
inkos write next 吞天魔帝

Audit a specific chapter

审核指定章节

inkos audit 吞天魔帝 --chapter 3
inkos audit 吞天魔帝 --chapter 3

Run the full daemon (continuous production)

启动持续创作守护进程

inkos daemon start
undefined
inkos daemon start
undefined

Project Structure

项目结构

After
inkos book create
, the project directory contains:
story/
  outline.md              # Story outline (architect agent input)
  book_rules.md           # Per-book custom rules and audit dimensions
  chapter_summaries.md    # Auto-generated per-chapter summaries
  subplot_board.md        # Subplot progress tracking (A/B/C lines)
  emotional_arcs.md       # Per-character emotional arc tracking
  character_matrix.md     # Character interaction matrix + info boundaries
  parent_canon.md         # Spinoff only: imported canon constraints
  style_profile.json      # Style fingerprint (if style import used)
  style_guide.md          # LLM-generated qualitative style guide
  chapters/
    ch001.md
    ch002.md
    ...
执行
inkos book create
后,项目目录包含以下内容:
story/
  outline.md              # 故事大纲(架构师Agent的输入文件)
  book_rules.md           # 单本小说的自定义规则与审核维度
  chapter_summaries.md    # 自动生成的各章节摘要
  subplot_board.md        # 副线剧情进度追踪(A/B/C线)
  emotional_arcs.md       # 各角色的情感弧光追踪
  character_matrix.md     # 角色互动矩阵 + 信息边界
  parent_canon.md         # 仅衍生作品:导入的正传设定约束
  style_profile.json      # 风格特征指纹(若使用风格导入功能)
  style_guide.md          # 由LLM生成的定性风格指南
  chapters/
    ch001.md
    ch002.md
    ...

Core Commands

核心命令

Book Management

书籍管理

bash
inkos book create --title "Title" --genre xuanhuan  # genres: xuanhuan | xianxia | dushi | horror | general
inkos book list
inkos book status 吞天魔帝
bash
inkos book create --title "Title" --genre xuanhuan  # 支持体裁:xuanhuan | xianxia | dushi | horror | general
inkos book list
inkos book status 吞天魔帝

Writing Pipeline

创作流水线

bash
inkos write next 吞天魔帝           # Write next chapter (auto-loads all context)
inkos write chapter 吞天魔帝 5      # Write specific chapter
inkos audit 吞天魔帝 --chapter 3    # Audit chapter (33 dimensions)
inkos revise 吞天魔帝 --chapter 3   # Revise based on audit results
inkos revise 吞天魔帝 --chapter 3 --mode spot-fix   # Point fix only (default)
inkos revise 吞天魔帝 --chapter 3 --mode rewrite    # Full rewrite (use cautiously)
inkos revise 吞天魔帝 --chapter 3 --mode polish     # Polish (no structural changes)
bash
inkos write next 吞天魔帝           # 撰写下一章(自动加载所有上下文)
inkos write chapter 吞天魔帝 5      # 撰写指定章节
inkos audit 吞天魔帝 --chapter 3    # 审核章节(33个维度)
inkos revise 吞天魔帝 --chapter 3   # 根据审核结果修订章节
inkos revise 吞天魔帝 --chapter 3 --mode spot-fix   # 仅定点修正(默认模式)
inkos revise 吞天魔帝 --chapter 3 --mode rewrite    # 完全重写(谨慎使用)
inkos revise 吞天魔帝 --chapter 3 --mode polish     # 润色(不修改结构)

Genre System

体裁系统

bash
inkos genre list                        # List all built-in genres
inkos genre show xuanhuan               # View full rules for a genre
inkos genre copy xuanhuan               # Copy genre rules to project for customization
inkos genre create wuxia --name 武侠     # Create new genre from scratch
bash
inkos genre list                        # 列出所有内置体裁
inkos genre show xuanhuan               # 查看某一体裁的完整规则
inkos genre copy xuanhuan               # 复制体裁规则到项目以进行自定义
inkos genre create wuxia --name 武侠     # 从零开始创建新体裁

Style Matching

风格匹配

bash
inkos style analyze reference.txt               # Analyze style fingerprint
inkos style import reference.txt 吞天魔帝        # Import style into book
inkos style import reference.txt 吞天魔帝 --name "某作者"
bash
inkos style analyze reference.txt               # 分析文本的风格特征指纹
inkos style import reference.txt 吞天魔帝        # 将风格导入到指定书籍
inkos style import reference.txt 吞天魔帝 --name "某作者"

Spinoff (Prequel/Sequel/IF-branch)

衍生作品(前传/后传/分支剧情)

bash
inkos book create --title "烈焰前传" --genre xuanhuan
inkos import canon 烈焰前传 --from 吞天魔帝       # Import parent canon constraints
inkos write next 烈焰前传                         # Writer auto-reads canon constraints
bash
inkos book create --title "烈焰前传" --genre xuanhuan
inkos import canon 烈焰前传 --from 吞天魔帝       # 导入正传设定约束
inkos write next 烈焰前传                         # 写手Agent会自动读取正传设定约束

AIGC Detection

AIGC检测

bash
inkos detect 吞天魔帝 --chapter 3     # Detect AIGC markers in chapter
inkos detect 吞天魔帝 --all           # Detect all chapters
inkos detect --stats                  # View detection history statistics
bash
inkos detect 吞天魔帝 --chapter 3     # 检测章节中的AIGC特征
inkos detect 吞天魔帝 --all           # 检测所有章节
inkos detect --stats                  # 查看检测历史统计数据

Daemon (Continuous Production)

守护进程(持续创作)

bash
inkos daemon start                    # Start scheduler (default: 15 min/cycle)
inkos daemon stop
inkos daemon status
bash
inkos daemon start                    # 启动调度器(默认:每15分钟一个周期)
inkos daemon stop
inkos daemon status

Configuration

配置

Global Config (
~/.inkos/config.json
)

全局配置(
~/.inkos/config.json

json
{
  "llm": {
    "provider": "openai",
    "model": "gpt-4o",
    "apiKey": "sk-...",
    "temperature": 0.8
  },
  "daemon": {
    "intervalMinutes": 15,
    "dailyChapterLimit": 10,
    "parallelBooks": 2
  },
  "webhook": {
    "url": "https://your-server.com/hooks/inkos",
    "secret": "your-hmac-secret",
    "events": ["chapter-complete", "audit-failed", "pipeline-error"]
  },
  "aigcDetection": {
    "provider": "gptzero",
    "apiKey": "...",
    "endpoint": "https://api.gptzero.me/v2/predict/text"
  }
}
json
{
  "llm": {
    "provider": "openai",
    "model": "gpt-4o",
    "apiKey": "sk-...",
    "temperature": 0.8
  },
  "daemon": {
    "intervalMinutes": 15,
    "dailyChapterLimit": 10,
    "parallelBooks": 2
  },
  "webhook": {
    "url": "https://your-server.com/hooks/inkos",
    "secret": "your-hmac-secret",
    "events": ["chapter-complete", "audit-failed", "pipeline-error"]
  },
  "aigcDetection": {
    "provider": "gptzero",
    "apiKey": "...",
    "endpoint": "https://api.gptzero.me/v2/predict/text"
  }
}

Per-Book Rules (
story/book_rules.md
)

单本书籍规则(
story/book_rules.md

markdown
undefined
markdown
undefined

Book Rules: 吞天魔帝

书籍规则:吞天魔帝

禁忌 (Forbidden)

禁忌

  • 主角不得主动求饶
  • 不得出现「命运」「天意」等宿命论表述
  • 主角不得主动求饶
  • 不得出现「命运」「天意」等宿命论表述

高疲劳词

高疲劳词

  • 震撼, 惊骇, 恐惧, 颤抖
  • 震撼, 惊骇, 恐惧, 颤抖

additionalAuditDimensions

additionalAuditDimensions

  • 数值系统一致性: 战力数值不得前后矛盾
  • 角色成长节奏: 主角突破间隔不少于3章
  • 数值系统一致性: 战力数值不得前后矛盾
  • 角色成长节奏: 主角突破间隔不少于3章

写手特别指令

写手特别指令

  • 战斗场面优先感官描写,禁止数值报告
undefined
  • 战斗场面优先感官描写,禁止数值报告
undefined

Agent Architecture

Agent架构

InkOS runs five specialized agents in sequence:
ArchitectAgent  →  outline.md, book_rules.md
WriterAgent     →  ch00N.md (reads: outline, summaries, arcs, matrix, style_guide, canon)
ValidatorAgent  →  11 deterministic rules, zero LLM cost
     ↓  (error found → trigger spot-fix immediately)
AuditorAgent    →  33 LLM dimensions, temperature=0 for consistency
ReviserAgent    →  spot-fix | rewrite | polish | anti-detect
InkOS会按顺序运行五个专用Agent:
ArchitectAgent  →  outline.md, book_rules.md
WriterAgent     →  ch00N.md(读取:大纲、摘要、人物弧光、角色矩阵、风格指南、正传设定)
ValidatorAgent  →  11条确定性规则,无LLM成本
     ↓ (发现错误→立即触发定点修正)
AuditorAgent    →  33个LLM评估维度,temperature=0以保证一致性
ReviserAgent    →  定点修正 | 重写 | 润色 | 反检测

Post-Write Validator Rules (Deterministic, No LLM)

创作后验证规则(确定性,无LLM成本)

RuleCondition
Forbidden patterns
不是……而是……
constructs
Em-dash ban
——
character
Transition word density仿佛/忽然/竟然≤1 per 3000 chars
High-fatigue wordsPer-book list, ≤1 per chapter
Meta-narrativeScreenwriter-style narration
Report terminologyAnalytical framework terms in prose
Author moralizing显然/不言而喻 etc.
Collective reaction「全场震惊」clichés
Consecutive 了≥4 consecutive sentences with 了
Paragraph length≥2 paragraphs over 300 chars
Book-specific bans
book_rules.md
forbidden list
规则条件
禁用句式
不是……而是……
结构
禁用破折号
——
字符
过渡词密度仿佛/忽然/竟然≤1每3000字
高疲劳词单本书籍列表中的词汇,每章≤1次
元叙事编剧式叙述方式
报告式术语prose中出现分析框架术语
作者说教显然/不言而喻等表述
集体反应「全场震惊」等陈词滥调
连续「了」字≥4个连续句子带「了」
段落长度≥2个段落超过300字符
单本书籍禁用内容
book_rules.md
中的禁用列表

Audit Dimensions (33 total, LLM-evaluated)

审核维度(共33个,由LLM评估)

Key dimensions include:
  • Dims 1–23: Core narrative quality (plot, character, pacing, foreshadowing)
  • Dim 24–26: Subplot stagnation, arc flatness, rhythm monotony (all 5 genres)
  • Dim 27: Sensitive content
  • Dim 28–31: Spinoff-specific (canon conflicts, future info leakage, world rule consistency, foreshadowing isolation)
  • Dim 32: Reader expectation management
  • Dim 33: Outline deviation detection
关键维度包括:
  • 维度1–23:核心叙事质量(情节、角色、节奏、伏笔)
  • 维度24–26:副线停滞、人物弧光扁平、节奏单调(所有5种体裁通用)
  • 维度27:敏感内容
  • 维度28–31:衍生作品专属(正传设定冲突、未来信息泄露、世界规则一致性、伏笔孤立)
  • 维度32:读者预期管理
  • 维度33:大纲偏离检测

Code Integration Examples

代码集成示例

Programmatic Usage (TypeScript)

程序化使用(TypeScript)

typescript
import { BookManager } from '@actalk/inkos'
import { WriterAgent } from '@actalk/inkos/agents'
import { ValidatorAgent } from '@actalk/inkos/agents'

// Create and configure a book
const manager = new BookManager()
const book = await manager.createBook({
  title: '吞天魔帝',
  genre: 'xuanhuan',
  outlinePath: './my-outline.md'
})

// Run the write pipeline for next chapter
const writer = new WriterAgent({ temperature: 0.8 })
const chapter = await writer.writeNext(book)

// Run deterministic validation (no LLM cost)
const validator = new ValidatorAgent()
const validationResult = await validator.validate(chapter, book)

if (validationResult.hasErrors) {
  // Auto spot-fix triggered
  const reviser = new ReviserAgent({ mode: 'spot-fix' })
  const fixed = await reviser.revise(chapter, validationResult.errors, book)
  console.log('Fixed violations:', validationResult.errors.length)
}
typescript
import { BookManager } from '@actalk/inkos'
import { WriterAgent } from '@actalk/inkos/agents'
import { ValidatorAgent } from '@actalk/inkos/agents'

// 创建并配置书籍
const manager = new BookManager()
const book = await manager.createBook({
  title: '吞天魔帝',
  genre: 'xuanhuan',
  outlinePath: './my-outline.md'
})

// 运行下一章的创作流水线
const writer = new WriterAgent({ temperature: 0.8 })
const chapter = await writer.writeNext(book)

// 运行确定性验证(无LLM成本)
const validator = new ValidatorAgent()
const validationResult = await validator.validate(chapter, book)

if (validationResult.hasErrors) {
  // 自动触发定点修正
  const reviser = new ReviserAgent({ mode: 'spot-fix' })
  const fixed = await reviser.revise(chapter, validationResult.errors, book)
  console.log('修复的违规项数量:', validationResult.errors.length)
}

Webhook Handler (Express)

Webhook处理器(Express)

typescript
import express from 'express'
import crypto from 'crypto'

const app = express()
app.use(express.raw({ type: 'application/json' }))

app.post('/hooks/inkos', (req, res) => {
  const sig = req.headers['x-inkos-signature'] as string
  const expected = crypto
    .createHmac('sha256', process.env.INKOS_WEBHOOK_SECRET!)
    .update(req.body)
    .digest('hex')

  if (sig !== `sha256=${expected}`) {
    return res.status(401).send('Invalid signature')
  }

  const event = JSON.parse(req.body.toString())

  switch (event.type) {
    case 'chapter-complete':
      console.log(`Chapter ${event.chapter} of "${event.book}" complete`)
      // Trigger human review gate
      notifyReviewer(event)
      break
    case 'audit-failed':
      console.log(`Audit failed: ${event.criticalCount} critical issues`)
      break
    case 'pipeline-error':
      console.error(`Pipeline error in "${event.book}":`, event.error)
      break
  }

  res.status(200).json({ received: true })
})
typescript
import express from 'express'
import crypto from 'crypto'

const app = express()
app.use(express.raw({ type: 'application/json' }))

app.post('/hooks/inkos', (req, res) => {
  const sig = req.headers['x-inkos-signature'] as string
  const expected = crypto
    .createHmac('sha256', process.env.INKOS_WEBHOOK_SECRET!)
    .update(req.body)
    .digest('hex')

  if (sig !== `sha256=${expected}`) {
    return res.status(401).send('无效签名')
  }

  const event = JSON.parse(req.body.toString())

  switch (event.type) {
    case 'chapter-complete':
      console.log(`${event.book}》第${event.chapter}章创作完成`)
      // 触发人工审核节点
      notifyReviewer(event)
      break
    case 'audit-failed':
      console.log(`审核失败:${event.criticalCount}个严重问题`)
      break
    case 'pipeline-error':
      console.error(`${event.book}》流水线错误:`, event.error)
      break
  }

  res.status(200).json({ received: true })
})

Custom Genre Definition

自定义体裁定义

typescript
// genres/wuxia.ts
import type { GenreConfig } from '@actalk/inkos/types'

export const wuxia: GenreConfig = {
  id: 'wuxia',
  name: '武侠',
  chapterTypes: ['江湖相遇', '武功切磋', '恩怨纠葛', '门派争斗', '武林大会'],
  forbiddenPatterns: [
    '内力值', '战力', '等级提升',   // No numerical power system
    '系统', '面板', '属性点'
  ],
  fatiguedWords: ['震惊', '无敌', '碾压', '秒杀'],
  languageRules: [
    {
      bad: '内力增加了100点',
      good: '一股暖流沿经脉漫开,指尖的颤抖渐渐平息'
    }
  ],
  auditDimensions: [
    '武功描写感官化',
    '江湖规则内部一致性',
    '恩怨情仇弧线完整性'
  ]
}
typescript
// genres/wuxia.ts
import type { GenreConfig } from '@actalk/inkos/types'

export const wuxia: GenreConfig = {
  id: 'wuxia',
  name: '武侠',
  chapterTypes: ['江湖相遇', '武功切磋', '恩怨纠葛', '门派争斗', '武林大会'],
  forbiddenPatterns: [
    '内力值', '战力', '等级提升',   // 无数值化力量体系
    '系统', '面板', '属性点'
  ],
  fatiguedWords: ['震惊', '无敌', '碾压', '秒杀'],
  languageRules: [
    {
      bad: '内力增加了100点',
      good: '一股暖流沿经脉漫开,指尖的颤抖渐渐平息'
    }
  ],
  auditDimensions: [
    '武功描写感官化',
    '江湖规则内部一致性',
    '恩怨情仇弧线完整性'
  ]
}

Style Import Pipeline

风格导入流水线

typescript
import { StyleAnalyzer } from '@actalk/inkos/style'

const analyzer = new StyleAnalyzer()

// Analyze reference text
const profile = await analyzer.analyze('./reference-novel.txt')
console.log(profile)
// {
//   avgSentenceLength: 18.3,
//   ttr: 0.42,           // Type-Token Ratio
//   rhetoricalDensity: 0.15,
//   paragraphLengthDist: { p25: 45, p50: 89, p75: 156 },
//   punctuationStyle: 'sparse'
// }

// Import into book (generates style_profile.json + style_guide.md)
await analyzer.importToBook('./reference-novel.txt', '吞天魔帝', {
  authorName: '某作者'
})
typescript
import { StyleAnalyzer } from '@actalk/inkos/style'

const analyzer = new StyleAnalyzer()

// 分析参考文本
const profile = await analyzer.analyze('./reference-novel.txt')
console.log(profile)
// {
//   avgSentenceLength: 18.3,
//   ttr: 0.42,           // 词型-词次比
//   rhetoricalDensity: 0.15,
//   paragraphLengthDist: { p25: 45, p50: 89, p75: 156 },
//   punctuationStyle: 'sparse'
// }

// 导入到书籍(生成style_profile.json + style_guide.md)
await analyzer.importToBook('./reference-novel.txt', '吞天魔帝', {
  authorName: '某作者'
})

Audit Revision Loop

审核-修订循环

The v0.4 hardened audit-revision loop prevents revision from introducing more AI markers:
AuditorAgent (temp=0)
     ↓ critical issues found
ReviserAgent spot-fix
AI marker count comparison
     ↓ markers increased?
  YES → discard revision, keep original
  NO  → accept revision
Re-audit (temp=0)
Key settings for audit consistency:
  • Auditor always runs at
    temperature: 0
    — eliminates 0–6 critical variance on same chapter
  • Default revision mode is
    spot-fix
    (only modify problem sentences)
  • rewrite
    mode is available but measured to introduce 6× more AI markers
  • polish
    mode is boundary-locked: no paragraph add/delete, no name changes, no new plot
v0.4版本强化的审核-修订循环可防止修订过程引入更多AI特征:
AuditorAgent(temperature=0)
     ↓ 发现严重问题
ReviserAgent 定点修正
AI特征数量对比
     ↓ 特征数量增加?
  是 → 丢弃修订版本,保留原版
  否 → 接受修订版本
重新审核(temperature=0)
保证审核一致性的关键设置:
  • 审核员Agent始终以
    temperature: 0
    运行——消除同一章节0-6个严重问题的差异
  • 默认修订模式为
    spot-fix
    (仅修改有问题的句子)
  • rewrite
    模式可用,但经测试会引入6倍以上的AI特征
  • polish
    模式有严格边界:不增删段落、不修改名字、不添加新情节

Spinoff Canon Constraints

衍生作品正传设定约束

When
parent_canon.md
is detected, 4 additional audit dimensions activate automatically:
markdown
undefined
当检测到
parent_canon.md
时,会自动激活4个额外的审核维度:
markdown
undefined

parent_canon.md (auto-generated by
inkos import canon
)

parent_canon.md(由
inkos import canon
自动生成)

正传世界规则

正传世界规则

  • 力量体系: 炼体→炼气→炼丹→炼神→炼虚
  • 地理: 九州大陆,东海以东无人居住
  • 阵营: 正道五宗 vs 魔道三门
  • 力量体系: 炼体→炼气→炼丹→炼神→炼虚
  • 地理: 九州大陆,东海以东无人居住
  • 阵营: 正道五宗 vs 魔道三门

关键事件时间线

关键事件时间线

  • 第1章: 主角获得吞天诀
  • 第45章: 正道五宗盟约成立 [分歧点]
  • 第1章: 主角获得吞天诀
  • 第45章: 正道五宗盟约成立 [分歧点]

角色快照 (分歧点时状态)

角色快照(分歧点时状态)

  • 林天: 炼气期第三层,未知父母身世
  • 剑宗宗主: 在世,尚未叛变
  • 林天: 炼气期第三层,未知父母身世
  • 剑宗宗主: 在世,尚未叛变

伏笔状态 (正传专属,番外禁止回收)

伏笔状态(正传专属,番外禁止回收)

  • 古剑残片: 未解
  • 神秘老人身份: 未解
undefined
  • 古剑残片: 未解
  • 神秘老人身份: 未解
undefined

Troubleshooting

故障排除

Validator fires on every chapter Check
book_rules.md
fatigue word list — words listed there are enforced ≤1 per chapter. Remove infrequently used terms.
Audit results wildly inconsistent between runs Confirm auditor temperature is locked to 0 in config. If using a proxy LLM API, ensure it respects
temperature: 0
.
Revision introduces more AI markers than original This is expected behavior — InkOS v0.4 automatically detects this and discards the revision. If it happens repeatedly, switch from
rewrite
to
spot-fix
mode explicitly.
Spinoff audit incorrectly flags events Verify
parent_canon.md
has accurate divergence point timestamps. Events before the divergence point are canon-locked; events after are fair game for the spinoff.
Daemon stops a book after repeated failures Check
daemon status
for the suspended book. After fixing the underlying issue (usually outline ambiguity or
book_rules.md
contradiction), run
inkos daemon resume 书名
.
Style guide not being applied by writer Run
inkos style import
again — if
style_guide.md
is missing or empty, the writer skips style injection silently. Check that the reference text is ≥5000 characters for reliable fingerprinting.
每章都会触发验证器报错 检查
book_rules.md
中的高疲劳词列表——列表中的词汇每章最多出现1次。移除不常用的词汇即可。
不同次运行的审核结果差异极大 确认配置中审核员的temperature已锁定为0。若使用代理LLM API,需确保其支持
temperature: 0
设置。
修订版本比原版的AI特征更多 这是预期行为——InkOS v0.4会自动检测这种情况并丢弃修订版本。若反复出现,可显式将模式从
rewrite
切换为
spot-fix
衍生作品审核错误标记事件 验证
parent_canon.md
中的分歧点时间戳是否准确。分歧点之前的事件受正传设定约束;分歧点之后的事件可由衍生作品自由创作。
守护进程在多次失败后停止某本书籍的创作 运行
inkos daemon status
查看暂停的书籍。修复根本问题(通常是大纲模糊或
book_rules.md
存在矛盾)后,运行
inkos daemon resume 书名
即可恢复。
写手Agent未应用风格指南 重新运行
inkos style import
——若
style_guide.md
缺失或为空,写手Agent会静默跳过风格注入。确保参考文本不少于5000字符,以保证风格指纹分析的可靠性。