Skip to content

CLI reference

Four binaries expose a command line: knomit (server + admin), knomit-bridge (MCP proxy + Claude integration), knomit-okf (OKF export), and knomit-desktop (the app). All four print the same build string, but the accepted spelling differs: knomit and knomit-bridge take only the bare version subcommand — --version is an unknown flag on both. knomit-okf and knomit-desktop accept version, --version and -version.

Boots the app, opens all repos, and listens on {host}:{port} (or a Unix socket). Serves REST /api/v1, the MCP endpoint, the web UI, and — if enabled — git smart-HTTP. Graceful shutdown on SIGTERM.

FlagTypeDefaultMeaning
--portstring19278 (config)Listen port
--hoststringlocalhost (config)Listen host
--log-filestringFile for JSON-structured logs (in addition to stderr)
--log-max-sizeint10Max log file size (MB) before rotation
--log-max-backupsint3Rotated log files to keep
--log-max-ageint7Max age (days) for rotated logs

Log level and format (console/json) are set through config, not flags — KNOMIT_LOG_LEVEL / KNOMIT_LOG_FORMAT (or the [log] TOML section). The --log-* flags above override only the rotating file sink.

Set KNOMIT_RUNTIME_ADDR (e.g. localhost:6060) to enable the gated runtime diagnostics port — pprof, Prometheus /metrics, expvar, and live process controls. See Observability.

Walks the git object chain, SQLite tables, and search index, reporting structural issues. Exit codes: 0 clean (warnings do not fail the run), 1 integrity errors found, 2 verify itself could not run — bad flags, unknown repo, boot failure. The difference between 1 and 2 is the contract: a script that reads “the tool could not run” as “the repo is damaged” pages someone at 3am over a typo in a flag.

FlagTypeDefaultMeaning
--repostringRepo to verify. Required unless --all — there is no default repo to fall back to
--allboolfalseVerify all active repos. An archived repo is not opened and cannot be verified; the run names any it skipped
--deepboolfalseParse every fact (slower, stricter)
--jsonboolfalseEmit the report(s) as JSON instead of text
--max-issuesint100Cap issues printed per repo in text output (0 = all). The per-category summary is always complete, and --json is never truncated — a truncated machine-readable report would look complete and not be. Ordering puts errors ahead of warnings, so truncation can only drop the least severe
--all-branchesboolfalseParity-check every refs/heads/* ref, not just the branches the index maintains
--prune-generated-refsboolfalseWrites. Deletes the generated okf/* refs left by the removed server-side export, and their markers — nothing else. Verify is otherwise strictly read-only

Only branches the index maintains are parity-checked. Other refs under refs/heads/* — another machine’s agent branch arriving by fetch, or refs left behind by a removed feature — have no SQLite rows by design. They are named as “not indexed” in the report header rather than reported as thousands of errors; --all-branches opts back in.

Converts a home shape that only exists on installations predating the control.db repo registry. A home created by a current build never needs it, and a converted one never needs it again.

knomit warm-models — pre-download the embedding model

Section titled “knomit warm-models — pre-download the embedding model”

Fetches model + tokenizer files into KNOMIT_HOME/models/<id>/ without booting the server or initializing ONNX. Used at Docker build time.

FlagTypeDefaultMeaning
--modelstringconfigured embed modelEmbedding model id to fetch

Prints the full version string (<semver>.<sha>).

knomit-bridge — MCP proxy & Claude integration

Section titled “knomit-bridge — MCP proxy & Claude integration”

Three modes: the default (no subcommand) stdio MCP proxy, the claude subcommands, and version.

Reads JSON-RPC from stdin, POSTs to the server’s MCP endpoint, writes responses to stdout. This is what an MCP client launches. In repo mode it discovers the agent branch via GET /api/v1/repos/{repo}, then targets {base-url}/api/v1/repos/{repo}/branches/{branch}/mcp (the branch / is URL-encoded as :). In lens mode it skips branch discovery entirely and targets {base-url}/api/v1/lenses/{lens}/mcp — a lens resolves each mount’s branch server-side. It maintains the Mcp-Session-Id header and handles SSE responses.

Flag / argDefaultMeaning
--repoRepository name. Exactly one of --repo or --lens is required — knomit has no default repo to fall back to
--lensLens name; connects to the lens MCP endpoint. Mutually exclusive with --repo — passing both is a fatal error
[base-url] (positional)http://localhost:19278Server base URL
--log/tmp/knomit-bridge.logBridge log file (4 MB rotation, 3 backups, 7 days)

The base URL resolves in this order: the positional argument, then the server.json lockfile, then http://localhost:19278. KNOMIT_BASE_URL does not apply here — it is read only by the claude subcommands. Pass the base URL positionally to override discovery. KNOMIT_MCP_DEBUG=1 raises the log level to debug.

knomit-bridge claude init — scaffold Claude Code integration

Section titled “knomit-bridge claude init — scaffold Claude Code integration”

Renders embedded templates into the current directory. See Claude Code integration for the full file list.

FlagDefaultMeaning
--repocwd basenameknomit repo name
--lensLens name; writes a lens-scoped .mcp.json. Mutually exclusive with --repo

Whichever name is used is validated against the server’s grammar ([a-z0-9_-]+) before any file is written, so an invalid value is rejected rather than baked into a broken .mcp.json. It is also capped at 27 characters — the mcpServers key is derived from it as knomit-repo-<repo> or knomit-lens-<lens>, and Claude Code builds tool names as mcp__<key>__<tool> against a 64-character API limit. A name that would overflow is rejected here rather than producing an entry whose tools silently cannot be called.

The generated file contains "args": ["--repo", "<name>"], or "args": ["--lens", "<name>"] in lens mode, under that derived key. See the .mcp.json key for why it is no longer the constant knomit, and why a project should carry only one knomit scope.

knomit-bridge claude hook <event> — run an editor hook

Section titled “knomit-bridge claude hook <event> — run an editor hook”

Invoked by Claude Code’s hook config; reads stdin, writes guidance to stdout. Valid events: session-start, post-edit, post-ask, pre-compact.

Publishes a knomit knowledge base as a portable Open Knowledge Format repository. Pure Go — no CGO, no native libraries — and built by the top-level make build alongside the others.

knomit-okf clone [-b <branch>] [--publish-source] [auth] <kb-url> <dir>
knomit-okf sync [-b <branch>] [--source <url>] [--publish-source] [auth]
knomit-okf branches [--source <url>] [--no-fetch] [auth]
knomit-okf version

sync and branches run inside an export directory; clone creates one. The tool commits but never pushes — you run git push yourself.

knomit-okf clone — create an export directory

Section titled “knomit-okf clone — create an export directory”
FlagTypeDefaultMeaning
-bstringsource’s advertised HEADSource branch to export. A knomit server’s HEAD is usually the agent branch — pass -b main for consensus.
--publish-sourceboolfalseRecord the KB URL in .knomit-okf.yaml so a stranger who clones the published repo can sync it
FlagTypeDefaultMeaning
-bstringthe branch in .knomit-okf.yamlSource branch to export
--sourcestringthe knomit-source remoteOverride the KB URL for this run only — it does not repoint the stored remote
--publish-sourceboolfalseRecord the KB URL in .knomit-okf.yaml

knomit-okf branches — survey what’s exported

Section titled “knomit-okf branches — survey what’s exported”
FlagTypeDefaultMeaning
--sourcestringthe knomit-source remoteOverride the KB URL for this run
--no-fetchboolfalseList from already-fetched refs without contacting the remote; the output says the counts may be stale

Accepted by all three commands. A knomit server’s git endpoint is unauthenticated and needs none. A flag that does not match the URL’s transport is rejected outright rather than ignored.

FlagEnv fallbackTransportMeaning
--tokenKNOMIT_OKF_TOKENHTTPSAccess token, sent as the basic-auth password (never a Bearer header)
--token-fileHTTPSRead the token from a file instead of argv; mutually exclusive with --token
--usernameHTTPSBasic-auth username, default git. Bitbucket requires x-token-auth; rejected without a token.
--ssh-keyKNOMIT_OKF_SSH_KEYSSHExplicit private key. Failing to load it is a hard error, never a silent fallback.
KNOMIT_OKF_SSH_PASSPHRASESSHPassphrase for an encrypted key. No flag exists, because a passphrase on argv is visible via ps.

Prints knomit-okf <semver>.<sha>. Accepts version, --version, or -version.

No arguments boots the app (picks a free loopback port, defaulting to 19278, boots the server in-process, opens the webview, writes server.json). The system tray is created on every platform, Linux included. version is the only argument the binary inspects; anything else is ignored and the app boots normally.

ArgMeaning
(none)Boot the app
version / --version / -versionPrint version

Logs go to stderr and a rotating file under the platform logs dir (~/Library/Logs/knomit on macOS, $XDG_STATE_HOME/knomit — default ~/.local/state/knomit — on Linux). See Desktop app for how it differs from a bare knomit serve.