Database
PostgreSQL is the persistent source of truth and the initial task queue.
Tables
users-- accounts (admin/operator), includesdate_formatandtime_formatpreferences.sessions-- user sessions.servers-- managed servers, includesmetadataJSONB (CPU, RAM, swap, disk, uptime, kernel errors, monitored services, service statuses).agent_enrollments-- one-time enrollment tokens.agent_heartbeats-- heartbeat history with metrics.conversations,messages-- chat history.tasks,task_steps,tool_executions-- task lifecycle and results.approvals-- approval requests for controlled actions.audit_events-- audit trail.
Rules
- UUID primary keys for business entities.
- Foreign keys with explicit
ON DELETEbehaviour; never cascade-delete audit history. - Index foreign keys and status/time lookups.
- Transactions for task creation, approval, claim and completion.
- Row-level locking (
FOR UPDATE SKIP LOCKED) when claiming tasks. - No secrets in JSONB, logs or model context.
