multiclaws 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,164 @@
1
+ # MultiClaws — 技能行为
2
+
3
+ 以下规则在插件安装后生效,指导 AI 如何使用 MultiClaws 工具。
4
+
5
+ MultiClaws 让多个 OpenClaw 实例通过 [A2A(Agent-to-Agent)](https://google.github.io/A2A/) 协议组成团队、互相委派任务。
6
+
7
+ ---
8
+
9
+ ## 1. 首次运行:自动生成档案
10
+
11
+ 每次用户发消息时,先调用:
12
+
13
+ ```
14
+ multiclaws_profile_pending_review()
15
+ ```
16
+
17
+ 如果 `pending: true`:
18
+
19
+ 1. **自动生成 bio**,不要让用户手动填写。扫描当前环境:
20
+ - 可用的工具和 skills(推断能力)
21
+ - 已连接的渠道(Telegram、Discord、Gmail 等)
22
+ - 工作区内容(git 仓库、关键文件、项目目录)
23
+ - 已安装的插件
24
+ 2. 写成 **markdown** 格式的 bio——把它当作「技能卡」,其他 AI 读它来决定是否把任务委派过来。包含:
25
+ - 所有者名字和角色
26
+ - 这个智能体能处理什么
27
+ - 能访问什么数据/系统
28
+ - 时区、语言等上下文
29
+ 3. 调用 `multiclaws_profile_set(ownerName="...", bio="...")` 设置档案
30
+ 4. 告诉用户:「你的默认名字是 xxx,需要修改吗?」并展示 bio 问是否需要修改
31
+ 5. 确认后调用 `multiclaws_profile_clear_pending_review()`
32
+
33
+ **示例 bio:**
34
+ ```markdown
35
+ 后端工程师,负责 API 服务开发与维护。
36
+
37
+ **可处理:**
38
+ - 代码审查、调试、重构(Node.js / Go / Python)
39
+ - API 文档编写与接口设计
40
+ - 数据库查询与优化(PostgreSQL)
41
+
42
+ **数据访问:**
43
+ - Codebase: `/Users/eric/Project/api-service`(Node.js,~50k LOC)
44
+ - Email: Gmail
45
+ - Calendar: Google Calendar
46
+
47
+ **时区:** GMT+8
48
+ ```
49
+
50
+ 如果 `pending: false`:跳过档案检查,直接处理用户请求。
51
+
52
+ ## 2. 团队操作前检查档案
53
+
54
+ 在 **创建团队** 或 **加入团队** 之前:
55
+
56
+ ```
57
+ multiclaws_profile_show()
58
+ ```
59
+
60
+ 如果 `bio` 为空或 `ownerName` 为空:
61
+ 1. 自动生成 bio(同上)
62
+ 2. 调用 `multiclaws_profile_set(...)` 设置
63
+ 3. 然后继续团队操作
64
+
65
+ ## 3. 保持档案更新
66
+
67
+ 档案是动态的。在以下情况自动更新(调用 `multiclaws_profile_set`):
68
+ - 用户连接了新渠道或数据源
69
+ - 用户安装了新 skill 或插件
70
+ - 用户的角色或关注点发生变化
71
+
72
+ 不要等用户说「更新档案」,主动更新并简要提及即可。
73
+
74
+ ---
75
+
76
+ ## 工具列表
77
+
78
+ ### 档案
79
+
80
+ | 工具 | 说明 | 参数 |
81
+ |------|------|------|
82
+ | `multiclaws_profile_set` | 设置名字和 bio | `ownerName`(可选), `bio`(可选,markdown) |
83
+ | `multiclaws_profile_show` | 查看当前档案 | — |
84
+ | `multiclaws_profile_pending_review` | 检查是否有待确认的首次档案 | — |
85
+ | `multiclaws_profile_clear_pending_review` | 清除待确认标记 | — |
86
+
87
+ ### 团队
88
+
89
+ | 工具 | 说明 | 参数 |
90
+ |------|------|------|
91
+ | `multiclaws_team_create` | 创建团队,返回邀请码 | `name` |
92
+ | `multiclaws_team_join` | 用邀请码加入团队 | `inviteCode` |
93
+ | `multiclaws_team_leave` | 离开团队 | `teamId`(可选) |
94
+ | `multiclaws_team_members` | 列出团队成员 | `teamId`(可选) |
95
+
96
+ ### 智能体与委派
97
+
98
+ | 工具 | 说明 | 参数 |
99
+ |------|------|------|
100
+ | `multiclaws_agents` | 列出所有已知智能体及 bio | — |
101
+ | `multiclaws_add_agent` | 手动添加远端智能体 | `url`, `apiKey`(可选) |
102
+ | `multiclaws_remove_agent` | 移除已知智能体 | `url` |
103
+ | `multiclaws_delegate` | 委派任务给远端智能体 | `agentUrl`, `task` |
104
+ | `multiclaws_task_status` | 查看委派任务状态 | `taskId` |
105
+
106
+ ---
107
+
108
+ ## 重要规则
109
+
110
+ - **不要问用户 IP 地址或 selfUrl。** 插件自动处理。
111
+ - **只使用上面列出的工具。** 没有 `multiclaws_status` 工具。
112
+ - **Bio 是自由格式的 markdown。** 写得让另一个 AI 能读懂这个智能体能做什么。
113
+ - **每个智能体就像一个 skill。** 委派时读每个智能体的 bio,选最匹配的。
114
+
115
+ ---
116
+
117
+ ## 工作流
118
+
119
+ ### 创建团队
120
+
121
+ ```
122
+ 1. multiclaws_profile_show() — 检查档案
123
+ 2.(如果为空)自动生成并设置 bio
124
+ 3. multiclaws_team_create(name="...") — 返回 inviteCode (mc:xxxx)
125
+ 4. 告诉用户把邀请码分享给队友
126
+ ```
127
+
128
+ ### 加入团队
129
+
130
+ ```
131
+ 1. multiclaws_profile_show() — 检查档案
132
+ 2.(如果为空)自动生成并设置 bio
133
+ 3. multiclaws_team_join(inviteCode="mc:xxxx")
134
+ → 自动同步所有团队成员
135
+ ```
136
+
137
+ ### 智能委派
138
+
139
+ ```
140
+ 1. multiclaws_agents() — 列出智能体,读 bio
141
+ 2. 选择 bio 最匹配任务的智能体
142
+ 3. multiclaws_delegate(agentUrl="...", task="...")
143
+ 4. 把结果返回给用户
144
+ ```
145
+
146
+ 选择智能体时:
147
+ - 匹配任务领域和 bio(如「财务报告」→ 有财务技能的智能体)
148
+ - 匹配数据需求(如「检查 API 代码」→ bio 中有该代码库的智能体)
149
+ - 多个匹配时选最具体的
150
+
151
+ ---
152
+
153
+ ## 跨网络
154
+
155
+ **同局域网:** 开箱即用,无需配置。
156
+
157
+ **不同网络:** 每人安装 [Tailscale](https://tailscale.com/download) 并登录同一 tailnet,插件自动检测 Tailscale IP。
158
+
159
+ 当加入或委派因网络错误失败时(ECONNREFUSED、ETIMEDOUT、fetch failed),引导用户:
160
+
161
+ > 你和对方不在同一网络。跨网络协作需要每个成员安装 Tailscale:
162
+ > 1. 下载安装:https://tailscale.com/download
163
+ > 2. 登录同一个 Tailscale 账号(或同一 tailnet)
164
+ > 3. 重启 OpenClaw,插件会自动检测 Tailscale IP