$npx -y skills add tykimos/cheliped-skills --skill browserAgent Browser Runtime for browsing, observing, and interacting with web pages via Chrome DevTools Protocol (CDP). Use this skill when Claude needs to: (1) navigate to and browse websites, (2) extract page content, text, or links from any URL, (3) fill forms or type into input fie
| 1 | # Agent Browser Runtime |
| 2 | |
| 3 | Control Chrome via CDP. Extract **Agent DOM** — a compressed DOM where every interactive element gets a numeric `agentId`. |
| 4 | |
| 5 | ## Setup |
| 6 | |
| 7 | Run once before first use: |
| 8 | |
| 9 | ```bash |
| 10 | cd scripts && npm install && npm run build |
| 11 | ``` |
| 12 | |
| 13 | ## Core Workflow: Observe-Act Loop |
| 14 | |
| 15 | ```bash |
| 16 | # 1. Navigate and observe |
| 17 | node scripts/cheliped-cli.mjs '[{"cmd":"goto","args":["https://example.com"]},{"cmd":"observe"}]' |
| 18 | |
| 19 | # 2. Use agentId from observe output to interact |
| 20 | node scripts/cheliped-cli.mjs '[{"cmd":"fill","args":["3","search term"]},{"cmd":"click","args":["4"]},{"cmd":"observe"}]' |
| 21 | ``` |
| 22 | |
| 23 | First call auto-launches Chrome and saves session. Subsequent calls reconnect (the reconnect is identity-checked against the browser's DevTools token, so a crashed-and-reused PID/port can't be mistaken for the original Chrome). Call `close` when done. |
| 24 | |
| 25 | ## Output Envelope |
| 26 | |
| 27 | Output is **always a JSON array**, one envelope per command, **compact by default**: |
| 28 | |
| 29 | ```json |
| 30 | [{ "cmd": "goto", "ok": true, "result": { "url": "...", "title": "..." } }, |
| 31 | { "cmd": "click", "ok": false, "error": { "code": "E_STALE_ID", "message": "..." } }] |
| 32 | ``` |
| 33 | |
| 34 | By default each command runs even if a prior one fails (per-command isolation). Error `code` is one of `E_BAD_ARG`, `E_STALE_ID`, `E_TIMEOUT`, `E_BROWSER`, `E_UNKNOWN`. |
| 35 | |
| 36 | ### CLI flags (before the JSON argument) |
| 37 | |
| 38 | | Flag | Effect | |
| 39 | |------|--------| |
| 40 | | `--session <name>` | named session (concurrent browsers) | |
| 41 | | `--no-headless` / `--headed` | run Chrome with a visible window | |
| 42 | | `--pretty` | indent JSON output (default is compact, fewer tokens) | |
| 43 | | `--stop-on-error` | fail-fast: halt the batch on the first error | |
| 44 | | `--chrome-path <path>` | explicit Chrome/Chromium binary (or `CHROME_PATH` env) | |
| 45 | | `--timeout <ms>` | launch/connect timeout | |
| 46 | | `--max-links <n>` / `--max-texts <n>` / `--max-text-length <n>` | tune `observe` compression (recall vs tokens) | |
| 47 | |
| 48 | ## Commands |
| 49 | |
| 50 | | Command | Args | Returns | |
| 51 | |---------|------|---------| |
| 52 | | `goto` | `["url"]` | `{ success, url, title }` | |
| 53 | | `observe` | none | `{ nodes, texts, links }` — `nodes[].id` = agentId | |
| 54 | | `click` | `["agentId"]` | `{ success, action, agentId }` | |
| 55 | | `fill` | `["agentId", "text"]` | `{ success, action, agentId }` | |
| 56 | | `screenshot` | `["path"]` (optional) | `{ success, path, size }` | |
| 57 | | `run-js` | `["expression"]` | `{ success, result }` | |
| 58 | | `extract` | `["text"\|"links"\|"all"]` | `{ type, data }` | |
| 59 | | `actions` | none | `[{ id, type, label, params }]` | |
| 60 | | `perform` | `["actionId"]` + `"params":{...}` | `{ success, actionId }` | |
| 61 | | `observe-graph` | none | `{ nodes, edges, forms }` | |
| 62 | | `back` | none | `{ success }` — navigate back in history | |
| 63 | | `forward` | none | `{ success }` — navigate forward in history | |
| 64 | | `hover` | `["agentId"]` | `{ success }` — hover over element | |
| 65 | | `scroll` | `["direction", "pixels"]` | `{ success }` — direction: up/down/left/right | |
| 66 | | `wait-for` | `["selector", "timeout"]` | `{ found }` — wait for CSS selector | |
| 67 | | `close` | none | `{ success }` | |
| 68 | | **Shadow DOM Commands** | | | |
| 69 | | `observe-shadow` | none | `{ shadowHosts: [{ hostSelector, elements, iframes }] }` | |
| 70 | | `click-deep` | `["selector"]` | `{ success }` — shadow-piercing click | |
| 71 | | `fill-deep` | `["selector", "text"]` | `{ success }` — shadow-piercing fill | |
| 72 | | **Iframe Commands** | | | |
| 73 | | `list-frames` | none | `{ frames: [{ index, url, name }] }` | |
| 74 | | `observe-frame` | `["target"]` | `{ url, elements: [{ index, tag, text, selector }] }` | |
| 75 | | `click-frame` | `["target", "selector"]` | `{ success }` — click inside iframe | |
| 76 | | `fill-frame` | `["target", "selector", "text"]` | `{ success }` — type into iframe input | |
| 77 | | `run-js-frame` | `["target", "expression"]` | `{ success, result }` — JS in iframe | |
| 78 | |
| 79 | `target` = frame index (0-based number from `list-frames`) or URL substring to match. |
| 80 | |
| 81 | ## Examples |
| 82 | |
| 83 | ### Browse and extract content |
| 84 | |
| 85 | ```bash |
| 86 | node scripts/cheliped-cli.mjs '[{"cmd":"goto","args":["https://news.ycombinator.com"]},{"cmd":"observe"}]' |
| 87 | ``` |
| 88 | |
| 89 | ### Fill a form and submit |
| 90 | |
| 91 | ```bash |
| 92 | node scripts/cheliped-cli.mjs '[{"cmd":"observe"},{"cmd":"fill","args":["7","hello"]},{"cmd":"click","args":["8"]}]' |
| 93 | ``` |
| 94 | |
| 95 | ### Semantic action (login, search) |
| 96 | |
| 97 | ```bash |
| 98 | node scripts/cheliped-cli.mjs '[{"cmd":"goto","args":["https://example.com/login"]},{"cmd":"actions"}]' |
| 99 | node scripts/cheliped-cli.mjs '[{"cmd":"pe |