Extends OpenClaw with a full-stack automation platform — agent orchestration, neural intelligence (BrainJar spiking neural network), ClawScript DSL, process management, and a unified dashboard. Includes a complete IG Trading integration as a reference implementation.
Cross-platform (Node.js — recommended):
git clone https://github.com/JoeSzeles/openclaw-mechanicus-patches.git
cd openclaw-mechanicus-patches
node install-node.cjsThe Node installer auto-detects your OpenClaw install location and works on Windows, Mac, and Linux. It patches the gateway to load ig-local-api.mjs at startup, enabling all API endpoints on the raw gateway without requiring the CEO proxy.
Linux / Mac (shell):
bash install.sh /path/to/openclawWindows (PowerShell):
.\install.ps1 C:\path\to\openclawThe installer backs up any existing files before overwriting them.
Restores all original files from the backup created during install.
bash uninstall.sh /path/to/openclaw.\uninstall.ps1 C:\path\to\openclaw- Mechanicus Dashboard — unified control surface for agents, processes, neural systems, and automation
- Agent Orchestration — spawn, manage, and chain agents with task assignment, parallel execution, and inter-agent communication
- Process Manager — bot lifecycle management with health monitoring, auto-restart, and log aggregation
- ClawScript DSL — general-purpose scripting language with 80+ commands spanning automation, AI, data, networking, and neural control
- Canvas System — visual workspace for dashboards, editors, documentation, and interactive tools
- Spiking Neural Network — biologically-inspired LIF neurons (5,000 default, configurable 350–20,000), Poisson-encoded inputs, synaptic weight learning
- Custom Brain Instances — create named brains with independent architectures, data directories, and persistent profiles (
~/.openclaw/brains/) - Volume Antenna — 180 neurons in 7 sub-groups for pattern detection (flash events, absorption, divergence, momentum shifts)
- Mushroom Body — dense interneuron cluster for memory consolidation and per-context pattern persistence across restarts
- Training Modes — backtest (historical data with feedback), live (real-time inputs), auto-test (multi-cycle calibration)
- Brain Management — boot, stimulate, observe, train, save/load, create/destroy instances via API or ClawScript
A general-purpose DSL for building automations, strategies, data pipelines, and agent workflows. Compiles to JavaScript with a visual flow editor for drag-and-drop composition.
Command categories:
- Core — variables, loops, conditions, functions, error handling, wait
- AI & ML — AI_QUERY, AI_GENERATE_SCRIPT, RUN_ML, ANALYZE_LOG
- Data & Web — WEB_FETCH, FILE_READ/WRITE, CLAW_WEB, CLAW_PDF, CLAW_X, DATA_TRANSFORM
- Agent & Task — AGENT_SPAWN/CALL/PASS/TERMINATE, TASK_ASSIGN/CHAIN/PARALLEL, SKILL_CALL
- Brain / Neural — BRAIN_BOOT, BRAIN_STIMULATE, BRAIN_OBSERVE, BRAIN_FEEDBACK, BRAIN_TRAIN, BRAIN_SAVE/LOAD, BRAIN_CREATE/USE/LIST/DESTROY, BRAIN_STATUS
- Communication — CHANNEL_SEND, EMAIL_SEND, SAY_TO_SESSION, WAIT_FOR_REPLY, ALERT
- Trading — BUY, SELL, SELLSHORT, EXIT, CLOSE, TRAILSTOP, INDICATOR, OPTIMIZE
- System — CRON_CREATE/CALL, STORE_VAR/LOAD_VAR, INCLUDE, CHAIN, PUBLISH_CANVAS
Full reference: github.com/JoeSzeles/clawscript
A complete trading system built on the Mechanicus platform, demonstrating what's possible with agent orchestration and neural intelligence applied to financial markets.
- 23 strategies — scalper, trend-following, mean-reversion, breakout, Donchian, grid, pairs, and more
- Batch backtester — run multiple instruments/strategies/timeframes with optimization memory
- AI calibration agent — Groq-powered multi-cycle parameter tuning
- Signal monitor — real-time alerts from strategy signals
- Trade Claw engine — live trade execution via IG REST API
- Neural Trading — BrainJar applied to market data with Cortex auto-trade, Volume Antenna pressure sensing, per-instrument pattern cards
The Neural Trading system integrates BrainJar's spiking neural network into the dashboard as four sub-tabs:
| Tab | Purpose |
|---|---|
| Neural Dashboard | Live data feed, charts, connection status, manual triggers |
| Brain (Neural Cortex) | Per-context pattern cards, auto-execution, training controls, calibration |
| Brain Config | Network architecture, timeframe presets, sensory assignments, mushroom body, backtest training |
| Dev Console | Real-time brain activity logs |
Key features:
- LIF Spiking Network — 5,000 neurons (configurable 350–20,000), Poisson-encoded data, synaptic weight learning
- Volume Antenna — 180 neurons in 7 sub-groups detect flash events, dead cat bounces, absorption, divergence, falling knives
- Cortex Auto-Execute — autonomous decision management with signal confirmation, hold zones, emergency exit on flash events
- Mushroom Body — dense interneuron cluster for memory consolidation, per-context pattern persistence across restarts
- Training — backtest (historical data with P&L feedback), live (real-time with antenna pressure), auto-test (multi-cycle calibration)
Documentation: open the Docs link in the Neural Trading tab bar, or view neural-trading.html in the canvas directory.
Copy .env.example to .env in your OpenClaw directory and fill in your values:
cp .env.example .env| Variable | Required | Description |
|---|---|---|
GROQ_API_KEY |
No | Groq API key for AI calibration and AI_QUERY commands |
OPENCLAW_LOGIN_USER |
No | Username for dashboard login protection |
OPENCLAW_LOGIN_PASSWORD |
No | Password for dashboard login protection |
DATABASE_URL |
No | PostgreSQL connection string (see Database Setup below) |
IG_API_KEY |
For trading | IG Trading API key |
IG_USERNAME |
For trading | IG account username |
IG_PASSWORD |
For trading | IG account password |
IG_ACCOUNT_ID |
No | IG account ID (auto-detected if omitted) |
IG_ACCOUNT_TYPE |
No | demo (default) or live |
The patch injects a standalone ESM module (ig-local-api.mjs) into the OpenClaw gateway at startup. This provides a full API layer that works on the raw gateway (port 18789) without requiring the CEO proxy.
Session & Config:
| Endpoint | Method | Description |
|---|---|---|
/api/ig/config |
GET | Get config (credentials masked) |
/api/ig/config |
POST | Update config (accepts {profiles:{...}} or {profile,profileName}) |
/api/ig/config/test |
POST | Test connection for a specific profile |
/api/ig/session |
GET | Get session status |
/api/ig/session/refresh |
POST | Force session token refresh |
Trading (proxied to IG REST API):
| Endpoint | Method | Description |
|---|---|---|
/api/ig/positions |
GET | List open positions with snapshots |
/api/ig/positions/open |
POST | Open a new position (BUY or SELL) |
/api/ig/positions/close |
POST | Close a position by dealId |
/api/ig/positions/update |
PUT | Update stop/limit on a position |
/api/ig/account |
GET | Account balance and details |
/api/ig/markets |
GET | Search markets by term |
/api/ig/markets/:epic |
GET | Get market details for an epic |
/api/ig/marketnavigation |
GET | Market navigation tree |
/api/ig/pricehistory/:epic |
GET | Historical price data |
/api/ig/workingorders |
GET | List working orders |
/api/ig/workingorders/create |
POST | Create a working order |
/api/ig/workingorders/update |
PUT | Update a working order |
/api/ig/workingorders/delete |
DELETE | Delete a working order |
/api/ig/activity |
GET | Account activity (requires ?from= param) |
/api/ig/history |
GET | Transaction history |
/api/ig/watchlists |
GET | IG account watchlists |
/api/ig/refresh-snapshots |
POST | Refresh market snapshots for positions |
Streaming (local-mode stubs — requires CEO proxy for live data):
| Endpoint | Method | Description |
|---|---|---|
/api/ig/stream/prices |
GET | Price stream status |
/api/ig/stream/status |
GET | Stream connection status |
/api/ig/stream/candles |
GET | Candle data (REST polling fallback) |
/api/ig/stream/candle-stats |
GET | Candle statistics |
Strategies & Scalper (local JSON file CRUD):
| Endpoint | Method | Description |
|---|---|---|
/api/ig/strategies |
GET | List all strategies |
/api/ig/strategies/global |
POST | Update global strategy toggle |
/api/ig/strategy-templates |
GET | List strategy templates |
/api/ig/watchedlist |
GET | Watched instruments list |
/api/ig/proofread |
GET/PUT | Proofread configuration |
/api/ig/scalper |
GET | Scalper configuration |
/api/ig/scalper/status |
GET | Scalper engine status |
/api/ig/scalper/strategies |
GET | Scalper strategies |
/api/ig/scalper/strategy-schemas |
GET | Strategy parameter schemas |
/api/ig/scalper/backtests |
GET | Backtest results |
/api/ig/scalper/optimization-memory |
GET | Optimization memory |
/api/ig/scalper/batch-backtest |
GET | Batch backtest results |
/api/ig/logs/scalper-trades |
GET | Scalper trade logs |
ClawScript:
| Endpoint | Method | Description |
|---|---|---|
/api/clawscript/strategies |
GET | ClawScript strategies |
/api/clawscript/results |
GET | ClawScript results |
/api/clawscript/scripts |
GET | ClawScript scripts |
/api/clawscript/templates |
GET | ClawScript templates |
/api/clawscript/ai/config |
GET | ClawScript AI configuration |
/api/clawscript/logbook |
GET/POST | ClawScript logbook entries |
Bots & Processes:
| Endpoint | Method | Description |
|---|---|---|
/api/bots |
GET | Registered bots |
/api/processes |
GET | Running processes |
The POST /api/ig/config endpoint accepts two formats for backward compatibility:
UI format (from model-config.js):
{ "profiles": { "demo": { "apiKey": "...", "username": "..." } } }Direct format:
{ "profileName": "demo", "profile": { "apiKey": "...", "username": "..." } }Masked values (•••••••• or ****) are automatically detected and skipped to prevent overwriting real credentials when the UI sends back masked fields.
The system uses PostgreSQL for storing strategies, backtest results, optimization memory, trade history, and candle data.
No database? No problem. When DATABASE_URL is not set, the system automatically falls back to CSV files stored in ~/.openclaw/db/. Everything works — strategies, backtests, trades, optimization memory, candle caching — just using local CSV files instead of PostgreSQL. This means you can run the full system without any database setup at all.
PostgreSQL is recommended for production use (better performance with large datasets, concurrent access, proper indexing), but CSV mode is fully functional for development, testing, and personal use.
All tables are created automatically on first startup — no manual SQL required.
Neon offers a free tier with 512 MB storage — more than enough.
- Go to https://neon.tech and sign up (GitHub/Google login works)
- Click New Project — give it a name like
openclaw-mechanicus - Select the region closest to you and click Create Project
- On the dashboard, find the Connection string — it looks like:
postgresql://username:password@ep-cool-name-123456.us-east-2.aws.neon.tech/neondb?sslmode=require - Copy the full connection string
- Open your
.envfile and set:DATABASE_URL=postgresql://username:password@ep-cool-name-123456.us-east-2.aws.neon.tech/neondb?sslmode=require - Start (or restart) OpenClaw Mechanicus — tables are created automatically
Supabase offers a free tier with 500 MB and a full Postgres database.
- Go to https://supabase.com and sign up
- Click New Project, pick an org, set a database password, and choose a region
- After the project is created, go to Project Settings > Database
- Under Connection string > URI, copy the connection string
- Replace
[YOUR-PASSWORD]in the string with the password you set - Add to your
.env:DATABASE_URL=postgresql://postgres:[YOUR-PASSWORD]@db.xxxxx.supabase.co:5432/postgres
If you have PostgreSQL installed locally:
DATABASE_URL=postgresql://postgres:yourpassword@localhost:5432/openclaw
Create the database first:
createdb openclawAfter setting DATABASE_URL, start the system with start-mechanicus.ps1 (Windows) or start-mechanicus.sh (Linux/Mac). Look for these log messages:
[startup] Database: configured
[startup] price_candles table ready
If you see Database: not configured (file-only mode), check that your .env file has the correct DATABASE_URL value.
| Table | Purpose |
|---|---|
scalper_config |
Global engine settings (budget, drawdown limits) |
scalper_strategies |
Strategy configurations (instruments, indicators, parameters) |
scalper_trades |
Execution history with P&L |
scalper_backtests |
Individual backtest results |
optimization_memory |
Best parameters found per instrument/strategy/timeframe |
price_candles |
Historical OHLCV data cached from APIs |
agent_backups |
Agent state snapshots |
agent_memory |
Agent long-term memory |
agent_daily_memory |
Agent daily journals |
agent_subconscious |
Agent pattern recognition data |
- Price history / chart data may return
exceeded-account-historical-data-allowanceon IG demo accounts (rate limit, resets after a few hours) - Market navigation returns 500 from IG API on some demo accounts
- Activity endpoint requires
?from=date parameter (e.g.,?from=2026-03-01T00:00:00) - Streaming (Lightstreamer live prices) works in local mode — auto-connects after first IG auth, subscribes to configured instrument epics, falls back to hybrid REST polling if L1 subscription fails. Live account streaming also supported if live profile is configured
- ClawScript compile/run/AI execution requires the CEO proxy — local mode returns helpful stubs
- Scalper engine start/stop requires the CEO proxy — local mode manages config/strategies/trades locally



