SWAT - Autonomous Squad Orchestration
SWAT dispatches tasks to autonomous AI squads powered by GitHub Copilot CLI. Each squad is a domain specialist that works independently in the background.
CLI
| Command | Purpose |
|---|---|
swat --version |
Show installed version |
Tools
Operations
| Tool | Purpose |
|---|---|
swat_dispatch |
Dispatch a task (auto-classified to the right squad) |
swat_ops |
List operations (supports status/since/limit/offset filters), returns counts |
swat_cancel |
Cancel a running operation |
Squads
| Tool | Purpose |
|---|---|
swat_squads |
List installed squads |
swat_squad_browse |
List squads available in the marketplace |
swat_squad_install |
Install a squad from the marketplace |
swat_squad_uninstall |
Uninstall a squad and clean up dependencies |
swat_squad_update |
Update an installed squad to the latest marketplace version |
Schedule
| Tool | Purpose |
|---|---|
swat_intake_create |
Create a scheduled recurring task (zero LLM cost) |
swat_intake_list |
List all intake queue entries |
swat_intake_delete |
Delete an intake queue entry |
Notifications
| Tool | Purpose |
|---|---|
swat_notify |
Send a notification to the user (optionally with operation report link) |
How to Dispatch
- Dispatch —
swat_dispatch(brief). Squad is auto-classified. Returns an operation ID immediately. - Tell the user — Confirm the task is dispatched. Classification + launch happens async in the background.
- Move on — Do NOT wait, poll, or sleep. The squad works in the background.
Scheduling Recurring Tasks
Use SWAT's built-in intake queue for deterministic, zero-LLM-cost recurring tasks:
swat_intake_create(brief="分析紫金矿业601899", cron="0 9 * * 1", timezone="Asia/Shanghai")
- Cron format: Standard 5-field —
min hour dom month dow immediate: Set totrueto trigger the first run right away (default:false)- Per-file locking: Concurrent safety via file locks
- Startup catch-up: Due entries are checked on SWAT startup — no missed runs after restarts
Use swat_intake_list to view all entries and swat_intake_delete(id) to remove one.
When to use SWAT scheduler vs OpenClaw cron:
- SWAT scheduler → deterministic recurring tasks (zero LLM cost, e.g. "analyze X every Monday")
- OpenClaw cron → tasks needing LLM judgment
Completion Notifications
Squads automatically notify the user when they finish or fail. Use swat_ops to check status on-demand when the user asks.
Checking Results
- Call
swat_opsonly when the user asks about a task, or when you have a natural reason to check (e.g., heartbeat). - Never use
sleep, polling loops, or repeatedexeccalls to wait for completion. swat_opsreturns counts + operations. Filters:status—queued,active,completed,failedsince— RFC3339 timestamp, only returns terminal ops after this time; active/queued always includedlimit— max results (default 50)offset— skip first N results (default 0)- Results sorted by time descending (most recent first)
Critical Rules
- Fire and forget — After dispatch, immediately return control to the user. Do not monitor, poll, or block.
- No sleep/exec polling — Never run
sleep X && checkor similar patterns. - Auto-classification — You do NOT need to pick a squad.
swat_dispatchauto-classifies the task. - Concurrent operations — Multiple tasks can run in parallel across different squads.
- Failed operations — Include the failure reason when reporting to the user.
Marketplace
swat_squad_browse— See what's available to install.swat_squad_install(squad)— Downloads squad + resolves dependencies automatically.swat_squad_uninstall(squad)— Removes squad blueprint + cleans up orphaned dependencies.swat_squad_update(squad)— Update to latest marketplace version.
First Run
If SWAT tools are not available, guide the user to install:
curl -fsSL https://raw.githubusercontent.com/LangSensei/swat/main/install.sh | bash
Then restart OpenClaw. After that, install a squad: swat_squad_install("squad-name").
Before the first dispatch, verify GitHub auth is set up (required for Copilot CLI):
gh auth status
If not authenticated, guide the user to run gh auth login first.