Use when the agent wants to define, list, inspect, or execute GUI macros via the OpenClaw Macro System CLI. Macros are parameterized, CLI-callable workflows — the agent invokes `macro run <name>` and the system handles backend routing (plugin, file transform, accessibility, compiled GUI replay).
The OpenClaw Macro System converts valuable GUI workflows into parameterized, CLI-callable macros. Agents never touch the GUI directly — they call macros through this stable CLI, and the runtime routes execution to the best available backend (native plugin/API, file transformation, semantic UI control, or precompiled GUI macro replay).
cd openclaw-skill/agent-harness
pip install -e .
Requirements: Python 3.10+, PyYAML, click, prompt-toolkit.
# 1. See what macros are available
cli-anything-openclaw macro list --json
# 2. Inspect a macro's parameters
cli-anything-openclaw macro info export_file --json
# 3. Dry-run to check params without side effects
cli-anything-openclaw --dry-run macro run export_file \
--param output=/tmp/test.txt --json
# 4. Execute a macro
cli-anything-openclaw macro run export_file \
--param output=/tmp/result.txt --json
# 5. See what backends are available
cli-anything-openclaw backends --json
| Flag | Description |
|---|---|
--json | Machine-readable JSON output on stdout |
--dry-run | Simulate all steps, skip side effects |
--session-id <id> | Resume or create a named session |
macro group| Command | Description |
|---|---|
macro list | List all available macros |
macro info <name> | Show macro schema (parameters, steps, conditions) |
macro run <name> --param k=v | Execute a macro |
macro dry-run <name> --param k=v | Simulate without side effects |
macro validate [name] | Structural validation |
macro define <name> | Scaffold a new macro YAML |
session group| Command | Description |
|---|---|
session status | Show session statistics |
session history | Show recent run history |
session save | Persist session to disk |
session list | List all saved sessions |
backendscli-anything-openclaw backends --json
# Shows: native_api, file_transform, semantic_ui, gui_macro, recovery
# and whether each is available in the current environment.
Pass parameters with --param key=value. Repeat for multiple:
cli-anything-openclaw macro run transform_json \
--param file=/path/to/data.json \
--param key=settings.theme \
--param value=dark \
--json
All commands output JSON when --json is set:
{
"success": true,
"macro_name": "export_file",
"output": {
"exported_file": "/tmp/result.txt"
},
"error": "",
"telemetry": {
"duration_ms": 312,
"steps_total": 2,
"steps_run": 2,
"backends_used": ["native_api"],
"dry_run": false
}
}
On failure ("success": false), read the "error" field for the reason.
Exit code is 1 on failure.
Backends are selected automatically based on the macro step definition:
| Backend | Triggered by | Use case |
|---|---|---|
native_api | backend: native_api | Subprocess / shell command |
file_transform | backend: file_transform | XML, JSON, text file editing |
semantic_ui | backend: semantic_ui | Accessibility / keyboard shortcuts |
gui_macro | backend: gui_macro | Precompiled coordinate replay |
recovery | backend: recovery | Retry / fallback orchestration |
Macros are YAML files in cli_anything/openclaw/macro_definitions/.
Scaffold one with:
cli-anything-openclaw macro define my_macro --output \
cli_anything/openclaw/macro_definitions/examples/my_macro.yaml
Minimal schema: