Skip to content

OpenClaw 接入指南

OpenClaw 是一个开源 AI Agent 平台,自 2026-03-15 起通过社区贡献实现了对 CLI-Anything 的支持。OpenClaw 采用 SKILL 机制来封装外部工具,可以无缝集成 CLI-Anything 生成的 CLI。


  • OpenClaw 已安装并运行
  • Python 3.10+
  • 目标软件已安装

方式一:使用 CLI-Hub Meta Skill(推荐)

Section titled “方式一:使用 CLI-Hub Meta Skill(推荐)”

这是最简便的方式,使用 CLI-Hub 的元技能来实现自治发现:

Terminal window
# 一键安装 cli-hub-meta-skill
npx skills add HKUDS/CLI-Anything --skill cli-hub-meta-skill -g -y

安装完成后,向 OpenClaw 发送提示:

Find appropriate CLI software in CLI-Hub and complete the task: "用 GIMP 把 image.jpg 裁剪成 800x600"

OpenClaw 会自动:

  1. 在 CLI-Hub 中搜索合适的 CLI
  2. 发现 cli-anything-gimp
  3. 执行相应的操作

OpenClaw 的 Skill 系统可以直接安装 CLI-Anything:

Terminal window
# 搜索可用技能
openclaw skills search gimp
# 安装技能
openclaw skills install gimp

安装后,AI Agent 会自动获得操控 GIMP 的能力。

  1. 安装 CLI-Hub:
Terminal window
pip install cli-anything-hub
  1. 安装目标 CLI:
Terminal window
cli-hub install gimp
  1. 在 OpenClaw 配置中添加工具路径:
~/.qclaw/config.yaml
tools:
cli-anything:
enabled: true
path: /usr/local/bin/cli-anything-gimp

用户:帮我把这张照片调成暖色调,加个边框,导出 PNG
OpenClaw Agent:
→ 调用 cli-anything-gimp image open --path ./photo.jpg
→ 调用 cli-anything-gimp filter apply --name "warm-tone" --intensity 0.7
→ 调用 cli-anything-gimp image border --width 10 --color "#333333"
→ 调用 cli-anything-gimp export file --path ./output.png --format PNG
✅ 完成!已导出到 ./output.png
用户:从 Excel 读取数据,生成图表,插入到 Word 文档
OpenClaw Agent:
→ 调用 cli-anything-libreoffice calc read --file ./data.xlsx --range A1:D20
→ 调用 cli-anything-libreoffice calc chart --type bar --data A1:D20 --output ./chart.png
→ 调用 cli-anything-libreoffice writer insert-image --file ./chart.png --position "Page 3"
✅ Word 文档已更新!
用户:用 Shotcut 把 intro.mp4 和 demo.mp4 合并,加上淡入淡出效果
OpenClaw Agent:
→ 调用 cli-anything-shotcut project new --name "merged-project"
→ 调用 cli-anything-shotcut import file --input ./intro.mp4 --track video
→ 调用 cli-anything-shotcut import file --input ./demo.mp4 --track video
→ 调用 cli-anything-shotcut transition add --type "fade" --duration 1
→ 调用 cli-anything-shotcut render output --format mp4 --codec h264
✅ 视频已导出!

OpenClaw 版本实现了 Windows 兼容的路径处理:

# cygpath guard for cross-platform compatibility
import subprocess
import sys
import os
def get_native_path(path):
"""Convert path for the current platform."""
if sys.platform == 'win32':
# Use cygpath on Windows if available
try:
result = subprocess.run(
['cygpath', '-w', path],
capture_output=True,
text=True
)
if result.returncode == 0:
return result.stdout.strip()
except FileNotFoundError:
# Fallback to os.path for MSYS/MSYS2
pass
return path

这确保了生成的 CLI 在 Windows、macOS、Linux 上都能正常工作。


将 CLI-Anything 生成的 CLI 封装为 OpenClaw Skill:

SKILL.md
# GIMP CLI Skill
## 使用场景
当用户需要处理图片(裁剪、滤镜、格式转换等)时使用此 Skill。
## 可用命令
- `cli-anything-gimp image new` — 创建新图像
- `cli-anything-gimp filter apply` — 应用滤镜
- `cli-anything-gimp export file` — 导出文件
- `cli-anything-gimp layer add` — 添加图层
## 示例
用户说"把这张图裁剪成 800x600":
→ 运行 cli-anything-gimp image crop --width 800 --height 600 --input <图片路径>

利用 OpenClaw 的 Cron 功能实现定时自动化:

# 每天凌晨 2 点自动备份 LibreOffice 文档
cron:
- schedule: "0 2 * * *"
task: "用 LibreOffice CLI 将 /docs 目录下所有 .odt 转为 PDF 并备份到 /backup"

解决

Terminal window
# 确认 CLI 在 PATH 中
which cli-anything-gimp
# 如果不在,创建软链接
sudo ln -s /path/to/cli-anything-gimp /usr/local/bin/

解决

Terminal window
# 更新 OpenClaw Skill 索引
openclaw skills update
# 清除缓存重试
openclaw skills install gimp --force

解决:确保安装 Git for Windows,它自带 cygpath 工具。如果没有,可以在 OpenClaw 配置中禁用 cygpath:

~/.qclaw/config.yaml
cli-anything:
use_cygpath: false