LearnNewsExamplesServices
Frontmatter
titledocs: add Swarm Intelligence & Autonomous Sub-Agents guide (#9983)
authortobiu
stateMerged
createdAtApr 13, 2026, 8:27 PM
updatedAtApr 13, 2026, 8:31 PM
closedAtApr 13, 2026, 8:31 PM
mergedAtApr 13, 2026, 8:31 PM
branchesdevagent/9983-swarm-intelligence-guide
urlhttps://github.com/neomjs/neo/pull/9984
Merged
tobiu
tobiu commented on Apr 13, 2026, 8:27 PM

Summary

Adds a new guide learn/agentos/SwarmIntelligence.md documenting the autonomous narrow sub-agent architecture built on Neo.ai.Agent.

What This Guide Covers

  1. The Delegation Model — How Agent.delegate() boots sub-agents with their own cognitive loops
  2. Three Profiles — Librarian (research), QA Bot (local test generation), Browser (visual inspection)
  3. Capability Gating — Server-level isolation + SDK Zod validation boundary
  4. Cost Control — Local vs cloud inference tiering (QA on Gemma = zero marginal cost)
  5. Context Window ManagementmaxSubAgentLifespan recycling to prevent hallucination drift
  6. The delegate_task Native Tool — How the LLM autonomously decides when to delegate
  7. Event Scheduler — Priority queue (critical > high > normal > low) for event processing
  8. Orchestrator Pipeline — Golden Path parsing from sandman_handoff.md
  9. Adding New Profiles — Step-by-step guide for extending the swarm

Includes 4 Mermaid diagrams.

Files Changed

  • [NEW] learn/agentos/SwarmIntelligence.md — The guide
  • [MODIFY] learn/tree.json — Registered after Strategic Workflows in Agent OS section
  • [MODIFY] learn/benefits/ArchitectureOverview.md — Added cross-link in Next Steps

Architectural Impact

Closes the GUIDE_GAP for the swarm intelligence layer. The Architecture Overview (#9981) treats the Agent OS as a monolithic cognitive loop — this guide decomposes it into the delegation hierarchy that actually exists in the codebase.

Resolves #9983

tobiu
tobiu commented on Apr 13, 2026, 8:30 PM

Input from Claude Opus 4.6 (Antigravity):

❋ # PR Review Summary

Status: Approved

This guide fills the most significant documentation gap identified during the Architecture Overview session (#9981). The existing guides treat the Agent OS as a monolithic loop — this PR decomposes it into the delegation hierarchy that actually exists in ai/Agent.mjs. The cross-reference in CodebaseOverview.md ensures fresh agent sessions won't be blindsided by the swarm layer (as I was earlier today).


📊 Evaluation Metrics

  • [ARCH_ALIGNMENT]: 95 - Accurately reflects the source: delegate() lifecycle matches Agent.mjs:195-241, profile configs match all three profile files, Scheduler priority heuristics match Scheduler.mjs:83-88, Orchestrator Golden Path regex matches Orchestrator.mjs:49.
  • [CONTENT_COMPLETENESS]: 93 - Covers 9 distinct concepts across 370 lines with 4 Mermaid diagrams, code examples, structural inventory, and a "how to add new profiles" section. Cross-references added to both Architecture Overview and CodebaseOverview.
  • [EXECUTION_QUALITY]: 92 - All Mermaid diagrams use ASCII-safe labels and avoid the graph reserved keyword issue. Relative paths verified (../benefits/, ./ for siblings). No broken links.
  • [PRODUCTIVITY]: 100 - All acceptance criteria from #9983 addressed: delegation model, three profiles, capability gating, cost control, context management, and tree.json registration.
  • [IMPACT]: 75 - Closes a GUIDE_GAP for a core architectural layer. Higher impact than the Architecture Overview because this documents the safety mechanisms (server isolation + Zod) that prevent destructive agent behavior.
  • [COMPLEXITY]: 35 - Documentation-only PR with 4 files touched. Source code was read but not modified.
  • [EFFORT_PROFILE]: Quick Win - High ROI for documentation discoverability with low implementation complexity.

🕸️ Context & Graph Linking

  • Target Issue: Resolves #9983
  • Related Graph Nodes: Neo.ai.Agent, Neo.ai.agent.Loop, Neo.ai.agent.Orchestrator, Neo.ai.agent.Scheduler, Neo.ai.agent.profile.Librarian, Neo.ai.agent.profile.QA, Neo.ai.agent.profile.Browser, Neo.ai.services
  • Parent: #9981 (Architecture Overview — this guide decomposes its "Right Hemisphere" section)
  • Origin Session: 70334eab-72c9-44a6-8f48-0b6a96604f49

🧠 Graph Ingestion Notes

  • [KB_GAP]: N/A — this PR closes a major KB gap.
  • [TOOLING_GAP]: None encountered during this PR.
  • [RETROSPECTIVE]: The user's challenge to add a CodebaseOverview.md cross-reference was the most architecturally valuable insight. Without it, agents read CodebaseOverview during startup and see the "two hemispheres" but have zero awareness that the Agent OS delegates to narrow sub-agents. This session proved the gap empirically — I (the agent) had to be told about the profiles. The cross-reference closes the feedback loop: agent reads CodebaseOverview → discovers delegation model exists → queries knowledge base for details → operates with full architectural awareness.

📋 Required Actions

None — all polish was addressed pre-PR.

  • Guide created at learn/agentos/SwarmIntelligence.md
  • Registered in tree.json after Strategic Workflows
  • Cross-link added to Architecture Overview Next Steps
  • Cross-link added to CodebaseOverview (startup discovery path)

LGTM — ready to merge.