Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI verbs

Every verb below is a subcommand of the single mado binary, verified against crates/mado/src/bin/mado.rs. Flags shown are the notable ones; run mado <verb> --help for the complete, authoritative list.

mado init

Initialize a new mado repository + workspace in the current directory.

FlagDefaultMeaning
--workspace <name>defaultWorkspace name to register. Must be unique per shared server.
--store-format <fs|fjall>fsAt-rest blob format for a local init. fs: loose files, shareable by concurrent processes. fjall: embedded LSM, exclusive to one process, the production/import format. Rejected for remote inits.
--resumeoffThis init is the target of a mado ws resume: skip the workspace-name collision probe (the name is expected to be registered).

mado mount

Mount the working copy through the FUSE VFS (a daemon).

FlagDefaultMeaning
--mountpoint <dir>requiredWhere to mount. Must differ from the workspace root.
--no-auto-snapshotoffDisable folding idle mount edits into @.
--no-auto-checkpointoffDisable the remote auto-checkpointer (no effect on a local workspace).
--checkpoint-interval <secs>30Auto-checkpoint cadence — the bounded off-box loss window. 0 disables.
--allow-otheroff-o allow_other: let other uids access the mount (needs user_allow_other in /etc/fuse.conf). Required to re-export into a guest VM.
--read-onlyoff-o ro: kernel refuses writes before they reach the VFS.
--scratch <dir>noneLocal backing dir for scratch redirections (off-snapshot build dirs).
--redirect <path>noneMount-relative path to redirect into --scratch (repeatable; merged with .mado-redirections).
--hydration-timeout-secs <secs>30Per-attempt deadline for a content fetch inside a FUSE read.
--hydration-retries <n>2Extra fetch attempts after the first failure/timeout, then EIO.

mado serve-virtiofs

Serve the working copy over virtiofs (vhost-user-fs) on a socket — the native second transport, no virtiofsd and no /dev/fuse.

FlagDefaultMeaning
--socket <path>requiredvhost-user unix socket qemu attaches to.
--no-auto-snapshotoffDisable idle edit folding.
--no-auto-checkpoint / --checkpoint-interval <secs>/ 30Inert here (the daemon holds no lease); present for CLI symmetry.
--cache-timeout-secs <secs>1Guest attr/entry cache timeout (virtiofs has no active invalidation). Larger = faster, staler.
--freshoffNo caching (--cache-timeout-secs 0): host-side checkouts reflect instantly.
--scratch <dir> / --redirect <path>Scratch redirections, as for mount.
--hydration-timeout-secs / --hydration-retries30 / 2As for mount.

mado snapshot

Fold edits made through the mount into @. Pulls the live overlay from the running daemon over the control socket and amends @. Quiet, idempotent — the manual equivalent of the daemon’s idle auto-snapshot. No flags.

mado materialize [PATH]

Prefetch (hydrate) the working copy’s file contents into the disk blob cache. Walks @’s tree under PATH (default: the whole tree; a directory prefetches its subtree) and fetches every file’s blobs with bounded concurrency. Requires a remote-backed workspace (MADO_REMOTE_ADDR); a no-op on a local workspace.

mado pack

Build locality packs for a commit’s dense small-file subtrees and record the pack index.

FlagDefaultMeaning
-r, --revision <revset>@Revision whose tree to pack (must resolve to one commit).
--recursiveoffBuild recursive-subtree (v2) packs instead of per-directory (v1). The measured-best default for real trees.

Packs are a reclaimable cache, never a GC root. Building is idempotent.

mado pack-status

Report the running mount daemon’s locality-pack attach state (attached mode / version / entry count / discovery source, or the not-attached reason). Requires a live mado mount / serve-virtiofs in the workspace. No flags.

mado ws checkpoint

Record a workspace checkpoint: fold pending mount edits into @, snapshot scratch, and bind (operation, scratch manifest, attr-table presence) into one durable record.

FlagMeaning
--scratch <dir>Local backing dir of the scratch redirections. Omit if the mount runs without scratch.
--redirect <path>Extra path redirected into --scratch (repeatable; merged with .mado-redirections).

mado ws pause

Pause this workspace so it can resume on another machine. Folds edits, snapshots scratch, uploads the attr table, writes the checkpoint, and CAS-swaps the server-side workspace head to it (the commit point). Blocks until everything is remote-durable. Flags: --scratch <dir>, --redirect <path> (as for checkpoint).

mado ws resume

Resume a paused workspace into this workspace. The target must be a fresh mado init --workspace <name> --resume against the same server.

FlagMeaning
--scratch <dir>Local backing dir to restore scratch redirections into. Required when the checkpoint carries scratch entries.
--forceOverwrite existing local workspace state (dirty workspace).
--stealSteal the workspace lease from a prior holder — succeeds only once the lease has expired on the server clock; bumps the epoch to fence the old holder.

mado serve

Serve this repo’s blob store + op-log over gRPC (the networked backend). Blocks until killed. Core flags:

FlagDefaultMeaning
--addr <host:port>127.0.0.1:50051Bind address (:0 lets the OS pick, printed on startup).
--op-heads-db <file>nonePersist op-heads to SQLite (else ephemeral in-memory). Required for scheduled GC and git interop.
--auth-token <token>noneRequire authorization: Bearer <token> on every RPC.
--prod-blobstoreoffStore through the production composition (Prefix → Pack(zstd) → Multiplexed → Fs). Changes the at-rest format.
--blob-prefix <p>noneNamespace blobs under this prefix (implies prod composition).
--gc-interval-secs <secs>0Run a server-side GC sweep every N seconds (0 = never). Requires --op-heads-db.
--gc-min-age-secs <secs>3600Scheduled GC age grace period.
--stats-interval-secs <secs>60Blob-traffic summary interval (0 disables).

Online git interop flags (all require --op-heads-db): --git-ingest-url, --git-ingest-ref (default master), --git-ingest-interval-secs (300), --git-ingest-mirror, --git-ingest-scope, --git-ingest-threads; --git-export-url, --git-export-staging, --git-export-refspec, --git-export-bookmark, --git-export-scope, --git-export-interval-secs (300), --git-export-force, --git-export-on-reject (retry|rebase|surface, default retry), --git-export-fidelity (any|roundtrip-only, default any); --git-interop-config <file> (named remotes, additive to the single-remote flags); throttling --git-interop-max-serve-ops (0 = unthrottled); server-held credentials --git-credential-token / --git-credential-file (preferred) / --git-credential-username (default x-access-token); event webhook --git-webhook-addr / --git-webhook-secret / --git-webhook-secret-file. See Operations and docs/design/online-git-interop.md.

mado sync-now

Wake a running mado serve’s online git interop tasks now (against MADO_REMOTE_ADDR) instead of waiting for their poll interval.

FlagMeaning
--remote <name>An interop task label to wake (e.g. git-ingest[foo]); repeatable. Omitted = wake them all.

mado gc

Garbage-collect unreachable blobs from .jj/repo/store. Dry run by default.

FlagDefaultMeaning
--op-heads-db <file>requiredLive-heads database defining what to retain.
--scope <scope>""Op-heads scope to read heads for.
--sweepoffActually delete (else report only).
--min-age-secs <secs>3600Age grace period; 0 disables (only safe when quiesced).
--prod-blobstore / --blob-prefix <p>Must match how the store is served.

mado recover-op-heads

Rebuild the op-heads database from the blobstore journal.

FlagMeaning
--out-db <file>Where to write the reconstructed database. Must not already exist.
--prod-blobstore / --blob-prefix <p>Must match how the store is served.

mado import-git

Convert a git repository’s history into this repo’s mado store and (unless --no-publish) publish the imported tips. One-way boundary conversion, memoized in git-map.sqlite (resumable; incremental on re-run after git fetch).

FlagDefaultMeaning
--git-repo <path>requiredGit repo (work tree or bare .git) to import.
--ref <ref>all local branchesA git ref to import (repeatable).
--depth <n>noneShallow graft by generation count (explodes on merge-dense history — prefer --shallow-since).
--shallow-since <when>noneTime-bound shallow graft (YYYY-MM-DD, ISO timestamp, or epoch seconds).
--no-publishoffConvert objects but publish no operation (imports stay unreferenced).
--op-heads-db <file>noneDatabase to publish into. Required unless --no-publish.
--scope <scope>""Op-heads scope to publish under.
--progress-every <n>1000Progress line cadence (0 = silent).
--threads <n>0Conversion worker threads (0 = one per core).
--pack-order <auto|on|off>autoConvert in pack-offset order (faster for large shallow clones).
--prod-blobstore / --blob-prefix <p>Must match how the store is served.
--no-packsoffSkip building + publishing locality packs for imported head trees (on by default; recursive index, warm-local).

mado export-git

Export this repo’s history (the current view’s bookmarks) into a git repository. Shares git-map.sqlite with import: exports back into the original repo reuse objects byte-identically; fresh exports of unsigned, gitlink-free history reproduce the original commit ids. Conflicted commits refuse to export.

FlagDefaultMeaning
--git-repo <path>requiredGit repo to export into (initialized non-bare if absent).
--bookmark <name>all local bookmarksA bookmark to export as the same-named branch (repeatable).
--op-heads-db <file>requiredDatabase naming the view to export.
--scope <scope>""Op-heads scope to read the view from.
--forceoffMove existing branch refs that point elsewhere.
--progress-every <n>1000Progress line cadence (0 = silent).
--prod-blobstore / --blob-prefix <p>Must match how the store is served.