Skip to content

Architecture

dj edited this page Mar 1, 2026 · 2 revisions

Architecture

System Overview

┌─────────────────────────────────────────────────────────┐
│                    CLI (commander.js)                    │
│         12 commands: gateway, agent, onboard, ...       │
├─────────────────────────────────────────────────────────┤
│                   Gateway (Express + WS)                │
│      HTTP API  |  WebSocket  |  Mission Control UI      │
├──────────┬──────────┬───────────┬───────────────────────┤
│ Channels │  Agent   │  Skills   │       Memory          │
│ 9 adapters│ Router  │ 49+ tools │  Graph (entities)     │
│ Discord  │ Multi-   │ Shell     │  Learning (patterns)  │
│ Telegram │ Agent    │ Browser   │  Briefings (daily)    │
│ Slack    │ Planner  │ GitHub    │  Relationships        │
│ WhatsApp │ Autonomy │ Email     │                       │
│ Matrix   │ Cost Opt │ Cron      │                       │
│ Signal   │ Context  │ ...       │                       │
│ Teams    │ Sessions │           │                       │
├──────────┴──────────┼───────────┼───────────────────────┤
│      Providers      │  Security │     Mesh Network      │
│  14 LLM providers   │  Shield   │  mDNS + Tailscale     │
│  66+ models         │  Sandbox  │  WebSocket transport   │
│  Auth rotation      │  Encrypt  │  Cross-node routing   │
└─────────────────────┴───────────┴───────────────────────┘

Directory Structure

src/
├── agent/       # Core agent: processing, multi-agent, autonomy, planning
├── channels/    # 9 messaging adapters (Discord, Telegram, Slack, WhatsApp, etc.)
├── providers/   # 14 LLM providers (Anthropic, OpenAI, Google, Ollama, +10 compat)
├── skills/      # 49+ tool/skill implementations
├── memory/      # Graph memory, learning, briefings, relationships
├── security/    # Prompt shield, sandbox, encryption, pairing
├── gateway/     # HTTP/WS server, dashboard, slash commands
├── mesh/        # Peer-to-peer networking (mDNS, Tailscale, WebSocket)
├── recipes/     # Multi-step workflow recipes
├── mcp/         # Model Context Protocol client
├── config/      # Zod schema, config loading
├── cli/         # 12 CLI commands
└── utils/       # Constants, helpers, logger, updater

Data Flow

  1. Inbound Message arrives via any channel adapter
  2. Slash Command Check — native commands or recipe commands
  3. Multi-Agent Router selects the appropriate agent
  4. Agent Processing — builds context, calls LLM, executes tools
  5. Tool Execution — autonomy check, sandbox, execute, return result
  6. Response — sent back through the originating channel
  7. Memory — conversation stored, graph updated, patterns learned

Key Design Decisions

  • Zero native dependencies — All optional deps in optionalDependencies
  • Dynamic imports — Optional features use await import() to avoid crash-on-missing
  • JSON file storage — No database server required
  • Event-driven channels — All channels extend ChannelAdapter and emit events
  • Provider normalization — Unified interface with automatic routing

Clone this wiki locally