2. Four-Layer Architecture
Layer 1: IntentGuard (Parent Process)
Bot CEO, Trust Debt Pipeline, FIM Geometric Auth, MCP Proxy
FIM Auth — 20-dimensional identity vector, computeOverlap(), sovereignty scoring
Trust-Debt — 8-step pipeline (outcomes → keywords → categories → presence → grades → timeline → narratives → audit)
MCP Proxy — Intercepts tool calls, pre-exec FIM check, fail-open for undefined tools
⬇️ spawns + coordinates
Layer 2: Claude Flow v3 (Multi-Agent Coordinator)
90 MCP Tools | Agent Spawning, Swarm Coordination, Memory Management, Task Dispatch
Swarm — Mesh topology, up to 50 agents, message-bus communication
Memory — sql.js + HNSW vector embeddings, semantic search across sessions
Tasks — Create, assign, track across agent swarm with dependency resolution
⬇️ coordinates
Layer 3: OpenClaw NPM Gateway live
v2026.2.13 | Discord + Dashboard + 54 Skills | ws://127.0.0.1:18789
Gateway — WebSocket RPC + HTTP REST (OpenAI-compatible) + launchd managed
Discord — Guild allowlist, user allowlist, voice memo support
Skills — 6 workspace + 48 bundled (coding-agent, github, tmux, weather, whisper...)
Dashboard — Full web UI: sessions, skills, config, logs, debug
⬇️ calls LLM via
Layer 4: claude-max-api-proxy live
OpenAI-compatible API at localhost:3456 | $0/token via Claude Max subscription
Primary — claude-sonnet-4 (200K context, free via Max)
Fallback — ollama/llama3.2:1b (131K context, local, degraded quality)
Upgrade — claude-opus-4 available for hardness-5 tasks
💬 Discord
🌐 Web UI
📱 WhatsApp
✈️ Telegram
🔒 Signal
💬 iMessage
👔 Teams
📧 Email
Signal Flow (gateway-first, no CLI nesting):
Discord message → runtime.ts
↓
thetasteer-categorize (Ollama)
↓
Hardness 1-5 estimation (Ollama)
↓
Full 12×12 notation: 📡 B3 Tactics.Signal : 🔌 C1 Operations.Grid
↓
┌───────┼───────┐
│ │ │
H1-2 H3-4 H5
Ollama Sonnet Opus
│ │ │
└───────┼───────┘
↓
Gateway API (POST /v1/chat/completions)
↓
Response → Discord channel + spec update
7. Usability Stories (High Impact)
Story 1: "Walk and Talk" — Voice Memo to Shipped Code
It's 7:30 AM. Elias is walking to the coffee shop. He has an idea for a feature. He opens Discord on his phone, holds the mic button in #builder, and says: "Add a rate limiter to the Discord message posting — exponential backoff, start at 1 second, cap at 30 seconds."
He taps send. A voice memo appears. He taps the 🔥 emoji (priority 1).
What happens next — completely autonomous, zero keyboard:
1
Bot detects reaction from authorized user. Downloads the .ogg audio file.
2
Whisper transcribes locally: "Add a rate limiter to the Discord message posting..."
3
ThetaSteer categorizes: 🔌 C1 Operations.Grid : 🔄 C2 Operations.Loop — infrastructure task.
4
Hardness estimated at 3/5 → routes to Sonnet via gateway.
5
Structured context header prepended with room context, spec state, and rolling history.
6
Gateway dispatches to Sonnet. Response posted to #builder with implementation.
7
Spec updated with learning: "Rate limiter added — exponential backoff pattern."
By the time Elias reaches the coffee shop, the feature is implemented and documented in the living spec. Total human effort: 15 seconds of talking + one emoji tap.
Story 2: "Sleep Shift" — 50 Agents Work Through the Night
It's 11 PM. Elias seeds 5 task queues (builder, vault, operator, performer, voice) with tasks for the overnight build. He closes the laptop.
What happens while he sleeps:
1
Watchdog (every 10 minutes) checks all room PIDs. Restarts anything that died.
2
Builder room reads task-queue/builder.jsonl, executes pending tasks via gateway API.
3
Ollama worker generates task suggestions for each room, populating queues for the next cycle.
4
Each completed task updates spec.md with learnings and posts a summary to #architect.
5
HTML overnight report generated at data/overnight-reports/ — CEO morning briefing.
Elias wakes up to overnight reports: 15 tasks completed, 3 bugs found and fixed, spec grew by 400 lines. The machine worked an 8-hour shift while he slept.
Story 3: "Parallel Universe" — 9 Terminals, One Brain
Elias types a complex prompt in #architect: "Design the new authentication system using FIM geometric permissions." The system categorizes it as Hardness 5 — Opus territory.
The cascade:
1
Architect room gets the design prompt → Opus produces architecture spec.
2
Architect hands off to Builder: "Implement this design" — iTerm2 receives the code task.
3
Builder spawns a Sonnet process that writes the auth module.
4
Builder hands off to Laboratory: "Run these test scenarios" — Cursor receives test cases.
5
All three terminals work in parallel: iTerm coding, VS Code reviewing, Cursor testing.
One prompt in #architect produced coordinated work across 3 terminals. Each sees its own domain. No context bleed. No focus stealing (iTerm and Cursor use native IPC, VS Code is serialized when needed).
Story 4: "Smart Spend" — $0 for 80% of Tasks
Over a typical workday, Elias sends 50 messages to various rooms. The system categorizes each and routes intelligently.
The breakdown:
| Hardness 1-2 (simple lookups, renames) | 30 messages | Ollama llama3.2:1b | $0.00 |
| Hardness 3-4 (features, debugging) | 18 messages | Sonnet via Max proxy | $0.00 |
| Hardness 5 (research, architecture) | 2 messages | Opus via Max proxy | $0.00 |
50 LLM calls, zero API spend. Ollama handles the trivial stuff locally. Sonnet/Opus route through claude-max-api-proxy on the Max subscription ($0/token). Before smart routing, every message would hit the API. Now 60% never leave the machine.
Story 5: "Living Memory" — The Spec That Learns
Elias fixes a bug where System Events rooms race for focus. After the fix, the system automatically captures the learning.
The feedback loop:
1
Task completes in Builder room. Output captured via captureViaScript().
2
updateSpecWithLearnings() appends to spec.md: "System Events rooms serialized to avoid focus races."
3
Summary posted to #architect Discord channel.
4
Next task dispatch reads updated spec — the context header now includes this learning.
5
Future tasks in the same domain benefit from accumulated knowledge.
The spec is not documentation — it's institutional memory. Every task reads it. Every completion writes to it. After 100 tasks, the spec contains 100 battle-tested learnings that no human had to manually document.
Story 6: "The Dashboard CEO" — Full Visibility From a Browser Tab
Elias opens http://127.0.0.1:18789 while on a call. The OpenClaw dashboard shows everything at a glance.
What the dashboard reveals:
1
Health: OK — Gateway, Ollama, Discord all connected.
2
54 Skills — 6 workspace (custom) + 48 bundled. 17 eligible, 36 blocked (deps), 1 API key needed.
3
Active Sessions — Can see live agent conversations, spawn new ones.
4
Config — Hot-reload configuration without restarting the gateway.
5
Logs — Real-time log streaming for debugging.
No SSH, no terminal. Full system visibility from any browser on the local network. The dashboard is the CEO's cockpit.
8. Best-Case Scenario: What We Could Build
The infrastructure is here. OpenClaw supports 10+ messaging channels, 54 skills, browser automation, mobile nodes, voice wake, cron scheduling, and multi-agent routing out of the box. Our custom layer adds cognitive rooms, terminal IPC, voice memos, tesseract categorization, and smart routing. The gap between "current" and "dream" is mostly configuration and dependency installation — not new code.
Scenario A: Omni-Channel CEO
Today: Discord only (1 channel active)
Dream: Discord + WhatsApp + Telegram + Signal + iMessage + Email (6 channels)
What changes: Voice memo from WhatsApp → same 14-step pipeline → same cognitive rooms. Text from Telegram → same categorization → same dispatch. iMessage for personal contacts, Signal for encrypted, Email for formal communications. One brain, six surfaces.
How to get there: Configure channels in ~/.openclaw/openclaw.json. WhatsApp needs Baileys QR scan. Telegram needs BotFather token. Signal needs signal-cli. Each takes ~5 minutes.
Effort: Configuration only. Zero new code.
Scenario B: Visual Intelligence
Today: Text-only interactions
Dream: Screenshots → analysis → action. Camera → object detection → task creation.
What changes: The peekaboo skill captures macOS UI elements. The camsnap skill captures RTSP camera feeds. The image tool analyzes screenshots. Browser automation takes actions based on visual state.
Use case: "Screenshot the Vercel dashboard and tell me if any builds failed" → peekaboo captures → image tool analyzes → Builder room fixes the failing build.
Effort: brew install peekaboo camsnap + configure image model.
Scenario C: Full Skill Ecosystem (54/54)
Today: 17/54 skills eligible
Dream: 54/54 skills active — every tool at the AI's fingertips
What this unlocks: Apple Notes for quick captures. Things 3 for task management. Obsidian for knowledge base. Notion for team wikis. Trello for project boards. Spotify for ambient music. Weather for daily briefing. Email for formal outreach. GitHub for PR management. Slack for team communication.
The compound effect: Each skill adds a capability. But skills compose: voice memo → transcribe (whisper) → categorize (thetasteer) → create task (things-mac) → email summary (himalaya) → post to Slack (slack) → update CRM (crm-tools). One voice memo triggers a 6-skill cascade.
Effort: ~20 brew installs + ~5 API keys. No custom code.
Scenario D: Mobile Command Center
Today: Mac-only with Discord mobile as remote
Dream: iOS/Android nodes paired, voice wake, camera snap, location awareness
What changes: OpenClaw supports iOS and Android nodes with Canvas, camera, screen recording, and location. Voice Wake lets you say "Hey Claw" to start a conversation. Talk Mode provides realtime voice with ElevenLabs TTS.
Use case: Walking past a competitor's store. Voice: "Hey Claw, snap a photo." Camera captures the storefront. Image analysis identifies products and pricing. Operator room updates the competitive intelligence file. Navigator room maps the location.
Effort: Install OpenClaw iOS/Android app, pair with gateway. Configure voice-call and talk-voice extensions.
Scenario E: FIM-Secured Autonomous Agent
Today: FIM auth is 260 LOC pseudocode
Dream: Every tool call validated against geometric identity. Trust-debt scoring gates permissions in real-time.
What changes: The MCP proxy intercepts every tool call before execution. computeOverlap(identity, requirement) checks if the caller's 20-dimensional fractal identity vector matches the action's required dimensions. Sovereignty score (from trust-debt pipeline step 4) must exceed the action's minimum threshold.
The equation: Permission(user, action) = Identity_Fractal(user) ∩ Coordinate_Required(action) >= Sovereignty_Threshold
Example: git_push requires sovereignty >= 0.7, code_quality >= 0.7, testing >= 0.6. If the agent's trust score drops below threshold (too many failed tests), it loses push access until trust is rebuilt.
Effort: Integration test for proxy intercept + real math replacing pseudocode. ~200 LOC.
Scenario F: Overnight Intelligence Machine
Today: Watchdog restarts dead rooms, basic task queue processing
Dream: Cron-scheduled intelligence gathering. Email digest. Competitive analysis. Market monitoring.
What changes: OpenClaw's built-in cron system schedules recurring tasks: 6 AM → scan competitor websites (browser skill), 7 AM → check GitHub notifications (github skill), 7:30 AM → compile overnight report, 8 AM → email morning briefing (himalaya skill), 8:30 AM → post summary to Discord #architect.
Combined with overnight rooms: Builder reviews open PRs and writes code reviews. Operator checks CRM pipeline and drafts follow-up emails. Vault scans for contract deadlines. Navigator explores new tools and libraries.
Effort: Configure cron jobs via dashboard. Install himalaya for email, github for PR scanning. ~30 min setup.
10. TypeScript Documentation (Corrected)
tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist",
"declaration": true,
"resolveJsonModule": true,
"isolatedModules": true
},
"include": ["src/**/*.ts", "skills/**/*.ts"]
}
Target: ES2022 — enables top-level await, class fields, logical assignment.
Module: ESNext with bundler resolution — tsx handles the module loading at runtime.
Strict: Full strict mode — noImplicitAny, strictNullChecks, strictFunctionTypes.
Includes: Both src/ and skills/ directories.
package.json
{
"name": "@thetadriven/openclaw",
"version": "0.1.0",
"private": true,
"type": "module",
"engines": { "node": ">=22.0.0" },
"scripts": {
"start": "npx tsx src/runtime.ts",
"doctor": "npx tsx src/doctor.ts",
"dev": "npx tsx watch src/runtime.ts",
"build": "tsc --noEmit"
},
"dependencies": {
"discord.js": "^14.14.1",
"ffmpeg-static": "^5.3.0"
}
}
Runtime: Node.js 22+ required for native fetch, top-level await, and ESM support.
Execution: tsx for TypeScript execution without compile step.
Build: tsc --noEmit for type checking only — no transpiled output needed.
Core Types (src/types.ts)
// The contract every skill must implement
interface AgentSkill {
name: string;
description: string;
initialize(ctx: SkillContext): Promise<void>;
execute(command: unknown, ctx: SkillContext): Promise<SkillResult>;
}
// The context passed to every skill method
interface SkillContext {
config: ConfigReader; // Read openclaw.json values
log: Logger; // Structured logging: info, warn, error
fs: FileSystem; // read(path), write(path, content)
shell: ShellExecutor; // exec(cmd) → { stdout, stderr, code }
callSkill(name: string, payload: unknown): Promise<SkillResult>;
}
// Every skill execute() returns this
interface SkillResult {
success: boolean;
message: string;
data?: unknown;
}
// Terminal configuration for each cognitive room
interface TerminalEntry {
room: string; // "builder", "operator", etc.
emoji: string; // "🔨", "🎩", etc.
app: string; // "iTerm", "kitty", etc.
processName: string; // macOS process name for AppleScript
ipc: IpcMethod; // "iterm" | "kitty" | "wezterm" | "terminal" | "system-events"
windowHint: string; // Window/tab title search hint
}
// IPC dispatch methods
type IpcMethod = "iterm" | "kitty" | "wezterm" | "terminal" | "system-events";
// Orchestrator configuration from openclaw.json
interface OrchestratorConfig {
channelCategory: string; // "Cognitive Rooms"
pollIntervalMs: number; // 2000 (output polling frequency)
taskTimeoutMs: number; // 120000 (2 min max per task)
stabilizationMs: number; // 5000 (output stable = done)
}
// Task lifecycle
type TaskStatus = "pending" | "running" | "capturing" | "complete" | "failed" | "killed";
CategorizationResult (thetasteer-categorize.ts)
interface CategorizationResult {
row: string; // "B3"
col: string; // "C1"
tile_id: string; // "B3:C1" (compact, for compat)
full_notation: string; // "📡 B3 Tactics.Signal : 🔌 C1 Operations.Grid"
semantic_question: string; // "What does Signal mean in Grid?"
confidence: number; // 0.0 - 1.0
tier: "GREEN"|"RED"|"BLUE"; // GREEN=0.7+, RED=0.3-0.7, BLUE=<0.3
hardness: number; // 1-5
target_model: "ollama"|"sonnet"|"opus";
reasoning: string; // Why this hardness level
}
Gateway API Reference
// Authentication
const GATEWAY_URL = "http://127.0.0.1:18789";
const AUTH_HEADER = "Bearer d9b07f435991e525a8c1c2d53c501a1f3df7863b4931c2b5";
// Chat Completion (OpenAI-compatible)
POST /v1/chat/completions
{
"model": "anthropic/claude-sonnet-4-5", // or "anthropic/claude-opus-4-6"
"messages": [{ "role": "user", "content": "prompt" }]
}
→ { "choices": [{ "message": { "content": "response" } }] }
// WebSocket RPC (ws://127.0.0.1:18789)
{"method": "agents.create", "params": {"prompt": "...", "model": "..."}}
{"method": "agent.wait", "params": {"agentId": "..."}}
{"method": "agents.list"}
{"method": "agents.abort", "params": {"agentId": "..."}}
{"method": "models.list"}
{"method": "cron.add", "params": {"schedule": "0 8 * * *", "prompt": "..."}}
{"method": "config.get", "params": {"path": "agents.defaults.model"}}
{"method": "config.patch", "params": {"patch": {...}}}
SKILL.md Format
---
name: my-skill
description: What this skill does
metadata: {
"openclaw": {
"emoji": "🎯",
"requires": {
"bins": ["required-binary"], // Must be on PATH
"env": ["REQUIRED_API_KEY"], // Must be set
"config": ["some.config.path"] // Must be truthy in config
},
"primaryEnv": "REQUIRED_API_KEY",
"install": [
{ "kind": "brew", "formula": "package-name", "bins": ["binary-name"] }
]
}
}
---
# My Skill
Instructions for the AI agent when this skill is loaded.
Use {baseDir} to reference the skill's directory.
## Scripts
- `scripts/my-script.sh` — Does the thing
Skill Locations (Precedence Order)
1. <workspace>/skills/ # Highest priority (our custom skills)
~/.openclaw/workspace/skills/
├── claude-flow-bridge/SKILL.md
├── output-capture/SKILL.md
├── system-control/SKILL.md
├── terminal-dispatch/SKILL.md
├── thetasteer-categorize/SKILL.md
└── voice-memo-reactor/SKILL.md
2. ~/.openclaw/skills/ # Managed/installed skills
(empty — use clawhub install)
3. node_modules/openclaw/skills/ # Bundled with npm package (48 skills)
├── github/SKILL.md
├── coding-agent/SKILL.md
├── tmux/SKILL.md
└── ... (45 more)