How alookai/alook works
Purpose and entry points
Alook is a self-hosted orchestration platform for running local AI coding agents as persistent, collaborative workers with tasks, email, calendars, files, traces, and community messaging. Primary user entry point is npx @alook/app onboard, implemented by src/app/src/index.ts and onboarding commands in src/app/src/commands/onboard.ts. Runtime-facing CLI entry is src/cli/src/index.ts; the local daemon is separately packaged in src/daemon/src/index.ts.
Control plane: Web application and API
The Next.js application provides workspace dashboards, agent chat/canvas, task and runtime views, plus a large HTTP API used by browser clients, CLI/daemons, and workers. Workspace UI begins under src/web/src/app/(app)/w/[slug]/, while API handlers live in src/web/src/app/api/. Task lifecycle endpoints—poll, start, progress, complete, fail—form the central remote execution contract: src/web/src/app/api/daemon/tasks/ and src/web/src/lib/services/task.ts.
Persistent domain model
src/shared is the cross-package domain boundary: API contracts, validation schemas, runtime configuration, and database query layer are shared by web and workers. Core entities include workspaces, agents, machines, runtimes, conversations, task queues, email, calendar events, artifacts, and community entities. Schema/query definitions are in src/shared/src/db/schema.ts, src/shared/src/db/queries/, and deployed SQL migrations in src/web/migrations/.
Local execution daemon
The daemon discovers installed agent runtimes, registers/heartbeats with the control plane, receives work, and launches isolated local agent sessions against local workdirs. Daemon composition starts at src/daemon/src/daemon/createDaemon.ts; routing and policy sit in src/daemon/src/manager/managerRuntime.ts and src/daemon/src/manager/agentRouter.ts. Session state, progress, notification, and process control are managed in src/daemon/src/runtime/.
Agent-provider adapters and isolation
Provider-specific drivers normalize heterogeneous local tools into a common runtime interface. Supported implementations include Claude, Codex, OpenCode, Gemini, Copilot, Cursor, Kimi, Pi, and Antigravity, centered on src/daemon/src/drivers/index.ts, src/daemon/src/drivers/claude.ts, and src/daemon/src/drivers/codex.ts. This is the key boundary between Alook orchestration and external AI CLIs/SDKs; drivers handle launch environments, event normalization, capability probing, prompts, and provider isolation.
Eventing, realtime, and community
WebSocket Durable Objects provide realtime control/event delivery and rate limiting: src/ws-do/src/ws-durable.ts and src/ws-do/src/rate-limit-do.ts. The web API issues WS tokens and produces events; browser community hooks consume them via src/web/src/hooks/community/use-community-ws.ts. Community servers/channels/DMs, agent/bot wake dispatch, membership, presence, and inbox projections are modeled in src/shared/src/community/ and src/shared/src/db/queries/community/.
External integrations and deployment runtimes
Cloudflare Workers host the web control plane and specialized workers. src/email-worker/src/imap-poller-do.ts polls IMAP and forwards inbound email; src/wake-worker/src/index.ts dispatches agent wake requests. The system uses Cloudflare Durable Objects (src/ws-do and email poller), persistent SQL storage via web migrations/shared queries, and object/media storage implied by artifact and community upload APIs. Desktop/mobile delivery is a Tauri Rust shell bridging to the web experience and push plugin: src/desktop/src-tauri/src/main.rs, src/desktop/src-tauri/src/lib.rs, and src/desktop/src-tauri/plugins/tauri-plugin-push/src/lib.rs.
Main entry points: createDaemon.ts Daemon composition · shared Shared domain · index.ts Provider drivers · ws-durable.ts WebSocket Durable Object
Components 27
Clients
- Onboarding CLI · Primary setup entry point.
src/app/src/index.ts - Onboarding commands
src/app/src/commands/onboard.ts - Runtime CLI
src/cli/src/index.ts - Desktop shell · Bridges the web experience and native push delivery.
src/desktop/src-tauri/src/main.rs - Push plugin
src/desktop/src-tauri/plugins/tauri-plugin-push/src/lib.rs
Control plane
- Workspace UI · Dashboards, chat, canvas, tasks, and runtime views.
- Web API · Serves browsers, daemons, CLI clients, and workers.
- Task lifecycle API · Poll, start, progress, complete, and fail endpoints.
- Task service
src/web/src/lib/services/task.ts - Shared domain · Cross-package contracts, schemas, configuration, and queries.
src/shared - Database schema · Defines workspaces, agents, machines, runtimes, and collaboration entities.
src/shared/src/db/schema.ts - Database queries
- SQL migrations
Local execution
- Daemon entry
src/daemon/src/index.ts - Daemon composition · Discovers runtimes, registers, heartbeats, and receives work.
src/daemon/src/daemon/createDaemon.ts - Runtime manager
src/daemon/src/manager/managerRuntime.ts - Agent router
src/daemon/src/manager/agentRouter.ts - Session runtime · Manages state, progress, notifications, and processes.
- Provider drivers · Normalizes local AI CLI and SDK providers.
src/daemon/src/drivers/index.ts - Claude driver
src/daemon/src/drivers/claude.ts - Codex driver
src/daemon/src/drivers/codex.ts
Realtime & workers
- WebSocket Durable Object · Delivers control and community events.
src/ws-do/src/ws-durable.ts - Rate-limit Durable Object
src/ws-do/src/rate-limit-do.ts - Community WS client
src/web/src/hooks/community/use-community-ws.ts - Community domain · Channels, DMs, presence, inboxes, and wake dispatch.
- IMAP email worker · Polls IMAP and forwards inbound email.
src/email-worker/src/imap-poller-do.ts - Wake worker
src/wake-worker/src/index.ts
Connections 28
- Onboarding CLI → Onboarding commands: runs
- Onboarding commands → Runtime CLI: configures
- Workspace UI → Web API: HTTP requests
- Desktop shell → Workspace UI: hosts
- Desktop shell → Push plugin: uses
- Web API → Task lifecycle API: exposes
- Task lifecycle API → Task service: drives
- Task service → Shared domain: uses
- Shared domain → Database schema: defines
- Shared domain → Database queries: provides
- Database queries → SQL migrations: persists through
- Runtime CLI → Daemon entry: connects to
- Daemon entry → Daemon composition: boots
- Daemon composition → Web API: registers & heartbeats
- Daemon composition → Runtime manager: creates
- Runtime manager → Agent router: routes work
- Agent router → Session runtime: launches session
- Session runtime → Provider drivers: executes through
- Provider drivers → Claude driver: implements
- Provider drivers → Codex driver: implements
- Task lifecycle API → Daemon composition: task lifecycle
- Web API → WebSocket Durable Object: issues tokens & events
- WebSocket Durable Object → Rate-limit Durable Object: enforces limits
- Community WS client → WebSocket Durable Object: consumes events
- Workspace UI → Community WS client: uses
- Community domain → Shared domain: extends
- IMAP email worker → Web API: forwards email
- Wake worker → Daemon composition: dispatches wake