Skip to main content
Glama
README.md
<div align="center">

<img src="extension/icons/icon128.png" alt="C-Thru Pane" width="84" height="84" />

# C-Thru Pane

**A security-first, non-blocking multi-agent browser companion for Chrome, Vivaldi, Brave, Edge, and Arc.**

Let **Antigravity**, **Codex**, **Claude Code**, **Hermes** (including custom profiles), and any **MCP agent** work alongside you across your home and work browsers—running either **locally on the same machine** or **remotely** over SSH, Tailscale, or any TLS proxy.

[![Version](https://img.shields.io/badge/version-0.2.0-111110?style=flat-square&labelColor=1A1A18)](https://github.com/Qaudy/c-thru-pane)
[![License: MIT](https://img.shields.io/badge/license-MIT-34D399?style=flat-square&labelColor=1A1A18)](LICENSE)
[![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-3B82F6?style=flat-square&labelColor=1A1A18)](pyproject.toml)
[![Manifest V3](https://img.shields.io/badge/extension-Manifest%20V3-F59E0B?style=flat-square&labelColor=1A1A18)](extension/manifest.json)
[![Security](https://img.shields.io/badge/security-zero--trust-EF4444?style=flat-square&labelColor=1A1A18)](SECURITY.md)

[Quick Start](#quick-start) · [Safety Modes](#safety-modes) · [MCP Tools](#mcp-toolset) · [CLI Reference](#cli-reference) · [Security](SECURITY.md)

</div>

---

## Why C-Thru Pane?

Most browser automation tools hijack your window, steal focus, or run with all-or-nothing permissions. **C-Thru Pane** (`cthru`) is built to stay out of your way while keeping you in complete control:

| Capability | How it works |
| :--- | :--- |
| **See-through & non-blocking** | Every click, keystroke, scroll, DOM read, and screenshot runs over per-tab background CDP (`chrome.debugger`)—never stealing focus or switching your active tab. |
| **Live per-agent cursor & overlay** | A closed Shadow DOM overlay (`pointer-events: none`) renders a Fitts's-law gliding cursor in each agent's custom color, a soft edge border, a top-center working notch with a **Stop** button, and an anti-snooping action tag—while your own clicks pass straight through. |
| **Multi-agent side panel + MCP** | Chat directly with auto-discovered agents (`agy`, `codex`, `claude`, `hermes`, and `~/.hermes/profiles/*`) in the side panel, or drive your browsers from any terminal/MCP client over `stdio` or Streamable HTTP. |
| **Zero-trust by default** | Strict per-agent tab opt-in, execution-time policy & origin re-verification, fail-closed pixel redaction for passwords/payment fields and cross-origin iframes, one-click Kill Switch, and a 30 actions/min circuit breaker. |
| **Lightweight & self-hosted** | One async Python (`uv`) daemon (~35–60 MB RAM, ~0% idle CPU, bounded in-memory buffers) that runs anywhere—locally or remotely over Tailscale—paired with a zero-build MV3 extension. |

---

> [!IMPORTANT]
> Only port `8765` (`/ws`) should ever be tunneled or proxied for remote browsers. Port `8766` (`/mcp` and `/internal/*`) is strictly bound to `127.0.0.1`. See [SECURITY.md](SECURITY.md) for the full threat model.

---

## Quick Start

### 1. Install & start the Hub

```bash
git clone https://github.com/Qaudy/c-thru-pane.git
cd c-thru-pane
uv sync
uv run cthru serve
```

Choose how your browser connects to the Hub:

| Setup | How to connect | Hub WebSocket URL |
| :--- | :--- | :--- |
| **Local (same machine)** | No tunnel or TLS needed—connect directly on loopback. | `ws://127.0.0.1:8765/ws` |
| **Remote via SSH tunnel** | Run `ssh -N -L 8765:127.0.0.1:8765 user@your-server` on your browser machine. | `ws://127.0.0.1:8765/ws` |
| **Remote via Tailscale Serve** | Run `tailscale serve --bg --https=8765 http://127.0.0.1:8765` on the hub host. | `wss://<host>.<tailnet>.ts.net:8765/ws` |
| **Remote via Caddy / Nginx / Cloudflare Tunnel** | Proxy `https://your-host.example` → `http://127.0.0.1:8765` with WebSocket upgrade enabled. | `wss://your-host.example/ws` |

> [!NOTE]
> The extension allows `ws://` **only** on loopback (`127.0.0.1`, `localhost`, `[::1]`). Any remote hostname requires `wss://` so tokens and page data never travel unencrypted.

<details>
<summary>Optional: Run 24/7 with <code>systemd --user</code> &amp; tune chat timeouts</summary>

```bash
mkdir -p ~/.config/systemd/user
cp deploy/c-thru-pane.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now c-thru-pane
```

Side-panel chat turns default to a **180s** idle timeout and **900s** wall-clock timeout. Override with:

```bash
uv run cthru serve --chat-idle-timeout 180 --chat-wall-timeout 900
```

Chat workspaces live under `workspaces/<device_id>/<agent_id>` in the hub's state directory (`~/.config/c-thru-pane`).

</details>

---

### 2. Pair your browser(s)

Generate a unique, revocable 256-bit token for each machine/browser:

```bash
uv run cthru pair home-chrome --label "Home Chrome"
uv run cthru pair work-vivaldi --label "Work Vivaldi"
```

---

### 3. Load the MV3 extension (zero build step)

1. Copy the [`extension/`](extension/) folder to your Mac, Windows, or Linux machine.
2. Open `chrome://extensions` (or `vivaldi://extensions`), enable **Developer mode**, click **Load unpacked**, and select `extension/`.
3. Click the **C-Thru Pane** toolbar icon (uses native Side Panel in Chrome/Brave/Edge, with an automatic docked popup fallback in Vivaldi).
4. Open **Settings** (gear icon):
   - **Hub WebSocket URL:** `ws://127.0.0.1:8765/ws` (local or SSH tunnel) or `wss://<your-host>/ws` (Tailscale / TLS proxy)
   - **Device Name:** `home-chrome` (matches `cthru pair`)
   - **Pairing Token:** paste the one-time token from step 2
   - **Safety Mode:** choose **Work Strict**, **Home Balanced**, or **Read-Only**
5. Click **Connect**, then click **Attach current tab** (or `+` in the composer) to opt a tab into the active agent's color-coded group.

---

### 4. Auto-discover & wire your agents

Inspect all detected CLIs (`agy`, `codex`, `claude`, `hermes`), `~/.hermes/profiles/*` profiles, and custom entries from `~/.config/c-thru-pane/agents.json`:

```bash
uv run cthru agents
```

Wire `c-thru-pane` into every detected agent config in one command (creates `.bak` backups first):

```bash
uv run cthru wire --dry-run    # preview changes without modifying files
uv run cthru wire              # wire all detected agents & Hermes profiles (stdio)
uv run cthru wire --agent ivy  # wire a single agent or profile
uv run cthru wire --http       # wire localhost Streamable HTTP instead of stdio
```

Need a snippet for any custom MCP client (`cursor`, `goose`, `my-bot`)?

```bash
uv run cthru config-snippets --agent my-bot
```

---

## Safety Modes

Every mode enforces hard blocks on browser internals (`chrome://`, `vivaldi://`, `file://`), password managers, and fail-closed pixel redaction on screenshots.

| Mode | Reads & Scrolls | Clicks, Typing & Forms | Navigation | `javascript_eval` | Best for |
| :--- | :--- | :--- | :--- | :--- | :--- |
| **Work Strict** *(default)* | Auto | Prompt every action | Prompt every action | Disabled | Work machines & sensitive browsers |
| **Home Balanced** | Auto | Prompt once per domain/session | Cross-origin prompts | Always prompts | Daily personal browsing |
| **Read-Only** | Auto | Blocked | Blocked | Blocked | Safe inspection & summarization |

> [!TIP]
> Sensitive password/payment/OTP fields **always** require explicit confirmation (or are blocked) regardless of domain allowlists, and `type_text` approval cards explicitly call out `[clears field]` and `[submits via Enter]`.

---

## MCP Toolset

<details>
<summary>View all 21 browser automation tools exposed over MCP</summary>

| Category | Tools |
| :--- | :--- |
| **Tabs** | `tabs_context`, `tabs_create`, `tabs_close` |
| **Reading & Vision** | `read_page` *(open Shadow DOM + `ref` drill-down + `viewport_only`)*, `get_page_text`, `find_elements`, `screenshot`, `zoom_screenshot` |
| **Interaction** | `click`, `hover`, `drag`, `type_text`, `press_key`, `scroll`, `form_input`, `navigate`, `wait` |
| **Diagnostics & Scripting** | `read_console_messages`, `read_network_requests`, `javascript_eval` *(opt-in)* |

</details>

---

## CLI Reference

| Command | Description |
| :--- | :--- |
| `cthru serve` | Run the WS Gateway (`:8765`) + localhost MCP Server (`:8766`) |
| `cthru pair <device>` | Pair a new browser device and print its one-time 256-bit token |
| `cthru devices` | List paired devices, permissions, and persisted `last_seen` timestamps |
| `cthru status` | Show live connected devices, attached tabs, and active hub state |
| `cthru revoke <device>` | Immediately revoke a device token and disconnect its live socket |
| `cthru agents` | List auto-discovered CLIs, Hermes profiles, and custom agents |
| `cthru wire [--dry-run]` | Safely wire `c-thru-pane` into detected agent MCP configs |
| `cthru config-snippets` | Print ready-to-paste MCP configs for any agent slug |
| `cthru stdio --agent <id>` | Bridge an MCP `stdio` client to the local Hub |

---

## Development & Contributing

Contributions, bug reports, and PRs are welcome! See [DESIGN.md](DESIGN.md) for the side panel design system and [SECURITY.md](SECURITY.md) for security invariants (including strict zero `.innerHTML` across all extension JavaScript).

```bash
uv sync --extra dev
uv run --offline pytest -q
node tests/test_extension_policy.mjs
```

---

## License

[MIT](LICENSE) © 2026 Qaudy