manuscript-lab
v3.0.0
Published
Local CI for prose: section contracts, checks, typed reviews, an issue ledger, an evidence spine, and release gates for long-form writing — a zero-dependency CLI and MCP server shared by humans, agents, and CI.
Maintainers
Readme
Manuscript Lab
Manuscript Lab is local CI for prose.
It gives long-form writing what software takes for granted: section contracts, checks, typed issues, revision trails, an evidence spine, and release gates — all in plain files in your repo, driven by a zero-dependency Node CLI that humans, agents, and CI jobs can share.
Sixty-Second Start
Requires Node.js 18 or newer. No runtime dependencies.
Start clean:
npm install -D manuscript-lab
npx mlab initOr adopt a manuscript you already have:
npx mlab adopt existing-draft.mdThen:
npx mlab status
npx mlab report --writeinit scaffolds a contracted workspace: manuscript-lab.config.json plus a
manuscript/ root with section contracts, state directories, and source/claim
registers (customize with --profile, --root, --title). adopt copies
every markdown file into contracted draft/ sections without modifying or
moving your originals.
Expect a freshly adopted draft to report blockers — that is the point. Short
imported sections sit below the word floor, claims have no sources yet, and
every imported contract starts confirmed: false with a provisional purpose
inferred from the text: reviewing each section's purpose and acceptance, then
flipping the flag to confirmed: true, is the one judgment step adopt cannot
do for you. The report names each gap and the exact command or edit that
closes it, so "not ready" is a work list instead of a shrug.
What You Get
Section contracts: each
draft/*.mdopens with a machine-checked contract (status, target words, purpose, acceptance, checks, reviews).Checks:
mlab checkruns deterministic document checks;mlab check --fixcreates any missing required scaffolding and rebuildsstate/status.md/outline.mdfrom the section contracts — statuses restated, deleted sections dropped, new sections added — then re-checks.Typed issues: reviews write durable work items to an issue ledger instead of advice that disappears in chat. Projects can register their own typed review lenses and prompts under the manuscript root;
mlab review listshows the merged built-in/project catalog.mlab issues batchapplies many decisions/closures from JSON or JSONL in one validated, locked transaction.Candidate trails: high-stakes revisions run as candidates, blind comparison, taste gate, merge winner, diff audit — never a silent rewrite.
Evidence spine: claims, sources, and citation markers share one implementation across
claims,citations,evidence, and the gates, with stableevidence.*requirement ids.Gates:
section-ready,citation-ready,manuscript-ready, andexport-readydecide readiness from evidence, not vibes. Sections markedtodoblock, prose below 33% of a section's target word count blocks, and applicable declared reviews warn when they have never completed or no longer match the section body and review definition.Reports with fix commands: every blocker in
mlab report(terminal, JSON, HTML) carries the command that addresses it. Advisory review gaps are shown separately with exactmlab review run ... --passes ...commands. For example:Blockers: - claim_unresolved: Claim "Documentation teams recover forty percent of review time after adopting local prose CI." is unsupported with unspecified risk and blocks release. fix: mlab claims list --unsupportedExport manifests:
mlab exportwrites Markdown and HTML by default plusexports/manifest.jsonwith input/output hashes. EPUB and PDF are explicit opt-ins (--formats md,html,epub,pdf); EPUB needszip, PDF needspython3with thereportlabpackage.Narrative observations: bare
mlab narrativebuilds the manuscript convergence profile; its subcommands extract a cached structural template per section, derives discourse-level observations (how meaning, emotion, time, and resolution are handled), checks them against declarednarrative_*contract intents, diffs candidates structurally, and reports manuscript-wide convergence — advisory craft diagnostics for the narrow repertoire model-assisted drafts drift into, never an "AI score". Seedocs/NARRATIVE.md.
The full command reference is docs/COMMANDS.md.
For Agents
Agents are the primary distribution surface. The fastest hookup is MCP:
claude mcp add manuscript-lab -- npx mlab mcpmlab mcp is a zero-dependency MCP server over stdio that exposes the
protocol as typed tools with safety annotations. Claude Desktop and Cursor
snippets, exposure flags (--read-only, --all-tools, --root), and the
generated tool table live in docs/MCP.md.
AGENTS.md is the standing contract for agents working in a Manuscript Lab
repo. Codex users can install the repo's Codex skill with
npm run codex:install-skill (see docs/CODEX_SKILLS.md). A GitHub Action
for running reports in CI is documented in docs/CI.md.
The Lab
Generation and orchestration features — writers' room, the Chorus line lab,
practice benchmarks, the model driver, eval snapshots, artifact inspection,
and the golden path — live under mlab lab (mlab lab --help lists them; the
old top-level names still work as aliases). They are contained R&D, not the
product promise: they write their evidence under state/, they never silently
rewrite drafts, and a lab feature graduates into the core surface only when a
real case study beats a solo frontier-model baseline on a real project. Until
then, the protocol is the product and the lab is where we try to earn the next
piece of it.
Does It Work
We test the core claim on ourselves. The first inward case study
(docs/CASE_STUDY_HARNESS_VS_DIRECT.md) ran the same model over four
contracted sections three ways: a direct pass, direct plus self-revision, and
the mlab loop. The mlab loop was the only arm to produce four gate-ready
sections; the direct pass shipped one of four, leaving TODO placeholders and
a literal [citation-needed] in finished prose that the harness sensors
caught. Blind judges leaned toward the harness drafts (9–6 and 10–6) but
within judge noise — the honest headline is 4/4 versus 1/4, at roughly 5x the
generation tokens. Raw drafts, every judge vote, and the runner are in
evals/case-studies/2026-07-harness-vs-direct/.
Fixtures
Two public fixtures demonstrate both ends of the workflow:
examples/technical-whitepaper: a complete project that ends green —validate,check --static-only,gate manuscript, andreportall pass, with an accepted issue, candidate run, diff audit, and export manifest kept as revision-trail history.examples/broken-whitepaper: deliberately red. Its README lists every expected blocker and thefix:command each one carries, so you can see the failure UX without breaking your own project.
Fastest demo from a clone:
cd examples/technical-whitepaper
../../bin/manuscript-lab.mjs validate
../../bin/manuscript-lab.mjs report --writeModel Providers
The core workflow is deterministic and needs no API keys. Model-backed checks,
reviews, and lab commands route through scripts/lib/model-provider.mjs,
which supports OpenRouter, Lightning AI, and custom OpenAI-compatible
endpoints. Copy .env.example to .env for keys and never commit .env.
See docs/MODEL_PROVIDERS.md.
Project-specific review charters do not need to be added to the package. Point
reviews.suite in manuscript-lab.config.json at a suite under the manuscript
root, keep its prompts there, then use those IDs in section contracts. The
suite merges with built-ins; collisions and path escapes fail validation. See
docs/FILE_PROTOCOL.md and inspect the result with mlab review list.
Successful review runs record target-body, target-file, pass-definition, and
registry fingerprints. Gates use those artifacts to distinguish “no review has
run,” “the latest successful review is stale,” and “completed reviews have no
persisted errors.” Coverage and freshness warn by default, including for
keyless projects using --mock-response. A release profile can make them
blocking:
{
"gates": {
"profiles": {
"release": {
"reviews": {
"declared_have_run": "block",
"declared_fresh": "block"
}
}
}
}
}Docs
docs/COMMANDS.md: full command reference, aliases, npm-script mappingdocs/GETTING_STARTED.md: first-project walkthroughdocs/MCP.md: MCP server setup and tool catalogdocs/CI.md: GitHub Actions workflow and the composite actiondocs/GATE_ENGINE.md: readiness gates and result formatdocs/EVIDENCE_SPINE.md: claims and sources designdocs/ARCHITECTURE.md: layers and file boundariesdocs/FILE_PROTOCOL.md: project layout and config protocoldocs/PRODUCT_STRATEGY.md: the decision of record and roadmap
License
MIT. See LICENSE.
