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
- Open Chrome DevTools on any page
- Click the DevPanel tab
- A terminal opens with your shell (fish/bash/zsh)
- A
claudeshell function is injected — it wrapsclaudewith--settingsto add the drain hook - Click Select → pick elements → annotate → they queue in the stack
- Type
claudein 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b46eae6446a28f58a5f4577aebb4ae59b2e2ace7c5ca487a457882fc8c008828
|
|
| MD5 |
b9cbf2d8f32afe8577ecebd4005cf163
|
|
| BLAKE2b-256 |
d652d12169bc5c9dcc9c97a207f8f136a0f10ec9fb3e19ff3b69d6bfeb57deb0
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e974092703fb9c06db30dfdfe46b9394f574c3f76291ebf5621c557c8c1c141f
|
|
| MD5 |
76355a69c176c3f4ed231b5a94cc5a4e
|
|
| BLAKE2b-256 |
c13198c8d37ffe60f2bfedccd6edbc30a0e1e69f199bb4763e26e824dae645fc
|