Autopilot & Systemmaster
Relevant source files
The following files were used as context for generating this wiki page:
Autopilot and the Systemmaster (Orchestrator) function as the central autonomous execution and coordination layer of the NeXifyAI platform. The Autopilot system operates a 24/7 background daemon that manages the lifecycle of tasks through an intake, execution, and verification pipeline. The Systemmaster, represented by the Project Supervisor Orchestrator and the Master Chat Routes, serves as the high-level decision instance that delegates work to specialized agents and maintains system consistency.
Sources: scripts/autopilot-daemon.py:2-4, services/api/routes/nexify_ai_routes.py:58-64, services/api/agents/brain_agents/project-supervisor-orchestrator.md:6-7
Autopilot Daemon Architecture
The Autopilot Daemon is a standalone Python service that monitors the public.tasks table in the database. It follows a continuous loop to fetch waiting tasks based on priority and RICE scores, transitions them through execution states, and records heartbeats for system health monitoring.
Task Lifecycle Management
The daemon implements a state machine to track task progress. It uses the intake_task function to query for the highest priority task where autopilot=true and the status is waiting.
The diagram shows the iterative logic of the Autopilot Daemon as it processes tasks from the database.
Sources: scripts/autopilot-daemon.py:30-45, scripts/autopilot-daemon.py:61-90
Core Functions
| Function | Description |
|---|---|
intake_task() | Queries public.tasks for items with autopilot=true and status='waiting', ordered by RICE score and priority. |
mark(id, status) | Updates the database record for a specific task with a new status and timestamp. |
write_heartbeat(state) | Updates a local JSON file at /opt/nexifyai/state/heartbeat.md with the current tick, run count, and status. |
handle_failure(task) | Records an incident in public.incidents and determines if the task should be retried or marked as permanently failed. |
Sources: scripts/autopilot-daemon.py:12-58
Systemmaster Orchestration
The Systemmaster functionality is distributed across the Master Chat Route (Agent Zero) and the Project Supervisor Orchestrator. These components manage multi-project oversight and high-level delegation.
Agent Zero (Master Orchestrator)
Agent Zero is the central autonomous lead instance. It resides in a Docker container (agent0ai/agent-zero:latest) and acts as the bridge between the CEO and specialized agents. It maintains a system-wide hierarchy where it sits above the operational NeXify AI assistant but below the human CEO.
Sources: services/api/routes/nexify_ai_routes.py:66-74
Project Supervisor Orchestrator
This agent monitors system-wide performance across multiple projects. It tracks specific metrics to trigger escalations if the platform deviates from expected behavior.
| Metric | Monitoring Target | Escalation Trigger |
|---|---|---|
| Velocity | Tasks closed vs. opened per week | >10% deviation: Alert Project Manager |
| Quality | Review rejection rate and bug backlog | >25% deviation: Critical alert to stakeholders |
| Agent Health | Brain point freshness and retrieval quality | Deployment blocker: Immediate escalation |
Sources: services/api/agents/brain_agents/project-supervisor-orchestrator.md:25-36
Operational Protocols
The interaction between Autopilot and Systemmaster relies on strict operational mandates, specifically the "Brain-First" mandate and automated quality gates.
The Brain-First Mandate
Before any action, the orchestrator must query the nexifyai_brain (Qdrant) to check for relevant lessons, similar past executions, and mission alignment. Following execution, the result must be reported back to the Brain to ensure persistence and prevent "system amnesia."
Sources: services/api/agents/brain_agents/project-supervisor-orchestrator.md:10-23, services/api/routes/nexify_ai_routes.py:125-131
Order Workflow Integration
The order-workflow-specialist acts as the gatekeeper for the production pipeline. No execution occurs without a formal order, which is then handled by the Autopilot or delegated by the Systemmaster.
The sequence diagram illustrates how orders flow from creation through autonomous execution to quality verification.
Sources: services/api/agents/brain_agents/order-workflow-specialist.md:10-20, services/api/agents/brain_agents/senior-quality-auditor.md:20-25
System Health and Monitoring
The platform exposes health metrics through an internal API (/api/admin/audit/health) which are visualized in a dashboard. The dashboard tracks the overall health score and individual component weights.
| Component | Weight (Typical) | Function |
|---|---|---|
| MongoDB | Variable | CRM and Lead data availability |
| Supabase | Variable | Oracle Tasks and Brain metadata |
| Workers | Variable | Active background task processing |
| Disk/Memory | Variable | Infrastructure resource utilization |
Sources: apps/web/public/health.html:115-130, services/api/routes/nexify_ai_routes.py:245-280
Escalation Matrix
The Systemmaster enforces a 4-level escalation matrix to handle autonomous failures:
- L1 (Retry): Initial timeout or agent failure.
- L2 (Delegate): Reassignment via matching algorithm if agent fails twice.
- L3 (CEO): Persistent failures or no available agents.
- L4 (All Hands): System-wide failure requiring an orchestrator halt.
Sources: services/api/agents/brain_agents/order-workflow-specialist.md:72-80, services/api/agents/brain_agents/senior-quality-auditor.md:120-128
Conclusion
The Autopilot & Systemmaster system ensures the NeXifyAI platform operates autonomously by linking low-level task execution (Autopilot) with high-level coordination and quality control (Systemmaster). By enforcing Brain-First mandates and structured order workflows, the system maintains consistency and auditability across all autonomous operations.