Architecture Overview

A comprehensive visual guide to the Mini's World AI agent platform — systems, data flows, security layers, and every API endpoint.

15
AI Agents
62
Tools
195+
Endpoints
37
Route Files
9/10
Security Score

System Overview

Three-tier architecture: Browser client, Express server, and external service integrations connected via HTTP, WebSocket, SSE, and webhooks.

BROWSER SERVER EXTERNAL SERVICES main.js Bootstrap UI Components 70 files Stores 26 files RealtimeClient WebSocket Audio System Capture + Player CredentialVault AES-256-GCM HTTP SSE WSS Express Server 37 routes · 195+ endpoints AI Module gpt-4.1 · DALL-E · Embeddings Tool System 60+ tools: local + API + MCP Workflow Engine State Machine + Orchestrator Storage Per-user JSON · JSONL WS Relay Session Manager Memory / RAG Embeddings + Cosine Trigger System Event Polling + Matching Schedule System Cron-like Engine Agent Registry 18 Agents + Prompts Auth / Security JWT · HMAC · CSRF ✦ Avatar System Monitor · Research · Briefing · Claude Eval System LLM-as-Judge · 8 Dimensions Workstation Router Policy · Cap Tokens · Audit · Injection Filter Travel + Events Watch Scanners · Deal Detectors 🖥 Mini Workstations — Local Compute Fleet Mac mini agent (Ed25519 WSS) · iMessage · WhatsApp Personal · Browser · Computer Use · Shell default-deny policy · per-contact ACL · hash-chained audit log · kill switch OpenAI Chat · RT · DALL-E · Embed Anthropic Claude (Avatar) Twilio Calls + SMS Recall.ai Meeting Bot MS Teams Bot Framework PostHog Analytics HeyGen Avatar Video Google OAuth Gmail · Calendar Microsoft OAuth Outlook · Calendar Plaid Banking · Tx Duffel Flights Alpaca Stocks + Crypto Stripe Payments Cloudinary Image CDN SeatGeek Event listings Ticketmaster Discovery API Bandsintown Tour stops LinkedIn Slack GitHub HubSpot Notion Shopify Apollo.io Salesforce Mailchimp Facebook / IG + 30 MCP servers HTTP SSE WSS Webhook

Workflow State Machine

Workflows progress through a deterministic state machine with revision caps, timeout gates, and human review checkpoints.

PENDING RUNNING AWAITING_REVISION max 2 revisions AWAITING_HUMAN APPROVED EXECUTING COMPLETED CANCELLED FAILED CLOSED rejected reject

Tool System

Three-tier tool routing: mcpClient.js dispatches to local executors first, then API tools with per-user credentials, then MCP servers.

mcpClient.js — Tool Router

Local Executors 15

image_generate
whatsapp
alpaca_trading
alpaca_crypto
web_search
document_create
audio_call
appointment_scheduler
website_build
twilio_calls
minisign
vision_browse
youtube_upload
meeting_bot
create_workflow

API Tools 13

gmail
smtp_email
linkedin_post
linkedin_page_post
heygen
facebook_instagram
youtube_publish
lead_generation
stripe
shopify
gorgias
azure_devops
mailchimp
google_calendar

MCP Servers 34

slack
twitter
discord
twilio_sms
calendly
hubspot
apollo
salesforce
airtable
brave_search
puppeteer
youtube_data
reddit
google_search_console
figma
wordpress
canva
notion
google_sheets
zapier
composio
github
+ 12 more

Memory & RAG Pipeline

User messages are embedded into 1536-dimensional vectors, searched by cosine similarity, and injected into the system prompt with layered context.

User Message natural language embed() OpenAI API float[1536] embedding vector Cosine Search threshold 0.4 Top 5 memories System Prompt injection System Prompt Layers 1. Agent Personality role + voice + style 2. Company Context name + industry + goals 3. Training Data custom instructions 4. Knowledge Docs domain .md files 5. Contact List CRM contacts 6. Memory RAG results 7. Tool Definitions JSON schemas All layers combined into a single system message sent with every API call

Trigger & Schedule Flow

Event sources feed into the trigger matching system, which auto-creates workflows and dispatches output actions.

EVENT SOURCES Email Phone Call Message Form Submit Payment Webhook Schedule (Cron) Trigger Matching eventListener.js once | continuous Workflow Creation workflowEngine.js state machine executor OUTPUT ACTIONS Send Email Send SMS Slack Message Phone Call LinkedIn Post Execute Trade Generate Image Create Document Schedule Meeting Update CRM Build Website

Security Architecture

Concentric defense layers from infrastructure hardening through authentication to encrypted data and AI safety nets.

INFRASTRUCTURE Helmet HSTS CSP Nonce CORS Rate Limit 10/min session limit AUTHENTICATION HMAC-SHA256 JWT CSRF double-submit OAuth2 PKCE httpOnly+Secure SameSite cookies DATA PROTECTION AES-256-GCM scrypt KDF per-user isolation per-company isolation encrypted credentials AI SAFETY injection detect arg validation cost breaker $2/hr

Chat Data Flow

Complete sequence from user input through embedding, memory search, prompt building, tool execution loop, and SSE streaming response.

Browser Server OpenAI Memory Tools POST /api/chat/send SSE: thinking embed(message) → float[1536] cosine search → top 5 memories build gpt-4.1 chat completion tool_calls: [{name, args}] SSE: tool_start mcpClient.execute(tool, args) result JSON SSE: tool_done continue with tool results final text response SSE: responding + done LOOP max 10 save to JSONL

Agent Roster

15 specialized AI agents, each with unique personality, knowledge base, voice configuration, and tool assignments.

API Reference

All 195+ REST endpoints organized by domain. Use the search box to filter by method, path, or description.

MethodPathAuthDescription

Environment Variables

All configuration options grouped by service. Click a group to expand.

Data Storage Map

Per-user file-based persistence. All data isolated under users/<userId>/.

data/
  users/
    <userId>/
      workflows.json — all workflows for this user
      memories.json — agent memories + embeddings
      tool-assignments.json — per-company per-Mini tool config
      triggers.json — event-based triggers
      schedules.json — cron-like schedules
      companies.json — company metadata
      contacts.json — CRM contacts
      trading-settings.json — Alpaca credentials + risk rules
      websites.json — hosted website configs
      campaigns.json — marketing campaigns
      feedback.json — user feedback entries
      chat-history/
        <companyId>_<agentId>.jsonl — append-only chat logs
      images/
        *.png — DALL-E generated images
      documents/
        *.html — generated documents
      studio/
        *.json — studio project files