ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

agent-factory

创建新的 OpenClaw Agent 并自动配置飞书机器人。当用户说"帮我创建 Agent"、"新建机器人"、"添加新 agent"、"配置新机器人"时触发。用户提供:agent 名称、飞书 appId、appSecret、角色定位。执行完毕后汇报结果。

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/beyondbright/walter-agent-factory
Or

agent-factory

自动创建新 OpenClaw Agent 并绑定飞书机器人。

输入参数

用户需提供:

参数说明示例
nameAgent 名称(英文,无空格)baikexia
displayName显示名称百科虾
appId飞书机器人 App IDcli_xxx
appSecret飞书机器人 Secretxxx
identity角色定位描述蜗牛公司问答助手
soul行为准则(可选)不准加没要求的功能、不准过度封装、不准瞎重构、不准假装测试通过、不准加装成功、先读再改不准盲改
skill要安装的 clawhub skill 名称(可选)wikipedia

执行流程

Step 1: 验证凭证

调用飞书 API 验证 appId/appSecret:

$body = @{
  app_id = $appId
  app_secret = $appSecret
} | ConvertTo-Json

$resp = Invoke-RestMethod -Uri "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" `
  -Method POST `
  -Body $body `
  -ContentType "application/json"

if ($resp.code -ne 0) { throw "凭证无效:$($resp.msg)" }

Step 2: 创建 Agent

openclaw agents add $name --workspace "$env:USERPROFILE\.openclaw\workspace-$name"

Step 3: 配置飞书账号

读取当前配置,追加新账号:

$config = Get-Content "$env:USERPROFILE\.openclaw\openclaw.json" -Raw | ConvertFrom-Json
$config.channels.feishu.accounts | Add-Member -NotePropertyName $name -NotePropertyValue @{
  appId = $appId
  appSecret = $appSecret
  name = $displayName
}

Step 4: 配置路由规则

追加 binding(如已存在则跳过):

$existingBinding = $config.bindings | Where-Object {
    $_.agentId -eq $name -and $_.match.accountId -eq $name
}
if (-not $existingBinding) {
    $config.bindings += @{
        type = "route"
        agentId = $name
        match = @{ channel = "feishu"; accountId = $name }
    }
}

Step 5: 原子写入配置文件

先备份,再写入临时文件,最后 Move-Item 替换,防止写入损坏导致配置丢失:

$configPath = "$env:USERPROFILE\.openclaw\openclaw.json"
$backupPath = "$env:USERPROFILE\.openclaw\openclaw.json.bak"
$tempPath = "$env:USERPROFILE\.openclaw\openclaw.json.tmp"

Copy-Item $configPath $backupPath -Force
$config | ConvertTo-Json -Depth 100 -Compress | Set-Content $tempPath -NoNewline -Encoding UTF8
Move-Item $tempPath $configPath -Force

Step 6: 创建角色文件

$env:USERPROFILE\.openclaw\workspace-{name}/ 下创建:

  • IDENTITY.md — 名字、emoji、定位
  • SOUL.md — 行为准则(用户提供的 soul 或默认模板)
  • AGENTS.md — 工作手册(可选)
  • USER.md — 用户占位符

Step 7: 安装 Skill(如有指定)

使用 clawhub install 将 skill 安装到新 agent 的 workspace 下,而非当前 active workspace:

clawhub install <skill-name> --workdir "$env:USERPROFILE\.openclaw\workspace-$Name"

注意:PowerShell 变量在字符串中需要用 " 包围双引号,或者先拼接路径再传入。

Step 8: 开启工具权限

openclaw config set channels.feishu.tools.wiki true
openclaw config set channels.feishu.tools.doc true
openclaw config set channels.feishu.tools.drive true

Step 9: 重启网关

openclaw gateway restart

完整脚本

提供两个版本:Windows (PowerShell)Linux/macOS (Bash + jq)

Linux / macOS (Bash)

将以下脚本保存为 create-agent.sh,执行 chmod +x create-agent.sh 后运行:

#!/usr/bin/env bash
# create-agent.sh — Linux/macOS 版(需安装 jq)
set -euo pipefail

Metadata

Stars4473
Views0
Updated2026-05-01
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-beyondbright-walter-agent-factory": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.