Install
openclaw skills install disclawManage Discord workspace structure and OpenClaw routing as code. Use when creating/renaming/deleting Discord channels, categories, threads, or managing agent-to-channel bindings. Triggers on: Discord channels, workspace structure, channel setup, routing, binding, disclaw.
openclaw skills install disclawDisclaw manages Discord workspace structure (categories, channels, threads) and OpenClaw agent-to-channel bindings as code via a YAML config file.
Disclaw vs Discord plugin: Disclaw manages structure (create/rename/delete channels, categories, threads; manage bindings and routing gates). The Discord plugin manages messaging (send/receive, reactions, pins, thread replies). They do not conflict.
npm install -g @ofan/disclaw
disclaw --version
channels.discord.tokenopenclaw.json:
{ gateway: { tools: { allow: ["gateway"] } } }
This lets disclaw read/write config via the gateway API. Without it, disclaw falls back to CLI.disclaw.yaml in the workspace (see format below)disclaw validate -c disclaw.yaml
disclaw diff -c disclaw.yaml
The config file (disclaw.yaml) declares the desired state of Discord workspace structure.
version: 1
managedBy: disclaw
guild: "YOUR_GUILD_ID"
channels:
# Standalone channel (no category)
- name: announcements
topic: "Important announcements"
# Category with channels
- category: Engineering
channels:
- name: general
threads: [Standup, Retro]
- name: alerts
topic: "Automated alerts only"
# Another category
- category: Support
channels:
- name: tickets
- name: escalations
# OpenClaw agent bindings (optional)
openclaw:
requireMention: false
agents:
main: general # single channel
siren: [general, alerts] # multiple channels
support: # with options
channel: tickets
requireMention: true
guild is the Discord server ID (right-click server → Copy Server ID)channels sectionrequireMention controls whether the bot needs @mention to respond in that channeldisclaw diff — Show what would changedisclaw diff -c disclaw.yaml
disclaw diff -c disclaw.yaml --json # structured output
disclaw diff -c disclaw.yaml --channel alerts # filter by channel
Shows: managed resources (create/update/delete/noop), unmanaged resources, unbound agents, stale agents, routing health warnings, and pinned messages.
disclaw apply — Apply changes (dry-run by default)disclaw apply -c disclaw.yaml # dry-run (shows what would change)
disclaw apply -c disclaw.yaml --yes # actually apply changes
disclaw apply -c disclaw.yaml --prune --yes # also delete unmanaged resources
Safety: Always takes a snapshot before mutating. Creates before deletes. Bindings and routing gates are updated atomically.
disclaw import — Import unmanaged Discord resourcesdisclaw import -c disclaw.yaml # dry-run (shows what would be imported)
disclaw import -c disclaw.yaml --yes # write to config file
Discovers Discord channels/categories/threads not in the config and adds them. Also finds unbound OpenClaw agents.
disclaw rollback — Restore from snapshotdisclaw rollback -c disclaw.yaml # dry-run
disclaw rollback -c disclaw.yaml --yes # actually rollback
Restores Discord state from the most recent pre-apply snapshot. Drift-aware (shows what changed since the snapshot).
disclaw validate — Validate config (no API calls)disclaw validate -c disclaw.yaml
disclaw validate -c disclaw.yaml --json
Safe for CI. Checks: schema validity, empty names, duplicate channels/threads, binding refs pointing to non-existent channels.
--category <names...> # filter by category name
--channel <names...> # filter by channel name
--thread <names...> # filter by thread name
--agent <names...> # filter by agent name
--json # structured JSON output
--gateway-url <url> # override gateway URL (default: http://127.0.0.1:18789)
--gateway-token <token> # override gateway auth token
Also via env vars: OPENCLAW_GATEWAY_URL, OPENCLAW_GATEWAY_TOKEN.
disclaw.yaml — add channel under the appropriate categorydisclaw validate -c disclaw.yamldisclaw diff -c disclaw.yamldisclaw apply -c disclaw.yaml --yesdisclaw.yaml — add entry under openclaw.agentsdisclaw diff -c disclaw.yamldisclaw apply -c disclaw.yaml --yesThis creates the binding AND allowlists the channel in routing gates automatically.
disclaw import -c disclaw.yaml (dry-run to preview)disclaw import -c disclaw.yaml --yes (writes to config)disclaw diff -c disclaw.yamldisclaw.yamldisclaw apply -c disclaw.yaml --prunedisclaw apply -c disclaw.yaml --prune --yesWarning: --prune is required for deletions. Without it, removed channels are shown as "unmanaged" but not deleted.
disclaw.yamldisclaw diff -c disclaw.yaml (shows delete old + create new)disclaw apply -c disclaw.yaml --yesNote: Discord doesn't support true renames via API — disclaw creates the new channel and (with --prune) deletes the old one.
"Discord bot token not found"
channels.discord.token is set in openclaw.jsonDISCORD_BOT_TOKEN env var"Gateway tool not available"
gateway.tools.allow: ["gateway"] to openclaw.json"Gateway auth failed"
OPENCLAW_GATEWAY_TOKEN env var matches gateway.auth.token in config--gateway-token <token>"OpenClaw CLI timed out"
openclaw statuscurl http://127.0.0.1:18789/"Discord connection timed out"
"Permission denied" during apply
--yes.disclaw/snapshots/disclaw rollback -c disclaw.yaml --yes