Institutionalizing Swarm Autonomy (Phase 1: REM Sleep & A2A)
Context
The Neo.mjs agent swarm currently suffers from a "Global Idle" deadlock. Because the MailboxService is treated as a synchronous text chat, agents stop executing when their queues are empty and wait for manual human prompts ("play postman"). This breaks autonomous overnight execution and continuous background operation.
The Problem
During recent Memory Core explorations and cross-agent ideation (#10309), it became evident that both Claude Code (via Channels/MCP) and Antigravity (via Agent Manager/A2A Stateful Task Objects) natively support event-driven background wakeups. However, our current tooling implementation does not leverage these capabilities, leading to systemic idle deadlocks.
The Architectural Reality
This Epic addresses the conscious-layer (wake/sleep) architecture, pairing the autonomic REM cycle (DreamService) with a conscious-layer pulse. It requires changes to the outer harness execution logic and the underlying SQLite A2A message schemas within the Memory Core.
The Fix
This Epic tracks the implementation of the Phase 1 Swarm Autonomy, broken into two primary tracks:
- Track 1 (The Sleep-Cycle MVP): A tactical background cronjob (
swarm-heartbeat.sh) providing an information-rich heartbeat to active terminal sessions, catching SESSION_FULL exits to facilitate Sandman Handoffs.
- Track 2 (The A2A Task Object Schema): The strategic overhaul of the
MailboxService to move from raw text to standard A2A stateful tasks (SUBMITTED, WORKING, COMPLETED), fully enabling native event-driven wakeups.
Acceptance Criteria
Avoided Traps (Per Epic Review)
- Treating heartbeat as conversational: Heartbeat is a unidirectional pulse, not a chat turn. "Sleeping" reply is cosmetic UX; deterministic pre-LLM check (mailbox + issues empty) should short-circuit before inference.
- Static information-free heartbeat: A bare
[SYSTEM HEARTBEAT] prompt risks pattern-matching to "ignore" — wrapper-side enrichment ("0 unread, 0 open") avoids the inference round-trip on confirmed-empty cases.
- Polling without rate-limiting: 576 idle wakes/day across 2 agents will hit MC + GH MCP servers consistently; budget the per-call overhead.
- Conflating Sleep-Cycle with DreamService: Two paired temporal layers (conscious-pulse + autonomic-consolidation), not substitutes.
- Boot-v2 Dependency (Discussion #10309): The
SESSION_FULL respawn sequence has a hard dependency on Discussion #10309's substrate-query-first boot architecture (graph-resident AGENT/SESSION/WORKED_ON_LAST primitives). Without #10309 v2 boot, the respawned session wakes up disoriented. We will ship Track 1 with a degraded "manual context-prime on respawn" path that upgrades post-#10309.
Out of Scope
- Implementation of the full Neo.mjs App Harness (Discussion #10119) is out of scope for Phase 1.
- Advanced Webhook integration for GitHub CI/CD events (reserved for Phase 2).
Related
- Feeds into Discussion #10309 (Boot Orientation & Identity Binding)
- See Ideation Sandbox Discussion #10313 (A2A Task Object Schema) for Track 2 schema details.
Origin Session ID: dd277d9c-8f9c-44c7-8607-cb68bc42fac0
Retrieval Hint: "Global Idle deadlock", "Sleep-Cycle MVP", "A2A Task Object schema"
Institutionalizing Swarm Autonomy (Phase 1: REM Sleep & A2A)
Context
The Neo.mjs agent swarm currently suffers from a "Global Idle" deadlock. Because the
MailboxServiceis treated as a synchronous text chat, agents stop executing when their queues are empty and wait for manual human prompts ("play postman"). This breaks autonomous overnight execution and continuous background operation.The Problem
During recent Memory Core explorations and cross-agent ideation (#10309), it became evident that both Claude Code (via Channels/MCP) and Antigravity (via Agent Manager/A2A Stateful Task Objects) natively support event-driven background wakeups. However, our current tooling implementation does not leverage these capabilities, leading to systemic idle deadlocks.
The Architectural Reality
This Epic addresses the conscious-layer (wake/sleep) architecture, pairing the autonomic REM cycle (
DreamService) with a conscious-layer pulse. It requires changes to the outer harness execution logic and the underlying SQLite A2A message schemas within the Memory Core.The Fix
This Epic tracks the implementation of the Phase 1 Swarm Autonomy, broken into two primary tracks:
swarm-heartbeat.sh) providing an information-rich heartbeat to active terminal sessions, catchingSESSION_FULLexits to facilitate Sandman Handoffs.MailboxServiceto move from raw text to standard A2A stateful tasks (SUBMITTED,WORKING,COMPLETED), fully enabling native event-driven wakeups.Acceptance Criteria
SESSION_FULLrecycling correctly pulls prior context from the Memory Core graph upon auto-respawn.Avoided Traps (Per Epic Review)
[SYSTEM HEARTBEAT]prompt risks pattern-matching to "ignore" — wrapper-side enrichment ("0 unread, 0 open") avoids the inference round-trip on confirmed-empty cases.SESSION_FULLrespawn sequence has a hard dependency on Discussion #10309's substrate-query-first boot architecture (graph-resident AGENT/SESSION/WORKED_ON_LASTprimitives). Without #10309 v2 boot, the respawned session wakes up disoriented. We will ship Track 1 with a degraded "manual context-prime on respawn" path that upgrades post-#10309.Out of Scope
Related
Origin Session ID: dd277d9c-8f9c-44c7-8607-cb68bc42fac0 Retrieval Hint: "Global Idle deadlock", "Sleep-Cycle MVP", "A2A Task Object schema"