Skip to main content

CLI for reading and writing Obsidian vault notes — locally or over SSH.

Project description

odcli

CLI for reading and writing Obsidian vault notes — locally or over SSH.

odcli operates directly on Markdown files, so it needs no Obsidian API or running Obsidian instance. Point it at a local vault or connect to a remote machine the same way you would with ssh.

Install

pip install odcli

Or with uv:

uv tool install odcli

After installation both odcli and obsidian-cli are available.

Quick start

Local vault

odcli auto-discovers the vault from your Obsidian config or common default locations. No setup needed in most cases:

odcli list
odcli read Inbox/today.md

To point at a specific vault:

export OBSIDIAN_VAULT="/path/to/MyVault"   # or ODCLI_VAULT
odcli list

Or per-command:

odcli --vault "/path/to/MyVault" list

Remote vault over SSH

If the host is in your ~/.ssh/config, use it like ssh:

odcli myserver list
odcli myserver read Inbox/today.md
odcli myserver write Inbox/today.md --content "# Hello"

Or use explicit flags:

odcli --ssh-host myserver --ssh-user me list

SSH details

How the alias is resolved

odcli myserver list is rewritten to odcli --ssh-alias myserver list. HostName, User, Port, and IdentityFile are pulled from ~/.ssh/config (including Include-d files). Any explicit flag or environment variable overrides the config value.

Environment variables

Set defaults in your shell profile so you never have to repeat flags:

Variable Description
ODCLI_SSH_HOST SSH host
ODCLI_SSH_USER SSH username
ODCLI_SSH_PORT SSH port
ODCLI_SSH_IDENTITY SSH private key path
ODCLI_VAULT / OBSIDIAN_VAULT Vault path (local or remote)

Resolution order

Each SSH field is resolved in this order:

  1. CLI flag (--ssh-host, --ssh-user, --ssh-port, --ssh-identity)
  2. Environment variable (ODCLI_SSH_*)
  3. ~/.ssh/config entry for the alias
  4. Built-in default:
    • user — current OS user
    • identity — first key found in ~/.ssh (id_ed25519 > id_ecdsa > id_rsa)
    • vault~/Documents/Obsidian Vault (macOS/Linux) or Documents\Obsidian Vault (Windows)

Commands

Command Description
check Validate the vault path
list [--limit N] List Markdown notes
read <note> Print a note
read-lines <note> <start> <end> Print a line range (1-based, inclusive)
write <note> --content TEXT Create or overwrite a note
write-lines <note> <start> <end> --content TEXT Replace a line range
append <note> --content TEXT Append to a note
search <query> [--case-sensitive] Full-text search across all notes
mkdir <dir> [--no-parents] Create a directory inside the vault

All write commands accept --stdin instead of --content to read from stdin. write also accepts --create-only to fail if the note already exists. mkdir creates the directory and any missing parents by default (like mkdir -p); pass --no-parents for strict mkdir semantics that fail on a missing parent or an existing directory.

AI coding assistant integration

odcli can install helper skills so AI coding tools know how to use it:

odcli plugin install all-skills   # Codex + Claude Code
odcli plugin install codex-skill  # Codex only
odcli plugin install claude-skill # Claude Code only

Vault discovery

When no vault is specified, odcli searches in this order:

  1. --vault flag
  2. OBSIDIAN_VAULT / ODCLI_VAULT environment variable
  3. Most recently opened vault from Obsidian's own config
  4. Common default directories:
    • macOS: ~/Documents/Obsidian Vault, ~/Documents/Obsidian, iCloud
    • Windows: %USERPROFILE%\Documents\Obsidian Vault, %USERPROFILE%\Documents\Obsidian

Development

uv sync                                       # install deps
uv run python -m unittest discover -s tests   # run tests
uv build                                      # build wheel + sdist

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odcli-0.1.14.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odcli-0.1.14-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file odcli-0.1.14.tar.gz.

File metadata

  • Download URL: odcli-0.1.14.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for odcli-0.1.14.tar.gz
Algorithm Hash digest
SHA256 7c2687f58996f7b37cae38974d94f65f87d0f34a82ae30ff16679b40381b03e3
MD5 75934ba0b2872e5b71f6cae55817d3de
BLAKE2b-256 5a858a1e689f6fbc55347c4655aebc73c130c105ee51fde96c91c9bc9c722737

See more details on using hashes here.

File details

Details for the file odcli-0.1.14-py3-none-any.whl.

File metadata

  • Download URL: odcli-0.1.14-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for odcli-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 af89aaf92072c454fe82bedc7a395e228219459e3003fa02cea0fb0e60764dda
MD5 45665205d4866ecaa90c89440700f57b
BLAKE2b-256 4b24e343ac0b13d6aeacee7ab34f4eb668deddf3b07bfc3a2c6e33bdedec14e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page