A self-evolving novel writing engine for Chinese fiction with continuity tracking, multi-role quality review, foreshadowing management, character voice libra...
---
name: lobster-novel
description: Self-evolving novel writing engine for OpenClaw agents. Pipeline: context to writer to multi-role review to continuity tracking. Built-in quality checks, foreshadowing management, character voice library, and token cost optimization.
version: 1.4.0
homepage: https://github.com/awoo129/lobster-novel
metadata: {"emoji":"๐ฆ","os":["linux","darwin","win32"],"requires":{"bins":[]}}
---
# lobster-novel
A self-evolving novel writing engine for OpenClaw agents. Designed for long-form Chinese fiction with rigorous continuity control, multi-role quality review, and built-in token cost management.
## Quick Start
```bash
# Initialize a new novel project
python3 lobster_novel.py --dir my-novel init --title "Novel Title"
# View current status
python3 lobster_novel.py --dir my-novel status
# Generate writing context for chapter N
python3 lobster_novel.py --dir my-novel context N
# Auto-write next chapter via SenseNova API
python3 lobster_novel.py --dir my-novel write
# Save a manually written chapter with review
python3 lobster_novel.py --dir my-novel save N chapter.md --summary "Summary"
# Run quality review on a chapter
python3 lobster_novel.py --dir my-novel review N chapter.md
# Export the full novel
python3 lobster_novel.py --dir my-novel export md --output novel.md
# Manage style templates
python3 lobster_novel.py --dir my-novel style-template list
python3 lobster_novel.py --dir my-novel style-template activate "wuxia"
```
## Architecture
```
lobster-novel/
โโโ core/ # Core engine modules
โ โโโ bible.py # Novel bible manager (world-building, characters, settings)
โ โโโ continuity.py # Continuity ledger (per-chapter state snapshots)
โ โโโ pipeline.py # Writing pipeline orchestrator
โ โโโ chapters.py # Chapter generator with token analysis
โ โโโ arc_planner.py # Story arc planner
โ โโโ beat_sheet.py # Beat sheet generator
โ โโโ contract.py # Writer-agent contract enforcement
โ โโโ style_lock.py # Style constraint system
โ โโโ conflict_detector.py
โ โโโ chinese_typeset.py
โโโ agents/ # Specialized agent roles
โ โโโ context_agent.py # Context preparation agent
โ โโโ data_agent.py # Data extraction agent
โ โโโ reviewer_agent.py # Multi-role review agent
โ โโโ three_laws.py # Three Laws of Novel Writing enforcement
โโโ review/ # Quality review modules
โ โโโ quality_check.py # 6-role static review
โ โโโ aigc_detect.py # AI-style pattern detector
โ โโโ scorer.py # Chapter scoring engine
โ โโโ strand_balance.py # Strand balance checker
โ โโโ deai_writer.py # De-AI writing assistant
โโโ memory/ # Memory & tracking systems
โ โโโ character_tracker.py
โ โโโ character_voice.py
โ โโโ emotion_arc.py
โ โโโ foreshadowing.py
โ โโโ plot_tracker.py
โ โโโ relationship_tracker.py
โ โโโ style_library.py
โ โโโ novel_kg.py
โโโ tools/ # CLI tools
โ โโโ novel-cli.py # Main CLI (12 subcommands)
โ โโโ auto_write.py # Batch continuous writing
โ โโโ batch_refine.py # Batch chapter refinement
โ โโโ serial_writer.py # Serial chapter writer
โ โโโ v3_checkpoint.py
โโโ rag/ # RAG systems
โ โโโ novel_rag.py
โโโ output/ # Export modules
โ โโโ export.py
โโโ templates/ # Style templates
โโโ scripts/ # Utility scripts
โโโ tests/ # Test suites
```
## Writing Pipeline
```
User Idea โ init โ context โ [write | manual writing]
โ save (auto quality review) โ review (static + AI-style detection)
โ foreshadowing update โ next chapter โ export
```
### Key Principles
1. **Continuity First** โ Every chapter updates the continuity ledger.
2. **Multi-Role Review** โ 6 roles: Reader, Editor, Storyteller, Satisfaction Analyst, Voice Validator, Web Novel Editor.
3. **AI-Style Detection** โ Detects and flags AI-typical patterns.
4. **Token Budget** โ Built-in token counting and cost estimation.
5. **Style Lock** โ Enforces selected writing style throughout.
## CLI Reference
| Command | Description |
|---------|-------------|
| `init` | Initialize a new novel project |
| `status` | Show project status |
| `context [N]` | Generate writing context for chapter N |
| `write` | Auto-write next chapter |
| `save N file.md` | Save a chapter with review |
| `review N file.md` | Run quality review |
| `export [md\|txt\|html]` | Export the full novel |
| `style-template` | Manage style templates |
| `tokens` | Token usage analysis |
| `bible` | Manage novel bible |
| `continuity` | View continuity ledger |
| `foreshadow` | Manage foreshadowing items |
## Style Templates
Built-in templates: wuxia, xianxia, xuanhuan, historical, horror, romance, sci-fi, comedy.
## Dependencies
- Python 3.10+
- SenseNova API key (via `SENSENOVA_API_KEY` env var)
- tiktoken (auto-installed if missing)
## Testing
```bash
cd lobster-novel
python3 -m pytest tests/ -v
```
15 test modules.
## License
MIT
don't have the plugin yet? install it then click "run inline in claude" again.