$ show sleepinginsummer/agent-browser-cli
agent-browser-cli is a CLI tool that enables AI agents to perceive and control a real Chrome browser session. It consists of a Rust CLI that communicates with a local daemon via HTTP API, which in turn communicates with a Chrome extension via WebSocket. The system preserves the user's login state and cookies while providing capabilities like tab management, page inspection, JavaScript execution, screenshots, and CDP access. The architecture cleanly separates concerns: the CLI handles user input, the daemon manages persistent connections, and the extension executes commands in the browser context.
The LLM identified 2 files worth highlighting for reuse:
This module resolves user input into either a web URL or local file path, handling complex edge cases like platform-specific paths, symbolic links, home directory expansion (~), and proper URL scheme detection. It demonstrates non-obvious skill in input validation by correctly distinguishing between file paths and URLs even when ambiguous (e.g., 'example.com' could be a local file or web URL), prioritizing existing files over web assumptions, and rejecting unsupported schemes. The component is highly reusable as it has minimal dependencies, clear inputs/outputs, and solves a common problem in CLI tools that accept file/URL inputs.
This module provides HTML optimization functions designed to reduce token consumption when processing web pages for AI agents. It includes functions like optimize_html_for_tokens() which cleans DOM nodes by removing unnecessary attributes while preserving meaningful ones, smart_truncate() which intelligently truncates HTML while preserving readability, and changed_elements() which detects differences between HTML snapshots. The component demonstrates skill in balancing information preservation with token efficiency, using standards-compliant HTML parsing libraries. It is reusable as it consists of pure functions with clear contracts that could be extracted for use in any web scraping or automation pipeline needing HTML preprocessing.