# document pip web coprocessor

- Status: `experiment`
- Track: [peer-to-peer coordination, pip surfaces & malleable plugins](https://aifoc.us/labs/agent-meshes/)
- Layer: 6. Peer-to-Peer, Persistent Chrome & Agent Meshes
- Updated: 1 December 2026
- Live demo: https://pip-web-coprocessor.kinlan-test.workers.dev
- Source: https://github.com/PaulKinlan/pip-web-coprocessor

## Inspired by

- [my chrome extensions are just prompts](https://aifoc.us/my-chrome-extensions-are-just-prompts/)

## Hypothesis

- **Claim:** Combining the Document Picture-in-Picture API, `BroadcastChannel`, Navigation API, and CSS Container Queries sustains a persistent cross-page companion workbench on a normal web origin without packaging a browser extension.
- **Confirms it:** Navigating across `/`, `/workspace/specs`, `/workspace/audit`, and `/workspace/notes` updates the floating Document PiP companion instantaneously without tearing down window state or duplicating listeners.
- **Falsifies or bounds it:** User-activation requirements on PiP open, browser popup restrictions, or unsupported mobile viewports force heavy reliance on the docked fallback panel.

> **Why this exists:** Most in-page assistants and inspector sidebars die the moment a user clicks a link to another page, which pushes builders into packaging Chrome extensions just to keep a companion panel open. Combining the Document Picture-in-Picture API with `BroadcastChannel` and the Navigation API lets a standard website host an always-on floating companion window across route changes with no browser extension required.


## What this lab tests

[Document PiP Web Coprocessor](https://pip-web-coprocessor.kinlan-test.workers.dev) ([GitHub](https://github.com/PaulKinlan/pip-web-coprocessor)) keeps a persistent companion workbench synchronized across multiple origin routes (`/`, `/workspace/specs`, `/workspace/audit`, `/workspace/notes`) via [`Document Picture-in-Picture`](https://developer.mozilla.org/en-US/docs/Web/API/Document_Picture-in-Picture_API), [`BroadcastChannel`](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel), the Navigation API, and CSS Container Queries.


## Open questions to iterate on

- What navigation patterns (full document loads vs. Navigation API intercepts) keep the Document PiP window bound smoothly across multi-page websites?
- How well do CSS Container Queries adapt tool UIs cleanly between a wide main pane and a narrow 340px PiP window?

## Iteration log

- **2026-12-01:** Built multi-route workspace (`/workspace/specs`, `/workspace/audit`, `/workspace/notes`), Document PiP host + docked `BroadcastChannel` fallback, and top code blueprint.
- **2026-12-01:** Moved multi-route workspace above setup docs, fixed narrow-viewport container-query width toggling, added CSP-safe DOM syntax highlighting, hardened 700px embed layout, and enforced no-cache headers on static assets.

## Primitives tested

- `Document Picture-in-Picture API`
- `BroadcastChannel`
- `Navigation API`
- `CSS Container Queries`

## Connected labs in other tracks

- [malleable worker plugin shell](https://aifoc.us/labs/agent-meshes/malleable-worker-shell/) — Runs sandboxed plugin UI slots inside a host companion container.
- [slice capability mesh](https://aifoc.us/labs/browser-containment/slice-capability-mesh/) — Provides scoped file URLs that a persistent coprocessor can inspect safely.

---
Canonical: https://aifoc.us/labs/agent-meshes/pip-web-coprocessor/
