Overview
OpenClaw Mission Control is the centralized operations and governance platform for running OpenClaw across teams and organizations. It provides unified visibility, approval controls, and gateway-aware orchestration through a modern web UI and REST API.Technology Stack
| Layer | Technology | Version |
|---|---|---|
| Backend API | FastAPI + SQLModel | Python 3.12 |
| ORM | SQLAlchemy async + psycopg | 2.0 / 3.3 |
| Database | PostgreSQL | 16 |
| Migrations | Alembic | 1.18 |
| Job Queue | Redis + RQ | 7 / 2.6 |
| Templates | Jinja2 | 3.1 |
| Frontend | Next.js App Router | 16 (Turbopack) |
| UI | React 19 + TypeScript | — |
| Styles | Tailwind CSS | — |
| API Client | Orval (generated) | — |
| Auth | Local bearer token or Clerk JWT | — |
System Architecture
Core Components
Frontend (Next.js)
The frontend is a modern Next.js 16 application using:- App Router for file-based routing
- React 19 with TypeScript for type safety
- Tailwind CSS for styling
- Orval-generated client for type-safe API calls
- React Query for data fetching and caching
/boards- Board and task management/agents- Agent lifecycle (admin only)/gateways- Gateway configuration (admin only)/approvals- Approval workflows/activity- Activity feed and audit logs/organization- Organization settings
Backend (FastAPI)
The backend provides a REST API with:- ~22 API route modules under
/api/v1 - SQLModel models (~30 database tables)
- Pydantic schemas for request/response validation
- Service layer for business logic
- Async database operations with SQLAlchemy 2.0
Entry Point
app/main.py defines:
- Custom
MissionControlFastAPIclass extending FastAPI - Lifespan hook for database initialization
- CORS configuration
- Health check endpoints:
/health,/healthz,/readyz - Router registration for all API modules
Configuration
app/core/config.py provides Settings class (Pydantic BaseSettings):
Database Layer
PostgreSQL stores all system state:- Organizations and membership
- Boards, board groups, and tasks
- Agents and gateways
- Approvals and activity events
- Board memory (key-value storage)
- Webhooks and custom fields
Job Queue (Redis + RQ)
Asynchronous job processing for:- Webhook dispatch with retry logic
- Background template synchronization
- Activity event processing
rq worker -u redis://localhost:6379/0
Gateway Integration
Mission Control integrates with OpenClaw Gateway via:- WebSocket RPC protocol (JSON-RPC style)
- Agent provisioning - create/update/delete agents
- File operations - write TOOLS.md and templates
- Session management - query active sessions
- Template sync - batch update agent configurations
Authentication Architecture
Local Mode (AUTH_MODE=local)
- Token ≥50 characters
- Non-placeholder value
- Same token in frontend
NEXT_PUBLIC_LOCAL_AUTH_TOKEN
Clerk Mode (AUTH_MODE=clerk)
Agent Authentication
Agents useX-Agent-Token header:
- Token hash stored in
agents.agent_token_hash - Token embedded in agent’s TOOLS.md file
- Agent endpoints require
require_admin_or_agentdependency
Data Flow
User Work Orchestration Flow
Template Sync Flow
Repository Structure
Key Design Principles
- Operations-first: Built for running agent work reliably, not just task management
- API-first: All UI operations available via REST API
- Gateway-aware: Designed for distributed runtime environments
- Governance built-in: Approvals, roles, and audit logs are first-class
- Async by default: Database and external calls use async/await
- Type-safe: Full TypeScript on frontend, Pydantic validation on backend
- Observable: Activity events, audit logs, and structured logging throughout
Scalability Considerations
Current Design
- Single backend server
- Single PostgreSQL database
- Single Redis instance
- RQ workers (can scale horizontally)
Scaling Options
- Backend: Deploy multiple FastAPI instances behind load balancer
- Database: PostgreSQL read replicas, connection pooling
- Redis: Redis Cluster or Sentinel for HA
- Workers: Scale RQ worker count based on job queue depth
- Storage: Agent workspaces on shared filesystem or object storage
Security Model
Authentication
- User auth via local token or Clerk JWT
- Agent auth via X-Agent-Token header
- Token validation on every request
Authorization
- Organization-scoped resources
- Role-based access control (owner/admin/member)
- Agent can only access own board’s tasks
- Admin endpoints require owner/admin role
Data Protection
- Passwords never stored (Clerk manages user auth)
- Agent tokens hashed with bcrypt
- CORS enforcement
- SQL injection prevention via parameterized queries
Monitoring and Observability
Health Checks
GET /health- Basic liveness checkGET /healthz- Database connectivity checkGET /readyz- Full readiness check
Logging
- Structured logging (JSON or text format)
- Request/response logging
- Slow query logging (configurable threshold)
- Activity events stored in database
Metrics
- Task counts by status
- Agent activity metrics
- Board metrics (via
/api/v1/metrics) - Job queue statistics
Related Concepts
- Organizations - Multi-tenant structure
- Boards - Work organization
- Agents - Autonomous actors
- Gateways - Runtime integration
- Tasks - Work items