You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A general-purpose domain-specific language (DSL) for automation, AI agent orchestration, neural computing, and application scripting in OpenClaw. Write readable commands that compile to JavaScript — from workflow automation and agent management to neural network control, data processing, and trading strategies.
Features
120+ commands across 20+ categories: Variables, Control Flow, AI/Analysis, Brain/Neural, Data Fetch, Agent Orchestration, Task Planning, Communication, Notifications, File & Data, Time/Schedule, Scientific, Functions, Trading, Portfolio, Economic/Political, TradingView-Style, Bloomberg/Data Access, PRT Compatibility (40+ ProRealTime commands), and more
Brain / Neural commands — boot, stimulate, observe, and train spiking neural networks; create custom named brain instances with configurable neuron architectures; save and load brain weights; switch between multiple brains in scripts
21 Automation Commands — define tasks, chain workflows, schedule cron jobs, send notifications via chat channels and email, read/write/execute files, and publish scripts
Flow Toolbar — Connect mode, Delete, Select All, Zoom In/Out/Fit, Auto-Layout, Export PNG, Undo/Redo, Clear All
Animated Flow Execution — real-time node highlighting, glowing connection paths, live values on nodes, speed control (Fast/Normal/Slow/Step)
Command Info Icons — info icons in sidebar showing floating documentation cards per command
Visual Output Popup — draggable results modal with Simulation, Backtest, and Flow Trace tabs; equity curve canvas
Code Editor — syntax-highlighted editor with live parsing, VS Code-style error highlighting with dynamic line height
Standalone Editor Page — full editor accessible via "Code" link in top navigation bar
AI Assistant — built-in chat panel with Bearer token auth, reads code/errors/logs to help fix issues
Strategy Compiler — compiles .cs scripts to production-ready .cjs modules
Save & Deploy Pipeline — save dialog with strategy name/filename, auto-deploy for engine discovery
Run Live — config popup (name, instrument) then deploys as persistent background process with live log viewer, stop/restart/pause controls
Backtest — config popup (timeframe, candle count, instrument) with progress indicator, results popup with equity curve canvas and trade list
Simulation & Backtest — test strategies with real or cached data; green play button, instrument selector, multi-tier data fallback (API, DB cache, stream ticks, demo data)
Indicator Dropdown — toolbar selector with 25+ indicators organized by category (Trend, Oscillators, Volatility, Volume), inserts code at cursor, favorites saved to localStorage
AI Integration — query AI models, generate scripts, analyze logs, and scan sentiment
The editor combines a syntax-highlighted code pane (left), a visual flow builder (right), an Output/Logs panel (bottom-left), and an AI Assistant chat (bottom-right). The toolbar provides Compile & Save, speed controls, instrument selector, Backtest, and Run Live buttons.
Visual Flow Builder
The flow view renders ClawScript as a directed graph. Rectangular nodes represent commands (trading, variables, control flow), circular nodes represent operators (AND, OR, comparisons, crossovers). The Commands sidebar organizes all blocks into collapsible categories.
Simulation Output
Real-time simulation output showing parsed statement count, data fetching with automatic fallback, and live indicator computation (EMA, RSI, MACD).
// Create and train a custom neural network
BRAIN_CREATE "pattern-detector" SENSORY 400 INTER 2400 MOTOR 600
BRAIN_USE "pattern-detector"
BRAIN_BOOT
// Stimulate with input data
BRAIN_STIMULATE { "price_up": 0.8, "volume": 0.5 }
// Read motor outputs
BRAIN_OBSERVE
// Reinforce good results
BRAIN_FEEDBACK "sugar"
// Save learned weights
BRAIN_SAVE
Agent orchestration example
// Spawn specialized agents and coordinate tasks
SPAWN_AGENT "researcher" WITH "You are a research assistant"
SPAWN_AGENT "analyst" WITH "You are a data analyst"
SET data = AI_QUERY "Gather recent market sentiment"
AGENT_PASS data TO "analyst"
TASK_DEFINE "AnalysisChain"
SET result = AGENT_CALL "analyst" "Analyze the data I received"
CHANNEL_SEND "#results" result
ENDTASK
TASK_CHAIN "AnalysisChain"
Trading strategy example
// RSI strategy with risk management
DEF rsi = RSI(14)
IF rsi < 30 THEN
BUY 1 AT MARKET STOP 20 LIMIT 40 REASON "RSI oversold"
ENDIF
IF rsi > 70 THEN
SELL 1 AT MARKET STOP 20 REASON "RSI overbought"
ENDIF
Installation
Into an existing OpenClaw instance
git clone https://github.com/JoeSzeles/clawscript.git
cd clawscript
bash install.sh
The installer copies files to the correct OpenClaw directories:
The editor includes a drag-and-drop node editor that syncs bidirectionally with the code pane:
Toolbox sidebar with 120+ command blocks organized in 20+ categories (including Brain/Neural, 5 Indicator sub-categories, and Notifications)
Drag nodes onto the canvas — they snap to a grid
Connect ports between nodes to define execution flow
Inline editing of node parameters
Zoom/Pan — scroll to zoom (zooms toward cursor), click+drag to pan
Auto-layout arranges nodes in a smart grid (linear chains group into rows, branches spread horizontally)
Undo/Redo with Ctrl+Z / Ctrl+Y (50-state stack)
Export PNG of the flow diagram
Changes in code update the flow, changes in flow update the code
Save & Deploy Pipeline
ClawScript modules integrate directly with the OpenClaw engine:
Write — Create your script in the code editor or flow builder
Compile & Save — Opens a dialog with name and filename fields
Deploy — The compiled .cjs file is saved for engine discovery
Discover — The loader auto-registers the new module
Configure — INPUT_* variables appear as editable fields in the dashboard
Run — The engine calls evaluateEntry() / evaluateExit() on each tick
Variable Tooltips
Comments on DEF and INPUT_* lines become tooltips in the editor:
DEF period = 14 // Lookback period (tooltip in editor)
INPUT_INT lookback DEFAULT 50 // Number of data points to analyze
INPUT_FLOAT threshold DEFAULT 0.02 // Sensitivity threshold
API Endpoints
Endpoint
Method
Description
/api/clawscript/strategies
GET
List ClawScript modules
/api/clawscript/strategies
POST
Save compiled module
/api/clawscript/strategies/:name
DELETE
Remove module
/api/clawscript/templates
GET
List templates
/api/clawscript/templates/:name
GET
Get template source
/api/clawscript/backtest
POST
Run backtest with historical data
Compiled Output
ClawScript compiles to a JavaScript class extending BaseStrategy:
sentiment-scan.cs — AI sentiment analysis + market scanner
btc-scalper.cs — Fast BTC scalping with RSI + EMA and tight stops
mean-reversion.cs — Bollinger Band mean reversion with error handling
bourse-trackers.cs — Multi-indicator approach for major index CFDs
License
MIT
About
ClawScript DSL for OpenClaw — 80+ commands for automated trading strategies, TradingView/Bloomberg/PRT compatibility, visual flow builder, AI integration, and compilation to JavaScript.