zennotes / terminal / docs v0.12.2

ZenNotes CLI & TUIThe terminal manual.

From your first note to a workspace that feels like home. Learn the app, look up a command, or put your notes to work in a script.

01 / GET STARTEDWrite your first note 02 / FIND YOUR COMMANDStraight to the reference
v0.12.2

This guide covers ZenNotes CLI 0.12.2. Upgrading from v0.5.0 or earlier? Use Homebrew, Go, or a fresh archive once: those versions do not have zn update. From ZenNotes desktop 2.60.0, a desktop-managed copy updates itself to each new signed release. Choose your installation path.

Your first vault

A vault is a folder of Markdown files. No account is needed for local notes. The same zn binary gives you a command-line tool, an interactive terminal app, and an MCP server.

Your first five minutes
brew install zennotes/tap/zn
zn init ~/Notes
zn create --title "First thought" --body "A little space to think."
zn tui
  1. Find a note. Press Ctrl+P, type part of its title, and press Enter.
  2. Start writing. Vim is enabled by default: press i to insert, then Esc for Normal mode. Prefer a plain editor? Open :settings and turn Vim off.
  3. Save and leave. Notes autosave; Ctrl+S saves immediately. Press Esc, type :qa, then Enter to save all and quit. :q closes the current tab.

Already have notes? Run zn vault add ~/Documents/notes. For a guided introduction, use zn setup; zn tui also offers setup when no vault is configured.

New in v0.6.0 Bare zn opens the TUI when stdin and stdout are terminals. In a pipe, it prints help.

Installation

Release downloads are standalone binaries for macOS, Linux, and Windows on amd64 or arm64. They need no Go installation. Choose your operating system →

Homebrew · macOS and Linux

Install and update with Homebrew
brew install zennotes/tap/zn
brew update && brew upgrade zn
zn --version

Download an archive

Extract the matching .tar.gz or Windows .zip from GitHub Releases. In the extracted folder, run ./zn tui on macOS/Linux or .\zn.exe tui in PowerShell. Move the executable into a directory on your user PATH to use zn anywhere. Release checksums are published alongside the archives.

Install with Go

Go 1.26 or newer
go install github.com/ZenNotes/tui/cmd/zn@latest
export PATH="$PATH:$(go env GOPATH)/bin"

The second line is for Bash/Zsh; add it to your shell profile. On Windows, add your Go bin directory (usually %USERPROFILE%\go\bin) to the user Path.

Installed through ZenNotes desktop

Desktop 2.51.1 and later bundle the Go CLI on macOS and Linux. Install or repair the command in desktop Settings → CLI. From desktop 2.60.0 the app also checks the latest CLI release once a day and installs it after verifying its signed manifest; Settings → CLI → Updates has Check for updates and a switch to be told instead. Earlier desktop versions refresh their managed runtime when an updated app opens. On Windows, use a standalone download.

Multiple installations? type -a zn on macOS/Linux or Get-Command zn -All in PowerShell shows which command wins. Update the installation that owns it.

Vaults & connections

Keep more than one workspace
zn vault add ~/Notes --name personal
zn vault add ~/Work/notes --name work
zn vault list
zn use work
zn list --vault personal
zn tui --workspace-source app

init, vault add, and connect remember their result and make it the terminal default. Add --no-default to save a workspace without selecting it. vault remove forgets a profile without deleting its files. vault mode root|inbox changes the notes layout and moves files accordingly.

Connect to a self-hosted server

Connect once, then use a saved name
zn connect https://notes.example.com --name home
zn list --server home
zn tui --server home
zn disconnect home

Connect asks for the server token, verifies it, and stores it separately from the profile. disconnect forgets the connection and its stored token. In the TUI, :vault or Space v switches workspaces; :server opens the server picker.

Which vault does a command use?

  1. Explicit --server, then explicit --vault.
  2. ZENNOTES_SERVER, then ZENNOTES_VAULT.
  3. The terminal’s saved default, when the workspace source is terminal.
  4. The desktop workspace as the fallback, or directly when the source is app.

Desktop-installed CLI commands follow the app’s workspace. The TUI defaults to its own terminal selection. Select the source explicitly with --workspace-source app|terminal or, for CLI commands, ZENNOTES_WORKSPACE_SOURCE. Explicit vault/server flags take precedence.

Local, self-hosted, and Cloud are different connections.

The TUI does not connect directly to ZenNotes Cloud. It works with local files or a self-hosted ZenNotes server. See how the apps and Cloud fit together.

Navigation & keybindings

Start with Space, the leader key. A hint panel shows the next moves. Ctrl+G opens the command palette, F2 opens context actions, and :help opens the built-in manual.

The shortcuts you will use every day
Keys / commandAction
Ctrl+P / Space fFind or create a note.
Ctrl+N / Ctrl+SNew note / save now.
Ctrl+BToggle the sidebar.
Ctrl+W, then v or sSplit right or below. :vsplit / :split do the same.
Ctrl+W, then h j k lMove between panes. q closes one; = equalizes sizes.
gt / gTNext / previous tab.
Ctrl+O / Ctrl+IMove back / forward through note jumps.
Space z p / s / ePreview / editor-and-preview / editor.
:zenHide the surrounding interface.
:pin / :reopenPin a tab / reopen a closed tab.
:qaSave all notes and quit.

Other leader destinations: Space x tasks, k Kanban, d today, w this week, m this month, p outline, and c calendar. Space s t searches vault text.

The mouse can focus panes, select text, open menus, scroll, and resize splits or the sidebar. Each vault remembers its split tree, tabs, cursor positions, and view state. Non-Vim editing still has the palette, arrows, F2, and common Ctrl shortcuts.

Writing & Vim

The editor supports counts, motions, text objects, visual modes, registers, marks, macros, dot-repeat, undo/redo, search, and ex commands including :s, :g, :sort, and :norm. Use gq to reflow and zc/zo to fold or unfold headings.

  • Ctrl+L toggles the task checkbox on the current line.
  • gd follows a note link; gx opens a URL; gy copies a link.
  • Enter continues lists; Tab indents list items; typing [[ opens note-link completion.
  • Ctrl+Space or :complete completes tags, callouts, and code fences according to context.
  • :table adds/removes rows or columns and changes alignment. :formatting opens formatting actions; :format formats the note.
  • Space l e opens the note in $VISUAL or $EDITOR and reloads it afterward.

Tag completion

Type # and a letter to see matching vault tags. Arrows or Ctrl+N/Ctrl+P move through matches; Enter, Tab, or Ctrl+Y accepts; Ctrl+E dismisses. Frontmatter tags: completes bare names. Ctrl+X Ctrl+O opens tag completion on demand.

Use a plain editor

Turn off [vim] enabled in :settings. Arrow keys, text selection, Ctrl+Z undo, Ctrl+S, and context menus keep everything accessible. vim.wrapped_line_motions can use display rows or logical lines when Vim is enabled.

Yank across notes

Registers belong to the TUI session. Yank with yy or a visual selection, switch notes with [b / ]b, then paste with p / P. Named registers, linewise/blockwise selections, and delete history are shared too. Closing the source note preserves the yank; cursor and undo history remain separate for each note.

Tasks, boards & calendars

Markdown checkboxes become a vault-wide task list. Add metadata in the note and work with the same tasks in three views:

A task in any Markdown note
- [ ] Review the proposal !high due:2026-10-15 #work
- [ ] Ask for feedback @waiting
Inside the TUI
:tasks list
:tasks kanban
:tasks calendar
:filters
:savefilter
:boardoptions

In tasks, x toggles completion and Enter opens the source line. p sets priority, d due date, w waiting, c cancelled, and / in progress. f filters; m or F2 opens actions.

The board defaults to Today / Upcoming / No due date / In progress / Waiting / Done, and the list groups tasks the same way; moving a card to No due date clears its due date. In the list, O or :order priority|note orders each group by priority or by the notes’ line order, the same tasks_list_order the desktop’s Order menu sets. H/L moves a card and g regroups by status, priority, due date, folder, or field:<key>. Board options configure column titles, custom statuses, folder roots, and card order. On a board grouped by field:status, a task note whose status: is one of your custom statuses stays in that column even when the status closes it, so status: done lands in a Done column instead of leaving the board. Folder boards keep cross-folder moves disabled.

In calendar view, Enter lists a day’s tasks and o opens its daily note. Filters search task text, note titles, priorities, tags, and fields. Advanced terminal queries start with where:, for example where: is:open due:today -meeting. Named filters are shared through the portable settings.

Tasks follow the vault’s folder lists, the same ones the desktop app uses: once the vault names Task folders, only the notes inside them feed Tasks, and excluded folders stay out even inside a Task folder. Settings edits both lists (tasks rows). zn task list --include-excluded lists every task anyway.

From a shell, zn task watch prints each task whose status changes as it happens, so a script can react when a card moves; see React to task status changes.

Search & organization

Find titles with Ctrl+P, search full text with Space s t, and follow [[wikilinks]]. The Connections panel shows backlinks; the Outline panel jumps between headings.

Tags has multi-selection with Tab, any/all matching with a, and vault-wide rename/remove actions with r/x. Home brings together daily notes, recent work, favorites, tasks, and tags.

Work on several notes

In lists and the sidebar, Ctrl+Space marks notes and Shift+Up/Down extends the selection. Use B or :bulk to open, move, archive, trash, restore, or unarchive the marked notes. Folder selections preserve subfolders when moved. Failed items keep their marks and appear in the operation report.

Archive and Trash have their own views and actions. Trashing is reversible; permanent deletion is explicit. Favorites, note sorting, and pinned tabs keep frequently used notes close.

Databases

Open a .base folder or a loose .csv as a table or board. Edit text, numbers, checkboxes, dates, select/multi-select values, and note links. Field editing, saved filters, sorts, and multiple views give plain files useful structure.

Record pages keep longer text beside a database row. :dbconvert turns a loose CSV into a .base folder; raw CSV remains accessible. From the shell:

Inspect a database
zn base list --json
zn base create "Reading list"
zn base rows "Reading list" --json

Use base add or base set with repeated --set Field=Value flags for fields in your database. Adding with --body or --page creates a record page. See the command reference for all database operations.

Templates & daily notes

Space d, w, and m open the current daily, weekly, or monthly note. Paths, title patterns, and date tokens follow the vault’s configured locale and periodic-note settings.

Use Space t to create from a template and Space i to insert one. :templates lets you preview, create, edit, duplicate, delete, and override built-in templates. Custom templates live in .zennotes/templates/ and use the same frontmatter and tokens as desktop, including {{cursor}}.

:rollover carries unfinished tasks into today’s note. :forward forwards the task at the cursor. Preferences and exclusions are editable from :settings.

Files & comments

Attachments, with context

Open :files or :assets to filter and sort attachments, inspect where they are used, attach a local file, copy/insert links, open externally, rename with reference updates, trash, and restore. The local import limit is 64 MiB; a remote server may impose a smaller limit.

Discuss a note

:comments opens anchored discussions beside the note. Read full threads, reply, edit/delete comments, and resolve or reopen conversations. Enter → Read full thread opens a scrollable reader. The shell supports the same thread format:

Comment on a note
zn comment add "First thought.md" "Worth exploring further."
zn comment list "First thought.md" --all --json

Preview & diagrams

Space z p renders the note; Esc or i returns to the editor. zn read <path> --pretty renders a note directly in your shell.

  • Markdown: Glamour rendering, built-in styles, custom JSON styles, or the built-in zen renderer.
  • Images: inline in Kitty/Ghostty using the Kitty graphics protocol; a card elsewhere. In tmux, enable allow-passthrough on.
  • Embeds: ![[Note]] renders a note inline. PDFs, audio, video, drawings, and YouTube/Vimeo links appear as cards you can open.
  • Diagrams: Mermaid renders as text, or as images with mmdc installed. $$ math uses typst when available, or your own LaTeX with math = "latex".

Math and TikZ through LaTeX New in v0.12.0

With math = "latex" under [terminal], the preview renders display math with your own pdftex, so the LaTeX the desktop app reads with KaTeX shows as pictures in Kitty and Ghostty: $$ and \[ \] blocks, equation, align, gather, multline and the rest of the amsmath environments, mhchem, bare tikzpicture blocks, and ```tikz fences, drawn the way the desktop draws them. Pictures take the theme’s text colour and are cached, so a note you have seen opens without running TeX again. A TeX error shows its first line above the source. typst stays the default, and in the editor $$ math is highlighted as LaTeX under either engine.

zn does not include TeX.

math = "latex" runs two programs you install yourself: pdftex, from a TeX distribution (TeX Live, MacTeX or MiKTeX), and pdftocairo, from poppler. Until both are on your PATH, LaTeX blocks show their source and the preview names the missing one. zn doctor checks for them and prints the install commands for your system.

macOS, with Homebrew
brew install --cask basictex
brew install poppler
eval "$(/usr/libexec/path_helper)"    # or open a new terminal
sudo tlmgr update --self
sudo tlmgr install standalone varwidth preview xcolor amsmath amsfonts mhchem pgf
Debian and Ubuntu
sudo apt install texlive-latex-extra texlive-science texlive-pictures poppler-utils
Fedora
sudo dnf install texlive-scheme-basic texlive-standalone texlive-varwidth texlive-preview texlive-xcolor texlive-amsmath texlive-amsfonts texlive-mhchem texlive-pgf poppler-utils
Arch
sudo pacman -S texlive-basic texlive-latex texlive-latexextra texlive-science texlive-pictures poppler

On Windows, install MiKTeX, which fetches missing LaTeX packages on first use, and poppler for pdftocairo, for example with scoop install poppler. Then set math = "latex" under [terminal] and run zn doctor.

Packages come from preamble.tex next to config.toml: zn writes it on the first render with amsmath, amssymb, mhchem, and TikZ with the libraries the desktop loads, and never rewrites it, so add your own packages there. render_timeout (seconds, default 10) stops a render that runs too long, and render_concurrency (default 2) caps how many run at once, for Mermaid and typst too.

TeX can read any file you can read, so under latex a note can show such a file in its preview. Leave latex off for vaults you do not trust.

Settings & themes

:settings is searchable and editable. zn config opens the portable file in your editor, creating a commented starter if needed. :config does the same in the TUI; :reloadconfig reloads immediately. External edits are usually picked up within a second.

Portable config.toml example
[editor]
word_wrap = true

[vim]
enabled = true

[terminal]
theme = "nord"
mouse = true
images = "auto"
preview_style = "auto"

The default file is ~/.config/zennotes/config.toml on macOS/Linux, or the zennotes folder under %APPDATA% on Windows. XDG_CONFIG_HOME is supported; ZENNOTES_CONFIG_DIR overrides the configuration locations. The terminal’s profiles live in workspaces.toml, with tokens separately in credentials.toml.

Shared sections include editor, vim, view, appearance, tweaks, keymaps, saved_filters, and kanban_column_titles. terminal contains terminal-specific choices. Vault settings stay in .zennotes/vault.json; session layouts are stored separately from your notes.

Make it look like you

The TUI reads desktop theme preferences and supports built-in families and custom themes. :themes previews choices, :theme nord changes the session, and [terminal] theme gives the terminal its own permanent look. Automatic mode follows your terminal’s background. :keymaps, :bind, and :unbind customize shortcuts.

New in v0.6.0

Read and write individual values from scripts:

Settings from the CLI
zn config list --json
zn config get editor.word_wrap
zn config set editor.word_wrap false
zn config edit

Command reference

Run commands as zn <command>. Note paths are relative to the selected vault; quote paths containing spaces. Use zn --help to inspect the available commands. Version 0.6.0 adds command-specific --help, typo suggestions, and strict argument validation.

Choose the destination and output
FlagMeaning
--vault <name|path>Select a vault or saved workspace.
--server <name|url>Select a server; takes precedence over --vault.
--token <token>Override the saved authentication token. Environment or saved credentials avoid putting it in shell history.
--workspace-source app|terminalChoose desktop or terminal workspace selection.
--jsonMachine-readable output for data commands.
--no-colorDisable terminal colors.
--no-inputNever prompt for missing values.
--help / --versionShow usage / the installed CLI version.

Notes

zn list
List notes, most recently updated first.--folder <folder> · --tag <tag> · --limit <number> · --json
zn read <path>
Print Markdown, render it, or return metadata and body as JSON.--pretty · --style <name|json-file> · --meta · --json
zn create
Create a note; take its body from a flag or stdin.--title <title> · --folder inbox|quick|archive · --subpath <path> · --tag <tag> · --body <text|->
zn write <path>
Replace the entire note body. Use append for an addition.--body <text|->
zn append <path>
Add text at the end of a note.--body <text|->
zn prepend <path>
Insert text at the top, after frontmatter.--body <text|->
zn rename <path>
Change the note’s filename/title.--to <new-title>
zn move <path>
Move a note to another folder.--folder <folder> · --subpath <path>
zn archive <path>
Move a note to archive.
zn unarchive <path>
Bring an archived note back.
zn trash <path>
Soft-delete a note; it can be restored.
zn restore <path>
Restore a trashed note to inbox.
zn duplicate <path>
Create a copy beside the original note.
zn delete <path>
Permanently delete a note.--yes required

Search, folders & tags

zn search <query>
Full-text search across live notes.--limit <number> · --json
zn search-title <query>
Find titles containing the query.--json
zn backlinks <path>
Find notes linking to this note with wikilinks.--json
zn folder list
List vault subfolders.--json
zn folder create <path>
Create a subfolder such as inbox/Work.
zn folder rename <path>
Rename a subfolder.--to <new-path>
zn folder delete <path>
Delete a subfolder and everything inside it.--yes required
zn tag list
List tags with their note counts.--json
zn tag find <tag>
Find notes carrying a tag.--limit <number> · --json

Tasks & comments

zn task list
List tasks across the vault. With --json, each task carries its status.--unchecked · --all · --tag <tag> · --include-excluded · --json
zn task toggle <id>
Toggle a task using the stable ID returned by task list.--json
zn task watch
Print each task whose status changes, as it changes. It only reports; what runs is up to your script.--json one line per change · --interval <seconds> for a server that cannot push · --include-excluded
zn comment list <path>
List a note’s discussion threads.--all includes resolved · --json
zn comment add <path> "<body>"
Start a thread, optionally anchored to note text.--anchor <text> · --author <name> · --json
zn comment reply <path> <id> "<body>"
Reply to a thread by ID.--author <name> · --json
zn comment resolve <path> <id>
Resolve a thread or reopen it.--reopen · --json

Vaults & connections

zn setup
Guided first run: create or open a vault, connect, or install a server.Interactive
zn init [folder]
Create and remember a vault; default folder is ~/Notes.--name <name> · --no-default · --json
zn connect <url|name>
Verify and save a server connection; prompt for its token if needed.--name <name> · --token <token> · --no-default · --json
zn disconnect [name]
Forget a saved server and its token.--json
zn use <name|folder|url|app>
Choose the terminal’s default workspace; app follows desktop again.--json
zn vault add <folder>
Remember an existing Markdown folder.--name <name> · --no-default · --json
zn vault remove <name>
Forget a profile zn saved, and a server’s token with it; keep files on disk. Names the desktop app’s entries instead of removing them. Alias: vault rm.--json
zn vault info
Show the vault path/server and folder counts.--json
zn vault list
List known vaults and servers, mark the default, and show whether zn (terminal) or the desktop app (app) saved each one.--json
zn vault mode [root|inbox]
Show or switch the file layout. Switching moves notes and updates favorites.--json

Databases

zn base list
List databases in the vault.--json
zn base create <title>
Create an empty database.--folder <folder/subfolder> · --json
zn base rows <base>
List rows; identify a base by its title or path.--json
zn base get <base> <row>
Read a row by ID or title value.--json
zn base add <base>
Add a row. Body/page options also create its record page.--set Field=Value (repeatable) · --body <text|-> · --page · --json
zn base set <base> <row>
Update fields and mirror the record page.--set Field=Value (repeatable) · --json
zn base convert <base>
Convert a loose CSV into a .base folder with record-page support.--json
zn base pages <base>
Give every record without one its record page, so each can be linked; a page file already in the folder is linked, not copied.--dry-run --json

Capture & runtimes

zn capture "<text>"
Quickly capture a note, or pipe stdin when no text is supplied.--folder <folder> · --tag <tag> · --title <title> · --json
zn open <path>
Hand local Markdown files or a vault folder to the desktop app.-n / --new-window
zn tui [path]
Open the terminal app, optionally starting on a note.--vault <workspace> · --server <server> · --workspace-source app|terminal
zn mcp
Run the MCP stdio server for an AI client.Workspace and authentication flags apply
zn config
Open config.toml in an external editor; create a starter when missing.--path prints its location · --no-edit creates without opening
zn version
Print the installed version. Also available as zn --version.

Configuration & diagnostics Since v0.6.0

zn config list
List effective supported preferences.--json
zn config get <section.key>
Read a single preference.--json
zn config set <section.key> <value>
Validate and persist a portable setting.--json
zn config edit
Open config.toml in your editor.
zn status
Explain workspace selection, configuration paths, credentials presence, and installation owner.--json
zn doctor
Check configuration, editor, credentials, workspace access, and managed instances.--json
zn completion <shell>
Print a completion script for bash, zsh, fish, or powershell.
zn update
Update using the detected installation owner.--check · --version <version> · --json

Managed servers Since v0.6.0

zn server setup <name>
Install, start, verify, and register a local server.--vault <folder> · --bind <ip:port> · --base-path <path> · --version <version> · --no-start · --no-default · --json
zn server install <name>
Install only, without starting the service.--vault <folder> · --bind <ip:port> · --base-path <path> · --version <version> · --json
zn server list
List locally managed instances.--json
zn server status <name>
Inspect service state and authenticated health.--json
zn server start <name>
Enable/start the login service and verify it.--json
zn server stop <name>
Stop and disable the login service.--json
zn server restart <name>
Restart and verify the service.--json
zn server run <name>
Run in the foreground until Ctrl-C.Stop the background service first
zn server logs <name>
Print up to the last 64 KiB of the log.
zn server config <name>
Show or change runtime settings with health checks and rollback on failure.--vault <folder> · --bind <ip:port> · --base-path <path> · --json
zn server update <name>
Check for a release, update, or restore the previous version.--check · --version <version> · --rollback · --json

Scripting & completion

Pipe text into capture or use --body - to explicitly read stdin. Prefer append/prepend for additions; write replaces the whole note body. Repeat --tag and database --set flags as needed.

A few useful shell recipes
printf 'A thought from the shell\n' | zn capture --tag ideas
printf '\nNext action: send the draft.\n' | zn append "First thought.md" --body -
zn list --tag work --limit 10 --json
zn task list --unchecked --json
zn read "First thought.md" --json | jq '.body'

jq is optional and installed separately. CLI paths follow your vault’s root/inbox layout; use zn list to get the actual path. read normally prints Markdown, while --json includes metadata and body.

React to task status changes

zn task watch prints a line each time a task’s status changes: a task note’s status:, a checkbox task’s @status:, or its checkbox. Moving a card on a Kanban board, editing the note in any editor, and zn task toggle all count; editing a task’s words, or saving it with the same status, does not. With --json each change is one line of JSON, so a script can act on each one as it arrives.

Start an agent when a task is ready
zn task watch --json | while IFS= read -r change; do
  if [ "$(jq -r .status <<<"$change")" = ready ]; then
    ./start-agent.sh "$(jq -r .path <<<"$change")"
  fi
done
One line per change
{"at":"2026-10-14T15:47:24Z","id":"inbox/Parser.md#task","path":"inbox/Parser.md","link":"zennotes://open?path=inbox/Parser.md","title":"Parser","kind":"file","content":"Parser","previousStatus":"backlog","status":"ready","lineNumber":0}

status and previousStatus follow the Kanban board. A task note’s status is its own status: (open when it has none). A checkbox task is done, cancelled, or forwarded once its box says so; until then it is its @status: or the status its note’s frontmatter gives it, and otherwise waiting, in-progress, or open. kind is file for a task note.

zn only reports: whatever runs on a change is your own script, so nothing that executes lives in the vault. A local vault is watched through its files. A server pushes its changes; one that cannot (an older server, or a proxy without WebSockets) is asked every --interval seconds instead, 5 by default. zn task list --json carries each task’s status too.

Environment variables

ZENNOTES_VAULT
Default local vault root.
ZENNOTES_SERVER
Default server name/URL.
ZENNOTES_REMOTE_TOKEN
Server token for automation; explicit --token takes precedence.
ZENNOTES_REMOTE_HEADERS
Extra headers for a server behind an access gateway such as Cloudflare Access, one Name: value per line (a JSON env block writes the line break as \n). Sent with every request, live updates included; never stored in credentials.toml.
ZENNOTES_WORKSPACE_SOURCE
Default CLI selection source: app or terminal.
ZENNOTES_CONFIG_DIR
Isolate or relocate configuration, profiles, and credentials.
ZENNOTES_APP_PATH
Desktop application location for zn open.
EDITOR / VISUAL
External editor. NO_COLOR disables ANSI colors.

Predictable automation

Add --no-input for unattended commands. Errors with --json go to stderr in a structured envelope; successful data stays on stdout. Usage errors exit 2, operation failures 1, and cancellation exits 130.

JSON error format
{"error":{"code":"usage","message":"unknown flag --titel. Did you mean \"title\"?"}}

Shell completion

Bash completion
zn completion bash > ~/.zn-completion.bash
source ~/.zn-completion.bash

Use zsh, fish, or powershell instead of bash for the corresponding script. In Zsh, initialize compinit before sourcing it; Fish uses ~/.config/fish/completions/zn.fish; PowerShell uses your profile. Suggestions include commands, flags, saved workspaces, managed instances, setting keys, and local note paths. Completion never contacts a remote server.

MCP & AI assistants

zn mcp starts an MCP server over stdio. It offers note, folder, search, task, asset, comment, archive, and trash tools against the same workspace selection as the CLI.

MCP client configuration
{
  "mcpServers": {
    "zennotes": {
      "command": "zn",
      "args": ["mcp"]
    }
  }
}

To pin a workspace, use arguments such as ["mcp", "--vault", "/absolute/path/to/notes"]. A remote workspace uses --server; save its token once with zn connect https://notes.example.com --no-default, or, when the desktop app is connected to that server, with Let assistants use it under Settings → MCP → Server token there (desktop 2.69.0 and later).

The MCP server re-resolves the workspace before each tool call. If it changes, operations pause until the assistant calls vault_info to confirm the new destination. Desktop-managed commands can use the token saved by zn connect; the desktop app’s OS-secret-store token cannot be read directly by the CLI.

Manage a server New in v0.6.0

Install a native ZenNotes server on the machine running zn. Setup downloads the official release, verifies its SHA-256 digest, creates a private token, starts the service, checks authentication and the exact vault, then saves your terminal connection.

A local server
zn server setup home --vault ~/Notes
zn server status home
zn list --server home

The default bind is 127.0.0.1:7878. Use --bind 127.0.0.1:7879 for another port, --base-path /notes for a URL prefix, and --version 2.56.0 to pin a server release. --no-default keeps your current terminal selection. --no-start installs without starting or registering a connection.

Day-to-day server commands
zn server list --json
zn server stop home
zn server start home
zn server restart home
zn server logs home
zn server config home --bind 127.0.0.1:7879

macOS uses a launchd user agent; Linux uses a systemd user service. Stop also disables its login service; start enables it again. Linux operation after logout needs user lingering configured by the machine’s owner. Windows can use install and foreground execution where a native release is available.

server install performs only the installation. Stop a background service before using server run home in the foreground; Ctrl-C ends it. Logs prints the last 64 KiB. Runtime files and tokens live outside the vault under the user-data servers/<name> directory, or $ZENNOTES_CONFIG_DIR/servers.

Inside the TUI, :servers opens the management menu: setup, connect, status, lifecycle, logs, release checks, upgrades, rollback, and bind-address changes. Long operations run in the background.

Native, local management.

This first manager does not provision over SSH or manage Docker containers. You can still connect the CLI/TUI to an existing remote or Docker-hosted server with zn connect.

Updates & rollback New in v0.6.0

Update a managed server

Check, upgrade, or recover
zn server update home --check
zn server update home
zn server update home --version 2.56.0
zn server update home --rollback

The candidate is verified before the old server stops. It must report the expected version, accept the token, reject unauthenticated vault access, and serve the configured vault. Failed checks restore the prior service. A successful upgrade retains the previous executable and digest for rollback.

A default update never downgrades; an explicit version can. Checks do not install anything. Stopped instances are briefly started to verify an update and returned to stopped afterward. Rollback restores the server binary/configuration, not any vault-format migration a server release might perform.

Update the CLI

Respect the installation owner
zn update --check
zn update
zn update --version 0.6.0
Homebrew
Runs brew upgrade zn. Homebrew chooses its packaged version; pinning through --version is rejected.
Go installation
Installs the chosen module version into the existing executable directory.
Desktop-managed
ZenNotes desktop 2.60.0 and later update it themselves: a daily check installs a newer release only after its signed manifest, archive checksum and integration check pass. zn update points to Settings → CLI → Check for updates; --check still reports. Earlier desktop versions update it with the desktop app.
Standalone macOS/Linux
Checks the archive and executable’s version/protocol, retains zn.previous, then atomically replaces the executable.
Windows / other packages
Provides the download or package-manager update instruction.

Native replacement requires a writable installation directory. Development builds are rebuilt from source. Upgrading from v0.5.0 or earlier requires your original installation method once, because those releases do not have zn update.

Troubleshooting

For a bug report, open :version (or :ve) in the TUI. It includes OS, architecture, runtime, build, installation, terminal, and active-server information. Press c to copy, or use :version copy / :version!. The same report is in the command palette and under v in Settings. Local vault paths and authentication details are omitted.

“Unknown command” or the wrong version

Run zn --version and type -a zn (PowerShell: Get-Command zn -All). Your shell may find an older desktop or Homebrew command first. Use a full executable path or change PATH order. The desktop app bundles a pinned CLI version; it updates that copy through desktop releases.

A different vault opens

Pass --vault /absolute/path or --server name to be explicit. Desktop-installed CLI commands and the TUI have different default selection sources; check environment variables and --workspace-source. zn status explains the selected destination and zn doctor checks access.

A remote server rejects the connection

Confirm the server is running, the URL includes the right base path, and the token matches its configuration. Reconnect with zn connect <url>. On macOS, check Local Network permission for the app/terminal when reaching a LAN host. WebSocket support enables live updates; polling and reconnect provide a fallback.

A note changed elsewhere while I was editing

Clean buffers refresh; dirty buffers retain your edits. :conflict offers reload, keep-local, or save-a-copy actions. Checks compare content before saving; the current server API does not make that check-and-write atomic. Avoid editing the same remote note simultaneously. If shutdown cannot save, the TUI reports a recovery JSON file under tui-recovery/ in the user-data directory.

Images, keys, or colors look different

Inline images require Kitty graphics support; other terminals show cards. In tmux, enable passthrough. Alt shortcuts require your terminal to send Option/Alt as Alt; the command palette and leader keys provide alternatives. Try [terminal] theme for a terminal-specific theme or images = "off" to disable image rendering.

A managed instance says it is locked

Setup, updates, and foreground execution lock their instance. Wait for the running operation. After a forced termination, confirm no command or foreground server is running before removing that instance’s .lock. server restart reapplies the saved manifest after interruption. Automatic rollback handles normal failures and cancellation, not power-loss recovery.

Where are the desktop-only tools?

Workflows, Atlas, publishing/sharing, Cloud sync, Harper grammar checks, and image resizing stay in the desktop app. Use Space l o or zn open <path> to hand a local note to desktop. Read the app documentation →

Build & contribute

The CLI and TUI are MIT-licensed Go code in ZenNotes/tui. The server lives in ZenNotes/znserver. With Go 1.26 or newer:

Build the published source repository
git clone https://github.com/ZenNotes/tui.git
cd tui
go build -o zn ./cmd/zn
./zn --version
go test -race ./...

Use tag v0.12.2 for this release or the default branch for ongoing development. The contributor sandbox creates disposable notes and configuration:

Disposable contributor sandbox
bash scripts/sandbox.sh
bash scripts/sandbox.sh --smoke
bash scripts/sandbox.sh --server --smoke

The first command opens the TUI; --smoke runs automated checks. --server downloads a verified server and runs it in the foreground without creating a login service. Exit the TUI with :qa; the sandbox cleans up afterward.

Now make something worth keeping.

Back to the beginning ↑