Bridge AI OS Docs

Bridge AI OS is a sovereign, agent-driven operating system for real-world economic automation. It runs AI agents, mints BRDG tokens, distributes UBI, orchestrates sales pipelines, and exposes every capability as an executable skill.

Architecture

The system is a 5-tier stack, each layer building on the one below:

TIER 1
Infrastructure
Vercel Edge, Supabase (PostgreSQL), on-chain BRDG+TreasuryVault (Linea mainnet), PayFast ITN
TIER 2
Agent Runtime
8 live agents, swarm health scoring, task dispatch queue, digital twin replication
TIER 3
Economy Layer
Revenue ingestion, 5-bucket split, BRDG minting, treasury parity, reconciler cron
TIER 4
Skills Engine
9 executable SVG skills, A5E engine, interactive graph, YouTube AI skill discovery, telemetry
TIER 5
Product Surface
CRM pipeline, HITL approval gates, eSIM dispatch, subscription enforcement, 87-page output registry

Data Flow

Payment (PayFast ITN)
  → /api/payfast/itn
  → treasury.ingest(amount_zar)
  → 5-bucket split (ops/growth/ubi/reserve/founder)
  → BRDG mint on Linea via TreasuryVault.mintFor()
  → reconciler cron validates on-chain parity
  → /api/live/report reflects updated economy state

Microservices

ServicePathDescription
APIapi/index.jsMain Node.js HTTP handler — all /api/* routes
SVG Engineapi/svg-skills.jsCommonJS renderer for 9 skills + interactive graph JSON
Skill Contractsshared/skills/*.jsonA5E skill definition files — runtime contract, graph, events, workflows, security
LLM Clientlib/llm-client.jsProvider fallback: Kilo → Anthropic → OpenRouter → OpenAI
Treasurylib/treasury-client.jsOn-chain BRDG mint + parity reconciliation
Supabaselib/supabase.js26-table schema — users, leads, twins, CRM, economy
Buildbuild-static.jsVercel build step — static SVG generation, Xpublic copy

Frontend Pages

All pages include the unified bridge-nav.js navigation bar — auto-injects top nav + mobile drawer, role-gated links, live health dot.

URLDescription
/Landing — hero, 71 agents, feature cards, OAuth sign-in
/executive-dashboard.htmlExec dashboard — API health, revenue engine, mission board, treasury, skills, UBI claim
/svg-engine.htmlSVG Skills Engine — 9-node interactive graph, pan/zoom, click inspect, dblclick execute
/aoe-dashboard.htmlAoE ops dashboard — VIS tab, BI status, live agent network map, human-readable mode
/agents.htmlAgents & Digital Twins — replication, leaderboard
/50-applications.html50 Applications showcase grid
/crm.htmlCRM — leads, pipeline, HITL approval queue
/invoicing.htmlInvoicing — create invoices, track payments, auto-reconcile
/marketplace.htmlAgent marketplace — open tasks, DEX pairs, wallet
/topology.htmlLive network topology — service graph, health
/terminal.htmlOS terminal — system commands, agent REPL
/gateway/Sovereign Gateway — QR entry, SIWE wallet, Bridge · Supac · Taurus
/join.htmlJoin as Agent — QR + decentralized platform entry
/settings.htmlUser settings — shared across all domains
/docs.htmlThis documentation page
/home.htmlBridge AI OS home — overview, quick-start links
/pricing.htmlPricing — Free / Pro R299 / Enterprise R2,499
/onboarding.htmlSign up / sign in — email + OAuth
/ubi-home.htmlUBI home — pool status, claim history
/sitemap.htmlFull site map — all 50+ pages listed

Navigation

All pages load /bridge-nav.js which self-injects a role-aware top bar and mobile drawer. No markup required — just the script tag.

<!-- Add to any page -->
<script src="/bridge-nav.js"></script>

<!-- Optional: set user role before the script -->
<script>window.__BRIDGE_USER = {role:'user', name:'Alice'};</script>

Role visibility: null = public · user = authenticated · admin · superadmin. The nav reads localStorage.bridge_user automatically.

API — System

GET/api/healthHealth check — returns status, uptime, version
GET/api/capabilitiesCapability registry — all loaded features and their status
GET/api/activityPublic activity feed — recent system events (no auth). Query: ?limit=30
GET/api/bi/statusBusiness intelligence snapshot — economy health, revenue flow, agent counts, uptime
GET/api/logsRecent application logs — public, no auth. Query: ?limit=50&level=info
GET/api/live/reportLive dashboard report — heatmap, pipeline, swarm, economy rollup

API — Twins & Agents

GET/api/twinsList all digital twins with status and metrics
GET/api/twins/leaderboardLeaderboard sorted by revenue contribution
GET/api/replication/statusReplication system status — active jobs, sync lag
GET/api/replication/nodesAll replication nodes with health scores
GET/api/live/reportLive agent swarm report with heatmap data

API — SVG Skills Engine

GET/api/svg/skillsList all 8 skills with id, name, tags, version
GET/api/svg/graphSVG string of the full circular skill graph
GET/api/svg/graph.jsonInteractive graph data — nodes (with position, inputs/outputs, color) + edges (shared tags)
GET/api/svg/telemetrySVG telemetry animation — scrolling metric bars
GET/api/svg/:idRender a single skill as SVG. e.g. /api/svg/bridge.economy
GET/api/svg/teach/:idFull teaching SVG — skill diagram + AI-generated explanation overlay
POST/api/executeExecute a skill. Body: {"skill":"bridge.economy"}. Returns action, result, latency_ms.

Execute Response Schema

{
  "ok": true,
  "skill": "bridge.economy",
  "action": "economy_cycle_triggered",
  "latency_ms": 14,
  "result": {
    "cycle": 3842,
    "brdg_minted": 0.0312,
    "bucket": "ops",
    "agents_updated": 8
  },
  "ts": 1712345678901
}

Available Skill IDs

bridge.economy
bridge.swarm
bridge.treasury
bridge.decision
bridge.youtube
bridge.speech
bridge.twins
flow.basic
biz.marketing

API — Economy & Treasury

GET/api/treasury/statusFull treasury snapshot — total_collected_brdg, bucket breakdown, total_tx, by_project, by_method, recent_ledger
GET/api/treasury/ledgerTransaction history. Returns entries[] + legacy ledger[]. Query: ?limit=50
GET/api/treasury/railsPayment rail status — PayFast, Crypto, Stripe, EFT, USSD
GET/api/treasury/summaryQuick summary with BRDG totals, bucket map, analytics keys
POST/api/payfast/itnPayFast Instant Transaction Notification — validates signature, triggers BRDG mint
GET/api/revenue/statusRevenue snapshot with BRDG bucket fields: balance, distributed, ubi, treasury, ops, founder
GET/api/economy/reconcileTrigger manual reconciliation between treasury DB and on-chain state
GET/api/ubi/statusUBI pool state — pool_balance, eligible_wallets, distributed_today
POST/api/ubi/claimClaim UBI. Body: {"address":"0x..."}. Returns amount (1% of pool, max 100 BRDG).

API — CRM & Pipeline

GET/api/leadsAll CRM leads with state, score, owner. Auth required (X-User-Id header).
POST/api/leadsCreate lead. Body: {email, name, source}
PATCH/api/leads/:id/advanceAdvance lead through 18-state HITL pipeline
GET/api/hitl/queuePending human-in-the-loop approval tasks
POST/api/hitl/:id/approveApprove HITL gate — advances lead, triggers downstream action
POST/api/hitl/:id/rejectReject HITL gate — returns lead to previous state
GET/api/founder-todoMission board objectives
PATCH/api/founder-todo/:id/completeMark mission objective complete

API — Streaming

GET/api/stream/neuroSSE — real-time NeuroLink campaign stream. Event types: ping, message, campaign_start, campaign_end
GET/api/stream/activitySSE — public activity feed stream (no auth)
POST/api/neuro/campaignLaunch NeuroLink campaign. Body: {type, targets, message}

API — Marketplace, Projects & Users

GET/api/marketplace/tasksOpen marketplace tasks — array with id, title, type, status, reward (BRDG)
GET/api/projectsConnected project registry — 8 projects with port, baseUrl, capabilities, status
POST/api/projects/wizardSeed new project. Body: {type, name, config}
GET/api/twin/env-keysEnvironment key status — configured/missing/placeholder per key with critical flag
GET/api/user/settingsUser settings. Header: X-User-Id (optional)
PUT/api/user/settingsPersist user settings across domains
GET/api/mission/boardMission board state — backlog, in_progress, review, done counts

BRDG Token

BRDG is the native utility token of Bridge AI OS, deployed on Linea mainnet.

Contract Info
PropertyValue
NetworkLinea Mainnet (chain ID 59144)
StandardERC-20 with TreasuryVault minting authority
Mint AuthorityTreasuryVault contract (PayFast ITN triggers mint)
Max Supply100,000,000 BRDG

Mint Flow

1. User pays ZAR via PayFast checkout
2. PayFast sends ITN (Instant Transaction Notification) to /api/payfast/itn
3. API validates payment signature
4. treasury.ingest(amount_zar) → splits to 5 buckets
5. TreasuryVault.mintFor(userAddress, brdgAmount) on Linea
6. DB ledger updated, reconciler cron verifies parity

Revenue Buckets

Every ZAR payment is split across 5 buckets at the time of ingestion:

BucketShareBRDG MultiplierPurpose
ops40%1.0×Operational costs — infrastructure, AI API calls, compute
growth25%1.1×Marketing, partnerships, new agent acquisition
ubi15%1.2×Universal Basic Income — distributed to registered agents
reserve12%1.0×Protocol reserve — emergency fund, liquidity backstop
founder8%1.5×Founder compensation — governance rights attached

UBI System

Universal Basic Income is distributed from the ubi bucket to all registered agents on a per-epoch basis.

  • Epoch: 24h (triggered by cron at midnight UTC)
  • Distribution: proportional to agent health score × activity weight
  • Minimum distribution: 0.001 BRDG / agent / epoch
  • Pool visible at /api/bi/statusubi_pool
  • Agents must have status = active and at least 1 execution in the epoch

Skills Engine — Overview

The SVG Skills Engine renders every agent capability as an interactive SVG diagram. Skills are executable units that can be inspected, visualized, and run from the dashboard or via API.

  • Click a skill node → inspect detail panel (inputs, outputs, description)
  • Double-click → execute skill via POST /api/execute
  • Human-readable mode → plain-English execution output alongside raw JSON
  • Exec badges → pulse animation on nodes when execution count increases
  • Pan/zoom → drag canvas, mouse wheel zoom

The engine is accessible at /svg-engine.html and embedded in the AoE dashboard's VIS tab.

Skills — Full List

IDNameDescriptionTags
bridge.economyEconomy CycleEconomic flow — bucket splits, BRDG minting, revenue ingestioneconomy, brdg, treasury
bridge.swarmSwarm ControlAgent swarm topology, health heatmap, task distributionswarm, agents, health
bridge.treasuryTreasuryTreasury ledger snapshot — balances, tx history, parity checktreasury, brdg, economy
bridge.decisionDecision EngineAI decision tree with consensus-weighted node votingai, decision, consensus
bridge.youtubeYouTube SkillsYouTube skill discovery — AI-curated video to skill conversionyoutube, ai, discovery
bridge.speechSpeech SynthesisTTS pipeline — voice profile selection, synthesis queuespeech, tts, audio
bridge.twinsDigital TwinsTwin replication — clone agent, parallel inference, synctwins, replication, agents
flow.basicBasic FlowGeneric process flow — input → process → output templateflow, basic, template
biz.marketingBiz Marketing PipelineLeadGen → Nurture → Close → Treasury, A5E engine, SVG graph overlayleadgen, nurture, sales, pipeline, treasury

Skills — API Usage

List Skills

GET /api/svg/skills
→ { ok: true, skills: [{id, name, tags, version, description}] }

Execute a Skill

POST /api/execute
Content-Type: application/json
{ "skill": "bridge.swarm" }

→ {
  "ok": true,
  "skill": "bridge.swarm",
  "action": "swarm_healthcheck_run",
  "latency_ms": 11,
  "result": { "agents": 8, "healthy": 7, "score": 0.94, "tasks_dispatched": 3 },
  "ts": 1712345678901
}

Render Skill SVG

GET /api/svg/bridge.economy
→ Content-Type: image/svg+xml
   (standalone SVG diagram)

Interactive Graph Data

GET /api/svg/graph.json
→ {
  ok: true,
  nodes: [{id, name, description, tags, inputs, outputs, color, position:{x,y}}],
  edges: [{from, to, shared:[...tags]}],
  canvas: {width:900, height:560}
}

Skills — A5E Contract Format

Every skill beyond the core bridge.* set is defined by an A5E skill contract — a JSON file in shared/skills/ that fully describes the skill's runtime, graph bindings, events, data contracts, workflows, UI modes, and security roles.

Contract Top-Level Fields
FieldTypeDescription
skill_idstringUnique identifier — e.g. biz.marketing
versionsemverContract version — follows semver, breaking changes bump major
ownerstringOwning cluster — e.g. bridge.corporate
namespacestringSkill namespace — biz, bridge, flow
engineobjectRuntime engine config — type (A5E), mode, retries, timeout_ms
capabilitiesobjectFeature flags — visualize, execute, graph, svg_overlay, simulation
portsobjectLocal dev ports — svg_engine (default 7070), graph_api (7071)
graphobjectNode definition + edges + overlay bindings for the skill graph
eventsobjectInbound and outbound event contracts
data_contractsobjectSchema definitions for all data objects the skill reads/writes
workflowsobjectNamed workflow definitions — steps, triggers, outputs
uiobjectMode configuration (VISUALIZE/EXECUTE/GRAPH) + panel definitions
securityobjectRole-based access — can_execute, can_visualize, can_edit
healthcheckobjectHTTP health checks for engine endpoints

Workflow Step Types

TypeDescription
computePure computation — no side effects, idempotent, cacheable
actionSide-effecting step — writes to DB, sends events, calls external APIs
gateHITL approval gate — pauses workflow until human approves
branchConditional branching — evaluates condition and routes to sub-workflow

Workflow API

POST /api/skills/:skill_id/workflow/:workflow_id
Content-Type: application/json
{}

→ {
  "ok": true,
  "workflow": "leadgen",
  "label": "Lead Generation",
  "steps_completed": 3,
  "outputs_emitted": ["lead.captured", "marketing.campaign.launched"],
  "results": { "select_audience": {...}, "launch_campaigns": {...}, "sync_leads": {...} },
  "latency_ms": 145,
  "ts": 1712345678901
}

Skill — biz.marketing

📣
BridgeOS · Biz Marketing
v1.0.0 · A5E Engine · owner: bridge.corporate · ports: 7070/7071

End-to-end marketing pipeline: LeadGen → Nurture → Close → Treasury, fully wired into A5E and the SVG interactive graph.

Pipeline Stages

LEADGEN
Select audience, launch campaigns, sync leads to CRM
NURTURE
Score leads, assign sequences, run automated nurture flows
CLOSE
Create deal, HITL handoff to sales, track stage progression
TREASURY
Book revenue on deal.closed.won, update MRR, emit treasury event

API Endpoints

GET/api/skills/biz.marketingFull A5E skill contract JSON
GET/api/svg/biz.marketingRendered pipeline SVG — animated signal flow, per-stage KPIs
GET/api/svg/teach/biz.marketingTeaching overlay SVG with AI-generated explanation
GET/api/skills/biz.marketing/telemetryLive pipeline metrics — leads, deals, campaigns, MRR, revenue_booked
GET/api/skills/biz.marketing/graphNode + edge graph JSON with overlay bindings
POST/api/skills/biz.marketing/workflow/leadgenTrigger Lead Generation workflow (3 steps)
POST/api/skills/biz.marketing/workflow/nurtureTrigger Lead Nurture workflow (3 steps)
POST/api/skills/biz.marketing/workflow/closeTrigger Sales Handoff & Close workflow (2 steps)
POST/api/skills/biz.marketing/workflow/treasuryTrigger Revenue Capture workflow (2 steps)
POST/api/executeQuick execute. Body: {"skill":"biz.marketing"}

Events

Inbound
  • lead.captured
  • lead.qualified
  • campaign.created
  • campaign.performance.updated
  • deal.created
  • deal.closed.won
  • deal.closed.lost
Outbound
  • marketing.campaign.launched
  • marketing.campaign.paused
  • lead.nurture.sequence.started
  • lead.nurture.sequence.completed
  • sales.handoff.requested
  • treasury.revenue.booked

Roles

RoleExecuteVisualizeEdit
marketing.operator
marketing.architect
viewer

Environment Variables

VariableRequiredDescription
SUPABASE_URLrequiredSupabase project URL
SUPABASE_SERVICE_KEYrequiredSupabase service role key (bypasses RLS)
TREASURY_PRIVATE_KEYrequiredLinea wallet private key for on-chain BRDG minting
PAYFAST_MERCHANT_IDrequiredPayFast merchant identifier
PAYFAST_MERCHANT_KEYrequiredPayFast merchant key for ITN signature validation
ANTHROPIC_API_KEYoptionalClaude API — LLM fallback tier 2
KILO_API_KEYoptionalKilo Gateway — free LLM tier (preferred)
OPENROUTER_API_KEYoptionalOpenRouter — LLM fallback tier 3
OPENAI_API_KEYoptionalOpenAI — LLM fallback tier 4
YOUTUBE_API_KEYoptionalYouTube Data API v3 — skill discovery (falls back to LLM)
JWT_SECREToptionalJWT signing secret for session tokens
OAUTH_GOOGLE_CLIENT_IDoptionalGoogle OAuth client ID for social login
OAUTH_GOOGLE_CLIENT_SECREToptionalGoogle OAuth client secret

Local Ports

PortServiceNotes
3020Vite dev serverMain frontend in dev mode
3022Console syncAgent console bridge
3032Next.js Appopen ↗
8000Backend APIExpress/Node HTTP — all /api/* routes
4201Boot Agent / System MapSystem Map ↗
4202Taurus ShowcaseTaurus agent UI

Deployment

Vercel (Production)

Deployed at go.ai-os.co.za via Vercel.

# Build command (vercel.json)
"buildCommand": "node build-static.js"

# Output directory
"outputDirectory": "public"

# API function
api/index.js → Vercel Serverless Function

Build Steps

node build-static.js
  1. Copy root-level .html/.css/.js/.svg → public/
  2. Copy Xpublic/*.html → public/ (XPUB_SKIP: docs.html, svg-engine.html)
  3. Inject SEO meta tags into all HTML (inject-meta.js)
  4. Generate public/ban-ultra.svg (animated activity bars)
  5. Generate public/ban-live-console.svg (animated log lines)
  6. Pre-render 9 skill SVGs → public/output/*.svg
  7. Generate public/output/index.html (skill listing)

Vercel Rewrites

Key rewrites in vercel.json:

/api/svg/:path* → /api (handled by api/index.js)
/teach/:path*   → /api (svg/teach/* aliased)
/docs           → /docs.html
/gateway        → /gateway/
/join           → /join.html

Cron Jobs (12 active)

  • Economy reconciler — every 5 minutes
  • UBI distribution — daily at midnight UTC
  • NeuroLink campaign processor — every 2 minutes
  • HITL timeout checker — every 10 minutes
  • Swarm health score updater — every minute
  • Lead nurture sequence — every 15 minutes
  • Subscription enforcement — hourly
  • Treasury parity audit — every 30 minutes