# cloak-cdp-cli **CLI for agents to drive CloakBrowser over CDP** — stealth Chromium + chrome-agent, without browser MCP token burn. Specific stack, specific interface: - **CloakBrowser** — source-level fingerprint stealth, optional `humanize` - **CDP** — Chrome DevTools Protocol via [chrome-agent](https://github.com/captivus/chrome-agent) - **CLI** — `sense`, `go`, `click`, `eval` with `--json` for Cursor and other coding agents Methodology from Corey Gallon's AI Engineer talk [*The Dark Arts of Web Automation*](https://www.youtube.com/watch?v=26RtyAm9y_Q): CLI over MCP, meatbag ladder, solver/operator split. --- ## Why not generic "web agent" tooling? This repo is **not** a general browser agent framework. It is a **Cloak + CDP command-line layer** you install into any project when agents need to: - Click through cross-origin iframes (trusted `Input.dispatchMouseEvent`) - Reuse a scripted CDP flow without a model per step - Share a Cloak session with tools like apply-engine (`connect --port`) | | Browser MCP | `cloak-cdp-cli` | |---|-------------|-----------------| | Stack | Varies | CloakBrowser + CDP only | | Replay | Model each step | Script once, replay free | | Stealth | Stock Chrome | Cloak default | | Agent output | Mixed | `--json` everywhere | --- ## Install ```bash pip install "git+https://github.com/ezumyn-aliegm/cloak-cdp-cli.git" # or editable git clone https://github.com/ezumyn-aliegm/cloak-cdp-cli.git cd cloak-cdp-cli && python3 -m venv .venv && source .venv/bin/activate && pip install -e . ``` Requires Python 3.11+. Cloak binary installs via `pip install cloakbrowser` (cached under `~/.cloakbrowser`). ```bash cloak-cdp-cli cloak-info cloak-cdp-cli --json launch --headless ``` Short alias: `cloak-cdp` (same binary). --- ## Use in other projects ### CLI ```bash cloak-cdp-cli --json launch --headless cloak-cdp-cli --json go "https://your-app.example/login" cloak-cdp-cli --json sense --screenshot ./artifacts/page.png cloak-cdp-cli --json click -s "#submit" --rung 2 cloak-cdp-cli stop ``` Session file: `artifacts/.cloak-cdp-session.json` ### Agent skill ```bash cp -r cloak-cdp-cli/.cursor/skills/cloak-cdp-cli your-project/.cursor/skills/ ``` Skill name: **`cloak-cdp-cli`** ### Adopt existing Cloak CDP ```bash cloak-cdp-cli --json connect --port 9222 ``` ### Python ```python from cloak_cdp_cli.cdp_session import CDPSession from cloak_cdp_cli.meatbag import MeatbagLadder, Rung async with CDPSession(port=9222) as session: await session.navigate("https://example.com") await MeatbagLadder(session).click_selector("#btn", rung=Rung.TRUSTED) ``` --- ## Architecture ``` Agent (decisions / vision when needed) │ cloak-cdp-cli --json CloakBrowser (stealth + humanize) — or Chrome (--chrome) │ loopback CDP :9222 chrome-agent client (sense · act · solve) ``` --- ## Commands | Command | Description | |---------|-------------| | `launch [--headless]` | CloakBrowser daemon (default) | | `launch --chrome` | Stock Chrome fallback | | `connect --port N` | Adopt running CDP | | `cloak-info` | Binary status | | `go`, `sense`, `eval`, `click`, `type`, `screenshot` | CDP automation | | `cdp Domain.method '{json}'` | Raw one-shot | | `solve [--tiles json]` | reCAPTCHA v2 (authorized testing only) | | `stop` | Stop daemon | **Meatbag ladder:** `--rung 1` synthetic → `2` trusted CDP (default) → `3` human mouse path. --- ## Optional: reCAPTCHA v2 module Authorized testing only. ```bash cloak-cdp-cli solve --headless cloak-cdp-cli solve --tiles artifacts/tiles.json ``` --- ## Layout ``` cloak-cdp-cli/ ├── bin/cloak-cdp-cli ├── src/cloak_cdp_cli/ ├── scripts/cloak_daemon.py └── .cursor/skills/cloak-cdp-cli/ ``` --- ## Related - [CloakBrowser](https://github.com/CloakHQ/CloakBrowser) - [chrome-agent](https://github.com/captivus/chrome-agent) - apply-engine — complementary; `cloak-cdp-cli connect --port 9230` --- ## License MIT — see [LICENSE](LICENSE).