Inkhaven (blackInkhaven)
Inkhaven is a standalone terminal application for writing books and long-form technical documentation. It pairs a full-screen Typst editor with a local semantic index, an AI writing assistant, versioned snapshots, and a backup pipeline — so the entire writing workflow lives inside one binary, without leaving the terminal.
Your manuscript is organised as a hierarchy of .typ files
(Book → Chapter → Subchapter → Paragraph), with first-class
image (.png / .jpg / …), HJSON data (.hjson), and
Bund script (.bund) leaves alongside paragraphs. Inkhaven
stores metadata in a local DuckDB database, indexes every text
node for full-text and semantic search, keeps versioned
snapshots, embeds the Bund
scripting language for hooks + custom rules, and streams answers
from your chosen LLM provider — six are bundled (Gemini,
Claude, OpenAI, DeepSeek, Grok, Ollama) and any
model genai routes is
one HJSON line away.

Latest release · 1.2.9 — Prose-craft tools for novelists
Read the full notes: Documentation/RELEASE_NOTES/1.2.9.md
1.2.9 turns inkhaven from a book editor into a book editor that audits your prose while you write it. Nine new features, all keyed to the same writing-craft idea: catch the mechanical weaknesses (drone, telling, hedging, lexical ruts) inline, while the words are still soft, instead of discovering them at revision time.
The headline overlays — always-on, zero latency:
- Filter-word highlight (
Ctrl+B Shift+F). Underlines intensifier crutches and hedges:just,really,very,seemed,felt, plus the Russian / French / German / Spanish equivalents. Snowball-stemmed soseemed/seems/seemingall flag the same way; per-language HJSON lists are user-extensible.inkhaven doctor --filter-words-snippetdumps the built-in lists ready to paste. - Repeated-phrase detector. Slides an
n-word window across the paragraph (defaultn=4, threshold3), stems each window, flags every occurrence of any n-gram that repeats —lifted her shouldersmatcheslifting her shoulders. Multilingual stop-word filtering keeps closed-class noise out. Shares theCtrl+B Shift+Ftoggle with filter-words. - Show-don't-tell flag. Catches three telling patterns
(copula + emotion adjective, manner-of-emotion adverbs,
cognition verbs) in soft teal.
was angryflags both tokens;realisedflags itself;was runningcorrectly does not flag. Stemmed. Pairs with an AI-driven scan (Ctrl+B Shift+T) that sends the paragraph to the configured LLM and asks for telling phrases plus concrete rewrites.
The headline modals + chips — on-demand prose audit:
- Concordance view (
Ctrl+B Shift+L). Project-wide: every distinct lexical stem ranked by occurrence, with KWIC samples per row. Snowball-grouped (sowalk/walked/walkingcollapse), stop-word filtered. Type to filter;Ctrl+Stoggles count ↔ alphabetical sort. Useful for noticing what your real voice actually is. - Sentence-rhythm gauge (
Ctrl+B Shift+H). Splits the open paragraph into sentences, computes word-count mean / stdev / coefficient of variation, maps CV to a verdict (MONOTONEred /STEADYyellow /VARIEDgreen /CHOPPYcyan). Per-sentence bar chart + three-shortest + three-longest outliers. Inspired by Gary Provost's "this sentence has five words" parable — measures the drone, in numbers. - POV / character chip (
Ctrl+B Shift+P). Status-bar chip showing the most-mentioned character in the open paragraph (the heuristic POV) plus the supporting cast. Driven by the existing characters lexicon — no separate tagging. Catches POV drift mid-scene. - Writing-streak heatmap (
Ctrl+B Shift+G). GitHub- style 13×7 grid of the last 91 days of word activity, with current streak + longest streak + active-day average. Tracks habit, not just total output. - Scene-break navigation (
Ctrl+B </Ctrl+B >). Jump cursor between typographic dividers (* * *,***,---,___,###,~~~,§) inside the open paragraph.
And the headline new accessibility surface:
- Text-to-speech read-aloud (
Ctrl+B S). Speaks the open paragraph through the host OS's TTS engine. Provides the ear feedback that catches what the eye glides over.Ctrl+B Shift+Rsaves the paragraph as an audio file (.aiffby default; macOSsay -opipeline). Configurable voice + speed + greeting + goodbye in HJSON.
Plus six new tutorials (38–43); updated KEYBINDING,
CONFIGURATION; inkhaven doctor --voices lists installed
TTS voices, --tts-test exercises the pipeline end-to-end,
--filter-words-snippet dumps the built-in style-warning
lists.
Every prior release lives under
Documentation/RELEASE_NOTES/.
Why Inkhaven
- Terminal-first. Inkhaven runs over SSH, in tmux, on a tiling WM — no browser, no Electron. The TUI uses ratatui and tui-textarea.
- Your manuscript is plain files. A paragraph lives in a
.typfile on disk; the metadata database tracks hierarchy and search but the prose is text — you can read it, diff it, version-control it, and edit it with another tool any time. - Semantic search out of the box. Embeddings via fastembed and HNSW are computed locally. Search for "the moment the lighthouse fails" and find the paragraph even if it never uses those exact words.
- AI is a co-author you steer. Inferences stream live; you control the
scope (selection / paragraph / subchapter / chapter / book), the
mode (Local-only RAG vs. Full general knowledge), and the
destination (replace, insert, top, bottom, copy, grammar-apply).
Inkhaven does NOT provide inherent privacy when external providers
(Gemini / Claude / OpenAI / DeepSeek / Grok) are used — prompts
travel to their servers under their terms. For privacy, set
llm.default_provider: "ollama"and run a local model; every other inkhaven subsystem (RAG embedding, semantic search, snapshot diff) is already on-device. - Multilingual. Snowball stemmers and multilingual embeddings make Russian, German, French, Spanish, Italian and others first-class. The shipped defaults cover English and Russian.
- Help, characters, places, artefacts, scripts — built in. Nine
system books are seeded on every project:
Notes,Research,Prompts,Places,Characters,Artefacts,Typst,Scripts,Help. Mentions of names from the lexicon books light up in the editor (cyan / amber / peach / underline).Ctrl+B P/C/Y/Gquery each via RAG.F1answers questions about Inkhaven itself by RAG overHelp.Scripts(added in 1.2) holds.bundsource files auto-loaded into the embedded Bund scripting VM at project open — seeDocumentation/Bund/. - First-class images. Drop PNG / JPG / WebP / SVG into the tree;
Book assembly emits the right
wrap_image_*calls and ships the bytes into the typst tree.Ctrl+B Pinside#image("…")opens a sibling picker. Enter on an Image row pops a ratatui-image preview (kitty / sixel / iterm2 / half-block). - From buffer to PDF in two chords.
Ctrl+B Aassembles your tree into a typst-compilable directory;Ctrl+B Bcompiles it;Ctrl+B Obuilds and copies the PDF into your shell's cwd as<book>-YYYYDDMM-HHMM.pdf. Compile failures route the captured stderr into a fresh AI chat with a typst-aware system prompt.
Features at a glance
Editor
- Typst syntax highlighting via tree-sitter-typst.
- Regex find / replace with same-line current-match highlighting.
- Split-edit with versioned snapshots — see two versions of a paragraph side by side, accept either.
- Word-aware navigation and deletion shortcuts.
- Vertical block selection (Alt+arrows) with rectangular copy.
- System-clipboard cut / copy / paste, plus per-doc undo / redo.
- Live "changes since last save" bolding; grammar-correction highlights
what changed after a
gapply.
Tree
- Multi-level folding (
←/→/Z/X). - Per-kind row colours (book / chapter / subchapter / paragraph / image)
- open-paragraph marker.
- Plain-letter shortcuts for add (
B/C/V/A/S/+/P), delete (D/-), reorder (U/J). - Document status badge column — one character per row colour-
coded to the workflow stage (
n/1/2/3/F/R). - Mouse: click to focus + select; scroll wheel scrolls.
AI pane
- Streaming markdown rendering — bold / italic / headings / code / lists.
- Six scope modes (cycled by
F9): None, Selection, Paragraph, Subchapter, Chapter, Book — each prepends the matching content to the next prompt. - Two inference modes (
F10): Local (use only supplied context) and Full (augment with general knowledge). Help inferences are pinned to Local automatically. - Persistent chat history with one-key clear (
Ctrl+B C). - Full-screen AI layout (
Ctrl+B K) — AI pane + scrollable chat history + AI prompt; persisted to.inkhaven-chat.jsonbetween sessions;Ctrl+Fsearches;Ctrl+Centers a turn-selection mode. - Lexicon RAG —
Ctrl+B P/C/G/Yin the editor sweep the selection throughPlaces/Characters/Notes/Artefactsand prepend the lookup to the next AI prompt. - F1 Help-manual floating query → grounded answer over the Help book.
inkhaven import-typst-helpseeds Help with a curated typst reference. - F7 Grammar check with deterministic correction extraction (
greplaces the buffer with just the corrected text, preserving Typst markup).
Storage and backup
- DuckDB metadata + Tantivy full-text + HNSW vectors via bdslib.
- Snapshots:
F5captures the buffer;F6opens the snapshot history picker. inkhaven backup --out <dir>zips the entire project.inkhaven restore <archive> --to <dir>puts it back.- Auto-backup on TUI exit when the last backup is older than
backup.max_age(humantime:7d,12h,30m, …) — splash screen with a progress bar. - Session persistence: cursor position, focus, tree-scroll, open paragraph all survive restarts. Per-paragraph cursor memory: switch around and every paragraph remembers where you were.
CLI tools
init— set up a fresh project (interactive confirmation if the directory exists).add/delete/mv/list— manage the hierarchy from a script.search "phrase"— semantic search from the shell.reindex— re-walk.typfiles into the database.export typst/export pdf— produce a single Typst manuscript or a built PDF.import-help --documents-directory <dir>— populate the Help book from a directory of markdown / text / typst files (wipes Help first).backup/restore— see above.ai "prompt"— one-shot inference from the shell (no TUI).
Configuration
A single inkhaven.hjson in each project root drives every knob:
embedding model, LLM providers, autosave cadence, sync interval, hierarchy
depth, language, snowball stemmers, the full visual theme (per-pane
backgrounds and foregrounds, all syntax colours, lexicon highlight
colours), key bindings, and backup policy.
Install
Inkhaven ships as a single static binary per platform. Three install paths:
1. cargo binstall (no compile)
If you already have cargo-binstall:
cargo-binstall reads [package.metadata.binstall] from Cargo.toml,
picks the right asset off GitHub Releases, and drops the binary into
~/.cargo/bin. Works on Linux (x86_64), macOS (Intel + Apple Silicon),
and Windows (x86_64).
2. GitHub Releases (direct download)
Grab the tarball for your platform from
Releases, unpack,
and put inkhaven somewhere on your PATH. Builds are produced by
the release.yml workflow on every
tag push.
3. cargo install --git (compile from source)
This works because every dependency (including bdslib and
tree-sitter-typst) is vendored under vendor/ — no separate registry
fetches, no GitHub auth needed. The first build takes ~10 minutes on a
modern laptop because of DuckDB + Tantivy + fastembed compilation; the
release binary above is the fast path.
Inkhaven is not published on crates.io. See
Cargo.toml'spublish = falseline and theDocumentation/notes for the rationale.
Quick start
# Build (if installing from source)
# Initialise a project (asks for confirmation if the directory exists)
# Build the hierarchy from the CLI…
# …or skip the CLI and add everything from the TUI
# Inside the TUI: B (book), C/V (chapter), A/S (subchapter), +/P (paragraph)
Use cases
- Long-form fiction. Hierarchy fits novels naturally (Book → Part → Chapter → Scene). Places / Characters / Research system books keep worldbuilding next to prose.
- Technical documentation. Each chapter is a
.typfile; the tree doubles as a table of contents. Semantic search makes "where did I document the retry policy?" a one-keystroke question. - Translation work. Multilingual embeddings + per-language Snowball stemmers let you keep source and target in two parallel books.
- Research notebooks. Snapshots track how a draft evolved; the AI pane can summarise a chapter when you come back after a week.
- Help and onboarding writing. Ship docs as a directory and let Inkhaven build a Help book your readers can query through F1.
Documentation
The full docs live under Documentation/.
Start here:
Documentation/README.md— entry point and table of contents.Documentation/FIRST_STEPS.md— compile, install, initialise.Documentation/Tutorials/— narrative walk-throughs, each focused on one workflow.
Reference:
Documentation/KEYBINDING.md— every keystroke the TUI recognises, organised by pane and overlay.Documentation/CONFIGURATION.md— the full HJSON reference.Documentation/MAINTENANCE.md— backup, restore, reindex, logs.Documentation/PROMPTS.md— the prompt library and the Prompts system book.Documentation/LOCATIONS.md— managing Places.Documentation/CHARACTERS.md— managing Characters.
Built with
- bdslib — DuckDB + Tantivy + fastembed + HNSW document store
- ratatui, tui-textarea
- tree-sitter + tree-sitter-typst
- genai — provider-neutral LLM streaming
- pulldown-cmark,
rust-stemmers,
zip,
humantime, and many others —
see
Cargo.toml.
Licence
Apache 2.0 — see LICENSE.