-
Notifications
You must be signed in to change notification settings - Fork 1
Swarm Overlord
The Overlord is the cross-project meta-orchestrator of Nebulus Swarm. Beyond managing individual minions, it understands project relationships, dependency graphs, and blast radius across your entire ecosystem.
The Overlord operates in three modes:
- Meta-Orchestrator (Phases 1-2, 279 tests): Project discovery, dependency tracking, scope analysis, and autonomy
- Slack + Background Mode (Phase 3, 285 tests): Slack command router, approval workflows, background daemon, proactive detection, notifications
- Control Plane (Original): Slack/Docker minion dispatch and coordination
590 total Overlord tests across all phases (v2.6.0).
Project configuration and dependency management using overlord.yml files:
- Discovers all projects in your workspace
- Loads project metadata (name, path, dependencies, test commands)
- Builds dependency order using Kahn's algorithm
- Validates circular dependencies
Git state and health monitoring across all projects:
- Scans for uncommitted changes, unpushed commits
- Detects active branches and their status
- Runs test suites and reports health
- Tracks last commit timestamps
DAG traversal and impact analysis:
- Find upstream dependencies (what this project depends on)
- Find downstream dependents (what depends on this project)
- Calculate affected projects by a change
- Render ASCII dependency trees
- Extract subgraphs for specific projects
Blast radius evaluation for changes:
- Categorizes changes: local, upstream, downstream, cross-cutting
- Computes affected project sets
- Evaluates autonomy suitability (can this be auto-dispatched?)
- Confidence scoring based on scope and test health
Cross-project observation store (SQLite):
- Remember key decisions, patterns, gotchas across projects
- Search observations by keyword or project
- Tag observations with categories and confidence
- Prune stale observations
- Export/import for sharing
Shared via nebulus-core: The canonical
OverlordMemoryimplementation now lives innebulus_core.memory.overlord(pure stdlib, no extra dependencies). Atom'snebulus_swarm/overlord/memory.pyis an import shim that triesnebulus_corefirst and falls back to a local copy for standalone installs. All consumer code continues importing fromnebulus_swarm.overlord.memoryunchanged.
Confidence-based auto-dispatch logic:
- Scores changes on: scope, test health, recent failures, observation history
- Recommends human review vs. auto-dispatch
- Suggests reviewer assignments based on affected projects
- Tracks dispatch outcomes for learning
The Dispatcher manages the execution lifecycle of tasks using the GateFlow (Verify-Fix-Re-verify) pattern. It ensures high reliability by triaging worker output and automatically retrying failed reviews.
-
Structured Return Protocol: Workers emit a machine-parseable
---NEBULUS-RETURN---block at the end of their output.-
Fields:
STATUS,SUMMARY,FILES_CREATED,FILES_MODIFIED,TESTS_PASSED,TESTS_FAILED,BLOCKERS,NEXT_ACTION. -
Triage: The Dispatcher parses this block to detect
blockedorerrorstates immediately, failing the task with diagnostic context before proceeding to the formal review step.
-
Fields:
-
Verify-Fix Loop: If a task passes triage but fails the subsequent review step, the Dispatcher enters a fix pass.
- A
FixContextis built containing the original brief, review feedback, attempt count, and previous output. - A new
MISSION_BRIEFis generated with this context to guide the worker's fix attempt.
- A
-
Retry Policy:
-
Max Retries: Defaults to 2 (configurable per-task via
work_queue.tasks.max_retries). - Scope: Only review failures trigger retries; execution failures (e.g., API errors, timeouts) fail immediately to prevent infinite loops and budget waste.
-
Max Retries: Defaults to 2 (configurable per-task via
Multi-project Slack command routing (slack_commands.py):
-
status [project]— Ecosystem or project health via scanner -
scan [project]— Detailed scan with issue detection -
merge <project> <source> to <target>— Dispatch via TaskParser with approval -
release <project> <version>— Coordinated release workflow -
autonomy [level]— Show/change autonomy level -
memory <query>— Search cross-project memory -
help— List available commands
Approval lifecycle with Slack thread binding (proposal_manager.py):
-
States:
pending→approved→executing→completed/failed(ordenied/expired) - Posts proposals to Slack with scope summary
- Reply "approve" or "deny" in thread to control execution
- Auto-expires pending proposals after configurable TTL
- SQLite-backed persistent proposal store
Persistent daemon process with scheduled sweeps and PID-based lifecycle management (overlord_daemon.py):
-
PID file at
~/.atom/overlord/daemon.pidfor reliable process discovery - croniter-based scheduler for configurable task execution
-
Scheduled tasks:
scan(hourly),test-all(nightly),clean-stale-branches(weekly) - Graceful shutdown via SIGINT/SIGTERM with PID file cleanup
- Automatic Slack bot connection when tokens are available
- CLI:
nebulus-atom overlord daemon start|status|stop|restart
Issue detection patterns (detectors.py):
- StaleBranchDetector — Branches with no activity for N days
- AheadOfMainDetector — Develop branches with unmerged commits
- FailingTestDetector — Projects with test failures or missing tests
- Detection engine with autonomy-level filtering
- Integrated into scheduled scans and on-demand
@atom scan
Alert routing and daily digest (notifications.py):
- Urgent notifications — Immediate Slack posts for critical events
- Buffered accumulation — Category-based buffering for daily digest
- Daily digest — Formatted summary with health checks, detections, proposals, executions
- Configurable via
NotificationConfiginoverlord.yml - Category tracking: detections, proposals, executions, health checks, test sweeps
Overlord Control Plane
├── SlackBot # Slack integration (Socket Mode)
├── LLMCommandParser # Natural language command parsing
├── DockerManager # Container lifecycle management
├── GitHubQueue # Issue scanning and label management
├── OverlordState # SQLite state persistence
├── ModelRouter # Complexity-based model selection
└── ReviewWorkflow # Automated PR review (optional)
The Overlord connects to Slack using Socket Mode (no public URL required). It listens for messages in a configured channel and routes them through the command parser.
Slack message → SlackBot → LLMCommandParser → Command handler → Response
The LLM parser uses a small model (default: llama-3.1-8b) to interpret natural language commands with a 5-second timeout. Falls back to regex parsing if the LLM is unavailable.
The Overlord tracks Slack threads for the clarifying questions feature. When a minion asks a question, the Overlord posts it as a Slack message. Human replies in that thread are captured and forwarded back to the minion.
The DockerManager handles the full container lifecycle:
- Spawn: Creates containers with environment variables for the minion's task
- Monitor: Tracks active containers and their status
- Kill: Terminates containers on request or timeout
- Cleanup: Removes dead/exited containers
- Sync: Recovers container tracking after Overlord restart
Each minion container runs in the nebulus-swarm Docker network with resource limits (2GB RAM, 1 CPU).
SQLite database (/var/lib/overlord/state.db) tracks:
- Active minions: ID, repo, issue, status, heartbeat timestamps
- Work history: Completed/failed tasks with duration and error details
- Minion lookups: By ID, by issue, active list
| Method | Description |
|---|---|
add_minion() |
Register a new minion |
update_minion_status() |
Update status and heartbeat |
get_active_minions() |
List all active minions |
get_minion_by_issue() |
Find minion working on an issue |
get_work_history() |
Query history with filters |
get_distinct_repos() |
List unique repositories |
The GitHubQueue scans watched repositories for issues labeled nebulus-ready:
- Fetch all open issues with the work label
- Skip issues already in-progress
- Sort by priority (high-priority label) then creation date
- Return as
QueuedIssueobjects
When cron is enabled (default: daily at 2:00 AM), the Overlord:
- Scans all watched repos for ready issues
- Checks available minion slots
- Warms up the LLM server
- Routes each issue through the Model Router
- Spawns minions for top-priority issues
- Notifies Slack of each spawn
The Overlord exposes health and API endpoints on port 8080:
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check (returns 200) |
/status |
GET | System status, active minions, pending questions |
/queue |
GET | Cached queue scan results |
/minion/report |
POST | Minion event callbacks |
/minion/answer/{id} |
POST | Answer a minion's question |
{
"paused": false,
"active_minions": [...],
"docker_available": true,
"config": {
"max_concurrent": 3,
"timeout_minutes": 30
},
"pending_questions": [...]
}When a minion encounters ambiguity, the Overlord:
- Receives a QUESTION event from the minion
- Posts the question to Slack
- Stores it as a
PendingQuestionwith the thread timestamp - Waits for a human to reply in the Slack thread
- Routes the reply back to the minion via the answer endpoint
Constraints: max 3 questions per minion, 10-minute timeout per question.
A background task monitors minion health:
- Checks heartbeat timestamps every 60 seconds
- Kills minions that haven't sent a heartbeat within the configured timeout (default: 5 minutes)
- Notifies Slack of timed-out minions
- Cleans up dead Docker containers
See Configuration for all Overlord environment variables.
- Nebulus Swarm - System overview
- Swarm Minion - Worker agent details
- Model Router - How models are selected
- Swarm Dashboard - Monitoring the Overlord