OpenCLI
Convert any website into a CLI & run Browser Use on your logged-in Chrome. Turn websites and browser sessions into deterministic interfaces for humans and AI agents. Or run Browser Use against any page โ navigate, fill forms, click, extract, automate.
OpenCLI is a general-purpose browser automation CLI for AI agents and an agent-browser alternative. Navigate, inspect, click, fill forms, extract, and screenshot websites without a site adapter. Built-in adapters add reusable, deterministic site commands. See OpenCLI vs agent-browser and migration.
OpenCLI gives you one surface for three different kinds of automation:
- Use built-in adapters for sites like Bilibili, Zhihu, Xiaohongshu, Reddit, HackerNews, Twitter/X, and many more.
- Let AI Agents operate any website โ install the
opencli-browserskill in your AI agent (Claude Code, Cursor, etc.), and it can navigate, click, type/fill, extract, and inspect any page through your logged-in browser viaopencli browserprimitives. - Write new adapters end-to-end with
opencli browser+ theopencli-adapter-authorskill, which guides from first recon through field decoding, code, andopencli adapter test.
Agent command contract
Commands default to JSON: { "ok": true, "data": ... }; failures return
{ "ok": false, "error": { "code": "...", "message": "...", "hint": "..." } }
on stdout with a nonzero exit code. Logs use stderr. Explicit human formats,
help, version and completion retain their own formats; browser follow modes use JSON Lines.
opencli list search --site github
opencli browser open https://example.com --session research
opencli browser network --static --session research
opencli browser chrome describe
opencli adapter check github/search
list returns compact, paginated capabilities (commands, total, nextOffset);
read arguments with <command> --help -f json. Page scope is --session, native
Chrome calls need no session. Adapter authoring is grouped under adapter init|check|test.
state --diagnostics and network --static replace analyze and discover.
This changes CLI syntax and JSON output. JS adapters keep cli({...}),
func(args) and func(page, args); adapter defaultFormat no longer changes the CLI default.
Quick Start
1. Install OpenCLI
For desktop use, start with OpenCLIApp. It bundles the OpenCLI runtime,
keeps the managed opencli command installed, and gives you a system tray UI
for setup, diagnostics, updates, browser-login keepalive, and Web โ Markdown.
Option A โ OpenCLIApp (recommended for macOS / Windows):
Download the latest app from https://opencli.info/download, install it, then
open the app once and use the System page to install or repair the opencli
command.
Option B โ npm global install (CLI-only / CI / servers): OpenCLI requires Node.js >= 20.18.1 when installed through npm.
node --version
npm install -g @jackwener/opencli
2. Install the Browser Bridge Extension
OpenCLI connects to Chrome/Chromium through a lightweight Browser Bridge extension plus a small local daemon. The daemon auto-starts when needed.
Option A โ Chrome Web Store (recommended): Install OpenCLI from the Chrome Web Store.
Option B โ Manual install:
- Download the latest
opencli-extension-v{version}.zipfrom the GitHub Releases page. - Unzip it, open
chrome://extensions, and enable Developer mode. - Click Load unpacked and select the unzipped folder.
3. Verify the setup
opencli doctor
4. Optional: name your Chrome profile
Each Chrome profile runs its own OpenCLI extension instance. If you use multiple Chrome profiles, list the connected profiles and assign local aliases:
opencli profile list
opencli profile rename <contextId> work
opencli profile use work
opencli --profile work browser main state
With only one connected profile, OpenCLI uses it automatically. With multiple connected profiles and no default, OpenCLI asks you to choose instead of guessing.
5. Run your first commands
opencli list
opencli hackernews top --limit 5
opencli bilibili hot --limit 5
For Humans
Use OpenCLI directly when you want a reliable command instead of a live browser session:
opencli listshows every registered command.opencli <site> <command>runs a built-in or generated adapter.opencli doctorhelps diagnose browser connectivity.
Extending OpenCLI
If you want to add your own commands, start with the Extending OpenCLI guide. README keeps this short; the guide covers the directory layout, source-control model, and install commands.
Close temporary browser tabs after use
To remove temporary owned tabs when a workflow finishes:
export OPENCLI_CLOSE_OWNED_TAB=1
opencli web read --url https://example.com --stdout true
# Multi-step browser sessions stay open between calls; close explicitly at the end:
opencli browser close --session research
This opts into closing only the current lease's owned tab. Chrome closes its
window automatically if no tabs remain; existing user pages and other sessions
are preserved. Bound tabs are detached and kept open. The default reusable
container policy, idle expiry, --keep-tab true, and persistent site sessions
remain unchanged. Use --site-session ephemeral for one-shot reads of adapters
that otherwise keep a persistent site session.
Cleanup uses a dedicated action, so older extensions reject it without releasing
the lease, and requires an extension acknowledgement. If cleanup fails or the extension
is too old, a warning reports it separately from the site action. Retry explicit
browser cleanup, or close a remaining one-shot adapter tab manually; do not
repeat a completed site write. Explicit browser close also exits
with an error; a one-shot adapter can still return its already-completed result.
For AI Agents
OpenCLI's browser commands are designed to be used by AI Agents โ not run manually. Install skills into your AI agent (Claude Code, Cursor, etc.), and the agent operates websites on your behalf using your logged-in Chrome session.
Install skills (also refreshes existing installs)
npx skills add jackwener/opencli
Or install only what you need:
npx skills add jackwener/opencli --skill opencli-adapter-author
npx skills add jackwener/opencli --skill opencli-autofix
npx skills add jackwener/opencli --skill opencli-browser
npx skills add jackwener/opencli --skill opencli-usage
OpenCLI no longer ships the sitemap skills. Older opencli-sitemap-author and
opencli-browser-sitemap copies may remain in an agent's separate skills directory after an
upgrade. If they remain, use the agent's removal flow if available; otherwise remove only those two
directories (for example, ~/.agents/skills/opencli-sitemap-author). The location varies by agent;
keep the rest of the skills directory.
Which skill to use
How it works
Once opencli-browser is installed, your AI agent can:
- Navigate to any URL using your logged-in browser
- Read page content via structured DOM snapshots (not screenshots)
- Interact โ click buttons, fill forms, select options, press keys
- Extract data from the page or intercept network API responses
- Wait for elements, text, or page transitions
The agent handles all the opencli browser commands internally โ you just describe what you want done in natural language.
Skill references:
skills/opencli-browser/SKILL.mdโ drive Chrome ad-hoc (navigate, fill forms, click, extract)skills/opencli-adapter-author/SKILL.mdโ write a new adapter end-to-endskills/opencli-autofix/SKILL.mdโ repair broken adaptersskills/opencli-usage/SKILL.mdโ command and site reference
Available browser commands include open, state, click, type, fill, select, keys, wait, get, find, extract, frames, screenshot, scroll, back, eval, network, tab list, tab new, tab select, tab close, chrome describe, chrome call, and close.
opencli browser commands require a --session <name> option for page operations. opencli browser --session work open <url> and opencli browser --session work tab new [url] both return a target ID. Use opencli browser --session work tab list to inspect target IDs, then pass --tab <targetId> to route a command to a specific tab. tab new creates a new tab without changing the default browser target; only tab select <targetId> promotes that tab to the default target for later untargeted commands in the same session.
Writing a new adapter
When the site you need is not yet covered, use the opencli-adapter-author skill end-to-end:
- Recon the site and pick a pattern (SPA / SSR / JSONP / Token / Streaming).
- Discover the right endpoint โ network inspection, initial state, bundle search, token trace, or interceptor fallback.
- Pick auth โ
PUBLIC/COOKIE/INTERCEPT/UI/LOCAL. - Decode response fields and design output columns.
opencli browser recon analyze <url>โopencli browser recon init <site>/<name>โ write adapter โopencli browser recon verify <site>/<name>.- Site knowledge persists to
~/.opencli/sites/<site>/so the next adapter for the same site starts from context.
Configuration
opencli browser * requires an explicit --session <name> option for page operations, uses a foreground browser window by default, and keeps that session's tab lease until opencli browser --session <session> close or idle cleanup. Browser-backed adapters use a background adapter window and release one-shot tab leases by default. Interactive adapters can declare siteSession: 'persistent' to keep a stable site tab for continuity; pass --site-session ephemeral for a one-shot tab.
Built-in Commands
Curated highlights โ โ see all 100+ supported sites & commands (douyin / weibo / spotify / 1688 / quark / nowcoder / google-scholar / hupu / xianyu / weread / weread-official / xiaoyuzhou / Chess.com / and more).
Download Support
OpenCLI supports downloading images, videos, and articles from supported platforms.
For video downloads, install yt-dlp first: brew install yt-dlp
opencli xiaohongshu download "https://www.xiaohongshu.com/search_result/<id>?xsec_token=..." --output ./xhs
opencli xiaohongshu download "https://xhslink.com/..." --output ./xhs
opencli rednote download "https://www.rednote.com/search_result/<id>?xsec_token=..." --output ./rednote
opencli bilibili download BV1xxx --output ./bilibili
opencli twitter download elonmusk --limit 20 --output ./twitter
opencli 1688 download 841141931191 --output ./1688-downloads
opencli xiaoyuzhou download 69b3b675772ac2295bfc01d0 --output ./xiaoyuzhou
opencli xiaoyuzhou transcript 69dd0c98e2c8be31551f6a33 --output ./xiaoyuzhou-transcripts
opencli xiaoyuzhou download and transcript require local Xiaoyuzhou credentials in ~/.opencli/xiaoyuzhou.json.
Output Formats
All built-in commands support --format / -f with json (default), table, yaml, md, and csv.
opencli bilibili hot -f json # Pipe to jq or LLMs
opencli bilibili hot -f csv # Spreadsheet-friendly
opencli bilibili hot -v # Verbose: show pipeline debug steps
Exit Codes
opencli follows Unix sysexits.h so CI / scripts can branch on failure mode: 0 success, 66 empty result, 69 Browser Bridge down, 75 timeout, 77 auth required, 78 config error, 130 Ctrl-C. Full reference: docs/guide/exit-codes.md.
Plugins
Extend OpenCLI with community-contributed adapters:
opencli plugin install github:user/opencli-plugin-my-tool
opencli plugin list
opencli plugin update --all
opencli plugin uninstall my-tool
Albato, Goofish and Taobao use local adapter-subdirectory installation; see the installation notes.
See Plugins Guide for creating your own plugin.
Testing
See TESTING.md for how to run and write tests.
Troubleshooting
- "Extension not connected" โ Ensure the Browser Bridge extension is installed from the Chrome Web Store and enabled in
chrome://extensions. - "attach failed: Cannot access a chrome-extension:// URL" โ Another extension may be interfering. Try disabling other extensions temporarily.
- Empty data or 'Unauthorized' error โ Your Chrome/Chromium login session may have expired. Navigate to the target site and log in again.
- Node API errors / missing
fetch/ startup crash on old Node โ OpenCLI requires Node.js >= 20.18.1. Runnode --version, upgrade Node if needed, then retry. - Daemon issues โ Check status:
curl localhost:19825/statusยท View logs:curl localhost:19825/logs