# webctl
webctl is a CLI for browser automation designed for both AI agents and humans. Uses stateless commands that control a persistent browser daemon via Unix sockets and JSON-RPC. Built on Playwright/Chromium. MIT licensed.
Solves a key problem with MCP-based browser tools: context bloat. MCP servers dump full accessibility trees and console logs into every response, exhausting context windows. webctl lets users filter data before it enters the LLM context, using flags and Unix pipes.
## Architecture
- **Client-daemon model**: Stateless CLI sends commands to a persistent browser daemon (auto-starts on first command)
- **Communication**: Unix sockets with JSON-RPC
- **IPC authentication**: Kernel-level UID verification (SO_PEERCRED on Linux, LOCAL_PEERCRED on macOS)
- **Element selection**: Semantic ARIA role-based queries instead of CSS selectors (stable across UI refactors)
## Key features
- Context filtering: `--interactive-only`, `--within`, `--limit`
- Pipe output through Unix tools (grep, jq)
- Cache snapshots to disk for reuse
- Named sessions with persistent cookies
- Headless and headed modes
- Output formats: human-readable, JSON, JSONL
- Proxy and container deployment support
## Commands
- Navigation: `navigate`, `back`, `forward`, `reload`
- Observation: `snapshot`, `screenshot`, `query`
- Interaction: `click`, `type`, `select`, `check`, `press`, `scroll`
- Waiting: `wait` (network-idle, element existence)
- Session: `status`, `save`, `console`
## Agent integration
- Auto-generates skills for [[Claude Code]] and Goose via `webctl init`
- Creates lean prompts for Gemini, Copilot, and Codex
- Human operators can run identical commands as agents for debugging/takeover
## References
- Source code: https://github.com/cosinusalpha/webctl
## Related
- [[Claude Code]]
- [[AI Agents]]
- [[Playwright]]