src/process/resources/skills/openclaw-setup/references/best-practices.md
openclaw doctorAGENTS.md 定义 Agent 行为TOOLS.md 启用所需工具示例:创建一个代码审查机器人
# 1. 创建新的 Agent
openclaw agents add code-review --workspace ~/.openclaw/workspace-code-review
# 2. 编辑工作区的 AGENTS.md,定义代码审查逻辑
# 3. 配置 TOOLS.md,启用 GitHub 相关工具
# 4. 测试
openclaw agent --agent code-review --message "审查这个 PR: https://github.com/..."
openclaw cron 设置定时任务openclaw webhooks 接收外部触发AGENTS.md 定义任务逻辑示例:每日报告任务
# 设置每日 9 点执行
openclaw cron add "0 9 * * *" --message "生成每日报告" --agent main
# Agent 的 AGENTS.md 中定义报告生成逻辑
openclaw agents add <name>openclaw.json 中示例配置:
{
agents: {
list: [
{ id: 'work', workspace: '~/.openclaw/workspace-work' },
{ id: 'personal', workspace: '~/.openclaw/workspace-personal' },
],
},
bindings: [
{
match: { channel: 'slack', accountId: 'work-account' },
agent: 'work',
},
{
match: { channel: 'telegram' },
agent: 'personal',
},
],
}
gateway.mode=remotegateway.remote.url 和认证示例:通过 SSH 隧道连接
# 在本地机器上
ssh -N -L 18789:127.0.0.1:18789 user@remote-server
# 在另一个终端
openclaw gateway status # 应该能连接到远程 Gateway
工作区包含 Agent 的记忆和配置,建议定期备份:
# 使用 git 备份(推荐)
cd ~/.openclaw/workspace
git init
git add .
git commit -m "Backup workspace"
# 推送到私有仓库
git remote add origin [email protected]:username/openclaw-workspace.git
git push -u origin main
~/.openclaw/openclaw.json~/.openclaw/workspace~/.openclaw/credentials/openclaw doctor 检查配置~/.openclaw/openclaw.json 权限为 600pairing 策略,避免开放 DM