Skills
by @narcooo
Autonomous novel writing CLI agent with web workbench (InkOS Studio) - use for creative fiction writing, novel generation, style imitation, chapter continuat...
clawhub install inkos📖 About This Skill
name: inkos description: Autonomous novel writing CLI agent with web workbench (InkOS Studio) - use for creative fiction writing, novel generation, style imitation, chapter continuation/import, EPUB export, AIGC detection, and fan fiction. Native English support with 10 built-in English genre profiles (LitRPG, Progression Fantasy, Isekai, Cultivation, System Apocalypse, Dungeon Core, Romantasy, Sci-Fi, Tower Climber, Cozy Fantasy). Also supports Chinese web novel genres (xuanhuan, xianxia, urban, horror, other). Multi-agent pipeline, two-phase writer (creative + settlement), stronger long-form chapter craft rules, hook-ledger payoff checks, 33-dimension auditing, token usage analytics, creative brief input, structured logging (JSON Lines), multi-model routing, custom OpenAI-compatible provider support, and InkOS Studio web UI for visual book management, chapter review, real-time writing progress, market radar, and analytics. version: 2.3.3 metadata: { "openclaw": { "emoji": "📖", "requires": { "bins": ["inkos", "node"], "env": ["OPENAI_API_KEY"] }, "primaryEnv": "OPENAI_API_KEY", "homepage": "https://github.com/Narcooo/inkos", "install": [{ "id": "npm", "kind": "node", "package": "@actalk/inkos", "label": "Install InkOS (npm)" }] } }
InkOS - Autonomous Novel Writing Agent
InkOS is a CLI tool for autonomous fiction writing powered by LLM agents. It orchestrates a multi-agent pipeline (Radar → Planner → Composer → Architect → Writer → Observer → Reflector → Normalizer → Auditor → Reviser) to generate, audit, and revise novel content with zero human intervention per chapter.
The pipeline operates in three phases:
Truth files are persisted as schema-validated JSON (story/state/*.json) with markdown projections for human readability. SQLite temporal memory database (story/memory.db) enables relevance-based retrieval on Node 22+.
When to Use InkOS
--lang enInitial Setup
First Time Setup
# Initialize a project directory (creates config structure)
inkos init my-writing-projectConfigure your LLM provider (OpenAI, Anthropic, or any OpenAI-compatible API)
Prefer --api-key-env so the key never appears in shell history:
export OPENAI_API_KEY=sk-xxx
inkos config set-global --provider openai --base-url https://api.openai.com/v1 --api-key-env OPENAI_API_KEY --model gpt-4o
For compatible/proxy endpoints, use --provider custom and point ONLY to trusted endpoints:
inkos config set-global --provider custom --base-url https://your-trusted-proxy.com/v1 --api-key-env OPENAI_API_KEY --model gpt-4o
Multi-Model Routing (Optional)
# Assign different models to different agents — balance quality and cost
inkos config set-model writer claude-sonnet-4-20250514 --provider anthropic --base-url https://api.anthropic.com --api-key-env ANTHROPIC_API_KEY
inkos config set-model auditor gpt-4o --provider openai
inkos config show-models
Agents without explicit overrides fall back to the global model.View System Status
# Check installation and configuration
inkos doctorView current config
inkos status
Common Workflows
Workflow 1: Create a New Novel
1. Initialize and create book:
inkos book create --title "My Novel Title" --genre xuanhuan --chapter-words 3000
# Or with a creative brief (your worldbuilding doc / ideas):
inkos book create --title "My Novel Title" --genre xuanhuan --chapter-words 3000 --brief my-ideas.md
- Genres: xuanhuan (cultivation), xianxia (immortal), urban (city), horror, other
- Returns a book-id for all subsequent operations2. Generate initial chapters (e.g., 5 chapters):
inkos write next book-id --count 5 --words 3000 --context "young protagonist discovering powers"
- The write next command runs the full pipeline: draft → audit → revise
- --context provides guidance to the Architect and Writer agents
- Returns JSON with chapter details and quality metrics3. Review and approve chapters:
inkos review list book-id
inkos review approve-all book-id
4. Export the book (supports txt, md, epub):
inkos export book-id
inkos export book-id --format epub
Workflow 2: Continue Writing Existing Novel
1. List your books:
inkos book list
2. Continue from last chapter:
inkos write next book-id --count 3 --words 2500 --context "protagonist faces critical choice"
- InkOS maintains 7 truth files (world state, character matrix, emotional arcs, etc.) for consistency
- If only one book exists, omit book-id for auto-detection3. Review and approve:
inkos review approve-all
Workflow 2.5: Shared Natural-Language Control (Recommended For OpenClaw)
When InkOS is being driven by OpenClaw or another external agent, prefer the shared interaction executor instead of stitching together many ad-hoc CLI calls:
inkos interact --json --message "continue the current book, but keep the pacing tighter"
inkos interact --json --message "rewrite chapter 3"
inkos interact --json --book my-book --message "switch to auto mode"
This returns a structured payload containing:
Use this as the primary OpenClaw entry because it shares the same control layer as the project TUI.
Workflow 2.6: Steering Chapter Focus Before Writing
Use this when the user says things like "pull focus back to the mentor conflict", "pause the merchant guild subplot", or "change what the next chapter should prioritize".
1. Update the book-level control docs when needed:
- Use update_author_intent to change the long-horizon identity of the book
- Use update_current_focus to change the next 1-3 chapters' focus
2. Compile the next chapter intent:
plan_chapter(bookId, guidance?)
- Generates story/runtime/chapter-XXXX.intent.md
- Use this to verify what the system thinks the next chapter should do3. Compose the actual runtime input package:
compose_chapter(bookId, guidance?)
- Generates story/runtime/chapter-XXXX.context.json
- Generates story/runtime/chapter-XXXX.rule-stack.yaml
- Generates story/runtime/chapter-XXXX.trace.json4. Only then write:
- write_draft if the user wants intermediate review
- write_full_pipeline if they want the usual write → audit → revise flow
Recommended orchestration:
update_current_focusplan_chaptercompose_chapterwrite_draft or write_full_pipelineWorkflow 3: Import Existing Chapters & Continue
Use this when you have an existing novel (or partial novel) and want InkOS to pick up where it left off.
1. Import from a single text file (auto-splits by chapter headings):
inkos import chapters book-id --from novel.txt
- Automatically splits by 第X章 pattern
- Custom split pattern: --split "Chapter\\s+\\d+"2. Import from a directory of separate chapter files:
inkos import chapters book-id --from ./chapters/
- Reads .md and .txt files in sorted order3. Resume interrupted import:
inkos import chapters book-id --from novel.txt --resume-from 15
4. Continue writing from the imported chapters:
inkos write next book-id --count 3
- InkOS reverse-engineers all 7 truth files from the imported chapters
- Generates a style guide from the existing text
- New chapters maintain consistency with imported contentWorkflow 4: Style Imitation
1. Analyze reference text:
inkos style analyze reference_text.txt
- Examines vocabulary, sentence structure, tone, pacing2. Import style to your book:
inkos style import reference_text.txt book-id --name "Author Name"
- All future chapters adopt this style profile
- Style rules become part of the Reviser's audit criteriaWorkflow 5: Spinoff/Prequel Writing
1. Import parent canon:
inkos import canon spinoff-book-id --from parent-book-id
- Creates links to parent book's world state, characters, and events
- Reviser enforces canon consistency2. Continue spinoff:
inkos write next spinoff-book-id --count 3 --context "alternate timeline after Chapter 20"
Workflow 6: Fine-Grained Control (Draft → Audit → Revise)
If you need separate control over each pipeline stage:
1. Generate draft only:
inkos draft book-id --words 3000 --context "protagonist escapes" --json
2. Audit the chapter (33-dimension quality check):
inkos audit book-id chapter-1 --json
- Returns metrics across 33 dimensions including pacing, dialogue, world-building, outline adherence, and more3. Revise with specific mode:
inkos revise book-id chapter-1 --mode polish --json
- Modes: polish (minor), spot-fix (targeted), rewrite (major), rework (structure), anti-detect (reduce AI traces)Workflow 7: Monitor Platform Trends
inkos radar scan
Workflow 8: Detect AI-Generated Content
# Detect AIGC in a specific chapter
inkos detect book-idDeep scan all chapters
inkos detect book-id --all
Workflow 9: View Analytics
inkos analytics book-id --json
Shorthand alias
inkos stats book-id --json
Workflow 10: Write an English Novel
# Create an English LitRPG novel (language auto-detected from genre)
inkos book create --title "The Last Delver" --genre litrpg --chapter-words 3000Or set language explicitly
inkos book create --title "My Novel" --genre other --lang enSet English as default for all projects
inkos config set-global --lang en
inkos genre list to see all available genresWorkflow 11: Fan Fiction
# Create a fanfic from source material
inkos fanfic init --title "My Fanfic" --from source-novel.txt --mode canonModes: canon (faithful), au (alternate universe), ooc (out of character), cp (ship-focused)
inkos fanfic init --title "What If" --from source.txt --mode au --genre other
Workflow 12: Rename Characters or Entities Across Entire Book
# Via interact
inkos interact --json --message "把林烬改成张三"
inkos interact --json --message "rename Lin Jin to Zhang San"Via slash command
inkos interact --json --message "/rename 林烬 => 张三"
Workflow 13: Patch Specific Text in a Chapter
inkos interact --json --message "/replace 5 旧文本 => 新文本"
Workflow 14: Interactive TUI Dashboard
inkos
inkos interact and StudioInkOS Studio (Web Workbench)
inkos studio launches a local web UI (default port 4567) that provides a visual interface for all InkOS operations:
inkos studio # Start on default port 4567
inkos studio -p 8080 # Start on custom port
The right-side AI Assistant panel in Studio shares the same interaction kernel as TUI and inkos interact. You can type natural language commands (rename entities, write chapters, audit, export) directly in the assistant panel.
Advanced: Natural Language Agent Mode
For flexible, conversational requests:
inkos agent "写一部都市题材的小说,主角是一个年轻律师,第一章三千字"
Input Governance Tools
These tools are the preferred control surface for chapter steering:
plan_chapter(bookId, guidance?)compose_chapter(bookId, guidance?)update_author_intent(bookId, content)story/author_intent.md
- Use for long-horizon changes to the book's identityupdate_current_focus(bookId, content)story/current_focus.md
- Use for local steering over the next 1-3 chapterswrite_truth_file remains available for broad file edits, but prefer the dedicated control tools above for input-governance changes.
Key Concepts
Book ID Auto-Detection
If your project contains only one book, most commands acceptbook-id as optional. You can omit it for brevity:
# Explicit
inkos write next book-123 --count 1Auto-detected (if only one book exists)
inkos write next --count 1
--json Flag
All content-generating commands support--json for structured output. Essential for programmatic use:
inkos draft book-id --words 3000 --context "guidance" --json
Truth Files (Long-Term Memory)
InkOS maintains 7 files per book for coherence:All agents reference these to maintain long-term consistency. Since 0.6.0, truth files are backed by schema-validated JSON in story/state/ with automatic bootstrap from markdown for legacy books. During import chapters, these files are reverse-engineered from existing content via the ChapterAnalyzerAgent.
Multi-Phase Writer Architecture
The Writer operates across multiple phases with specialized agents:Truth files use structured JSON (story/state/*.json) as the authoritative source, with markdown projections for human readability. Hook admission control prevents duplicate/family hooks from inflating the hook table.
Context Guidance
The--context parameter provides directional hints to the Writer and Architect:
inkos write next book-id --count 2 --context "protagonist discovers betrayal, must decide whether to trust mentor"
Genre Management
View Built-In Genres
inkos genre list
inkos genre show xuanhuan
Create Custom Genre
inkos genre create my-genre --name "My Genre"
Options: --numerical, --power, --era
inkos genre create dark-xuanhuan --name "Dark Xuanhuan" --numerical --power
Copy Built-in Genre for Customization
inkos genre copy xuanhuan
Copies to project genres/ directory for editing
Command Reference Summary
| Command | Purpose | Notes |
|---------|---------|-------|
| inkos init [name] | Initialize project | One-time setup |
| inkos book create | Create new book | Returns book-id. --brief , --lang en/zh, --genre litrpg/progression/... |
| inkos book list | List all books | Shows IDs, statuses |
| inkos write next | Full pipeline (draft→audit→revise) | Primary workflow command |
| inkos draft | Generate draft only | No auditing/revision |
| inkos audit | 33-dimension quality check | Standalone evaluation |
| inkos revise | Revise chapter | Modes: polish/spot-fix/rewrite/rework/anti-detect |
| inkos agent | Natural language interface | Flexible requests |
| inkos style analyze | Analyze reference text | Extracts style profile |
| inkos style import | Apply style to book | Makes style permanent |
| inkos import canon | Link spinoff to parent | For prequels/sequels |
| inkos import chapters | Import existing chapters | Reverse-engineers truth files for continuation |
| inkos detect | AIGC detection | Flags AI-generated passages |
| inkos export | Export finished book | Formats: txt, md, epub |
| inkos analytics / inkos stats | View book statistics | Word count, audit rates, token usage |
| inkos radar scan | Platform trend analysis | Informs new book ideas |
| inkos config set-global | Configure LLM provider | OpenAI/Anthropic/custom (any OpenAI-compatible) |
| inkos config set-model | Set model override for a specific agent | --provider, --base-url, --api-key-env for multi-provider routing |
| inkos config show-models | Show current model routing | View per-agent model assignments |
| inkos doctor | Diagnose issues | Check installation |
| inkos update | Update to latest version | Self-update |
| inkos up/down | Daemon mode | Background processing. Logs to inkos.log (JSON Lines). -q for quiet mode |
| inkos review list/approve-all | Manage chapter approvals | Quality gate |
| inkos fanfic init | Create fanfic from source material | --from , --mode canon/au/ooc/cp |
| inkos genre list | List all available genres | Shows English and Chinese genres with default language |
| inkos genre create | Create custom genre profile | --name, --numerical, --power, --era |
| inkos genre copy | Copy built-in genre to project | For customization |
| inkos write rewrite | Rewrite a specific chapter | Deletes chapter and later, rewrites from that point |
| inkos book update [book-id] | Update book settings | --chapter-words, --target-chapters, --status, --lang |
| inkos book delete | Delete book and all chapters | --force to skip confirmation |
| inkos plan chapter [book-id] | Generate chapter intent | Preview what next chapter will do before writing |
| inkos compose chapter [book-id] | Generate runtime artifacts | Context, rule-stack, trace for next chapter |
| inkos consolidate [book-id] | Consolidate chapter summaries | Reduces context for long books (volume-level summaries) |
| inkos eval [book-id] | Quality evaluation report | --json, --chapters . Composite quality score |
| inkos studio | Start web workbench | -p for port. Local web UI for book management |
| inkos fanfic show [book-id] | Display parsed fanfic canon | Shows imported source material analysis |
| inkos fanfic refresh [book-id] | Re-import and regenerate fanfic canon | --from for updated source material |
| inkos interact | Shared interaction endpoint | --json, --message, --book. Primary entry for OpenClaw |
| inkos (no args) | Launch TUI dashboard | Full-screen Ink + React interactive dashboard |
Error Handling
Common Issues
"book-id not found"
inkos book list"Provider not configured"
inkos config set-global with valid credentialsinkos doctor"Context invalid"
--context is a string (wrap in quotes if multi-word)"Audit failed"
inkos revise with --mode rewrite"Book already has chapters" (import)
--resume-from to append to existing chaptersRunning Daemon Mode
For long-running operations:
# Start background daemon
inkos upStop daemon
inkos downDaemon auto-processes queued chapters
Tips for Best Results
1. Provide rich context: The more guidance in --context, the more coherent the narrative
2. Start with style: If imitating an author, run inkos style import before generation
3. Import first: For existing novels, use inkos import chapters to bootstrap truth files before continuing
4. Review regularly: Use inkos review to catch issues early
5. Monitor audits: Check inkos audit metrics to understand quality bottlenecks
6. Use spinoffs strategically: Import canon before writing prequels/sequels
7. Batch generation: Generate multiple chapters together (better continuity)
8. Check analytics: Use inkos analytics to track quality trends over time
9. Export frequently: Keep backups with inkos export
Security & Trust
@actalk/inkos, @actalk/inkos-core, and @actalk/inkos-studio npm packages are AGPL-3.0-only. Running InkOS and distributing modified versions are governed by AGPL. Full source on GitHub for auditability.preinstall/postinstall/install scripts. Install is inert.books/*, inkos.json, inkos.log). No writes outside the working directory.--api-key-env over --api-key so keys never hit shell history. Keys are stored in inkos.json under your project directory — treat it like a secret and add it to .gitignore if you commit the project.--provider custom forwards your API key to whatever URL you specify. Only point it at endpoints you trust (your own proxy or an audited reverse-proxy). Never paste an untrusted --base-url.localhost:4567 only).Support & Resources
inkos initbooks//story/ per book, with structured JSON in story/state/inkos doctor for troubleshooting