AIO Communication Bus Architecture & HTTP API

Zero-dependency local session bus enabling different AI coders (Antigravity, Claude Code, Codex, Gemini CLI, and custom agents) to self-onboard via /guide, exchange scoped briefs, enforce deterministic wakeups, and collaborate on the same goal without storing message bodies on disk.

AIO includes a built-in, stdlib-only local session coordination bus (aioptimizer/bus.py + aioptimizer/bus_guide.py) wired directly into aioptimizer serve (and standalone via aioptimizer bus serve). It replaces the legacy v1 ClaudeProxy bus_gateway wire-compatibly while adding self-guiding onboarding for any session connecting for the first time.

Companion copy-paste prompts:


1. Self-Guiding First-Time Onboarding

A brand-new AI session simply told "set up yourself as master on port 14786" (or "as slave <name> on port 14786", default 14786 via service.bus_port, adjacent to gateway 14787 so it avoids colliding with legacy v1 13119) does not need prior docs or a local repo checkout to connect cleanly:

  1. Discover from GET /: Returns guide, guide_json, helper, setup (universal, master, slave), prompts (universal, master, slave, worker, brain), endpoints, and a hint naming the live endpoints for the running port.
  2. Read the Onboarding Guide (GET /guide, /setup, /help, /onboarding):
  1. Download Standalone Client (GET /helper/bus_helper.py or GET /bus_helper.py):
  1. Pull Role-Specific or Universal Prompts (GET /prompt/master, GET /prompt/slave, GET /prompt/universal, GET /setup/master, GET /setup/slave, GET /prompt/worker, GET /prompt/brain):
  1. First Registration Onboarding (POST /register):
  1. 400/404 Helpful Errors: Invalid parameters or unknown routes include "guide": "http://<host>:<port>/guide" alongside "error".

2. Automatic Watching & Deterministic Stop Hook

The standalone CLI (scripts/bus_helper.py, installed into ~/.session_bus/bus_helper.py) solves missed wakeups, duplicate watcher loops, and historical inbox replays:

  1. One-Time Machine Setup:
   aioptimizer bus install-hook
   # OR directly from the bus helper:
   python ~/.session_bus/bus_helper.py install-hook

This exports bus_helper.py into ~/.session_bus/ and installs:

   "hooks": {
     "Stop": [{"hooks": [{"type": "command", "command": "python \"<HOME>/.session_bus/bus_helper.py\" check-watch --auto --quiet"}]}]
   }
  1. PID-Bound Automatic Enforcement (--auto):
  1. Replay-Safe First-Run Initialization (init):
  1. One-Shot Background Watcher + Self-Superseding Lock (watch):
  1. CRITICAL WAKEUP RULE:
  1. Clean Shutdown (stop-watch):

3. CLI & GUI Surfaces

CLI (aioptimizer bus ...)

Gateway Integration (aioptimizer serve) & Web GUI


4. HTTP API & Security Invariants

EndpointMethodPurposeNotes
/GETDiscovery + onboarding linksLive guide, helper, setup, prompts, endpoints
/healthGETReadiness probeReturns ok, service, phase, provider, ts
/guide, /setup, /help, /onboardingGETDual-role Master/Slave setup guideMarkdown by default; ?format=json or Accept: application/json for JSON
/helper/bus_helper.py, /bus_helper.pyGETStandalone bus_helper.py downloadtext/x-python; charset=utf-8
/prompt, /prompt/universalGETUniversal dual-role promptBoth Master & Slave setup sections (text/markdown)
/prompt/master, /setup/master, /prompt/brainGETMaster (Controller/Brain) promptSelf-contained setup + watch protocol (text/markdown)
/prompt/slave, /setup/slave, /prompt/workerGETSlave (Worker/Hands) promptSelf-contained setup + Stop-hook watch protocol (text/markdown)
/peersGETLive local + remote peersRegistration TTL 180s
/registerPOSTRegister / heartbeat peerReturns onboarding on first_registration: true
/inboxGETPoll peer inboxQuery ?name=&machine_id=&since= (in-memory only)
/sendPOSTDeliver local or queue remoteSame machine_id -> local inbox; different -> /outbox (1h TTL); max 358,400 bytes
/outboxGETRelay outbound queue pollQuery ?since=
/inbox/notifyPOSTRelay inbound delivery hookPhase 0 (queued-no-fetch) or Phase 1 deduped delivery
/peers/remotePOSTRelay remote presence updateReplaces cached remote peer table

Non-negotiable guards:


Want a live walkthrough or evaluation setup for Artificial Intelligence Optimizer (AIO)? Message George Vranjesevic or reach out at george@developmentsnapshot.com.