// DOCUMENTATION

Architecture layers

How Koko separates engine internals, runtime services, protocols, and public APIs.

Core Concepts

Koko separates browser execution into explicit runtime layers so engine internals stay isolated, protocols stay modular, and public APIs stay stable.

Layer model

Core Engine → Runtime → Protocols → Adapters → Public API

Repository layout

src/
  core/         # Browser engine, DOM, parser, JS bindings, Web APIs
  runtime/      # Lifecycle, services, network, storage, telemetry
  protocols/    # CDP and MCP protocol implementations
  adapters/     # CLI and server adapters
  public/       # Stable public API surface
  support/      # Shared utilities
  testing/      # Isolated test infrastructure

sdk/
  src/          # TypeScript CDP SDK and CLI helpers

code-check/
  lifecycle/    # Browser lifecycle and realm correctness tests
  suite/        # Fingerprint / bot-detection regression suite
  local/        # Offline HTML fixtures
  sites/        # Per-site integration scripts
  features/     # Per-engine feature checks

Core engine

Low-level browser execution: HTML/CSS parsing, DOM, JavaScript via V8 bindings, and Web API implementations. Written in Zig for predictable memory behavior and embeddability.

Runtime services

Navigation lifecycle, network stack (libcurl), storage, telemetry, and multi-session coordination. This layer enforces ordering guarantees critical for automation.

Protocols

  • CDP — Chrome DevTools Protocol domains including custom LP.* namespace
  • MCP — Model Context Protocol tools for AI agent integration

Adapters

CLI entrypoints (serve, mcp) and server mode that expose protocols over HTTP/WebSocket.

SDK

TypeScript client that speaks CDP directly. Modules: transport/, cdp/, browser/, cli/.