AI browser automation and verification
BrowserHUB
Real browser automation with evidence-based AI verification. Claude Code drives a real browser through 16 MCP tools, every action streams to a live watcher, and a feature only passes when the observed URL, page state and screenshots say so, not because a tool call returned.
Overview
BrowserHUB connects Claude Code to a real browser through structured MCP tools. The agent can navigate, click, type, scroll, read page state, extract content and take screenshots, then decide what to do next from what it actually observed. It is packaged as a Claude Code plugin, with hooks, skills and supporting scripts, so it fits the workflow developers already use.
The problem
Generating code is not the same as verifying that an application works. A change can compile and still break the UI, a page can load while a key function is dead, and a browser command can return success without achieving anything. Failed tests lead to endless retries, and final reports claim success with nothing behind them.
The principle
An agent should not write code and claim it works. It should use the running application, observe the result, check it against the expected behaviour and show evidence. In BrowserHUB a tool returning success is never enough: a navigation passes only when the reported URL matches and the expected elements are visible.
Approach
- See it work: every action and screenshot streams to a live, passive watcher pane.
- Prove it: acceptance criteria are written before testing starts, and the actual URL and page state are checked after each action.
- Stay in bounds: at most 3 repair attempts per task, then an honest report instead of an endless retry loop.
- Stay safe: an org-only access gate, typed passwords redacted from logs, a per-developer local browser and a full audit trail.
Result
A head-to-head benchmark against headless Playwright showed about the same token cost, because screenshots are the expense, not the tool. Playwright wins on raw speed. BrowserHUB wins on visibility and criteria-checked verification. Both are used, for different jobs.
Architecture
Claude Code keeps the reasoning. BrowserHUB supplies the browser. Structured MCP tools go through a local proxy to Browser Use and a real browser, and typed results, including screenshots, come back to the agent. A separate hook path records every call for a human-readable watcher.
16 tools in six groups
| Group | Tools | Used for |
|---|---|---|
| Navigation | browser_navigate · browser_go_back | Open a site, a staging environment or the page under test, and step back through a workflow. |
| Interaction | browser_click · browser_type · browser_scroll | Press buttons and links, fill fields and forms, and reach content below the fold. |
| Observation | browser_get_state · browser_extract_content · browser_get_html · browser_screenshot | Read the reported URL and page state, pull visible content, inspect the markup, and capture a screenshot returned as real PNG image content. |
| Tabs | browser_list_tabs · browser_switch_tab · browser_close_tab | Work across several tabs without confusing one page with another. |
| Sessions | browser_list_sessions · browser_close_session · browser_close_all | Manage browser sessions. Closing all is powerful, so shared sessions are never closed indiscriminately. |
| Agent-assisted | retry_with_browser_use_agent | Hands a browser task to Browser Use’s own agent when that suits the job better. |
The interface is structured JSON-RPC, so the agent never drives the browser through a shell or a terminal multiplexer. Tool responses carry text and image content, with screenshots returned as base64-encoded PNG.
Evidence-based verification
Two skills turn single tools into a repeatable workflow. pre-flight-check establishes readiness, and browserhub-verify runs the full lifecycle in six stages.
# a successful tool call is not evidence
action navigate to /dashboard
tool result success
verify browser_get_state → reported URL is the dashboard URL
verify expected dashboard elements are visible
result PASS only when every observation supports it Pre-flight check
Repository instructions, app readiness before browser testing, BrowserHUB health, baseline tests where feasible, access checks when sign-in is involved, and release checks before publishing.
Acceptance criteria
Success is written down before implementation: a button does one thing, a form rejects bad input, a submission shows confirmation, navigation reaches the expected URL.
Real-browser verification
Navigate, interact, read the reported state, check expected content, take screenshots where useful, and compare what was observed with the criteria.
Final report
What was tested, what passed, what failed, what was repaired, and what remains unverified, each with its evidence.
Bounded repair
A small script enforces the retry limit, so a failing test ends in an honest report rather than an endless loop.
Task-scoped counter
Each verification task has its own count. A continuation of the same task keeps it; a new task starts fresh.
Hard limit of 3
Attempts 1, 2 and 3 are accepted. The fourth exits non-zero with LIMIT REACHED, and the agent reports the failure instead of trying again.
24-hour staleness reset
Old counters expire, so yesterday’s failure does not block today’s work.
Fails safe
A missing task ID stops the loop instead of silently allowing unlimited retries.
Hooks and monitoring
Claude Code hooks wrap every browser tool call. Events land in a JSONL file, one JSON object per line, which suits inspection, log processing and later reporting.
| Stage | Script | What it does |
|---|---|---|
| SessionStart | link-commands.sh | Links the plugin’s commands into the Claude Code session. |
| PreToolUse | check-authorization.sh | Checks the authorisation requirements before a browser tool runs. Cache, allow and deny paths are all tested. |
| PreToolUse | log-browser-events.sh | Records the event before execution. |
| PostToolUse | log-browser-events.sh | Records the result after execution, so the log brackets every tool call. |
The watcher is a passive terminal view driven by the log. Event logging and text output are covered by automated tests; terminal colour and inline-image rendering are checked by hand.
Screenshot evidence and reporting
Finds real artifacts
Uses the browser tool-use IDs to locate screenshots in the existing screenshot store, and never invents a path.
Checks the bytes
Confirms each file exists and validates its format by magic bytes: PNG, JPEG or WEBP.
Valid is not correct
A valid PNG proves an image exists, not that it shows the expected result. A person or a suitable visual check still decides that.
Three honest verdicts
The final report separates PASS, FAIL and NOT VERIFIED, with the URL, page state, extracted content, test output and repair history behind each.
Tested, not assumed
Smoke test
Talks to the proxy directly with curl: readiness, MCP initialisation and tool discovery, a real navigation to example.com, the reported URL, a screenshot containing valid PNG data, and cleanup of only the session it created. Last run: 6 of 6 pass.
End-to-end test
Runs a real Claude Code session through plugin tool discovery and invocation: a unique marker URL, a screenshot returned as image content, event logging with original lines preserved byte for byte and new events appended, and scoped cleanup. Last run: clean, zero regressions.
Isolated hook tests
Session-start linking, event writing, screenshot extraction, watcher text output, and authorisation cache, allow and deny paths, using fake ssh and claude executables on PATH instead of real keys.
Plugin validation
claude plugin validate with --strict passes for v0.1.12, alongside repair-tracker tests, a controlled limit failure and report assembly against real screenshots.
Security and operations
BrowserHUB can reach authenticated applications, so execution and session handling have firm boundaries.
Authorisation around tools
Every browser tool call passes an authorisation check, and is logged before and after.
Local by design
The proxy listens on localhost only, with one browser per developer.
Scoped sessions
Tests create their own session and close only that one, never browser_close_all while shared sessions may exist.
Nothing overwritten
Existing MCP configuration, hooks, event log, watcher and user changes are preserved. No unrelated global hooks and no duplicate browser-control service.
One request, end to end
Ask Claude Code to “add a discount coupon to the checkout page” and the workflow runs like this.
- 01Pre-flight
Claude reads the checkout code, then the verify skill runs the real pre-flight check.
- 02Criteria
Coupon field visible. Invalid code shows an error. Valid code applies the discount. Total recalculates. Removing the code restores the total.
- 03Implement
The change is made and the project’s tests run.
- 04Drive the browser
The app starts, BrowserHUB opens checkout, types coupon values, clicks, and reads the page.
- 05Verify and repair
Each displayed result is compared with its criterion. A failure gets up to three repairs.
- 06Report
Screenshots and observations are collected, and the report lists what passed, failed, was repaired and remains unverified.
Release history
| Version | What it added |
|---|---|
0.1.9 | Smoke test: proxy, MCP, navigation, state, screenshot and scoped cleanup. |
0.1.10 | End-to-end test through a real Claude Code session, plus isolated hook tests. |
0.1.11 | pre-flight-check skill: a reusable readiness workflow. |
0.1.12 | browserhub-verify: six stages, criteria, bounded repair, screenshot validation, evidence-based reporting. |
What is built, and what is not
| Capability | Status |
|---|---|
| Claude Code MCP integration, 16 tools, proxy, Browser Use | Implemented and tested |
| Navigation, interaction, state inspection, screenshots as image content | Tested |
| Hook-driven event logging, watcher text output, authorisation hooks | Tested (hooks in isolation) |
| Pre-flight and verify skills | Implemented, invoked in a real session |
| Three-attempt repair limit, screenshot magic-byte check | Tested |
| 24-hour repair-counter reset | Implemented |
| Strict plugin validation, smoke and end-to-end suites | Passed |
| Terminal colour and inline-image rendering | Needs a human check |
| Saved JSON and Markdown verification reports | Not yet built |
| CodeHUB integration, application-wide QA, verification history | Future direction |
Don’t just generate code. See it. Test it. Verify it.