# chrome-agent [![Crates.io](https://img.shields.io/crates/v/chrome-agent)](https://crates.io/crates/chrome-agent) [![npm](https://img.shields.io/npm/v/chrome-agent)](https://www.npmjs.com/package/chrome-agent) [![CI](https://github.com/sderosiaux/chrome-agent/actions/workflows/ci.yml/badge.svg)](https://github.com/sderosiaux/chrome-agent/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![Rust 2024](https://img.shields.io/badge/Rust-2024_edition-orange)](https://doc.rust-lang.org/edition-guide/rust-2024/)

chrome-agent — web tasks that compile

English | 简体中文

**Make websites learnable by agents.** Our mission is to turn websites into capabilities that agents discover, verify, reuse and maintain themselves. The calling agent supplies the reasoning; chrome-agent preserves the discovered knowledge and its validation evidence. Shared recipes will have a GitHub catalogue with automated validation and updates, starting with reading and extraction. Recipes that modify a site will follow later. Local and private recipes will use the same lifecycle. Today, chrome-agent provides the execution foundation: a 3 MB Rust binary over CDP, browser observations, assertions, structured outputs and local macros. It reports retained values, intercepted clicks and missing observations so the calling agent can check what happened. The repository now includes a [persistent discovery protocol](docs/discovery.md): the calling agent records experiments, resumes them across processes and exports local candidate macros. Autonomous discovery without a supplied procedure and independent recipe acceptance remain M1 and later roadmap gates; there is no public catalogue yet. Read the [mission](docs/mission.md) and [implementation roadmap](docs/roadmap.md). > Independent project. Not affiliated with, endorsed by, or sponsored by Google or the Chrome team. ## Install ```bash npx skills add sderosiaux/chrome-agent # skill file + binary, for coding agents npm install -g chrome-agent # prebuilt binary cargo install chrome-agent # from source ``` Linux builds are static musl binaries, so they run on any distro without a glibc version to match. ## 60-second quickstart ```bash # Navigate and read the page as an accessibility tree with stable uids chrome-agent goto https://example.com --inspect # uid=n9 heading "Example Domain" level=1 # uid=n12 link "More information..." # Act by uid, by CSS selector, or by coordinates chrome-agent click n12 --inspect chrome-agent click --selector "button.submit" chrome-agent click --xy 100,200 # Fill and check what the page kept chrome-agent fill --uid n20 "user@test.com" chrome-agent assert value --uid n20 --equals "user@test.com" # Get content, not markup chrome-agent read chrome-agent extract --limit 30 chrome-agent text --selector "main" --truncate 500 # Everything is available as JSON chrome-agent --json eval "document.title" ``` Chrome stays alive between invocations, so a command costs a connection, not a browser launch. Use `--browser ` to give each parallel agent its own Chrome and its own session state. ## Commands ### Navigation and session | Command | What it does | |---|---| | `goto [--inspect] [--max-depth N] [--header "K: V"]` | Navigate. Auto-prefixes `https://`. Reports `landed` (see below). `--header` is repeatable. | | `back [--inspect]` | History back. Answers `url` and `title`, or a message when there is nowhere to go. | | `forward [--inspect]` | History forward. Same answer, opposite sign. | | `history [--filter pattern]` | Pages this browser visited. | | `tabs` | List open tabs. | | `status` | Browsers the session store knows, their pids, and running ones no entry claims (`orphan=`). | | `close [--purge] [--orphans]` | Stop the browser. `--purge` deletes cookies and profile. `--orphans` closes unclaimed browsers. | ### Reading the page | Command | What it does | |---|---| | `inspect [--verbose] [--max-depth N] [--uid nN] [--filter "role,role"] [--scroll] [--limit N] [--urls] [--max-chars N] [--offset K]` | Accessibility tree with uids. `--urls` resolves link hrefs. Narrowing flags change what is PRINTED; the stored baseline is always the full tree. | | `diff` | What changed since the last inspect, compared against that full baseline. | | `text [uid] [--selector "css"] [--truncate N]` | Visible text of the page or one element. | | `read [--html] [--truncate N]` | Article extraction via Mozilla Readability. | | `extract [--selector "css"] [--limit N] [--scroll] [--a11y]` | Auto-detect repeating records (products, feeds, search results). No selectors needed. `--a11y` for React SPAs. | | `eval [--selector "css"]` | JS in page context. `el` is the matched element. | | `screenshot [--filename name] [--format jpeg\|png] [--quality N] [--max-width N] [--uid nN\|--selector "css"]` | Screenshot to a file path. `--uid`/`--selector` clip to one element. | | `pdf [--filename name] [--landscape] [--background]` | Print the page to PDF. | | `download [--out path] [--timeout N] [--max-bytes N]` | Fetch in-page so cookies and auth carry over. Also `download --uid nN` / `--selector "css"` to click and capture a browser-native download. | ### Acting | Command | What it does | |---|---| | `click [--selector "css"] [--xy X,Y] [--inspect]` | Click. Falls back to JS `.click()` when there is no box model. | | `dblclick ` | Double-click, same three targeting modes. | | `fill --uid [--secret] [--inspect]` | Fill an input. Also `--selector "css"`. Reports what the page kept; `--secret` reports only its length. | | `fill-form ...` | Fill several fields, one kept-value report per field. | | `select --uid ` | Pick a ``" | A custom React/MUI dropdown. | Click to open, then click the option. | | Verdict is `unchanged` on a click that worked | Canvas, CSS-only or late effects are invisible to the tree. | `wait`, then `assert`. | | 403 or a captcha with `--stealth` | Managed Turnstile, DataDome or Kasada. | `--connect` to a real Chrome. | | `serving: nothing_actionable` on a page you know renders | The settle probe stopped before first paint. | Run `inspect`. | | Blocked on a native `alert`/`confirm` | You passed `--dialog manual`. | Drop it, or answer the dialog. | | `network --abort` catches nothing | It is blocking and runs for `--live N` seconds. | Start it before navigating. | ## Structured extraction `extract` finds repeating records structurally with MDR/DEPTA-style heuristics (sibling similarity, content heterogeneity, text-to-link ratio) instead of asking a model to read the DOM. On the Hacker News front page it hands over 30 stories as records in 1,571 tokens against 5,652 for the accessibility tree and 8,727 for raw HTML ([`scripts/measure.sh`](scripts/measure.sh)). The gap depends on the page: on a blog archive that is nothing but a list, the two are close. ## Current scope The runtime targets Chrome through CDP. It has no built-in model, MCP server, hosted scheduler, or managed browser fleet. The roadmap defines the discovery and recipe capabilities to build on this executor. Existing commands remain available while that work proceeds. ## Using it from an agent `npx skills add sderosiaux/chrome-agent` installs a SKILL.md. Otherwise `chrome-agent --help` embeds a full LLM usage guide, and every error carries a `hint` naming the next action. Claude Code permissions: `{"permissions": {"allow": ["Bash(chrome-agent *)"]}}`. ``` chrome-agent (3 MB Rust binary, ~30.9K lines of Rust in src/) | CDP over WebSocket v Chrome (headless by default, no Node.js, no runtime) ``` Design records live in [`docs/design/README.md`](docs/design/README.md). ## Built on chrome-agent - [chrome-agent-search](https://github.com/ominiverdi/chrome-agent-search) — search (Bing, Brave, DuckDuckGo) and read pages through chrome-agent, JSON output. ## License MIT