JB Obsidian Sync
Manage Obsidian vaults as synchronized Markdown repositories inside the agent workspace.
Verified CLI
Use the headless Obsidian client ob from the obsidian-headless package.
command -v ob
ob --version
ob --help
Resolve the executable with command -v ob; do not encode a user-specific installation path. Recheck the version and relevant --help output before relying on syntax after upgrades.
Do not use an Obsidian CLI whose purpose is merely to remote-control Obsidian Desktop. Obsidian Desktop is not required.
Operating model
- Use
obto connect and synchronize Obsidian Sync vaults into the workspace. - After a vault is available locally, work directly on its Markdown files with normal filesystem tools.
- Treat
ob syncas bidirectional by default. - Resolve vault paths from the current request or
TOOLS.md; never discover or infer them from vault contents. - Pass an explicit absolute
--path "$VAULT_PATH"to everyobcommand that supports--path. - Do not confuse an Obsidian Sync checkout with an ordinary Git repository unless the local checkout actually uses Git.
- Never put account passwords, MFA codes, vault passwords, recovery keys, encryption keys, or tokens in command arguments, logs, notes, tracked files, or chat.
Inspect account and vaults
These commands are read-only:
ob login
ob sync-list-remote
ob sync-list-local
With no credentials passed, ob login shows the current login status or prompts interactively. Never pass --password or --mfa on the command line. If authentication is required, run ob login interactively so secrets are prompted.
Use ob sync-list-remote to resolve a remote vault by ID or unique name. Prefer the immutable vault ID when names are duplicated or when recording durable configuration.
Use ob sync-list-local to audit the CLI's configured checkouts and compare them with TOOLS.md. Do not silently replace the path mapping in TOOLS.md from this output.
Vault path registry
Treat TOOLS.md as the canonical registry for reusable local vault paths.
For each configured vault, record:
- canonical vault name
- immutable remote vault ID
- absolute local checkout path
When setting up a new checkout, add or update its mapping in TOOLS.md only after ob sync-setup and ob sync-status succeed. Preserve unrelated tool notes.
Do not store account passwords, vault passwords, encryption material, recovery keys, or tokens in TOOLS.md.
Resolve a local vault checkout
Use this order:
- An explicit absolute path supplied by JB for the current task.
- The matching absolute path recorded in
TOOLS.md.
If neither provides an unambiguous path, stop and ask JB. Do not search the filesystem and do not infer a vault from its contents.
Verify that the directory exists, then confirm its sync configuration with the same explicit path:
ob sync-status --path "$VAULT_PATH"
If the path in TOOLS.md disagrees with ob sync-list-local or ob sync-status, stop and report the mismatch instead of choosing one silently.
ob sync-status reports the stored sync configuration; it is not a substitute for running ob sync.
Connect a remote vault
When JB asks to clone, connect, or set up a remote vault:
- Confirm authentication with
ob login. - List remote vaults with
ob sync-list-remote. - Resolve an explicit absolute target path supplied by JB or agreed for the setup.
- Create that exact directory only when the requested setup requires it.
- Use the machine hostname as the device name, which identifies this client in Obsidian Sync's version history.
- Connect it interactively:
DEVICE_NAME="$(hostname)"
ob sync-setup \
--vault "$REMOTE_VAULT_ID" \
--path "$VAULT_PATH" \
--device-name "$DEVICE_NAME"
- Omit
--password; allowobto prompt for the E2E vault password. - Verify configuration with
ob sync-status --path "$VAULT_PATH". - Record the canonical name, remote ID, and absolute local path in
TOOLS.md. - Run the initial one-time synchronization:
ob sync --path "$VAULT_PATH"
- Verify the checkout contents.
Safe editing and synchronization workflow
For every task that changes a synced vault:
- Resolve the explicit checkout path from the request or
TOOLS.md. - Inspect its configuration:
ob sync-status --path "$VAULT_PATH"
- Pull and reconcile current remote changes with a one-time bidirectional sync before editing:
ob sync --path "$VAULT_PATH"
- Inspect the target notes, then make the requested Markdown changes.
- Review the local files changed during the task. Do not alter unrelated files.
- Run another one-time bidirectional sync:
ob sync --path "$VAULT_PATH"
- Run
ob sync-status --path "$VAULT_PATH"again and inspect command output for failures or conflicts. - Report the explicit vault path, changed notes, and whether the final sync succeeded.
Do not start ob sync --continuous for ordinary edits. Use continuous mode only when JB explicitly requests a long-running watcher; always pass --path "$VAULT_PATH", manage it as a background process, and report how it can be stopped.
Sync configuration
Inspect the current configuration without changing it:
ob sync-config --path "$VAULT_PATH"
Supported settings include:
--mode bidirectional|pull-only|mirror-remote--conflict-strategy merge|conflict--excluded-folders <comma-separated-folders>--file-types image,audio,video,pdf,unsupported--configs app,appearance,appearance-data,hotkey,core-plugin,core-plugin-data,community-plugin,community-plugin-data--device-name <name>
Never switch to mirror-remote: it reverts local changes. Use it only with JB's explicit approval after showing the impact. Do not change sync mode, conflict strategy, exclusions, file types, or configuration categories merely to complete a note edit.
ob sync-unlink --path "$VAULT_PATH" removes the stored sync configuration and credentials. Treat unlinking as destructive and run it only when JB explicitly asks after confirming the exact path.
Create a new remote vault
Create a remote vault only when JB explicitly asks.
- Confirm authentication.
- Determine the valid region identifier before creation. The CLI validates
--region; do not guess the identifier. - Require end-to-end encryption and interactive password entry:
ob sync-create-remote \
--name "$VAULT_NAME" \
--encryption e2ee \
--region "$REGION"
- Omit
--passwordsoobprompts securely. - Prefer Germany, specifically Frankfurt, when available; otherwise another German region, then an EU region.
- If E2EE cannot be enabled, stop instead of creating the vault.
- If the requested residency is unavailable, explain the available locations before choosing a materially different region.
- After creation, connect it to an explicit absolute path with
ob sync-setup, record the mapping inTOOLS.md, and verify withob sync --path "$VAULT_PATH".
Preserve Obsidian formatting
Prefer the vault's existing conventions when discoverable. Otherwise:
- Keep notes mostly flat at the vault root.
- Use Title Case for note filenames.
- Use index notes to aggregate related topics, for example
Skills Index.mdorRAG Index.md. - Avoid new folders used only for categorization; prefer links and index notes.
- Use Obsidian
[[wikilinks]]. - Add links to dependencies and closely related notes near the bottom of a note.
- Keep index notes as simple, readable lists of
[[wikilinks]]. - Preserve existing YAML frontmatter, callouts, embeds, block references, tags, and other Obsidian syntax unless the task requires changing them.
Search notes
Search filenames first, then content inside the explicitly resolved vault path. Prefer rg and rg --files; fall back to find and grep if unavailable.
rg --files "$VAULT_PATH" -g '*.md' | rg -i 'keyword'
rg -il 'keyword' "$VAULT_PATH" -g '*.md'
Create or update a note
- Complete the pre-edit sync workflow with the explicit vault path.
- Search for an existing note with the same or overlapping purpose.
- Follow the vault's existing naming, frontmatter, and organization patterns.
- Use a Title Case filename when no stronger local convention exists.
- Write the note as a coherent unit of learning.
- Add relevant
[[wikilinks]]and update an existing index note when appropriate. - Preserve unrelated content in existing notes.
- Complete the post-edit sync and verification workflow with the same explicit vault path.
Find backlinks
rg -l '\[\[Note Title\]\]' "$VAULT_PATH" -g '*.md'
Find index notes
rg --files "$VAULT_PATH" -g '*Index*.md'
Safety
- Never overwrite an existing note blindly.
- Never create or initialize a vault without explicit instruction.
- Keep edits scoped to the explicitly selected vault checkout.
- Stop on missing or conflicting path mappings.
- Stop on authentication, encryption, locking, synchronization, or conflict errors.
- Never resolve a conflict by discarding local or remote changes blindly.
- Never run more than one
ob syncinstance for the same vault; the CLI locks each checkout.