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

OpenClaw Agent Gains Phone Call Capability Through Custom Skill
A developer created a custom skill for self-hosted OpenClaw agents that enables phone call functionality, allowing the agent to initiate calls based on triggers like build completions or server outages. The implementation provides voice interaction with full chat capabilities including web searches and alert setup.

Mymir: An Open-Source Project Graph for Coding Agents via MCP
Mymir gives agents a graph-based project map with dependencies, decisions, acceptance criteria, and previous execution notes, delivered via MCP to avoid re-explaining state across sessions.

Local-First Movie Recap Pipeline Using Whisper + CLIP + Ollama
A fully local pipeline that auto-generates narrated movie recap videos using Whisper, CLIP, Ollama, Edge TTS, and FFmpeg. Drop in a movie file, get a narrated recap in ~15 minutes.

Claude Skill Enables Granular Personality Adjustments with Quantified Variables
A new Claude skill allows developers to make quantified adjustments across 32 groups of personality traits covering 120 Claude-defined variables, with group-level profiles showing metrics like Wordiness (60), Agreeableness (55), and Sarcasm & Edge (17). The skill persists across conversations and includes a publish command for custom instructions.