Let your remote Moltbot read and write to your local Markdown vault β securely.
If you run Moltbot on a server, it can't access notes on your laptop out-of-the-box. This tool creates a secure bridge so your bot can read and write Markdown notes in a specific folder on your local machine (macOS or Linux).
How it works: Your local machine connects to your bot server and keeps a secure channel open. The bot can only run a specific set of commands (vaultctl) β it cannot access other files or run arbitrary programs.
When running Moltbot on a remote server, the Moltbot-bundled obsidian-cli doesn't fully work because many operations require the Obsidian GUI app to be installed in its environment. This headless-vault-cli is the workaround β it lets the remote bot operate on your local folder. Best part: no Obsidian app or vault required! It works with any folder of markdown files.
- Safe Remote Access: The remote bot can only access your notes folder, nothing else.
- No App Needed: Works with any markdown folder, no Obsidian or other note-taking app needed.
- Non-destructive: Only create and append operations β no delete or overwrite β so you can sleep tight even if you set your bot loose.
Setup requires two parts: VPS (where Moltbot runs) and Local Machine (Mac or Linux, where your notes live).
clawdhub install headless-vault-clicat ~/.ssh/id_ed25519.pubIf you get "No such file", generate a key first:
ssh-keygen -t ed25519 -C "moltbot"
# Press Enter 3 times to accept defaults (no passphrase)
cat ~/.ssh/id_ed25519.pubYou'll see something like:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... user@vps
Copy this key β you'll need it for the local machine setup.
macOS:
- Open System Settings β General β Sharing
- Turn on Remote Login
- Under "Allow access for", select your user or "All users"
Linux (Debian/Ubuntu):
sudo apt install openssh-server
sudo systemctl enable --now sshLinux (Fedora/RHEL):
sudo dnf install openssh-server
sudo systemctl enable --now sshdcurl -fsSL https://raw.githubusercontent.com/logancyang/headless-vault-cli/master/setup.sh | bash -s -- <path-to-vault>Replace <path-to-vault> with your notes folder, e.g. ~/Notes or ~/Documents/MyVault.
Or manually:
git clone https://github.com/logancyang/headless-vault-cli.git
cd headless-vault-cli
./install.sh <path-to-vault>vaultctl treeOpen (or create) the authorized_keys file:
vim ~/.ssh/authorized_keysAdd this line (all on one line), replacing <PASTE_VPS_KEY_HERE> with the key you copied from step 2:
command="/usr/local/bin/vaultctl-wrapper",no-port-forwarding,no-X11-forwarding,no-agent-forwarding <PASTE_VPS_KEY_HERE>
So the full line looks like:
command="/usr/local/bin/vaultctl-wrapper",no-port-forwarding,no-X11-forwarding,no-agent-forwarding ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... user@vps
Save and exit (:wq then Enter).
Important: Fix permissions (SSH ignores the file if others can read it):
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keysWhat this does: The command= prefix restricts this key so it can only run vaultctl β even if someone has the key, they can't get a shell or run other commands.
Option A: Manual (for testing)
ssh -N -R 2222:localhost:22 \
-o ServerAliveInterval=30 \
-o ServerAliveCountMax=3 \
-o ExitOnForwardFailure=yes \
user@your-vps.comThe keepalive options detect and kill dead connections within 90 seconds, preventing zombie tunnels.
Option B: Persistent (auto-reconnect)
macOS (launchd):
./setup/tunnel-setup.sh <vps_user> <vps_host> [port]
# Example:
./setup/tunnel-setup.sh deploy my-vps.example.com 2222This installs a launchd service that starts on login, auto-reconnects if connection drops, and logs to /tmp/vaultctl-tunnel.log.
Linux (systemd):
./setup/tunnel-setup-linux.sh <vps_user> <vps_host> [port]
# Example:
./setup/tunnel-setup-linux.sh deploy my-vps.example.com 2222This installs a systemd user service. To keep it running after logout:
sudo loginctl enable-linger $USERssh -p 2222 <local-username>@localhost vaultctl treeReplace <local-username> with your local machine username. To find it, run whoami on your Mac/Linux.
Example:
ssh -p 2222 logan@localhost vaultctl treeIf that works, your Moltbot can now access your notes!
| Command | Description | Example |
|---|---|---|
tree |
List vault structure | vaultctl tree --depth 2 |
resolve |
Find note by path or title | vaultctl resolve --title "Meeting" |
info |
Get file metadata | vaultctl info Projects/Plan.md |
read |
Read entire note | vaultctl read Projects/Plan.md |
create |
Create new note | vaultctl create Notes/New.md "# Title" |
append |
Append to note | vaultctl append Notes/Log.md "Entry" |
set-root |
Change vault directory | vaultctl set-root ~/NewNotes |
All commands output JSON to stdout. Errors go to stderr with exit code 1 (user error) or 2 (system error).
$ vaultctl tree
{"tree": [{"path": "Notes", "type": "dir"}, {"path": "Notes/Ideas.md", "type": "file"}, {"path": "Projects", "type": "dir"}, {"path": "Projects/Plan.md", "type": "file"}]}
$ vaultctl info Projects/Plan.md
{"path": "/Users/me/Notes/Projects/Plan.md", "lines": 42, "bytes": 1337, "sha256": "abc123...", "mtime": 1706000000}
$ vaultctl read Projects/Plan.md
{"path": "/Users/me/Notes/Projects/Plan.md", "content": "# Project Plan\n\n..."}βββββββββββββββββββ reverse tunnel βββββββββββββββββββ
β VPS (Bot) βββββββββββββββββββββββββΊβ Local Machine β
β β localhost:2222 β (Mac/Linux) β
β ssh vaultctl ββββββββββββββββββββββββββΊβ vaultctl β
β <cmd> <args> β β (forced cmd) β
βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
~/Notes/
βββ *.md files
- Forced-command: SSH key can only run
vaultctl, not arbitrary commands - Path sandboxing: All paths validated inside
VAULT_ROOT - No shell access: Bot cannot run
rm,curl, etc. - Non-destructive: No delete or overwrite commands
The vault path is configured automatically during installation and stored in ~/.config/vaultctl/config.
Option 1: Use the set-root command (recommended)
vaultctl set-root <path-to-vault>Option 2: Re-run the installer
./install.sh <path-to-vault>These are automatically configured during setup. You don't need to set them manually.
| Variable | Description | Default |
|---|---|---|
VAULT_ROOT |
Path to vault directory | Set during install |
VAULTCTL_PATH |
Path to vaultctl binary | /usr/local/bin/vaultctl |
VAULTCTL_LOG |
Log file for wrapper | /tmp/vaultctl.log |
Config file location: ~/.config/vaultctl/config
When a new version is released, update both parts:
clawdhub update headless-vault-cliThen start a new Moltbot session (skills are snapshotted at session start).
curl -fsSL https://raw.githubusercontent.com/logancyang/headless-vault-cli/master/setup.sh | bash -s -- <path-to-vault>Replace <path-to-vault> with your notes folder. Same command for install and update.
- macOS (tested on Ventura+) or Linux (Ubuntu 22.04+)
- Python 3.9+
- SSH server enabled
- For persistent tunnel: launchd (macOS) or systemd (Linux)
MIT License - see LICENSE