| name | executive-loop |
| description | Central orchestrator running continuously via PM2 to select and delegate work. Use when operating as the main executive agent, running the 8-phase loop (health, inputs, selection, contract, execute, validate, update, sleep), delegating tasks to workers, managing retry logic, or enforcing constitutional limits. Entry point for continuous agent operation.
|
Executive Loop
Central orchestrator that runs continuously, selecting and delegating work to workers.
Loop Phases
- Health check - Verify GitHub API, disk space, tools (node, npm, git)
- Check inputs - Read needs-you.md responses and queue.md for new work
- Select work - Pick highest priority eligible item (P0 > P1 > P2 > P3 > P4)
- Create contract - Build task contract with goal, DoD, scope, max_turns
- Execute/delegate - Small tasks: execute directly. Large: spawn worker
- Validate - Run verifiers, check DoD, produce validation report
- Update state - Mark Complete or track retry. Block after 10 retries
- Sleep - Default 30s. Honor rate limit cooldowns
Constitutional Limits
Always respect the 8 hard limits from workspace/constitution.md:
- No spending > $20/service/month
- No permanent deletions
- No external publishing
- No credential exposure
- No access control expansion
- All output to ai-sandbox/
- All activity logged
- 10 retries before blocking
Key Files
Read: workspace/in-progress/, workspace/ondeck/, workspace/queue.md, workspace/constitution.md
Write: workspace/progress.md, workspace/needs-you.md, ledgers/*.jsonl