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:
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
| Service | Path | Description |
|---|---|---|
| API | api/index.js | Main Node.js HTTP handler — all /api/* routes |
| SVG Engine | api/svg-skills.js | CommonJS renderer for 9 skills + interactive graph JSON |
| Skill Contracts | shared/skills/*.json | A5E skill definition files — runtime contract, graph, events, workflows, security |
| LLM Client | lib/llm-client.js | Provider fallback: Kilo → Anthropic → OpenRouter → OpenAI |
| Treasury | lib/treasury-client.js | On-chain BRDG mint + parity reconciliation |
| Supabase | lib/supabase.js | 26-table schema — users, leads, twins, CRM, economy |
| Build | build-static.js | Vercel 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.
| URL | Description |
|---|---|
| / | Landing — hero, 71 agents, feature cards, OAuth sign-in |
| /executive-dashboard.html | Exec dashboard — API health, revenue engine, mission board, treasury, skills, UBI claim |
| /svg-engine.html | SVG Skills Engine — 9-node interactive graph, pan/zoom, click inspect, dblclick execute |
| /aoe-dashboard.html | AoE ops dashboard — VIS tab, BI status, live agent network map, human-readable mode |
| /agents.html | Agents & Digital Twins — replication, leaderboard |
| /50-applications.html | 50 Applications showcase grid |
| /crm.html | CRM — leads, pipeline, HITL approval queue |
| /invoicing.html | Invoicing — create invoices, track payments, auto-reconcile |
| /marketplace.html | Agent marketplace — open tasks, DEX pairs, wallet |
| /topology.html | Live network topology — service graph, health |
| /terminal.html | OS terminal — system commands, agent REPL |
| /gateway/ | Sovereign Gateway — QR entry, SIWE wallet, Bridge · Supac · Taurus |
| /join.html | Join as Agent — QR + decentralized platform entry |
| /settings.html | User settings — shared across all domains |
| /docs.html | This documentation page |
| /home.html | Bridge AI OS home — overview, quick-start links |
| /pricing.html | Pricing — Free / Pro R299 / Enterprise R2,499 |
| /onboarding.html | Sign up / sign in — email + OAuth |
| /ubi-home.html | UBI home — pool status, claim history |
| /sitemap.html | Full 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
API — Twins & Agents
API — SVG Skills Engine
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
API — Economy & Treasury
API — CRM & Pipeline
API — Streaming
API — Marketplace, Projects & Users
BRDG Token
BRDG is the native utility token of Bridge AI OS, deployed on Linea mainnet.
| Property | Value |
|---|---|
| Network | Linea Mainnet (chain ID 59144) |
| Standard | ERC-20 with TreasuryVault minting authority |
| Mint Authority | TreasuryVault contract (PayFast ITN triggers mint) |
| Max Supply | 100,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:
| Bucket | Share | BRDG Multiplier | Purpose |
|---|---|---|---|
| ops | 40% | 1.0× | Operational costs — infrastructure, AI API calls, compute |
| growth | 25% | 1.1× | Marketing, partnerships, new agent acquisition |
| ubi | 15% | 1.2× | Universal Basic Income — distributed to registered agents |
| reserve | 12% | 1.0× | Protocol reserve — emergency fund, liquidity backstop |
| founder | 8% | 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/status → ubi_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
| ID | Name | Description | Tags |
|---|---|---|---|
| bridge.economy | Economy Cycle | Economic flow — bucket splits, BRDG minting, revenue ingestion | economy, brdg, treasury |
| bridge.swarm | Swarm Control | Agent swarm topology, health heatmap, task distribution | swarm, agents, health |
| bridge.treasury | Treasury | Treasury ledger snapshot — balances, tx history, parity check | treasury, brdg, economy |
| bridge.decision | Decision Engine | AI decision tree with consensus-weighted node voting | ai, decision, consensus |
| bridge.youtube | YouTube Skills | YouTube skill discovery — AI-curated video to skill conversion | youtube, ai, discovery |
| bridge.speech | Speech Synthesis | TTS pipeline — voice profile selection, synthesis queue | speech, tts, audio |
| bridge.twins | Digital Twins | Twin replication — clone agent, parallel inference, sync | twins, replication, agents |
| flow.basic | Basic Flow | Generic process flow — input → process → output template | flow, basic, template |
| biz.marketing | Biz Marketing Pipeline | LeadGen → Nurture → Close → Treasury, A5E engine, SVG graph overlay | leadgen, 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.
| Field | Type | Description |
|---|---|---|
| skill_id | string | Unique identifier — e.g. biz.marketing |
| version | semver | Contract version — follows semver, breaking changes bump major |
| owner | string | Owning cluster — e.g. bridge.corporate |
| namespace | string | Skill namespace — biz, bridge, flow |
| engine | object | Runtime engine config — type (A5E), mode, retries, timeout_ms |
| capabilities | object | Feature flags — visualize, execute, graph, svg_overlay, simulation |
| ports | object | Local dev ports — svg_engine (default 7070), graph_api (7071) |
| graph | object | Node definition + edges + overlay bindings for the skill graph |
| events | object | Inbound and outbound event contracts |
| data_contracts | object | Schema definitions for all data objects the skill reads/writes |
| workflows | object | Named workflow definitions — steps, triggers, outputs |
| ui | object | Mode configuration (VISUALIZE/EXECUTE/GRAPH) + panel definitions |
| security | object | Role-based access — can_execute, can_visualize, can_edit |
| healthcheck | object | HTTP health checks for engine endpoints |
Workflow Step Types
| Type | Description |
|---|---|
| compute | Pure computation — no side effects, idempotent, cacheable |
| action | Side-effecting step — writes to DB, sends events, calls external APIs |
| gate | HITL approval gate — pauses workflow until human approves |
| branch | Conditional 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
End-to-end marketing pipeline: LeadGen → Nurture → Close → Treasury, fully wired into A5E and the SVG interactive graph.
Pipeline Stages
API Endpoints
Events
- lead.captured
- lead.qualified
- campaign.created
- campaign.performance.updated
- deal.created
- deal.closed.won
- deal.closed.lost
- marketing.campaign.launched
- marketing.campaign.paused
- lead.nurture.sequence.started
- lead.nurture.sequence.completed
- sales.handoff.requested
- treasury.revenue.booked
Roles
| Role | Execute | Visualize | Edit |
|---|---|---|---|
| marketing.operator | ✓ | ✓ | ✗ |
| marketing.architect | ✓ | ✓ | ✓ |
| viewer | ✗ | ✓ | ✗ |
Environment Variables
| Variable | Required | Description |
|---|---|---|
| SUPABASE_URL | required | Supabase project URL |
| SUPABASE_SERVICE_KEY | required | Supabase service role key (bypasses RLS) |
| TREASURY_PRIVATE_KEY | required | Linea wallet private key for on-chain BRDG minting |
| PAYFAST_MERCHANT_ID | required | PayFast merchant identifier |
| PAYFAST_MERCHANT_KEY | required | PayFast merchant key for ITN signature validation |
| ANTHROPIC_API_KEY | optional | Claude API — LLM fallback tier 2 |
| KILO_API_KEY | optional | Kilo Gateway — free LLM tier (preferred) |
| OPENROUTER_API_KEY | optional | OpenRouter — LLM fallback tier 3 |
| OPENAI_API_KEY | optional | OpenAI — LLM fallback tier 4 |
| YOUTUBE_API_KEY | optional | YouTube Data API v3 — skill discovery (falls back to LLM) |
| JWT_SECRET | optional | JWT signing secret for session tokens |
| OAUTH_GOOGLE_CLIENT_ID | optional | Google OAuth client ID for social login |
| OAUTH_GOOGLE_CLIENT_SECRET | optional | Google OAuth client secret |
Local Ports
| Port | Service | Notes |
|---|---|---|
| 3020 | Vite dev server | Main frontend in dev mode |
| 3022 | Console sync | Agent console bridge |
| 3032 | Next.js App | open ↗ |
| 8000 | Backend API | Express/Node HTTP — all /api/* routes |
| 4201 | Boot Agent / System Map | System Map ↗ |
| 4202 | Taurus Showcase | Taurus 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