← 返回
数据分析 中文

Create Agent With Telegram Group

Create a new OpenClaw agent and bind it to a dedicated Telegram group with workspace ~/claw-<agent-name>. Use when the user asks for one-agent-one-group setu...
创建新的OpenClaw代理,绑定专属Telegram群组,工作区为~/claw-<代理名>。适用于用户请求单代理单群组设置。
sheetaa
数据分析 clawhub v0.1.5 1 版本 99893.7 Key: 无需
★ 0
Stars
📥 940
下载
💾 12
安装
1
版本
#latest

概述

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)
  • scripts/init_workspace.py 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)
  • ~/.openclaw/cron/jobs.json — read-only (for job listing if needed)
  • ~/claw-/ — workspace directory created by script
  • ~/.openclaw/agents//agent/ — 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..
  • It updates only:
  • agents.list (add/update target agent) — does NOT copy auth credentials
  • bindings (add target telegram group binding)
  • channels.telegram.groups..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)
  • model (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).
  2. Build workspace path as ~/claw- and create it if missing.
  3. 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 --model --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 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 --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).
  10. 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.
  2. If needed, run openclaw --help for the relevant subcommand.
  3. Use only discovered command forms.

Idempotency

  • If ~/claw- 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:
  • model:
  • workspace: ~/claw-
  • telegram_group: </li><li><code>chat_id</code>: <id or PENDING></li><li><code>binding</code>: <done|pending></li><li><code>reply_without_mention</code>: <enabled|disabled></li><li><code>initialized_files</code>: <USER.md, IDENTITY.md, SOUL.md or subset></li><li><code>verification</code>: <passed|failed></li><li><code>next_step</code>: <none or exact minimal action></li></ul></div> </div> </div> <div id="tab-versions" class="detail-content"> <div class="detail-section"> <h2>版本历史</h2> <p style="margin-bottom:12px;font-size:14px;color:#94a3b8;">共 1 个版本</p> <ul class="version-list"> <li> <div> <span class="version-tag">v0.1.5</span> <span style="font-size:11px;color:#5b6abf;margin-left:8px;background:#eef0ff;padding:1px 8px;border-radius:10px;">当前</span> </div> <div style="font-size:12px;color:#94a3b8;"> 2026-03-29 10:27 安全 安全 </div> </li> </ul> </div> </div> <div id="tab-security" class="detail-content"> <div class="detail-section"> <h2>安全检测</h2> <div class="sec-grid"> <div class="sec-card"> <h4>腾讯云安全 (Keen)</h4> <div class="sec-status sec-safe"> 安全,无风险 </div> <a href="https://tix.qq.com/search/skill?keyword=b5a29834114d8271ad80c0933bd886f5" target="_blank">查看报告</a> </div> <div class="sec-card"> <h4>腾讯云安全 (Sanbu)</h4> <div class="sec-status sec-safe"> 安全,无风险 </div> <a href="https://static.cloudsec.tencent.com/html-report-v2/2026/05/25/398912_4a693ceb5d41fce4e1bfccdcb041c212.html?q-sign-algorithm=sha1&q-ak=AKID8JMG1bzBC1dz96qNhssfFftujT1NCoFi&q-sign-time=1781289043%3B1812825043&q-key-time=1781289043%3B1812825043&q-header-list=host&q-url-param-list=&q-signature=ec7dfaf406f2c238321ce88bca4c580f8579ca2c" target="_blank">查看报告</a> </div> </div> </div> </div> <!-- Recommended Skills --> <div style="margin-top:24px;"> <h2 style="font-size:18px;font-weight:600;margin-bottom:16px;">🔗 相关推荐</h2> <div class="rec-grid"> <div class="rec-card"> <span class="badge-cat" style="margin-bottom:8px;display:inline-block;">data-analysis</span> <h3><a href="/s/akshare-stock">A股量化 AkShare</a></h3> <div class="rec-owner">mbpz</div> <div class="rec-desc">A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。</div> <div class="rec-stats"> <span style="color:#f39c12;">★ 164</span> <span style="color:#5b6abf;">📥 59,789</span> </div> </div> <div class="rec-card"> <span class="badge-cat" style="margin-bottom:8px;display:inline-block;">communication-collaboration</span> <h3><a href="/s/delete-agent-with-telegram-group">Delete Agent With Telegram Group</a></h3> <div class="rec-owner">sheetaa</div> <div class="rec-desc">安全彻底地删除 OpenClaw 代理及其制品。用户要求完全移除代理(包括工作区、~/... 下的代理文件)时使用。</div> <div class="rec-stats"> <span style="color:#f39c12;">★ 0</span> <span style="color:#5b6abf;">📥 828</span> </div> </div> <div class="rec-card"> <span class="badge-cat" style="margin-bottom:8px;display:inline-block;">data-analysis</span> <h3><a href="/s/data-analysis">Data Analysis</a></h3> <div class="rec-owner">ivangdavila</div> <div class="rec-desc">{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}</div> <div class="rec-stats"> <span style="color:#f39c12;">★ 198</span> <span style="color:#5b6abf;">📥 64,958</span> </div> </div> </div> </div> </div> <script> document.addEventListener('DOMContentLoaded',function(){ document.querySelectorAll('.detail-tab').forEach(function(btn){ btn.addEventListener('click',function(e){ var tab = this.getAttribute('data-tab'); document.querySelectorAll('.detail-tab').forEach(function(b){b.classList.remove('active')}); document.querySelectorAll('.detail-content').forEach(function(c){c.classList.remove('active')}); this.classList.add('active'); var el = document.getElementById('tab-'+tab); if(el) el.classList.add('active'); }); }); }); </script> <div class="footer"> <p>Skill工具集 © 2026</p> </div></body> </html>