The Problem

AI agents often need to interact with a user’s logged‑in browser, but existing solutions force agents to open new windows, lose session state, or block the user’s workflow. A clean integration that preserves the user’s session, runs in a separate visible window, and allows human hand‑off for captchas or confirmations is missing.

What This Does

BrowserSkill lets an AI agent control a real browser tab while the user continues normal work.

  • Tab borrowing – apps/extension/src/content/BorrowConfirmationOverlay.tsx and HelpRequestOverlay.tsx implement the human‑in‑loop workflow.
  • Full‑page screenshots – apps/extension/src/long-screenshot/long-screenshot.browser.ts captures arbitrary pages, while apps/extension/src/long-screenshot/exports.ts writes the image file.
  • Command bridge – crates/bsk-protocol defines JSON‑RPC messages; the CLI (crates/bsk-cli/src/main.rs) serialises commands and the extension (apps/extension/src/lib/audit-bridge.ts) deserialises them to drive UI actions.

How It Is Wired

  1. Entry point – crates/bsk-cli/src/main.rs parses CLI args (bsk screenshot …) and sends a ScreenshotRequest via bsk-protocol.
  2. Daemon – The Rust binary spins a WebSocket server (crates/bsk-cli/src/daemon.rs – not shown but inferred).
  3. Extension background – apps/extension/src/entrypoints/background.ts listens on the same WebSocket, forwards messages to the visible agent window (apps/extension/src/entrypoints/popup/App.tsx) and to content scripts (apps/extension/src/entrypoints/content.ts).
  4. Content scripts – apps/extension/src/content/record-capture.ts performs DOM actions, long-screenshot.ts captures frames, and overlay-controller.ts manages UI overlays.
  5. Result delivery – The extension writes files via apps/extension/src/long-screenshot/storage.ts; the CLI reads the file and returns the path.

The communication chain has four hops: CLI → daemon → background → content. Each hop uses a small, well‑named function (sendRequest, handleMessage, executeCommand), limiting blast radius. The module graph shows a single cycle between daemon-connection-preference.ts and daemon-port-preference.ts, which centralises port selection; changing it would affect all connection logic.

How To Use It

Setup

git clone https://github.com/moses-y/BrowserSkill
cd BrowserSkill
# Rust toolchain
rustup target add x86_64-unknown-linux-gnu
cargo install --path crates/bsk-cli
# Extension build
pnpm i
pnpm run build

Configuration – Set BSK_HOME to a writable directory (e.g., ~/.bsk). Running

# Start the daemon
bsk daemon
# Use the CLI
bsk screenshot --session 12345 --full-page --out page.png

The extension must be loaded as an unpacked extension from apps/extension/dist in Chrome/Edge.

Real‑World Use

An agent can request a screenshot of a logged‑in page:

bsk screenshot --session 42 --full-page --out dashboard.png

The CLI forwards the request to the daemon, the extension captures dashboard.png, and the agent receives the file for further analysis.

Code Health & Issues

  • Low/Secret – Test fixtures contain cert.pem and key.pem under crates/bsk-cli/tests/fixtures/remote-tls/. They are flagged as secret‑shaped paths but are only used in tests, not in production.
  • No other static‑analysis findings are reported.
  • The repository includes a comprehensive test suite (≈200 tests) and CI (.github/workflows/ci.yml).

The Bottom Line

BrowserSkill offers a pragmatic, low‑overhead bridge between shell‑able AI agents and a logged‑in browser. The code is split cleanly between Rust (daemon/CLI) and TypeScript (extension), with clear entry points and a small, well‑contained communication layer. The main trade‑off is that the extension must be manually loaded or installed from the store; automated deployment requires extra scripting. Overall, it is a solid foundation for agents needing real‑browser interaction without disrupting the user.