微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🤖

OpenClaw代理全生命周期配置专家

claw-agent-creator-archit · vv1.0.0
专业技能 安全 A 级 作者 arch1904 公开目录收录
下载 2.1k 安装 622 收藏 7.2k 浏览 90.2k
原始页面

简介

OpenClaw多代理系统专用配置向导,基于Wire代理实战经验,提供从目录创建到Telegram路由的完整生命周期管理。

原始描述

Create new OpenClaw agents for Arch's multi-agent system. Use this skill when asked to create, add, or set up a new OpenClaw agent, or when adding an agent to the system defined in ~/.openclaw/. Covers the full lifecycle: directory creation, workspace files (SOUL.md, IDENTITY.md, etc.), openclaw.json config, Telegram routing (bindings groups mention patterns), cron job creation with proper prompt engineering, and gateway restart. Includes hard-won lessons from building the Wire (News) agent — the first non-default agent in the system. Also use when modifying existing agent configs, adding cron jobs to agents, or debugging agent routing issues.

中文使用说明 来自收录源

核心用法

OpenClaw Agent Creator 是一套面向 Arch 个人多代理系统的配置管理技能,专门用于创建、配置和维护 OpenClaw 代理。其核心工作流程分为九个步骤:需求澄清→停止网关→备份配置→创建目录→编写工作区文件→编辑 openclaw.json 代理条目→配置 Telegram 路由→创建定时任务→重启验证。该技能强调"硬编码经验"的传承,特别是从首个非默认代理 Wire 的构建过程中总结的实战教训。

显著优点

实战导向的完整性:不同于通用文档,该技能提供了经过验证的配置模式,包括动态群组 ID 解析、三层 Telegram 路由系统(Group Config + Binding + Mention Patterns)等关键设计,避免了常见的静默失败问题。

风险意识嵌入:强制要求在编辑配置前停止网关(避免竞态条件)、自动备份机制、硬编码路径检查提醒等,体现了生产环境的安全思维。

自愈合设计:定时任务模板中的动态群组 ID 解析模式,确保配置在 Telegram 群组迁移后仍能正常工作,减少了运维负担。

清晰的边界划分:通过详细的参考文档(config-schema、telegram-routing、prompt-patterns、bugs-and-pitfalls)将知识模块化,便于按需查阅。

潜在缺点与局限性

高度定制化:该技能专为 Arch 的个人 OpenClaw 实例设计(Linux 用户 archit、America/Denver 时区、端口 18789),其他用户需要大量适配才能使用。

非自动化工具:本质上是指导性文档而非脚本化工具,所有操作仍需手动执行,不适合需要批量部署的场景。

单点依赖:所有代理共享同一个 Telegram 机器人和网关进程,虽然通过路由隔离,但网关故障会影响全部代理。

T3 来源限制:作为个人社区项目,缺乏官方背书和长期维护保障,用户需自行承担演进风险。

适合的目标群体

  • 已部署 OpenClaw 多代理系统的个人用户或小型团队
  • 需要为特定场景(新闻聚合、客服、数据监控)定制专用代理的开发者
  • 熟悉 Linux 环境、愿意深入理解配置细节的技术用户
  • 希望通过 Telegram 统一入口管理多个 AI 代理的场景

使用风险

配置错误风险:JSON 语法错误、路由配置遗漏(如缺少 channels.telegram.groups 会导致消息静默丢弃)可能使代理无法正常工作。

数据竞争风险:未按规范停止网关直接编辑配置,可能导致 jobs.json 状态损坏。

权限与隔离风险:agentDir 复用会导致认证会话冲突,需严格遵循目录隔离原则。

模型成本风险:未正确配置 model 字段可能导致高成本模型(Claude Sonnet)被意外调用。

来源可信度风险:T3 级别来源意味着内容未经第三方审计,建议关键配置变更前进行代码审查。

技能正文


name: claw-agent-creator-archit description: > Create new OpenClaw agents for Arch's multi-agent system. Use this skill when asked to create, add, or set up a new OpenClaw agent, or when adding an agent to the system defined in ~/.openclaw/. Covers the full lifecycle: directory creation, workspace files (SOUL.md, IDENTITY.md, etc.), openclaw.json config, Telegram routing (bindings + groups + mention patterns), cron job creation with proper prompt engineering, and gateway restart. Includes hard-won lessons from building the Wire (News) agent — the first non-default agent in the system. Also use when modifying existing agent configs, adding cron jobs to agents, or debugging agent routing issues.

OpenClaw Agent Creator

Create and configure agents for Arch's OpenClaw multi-agent system at ~/.openclaw/.

System Context

  • Owner: Archit (Arch), Linux user archit, timezone America/Denver
  • Gateway: Single process on port 18789 managing all agents
  • Bot: One Telegram bot shared across all agents — routing determines which agent handles which chat
  • Existing agents: Check ~/.openclaw/openclaw.json → agents.list[] for current roster
  • Implementation history: See ~/.openclaw/implementation-docs/ for the Wire agent reference implementation

Agent Creation Workflow

1. Gather Requirements

Before creating anything, clarify with Arch:

  • Agent name and ID (lowercase, no spaces for ID)
  • Role and responsibilities (specific, not vague)
  • Model tier: cheap (Kimi K2.5 only) or full cascade (include Claude Sonnet)
  • Whether it needs a Telegram group for Q&A
  • Whether it needs cron jobs (what schedule, what tasks)
  • Whether heartbeat should be enabled or disabled

2. Stop the Gateway

openclaw gateway stop

MANDATORY before editing openclaw.json or cron/jobs.json. The gateway actively writes to jobs.json (updating job state after each cron run). Editing while the gateway runs causes race conditions and data loss.

3. Backup Config

cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.backup.$(date +%Y%m%d%H%M%S)

4. Create Directories

mkdir -p ~/.openclaw/workspace-<agent_id>/memory
mkdir -p ~/.openclaw/agents/<agent_id>/agent

NEVER reuse agentDir across agents — causes auth/session collisions.

5. Write Workspace Files

Use templates from assets/templates/ as starting points. Every agent needs:

File Purpose Required
SOUL.md Personality, role, responsibilities, behavioral modes Yes
IDENTITY.md Quick-reference card (name, role, emoji) Yes
USER.md About Arch (copy from any existing agent workspace) Yes
AGENTS.md Workspace rules (boot sequence, memory, safety) Yes
HEARTBEAT.md Periodic task checklist (or comment if disabled) Yes

SOUL.md is the most important file. Be specific about responsibilities. Include behavioral modes if the agent operates differently in different contexts (e.g., briefing mode vs chat mode).

6. Edit openclaw.json — Agent Entry

Add to agents.list[]. See references/config-schema.md for all valid fields.

Minimal entry:

{
  "id": "<agent_id>",
  "name": "<Display Name>",
  "workspace": "/home/archit/.openclaw/workspace-<agent_id>",
  "agentDir": "/home/archit/.openclaw/agents/<agent_id>/agent",
  "identity": { "name": "<Display Name>" }
}

Common additions:

  • "model" — Override the default model cascade. Exclude expensive models for worker agents.
  • "heartbeat": { "every": "0" } — Disable heartbeat for cron-only agents.
  • "groupChat": { "mentionPatterns": ["@<id>", "@<Name>"] } — Enable @mentions in groups.

Only ONE agent should have "default": true (currently Fossil). The default agent receives all unrouted messages.

7. Edit openclaw.json — Telegram Routing (if needed)

THREE separate config changes are required. Missing any one causes silent failures. See references/telegram-routing.md for the full explanation.

  1. Group config in channels.telegram.groups:

    "-100XXXXXXXXXX": { "requireMention": false }
    
  2. Binding in bindings[]:

    { "agentId": "<id>", "match": { "channel": "telegram", "peer": { "kind": "group", "id": "-100XXXXXXXXXX" } } }
    
  3. Mention patterns on the agent entry (already done in step 6 if groupChat was added).

8. Create Cron Jobs (if needed)

Edit cron/jobs.json. Every cron job prompt MUST include:

  • Dynamic group ID resolution preamble (NEVER hardcode Telegram group IDs):
    FIRST: Resolve your Telegram group ID by running:
    jq -r '.bindings[] | select(.agentId == "<agent_id>") | .match.peer.id' ~/.openclaw/openclaw.json
    Use the output as the target for all Telegram messages in this task.
    
  • Date injection: $(date '+%A, %B %d, %Y') after the preamble
  • Explicit constraints: source allowlists, recency rules, format templates
  • Delivery instructions: use target='<AGENT_GROUP_ID>' placeholder (resolved by the preamble)

This self-healing pattern ensures cron jobs survive Telegram group ID migrations. See references/prompt-patterns.md for full patterns and references/telegram-routing.md for why this matters.

Critical: If copying files or prompts from another agent's workspace, grep for hardcoded paths and update them.

9. Restart Gateway and Verify

openclaw gateway start

Verify in logs:

  • Agent registered: agent registered: <id>
  • Messages route correctly: lane enqueue: lane=session:agent:<id>:...

If messages to a Telegram group show skip: no-mention, the channels.telegram.groups config is missing (see references/bugs-and-pitfalls.md).

Reference Files

File When to Read
references/config-schema.md When writing agent config or cron jobs
references/telegram-routing.md When setting up Telegram group routing
references/prompt-patterns.md When writing cron job prompts
references/bugs-and-pitfalls.md When debugging issues or before any config edit

Template Files

Starter templates for workspace files are in assets/templates/. Copy and customize per agent.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

automationdevopsbackendproductivitydevelopment-engineeringproject-program-management

同类 Skill