smartwriter
A creative midwife for writers. Say what you want the piece and the chapter to be, and be questioned, given directions, read back against your own intent, or handed a draft you can take or leave. Then, on the page itself: highlight words and say how they should change, or right-click a gap and say what belongs there. By a model running on your own machine: nothing you write, intend or gather leaves the computer, the app works with the network off, and everything it keeps on disk is encrypted under a password only you have. If you write on two computers, cloud sync will carry a desk between them — optional, off by default, and sealed with that password before any of it leaves.
A Wails desktop app: Go backend, Svelte 5 frontend, and a local Qwen3.5 served by the model runtime every kumulativ app shares (kumulativ-core). It shares its stack and its “Maison” design language with smartreader and smartdiary.
What it does
Write. One measure of serif text on paper. The page is a rich-text
editor: bold, italic, underline, strike-through, headings, quotations and list
items, set from a small bar that appears over a selection or with the
shortcuts everyone already has (Ctrl+B/I/U, Ctrl+Alt+1/2/3 for headings,
Ctrl+Alt+0 for a paragraph, Ctrl+Shift+. for a quotation). Pastes arrive as
plain text with their paragraphs kept and their fonts left behind. Chapters
sit in a list on the left and can be added, reordered and removed. Everything
saves on a pause in typing; the bar says saved.
A piece. A new piece is given a title, a form — a book, a novel, a story, an essay, an article, a memoir, poetry, a script — and, if you know it yet, what you want it to be. It starts with one empty chapter, so you land on a page rather than on a button that makes one.
Locked. The app opens on a password. It encrypts everything smartwriter keeps on this machine: the pieces, the manuscripts, the intents, the sources and every conversation. See The lock.
Sync, if you want it. Connect a computer with a one-time code from your cloud userspace and your pieces follow you between your own machines, sealed with your password before they leave. Optional and off by default; the app has never needed an account and still does not. See Cloud sync.
Move the desk. Settings writes the whole desk — every piece, source and conversation — to one zip you can carry to another computer. It is exported still encrypted, so the file is exactly as private as this disk is, and the machine you open it on asks for the password this one uses. Importing merges: a piece on both sides is taken from whichever was written in last, one that exists on only one side is kept, and nothing is deleted. See Moving the desk.
Export. As a Word document, a PDF, or Markdown, from the Export button. The Word file carries real styles — Title, Heading 1 for chapters, Quote, List Paragraph — so Word’s navigation pane and style gallery work on it. The PDF is set in Source Serif 4 with a title page, one chapter per page break and page numbers.
Translate. The Translate button in the writing view turns the whole piece — every chapter, its title and what you said it is about — into another language, using the model on this machine. The result is a new piece on the desk beside the original, which is never written to; progress shows while it runs, you can keep writing meanwhile, and Stop keeps nothing. The manuscript goes through the model in numbered batches of paragraphs, and a batch the model gives back short is asked for again paragraph by paragraph; anything still missing keeps its original words and is counted in a notice. Read the result as a first draft in the new language.
Check spelling and grammar. The Check button reads the whole piece for misspellings, slips of grammar and punctuation. It runs only when you ask, never by itself, and what it finds is a list of suggestions on the panel’s Corrections tab — the words as written, what they should read, and why. Each one is Take it or Leave it, or take them all; a suggestion is placed by looking for its words again, so a paragraph edited since the check reports them gone rather than changing the wrong ones. Nothing on the page changes until you take a suggestion.
Say what you want. This is the point of the app, and it works two ways.
The brief is what you say the writing is to be, and it is stated once and kept:
| Level | Where it is set | What it is for |
|---|---|---|
| The piece — named as you named it: the novel, the essay | Its settings, at the top of the chapter list, with the title, author and form | The premise, the reader, the register, what it should leave behind |
| Chapter | The settings beside each chapter in the list | What this chapter is about, and has to do for the whole |
Each of those settings has three faces: About (the statement above), Sources (what has been gathered for that one place — see below), and Midwife, where the conversation about the piece or the chapter is held.
On the Midwife face, with an intent stated (or not — she will ask for it), four things can be asked:
| Ask | What comes back |
|---|---|
| Ask me | Probing questions that draw out what you mean, without answering them |
| Suggest | Three or four concrete directions the piece or the chapter could take |
| Read back | What is already working, quoted, and exactly where the text parts company with the intent; then the changes that would matter most |
| Draft | The next paragraph or two of the chapter in its own voice, or — for the piece — an outline. Insert it at the end of the chapter, or copy it |
The page is the other way, and it needs nothing stated in advance. The right-hand panel exists for this alone: it is closed until you take one of two gestures, and goes again when the work is done.
| Gesture | What happens |
|---|---|
| Highlight words | The bar over them offers Rewrite… — which hands them to the panel, where you say how they should change (“tighter”, “colder”, “in her voice”, or nothing at all) and press Enter — and Other ways, which asks at once for three alternatives, each one a click to use |
| Right-click | On highlighted words: rewrite them, ask for other ways, or ask about them. On a bare point in the text: Write something here…, where you say what belongs in the gap |
What comes back appears in the panel, never on the page: a draft in a box you can edit before you take it, alternatives as a list of buttons, and a prompt that takes the work further — shorter, keep the second one, now in her voice — each answer made in the light of the last. Nothing touches the manuscript until you press Replace the words or Put it here.
The words the panel is working on keep a wash of colour on the page after your selection has gone, and a point you asked to have filled carries a dot in the margin. Both are paint rather than markup — the page’s DOM is exactly what you typed — so they never catch the caret.
Plus a free question about whatever is in focus. Conversations about the brief are kept against it: come back to a chapter a week later and the panel shows what was asked and said, and a follow-up is answered in the light of it. Forget this drops one. Work on a passage is not kept — it lives in the panel while you decide, and ends when you take it or leave it. A manuscript’s history is the manuscript.
The midwife’s manner — gentle, direct or rigorous — is a setting. What she knows is the same either way: what you said the piece and the chapter are to be, the chapter so far (whole when it fits, otherwise the paragraphs around where you are working), what the other chapters are and do, and the sources.
Sources. A source belongs to the whole piece or to one chapter. The piece’s own settings hold the sources the midwife may draw on from anywhere; a chapter’s settings hold the ones she sees only while working in that chapter — the research behind one scene, the paper one section argues with. A source can be moved between them from its card, and a deleted chapter’s sources go back to the whole rather than being lost. Add PDFs, EPUBs, Word files or plain text — from the the settings, the Sources screen, or by dropping them on the window (which gives them to the whole). Each one is read once, in the background, and summarised section by section and as a whole (the same pass smartreader’s Study this makes, with the same right-of-way rule: a question you ask cuts the summarising short, and it resumes after). When you ask about the piece or a chapter, the midwife is shown every source’s summary; when you work on a passage or a point, she is shown the passages of your sources that bear on it, found by lexical retrieval (BM25 over paragraph-sized chunks) from what you wrote there and what you asked for. She is told to name the source she draws on and never to invent what one says.
Cloud sync
Off by default, and not needed. smartwriter works on one machine with the network off, and the export below moves a desk by hand. This is for people who write on two computers and would rather not.
Settings → Cloud sync connects this computer to an account on
cloud.kumulativ.com. The connection is per machine and
has to be made from the account’s own userspace: a one-time code appears there,
lasts ten minutes, and is typed in here with the email address. Approval is by
hand — an account exists only because somebody let it.
What leaves is sealed under your password first. The service stores a revision, an edit time and a checksum per item, and a blob it cannot open; the lock profile travels with it, because without the salt no second machine could ever derive the key. Your password is not in it and never reaches the server.
The unit is a whole piece — the entry in the index and the manuscript beside it, sealed together, because they are only ever true about each other. Syncing them separately would let a machine hold a chapter list saying four chapters and a manuscript with three. Sources travel with their summaries, which saves the other machine an hour of reading. Settings do not travel: a type size describes a screen, not a manuscript.
When the same piece is edited on both machines between syncs, the later edit wins and the earlier is replaced. There is no merge, deliberately — a desk is not a git repository, and a merge nobody asked for produces text nobody wrote.
Connecting a second computer requires the password the first one uses, because a desk has one data key and the second machine has to derive the same one. Revoking a machine from the Machines page stops it at its next attempt; disconnecting from Settings does the same from this side. Either way the desk on disk is untouched.
Moving the desk
Settings → Moving the desk writes a .zip and reads one back. Nothing is
decrypted to make it: the archive is the sealed files exactly as they sit on
disk, plus profile.json — the salt, the KDF parameters and the wrapped data
key, which hold no secret — plus a manifest naming the app and the format
version.
manifest.json app, schema, when, how many pieces and sources
profile.json how to unwrap the key, given the password
data.enc the index
projects/<id>.enc one piece's chapters and paragraphs
sources/<id>.enc one source's extracted text
sources/<id>.study.enc its summaries
Importing asks for the password the source machine used. That is not a quirk of the format, it is the consequence of never having decrypted anything: every profile has its own random salt and its own random data key, so two computers hold two different keys even when the same password was typed into both. An archive exported from the machine you are importing on — a backup being restored — needs nothing typed.
The merge is per item and conservative:
| Pieces | The later updatedAt wins; a piece newer here is left alone |
| Sources | Added if this machine has never seen them, with their summaries |
| Conversations | Added if new; never edited in place |
| Settings | Not merged — they describe this machine’s screen, not the work |
Updates
smartwriter knows its own version and looks, a few seconds after launch and
once a day while it runs, whether a newer one has been published. The look is
one GET of a small public file — smartwriter/latest.json on the releases
bucket — with nothing about you or this computer in the request. It happens
before the desk is unlocked, because it needs nothing from the desk. Settings
has a switch to turn the automatic look off, and a button to look by hand.
When there is a newer version, a card in the corner says so, with what changed. Update downloads the installer and checks it against the SHA-256 the manifest carries; then — on Windows — Restart to update starts the installer silently and quits: the installer waits for the process to be gone, replaces the files, and opens the new version (Windows asks permission once). On macOS the disk image opens and the drag to Applications is yours. Not now hides the card until the next launch; Skip this version in Settings hides that version for good. Nothing on the desk is touched by any of this.
Where things live
<UserConfigDir>/smartwriter/
profile.json the salt, the KDF parameters and the wrapped key
data.enc settings, the pieces, the sources, the conversations
projects/<id>.enc one piece's chapters and paragraphs
sources/<id>.enc one source's extracted text
sources/<id>.study.enc its summaries
<UserConfigDir>/kumulativ/ shared with every kumulativ app — see kumulativ-core
models/ the Qwen weights, one copy for every app
engines/ the llama.cpp build for this machine
run/ the one running server: registry, lock, presets
Environment variables
| Variable | Effect |
|---|---|
SMARTWRITER_CONFIG_DIR |
Move the whole data directory (portable install, tests) |
SMARTWRITER_GGUF |
Use this .gguf and download nothing |
KUMULATIV_HOME |
Move the shared model store |
KUMULATIV_BIN_DIR |
Look for llama-server here first |
KUMULATIV_IDLE_UNLOAD_MIN |
Minutes of quiet before the model is put to sleep (default 1; 0 = never) |
KUMULATIV_LLAMA_ASSET / KUMULATIV_LLAMA_RELEASE |
Pin a specific llama.cpp release asset |
KUMULATIV_LLAMA_EXTRA_ARGS |
Extra flags for the llama-server command line |
KUMULATIV_FORCE_CPU |
Never use the CUDA build |
KUMULATIV_NO_ENGINE_FETCH |
Refuse to download an engine |
KUMULATIV_DEBUG |
Forward the server’s output instead of swallowing it |
The lock
Everything above is encrypted on disk, under a password that exists nowhere but in your head. It is smartdiary’s lock, unchanged in substance, because the two apps guard the same kind of thing — what somebody writes when they are not writing for anybody yet.
- The password does not encrypt the manuscript. It is stretched with Argon2id (64 MiB, 3 passes) into a key that unwraps a random 32-byte data key, and that key encrypts every file with XChaCha20-Poly1305. Changing the password rewraps 48 bytes instead of re-encrypting a novel, and a change interrupted halfway cannot leave the desk half-readable.
profile.jsonholds no secrets — a salt, the KDF parameters and the wrapped key — so it is safe to back up or sync.- Locked means locked. Until you unlock, the backend holds no key, no index and no manuscript: the lock screen is not a curtain over a rendered app, there is nothing behind it. Lock now in Settings drops the key and the open chapter together and stops anything the model was doing with them.
- Remembering this machine puts the data key — never the password — in the OS credential store: macOS Keychain, Windows Credential Manager, or the Secret Service on Linux. Forget this machine removes it and the next launch asks again.
- There is no reset. Nothing about the password leaves the computer, so nobody can recover it for you.
A desk written before the lock existed is converted when you set your first password. Every file is encrypted and read back before a single original is removed, so an interruption leaves every plaintext file exactly where it was — and the password with it, so the next launch offers to set one again rather than asking for one that opens half a desk.
How it is put together
The page is the DOM
The editor is one contenteditable element whose children are the chapter’s
paragraphs, each carrying its id in data-block. The browser does the
editing; after every input editor.ts reads the DOM back into Para records,
reducing the markup to five inline tags (strong, em, u, s, br). A paragraph the
browser clones (Enter in the middle of one copies its attributes) keeps its id
on the first half and gets a fresh one on the second, so an id always names the
same words. The Go side makes the same reduction again on save
(richtext.go) and derives the plain text from the reduced markup.
A highlighted passage is held as two ids and two offsets — from start in one
paragraph to end in another, which are the same paragraph inside one — and a
point of insertion as an id and an offset. Offsets are UTF-16 units, because
JavaScript is the one counting. Because they are anchored to ids rather than to
DOM nodes, editing elsewhere in the chapter leaves them alone; a paragraph that
is deleted takes its focus with it, and the panel falls back to the chapter.
The focus is drawn with the CSS Custom Highlight API — a range the browser
paints over, not an element — so the DOM stays exactly what was typed and the
offset invariant (text nodes in order, one \n per <br>, concatenate to the
paragraph’s text) never depends on a wrapper staying put.
Putting what the midwife wrote onto the page is one manoeuvre, used three times: whatever stood after the point is lifted out of its paragraph, the new paragraphs are laid down, and it is put back on the end of the last one. That is what makes a rewrite of half a sentence join up with the half that was left, a passage that ran across two paragraphs come back as one, and a paragraph asked for in the middle of another leave a whole paragraph on either side.
The prompt
prompts.go builds every message. One system message carries the midwife’s
standing instructions and the whole context from the general to the
particular: the piece and its intent, an outline of the other chapters, the
chapter in focus and its intent and text, then either the highlighted words
(with the paragraph they sit in, when they are only part of one) or the text
either side of the point, then the sources. Then the conversation so far as
user/assistant pairs, then one imperative for the mode and level.
Context goes in the system message on purpose: the history clamp trims from
the oldest non-system message, and the text must be the last thing to go.
Retrieval
sources.go cuts each source into chunks of about nine hundred characters on
paragraph boundaries and scores them with BM25 against a query made of the
question, the intents and the text in focus (the highlighted words, or what
stands either side of the point). A chunk has to meet the query on
at least two terms to count. It is lexical on purpose: exact, instant, no
second model beside the one that writes, and explainable when it misses.
Known limits
- The midwife drafts in the voice of what is on the page. An empty chapter with a one-line intent gets a generic opening; the more you have written and said, the better she reads you.
- Retrieval is by words. A source that says the same thing in different words is not found for a passage; its summary still reaches the midwife at piece and chapter level.
- The right-click menu replaces the browser’s own, and with it the spell-checker’s suggestions. Corrections are still offered by the underline itself in most webviews.
- Scanned PDFs need OCR first, and PDFs with broken font maps are refused, as in smartreader.
- The PDF export does not justify and does not hyphenate; the Word export leaves that to Word.
- Translation and checking are slow on a local model. A novel goes through in batches of a couple of thousand characters, each a request to the model; the bar says where it is, and both can be stopped. The proofreading pass reports only what it can quote exactly from the page, so it misses things a dedicated checker would catch, and a translation is a draft.