openclaw 使用技巧
ufw
本文字数:1.5k 字 | 阅读时长 ≈ 7 min

openclaw 使用技巧

ufw
本文字数:1.5k 字 | 阅读时长 ≈ 7 min

1. 一些常用命令

2. session 交互

3. 模型设置

4. agent 交互

5. 日志相关

6. skills

在 OpenClaw 里,skill 本质上就是一个目录,其中包含 SKILL.md 文件。OpenClaw 中 skill 有两种常见放置位置

当前 agent 专用 skill,这类 skill 只对当前 workspace 对应的 agent 生效

~/.openclaw/workspace/skills/
~/.openclaw/workspace/skills/hello_world

如果要让本机所有 agent 都可以使用这个 skill,放到这里,这样所有agent都能看到

~/.openclaw/skills/
~/.openclaw/skills/hello_world

1. 创建一个最简单的 Skill

下面以一个最简单的 hello_world skill 为例。假设这个 skill 是共享 skill

mkdir -p ~/.openclaw/skills/hello_world

2. 创建 SKILL.md

以通用 skill 为例

cat > ~/.openclaw/skills/hello_world/SKILL.md <<'EOF'
---
name: hello_world
description: A simple skill that says hello.
---

# Hello World Skill

When the user asks for a greeting, reply with:

Hello from your custom skill!
EOF

创建完 skill 后,需要让 OpenClaw 重新加载。重启 gateway,就可以看到新添加的 skill 了

➜ ~ systemctl --user restart openclaw-gateway
➜ ~ sleep 3
➜ ~ openclaw skills list --eligible
🦞 OpenClaw 2026.2.23 (b817600) — I'm basically a Swiss Army knife, but with more opinions and fewer sharp edges.

Skills (7/7 ready)
┌──────────┬──────────────────┬────────────────────────────────────────────────────────────────┬────────────────────┐
│ Status   │ Skill            │ Description                                                    │ Source             │
├──────────┼──────────────────┼────────────────────────────────────────────────────────────────┼────────────────────┤
...
│          │                  │ and assets.                                                    │                    │
│ ✓ ready  │ 🌤️ weather       │ Get current weather and forecasts via wttr.in or Open-Meteo.   │ openclaw-bundled   │
│          │                  │ Use when: user asks about weather, temperature, or forecasts   │                    │
│          │                  │ for any location. NOT for: historical weather data, severe     │                    │
│          │                  │ weather alerts, or detailed meteorological analysis. No API    │                    │
│          │                  │ key needed.                                                    │                    │
│ ✓ ready  │ 📦 hello_world    │ A simple skill that says hello.                                │ openclaw-managed   │
└──────────┴──────────────────┴────────────────────────────────────────────────────────────────┴────────────────────┘

3. 如何使用 skill

自然语言触发

直接在 TUI、Telegram 或本地消息中描述需求。如果 skill 写得足够清楚,模型会自动使用它

请用 hello_world skill 跟我打个招呼
跟我打个招呼

/skill 显式调用

/skill hello_world
/skill hello_world greet me

对话中的常用命令

相关例子

  1. 删除 session:key 就是你要删除的 session,见下面例子
cp ~/.openclaw/agents/main/sessions/sessions.json ~/.openclaw/agents/main/sessions/sessions.json.bak.$(date +%Y%m%d-%H%M%S)

python3 - <<'PY'
import json
from pathlib import Path

p = Path.home() / ".openclaw/agents/main/sessions/sessions.json"
key = "agent:main:newsession"

data = json.loads(p.read_text(encoding="utf-8"))
if key in data:
    del data[key]
    p.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
    print(f"Deleted: {key}")
else:
    print(f"Key not found: {key}")
PY

删完以后记得重启 systemctl --user restart openclaw-gateway

  1. 添加模型:openclaw models set github-copilot/gpt-4o
➜ ~ openclaw models list

🦞 OpenClaw 2026.2.23 (b817600) — I'll butter your workflow like a lobster roll: messy, delicious, effective.

Model                                      Input      Ctx      Local Auth  Tags
github-copilot/gpt-5-mini                  text+image 125k     no    yes   default,configured
➜ ~ openclaw models set github-copilot/gpt-4o
🦞 OpenClaw 2026.2.23 (b817600)
   If it's repetitive, I'll automate it; if it's hard, I'll bring jokes and a rollback plan.

Config overwrite: /home/yonghuiwang/.openclaw/openclaw.json (sha256 5db3d5fc1e007d8ecff4f5f6c40eba7bb779082204582bb441d1b0909493fd6a -> 121a640420b0e5a763d8ede1f88a7a6a772ffd07cc2fb03a5ae6ba419ef4df1e, backup=/home/yonghuiwang/.openclaw/openclaw.json.bak)
Updated ~/.openclaw/openclaw.json
Default model: github-copilot/gpt-4o
➜ ~ openclaw models set github-copilot/gpt-4o
➜ ~ openclaw models list                     
🦞 OpenClaw 2026.2.23 (b817600) — I speak fluent bash, mild sarcasm, and aggressive tab-completion energy.

Model                                      Input      Ctx      Local Auth  Tags
github-copilot/gpt-4o                      text+image 63k      no    yes   default,configured
github-copilot/gpt-5-mini                  text+image 125k     no    yes   configured
➜ ~ 

一些问题

1. telegram 无法输入图片

Telegram 文本消息正常,但 Telegram 图片下载失败,这和最近 OpenClaw 社区里报告的 Telegram 媒体下载代理问题一致:普通 Bot API 请求能通,但媒体文件下载链路不会可靠地走环境变量代理,解决办法通常是显式配置 channels.telegram.proxy,必要时再加 ipv4first。

➜ ~ openclaw logs --follow                   

🦞 OpenClaw 2026.2.23 (b817600) — Your terminal just grew claws—type something and let the bot pinch the busywork.

Log file: /tmp/openclaw/openclaw-2026-03-13.log
09:00:52 error gateway/channels/telegram {"subsystem":"gateway/channels/telegram"} Telegram command sync failed: HttpError: Network request for 'setMyCommands' failed!
..................
09:33:24 info gateway/channels/telegram {"subsystem":"gateway/channels/telegram"} telegram sendMessage ok chat=1907660075 message=40
09:41:42 warn telegram-auto-reply {"module":"telegram-auto-reply"} {"chatId":1907660075,"error":"MediaFetchError: Failed to fetch media from https://api.telegram.org/file/bot8744486052:AAESKZbOuudvaPOoXnOKjMQ_axJmFQOwAWU/photos/file_3.jpg: TypeError: fetch failed"} media fetch failed
09:42:46 info gateway/reload {"subsystem":"gateway/reload"} config change detected; evaluating reload (channels.telegram.network, channels.telegram.proxy)

修改也比较简单,如下,加入 proxy 和 network 这两行即可

➜ ~ vim ~/.openclaw/openclaw.json

"channels": {
  "telegram": {
    "enabled": true,
    "dmPolicy": "pairing",
    "botToken": "8744486052:xxxxxxxxxxxx",
    "groupPolicy": "allowlist",
    "streaming": "off",
    "proxy": "http://127.0.0.1:10809",
    "network": {
      "dnsResultOrder": "ipv4first",
      "autoSelectFamily": false
    }
  }
}

2. 主要 api 性能排行

排行网站:https://pinchbench.com/

3月 13, 2026
ufw
12月 14, 2025
8月 26, 2025