README file from
GithubAny AI CLI

Run any local AI coding CLI — Claude, Codex, or your own — inside a right sidebar terminal in Obsidian.
The plugin embeds a real PTY-backed terminal in the sidebar and lets you declare an unlimited list of CLI runtimes from settings (each with a display name and a launch command). Pick one from a dropdown to start it in your active vault folder, switch between them on the fly, and inject the active file or folder as a mention with one click.
Features
- Dedicated sidebar view with an embedded
xtermterminal. - Customizable runtime list — declare any number of CLI runtimes from settings (Claude and Codex are pre-populated; add Aider, custom wrappers, anything on
PATH) and switch between them via a sidebar dropdown. - One-click
@active fileand@active folderbuttons that insert the current note path (or its parent folder) as a mention in the running CLI's stdin. - Process controls in the toolbar:
Start,Stop,Restart,Clear. - Launches the selected runtime in the current active vault folder so the AI sees your notes as the working tree.
- Resilient PTY stack with multi-tier fallbacks (
node-pty→ Python PTY bridge → direct pipe →script) so it works on macOS, Linux, and Windows. - Visible runtime status (
Status: ...) and clear error reporting in the panel.
Requirements
- Obsidian Desktop 1.7.2 or newer (
isDesktopOnlyplugin). - Node.js available on the machine.
- At least one AI coding CLI installed on
PATH(e.g.claude,codex,aider). - For the Python PTY fallback on macOS/Linux:
python3recommended.
Install in a Vault
Recommended — from a GitHub release
-
Open the latest release.
-
Download
any-ai-cli-<version>.zip. -
Unzip it directly inside your vault's plugin folder so the resulting path is:
/PATH/TO/VAULT/.obsidian/plugins/any-ai-cli/ -
In Obsidian, enable the plugin:
Settings → Community plugins → Installed plugins → Any AI CLI.
That's it. No commands required — the plugin uses an embedded Python PTY bridge fallback so it works out of the box on macOS / Linux (and falls back to direct pipe mode on Windows).
Optional — install the native PTY backend for best terminal fidelity
The bundle ships without node-pty (a native module that has to be compiled for your specific Node ABI). The plugin works without it, but installing it gives you a fully native PTY (better full-screen TUI rendering and resize behavior). To enable it:
cd "/PATH/TO/VAULT/.obsidian/plugins/any-ai-cli"
npm install --omit=dev
Reload the plugin afterwards.
Manual install / dev clone
- Clone or copy the repository into
/PATH/TO/VAULT/.obsidian/plugins/any-ai-cli/. - Run
npm installandnpm run buildinside the folder to producemain.js. - Enable the plugin in
Settings → Community plugins.
Required files
The community-store auto-install and the release zip both ship only the three canonical Obsidian plugin files. Everything else the plugin needs at runtime is bootstrapped from main.js:
In the release zip / plugin folder:
manifest.json— Obsidian plugin metadata (id, version, minAppVersion).main.js— bundled plugin code. Embeds the full source ofpty-proxy.jsandpty-bridge.py(injected by esbuild'sdefineat build time) and writes them next to itself on firstStart.styles.css— sidebar / toolbar / dropdown styling. Without it the panel renders with raw browser defaults.
Auto-generated on first run (from main.js):
pty-proxy.js— Node child process that runs your CLI inside a PTY.pty-bridge.py— Python PTY fallback used on macOS/Linux whennode-ptyis not installed.
Available on the GitHub release page but not in the zip:
versions.json— used by Obsidian to find a backwards-compatible plugin version when the currentminAppVersionis too high for the user's app. Obsidian fetches it directly from the release URL.
Not shipped with the plugin (only in the repo, for advanced users):
package.json+package-lock.json— needed only if you opt into the nativenode-ptybackend. Download them from the repo for the matching tag, drop them in the plugin folder, and runnpm install --omit=dev.
Usage
- Click the bot ribbon icon, or run the command palette entry
Open panel, to reveal the panel on the right. - Use the runtime dropdown on the first toolbar row to pick which CLI to launch (Claude, Codex, or any custom entry you added).
- Click
Startto launch the selected runtime in the active vault folder. - While the CLI is running:
- Click
@active fileor@active folder(second toolbar row) to insert the current note path or its parent folder as a mention. - Click
Restartto relaunch,Stopto terminate,Clearto wipe the terminal output.
- Click
- Switching the dropdown to another runtime while a process is running automatically restarts it on the new CLI (configurable in settings).
Plugin Settings
General:
- Default runtime — which configured runtime is selected when the panel opens (and used by auto-start).
- Auto-start — start the default runtime automatically when the panel opens.
- Auto-restart on runtime switch — when you change the runtime from the sidebar dropdown while a process is running, restart it immediately to apply the new selection.
Runtimes section (the customizable list of CLIs shown in the sidebar dropdown):
- Each entry holds a display name and a launch command. Examples:
Claude→claudeCodex→codex --no-alt-screen -c check_for_update_on_startup=false ...Aider→aider --model openrouter/...
- Add as many entries as you need with Add runtime. Remove unused ones via the trash icon (the list must keep at least one entry).
- Claude and Codex are pre-populated on first install. Old
command/codexCommandsettings from earlier versions are migrated automatically.
Advanced:
- Node executable — path to the Node binary used to run the PTY proxy. Leave as
autofor automatic detection, or override with an explicit path (/opt/homebrew/bin/node,C:\Program Files\nodejs\node.exe, etc.).
Runtime Architecture (Fallback Chain)
The plugin tries multiple strategies to maximize startup success:
- PTY via
node-pty - Python PTY bridge fallback (
pty-bridge.py) on macOS/Linux - Direct pipe fallback (
child_process) scriptfallback (last resort on Unix)
Status and logs clearly show the active strategy (proxy-warn, proxy-info, etc.).
Troubleshooting
command not found: <cli>
The CLI binary is not in Obsidian's process PATH. Either:
- Edit the runtime entry in settings and set the Launch command to an absolute path, for example
/Users/<you>/.local/bin/claudeor/opt/homebrew/bin/codex. - Or adjust your shell/Obsidian environment so the CLI resolves on
PATH.
Cannot find module 'node-pty'
Since 0.1.25, this no longer crashes the plugin — node-pty is optional and the proxy automatically falls back to the Python bridge (or direct pipe). If you want the native PTY backend anyway:
cd "/PATH/TO/VAULT/.obsidian/plugins/any-ai-cli"
npm install --omit=dev
posix_spawnp failed
Native PTY failed in the current runtime environment.
- Plugin should automatically fallback to Python/pipe mode.
- Ensure
python3is installed for Python PTY fallback.
Empty panel
- Ensure
main.jsandstyles.cssare up to date - Reload plugin (disable/enable)
- Open Obsidian developer console if needed
Local Development
npm install
npm run lint
npm run test
npm run build
npm run dev: esbuild watch modenpm run build: compilemain.ts->main.jsnpm run lint: run eslint-plugin-obsidianmd so violations of the Obsidian community-store guidelines are caught locally before submission
Test Stack
- Framework: Vitest
- Tests:
tests/**/*.test.ts - Commands:
npm run testnpm run test:watch
CI
GitHub Actions workflow: .github/workflows/ci.yml
Triggers:
pushpull_request
Steps:
npm cinpm run lintnpm run testnpm run build
Release
GitHub Actions workflow: .github/workflows/release.yml
Triggered by pushing a git tag (e.g. 0.1.25):
git tag 0.1.25
git push origin 0.1.25
The workflow:
- Checks out the repo and runs
npm ci+npm run build. At build time,esbuildinlinespty-proxy.jsandpty-bridge.pyintomain.js(viadefine) so they no longer need to ship as separate files. - Stages the three canonical Obsidian plugin files (
manifest.json,main.js,styles.css) into anany-ai-cli/folder. - Zips it as
any-ai-cli-<tag>.zipfor drop-in install. - Publishes a GitHub Release as a draft, attaching the zip plus standalone
manifest.json,main.js,styles.css, andversions.json(the assets Obsidian's plugin update protocol and tools like BRAT actually fetch). - Auto-generates release notes from the commit history.
Before tagging, keep these versions in sync: manifest.json, versions.json, package.json.
Main Files
main.ts: Obsidian plugin logicmain.js: built distribution filestyles.css: terminal panel stylingmanifest.json: Obsidian plugin metadatapty-proxy.js: runtime proxy (Node)pty-bridge.py: Python PTY fallbackruntime-utils.ts: testable shared utilitiestests/runtime-utils.test.ts: unit tests
Platform Notes
- macOS/Linux: full support with Python PTY fallback
- Windows: support via
node-ptyor pipe fallback - Obsidian Mobile: not supported (
isDesktopOnly)
License
MIT