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.13.tar.gz (18.4 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.13-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: odcli-0.1.13.tar.gz
  • Upload date:
  • Size: 18.4 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.13.tar.gz
Algorithm Hash digest
SHA256 d3dff1ed783349af20c399fd79af69abd8a8880503fd5f52f2d38c3046ff489a
MD5 b92858dc18915bc22c1ec8e9f3d39bce
BLAKE2b-256 329246c927e441afd34f255078cb1040b9f7f353af006233a1ea8b1a60faad46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: odcli-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 16.2 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.13-py3-none-any.whl
Algorithm Hash digest
SHA256 ce3d3d2a0c2f3cbce1781c81366d1a901229afba0926616d0c6c9e64722473b8
MD5 d908375a495394935c1f1bf90a39d511
BLAKE2b-256 af947197a859a9bfe03a54c05ee48071c94a57def970acb26853607c5b8c7dce

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