Margin

Long novels contradict themselves, and Margin is a self-hosted AI editor that reads the whole manuscript, catches the slips, and backs every answer with a quote from your own pages. Ask what color the inn door was in chapter 3 and each statement links to the passage that proves it. When the book is silent, Margin says so. Paste a new chapter, or pick a Google Docs tab, and every factual claim is checked against the rest of the book. Contradictions land side by side, your new line next to the earlier one. The worst-case cost shows first, and Margin asks before spending. A progress view charts words against your target and separates drafted chapters from outlines. It also counts words written this week and draws a chapter-length chart. A timeline lays scenes out in story order, each with the time words it rests on, and undated scenes wait under Not placed. A bible lists characters and places with quoted facts and the chapters that name them. Manuscripts load from Markdown, text, Word files, or a Google Doc with one tab per chapter. Re-ingesting reads only what changed. Margin never writes or rewrites prose. Every quote is checked word for word in code before it appears. Running on a dedicated VPS on RepoCloud with guaranteed CPU, RAM, and SSD, full root SSH access, and a browser serial console. MIT licensed.

Margin
Margin
Margin
Margin
Margin

Benefits

  • Answers backed by verified quotes
  • Every statement cites a passage from your own manuscript, matched word for word in code before display, and a question the book cannot answer returns Not in the manuscript.
  • Continuity slips caught before readers
  • Paste a chapter or a Google Docs tab and each factual claim is compared with the rest of the book; contradictions appear side by side with chapter and paragraph.
  • Manuscript stays on your server
  • Text and its search index live on your own machine; only the few passages a question needs go to the model, using your own Anthropic key.
  • See the whole book at once
  • Progress charts need no model calls, while the story-order timeline and the character bible are built only on request, after showing the cost.

Features

  • Hybrid keyword and vector search
  • Passages stored in Elasticsearch are ranked by BM25 and kNN, merged with reciprocal rank fusion, using BAAI/bge-small-en-v1.5 embeddings that run locally on ONNX CPU.
  • Claude structured answers
  • Anthropic Claude receives the question and the top eight passages as escaped data, then returns short statements with passage ids and exact quotes that code verifies.
  • FastAPI service and OpenAPI docs
  • A FastAPI service serves the web page, a server-sent events ask endpoint, status and ingest routes, and interactive OpenAPI documentation at /docs.
  • Google Docs and Word import
  • Reads Markdown, text, and .docx files, or a Google Doc with one tab per chapter through a read-only OAuth client you create, re-embedding only changed tabs.
  • Typer command line
  • A margin CLI offers ingest, ask, check, timeline, bible, progress, and Google sign-in commands, and Docker Compose starts Elasticsearch 8 plus the Margin service.
  • Published eval baselines
  • Each AI feature ships with a hand-run eval; baselines report 0.91 answer accuracy, 1.0 abstention, and 0.92 recall on 21 planted contradictions.

Apps Similar to Margin