CLI reference

The relayfile CLI: setup, login, seed, tree, mount, and the relayfile-mount daemon flags, with auth and token resolution rules.

The relayfile CLI is the primary interface for humans and CI to work with Relayfile workspaces. It wraps the HTTP API and the mount sync engine into one tool: minimal flags, sensible defaults, composable with pipes (--json everywhere), and no implicit destructive actions (deletes require --yes).

Authentication

The CLI resolves a token in priority order, first match wins:

  1. --token flag (one-off override)
  2. RELAYFILE_TOKEN env var (CI/CD)
  3. the canonical relay cloud session (cloud-hosted interactive use)
  4. ~/.relayfile/credentials.json (self-hosted / API-key compatibility)

For the cloud-hosted path, login is owned by the agent-relay CLI: agent-relay login, then agent-relay workspace switch <name>, then any relayfile command. For self-hosted servers, use the API-key path:

relayfile login --api-key --server https://api.relayfile.dev

If no token is found, the CLI prints: Error: not authenticated. Run 'agent-relay login' for Cloud or set RELAYFILE_TOKEN.

relayfile setup

The low-friction Cloud setup path for humans and agent-guided onboarding. It ensures you're logged in, creates or joins a Cloud workspace, requests a hosted connect session for the chosen provider, waits until it reports ready, and starts the mount loop.

relayfile setup --provider notion --workspace my-project --local-dir ./relayfile-mount
FlagDefaultDescription
--providerprompted (github)Integration to connect; none to skip
--workspacepromptedWorkspace name to create or join
--local-dirprompted (./relayfile-mount)Local mount directory
--cloud-api-urlhttps://agentrelay.com/cloudCloud API URL
--cloud-tokenRELAYFILE_CLOUD_TOKENCloud token for headless setup; skips browser login
--no-openfalsePrint login/connect URLs instead of opening a browser
--skip-mountfalseComplete setup without starting the mount loop
--oncefalseRun one mount sync cycle and exit

Re-running with the same workspace name reuses the workspace, refreshes the session, and only opens a new connect flow when the provider isn't already connected. See Relayfile Cloud.

relayfile login

Authenticate through the canonical relay session, or the self-hosted API-key path.

relayfile login [--no-open]
relayfile login --api-key --server https://api.relayfile.dev

The default path delegates to agent-relay login. --api-key keeps the self-hosted compatibility path and writes ~/.relayfile/credentials.json with 0600 permissions.

relayfile seed

Bulk-upload a local directory into a workspace, respecting .gitignore and --exclude patterns.

relayfile seed my-workspace ./src
FlagDefaultDescription
--exclude(none)Glob patterns to exclude (repeatable)
--dry-runfalseList files that would upload, without uploading
--batch-size50Files per bulk API request

It walks the directory and posts batches to the bulk write endpoint, printing progress.

relayfile tree

List a remote workspace path without mounting.

relayfile tree my-workspace / --depth 2
FlagDefaultDescription
--depth1Maximum tree depth
--jsonfalsePrint the raw API response

Prints a compact human-readable tree by default; --json is for scripts. relayfile read <workspace> <path> (alias relayfile cat) reads a single file the same way.

relayfile mount

Mount a workspace to a local directory, syncing changes in real time. This replaces the standalone daemon for end users.

relayfile mount my-workspace ./local-mirror
FlagDefaultDescription
--interval30sPolling interval between sync cycles
--oncefalseRun a single sync cycle and exit (CI)
--modepollpoll (synced mirror, recommended) or fuse (opt-in, POSIX)
--backgroundfalseDetach; write PID to .relay/mount.pid, logs to .relay/mount.log
--no-websocketfalseDisable WebSocket streaming, poll only

In poll mode the daemon maintains a synced mirror accelerated by a WebSocket invalidation channel. fuse mode is gated by build tags and unavailable in the OSS build (the CLI exits cleanly with a clear message rather than falling back silently). Stop a background mount with relayfile stop and tail its log with relayfile logs.

The relayfile-mount daemon

cmd/relayfile-mount is the minimal single-purpose daemon, kept for backwards compatibility and deployments that want it directly. It's configured by flags or environment variables:

RELAYFILE_TOKEN="$TOKEN" go run ./cmd/relayfile-mount \
  --base-url http://localhost:9090 \
  --workspace ws_demo \
  --local-dir ./relayfile-mount \
  --remote-path /github \
  --fuse-content-ttl 10s
Flag / envDefaultDescription
--base-url / RELAYFILE_BASE_URLhttp://127.0.0.1:8080Relayfile API base URL
--workspace / RELAYFILE_WORKSPACE— (required)Workspace ID to mount
--local-dir / RELAYFILE_LOCAL_DIR— (required)Local mirror directory
RELAYFILE_TOKEN— (required)Bearer token
--remote-path / RELAYFILE_REMOTE_PATH/Remote subtree to mirror (repeatable)
--paths-fileJSON array or newline list of remote roots
--fuse-content-ttl / RELAYFILE_MOUNT_FUSE_CONTENT_TTL30sFUSE content cache TTL
RELAYFILE_MOUNT_INTERVAL2sPolling interval
RELAYFILE_MOUNT_TIMEOUT15sPer-sync timeout

See Run locally for the daemon in context and Local development for the no-Docker loop.

Other commands

CommandPurpose
relayfile workspace create / list / deleteManage workspaces
relayfile exportDownload a snapshot (--format tar|json|patch)
relayfile statusPer-provider sync state, lag, conflicts, denials
relayfile integration connect / list / disconnectManage provider integrations after setup
relayfile pullForce a reconcile of a path or the whole workspace
relayfile permissionsShow writable paths and expected schema for a path
relayfile ops list / replayInspect and replay dead-lettered writeback ops
relayfile stop / relayfile logsControl and read a background mount daemon

Global flags

FlagEnv varDescription
--serverRELAYFILE_SERVERServer base URL
--tokenRELAYFILE_TOKENBearer token
--workspaceRELAYFILE_WORKSPACEWorkspace name or ID
--jsonEmit JSON instead of tables
--verboseDebug logging to stderr