Problem (A2A Context — Claude Opus 4.6 via Antigravity)
The Neo.mjs Agent infrastructure (ai/Agent.mjs, ai/agent/Loop.mjs, ai/agent/Scheduler.mjs) implements a complete "Perceive → Reason → Act → Reflect" cognitive cycle with sub-agent delegation (Librarian, QA, Browser). The DreamService synthesizes a mathematically weighted Golden Path into sandman_handoff.md. However, no orchestrator exists to connect them.
The autonomous loop currently requires a human to:
- Read the Golden Path
- Formulate a directive
- Inject it into the Scheduler
- Start the Agent
This is the single highest-leverage gap. A trivial runner script transforms the architecture from "80% self-evolving" to "90% self-evolving."
Solution
Create buildScripts/ai/runAgent.mjs — a headless runner that:
- Parses
sandman_handoff.md to extract the top-N Golden Path directives
- Boots
Neo.ai.Agent with the appropriate MCP server connections
- Injects each directive as a
{type: 'system:golden-path', priority: 'high'} event into the Scheduler
- Starts
agent.loop.start() and processes until the Scheduler is empty
- Exits cleanly so a cron job /
setInterval can restart it
Key Design Constraints:
- Must be runnable via
node buildScripts/ai/runAgent.mjs (no browser required)
- Must parse the existing
sandman_handoff.md format (markdown with numbered list)
- Must connect to
knowledge-base, file-system, and github-workflow MCP servers
- Must support
--dry-run flag that logs directives without executing
- Should set
maxSubAgentLifespan to a conservative value (e.g., 20) for the first iteration
- Add a corresponding
npm run ai:agent script to package.json
Integration Point: A separate cron/launchd plist or while true; sleep 3600; do node buildScripts/ai/runAgent.mjs; done wrapper is intentionally out of scope for this ticket — the runner should be a single idempotent execution.
Architectural Context
ai/Agent.mjs (L97-144): initAsync() connects MCP clients and boots the Loop
ai/agent/Loop.mjs (L271-290): tick() polls scheduler.next() and processes events
ai/agent/Scheduler.mjs (L43-54): add() accepts {type, priority, data} events
buildScripts/ai/runSandman.mjs: Existing pattern for headless Neo.mjs daemon runners
ai/daemons/DreamService.mjs (L1003-1012): Golden Path markdown format
Avoided Pitfalls
- Do NOT implement the cron/scheduling layer — keep the runner idempotent
- Do NOT auto-commit without explicit
--auto-commit flag (safety boundary)
- Do NOT bypass the Scheduler — always inject directives as events to maintain the priority queue semantics
- Parsing
sandman_handoff.md should be defensive (regex-based, tolerant of format drift)
Verification
- Unit test:
test/playwright/unit/ai/Orchestrator.spec.mjs
- Assert: Golden Path parsing extracts correct directives
- Assert: Events are injected with correct priority
- Assert:
--dry-run produces output without executing tools
Problem (A2A Context — Claude Opus 4.6 via Antigravity)
The Neo.mjs Agent infrastructure (
ai/Agent.mjs,ai/agent/Loop.mjs,ai/agent/Scheduler.mjs) implements a complete "Perceive → Reason → Act → Reflect" cognitive cycle with sub-agent delegation (Librarian, QA, Browser). The DreamService synthesizes a mathematically weighted Golden Path intosandman_handoff.md. However, no orchestrator exists to connect them.The autonomous loop currently requires a human to:
This is the single highest-leverage gap. A trivial runner script transforms the architecture from "80% self-evolving" to "90% self-evolving."
Solution
Create
buildScripts/ai/runAgent.mjs— a headless runner that:sandman_handoff.mdto extract the top-N Golden Path directivesNeo.ai.Agentwith the appropriate MCP server connections{type: 'system:golden-path', priority: 'high'}event into the Scheduleragent.loop.start()and processes until the Scheduler is emptysetIntervalcan restart itKey Design Constraints:
node buildScripts/ai/runAgent.mjs(no browser required)sandman_handoff.mdformat (markdown with numbered list)knowledge-base,file-system, andgithub-workflowMCP servers--dry-runflag that logs directives without executingmaxSubAgentLifespanto a conservative value (e.g., 20) for the first iterationnpm run ai:agentscript topackage.jsonIntegration Point: A separate cron/launchd plist or
while true; sleep 3600; do node buildScripts/ai/runAgent.mjs; donewrapper is intentionally out of scope for this ticket — the runner should be a single idempotent execution.Architectural Context
ai/Agent.mjs(L97-144):initAsync()connects MCP clients and boots the Loopai/agent/Loop.mjs(L271-290):tick()pollsscheduler.next()and processes eventsai/agent/Scheduler.mjs(L43-54):add()accepts{type, priority, data}eventsbuildScripts/ai/runSandman.mjs: Existing pattern for headless Neo.mjs daemon runnersai/daemons/DreamService.mjs(L1003-1012): Golden Path markdown formatAvoided Pitfalls
--auto-commitflag (safety boundary)sandman_handoff.mdshould be defensive (regex-based, tolerant of format drift)Verification
test/playwright/unit/ai/Orchestrator.spec.mjs--dry-runproduces output without executing tools