Technical Documentation
A definitive engineering guide to the Cloaktail browser runtime. Learn how to manage Isolates, execute low-latency JS, and integrate the engine into production-ready agentic pipelines.
Core Runtime
Cloaktail uses a Thread-Per-Isolate model to ensure maximum isolation and performance. Each browser instance is managed by a dedicated Zig thread that orchestrates the V8 isolate and Skia rendering context.
Memory Model
Our Zig kernel utilizes explicit memory allocation pools. This prevents the "memory spike" behavior common in Chromium and allows for predictable resource management in long-running agent processes.
// Fixed-buffer allocator used for Skia paint ops
var buffer: [1024 * 1024]u8 = undefined;
var fba = std.heap.FixedBufferAllocator.init(&buffer);
Isolate Snapshots
To achieve sub-millisecond startup times, Cloaktail leverages V8's native snapshot capabilities. You can serialize an entire pre-warmed JavaScript environment to disk and instantiate it instantly across thousands of parallel worker processes.
Engine Commands
The cloaktail CLI is the primary interface for managing instances and performing low-latency web operations.
cloaktail fetch
Executes a high-speed HTTP GET request using Zig's native multi-threaded downloader, bypassing the V8 engine entirely for raw data retrieval.
$ cloaktail fetch https://api.example.com/data --output-dir ./logs
cloaktail run
Evaluates a script or URL directly within the Zig/V8 bridge without spawning a persistent server.
$ cloaktail run --evaluate "console.log(1+1)"
cloaktail serve
Initializes a persistent instance with a JSON-RPC / CDP listener enabled.
| Flag | Description | Default |
|---|---|---|
| --port | CDP listening port | 9222 |
| --stealth | Enable fingerprint obfuscation | false |
| --headless | Run without GPU window allocation | true |
Integration
Cloaktail is designed to be deployed as a sidecar or a standalone high-performance runtime inside containerized environments.
High-Performance Docker Deployment
To maintain the engine's 42MB footprint, we recommend a multi-stage Alpine Linux build. This ensures zero-dependency execution and absolute minimal image size (approx 54MB total).
# Stage 1: Runtime environment
FROM alpine:3.19 as runtime
# Stage 2: Cloaktail injection
COPY --from=builder /app/bin/cloaktail /usr/local/bin/cloaktail
# Stage 3: Optimization
ENTRYPOINT ["cloaktail", "serve", "--port", "9222"]
EXPOSE 9222
CDP Protocol Bridge
Connect your custom agentic framework directly to Cloaktail using any standard CDP client.
const browser = await puppeteer.connect({
browserWSEndpoint: 'ws://127.0.0.1:9222',
defaultViewport: null
});
API Reference
Cloaktail exposes a comprehensive API surface through the Chrome DevTools Protocol (CDP) and Model Context Protocol (MCP). Use the interactive documentation to explore available methods.
CDP Endpoints
| Endpoint | Description |
|---|---|
| /json | List available CDP targets |
| /json/version | Protocol version info |
| /metrics | Prometheus metrics |
CDP Domains
| Domain | Description |
|---|---|
| Page | Page navigation, screenshots, PDF |
| Runtime | JavaScript evaluation |
| DOM | DOM inspection and manipulation |
| Network | Request handling, cookies |
| Performance | Performance metrics |
| Storage | Storage management |
| Emulation | Device/viewport emulation |
MCP Tools
| Tool | Description |
|---|---|
| goto | Navigate to URL |
| markdown | Get page content as markdown |
| links | Extract all links from page |
| evaluate | Evaluate JavaScript |
| semantic_tree | Get semantic DOM tree |
| click | Click on element |
| fill | Fill input field |
| scroll | Scroll page/element |
| waitForSelector | Wait for element |