long-novel-agent-kit
This server provides a local stdio MCP interface for desktop agents to manage long-novel continuity, check drafts, and update project state without relying on chat history.
Agent Setup & Configuration
get_agent_template– Retrieve workflow instructions tailored to a specific platform (Codex, Cursor, Claude Desktop, etc.) and write mode.explain_tool_visibility– Understand which tools are available under a given mode (read-only/writer) and tool profile (core/writing/full).build_agent_startup_prompt– Generate a copy-ready startup prompt for an agent taking over a target chapter.build_desktop_next_step– Get a decision report on what the desktop agent should do next based on project state.build_desktop_diagnostics– Produce a diagnostics report covering project state, MCP config, and pack health.
Project Status & Activity
get_project_status– Summarize whether a.novel-agentproject is ready for writing.list_agent_capabilities– View recorded host agent capability declarations.list_agent_activity/build_agent_activity_report– List and evaluate agent activity and handoff records.doctor– Check kit installation and project state health.
Chapter Context & Session Preparation
build_chapter_context/build_chapter_context_brief– Build chapter-safe context (facts, rules, debts) in full or compact form.prepare_chapter_session– Generate a full read-only startup packet (context + fingerprints) before drafting.check_write_session– Preflight check comparing project ID, state hash, and context hash to prevent stale writes.
Continuity Facts & Open Threads
list_facts– List active structured continuity facts, optionally filtered by chapter and kind.list_open_threads– View unresolved plot debts, chapter contracts, conflicts, and the latest handoff.
Draft Checking & Revision
check_chapter– Check a chapter draft against rules, character state, facts, timeline, and continuity obligations.diff_chapter_contract– Compare a draft against required beats, acceptance checks, and forbidden moves.build_chapter_readiness– Produce an author-facing acceptance readiness report with a revision plan.build_chapter_revision_prompt– Generate a targeted revision prompt for the desktop agent.build_chapter_revision_comparison– Compare before/after drafts to show resolved, new, and remaining issues.
Delivery & Acceptance
build_chapter_delivery_packet– Bundle draft metadata, readiness, and post-acceptance commands for author delivery.build_chapter_acceptance_plan– Build a post-acceptance write plan with author-confirmation gates and ordered writer commands.build_author_review_queue– List proposals, conflicts, and acceptance items awaiting author review.
Post-Write Proposals & State Updates
build_proposal_template/get_proposal_schema– Generate an empty proposal template or retrieve its JSON Schema.validate_proposal– Validate a proposal for evidence and conflicts before applying.diff_proposal– Preview what facts, characters, and debts a proposal would change.build_proposal_review– Build an author review packet for a saved or inline proposal.build_proposal_readiness– Check readiness gates before durably applying a proposal.
Handoff
build_handoff_report– Build a handoff report and next-agent brief with workflow requirements, write boundaries, and pending continuity work.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@long-novel-agent-kit prepare session for chapter 5"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Long Novel Agent Kit
Local continuity infrastructure for writing long novels with desktop agents.
Long Novel Agent Kit does not replace the model, the writing agent, or the author's judgment. It gives local desktop agents a durable project memory and a set of safety gates so a long novel can survive long context windows, agent handoffs, source material updates, and multi-chapter continuity drift.
The Short Version
Use the desktop agent for intelligence. Use this kit for continuity.
The desktop agent reads PDFs, old drafts, notes, web pages, images, and long files with its native tools.
The agent writes confirmed summaries, facts, research notes, and decisions into
.novel-agent/.Before drafting, the agent calls
prepare-sessionorbuild-contextinstead of relying on chat history.Before delivery, the agent calls continuity checks and delivery helpers.
After the author accepts a chapter, writer tools record the chapter and update durable state with author confirmation.
Another local agent can later read the same
.novel-agent/state and continue the book.
Related MCP server: novel-mcp
Architecture At A Glance
flowchart TD
Author["Author"]
Agent["Local desktop agent<br/>Codex, Cursor, Claude Desktop, etc."]
Native["Agent native abilities<br/>model, long context, file parsing, web, PDF/OCR, retrieval"]
Skill["SKILL.md<br/>workflow instructions"]
MCP["server.py<br/>stdio MCP tools"]
CLI["cli.py<br/>local commands"]
State[".novel-agent/<br/>durable novel state"]
Pack["desktop-pack<br/>local HTML/JSON/command packet"]
Runtime["standalone runtime<br/>no-Python CLI and MCP executables"]
Author --> Agent
Agent --> Native
Agent --> Skill
Agent --> MCP
Agent --> CLI
MCP --> State
CLI --> State
State --> MCP
State --> CLI
CLI --> Pack
CLI --> Runtime
Pack --> Agent
Runtime --> AgentComponent Responsibilities
Component | What it does | What it does not do |
Desktop agent | Reads sources, reasons about prose, drafts and revises chapters, uses its own search/parsing/model tools | It is not trusted as durable memory by itself |
| Tells an agent the required writing protocol and when to call the tools | It does not store state or execute commands |
| Exposes the kit through local stdio MCP, with read-only and writer modes | It is not a remote server and does not require cloud hosting |
| Provides local commands for setup, context, checks, packs, handoff, and writer operations | It does not call an LLM |
| Stores accepted continuity, sources, facts, chapters, proposals, audit rows, and snapshots | It is not a manuscript editor |
| Creates a local packet with HTML pages, JSON state, schemas, commands, evidence templates, and handoff files | It does not prove the GUI desktop client has loaded MCP |
| Builds and packages no-Python local runtimes for another computer | It cannot cross-build every operating system reliably |
Core State Model
Every novel project keeps long-term continuity in .novel-agent/.
File | Purpose |
| Project identity, schema version, current chapter metadata |
| Required phrases, forbidden phrases, future markers, naming constraints |
| Accepted chapter records, summaries, tails, handoff notes |
| Structured facts for continuity checks, such as ownership, location, status, relationships, timeline |
| Source summaries confirmed from old drafts, PDFs, notes, or other local materials |
| Research notes and reliability notes from external lookup |
| Resolved contradictions and the chosen version |
| Character state, arcs, relationships, and constraints |
| Foreshadowing, promises, unresolved plot debt |
| Chapter goals, required beats, forbidden moves, acceptance checks |
| Proposed post-write updates awaiting review or application |
| Local agent activity and handoff logs |
| Real desktop client evidence records |
| Durable write audit trail |
| Rollback snapshots created before risky state changes |
Capability Map
Problem | Main commands / tools | Result |
Start a new novel state |
| Creates |
Import an existing Gaoxia-style project |
| Converts chapters, Vault notes, memory, and narrative state into local continuity state |
Save source summaries from the host agent |
| Turns parsed material into durable evidence and rules |
Prepare a chapter |
| Returns chapter-safe context, visible facts, rules, handoff, budget, and fingerprints |
Check a draft |
| Finds rule violations, missing beats, fact conflicts, future leaks, and state conflicts |
Help revision |
| Produces targeted repair instructions and before/after issue comparison |
Deliver to author |
| Bundles readiness, known issues, handoff state, and post-acceptance commands |
Update long-term state after acceptance |
| Records accepted chapter and applies reviewed continuity updates |
Prevent stale or wrong-project writes |
| Blocks writer commands when the state has changed since context generation |
Hand off to another local agent |
| Gives the next agent enough durable context to continue safely |
Give a normal user a local packet |
| Creates and validates a browser-readable and agent-readable local packet |
Prove a real desktop client can use the kit |
| Separates local config checks from real GUI client evidence |
Move to another computer without Python |
| Creates runtime executables plus a copyable project/pack/runtime bundle |
Recover or audit state |
| Supports rollback, migration, and project health checks |
The Main Writing Flow
sequenceDiagram
participant A as Desktop Agent
participant K as Long Novel Agent Kit
participant S as .novel-agent
participant U as Author
A->>K: source-intake / add-source / add-research
K->>S: store confirmed evidence
A->>K: prepare-session chapter N
K->>S: read facts, rules, sources, chapters, debts
K-->>A: chapter-safe context and fingerprints
A->>A: draft chapter with native model
A->>K: check-chapter / chapter-readiness
K-->>A: continuity and contract issues
A->>U: deliver draft and known issues
U-->>A: accept or request revision
A->>K: record-chapter with author confirmation
A->>K: propose-after-write / proposal-readiness
K->>S: write audited accepted state when allowedThe important rule: generate context from durable state before writing. Do not treat chat history as the source of truth.
Read-Only Mode And Writer Mode
Read-only MCP is the default and recommended mode:
python server.py --read-only --tool-profile coreRead-only mode can prepare context, check drafts, build reports, inspect packs, and explain next steps. It cannot change .novel-agent/.
Writer mode can change durable state, so it is gated:
The author must confirm the write.
write-session-checkcompares project identity, state fingerprint, and chapter context fingerprint.Proposal readiness checks evidence, conflicts, and risk.
.write.lockprevents concurrent writes.Snapshots are created before applied proposal updates.
Every durable write appends to
audit.jsonl.
Desktop Packs
desktop-pack is the bridge between the kit and ordinary local desktop-agent usage.
It writes a local directory containing:
first-three.html,local-summary.html, anduser-steps.htmlfor a normal userpack-index.json,commands.json,commands-index.json, and schemas for an agentchapter-session.json,handoff-report.json, project status, continuity audit, and author review queuesetup, install, upgrade, uninstall, local check, and archive scripts for macOS, Windows, and POSIX shells
evidence templates and result JSON schemas for proving real GUI client behavior
acceptance review and writer-mode authorization packets
The pack is a local guide and snapshot. If it is copied or moved, run pack-doctor, pack-freshness, or rebind-pack-kit before trusting old paths.
No-Python Handoff
For non-technical users on another computer, build a same-OS standalone runtime first:
python cli.py standalone-build \
--output-dir release/long-novel-agent-runtime-macos-arm64 \
--target-os macos \
--apply \
--force \
--format jsonThen create a handoff bundle:
release/long-novel-agent-runtime-macos-arm64/long-novel-agent desktop-handoff-bundle ./my-novel \
--platform codex \
--mode read-only \
--chapter 1 \
--runtime-dir release/long-novel-agent-runtime-macos-arm64 \
--output-dir release/my-novel-agent-bundle \
--archive \
--force \
--format jsonThe bundle contains project/, pack/, runtime/, launchers, MCP snippets, runtime command files, and agent-read-me-first.md. When both runtime executables are present, the target computer does not need Python.
For a Windows .exe release, build on Windows and follow Windows Runtime Release. The GitHub Actions template is stored at docs/github-actions-windows-release.yml; copy it into .github/workflows/ only when the GitHub token used for the push has workflow scope.
Quick Start From Source
git clone https://github.com/mushroomfk/long-novel-agent-kit.git
cd long-novel-agent-kit
python cli.py doctor
python cli.py init ./my-novel --title "My Novel"
python cli.py prepare-session ./my-novel --chapter 1 --platform codex --mode read-only --format markdownCheck a draft:
python cli.py check-chapter ./my-novel --chapter 1 --file chapters/001.md --format markdownGenerate a desktop setup guide:
python cli.py desktop-setup ./my-novel --platform codex --mode read-only --format markdownWhat This Kit Does Not Do
It does not run an LLM.
It does not include embedding search.
It does not parse PDF/OCR/web pages by itself.
It does not upload manuscripts.
It does not require a server for local desktop use.
It does not replace literary judgment, editing taste, or author approval.
Those jobs belong to the host desktop agent and the author. This kit persists and verifies the continuity layer.
Repository Layout
.
├── cli.py # local CLI
├── server.py # stdio MCP server
├── install.py # local skill and MCP installer
├── SKILL.md # agent workflow instructions
├── schemas/ # JSON schemas for proposals and desktop packs
├── assets/review-panel.html # local static proposal review panel
├── examples/ # smoke, handoff, evidence, and adversarial examples
├── docs/ # architecture, install, workflow, and release docs
├── scripts/verify_agent_kit.py # full regression check
└── scripts/adversarial_release_check.pyVerification
Run the full regression suite:
python scripts/verify_agent_kit.pyRun the stronger release gate:
python scripts/adversarial_release_check.pyAn optional GitHub Actions workflow template is available at docs/github-actions-verify.yml. Repository maintainers with workflow scope can copy it to .github/workflows/verify.yml.
Requirements
Python 3.10 or newer for source-based CLI/MCP usage.
A local desktop agent that can start stdio MCP or run shell commands.
Optional: PyInstaller when building no-Python runtime bundles.
Supported Local Agent Paths
CLI-only agents can run
python cli.py ....MCP-capable agents can start
python server.py --read-only.Codex and Cursor local config paths can be generated automatically by
install.py.Claude Desktop and generic JSON MCP clients can use explicit config snippets.
Remote connector-only platforms are outside this local stdio MCP flow.
License
MIT. See LICENSE.
Available Tools
31 toolsbuild_agent_activity_reportC
Check whether target-visible desktop agent activity is specific enough for handoff. Read-only.
Inputs: project_dir (required), limit, format, chapter, +2 more.
build_agent_startup_promptB
Build a copy-ready read-only startup prompt for a local desktop agent starting or taking over a target chapter.
Inputs: project_dir (required), mode, format, chapter, +4 more.
build_author_review_queueB
Build a read-only queue of proposals, conflicts, writer-mode authorization, and chapter-range acceptance items that need author review before durable state changes.
Inputs: project_dir (required), mode, limit, format, +10 more.
build_chapter_acceptance_planB
Build a read-only post-acceptance write plan for one draft chapter, including pre-write review, author-confirmation gates, write-session guard guidance, and ordered writer commands.
Inputs: file (required), chapter (required), project_dir (required), format, +3 more.
build_chapter_contextC
Build chapter-safe context for the target chapter before writing or revising.
Inputs: chapter (required), project_dir (required), format.
build_chapter_context_briefA
Build only the compact read-first chapter context brief for small-context desktop agents.
Inputs: chapter (required), project_dir (required), format.
build_chapter_delivery_packetB
Build a read-only author delivery packet that combines draft metadata, chapter readiness, handoff report, gates, and post-acceptance commands.
Inputs: file (required), chapter (required), project_dir (required), format, +1 more.
build_chapter_readinessC
Build a read-only author-facing chapter acceptance readiness report from continuity checks and contract diff, including a revision_plan ordered for desktop agents.
Inputs: file (required), chapter (required), project_dir (required), format.
build_chapter_revision_comparisonB
Compare before and after draft readiness for a read-only revision report with resolved, new, and remaining issues.
Inputs: chapter (required), after_file (required), before_file (required), project_dir (required), +2 more.
build_chapter_revision_promptC
Build a read-only copyable revision prompt from chapter readiness, revision_plan, and fact_context for a local desktop agent.
Inputs: file (required), chapter (required), project_dir (required), format, +1 more.
build_desktop_diagnosticsC
Build a read-only local desktop-agent diagnostics report from project state, MCP config, desktop evidence, and optional pack health.
Inputs: mode, format, chapter, pack_dir, +6 more.
build_desktop_next_stepC
Build a read-only next-step decision report for a local desktop agent from project state, MCP config, desktop evidence, and author review queue.
Inputs: mode, format, chapter, platform, +5 more.
build_handoff_reportB
Build a handoff report and next-agent brief, including required workflow, startup commands, write boundaries, and pending continuity work.
Inputs: project_dir (required), chapter, include_context.
build_proposal_readinessC
Build a read-only readiness gate for a saved or inline post-write proposal before durable apply.
Inputs: project_dir (required), format, updates, proposal_id.
build_proposal_reviewC
Build a read-only author review packet for a saved or inline post-write proposal.
Inputs: project_dir (required), format, updates, proposal_id.
build_proposal_templateC
Build an empty post-write proposal template with chapter context and evidence requirements.
Inputs: chapter (required), project_dir (required), file.
check_chapterC
Check a chapter file against visible rules, future boundaries, character state, structured facts, timeline order, location, relationship, life state, and continuity obligations; returns issues plus a revision_plan.
Inputs: file (required), chapter (required), project_dir (required).
check_write_sessionB
Read-only preflight before writer tools mutate .novel-agent state. Checks project_id, project-state sha256, and optional target chapter context hash from prepare_chapter_session.
Inputs: project_dir (required), format, chapter, expected_project_id, +2 more.
diff_chapter_contractB
Compare a chapter file with visible required beats, acceptance checks, forbidden moves, and future markers.
Inputs: file (required), chapter (required), project_dir (required).
diff_proposalC
Preview which facts, characters, debts, and handoff fields a proposal would change.
Inputs: project_dir (required), updates, proposal_id.
doctorC
Check kit installation and optional project .novel-agent state health.
Inputs: project_dir, install_config, start_mcp_test.
explain_tool_visibilityC
Explain whether a local MCP tool is visible under read-only/writer mode and core/writing/full profile.
Inputs: tool_name (required), mode, format, tool_profile.
get_agent_templateC
Return host desktop agent workflow instructions for a local platform and write mode.
Inputs: mode, platform.
get_project_statusC
Summarize whether a .novel-agent project is ready for desktop-agent writing.
Inputs: project_dir (required), format, chapter, platform, +1 more.
get_proposal_schemaA
Return the JSON Schema for post-write proposal updates.
Inputs: no named parameters.
list_agent_activityC
List local desktop agent activity and handoff records.
Inputs: project_dir (required), limit, action, format, +2 more.
list_agent_capabilitiesC
List recorded host agent capability declarations.
Inputs: project_dir (required).
list_factsB
List active or all structured continuity facts, optionally filtered by chapter and kind.
Inputs: project_dir (required), kind, chapter, include_inactive.
list_open_threadsC
List visible unresolved plot debts, chapter contracts, conflicts, and the latest handoff.
Inputs: project_dir (required), chapter.
prepare_chapter_sessionB
Build a read-only startup packet for a desktop agent before drafting or revising a target chapter.
Inputs: project_dir (required), mode, format, chapter, +2 more.
validate_proposalB
Validate a post-write update proposal for evidence and conflicts before applying it.
Inputs: project_dir (required), updates, proposal_id.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 31 tools
Most tools have distinct purposes, but some overlap exists (e.g., build_agent_activity_report vs list_agent_activity, build_chapter_context vs build_chapter_context_brief). Descriptions help clarify, but agents may still confuse similar-sounding tools.
Tools use a mix of verb prefixes (build_, check_, diff_, list_, get_, etc.) without a single consistent pattern. While each subgroup is internally consistent, the overall naming lacks predictability.
31 tools is on the high side for a single server, but the domain (novel writing agent with chapter management, proposals, handoffs) is complex enough to justify the count. Some tools might be merged.
The tool set covers the core workflow: chapter readiness, proposal management, handoffs, diagnostics, and pre-write sessions. Minor gaps exist (e.g., no direct tool for writing content, but that is delegated to the agent via prompts).
Related MCP Connectors
Durable agent-to-agent handoffs and shared scratchpad for multi-agent workflows.
Project memory, documentation and controlled secret access for AI coding agents.
Persistent memory for AI agents. Hosted cloud connector or local Windows install.
Memory, reflection and safety for AI agents. Hosted or local, no vector database.
Related MCP Servers
- FlicenseCqualityDmaintenanceA multi-agent book-writing MCP server that manages a guarded chapter pipeline (writer → editor → third-pass agents → approve) with project planning, continuity tracking, and export/diff helpers.35-
- AlicenseAqualityCmaintenanceEnables AI tools to collaboratively write novels by managing chapters, characters, and story state through commands like validate, context, draft, review, and approve.8MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI-driven long-form novel creation and management, including chapter generation, character and timeline tracking, semantic memory retrieval, version savepoints, and deep consistency checking across multiple projects through MCP tools, with support for local LM Studio or any OpenAI-compatible API.16MIT
- AlicenseAqualityBmaintenanceEnables AI hosts to plan, draft, and check long-form novel chapters while honoring canon settings, character state, arcs, and check ordering, with approval-gated atomic commits. It keeps world, character, and chapter files as the human-editable source of truth, with snapshots and rollback for recovery.2717 npmApache 2.0