How reticlehq/reticle works
Purpose and topology
Reticle is a dev-only, localhost verification layer for AI coding agents. It instruments a running web or desktop app, exposes structured observation/control through MCP and CLI, and returns pass/fail/unknown verdicts with evidence and source attribution. This pnpm/Turbo monorepo separates embedded SDK packages from the local daemon/agent-facing server.
• packages/core/src/index.ts
• packages/server/src/index.ts
• packages/browser/src/index.ts
Agent and CLI entry points
@reticlehq/server is the operational entry point: its CLI starts/statuses the daemon, initializes projects, and launches an MCP server. MCP tool requests are dispatched into server-side tool, session, flow, and verification subsystems rather than directly controlling the browser.
• packages/server/src/cli.ts
• packages/server/src/mcp/mcp.ts
• packages/server/src/tools/tools.ts
In-app instrumentation boundary
The browser SDK runs inside the target app only in development. It installs observers for DOM, network, console, routing, storage, state, and browser behavior; captures actions and snapshots; then streams bounded structured events to the local bridge. This is the principal boundary between the application runtime and Reticle.
• packages/browser/src/reticle.ts
• packages/browser/src/observers/install-all.ts
• packages/browser/src/transport/transport.ts
Framework integration and source attribution
Build integrations inject/connect the SDK in supported app runtimes and keep it out of production builds. The React package augments generic browser evidence with React commit/store information and maps DOM targets through React fiber toward source locations. Next and Vite adapters are the common framework-facing integration points.
• packages/react/src/index.ts
• packages/react/src/cdp-reader.ts
• packages/vite-plugin/src/index.ts
• packages/next/index.cjs
Local bridge, daemon, and session control
A localhost HTTP/WebSocket bridge authenticates paired browser connections, receives browser event streams, and mediates commands. The daemon owns lifecycle, ports, durable local state, heartbeat/idle behavior, multi-project coordination, and session leases; session management maintains command queues, observed state, health, and live-control context.
• packages/server/src/bridge/bridge.ts
• packages/server/src/daemon/daemon.ts
• packages/server/src/session/session-manager.ts
Verification pipeline
Agent actions (navigate, input, click, query, observe) are executed against a selected session, then events are reconciled in action windows. Predicate evaluation combines network, DOM, state, signal, console, and related evidence; honesty/coverage logic prevents an unobservable or unsettled condition from becoming a silent pass. Verdicts can carry source evidence and consequence diagnostics.
• packages/server/src/tools/act-tools.ts
• packages/server/src/events/predicate-eval.ts
• packages/server/src/honesty/honesty.ts
• packages/core/src/consequence.ts
Recorded flows, persistence, and execution modes
Flows record actions and assertions, compile/replay them deterministically, support verification/gating and healing proposals, and persist project/run/journal artifacts locally. Browser automation is pooled through Playwright when Reticle needs launched or managed contexts; normally it attaches to an already running instrumented app. Desktop support crosses renderer/main-process or Rust IPC boundaries.
• packages/server/src/flows/flows.ts
• packages/server/src/flows/flow-replay.ts
• packages/server/src/project/project-store.ts
• packages/server/src/pool/browser-pool.ts
• packages/electron/main.cjs
• packages/tauri/src/lib.rs
External services and delivery boundaries
Core runtime communication is local: browser-to-daemon transport binds to localhost and data is retained in local stores/journals. Optional cloud sync, telemetry, feedback, licensing, and update checks are isolated server concerns. The repository also ships benchmark apps and end-to-end harnesses that exercise browser, Electron, Tauri, daemon, MCP, replay, and transport-fault paths.
• packages/server/src/cloud/cloud-sync.ts
• packages/server/src/telemetry/telemetry.ts
• packages/server/src/license/license.ts
• apps/e2e/run.mjs
Main entry points: daemon.ts Daemon · reticle.ts Browser SDK · session-manager.ts Session manager · bridge.ts Local bridge
Components 22
Agent control
- Server CLI · Starts and manages the local daemon.
packages/server/src/cli.ts - MCP server
packages/server/src/mcp/mcp.ts - Tool dispatcher
packages/server/src/tools/tools.ts
In-app instrumentation
- Target app runtime · The instrumented browser or desktop application.
- Browser SDK · Development-only observation and control boundary.
packages/browser/src/reticle.ts - Observers · Captures DOM, network, console, routing, storage, state, and behavior.
packages/browser/src/observers/install-all.ts - Browser transport · Streams bounded structured events to localhost.
packages/browser/src/transport/transport.ts
Local runtime
- Local bridge · Authenticates browser connections and mediates commands.
packages/server/src/bridge/bridge.ts - Daemon · Owns lifecycle, ports, heartbeats, and multi-project coordination.
packages/server/src/daemon/daemon.ts - Session manager · Maintains leases, command queues, observed state, and health.
packages/server/src/session/session-manager.ts - Project store · Persists project, run, and journal artifacts.
packages/server/src/project/project-store.ts - Browser pool · Provides launched or managed browser contexts when needed.
packages/server/src/pool/browser-pool.ts
Verification and flows
- Action tools · Executes navigate, input, click, query, and observe actions.
packages/server/src/tools/act-tools.ts - Predicate evaluation · Reconciles action windows across captured evidence.
packages/server/src/events/predicate-eval.ts - Honesty and coverage · Prevents unobservable or unsettled conditions from silently passing.
packages/server/src/honesty/honesty.ts - Consequence diagnostics · Carries source evidence and consequence diagnostics with verdicts.
packages/core/src/consequence.ts - Recorded flows · Records assertions and deterministically compiles or replays flows.
packages/server/src/flows/flow-replay.ts
Integrations
- Framework adapters · Vite and Next inject/connect the SDK outside production builds.
packages/vite-plugin/src/index.ts - React attribution · Adds commit/store evidence and fiber-to-source mapping.
packages/react/src/cdp-reader.ts - Desktop adapters · Crosses renderer/main-process or Rust IPC boundaries.
packages/electron/main.cjs
Optional services and validation
- Cloud and telemetry · Isolated sync, telemetry, feedback, licensing, and update concerns.
packages/server/src/cloud/cloud-sync.ts - E2E harness · Exercises daemon, MCP, replay, desktop, and transport-fault paths.
apps/e2e/run.mjs
Connections 26
- Server CLI → Daemon: manages
- Server CLI → MCP server: launches
- MCP server → Tool dispatcher: dispatches requests
- Tool dispatcher → Action tools: invokes
- Framework adapters → Browser SDK: injects/connects
- React attribution → Browser SDK: augments evidence
- Browser SDK → Target app runtime: runs in
- Browser SDK → Observers: installs
- Observers → Browser transport: emits events
- Browser transport → Local bridge: localhost stream
- Daemon → Local bridge: hosts
- Daemon → Session manager: coordinates
- Daemon → Project store: persists locally
- Action tools → Session manager: targets selected session
- Session manager → Local bridge: queues commands
- Local bridge → Browser SDK: mediates control
- Session manager → Predicate evaluation: supplies action windows
- Predicate evaluation → Honesty and coverage: evaluates verdict safety
- Honesty and coverage → Consequence diagnostics: returns evidence diagnostics
- Recorded flows → Action tools: replays actions
- Recorded flows → Predicate evaluation: replays assertions
- Recorded flows → Project store: stores runs and journals
- Browser pool → Session manager: provides managed contexts
- Desktop adapters → Local bridge: IPC integration
- Daemon → Cloud and telemetry: optional sync and telemetry
- E2E harness → Daemon: validates