How crshdn/mission-control works
1. What this repo is
Autensa is a single Next.js 14 application that combines a human-facing control plane with an autonomous product-improvement engine. It is not just a dashboard: the app also runs the orchestration logic that decides when to research, ideate, dispatch agents, track progress, and create pull requests.
2. Primary runtime boundary
The main process is the Next.js app (src/app for pages and API routes). It serves the UI, exposes all server APIs, and acts as the integration hub. The major external runtime it depends on is the OpenClaw Gateway over WebSocket, which is the actual agent execution environment.
3. Core user-facing subsystems
The UI is split into a few large surfaces:
- Task orchestration: kanban, planning, convoy, chat, activity, checkpoints
- Product autopilot: research, ideation, swipe, maybe-pool, health, schedules
- Workspace / agent ops: workspace views, agent health, agent discovery, live feed
- Cost controls: task/product cost dashboards and budget caps
These are all backed by API routes rather than local client-only state.
4. Server-side domain boundaries
API routes are grouped by domain under src/app/api:
- tasks/* for task lifecycle, planning, dispatch, checkpoints, convoy, chat
- products/* for autopilot lifecycle: research, ideation, swipes, schedules, health, A/B tests
- agents/* for agent registry, health, mailbox, discovery/import
- costs/* for spend tracking and caps
- workspaces/* for workspace data and knowledge
- openclaw/* for gateway proxying and session/status access
- webhooks/* for GitHub and agent-completion callbacks
This makes the repo strongly domain-oriented rather than layered around generic CRUD.
5. Persistence and local state
The system uses SQLite as the authoritative database for products, tasks, ideas, swipe history, costs, checkpoints, workspaces, agent health, mailbox messages, and merge state. Database schema and migrations live in src/lib/db, with automatic migration execution on startup and backup support before destructive changes. File-based storage is also used for task images and workspace files on disk.
6. Autopilot data flow
The product autopilot pipeline is the repo’s main business flow:
research → ideation → swipe → plan → build → test → review → PR
Research and ideation run as server-side jobs, persist results in SQLite, and emit activity/events. Swipe decisions update preference models and may create tasks or queue ideas in the maybe pool. Approved ideas become build tasks that flow into agent dispatch and eventually GitHub PR creation.
7. Agent execution flow
Autensa does not execute builds itself. It prepares context, workspace, and instructions, then dispatches work to the OpenClaw Gateway. The gateway runs the agent sessions, while Autensa tracks session metadata, health, checkpoints, mailbox messages, and completion callbacks. That separation is the key architectural boundary: Autensa orchestrates; OpenClaw executes.
8. Real-time feedback loop
The app uses SSE (/api/events/stream) and related event APIs to keep the UI live. Activity dashboards, live feeds, unread badges, agent health indicators, and task chat all update from streamed server events rather than polling alone. This stream is fed by task progress, agent callbacks, cost events, and lifecycle changes from the orchestration layer.
9. Advanced orchestration features
Two important execution modes sit on top of the core pipeline:
- Convoy mode: decomposes large work into dependent subtasks and schedules them in parallel
- Checkpoint / recovery: stores agent progress so work can resume after interruption
These features depend on dedicated orchestration libraries in src/lib/convoy.ts, checkpoint.ts, agent-health.ts, and workspace-isolation.ts.
10. Workspace isolation
Build work happens in isolated per-task environments. For repo-backed projects, the system uses git worktrees; for local/non-repo work it uses task sandboxes under a workspace base path. It also manages port allocation so concurrent builds do not collide. This is a distinct operational boundary between the controller and the mutable build environment.
11. Learning and adaptation
The repo includes a feedback loop for improving future agent behavior. learner.ts, skills.ts, skill-extraction.ts, and the autopilot preference model capture what worked during builds and what the operator swiped on. That knowledge is injected into later dispatches, so the system evolves across tasks and products.
12. Cost, safety, and governance
Cost tracking and budget caps are first-class features, with APIs and libraries for per-task/per-product spend, cap enforcement, and pause behavior. Safety/governance is enforced through bearer-token auth, HMAC webhook validation, input validation, rollback/backup flows, and error reporting. There are also explicit admin endpoints for backups and rollbacks.
13. External integrations
The two material integrations are:
- OpenClaw Gateway via WebSocket for agent execution and session management
- GitHub via webhooks for completion/revert automation and PR lifecycle handling
AI providers are indirectly involved through the gateway and autopilot research/ideation paths, but the repo’s main architectural dependency is still the gateway rather than a direct model SDK surface.
14. Deployment shape
The project is designed for self-hosting, including Docker and Compose. Runtime state is split between the app container, SQLite volume, and workspace volume, while the gateway can run locally or remotely. That means the architecture is fundamentally controller + external agent runtime + local persistence + workspace filesystem.
Main entry points: page.tsx Control plane · tasks/route.ts Tasks API · schema.ts SQLite DB · products/route.ts Products API
Components 24
UI surfaces
Next.js pages and client components for operator workflows
- App shell · Root app layout and entrypoint for the control plane
src/app/layout.tsx - Control plane · Main landing surface for tasks, products, workspace, and settings
src/app/page.tsx - Task ops UI · Kanban, planning, convoy, chat, activity, checkpoints, and task detail views
src/components/TaskModal.tsx - Autopilot UI · Research, ideation, swipe, review, health, and maybe-pool workflows
src/app/autopilot/[productId]/page.tsx - Workspace UI · Workspace dashboards and agent activity surfaces
src/app/workspace/[slug]/page.tsx - Cost UI · Spend views and budget cap controls
src/components/costs/CostDashboard.tsx
Server APIs
Domain-oriented route handlers under src/app/api
- Tasks API · Task lifecycle, planning, dispatch, convoy, chat, checkpoints, and workspace binding
src/app/api/tasks/route.ts - Products API · Research, ideation, swipe, maybe-pool, health, schedules, variants, and AB tests
src/app/api/products/route.ts - Agents API · Agent discovery, health, mailbox, OpenClaw bindings, and registry operations
src/app/api/agents/route.ts - Workspaces API · Workspace metadata, knowledge, and workflows
src/app/api/workspaces/route.ts - OpenClaw API · Session/status/model access and orchestration proxy endpoints
src/app/api/openclaw/status/route.ts - Costs API · Cost events, breakdowns, and caps enforcement
src/app/api/costs/route.ts - Events stream · Server-sent event stream and event recording for live UI updates
src/app/api/events/stream/route.ts
Orchestration core
Server-side coordination, domain logic, and runtime control
- Orchestration core · High-level task and product coordination across planning, dispatch, and recovery
src/lib/orchestration.ts - Autopilot pipeline · Research, ideation, swipe, preferences, maybe-pool, health, scheduling, and recovery
src/lib/autopilot/research.ts - Convoy & recovery · Parallel subtask scheduling, checkpoints, and resume logic
src/lib/convoy.ts - Isolation layer · Per-task worktrees, sandbox paths, and port allocation for concurrent builds
src/lib/workspace-isolation.ts - Cost tracking · Spend accounting, reporting, cap checks, and pause behavior
src/lib/costs/tracker.ts - Learning loop · Learner, skills extraction, and preference updates that influence later dispatches
src/lib/learner.ts
State & persistence
SQLite, files, and backup/restore support
- SQLite DB · Persistent store for tasks, products, ideas, costs, checkpoints, agents, and merge state
src/lib/db/schema.ts - Migrations · Schema setup, automatic migrations, and startup database changes
src/lib/db/migrations.ts - Workspace files · Task images, workspace files, worktrees, and sandboxed build artifacts
data/task-images
External integrations
Gateway, GitHub, webhooks, and streaming events
- OpenClaw Gateway · External agent execution environment that runs sessions and builds
- GitHub · PR, completion, and revert automation via webhooks
Connections 29
- App shell → Control plane: renders · Root layout hosts the main operator entrypoint
- Control plane → Task ops UI: navigates · Primary control plane opens task orchestration surfaces
- Control plane → Autopilot UI: navigates · Primary control plane opens product autopilot surfaces
- Control plane → Workspace UI: navigates · Primary control plane opens workspace and agent ops surfaces
- Control plane → Cost UI: navigates · Primary control plane opens spend and budget controls
- Task ops UI → Tasks API: calls · Task views are backed by task lifecycle and orchestration APIs
- Autopilot UI → Products API: calls · Autopilot views drive server-side research, ideation, swipe, and health flows
- Workspace UI → Workspaces API: calls · Workspace views load metadata, knowledge, and workflows from APIs
- Workspace UI → Agents API: calls · Agent operations and live health data are fetched through agent APIs
- Cost UI → Costs API: calls · Budget dashboards and caps manager operate through cost APIs
- Tasks API → Orchestration core: uses · Task routes delegate scheduling, dispatch, planning, and state transitions
- Tasks API → Convoy & recovery: uses · Task routes expose convoy dispatch and checkpoint recovery
- Tasks API → Isolation layer: uses · Task execution is prepared in isolated workspaces and sandboxes
- Products API → Autopilot pipeline: uses · Product routes run the research-to-PR pipeline and persist results
- Products API → Learning loop: uses · Swipe and build feedback update preference and skill models
- Agents API → OpenClaw Gateway: proxies · Agent session and health operations bridge to the OpenClaw runtime
- OpenClaw API → OpenClaw Gateway: proxies · OpenClaw endpoints expose gateway sessions, status, and model access
- Orchestration core → OpenClaw Gateway: dispatches · Autensa prepares context and delegates execution to the external agent runtime
- Orchestration core → SQLite DB: persists · Task and product orchestration state is stored in SQLite
- Autopilot pipeline → SQLite DB: persists · Research, ideation, swipe history, and product state are stored durably
- Convoy & recovery → SQLite DB: persists · Convoy progress and checkpoints are recovered from SQLite state
- Isolation layer → Workspace files: manages · Isolated build environments use worktrees, sandboxes, and task files
- Cost tracking → SQLite DB: persists · Spending records and caps are tracked in SQLite
- Events stream → Control plane: streams to · Realtime events power live dashboards and badges
- Events stream → Orchestration core: emits · Task and product lifecycle changes feed the event stream
- Events stream → OpenClaw Gateway: receives · Agent callbacks and session changes surface through realtime events
- GitHub → Tasks API: callbacks · GitHub webhooks trigger completion and revert automation
- GitHub → Products API: callbacks · GitHub webhook events support PR lifecycle handling
- Migrations → SQLite DB: initializes · Schema migrations prepare and evolve the SQLite database