Agent Create + Dedicated Telegram Group
Create one dedicated Telegram group per agent, bind the agent to that group, and set an isolated workspace path.
Script-first Rule
Prefer bundled scripts for deterministic steps (more stable + lower token cost). Only do manual JSON editing when scripts cannot cover a special case.
Use:
- -
scripts/provision_config.py for agent/config/binding/no-mention setup (with automatic backup of openclaw.json) - INLINECODE2 for
USER.md / IDENTITY.md / SOUL.md initialization
Access Scope
This skill accesses the following files on the host:
- -
~/.openclaw/openclaw.json — read (model discovery) and write (agent binding) - INLINECODE7 — read-only (for job listing if needed)
- INLINECODE8 — workspace directory created by script
- INLINECODE9 — directory created (no auth files copied)
Config Safety
- -
scripts/provision_config.py reads and writes ~/.openclaw/openclaw.json. - By default it creates a backup file:
~/.openclaw/openclaw.json.bak.<timestamp>. - It updates only:
-
agents.list (add/update target agent) — does NOT copy auth credentials
-
bindings (add target telegram group binding)
-
channels.telegram.groups.<chat_id>.requireMention=false
-
gateway.reload.mode only if missing (sets default
hybrid)
- - The skill does NOT propagate API keys or auth tokens between agents.
- Gateway-level auth is inherited automatically; do not manually copy auth files.
Inputs
Collect (before executing):
- -
agent_name (required) - INLINECODE19 (required): ask user explicitly which model to use; model options must be read live from the user’s
~/.openclaw/openclaw.json (do not hardcode examples) - Optional
telegram_group_title override (custom group name) - Initialization preferences (required ask):
- whether to create/update
USER.md
- whether to create/update
IDENTITY.md
- whether to create/update
SOUL.md
- - If initialization is enabled, collect content fields before writing files:
-
USER.md: user name / preferred call name / language / goals / notes
-
IDENTITY.md: agent display name / vibe / emoji (optional)
-
SOUL.md: role/mission / tone / constraints (short bullet points)
Normalize agent_name:
- - Keep lowercase letters, digits, and hyphens only.
- Replace spaces/underscores with
-. - Use this value in paths and IDs.
Telegram group title rule:
- - If user provides
telegram_group_title, use it directly. - If not provided, generate default title from agent name in PascalCase.
- Example:
test-skill ->
TestSkill,
bilingual-agent ->
BilingualAgent.
Workflow
- 1. Read available models from
~/.openclaw/openclaw.json first, then confirm inputs with user (agent name, model, init-file preferences, optional telegram group title). - Build workspace path as
~/claw-<agent-name> and create it if missing. - Resolve group title:
- custom
telegram_group_title if provided
- otherwise PascalCase(agent_name)
- 4. Create and bind Telegram group (use resolved group title):
- use browser automation/user-account flow (Telegram bot API cannot reliably create groups)
-
CONFIRM with user before triggering browser automation (explicit yes/no required)
- if browser automation is unavailable, request the minimal manual steps and resume
- 5. Create/update OpenClaw config via script (preferred):
-
CONFIRM with user before modifying openclaw.json (explicit yes/no required)
-
python3 scripts/provision_config.py --agent-name <agent_name> --model <model> --chat-id <chat_id>
- this sets: agent entry, workspace, binding, and
requireMention=false
- 6. Apply config and activate it:
- if hot reload is enabled, verify reload logs show applied changes
- if reload is off or not applied,
CONFIRM with user before restarting gateway (explicit yes/no required)
- restart gateway only after user approval
- 7. Bootstrap agent runtime files (required for first-run stability):
- ensure
~/.openclaw/agents/<agent-id>/agent exists
- do NOT copy any auth files from other agents (this prevents credential/API key propagation)
- new agents inherit authentication from the gateway's shared auth context automatically
- do NOT manually copy or create auth-profiles.json, auth.json, or models.json
- 8. If initialization is requested, ask user for file content fields first, then write files:
- collect required values for
USER.md /
IDENTITY.md /
SOUL.md
- then run:
python3 scripts/init_workspace.py --workspace <workspace> --agent-name <agent_name> [--with-user] [--with-identity] [--with-soul]
- if user provided custom text, apply it after script initialization (overwrite placeholders)
- 9. Ensure routing validity for current schema (no invalid allowFrom entries for groups).
- Post-provision verification:
- send a test message in group and ask user to send
ping
- confirm agent responds without
@mention
- 11. Return completion summary with:
- agent name
- model
- workspace path
- group title
- chat_id
- no-mention reply mode (
enabled/
disabled)
- status and next step (if any)
Telegram Automation Rules
- - Group creation/deletion and member operations should use browser automation (user-account flow).
- For browser flow, prefer Chrome relay profile for existing logged-in Telegram sessions.
- If no connected Chrome tab is available, ask user to attach once, then continue.
- If Telegram shows confirmation/captcha that cannot be automated, request one manual click, then resume.
OpenClaw Command Discovery
Do not invent OpenClaw commands.
When agent create/update command syntax is unknown:
- 1. Run
openclaw help. - If needed, run
openclaw <subcommand> --help for the relevant subcommand. - Use only discovered command forms.
Idempotency
- - If
~/claw-<agent-name> already exists, reuse it. - If a same-name group already exists, confirm whether to reuse or create a fresh one.
- If agent already exists, update model/binding/workdir instead of duplicating.
Reliability Checks (must do)
- - Verify
requireMention=false for the bound group. - Verify gateway config actually applied:
- check reload mode/status logs (
config hot reload applied,
restarting telegram channel)
- if reload is
off or not applied, restart gateway and re-check logs.
- - Send one bot-originated test message to the new group, then require one live user
ping. - Verify agent replies without
@mention. - Do not claim success before
ping -> pong verification passes.
Failure Handling
If group creation succeeds but binding fails:
- - Keep created group.
- Report exact failed step.
- Provide one-command resume instruction for the next run.
If chat_id cannot be resolved automatically:
- - Report that as a partial success.
- Provide the shortest fallback step to fetch chat_id, then continue binding.
Output Template
Return concise status:
- -
agent: - INLINECODE60 :
- INLINECODE61 : INLINECODE62
- INLINECODE63 :
- INLINECODE64 :
- INLINECODE65 :
- INLINECODE66 :
- INLINECODE67 :
- INLINECODE68 :
- INLINECODE69 :
创建智能体 + 专属Telegram群组
为每个智能体创建一个专属Telegram群组,将智能体绑定到该群组,并设置隔离的工作区路径。
脚本优先规则
优先使用内置脚本执行确定性步骤(更稳定 + 更低的Token成本)。仅在脚本无法处理特殊情况时才手动编辑JSON。
使用:
- - scripts/provisionconfig.py 进行智能体/配置/绑定/免提及设置(自动备份 openclaw.json)
- scripts/initworkspace.py 初始化 USER.md / IDENTITY.md / SOUL.md
访问范围
本技能可访问主机上的以下文件:
- - ~/.openclaw/openclaw.json — 读取(模型发现)和写入(智能体绑定)
- ~/.openclaw/cron/jobs.json — 只读(需要时查看任务列表)
- ~/claw-<智能体名称>/ — 由脚本创建的工作区目录
- ~/.openclaw/agents/<智能体ID>/agent/ — 创建的目录(不复制认证文件)
配置安全
- - scripts/provision_config.py 读取和写入 ~/.openclaw/openclaw.json。
- 默认情况下会创建备份文件:~/.openclaw/openclaw.json.bak.<时间戳>。
- 仅更新:
- agents.list(添加/更新目标智能体)— 不复制认证凭据
- bindings(添加目标Telegram群组绑定)
- channels.telegram.groups.
.requireMention=false
- gateway.reload.mode(仅在缺失时设置默认值 hybrid)
- - 本技能不会在智能体之间传播API密钥或认证令牌。
- 网关级别的认证会自动继承;请勿手动复制认证文件。
输入
执行前收集:
- - agentname(必填)
- model(必填):明确询问用户使用哪个模型;模型选项必须从用户的 ~/.openclaw/openclaw.json 实时读取(不要硬编码示例)
- 可选 telegramgroup_title 覆盖(自定义群组名称)
- 初始化偏好(必填询问):
- 是否创建/更新 USER.md
- 是否创建/更新 IDENTITY.md
- 是否创建/更新 SOUL.md
- USER.md:用户名/偏好称呼/语言/目标/备注
- IDENTITY.md:智能体显示名称/风格/表情符号(可选)
- SOUL.md:角色/使命/语气/约束(简短要点)
规范化 agent_name:
- - 仅保留小写字母、数字和连字符。
- 将空格/下划线替换为 -。
- 在路径和ID中使用此值。
Telegram群组标题规则:
- - 如果用户提供了 telegramgrouptitle,直接使用。
- 如果未提供,根据智能体名称生成帕斯卡命名法的默认标题。
- 示例:test-skill -> TestSkill,bilingual-agent -> BilingualAgent。
工作流程
- 1. 首先从 ~/.openclaw/openclaw.json 读取可用模型,然后与用户确认输入(智能体名称、模型、初始化文件偏好、可选的Telegram群组标题)。
- 构建工作区路径为 ~/claw-<智能体名称>,如果不存在则创建。
- 解析群组标题:
- 如果提供了自定义 telegramgrouptitle 则使用
- 否则使用帕斯卡命名法(agent_name)
- 4. 创建并绑定Telegram群组(使用解析后的群组标题):
- 使用浏览器自动化/用户账户流程(Telegram机器人API无法可靠创建群组)
- 在触发浏览器自动化前与用户确认(需要明确的同意/拒绝)
- 如果浏览器自动化不可用,请求最少的手动步骤并继续
- 5. 通过脚本创建/更新OpenClaw配置(首选):
- 在修改openclaw.json前与用户确认(需要明确的同意/拒绝)
- python3 scripts/provision_config.py --agent-name <智能体名称> --model <模型> --chat-id <聊天ID>
- 设置:智能体条目、工作区、绑定和 requireMention=false
- 6. 应用配置并激活:
- 如果启用了热重载,验证重载日志显示已应用的更改
- 如果重载关闭或未应用,在重启网关前与用户确认(需要明确的同意/拒绝)
- 仅在用户批准后重启网关
- 7. 引导智能体运行时文件(首次运行稳定性必需):
- 确保 ~/.openclaw/agents/<智能体ID>/agent 存在
- 不要从其他智能体复制任何认证文件(防止凭据/API密钥传播)
- 新智能体会自动从网关的共享认证上下文继承认证
- 不要手动复制或创建 auth-profiles.json、auth.json 或 models.json
- 8. 如果请求初始化,先询问用户文件内容字段,然后写入文件:
- 收集 USER.md / IDENTITY.md / SOUL.md 的必需值
- 然后运行:python3 scripts/init_workspace.py --workspace <工作区> --agent-name <智能体名称> [--with-user] [--with-identity] [--with-soul]
- 如果用户提供了自定义文本,在脚本初始化后应用(覆盖占位符)
- 9. 确保当前架构的路由有效性(群组没有无效的 allowFrom 条目)。
- 配置后验证:
- 在群组中发送测试消息,并要求用户发送 ping
- 确认智能体无需 @提及 即可响应
- 11. 返回完成摘要,包含:
- 智能体名称
- 模型
- 工作区路径
- 群组标题
- 聊天ID
- 免提及回复模式(启用/禁用)
- 状态和下一步(如果有)
Telegram自动化规则
- - 群组创建/删除和成员操作应使用浏览器自动化(用户账户流程)。
- 对于浏览器流程,优先使用Chrome中继配置文件进行已登录的Telegram会话。
- 如果没有可用的已连接Chrome标签页,要求用户连接一次,然后继续。
- 如果Telegram显示无法自动化的确认/验证码,请求一次手动点击,然后继续。
OpenClaw命令发现
不要发明OpenClaw命令。
当智能体创建/更新命令语法未知时:
- 1. 运行 openclaw help。
- 如果需要,运行 openclaw <子命令> --help 查看相关子命令。
- 仅使用发现的命令形式。
幂等性
- - 如果 ~/claw-<智能体名称> 已存在,则重用。
- 如果同名的群组已存在,确认是重用还是创建新群组。
- 如果智能体已存在,更新模型/绑定/工作目录而不是重复创建。
可靠性检查(必须执行)
- - 验证绑定群组的 requireMention=false。
- 验证网关配置实际已应用:
- 检查重载模式/状态日志(config hot reload applied,restarting telegram channel)
- 如果重载为 off 或未应用,重启网关并重新检查日志。
- - 向新群组发送一条机器人发起的测试消息,然后要求一个实时用户 ping。
- 验证智能体无需 @提及 即可回复。
- 在 ping -> pong 验证通过之前,不要声称成功。
失败处理
如果群组创建成功但绑定失败:
- - 保留已创建的群组。
- 报告确切失败的步骤。
- 提供下次运行的单命令恢复说明。
如果无法自动解析聊天ID:
- - 报告为部分成功。
- 提供获取聊天ID的最短回退步骤,然后继续绑定。
输出模板
返回简洁状态:
- - agent:<智能体名称>
- model:<所选模型>
- workspace:~/claw-<智能体名称>
- telegramgroup:<标题>
- chatid:
- binding:<完成|待处理>
- replywithoutmention:<启用|禁用>
- initializedfiles:
- verification:<通过|失败>
- nextstep:<无 或 确切的最小操作>