// TECHNICAL_MANUAL_v0.1.0

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.

ZIG
// 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.

SHELL
$ 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.

SHELL
$ cloaktail run --evaluate "console.log(1+1)"

cloaktail serve

Initializes a persistent instance with a JSON-RPC / CDP listener enabled.

FlagDescriptionDefault
--portCDP listening port9222
--stealthEnable fingerprint obfuscationfalse
--headlessRun without GPU window allocationtrue

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).

DOCKERFILE
# 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.

TYPESCRIPT (Puppeteer)
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.

OpenAPI Schema (JSON) Interactive API Docs

CDP Endpoints

EndpointDescription
/jsonList available CDP targets
/json/versionProtocol version info
/metricsPrometheus metrics

CDP Domains

DomainDescription
PagePage navigation, screenshots, PDF
RuntimeJavaScript evaluation
DOMDOM inspection and manipulation
NetworkRequest handling, cookies
PerformancePerformance metrics
StorageStorage management
EmulationDevice/viewport emulation

MCP Tools

ToolDescription
gotoNavigate to URL
markdownGet page content as markdown
linksExtract all links from page
evaluateEvaluate JavaScript
semantic_treeGet semantic DOM tree
clickClick on element
fillFill input field
scrollScroll page/element
waitForSelectorWait for element