#命令整理

1 messages · Page 1 of 1 (latest)

untold surgeBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

frank meadowBOT
#

An error occurred while processing your request. You can retry your request, or contact us through our help center at help.openai.com if the error persists. Please include the request ID req_f9672bb977be43c0ae326abdbce5a0dc in your message.

plush dew
#

@frank meadow

frank meadowBOT
#

太好了,这个需求很适合做成“给同学的一页速查表”。我先给你一版可直接转发的中文版(CLI + 手改 JSON5 都有)。


0) 先确认版本(强烈建议)

openclaw --version

1) 安装 OpenClaw

方式 A(官方最快)

curl -fsSL https://openclaw.ai/install.sh | bash
#
openclaw onboard --install-daemon
openclaw gateway status
openclaw dashboard

方式 B(源码 + pnpm,适合折腾)

git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install
pnpm build
pnpm ui:build
pnpm openclaw onboard --install-daemon

#

2) 创建 agents(多人格 / 多工作区)

CLI

openclaw agents add study --workspace ~/.openclaw/workspace-study
openclaw agents list --bindings
openclaw agents bind --agent study --bind telegram:study

手动改 ~/.openclaw/openclaw.json(JSON5)

{
agents: {
list: [
{ id: "main", default: true, workspace: "~/.openclaw/workspace-main" },
{ id: "study", workspace: "~/.openclaw/workspace-study" },
#
],
},
bindings: [
{ agentId: "study", match: { channel: "telegram", accountId: "study" } },
],
}

3) 配置新的模型(默认模型 / 别名 / fallback)

CLI

openclaw models status
#
openclaw models list
openclaw models set anthropic/claude-sonnet-4-6
openclaw models fallbacks add openai/gpt-5.4
openclaw models aliases add sonnet anthropic/claude-sonnet-4-6

手动 JSON5

{
agents: {
defaults: {
model: {
primary: "anthropic/claude-sonnet-4-6",
fallbacks: ["openai/gpt-5.4"],
},
#
models: {
"anthropic/claude-sonnet-4-6": { alias: "sonnet" },
"openai/gpt-5.4": { alias: "gpt" },
},
},
},
}

4) 配置新的 channel(以 Telegram / Discord 为例)

CLI(推荐先走交互)

#
openclaw channels add --channel telegram
openclaw channels add --channel discord
openclaw channels list
openclaw channels status --probe

Telegram 手动 JSON5

{
channels: {
telegram: {
enabled: true,
botToken: "123456:ABC...",
dmPolicy: "pairing",
groups: { "*": { requireMention: true } },
#
},
},
}

Discord 手动 JSON5(推荐 token 用 env SecretRef)

{
channels: {
discord: {
enabled: true,
token: { source: "env", provider: "default", id: "DISCORD_BOT_TOKEN" },
groupPolicy: "allowlist",
guilds: {
"YOUR_GUILD_ID": {
#
requireMention: true,
users: ["YOUR_USER_ID"],
},
},
},
},
}

5) 下载 skills

CLI(最常用)

#
openclaw skills search "calendar"
openclaw skills install <skill-slug>
openclaw skills update --all
openclaw skills list --eligible
openclaw skills check

手动 JSON5(启用/禁用、扩展目录)

{
skills: {
load: {
extraDirs: ["~/my-shared-skills"],
},
entries: {
#
"my-skill": { enabled: true },
},
},
}

6) 配置沙箱(sandbox)

CLI(检查 / 重建)

openclaw sandbox explain
openclaw sandbox list
openclaw sandbox recreate --all
#

手动 JSON5(安全起步模板)

{
agents: {
defaults: {
sandbox: {
mode: "non-main", // off | non-main | all
backend: "docker", // docker | ssh | openshell
scope: "session", // session | agent | shared
workspaceAccess: "none",
docker: {
image: "openclaw-sandbox:bookworm-slim",
network: "none",
},
},
},
#
},
}

如果你是源码安装,首次常见还会做一次 sandbox 镜像准备:scripts/sandbox-setup.sh


7) 常用斜杠命令(给同学最实用版)

  • /help:命令总览
  • /status:当前状态
  • /model / /model list / /model <name>:切模型
  • /new/reset:开新会话
  • /compact:压缩上下文
  • /stop:停止当前任务
#
  • /queue <mode>:调消息队列策略
  • /subagents ...:子代理管理
  • /think <level>:思考强度
  • /verbose on|off:详细输出
  • /reasoning on|off:推理输出开关
  • /elevated on|off|full:exec 提权模式

大多数 slash 命令要作为单独一条消息发送(以 / 开头)。


8) 配置文件位置与常用配置命令

  • 配置文件:~/.openclaw/openclaw.jsonJSON5,可注释)
  • 查看当前配置路径:
#
openclaw config file
  • 常用:
openclaw config get agents.defaults.workspace
openclaw config set agents.defaults.workspace "~/.openclaw/workspace"
openclaw config validate

官方文档入口(建议一起发给同学):