Repository navigation
Browser
The plugin dotclaude-browser drives a real browser for Claude.
Read this page to set up the browser, or to learn how the WebSearch handler works and when it falls back.
The plugin has two slices.
The slice browse gives the skill browse and the command dotclaude-browser-guide.
The slice search answers each WebSearch call with a search in the headless browser.
The plugin works without the core plugin.
It imports nothing from another plugin.
The source is in src/plugins/dotclaude-browser/.
The tests are in tests/browser/.
| Part | Slice | What it gives |
|---|---|---|
Skill browse
|
browse |
Steps to open, click, fill, or read a page with agent-browser
|
Command dotclaude-browser-guide
|
browse |
Prints the agent-browser guide that the skill loads |
Handler on WebSearch
|
search |
Runs a search in the headless browser, and falls back to the built-in WebSearch
|
Option backend
|
search |
Chooses agent-browser (the default) or cloakbrowser
|
- Install
agent-browserwithnpm install -g agent-browser. The skill asks the user for this command when the binary is missing (NOT_INSTALLEDinslices/browse/domain/guide.ts). - For the
cloakbrowserbackend, install CloakBrowser. The plugin does not install it. The binary must be at~/.cloakbrowser/chromium-<version>/Chromium.app/Contents/MacOS/Chromium(CLOAK_DIRandCLOAK_BINARYinslices/search/domain/search.ts). Only this macOS layout is in the code. - Install the plugin with
/plugin install dotclaude-browser@dotclaude. - Set the option
backendin the plugin settings. Its default isagent-browser. Its other value iscloakbrowser(slices/search/slice.ts).
The skill browse has the allowed-tools entries Bash(agent-browser *) and Bash(dotclaude-browser-guide).
Its body includes the output of dotclaude-browser-guide at load time, through a ! command in slices/browse/skills/browse/SKILL.md.
The command runs agent-browser skills get core with Bun.spawnSync.
It has no shell (runGuide in slices/browse/adapters/cli.ts).
The guide text is cut at MAX_GUIDE_CHARS.
The cut text ends with a notice.
The notice names the command that reads the rest (guideText in slices/browse/domain/guide.ts).
The command exits with 0 also when the guide is missing.
The text then tells Claude what to do.
The handler is a tool.call mod handler with the filter { tool: "WebSearch" } and the phase answer (slices/search/slice.ts).
Its code is in slices/search/adapters/mod.ts.
Its pure logic is in slices/search/domain/search.ts.
For each call, the handler does these steps:
- It builds the query from the
queryfield and from theallowed_domainsandblocked_domainsfields. Each domain becomes asite:term. A blocked domain becomes a-site:term (searchQuery). It takes at mostMAX_DOMAINSdomains from each list. It skips a name with a character outside[\w.-]. - It denies the call with
INVALID_INPUTwhen the query is empty. - It looks for the newest CloakBrowser build.
It lists the folder
~/.cloakbrowser/, keeps thechromium-<version>folders, and sorts them by the numbers of the version (findBinaryandcloakBuilds). - It denies the call with
MISSING_BINARYwhen thebackendoption iscloakbrowserand no binary exists. - It opens the search page in a session with
agent-browser open. It reads the body text withget text body, and it closes the session. The read uses--max-outputwithMAX_OUTPUT_CHARS. The session name starts withdcws, so that a search never uses a session of the user (sessionName). - It answers with the page text when the page has text and no bot check (
pageResult). It falls back when the page has no text, when the page shows a bot check, or when a step fails.
When the handler falls back, the built-in WebSearch answers.
With the cloakbrowser backend, the built-in result gets a notice.
The notice says that CloakBrowser gave no results (fallbackNotice).
With the cloakbrowser backend, a thrown error also becomes a fallback.
The fallback carries the message of the error.
With the agent-browser backend, Claude Code skips and logs a thrown error.
The built-in WebSearch then answers.
The page text is third-party content.
The result says so before the page text (pageResult).
| Bound | Value | File | Use |
|---|---|---|---|
MAX_GUIDE_CHARS |
40000 | slices/browse/limits.ts |
Most characters of the guide in the skill |
GUIDE_TIMEOUT_MS |
15000 ms | slices/browse/limits.ts |
Time for agent-browser skills get core
|
MAX_OUTPUT_CHARS |
20000 | slices/search/limits.ts |
Most characters of page text in one result, and the --max-output of the read |
OPEN_TIMEOUT_MS |
30000 ms | slices/search/limits.ts |
Time to open the search page |
READ_TIMEOUT_MS |
15000 ms | slices/search/limits.ts |
Time to read the page text |
CLOSE_TIMEOUT_MS |
10000 ms | slices/search/limits.ts |
Time to close the session |
SESSION_PREFIX |
dcws |
slices/search/limits.ts |
Start of each session name |
SESSION_NAME_MAX |
12 | slices/search/limits.ts |
Longest session name, checked by tests/browser/search.test.ts
|
MAX_DOMAINS |
10 | slices/search/limits.ts |
Most domains in each filter list |
SEARCH_URL |
https://html.duckduckgo.com/html/ |
slices/search/limits.ts |
The search page, which needs no script and no sign-in |
The session name has a counter in base 36 and five random characters after the prefix.
The comment in slices/search/limits.ts gives the reason for SESSION_NAME_MAX.
The browser makes a socket path under the home folder.
macOS refuses a path over 103 bytes.
- The plugin answers
WebSearchin the headless browser. It keeps the built-in tool as the fallback. The fallback keeps a search working when the browser gets a bot check. - The
searchslice uses atool.callhandler onWebSearch, in the phaseanswer. The handler reads thebackendoption throughkeepOptions. - The plugin uses
Bun.spawnSyncin the guide command and$.process.runin the mod handler. Neither uses a shell. The arguments are passed as a list. - DuckDuckGo's HTML page needs no script and no sign-in, so
agent-browsercan read it (SEARCH_URL). - Each add-on stays a separate plugin.
See D24 in Decisions-Layout.
The layout page also records that the browser plugin replaces the built-in
WebSearchwith its headless browser. - The guide bound keeps the text of the skill small in the context of the session.
- Troubleshooting: the symptoms of this plugin and their fixes.
- Library Docs: the next add-on page.
-
Attributions: the license of
agent-browserand of CloakBrowser. - Add-On Plugins: the list of the add-on plugins.
- Start
- How dotclaude Works
- Add-On Plugins
- How Claude Code Works
- Reference
- Rationale
- Evidence
- Development
- Archive