$ show openclaw/Peekaboo
Peekaboo is a mature macOS desktop automation toolkit that provides a CLI, Mac app, and MCP server for screen capture, UI element detection, input synthesis, window management, and AI agent integration. The architecture is modular: a Swift CLI (peekaboo) exposes ~33 commands for interaction, system control, and AI agent orchestration; a Mac app provides a menu bar interface, session management, and visualizer overlays; a bridge daemon (PeekabooBridge) enables secure remote automation via a versioned socket protocol with operation allowlisting. The MCP server exposes native automation tools to AI clients (Claude, Cursor, etc.) via stdio transport. The agent runtime (PeekabooAgentService) supports multiple AI providers (OpenAI, Anthropic, Ollama, etc.) with streaming, tool calling, and session persistence. The codebase is written in Swift 6.2 with strict concurrency, extensive unit/integration tests, and a focus on safety (fail-closed target validation, honest effect reporting). It is not a data research project; it is a production-grade application for macOS automation.
The LLM identified 6 files worth highlighting for reuse:
Implements a versioned handshake protocol for the PeekabooBridge IPC socket. The server validates client protocol version, code-signing identity, and operation allowlist before granting access. This pattern is reusable for any privileged service that needs to authenticate and authorize remote clients over a local socket, with clear version negotiation and capability gating.
Defines the MCPTool protocol that all automation tools conform to, providing input schema, argument validation, execution, and response formatting. The pattern decouples tool logic from transport and agent loop, making it easy to add new tools. The registry (MCPToolCatalog) dynamically discovers and registers tools. This abstraction is reusable for any MCP server or tool-based system.
Implements a planning pattern for UI actions (click, type, scroll) that coordinates capture receipts, lane coordination, and fallback strategies. The plan validates snapshot freshness, applies input policies, and tracks execution outcomes. This pattern is reusable for any system that needs to execute operations with preconditions, retries, and outcome classification.
Generates human-like mouse movement paths using cubic bezier curves with configurable jitter, overshoot, and speed. The service simulates realistic pointer trajectories for click, drag, and move operations. This component is self-contained and can be extracted for any application needing natural mouse simulation.
Provides a SwiftUI Canvas-based animated ghost icon for the menu bar that reacts to agent processing state. Uses adaptive frame rate (30/15 fps), icon caching, and drawingGroup() optimization. This pattern is reusable for any status bar indicator that needs smooth, battery-efficient animation.
A test helper that runs CLI commands in-process with injected stub services, enabling deterministic testing of command logic without real system calls. It serializes async execution and captures output. This pattern is reusable for any CLI testing framework that needs to avoid subprocess overhead and control dependencies.