Getting Started

Constclaw Docs

Constclaw is a Chrome extension that connects to your local OpenClaw AI gateway over WebSocket. Highlight any text → click → get AI-powered analysis in the side panel.

🦀
New here? Start with the Installation guide to get OpenClaw running, then load the extension. Total setup: under 5 minutes.

Architecture overview

Constclaw follows a two-layer architecture. The extension itself is a thin client — it captures text selections, renders the side panel UI, and manages query history. All AI inference is delegated to the local OpenClaw gateway.

  ┌─────────────────────────────────────────────────┐
  │              Chrome Browser                      │
  │                                                   │
  │   ┌──────────────┐     ┌─────────────────────┐   │
  │   │  Content.js  │────▶│   Side Panel UI     │   │
  │   │ (text select) │     │  (sidepanel.html)   │   │
  │   └──────┬───────┘     └──────────┬──────────┘   │
  │          │                        │               │
  └──────────┼────────────────────────┼───────────────┘
             │              WebSocket │
             └──────────┬────────────┘
                        ▼
             ┌──────────────────────┐
             │   OpenClaw Gateway   │
             │  ws://127.0.0.1:18789│
             └──────────┬───────────┘
                        │
             ┌──────────▼───────────┐
             │    AI Model Provider │
             │  (Anthropic / OpenAI)│
             └──────────────────────┘
    

Key concepts

File structure

bash
ai-assistant-extension/
├── manifest.json        # MV3 config, ws:// host permissions
├── background.js        # Service worker — context menu relay
├── content.js           # Floating button injection + text selection
├── assets/
│   ├── icon16.png
│   ├── icon48.png
│   └── icon128.png
└── sidepanel/
    ├── sidepanel.html   # Side panel UI markup
    ├── sidepanel.css    # Styles
    └── sidepanel.js     # WS gateway client + OpenClaw protocol

Host permissions

Constclaw uses ws:// host permissions in manifest.json. This allows the extension to open WebSocket connections to the local gateway. No external URLs are contacted by the extension itself.

json
"host_permissions": [
  "ws://127.0.0.1: 18789/*",
  "ws://localhost: 18789/*",
  "ws://*/*"
]