The standalone mdbase archive contains the same native CLI and daemon that
ships inside the matching mdbase connect desktop release. It does not contain Electron and does not introduce a second trust or
collection implementation.
Download the archive, its entry in the platform SHA256SUMS file, and the
adjacent .sigstore.json bundle from the same GitHub release. Verify the
checksum and Sigstore identity before extracting it. The expected certificate
identity is the tag-bound workflow:
https://github.com/mdbase-dev/mdbase-connect/.github/workflows/desktop-release.yml@refs/tags/VERSION
Sigstore proves which repository workflow produced the bytes. It does not
replace Apple notarization or Windows Authenticode. An artifact whose filename
contains UNSIGNED is a preview and may trigger an operating-system warning.
On Linux or macOS, extract the archive and install the executable at a stable
path on PATH, for example:
install -m 0755 mdbase ~/.local/bin/mdbase
mdbase service install
mdbase service statusOn Windows, extract mdbase.exe to a stable per-user directory, add that
directory to PATH, then run the same mdbase service install and status
commands from PowerShell.
service install copies the exact invoking executable into mdbase's private
runtime directory (keeping the copy it replaces as mdbase.previous), registers
the per-user service and waits until it is ready. Run it again after installing
an upgrade. For containers, SSH sessions, or supervisors that should own the
process lifecycle, use the foreground entry point with an isolated profile
instead:
mdbase --state-dir /secure/persistent/state daemon runSign the computer in with mdbase account sign-in. The daemon is the final
authorization boundary for local collections: apps reach a collection only
after you approve them (mdbase access), the same in desktop and fully headless
sessions.
Do not expose the local control socket or named pipe over a network. Back up the state directory and OS credential store according to the recovery guidance for your platform.
The data commands work on the collection folder you are in, another folder with
-C PATH, or a registered collection with -c and its ID, ID prefix or name:
mdbase query --types task --where 'status == "open"' --order-by -due
mdbase read tasks/review.md --json
mdbase validate
mdbase types list
mdbase create --type task --fields '{"title": "Review"}' --body-file notes.txt
mdbase update tasks/review.md --fields '{"status": "done", "due": null}'
mdbase rename tasks/review.md done/review.md
mdbase delete done/review.md --if-revision <revision>
mdbase batch --request ops.jsonWhen the daemon serves the folder, a command goes through it. Otherwise the CLI opens
the folder itself for the one command. It refuses a folder that another process
holds open, a folder inside a registered collection while the daemon is stopped
(exit 3), and a folder that contains a registered collection. Registered
collections open only once the computer is signed in.
validate with no paths checks every record, a page at a time; 10,000
records take about a third of a second.
read --json prints the record with its revision. Pass it back with
--if-revision so a write fails rather than overwrite a change made in
between. Every write takes --dry-run. batch applies all its operations or
none; mdbase batch --help shows the request shape. A write returns once its
file is written. If the file changed on disk or is held, the change is recorded
without writing it; the command says so, and mdbase holds lists held files.
With --json, each command prints its result, and a failure prints
{"error": {"code", "message", "reason"}}. Exit codes are 0 for success, 1
for an error (including validate finding an error), 2 for invalid usage
and 3 when the daemon is not running.
This hold exists only on the computer that shows it. For example, if one computer renames a folder while another edits a note in it, the renaming computer can show the hold even though the editing computer doesn't.
- On the computer that shows the hold, run
mdbase holds <collection>to find the held file and its ID. Runmdbase resolve <collection> <id> keep_bothto preserve both versions, or choose Keep both in Connect Desktop's Collections → Review files action on that computer. - Wait for the computers to sync and check that they show the same files. If the preserved edit is still in the old folder, move it to the intended folder on one computer and let that move sync.
scripts/hosted-read-canary.mjs proves, once per run, that a signed-in
computer reaches its account and reads one immutable Markdown marker from a
synced (cloud-copy) collection through the hosted log. It drives the shipped
mdbase CLI and daemon against an isolated profile and has no credentials or
network client of its own.
Each run starts that profile's daemon, so nothing it observes predates the
run: the account relay reports online only after a device-bound session with
the control plane, and the joined collection's hosted log reports online only
after an authenticated reply from the log service. The canary then requires the
collection to be caught up to the head the log reported (no pending changes,
holds or conflicts), reads the marker from the joined folder, compares the
SHA-256 of its exact bytes, and stops the daemon. It refuses to use a daemon it
did not start.
Enrollment is a separate, manual step. Use a dedicated canary account that is a
member of the marker collection, ideally with the viewer role, and the mdbase
binary of the environment being probed (production builds sign in only to
https://connect.mdbase.dev):
mdbase --state-dir /secure/persistent/canary-state daemon start
mdbase --state-dir /secure/persistent/canary-state account sign-in
mkdir -m 0700 /secure/persistent/canary-collection
mdbase --state-dir /secure/persistent/canary-state collection join \
<collection-id> /secure/persistent/canary-collection
mdbase --state-dir /secure/persistent/canary-state status
sha256sum /secure/persistent/canary-collection/status/canary.md
mdbase --state-dir /secure/persistent/canary-state daemon stopWait until status shows the collection ready and synced before computing the
digest, and compare it with the marker you published: the expected digest is
sha256: followed by the 64 lowercase hex digits of the marker's exact UTF-8
Markdown bytes. The device identity lives in the platform keyring or credential
store, not in the state directory; keep both persistent, leave the joined folder
unmodified, and do not set MDBASE_SECRET_BACKEND. The folder path stays on
this computer; only the collection ID goes to the control plane.
Schedule the probe with explicit non-secret inputs:
node scripts/hosted-read-canary.mjs \
--environment production \
--cli /opt/mdbase/bin/mdbase \
--state-dir /secure/persistent/canary-state \
--expected-origin https://connect.mdbase.dev \
--collection <collection-id> \
--expected-collection-name "Status marker" \
--marker-path status/canary.md \
--expected-marker-sha256 sha256:<64-lowercase-hex-digits> \
--timeout-ms 60000Every option also has an MDBASE_HOSTED_CANARY_* environment-variable form;
use either the argument or its environment variable, never both. Run it without
MDBASE_HOME, MDBASE_ENV or MDBASE_SECRET_BACKEND; inherited overrides are
rejected so a run cannot select another profile, environment or secret store.
The timeout bounds the probe; stopping the daemon afterwards has its own
30-second bound. Do not run another daemon on the canary profile.
The probe prints one JSON line: schema_version 1, environment, component
hosted_canary, status, checked_at, duration_ms, the stages config,
daemon_start (start a fresh daemon), registration (wait for the
keyring-backed account at the expected origin to be online), connections (the
collection is registered once, synced, with the expected name), describe
(hosted log online and caught up), read, digest and shutdown, and on
failure an error with its stage and a fixed code. Exit 0 is operational,
1 is a probe failure, and 2 is invalid or unsafe configuration. A scheduler should retain only that line.
Failed CLI commands contribute only the daemon's stable error code or a fixed
start/stop reason (for example start_failed, daemon_unreachable or
unauthenticated). A wait that outlasts the timeout reports the last reason it
waited on, such as account_offline, log_offline, not_caught_up or
collection_opening. Process failures are classified as timeout,
output_limit, cli_unavailable, or cli_signaled; anything else is
cli_failed. No message, arbitrary code, account error text, identifier,
response body, credential, path or record content is reflected. Keep the
installed CLI and the canary script current together.
scripts/hosted-sync-canary.mjs measures how long one edit takes to travel
from one computer to another through the hosted log: the core sync promise.
Where the read canary starts a fresh daemon on every run (and so includes cold
start), this probe drives two long-running daemons, a writer and a reader. Both
are isolated profiles of the same mdbase binary on one machine, signed in to
the same dedicated account as two devices, with the same small synced
(cloud-copy) collection in their own folders.
Each run checks that both daemons use the keyring, are signed in at the
expected origin and online, are distinct devices of one account, and are
caught up to the same head, with no pending changes, holds or conflicts. It
then overwrites one probe file in the writer's folder in place with a fresh
random nonce, as an editor saves, and polls both daemons' status and the
reader's copy every 25 ms on one monotonic clock until the reader's file holds
the nonce. The stages are:
detect: the writer's daemon has noticed the edit (pendingabove zero or the head moved).upload: the writer has nothing pending and has confirmed a new head.notify: the reader has heard of that head (head_known).apply: the reader's copy contains the nonce.
Each milestone is its earliest evidence: a later one proves the earlier ones,
so if the reader's copy changes before a status poll shows the new head, the
skipped stages report 0. Durations are therefore bounded by the poll interval
plus one status call (a few milliseconds).
Enrollment follows the read canary's, twice. Use a dedicated account, keep
both state directories and folders persistent, and do not set
MDBASE_SECRET_BACKEND; each isolated profile keeps its device identity in
the keyring under its own namespace:
mdbase --state-dir /secure/persistent/sync-writer daemon start
mdbase --state-dir /secure/persistent/sync-writer account sign-in
mdbase --state-dir /secure/persistent/sync-writer account rename "Sync canary writer"
mkdir -m 0700 -p /secure/persistent/sync-writer-files/status
mdbase --state-dir /secure/persistent/sync-writer collection add \
--name "Sync canary" /secure/persistent/sync-writer-files
mdbase --state-dir /secure/persistent/sync-writer sync enable \
--mode cloud-copy "Sync canary"
mdbase --state-dir /secure/persistent/sync-writer status
mdbase --state-dir /secure/persistent/sync-reader daemon start
mdbase --state-dir /secure/persistent/sync-reader account sign-in
mdbase --state-dir /secure/persistent/sync-reader account rename "Sync canary reader"
mkdir -m 0700 /secure/persistent/sync-reader-files
mdbase --state-dir /secure/persistent/sync-reader collection join \
<collection-id> /secure/persistent/sync-reader-filesThen run each daemon under the service manager with
mdbase --state-dir <dir> daemon run instead of daemon start, and schedule
the probe (every five minutes is plenty) with explicit non-secret inputs:
node scripts/hosted-sync-canary.mjs \
--environment production \
--cli /opt/mdbase/bin/mdbase \
--writer-state-dir /secure/persistent/sync-writer \
--reader-state-dir /secure/persistent/sync-reader \
--expected-origin https://connect.mdbase.dev \
--collection <collection-id> \
--expected-collection-name "Sync canary" \
--probe-path status/sync-probe.md \
--timeout-ms 60000Every option also has an MDBASE_SYNC_CANARY_* environment-variable form, and
the same override rules as the read canary apply. The probe never starts or
stops a daemon; a daemon that is not running fails preflight with
daemon_not_running. Nothing else should edit the collection.
The probe prints one JSON line: schema_version 1, source sync,
component hosted, environment, checked_at, status, duration_ms
(write to the reader's copy, or to the failure; before a write, how long the
run took), the stages that completed and the one that failed, and on failure an
error with its stage and a fixed code. A failure before timing starts is the
run's only stage, config (exit 2), preflight (for example account_mismatch,
same_device, heads_differ, log_offline or a CLI code) or write. A stage
that outlasts the timeout reports the device's last blocking reason
(log_offline, account_offline, collection_opening) or timeout; holds,
conflicts or a failed collection end the run at once. Codes follow the read
canary's privacy rules.
With --timings-url https://… and --timings-token-file <absolute path>
(both or neither), the probe also POSTs that line with
Authorization: Bearer <token>. The token file must be a regular file readable
only by its owner. A failed publication prints only Timing publication failed: with a fixed reason or the HTTP status to stderr and exits 1, so the
scheduler records the run as failed.