Skip to main content
loc is the supported command surface for Locality. Use it to connect sources, register mounts, inspect local sync state, review remote write plans, push approved edits, and operate the background daemon and virtual filesystem providers. Most developer and agent workflows should stay path-scoped:
Use --json on commands when integrating with scripts, agents, tests, or MCP tools. Help output is always text, even when --json is present.

Command map

Conventions

Paths and scope

Commands that accept a path resolve it through the registered Locality mount table. Prefer the narrowest useful path: a single page.md, one page directory, or a small subtree. Broad workspace-level diff and push commands are harder to review. When a path is optional, Locality uses the current working directory when it is inside a mount. Outside a mount, commands such as loc status report registered mounts in the active state directory.

--json

--json is global:
JSON output is intended for tools. It does not include OAuth tokens, refresh tokens, personal access tokens, client secrets, or credential-store references.

State directory

Production state defaults to ~/.loc. For isolated development and tests, use LOCALITY_STATE_DIR or daemon flags such as --state-dir <path>.

Projection modes

Projection support depends on the host platform: plain-files writes normal files during loc pull. The virtual projection modes list online-only content through the platform provider and materialize file bodies on open or explicit pull.

Connect sources

loc connect notion

Connect a Notion workspace and save a reusable connection.
Use this before mounting Notion. The default path uses Locality’s OAuth broker, opens a browser, and stores credentials in the local credential store. Locality can mount only pages and workspaces shared with the Notion integration. Key arguments: Examples:

loc connect google-docs

Connect Google Docs through the Locality OAuth broker.
Use this before mounting a Google Drive workspace folder that contains Google Docs. Non-Google-Docs Drive files are ignored by the Google Docs connector. Key arguments: Example:

Inspect and remove connections

Use connections to list saved account connections. Use profiles to list connector auth profiles and capabilities. Use connection show for one connection’s metadata. These commands never print secrets. disconnect deletes the credential and marks the connection revoked. It does not remove mounts; affected mounts will report auth or revoked-connection problems until you reconnect or remount.

Mount sources

loc mount notion

Register Notion content at a local path.
Use --workspace for all Notion content shared with the integration. Use --root-page <page-id> when you want one page tree instead of the whole accessible workspace. Key arguments: Examples:
After a virtual mount, register or open the platform provider:
For a plain-file mount, pull once to write the local projection:

loc mount google-docs

Register Google Docs content under a Drive workspace folder.
Use this when a Google Drive folder is the workspace boundary for Locality. The folder can be specified by name, id, or folder URL. Key arguments: Examples:

Find and inspect content

Search Locality’s local SQLite search index.
Use search for navigation, desktop typeahead, agent path lookup, and source URL resolution. It reads local SQLite entity metadata, remote observations, derived breadcrumb/path text, connector-provided search metadata such as source URLs and aliases, and hydrated shadow frontmatter/body text. Ordinary search is local-first, so it is fast and safe but may not know about the newest remote changes until a pull, daemon refresh, or freshness check has run. Exact Notion URL misses may trigger a targeted metadata refresh before re-running the local search. Results are field-weighted so title, alias, source URL, and path hits outrank broader metadata and body hits. Human output can include a compact match: line, and JSON output can include stable optional match_context with the matched field and best-effort snippet. Tools should tolerate absence and future field names. Key arguments: Examples:

loc info

Show source, mount, entity, child, and journal context for a path using local state only.
Use info when you need to answer “what is this file connected to?” without hydrating content or calling the remote connector. It is useful before deleting or moving suspicious files in a mount. Examples:

loc status

Show local sync state for one path, the current mount scope, or all mounts.
Use status before and after edits. It reports stubs, dirty files, conflicts, missing projections, pending journals, failed journals, remote-update metadata already observed by the daemon, and read-only state. It does not call remote connectors itself. Examples:
Common states:

loc inspect

Explain local and remote sync state for one path.
Use inspect when status says remote state may have changed and you need a more authoritative explanation before choosing pull, push, or manual merge. Unlike status, inspect may call the remote connector. It is read-only: it does not rewrite local files, update shadows, or mutate the remote source. Example:

loc doctor

Run read-only diagnostics for daemon, state store, mounts, providers, projection support, and auth.
Use doctor when a mount is not appearing, a daemon/provider seems stopped, auth is failing, or you want a broad health report. It reports suggested recovery commands but does not initialize state, write credentials, start daemons, register providers, or reset anything. Example:

Review and sync

loc pull

Pull remote content into the local projection.
Use pull to hydrate stubs, refresh a page or subtree, update clean files after remote changes, or write a plain-file mount after registration. Pull refuses to overwrite dirty hydrated content. On virtual filesystem mounts, it updates daemon/cache state and materialized visible files only when they are still clean relative to the synced shadow. Examples:

loc diff

Preview the remote write plan for local changes.
Use diff before every explicit push. It parses the mounted Markdown, compares it with the synced shadow, validates Locality metadata, detects unresolved conflict markers, and shows the connector-neutral operations that push would attempt. It does not mutate local files or remote content. Examples:

loc push

Push local changes back to the remote source.
Use push only after reviewing loc diff or when Live Mode has paused and asks for a manual decision. The push pipeline runs the same validation and planning as diff, then uses a journaled connector apply path. Key arguments: Examples:
If the remote changed first, pull before pushing:
If the file contains conflict markers, edit it to the intended final content, remove every marker line, then run loc diff again.

loc restore

Restore a local file from the last synced shadow.
Use restore when local edits should be discarded. It rewrites the local file from Locality’s last synced snapshot and does not call Notion or Google Docs. Failed push journals remain in the audit log. --force allows restoring a file marked conflicted. Use it only when you have chosen to discard local conflict content. Examples:

loc log

List push journal entries.
Use log to inspect previous push attempts, failed journals, and journal ids for undo. With a path, Locality filters to entries that touched that entity or scope. Examples:

loc undo

Undo a reconciled push using its journal id.
Use undo for journal-backed recovery where the connector supports the reverse operations. It is not a generic remote history browser. Failed or partially applying journals may be unsafe to undo automatically. Example:

Create local drafts and exports

loc create page

Create a local page draft in a mounted Locality folder.
Use this to create the filesystem shape for a new page without calling the remote connector. The containing directory determines the remote parent when the draft is pushed. When --parent is omitted, Locality uses the current directory. Key arguments: Example:

loc templates

Manage local-first template packs.
Use templates for repeatable local workflows, such as progress logs or draft documents. Template commands write local files only. They do not connect sources, mount workspaces, bypass diff review, or push remote changes. Key forms: Examples:

loc okf export

Export mounted content as an Open Knowledge Format bundle.
Use OKF export when an agent, search pipeline, or review process needs a portable Markdown bundle instead of live mounted files. The command reads the source projection and writes a separate output directory. It is read-only with respect to Locality state and the remote source. --out <dir> must point to an empty output directory. Example:

Daemon and virtual filesystem providers

loc daemon

Start, stop, reload, restart, or inspect the background localityd process.
Use the daemon for Live Mode, virtual filesystems, background hydration, freshness checks, and managed provider workflows. Subcommands: Key arguments: Examples:

loc file-provider

Manage the platform virtual filesystem provider for a mount.
Use this command with macos-file-provider, linux-fuse, and windows-cloud-files projection modes. The target can be a mount id such as notion-main or a path inside a mount. Subcommands: Examples:
Platform notes:

Tool integration and development

loc mcp

Run the Locality MCP stdio server.
Use this from an MCP client configuration. It speaks over stdin/stdout and is not meant to be run as an interactive shell command.

loc config

Reserved for future configuration commands.
The current CLI exposes the command, but it prints not implemented yet.

Development entrypoints

From a source checkout:
For isolated command tests:

Exit codes

Common workflows

Connect, mount, pull, edit, push

Use a virtual projection

Use macos-file-provider on macOS and windows-cloud-files on Windows.

Recover from unwanted local edits

Diagnose a paused or unhealthy mount