Browser CLI: A Token-Efficient Browser Automation Tool for AI Coding Agents

What Browser CLI Does
Browser CLI is a browser automation tool built to address token overhead in AI coding agents. The creator noticed browser verification was consuming ~30,000 tokens per session through Playwright MCP protocol overhead, with each browser_navigate + browser_snapshot call costing ~1,500 tokens in JSON schema framing.
The solution is a persistent headless Chromium daemon that you interact with via Bash commands. It uses the same Playwright ARIA snapshot technology underneath but achieves ~50-100 tokens per call instead of ~1,500.
Commands and Usage
Available commands include:
browser-cli goto https://example.com- Navigate to URLbrowser-cli snapshot -i- ARIA tree with @e refsbrowser-cli click @e3- Click by refbrowser-cli fill @e5 "hello"- Fill inputbrowser-cli css @e3 font-size- Get computed CSS valuebrowser-cli inspect @e3- Full box model + stylesbrowser-cli screenshot /tmp/page.png- Screenshotbrowser-cli snapshot -D- Diff: what changed since last snapshotbrowser-cli responsive /tmp- Screenshots at mobile/tablet/desktop
The server auto-starts on first call (~3s), then subsequent calls are ~100-200ms. It stays alive for 30 minutes, preserving cookies, tabs, and state between commands.
Token Savings
Token comparison:
- Playwright MCP: ~1,500 tokens per call, ~30,000 tokens for 20 calls
- Browser CLI: ~75 tokens per call, ~1,500 tokens for 20 calls
That's 95% savings on browser verification. For automated pipelines that do multiple tasks per session, this compounds fast.
Features Beyond Playwright MCP
- CSS inspection -
css @e3 paddingreturns computed values.inspect @e3gives full box model + 16 key styles as JSON. - Live style mutation -
style @e3 color redwithstyle --undo. Debug CSS without touching source code. - Snapshot diffing -
snapshot -Dcompares before/after ARIA trees. - Responsive presets -
responsive /tmptakes mobile + tablet + desktop screenshots in one command. - Auth profiles -
handoffopens a visible Chrome for manual SSO/MFA login,resumegoes back to headless,auth-save adminencrypts the session (AES-256). Next time:goto-auth https://app.com/dashboard --profile admin— no login needed. - Command batching -
chain [["goto","url"],["snapshot","-i"],["console"]]runs multiple commands in one call.
Technical Implementation
Architecture: AI Agent → Bash → CLI client (bin/browse.mjs) → HTTP POST (localhost) → Server (src/server.mjs) → Playwright API → Chromium (headless).
Pure Node.js. Playwright is the only dependency. No Bun, no Rust, no MCP overhead.
Claude Code Integration
Install globally:
npm install -g @tuandm/browser-cliAdd to .claude/settings.json:
{
"permissions": {
"allow": ["Bash(browser-cli*)"]
}
}Add a rule at .claude/rules/browser-cli.md telling Claude to use Browser CLI instead of Playwright MCP. The creator ran 5 eval scenarios and Claude picked the right command every time with the rule loaded.
It also ships as a Claude Code plugin (plugin.json included) for future marketplace distribution.
Inspiration and Technology
Inspired by gstack by Garry Tan, which pioneered the persistent Chromium CLI approach for AI agents. The core insight was that Bash commands are dramatically more token-efficient than MCP for browser automation. The underlying technology is Playwright by Microsoft.
📖 Read the full source: r/ClaudeAI
👀 See Also

SkillMesh: MCP-Friendly Router for Large Tool Catalogs Reduces Context Size by 70%
SkillMesh is an MCP-friendly router that retrieves only relevant expert cards for AI agent queries, reducing context size by 70% and improving tool selection. It supports Claude via MCP server, Codex skill bundles, and OpenAI-style function schemas.

Solitaire: Open-Source Identity Layer for AI Agents Built with Claude Code
Solitaire is an open-source identity layer for AI agents that evolves through interaction rather than static configuration. It's been tested across 600+ production sessions and stores all data locally using SQLite + JSONL with no cloud dependencies.

clarp: Open Source Drop-In Replacement for Claude -p Before June 15 Metered Pricing
Claude -p moves to metered pricing on June 15. clarp is an open source CLI that replaces it for local workflows — just change the binary name from claude to clarp.

Local AI Agent Workflow Using OpenCode, FastMCP, and DeepSeek-r1
A developer shares their local AI agent setup using OpenCode with AGENTS.md files for deterministic system prompts, FastMCP for exposing local functions, and DeepSeek-r1 via Ollama for specific subagents like testing.