Skip to main content

Chrome DevTools panel with terminal and browser context injection for Claude Code

Project description

devpanel

Chrome DevTools panel with an embedded terminal and browser context injection for Claude Code.

What it does

Opens a terminal inside Chrome DevTools. Claude Code runs in that terminal with a hook that automatically injects browser context into every prompt.

Select elements — click Select, Chrome's native crosshair picker activates. Click an element, type an annotation in the prompt, repeat. Selectors queue for the next Claude Code prompt.

Capture network — snapshot recent requests from devtools.network.getHAR(). Full HAR spills to a JSON file the agent can grep.

Screenshot — CDP Page.captureScreenshot with clip from the selected element. PNG spills to disk, agent can read it.

Page HTML — captured automatically on first element selection. Full HTML spills to a file for grep/read.

Everything drains on prompt submit. Claude Code sees the browser context without you describing it.

Architecture

Chrome DevTools (DevPanel tab)
  ├── Terminal (xterm.js) ──ws──→ PTY daemon (:random)
  ├── Select button ──CDP──→ Overlay.setInspectMode → selector + annotation
  ├── Network button ──→ devtools.network.getHAR()
  └── Screenshot button ──→ chrome.debugger → Page.captureScreenshot

Service Worker
  ├── Native messaging → spawn PTY daemon
  ├── CDP element picker (Overlay domain)
  └── Screenshot relay (chrome.debugger, not available in panel)

PTY daemon (Python, aiohttp)
  ├── WebSocket /ws → terminal I/O
  ├── POST /stack → push context (spills large data to disk)
  ├── GET /stack → drain + clear (formatted text for hook)
  ├── GET /stack?peek=true → raw JSON (for panel UI)
  └── GET /controls → dev endpoint (port, pid, stack size)

Claude Code (in terminal)
  └── UserPromptSubmit hook → curl /stack (drain)

Install

pip install devpanel  # or: uv tool install devpanel
devpanel install --extension-id=EXTENSION_ID

Then load the extension in chrome://extensions → Load unpacked → point to the printed path.

The --extension-id is shown on the extensions page after loading. Re-run devpanel install with the correct ID.

Usage

  1. Open Chrome DevTools on any page
  2. Click the DevPanel tab
  3. A terminal opens with your shell (fish/bash/zsh)
  4. A claude shell function is injected — it wraps claude with --settings to add the drain hook
  5. Click Select → pick elements → annotate → they queue in the stack
  6. Type claude in the terminal → send a prompt → hook fires, Claude sees the queued context

Dev

# Extension
cd extension-src
npm install
npm run build          # required — hot reload doesn't work with CRXJS service workers
npm run check          # svelte-check
npm run lint           # prettier + eslint

# Daemon (standalone, for testing)
uv run devpanel start
# Then: curl localhost:PORT/controls, curl POST/GET /stack

# Full build (extension + Python wheel)
make build

How the hook works

The daemon writes ~/.config/fish/conf.d/devpanel.fish (cleaned up on daemon exit) that defines:

function claude
  command claude $argv --settings '{"hooks":{"UserPromptSubmit":[{"matcher":"","hooks":[{"type":"command","command":"curl -s http://127.0.0.1:PORT/stack"}]}]}}'
end

For bash, a rcfile with the equivalent function is loaded via --rcfile on the PTY shell.

The function shadows the real claude binary. $argv comes first so wrapper flags (like --use VERSION) are parsed before --settings. The --settings flag merges with other Claude Code settings.

Drain format

When the hook fires, the agent sees:

## Browser Context

### Page HTML
- https://www.wikipedia.org/ → /run/user/1000/devpanel/page-abc.html

### Selected elements
- `div.central-textlogo` — this is the logo
- `nav.central-featured` — language links

### Network
- 8 requests, 1 errors → /run/user/1000/devpanel/network-def.json

### Screenshots
- /run/user/1000/devpanel/screenshot-ghi.png

Large data (HTML, HAR, screenshots) spills to disk. The agent uses Read/Grep on the file paths.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devpanel-0.2.0.tar.gz (366.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devpanel-0.2.0-py3-none-any.whl (371.1 kB view details)

Uploaded Python 3

File details

Details for the file devpanel-0.2.0.tar.gz.

File metadata

  • Download URL: devpanel-0.2.0.tar.gz
  • Upload date:
  • Size: 366.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"EndeavourOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for devpanel-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b46eae6446a28f58a5f4577aebb4ae59b2e2ace7c5ca487a457882fc8c008828
MD5 b9cbf2d8f32afe8577ecebd4005cf163
BLAKE2b-256 d652d12169bc5c9dcc9c97a207f8f136a0f10ec9fb3e19ff3b69d6bfeb57deb0

See more details on using hashes here.

File details

Details for the file devpanel-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: devpanel-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 371.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"EndeavourOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for devpanel-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e974092703fb9c06db30dfdfe46b9394f574c3f76291ebf5621c557c8c1c141f
MD5 76355a69c176c3f4ed231b5a94cc5a4e
BLAKE2b-256 c13198c8d37ffe60f2bfedccd6edbc30a0e1e69f199bb4763e26e824dae645fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page