Skip to main content
The @browser tool drives a real local Chrome/Chromium browser so the agent can see and interact with web pages the way a person would: open a URL, read the rendered page as text (shadow DOM and same-origin iframes included), find text on it, click with a real mouse, type into inputs and rich-text editors, run JavaScript, capture screenshots it then looks at, read response bodies, list downloads, and inspect the page’s console and network activity. When a site puts up a bot challenge (Cloudflare, a captcha), the tool says so instead of pretending the block page is the content, and hands the window to you. It is the verification loop for web work — the agent builds or changes a frontend, then actually looks at it and debugs it from what the page logged and requested, instead of guessing from source.
@browser speaks the Chrome DevTools Protocol (CDP) directly over the websocket client ChatCLI already ships — zero new dependency, no driver, no downloaded runtime, no API key. It only needs a locally installed Chromium-family browser (Google Chrome, Chromium, Brave or Edge).

How it works

  1. Lazy launch — the first open starts one browser; every later command reuses that single stateful session.
  2. CDP over websocket — navigation, DOM reads, screenshots and event capture all flow over the DevTools websocket. No Selenium/Playwright, no external binary.
  3. Snapshot as text — the page is rendered to model-friendly text with every interactive element stamped and numbered (with its state: value, checked, disabled, expanded…) so the agent can address them precisely. The scan reaches into open shadow roots and same-origin iframes; cross-origin frames are listed so the agent knows a captcha or an embedded login lives there. Password fields never show their value.
  4. Continuous capture — console messages (errors included) and network responses are captured into bounded rings, so you can ask “what did the page log?” after the fact.
  5. Visible on demand — the browser is headless by default, but the agent can put the window on your screen with show (or open --visible) whenever you need to act — log in, pick an account, solve a captcha — then take it back with hide. The switch relaunches the browser on the same profile, so cookies and logins survive it.
  6. Looks like the browser it is — a headless session presents the same user agent, client hints, language and a laptop-sized viewport as the headed browser would, so sites serve it their normal page instead of a block page for “HeadlessChrome”.
  7. Dies with the session — a browser ChatCLI launched never outlives it; it is closed on CLI shutdown (or explicitly with close).

Subcommands

Invoke with a JSON envelope {cmd, args} or the flat argv form. The model calls @browser automatically in /agent and /coder when it needs to look at a page.

Refs vs. CSS selectors

Every snapshot stamps each interactive element with a data-chatcli-ref attribute and returns a numbered listing. click and type accept either that [n] ref number or a raw CSS selector:
Each line carries the element’s label the way an accessibility tree would resolve it (aria-label, <label for>, placeholder, alt text…) and its state: the current value, checked/unchecked, disabled, expanded/collapsed, selected, the role, and in iframe when it lives in an embedded frame. A password field shows value=<hidden> — its value never reaches the transcript, and what the agent types into one is not echoed either. click sends real mouse events at the element’s center (the page sees mousedown/mouseup/click like a person’s click, which React synthetic handlers, maps and drag-and-drop widgets need). When the center is covered by another element — a sticky header, a modal, a cookie banner — the click is dispatched programmatically instead and the result says what covered it. type sets the value of inputs and textareas through the native setter (frameworks see the change) and inserts text into rich-text editors (contenteditable: LinkedIn, Slack, Notion, ProseMirror, Draft.js…) through the browser’s input pipeline, so the editor receives beforeinput/input like a keystroke and its Send button enables. --append keeps what was there; clear empties it.
Refs are stable until the next navigation. After you open a new URL or a click triggers navigation, take a fresh snapshot before addressing elements by [n] again.

Reading a long page

A snapshot caps the page text (12 KB by default) so a busy page never floods the context. Nothing is lost: the cap is a window, and the tool tells the agent how to move it.
find is the first move on an unfamiliar page: it stamps refs exactly like snapshot, so the [n] it returns is clickable right away, and it searches the whole text, including what the snapshot window did not show. Every result ends with a range footer ([text bytes 0–12000 of 48210; --offset 12000 continues]), so the agent reads the page in order instead of guessing with eval. eval runs in the DevTools REPL mode: const data = … in one call and const data = … again in the next is fine (no “Identifier has already been declared”), and await fetch(…) works at the top level.

Bot challenges and block pages

Some sites answer a first visit with an interstitial — Cloudflare’s “Just a moment…”, a captcha, a “Press & Hold”, an “Access denied” — instead of the page. @browser recognizes the common ones (Cloudflare, reCAPTCHA, hCaptcha, PerimeterX/HUMAN, DataDome, Imperva, Akamai, AWS WAF, and generic access-check pages by their title and text) and reports them as what they are:
open first waits a few seconds for a challenge that clears by itself (a managed challenge often does in a real browser), and only then reports it. The hand-off is the same as for a login:
wait --unblocked fires when no challenge is showing — the right condition here, since a challenge page keeps the URL of the page it protects, so --url and --changed never fire. find and snapshot carry the same warning as long as the block page is up, so the agent never mistakes it for content. A captcha widget on a normal form (a sign-up page, say) is not reported as a block: it is just one more element, and it lives in a cross-origin iframe the snapshot lists.
This is detection and a polite hand-off, not evasion. The headless session identifies itself as the browser it is (a real Chrome, headless marker removed, your language, a laptop viewport), which is what a normal visit looks like; a site that refuses automated browsers outright still refuses it, and the agent tells you so.

Network bodies and downloads

network lists what the page requested. With --filter it keeps only URLs containing a substring, and with --body it returns the body of the newest match — the JSON an API call answered, the HTML of a fragment, the error page behind a 500:
Bodies are capped (8 KB by default, --max raises it), binary bodies are described rather than dumped, and they are only available while the page that received them is still loaded. Files the page downloads — a report, an export, a PDF behind a button — are saved in the session scratch directory (the same place screenshots go), never in your Downloads folder, and downloads lists them with their state and path so the agent can hand them to @view or @coder read. An attached browser (CHATCLI_BROWSER_CDP_URL) keeps its own download settings.

Let the user log in (visible hand-off)

The agent’s browser starts as a throwaway profile: none of the sessions in your everyday Chrome exist there. So when a task hits a login wall, the agent hands the window to you instead of guessing credentials:
wait accepts --url, --text, --selector, --changed, --unblocked and --idle (all must hold when combined). --changed fires when the URL leaves the one it had when the wait started — the right condition when the landing page cannot be predicted (GitHub, for instance, ignores the login’s return_to and lands on its home page). A timeout is reported as a result, including where the page moved from if it did move, so the agent can ask you or wait again. Without a page condition to wait for, the agent asks you directly with @ask. Logins done this way live for the rest of the ChatCLI session; to keep them across runs, set CHATCLI_BROWSER_PROFILE (below).
OAuth providers often open the sign-in flow in a popup. tabs lists it and tab 2 lets the agent drive it — or you finish it yourself in the visible window.
Signing in with Google. Google refuses password sign-in in browsers it detects as automated (“This browser or app may not be secure”). ChatCLI launches Chrome with the automation marker off (navigator.webdriver is false), which is what that check looks at. If Google still refuses, sign into the site with a password or passkey instead of the Google button, or attach ChatCLI to the Chrome you are already signed into with CHATCLI_BROWSER_CDP_URL (below).
If you close the tab or the window while the agent is waiting, wait reports it instead of failing, and the next open/show attaches a fresh tab — the browser session itself keeps running.

A worked example

Build a page in /coder, then verify it end to end:
The agent now knows the button worked in the UI but the backend returned 500, and the exact console error — the full verify-and-fix loop without leaving ChatCLI.

Environment variables


Security

Observation commands are read-only and skip the confirmation prompt — the agent can look freely: open, show, hide, wait, snapshot, text, find, screenshot, html, pdf, resize, tabs, tab, cookies (listing), console, network (bodies included), downloads, scroll, back, forward, reload, status, close. Commands that act on a page — click, type, clear, press, hover, select, upload, eval and cookies --clear — can trigger real actions on remote sites (or log you out of everything), so they go through the standard security gate like any other mutating tool. See Coder Mode Security. cookies never returns cookie values: the agent can tell that a session cookie exists for a domain, but a token never lands in the transcript. Password fields show value=<hidden> in every snapshot, and what the agent types into one is not echoed back — still, the right way to enter your password is in the visible window, yourself.
@browser drives a real browser signed into whatever profile it runs on. The default throwaway profile is the safe choice for untrusted pages; a persistent profile (CHATCLI_BROWSER_PROFILE) or your own browser (CHATCLI_BROWSER_CDP_URL) hands the agent every login stored there — treat click/type/eval on external sites as the side-effecting operations they are.

Notes

  • One session per process, launched lazily on the first open and reused across every call.
  • Console and network are captured continuously into bounded rings — console/network read the recent history, they don’t need to be “armed” first.
  • screenshot writes a PNG in the session scratch directory (--file name names it there) and attaches it to the conversation through the same vision pipeline as @view, so the model sees what it captured on the next turn without a second call. --view false only saves the file; outside an agent loop (chatcli tool @browser screenshot) the result is just the path.
  • A snapshot that starts with “Bot challenge detected” is the block page, not the content — see above. The agent is told never to retry open in a loop against it.
  • alert(), confirm() and prompt() dialogs are accepted automatically (they would otherwise freeze the page) and traced in console as [dialog] entries.
  • A browser ChatCLI launched is always closed on ChatCLI shutdown; a stray headless Chrome never survives the session. An attached browser (CHATCLI_BROWSER_CDP_URL) only loses the tab ChatCLI opened.

Next steps

Image Input (@view)

The vision pipeline @browser screenshot attaches through; @view for any other image or PDF.

Plugin @coder

Read, write, patch and run — pair it with @browser to build then verify.

Agentic Plugins

The full builtin tool catalog and how the agent uses them.

Web Tools

@webfetch, @websearch and the shared hardened HTTP client.