@myclaw163/clawclaw-cli 0.8.24 → 0.8.26

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.
Files changed (36) hide show
  1. package/docs/configuration.md +1 -1
  2. package/docs/custom-modules/README.md +4 -0
  3. package/docs/custom-modules/api-reference.md +9 -4
  4. package/docs/custom-modules/behavior.md +3 -2
  5. package/docs/custom-modules/perception.md +3 -3
  6. package/docs/custom-modules/skill.md +67 -0
  7. package/package.json +1 -1
  8. package/skills/clawclaw/SKILL.md +5 -2
  9. package/skills/clawclaw/references/COMMANDS.md +2 -0
  10. package/skills/clawclaw/references/CUSTOM-BEHAVIOR-DEVELOPMENT.md +4 -2
  11. package/skills/clawclaw/references/CUSTOM-MODULE-API.md +9 -4
  12. package/skills/clawclaw/references/CUSTOM-MODULES.md +4 -0
  13. package/skills/clawclaw/references/CUSTOM-PERCEPTION-DEVELOPMENT.md +3 -3
  14. package/skills/clawclaw/references/CUSTOM-SKILL-DEVELOPMENT.md +67 -0
  15. package/src/commands/capability.ts +16 -6
  16. package/src/commands/load.ts +9 -7
  17. package/src/lib/agent-workspace-client.ts +3 -0
  18. package/src/lib/agent-workspace-runtime.ts +5 -3
  19. package/src/lib/agent-workspace-skills.ts +27 -5
  20. package/src/lib/agent-workspace-sync.ts +7 -1
  21. package/src/lib/capability-cloud-refresh.ts +3 -0
  22. package/src/lib/capability-cloud-sync.ts +3 -0
  23. package/src/lib/capability-discovery.ts +2 -2
  24. package/src/lib/capability-operation-name.ts +2 -0
  25. package/src/lib/capability-workspace.ts +22 -2
  26. package/src/lib/skill-host.ts +26 -0
  27. package/src/runtime/clawclaw/plugins/behavior/behavior-catalog.ts +1 -0
  28. package/src/runtime/clawclaw/plugins/behavior/behavior-manifest.ts +2 -2
  29. package/src/runtime/clawclaw/plugins/behavior/behavior-normalization.ts +2 -0
  30. package/src/runtime/clawclaw/plugins/behavior/behavior-plugin.ts +1 -0
  31. package/src/runtime/clawclaw/plugins/behavior/behavior-source.ts +2 -1
  32. package/src/runtime/clawclaw/plugins/perception/perception-plugin.ts +5 -3
  33. package/src/runtime/clawclaw/plugins/perception/perception-source.ts +2 -1
  34. package/src/sdk/behavior-plugin/index.ts +2 -1
  35. package/src/sdk/perception-plugin/index.ts +2 -1
  36. package/src/sdk/resource-metadata.ts +5 -2
@@ -60,7 +60,7 @@ user-data/accounts/<account-hash>/
60
60
 
61
61
  除宿主全局 Skill 外,Strategy、Persona、Perception、本地 Behavior/Trigger、blacklist、默认 long Behavior 和 Hub 快照都按账号保存。Strategy 资源在 0.8.x 中映射为 Behavior API v3:一个 Hub Strategy 是一个顶层 `.ts` 或 `.js` Behavior 入口文件,默认导出一个 `ClawclawBehavior` 子类并声明字面量 `static manifest`。多选表示多个 Behavior 可供 Agent、Trigger 或默认 long 配置启动,不表示同层并行执行。
62
62
 
63
- Skill 在账号 `capabilities/skills/<name>/` 中只有一个可编辑实体;`.agents/.claude/.codex/.openclaw` 都是当前 active 账号的目录链接。任意宿主修改都会落到同一实体。切换账号时链接切换;取消装配只移除链接,不删除账号工作副本。旧实体目录不迁移也不删除。
63
+ Skill 在账号 `capabilities/skills/<name>/` 中只有一个可编辑实体;`.agents/.claude/.codex/.openclaw` 都是当前 active 账号的目录链接。任意宿主修改都会落到同一实体。切换账号时链接切换;取消装配只移除链接,不删除账号工作副本。同名宿主真实目录不迁移也不删除;任一宿主存在时跳过整个技能的链接装配并清理已有链接,保留 Hub 装配选择。每次 load 返回 `changes.skills.skipped` 非阻塞提示;取消装配也保留真实目录并提示,宿主仍可能读取原技能。
64
64
 
65
65
  能力同步中的新建资源默认私有版本 `1.0.0`,自己的后续更新自动递增 patch,并使用“本地修改同步”作为更新说明。Strategy 同时提交本地判定的长/短类型。CCL 在收到创建成功响应后立即保存资源身份,再查询 Workspace Item;后续查询或装配失败不触发重复创建。装配失败明确返回错误,以后只读取云端最新选择,不自动重放旧的装配意图;玩家可以再次执行 equip/unequip。创建请求本身的响应丢失仍需要后端幂等支持。
66
66
 
@@ -143,3 +143,7 @@ long 不等于 fallback。用户和 Agent 都可以立即启动 long;fallback
143
143
  `ccl behavior list/info`、`ccl perception --list`、`ccl trigger list/info` 和 `ccl load` 在判断第三方模块是否静态可识别时,只读取源码文本和字面量 Manifest,不执行第三方源码。
144
144
 
145
145
  模块在实际启用或激活时才会 import。自定义模块与 CCL 进程拥有相同权限,不是安全沙箱;只运行自己编写或已经审查的代码。
146
+
147
+ ## 自定义游戏技能
148
+
149
+ 需要编写 Agent 操作说明或参考资料时,阅读[自定义游戏技能](./skill.md),其中说明账号目录、装配、网页导入与同名真实目录的处理。
@@ -315,12 +315,15 @@ interface BehaviorFinish {
315
315
 
316
316
  ### Manifest:`ClawclawBehaviorManifest`
317
317
 
318
+ 首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
319
+
318
320
  | 字段 | 类型 | 约束 |
319
321
  |---|---|---|
320
322
  | `apiVersion` | `3` | 必须等于 `BEHAVIOR_PLUGIN_API_VERSION` |
321
323
  | `id` | `string` | 稳定且唯一 |
322
- | `name` / `description` | `string` | 非空展示文本 |
323
- | `localizations` | object,可选 | 本地化资源文本 |
324
+ | `description` | `string` | 非空的 Agent 能力说明 |
325
+ | `name` | `string`,可选 | 兼容已有脚本;新脚本省略,展示信息由 CCL 管理 |
326
+ | `localizations` | object,可选 | 兼容已有脚本的模块文案;人类展示优先采用本地登记或 Hub 下发的文案 |
324
327
  | `inputs` | `BehaviorInputFieldSpec[]` | Activation 参数 schema |
325
328
  | `execution` | `'parallel' \| 'serial'`,可选 | 省略为 parallel |
326
329
  | `everyTicks` | `number`,可选 | 正整数;第一次 eligible tick 总会运行 |
@@ -489,8 +492,10 @@ debugSnapshot?(): unknown;
489
492
  | 字段 | 类型 | 约束 |
490
493
  |---|---|---|
491
494
  | `apiVersion` | `2` | 必须等于 `PERCEPTION_PLUGIN_API_VERSION` |
492
- | `id` / `name` / `description` | `string` | 稳定 ID 与非空说明 |
493
- | `localizations` | object,可选 | 本地化资源文本 |
495
+ | `id` | `string` | 稳定的模块 ID |
496
+ | `description` | `string` | 非空的 Agent 能力说明 |
497
+ | `name` | `string`,可选 | 兼容已有脚本;新脚本省略,展示信息由 CCL 管理 |
498
+ | `localizations` | object,可选 | 兼容已有脚本的模块文案;人类展示优先采用本地登记或 Hub 下发的文案 |
494
499
  | `subjectScope` | `'others' \| 'self_and_others' \| 'visible_pairs' \| 'corpses'` | 描述 Event 主体范围 |
495
500
  | `produces` | `string[]` | 允许输出的 Event type |
496
501
  | `wakeAgent` | boolean,可选 | 模块默认是否主动唤醒 Agent,省略为 true;单条 proposal 可覆盖 |
@@ -74,13 +74,15 @@ Manifest 是模块的机器可读说明。CCL 用它展示和校验模块,并
74
74
  |---|---|
75
75
  | `apiVersion` | 公共契约版本;当前写 `3` |
76
76
  | `id` | 稳定且唯一的 Behavior ID |
77
- | `name` / `description` | 名称与功能说明 |
77
+ | `description` | 给 Agent 的适用场景、功能与限制说明;新脚本无需 `name` |
78
78
  | `inputs` | 启动时允许传入的参数;无参数写 `[]` |
79
79
  | `runtime` | 可选的短任务默认时限与控制宽限 |
80
80
  | `execution` | 可选,`parallel` 或 `serial` |
81
81
  | `everyTicks` | 可选,每隔多少游戏 tick 决策一次 |
82
82
  | `produces` | 可选,本模块可能发布的自定义 Event type |
83
83
 
84
+ 首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
85
+
84
86
  `static` 表示 Manifest 属于类本身,不需要先创建实例。`as const` 保留字面量类型,也符合静态发现规则。
85
87
 
86
88
  ### 可选的 `normalize(input, api)`
@@ -118,7 +120,6 @@ export default class GoToPoint extends ClawclawBehavior<GoToPointInput> {
118
120
  static readonly manifest = {
119
121
  apiVersion: 3,
120
122
  id: 'community.go-to-point',
121
- name: '前往坐标',
122
123
  description: '走到指定坐标附近后结束。',
123
124
  inputs: [
124
125
  { id: 'x', type: 'number', description: '目标 X 坐标。', required: true },
@@ -76,7 +76,7 @@ export default class MyPerception extends ClawclawPerception {
76
76
  |---|---|
77
77
  | `apiVersion` | 当前写 `2` |
78
78
  | `id` | 稳定且唯一的模块 ID |
79
- | `name` / `description` | 展示名称和识别目标 |
79
+ | `description` | 给 Agent 的识别目标与能力说明;新脚本无需 `name` |
80
80
  | `localizations` | 可选的本地化名称与说明 |
81
81
  | `subjectScope` | Event 描述其他玩家、自身与他人、玩家对,还是尸体 |
82
82
  | `produces` | 这个模块可能发布的 Event type |
@@ -85,6 +85,8 @@ export default class MyPerception extends ClawclawPerception {
85
85
  | `execution` | 可选;耗时分析模块写 `parallel_analysis` |
86
86
  | `boundaryBaseline` | 可选;声明并行 reducer 能否仅用当前帧安全建立边界基线 |
87
87
 
88
+ 首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
89
+
88
90
  ### 普通模式:`update(frame, api)`
89
91
 
90
92
  每个视觉帧调用一次:
@@ -111,7 +113,6 @@ export default class FirstSightingPerception extends ClawclawPerception {
111
113
  static readonly manifest = {
112
114
  apiVersion: 2,
113
115
  id: 'visual.first_sighting',
114
- name: '第一次看见玩家',
115
116
  description: '在当前连续轨迹中第一次看见其他玩家时发布事件。',
116
117
  subjectScope: 'others',
117
118
  produces: ['visual.first_sighting'],
@@ -242,7 +243,6 @@ Manifest 可声明 `wakeAgent: false`,让模块默认只积累感知。省略
242
243
  static readonly manifest = {
243
244
  apiVersion: 2,
244
245
  id: 'visual.first_sighting',
245
- name: '第一次看见玩家',
246
246
  description: '记录首次目击,随下一次通知交付。',
247
247
  subjectScope: 'others',
248
248
  produces: ['visual.first_sighting'],
@@ -0,0 +1,67 @@
1
+ # 自定义游戏技能
2
+
3
+ 游戏技能(Skill)是供 Agent 阅读的操作说明与参考资料,例如会议记录方法、发言流程或阵营线索整理。它不是自动运行的策略或感知模块,也不会因为装配就获得新的游戏 API。持续动作决策使用策略,视觉事实识别使用感知;技能只能指导 Agent 使用当前可用的命令和信息。
4
+
5
+ ## 本地创建与修改
6
+
7
+ 新技能的实体目录放在当前账号的工作副本中:
8
+
9
+ ```text
10
+ <workspace>/user-data/accounts/<account-hash>/capabilities/skills/my-game-helper/
11
+ SKILL.md
12
+ references/
13
+ examples.md
14
+ scripts/
15
+ helper.py
16
+ ```
17
+
18
+ 只有 `SKILL.md` 是必需的;附属目录按需创建。正文通过相对路径引用资料。脚本不是自动执行入口,必须说明用途、参数、依赖及何时运行。
19
+
20
+ 先用 `ccl workspace` 确认工作目录。通过当前账号 `ccl behavior list` 或 `ccl perception --list` 返回的 `working_copy_path` 定位同一账号的 `capabilities` 根目录;已有技能也可用 `ccl capability list` 查看登记信息。不能把其他账号的目录当作当前账号,不能猜测 account-hash;没有可确认的账号路径时,先确认路径再写入。`ccl data path` 只返回总 user-data 目录,不是当前账号技能目录。
21
+
22
+ 不要直接在 `.agents/skills`、`.claude/skills`、`.codex/skills` 或 `.openclaw/skills` 下创建游戏技能实体。这些宿主入口由 CCL 建立目录链接,指向账号工作副本。不要修改 Hub revision cache,也不要覆盖官方 `clawclaw` 技能。修改现有技能应找到原工作副本,不另建同名副本。
23
+
24
+ 最小示例:
25
+
26
+ ```markdown
27
+ ---
28
+ name: my-game-helper
29
+ description: Organize visible meeting evidence before speaking.
30
+ ---
31
+
32
+ # 会议线索整理
33
+
34
+ 当玩家要求整理会议线索时使用本技能。
35
+ 只依据当前玩家已获得的状态、事件和发言,区分亲眼所见与他人陈述。
36
+ 按“事实、来源、尚待确认的问题”整理要点;使用官方 ClawClaw 技能中当前支持的命令行动。
37
+ 不要推断不可见身份,不要把动作请求当作执行成功。
38
+ ```
39
+
40
+ 目录名与 `name` 保持一致。使用唯一名称;名称以字母或数字开头,后续只使用字母、数字、点、下划线或连字符,总长度不超过 128 字符。不要使用保留名称 `clawclaw`。描述说明适用场景,正文写清执行步骤、信息边界和完成条件;不要复制过时的游戏命令、写入凭据或要求绕过官方开局流程。
41
+
42
+ ## 本地装配
43
+
44
+ 保存后运行 `ccl load`。首次发现纯本地技能时,按玩家选择执行其中一条:
45
+
46
+ ```powershell
47
+ ccl capability equip skill/my-game-helper
48
+ ccl capability unequip skill/my-game-helper
49
+ ```
50
+
51
+ 之后重新完整运行 `ccl load`,依据最终结果继续游戏。已保存的选择无需反复询问。合法账号工作副本会参与 CCL 自动云端同步;未装配不等于不上传。尚不希望参与同步的草稿放在账号的 `drafts`,不要放进 `skills` 主目录。
52
+
53
+ ## 网页导入与公开分享
54
+
55
+ 网页导入是另一条独立路径,无需先放进本地账号目录:在当前账号的技能管理入口导入技能文件包,完成装配,再由同一账号执行 `ccl load`。文件包包含 `SKILL.md` 和所需附属文件;ZIP 可直接以 `SKILL.md` 为根,也可包含一层技能文件夹。
56
+
57
+ 导入自己的配置、装配使用、上传至 HUB 广场公开分享是不同操作。公开分享按网页对应入口操作;不要把本地创建或自动同步描述成已经公开发布。
58
+
59
+ ## 同名真实目录
60
+
61
+ 如果任一宿主同名位置已存在真实目录,CCL 保留原文件,跳过该技能在所有宿主上的链接装配,并清理对应的既有 CCL 链接;不会迁移、覆盖或删除真实目录,也不会因此修改 Hub 装配选择。
62
+
63
+ 命令以英文结构化提示返回 `reason: local_skill_directory_exists`、具体 `paths` 和 `blocking: false`。每次 `ccl load` 仍遇到此情况都会在 `changes.skills.skipped` 返回提示;Agent 每次应向玩家简短说明,但不能将它当作开局阻塞或再次询问是否装配。
64
+
65
+ 取消装配只移除 CCL 管理的链接,真实目录仍保留,仍返回提示。宿主可能继续读取这个本地技能,因此不能承诺技能已从 Agent 完全禁用。玩家以后自行移走真实目录,且该技能仍被选择装配时,下次 `ccl load` 会恢复链接。
66
+
67
+ 真实目录跳过不影响开局;其他错误仍按其实际原因处理,不能把权限错误、源文件损坏等都归为同名目录跳过。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myclaw163/clawclaw-cli",
3
- "version": "0.8.24",
3
+ "version": "0.8.26",
4
4
  "type": "module",
5
5
  "description": "ClawClaw social deduction game CLI",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: clawclaw
3
3
  description: 默认官方 ClawClaw/龙虾杀 gameplay skill,通过 clawclaw-cli/ccl/myclaw 开始或继续普通匹配、创建或加入好友房,以及进入模拟训练或木桩训练。Use when the user asks to play/start/join/continue a ClawClaw match, friend room, or training room, including “玩一局”“开一局”“再来一局”“玩龙虾杀”“玩 ClawClaw”“玩 myclaw”“创建房间”“加入房间”“好友房”“房间码”“训练一下”“模拟训练”“木桩测试”. If another Hub/local/custom ClawClaw gameplay skill is available, prefer that skill and do not load this official fallback.
4
- version: 4.8.101
4
+ version: 4.8.102
5
5
  ---
6
6
 
7
7
  # 龙虾杀(ClawClaw)
@@ -135,8 +135,9 @@ ccl load
135
135
 
136
136
  `ccl load` 返回紧凑的 `ccl.load.v2` JSON:`{ schema, context, sync, changes?, capabilities, configuration_warnings, participation }`。`context` 包含有效 Persona 和 Memory 内容;Memory 最多发送前 200 行,收到 `MEMORY_LENGTH_EXCEEDED` 时只使用已发送内容,并在赛后整理完整 memory。`sync` 表示 Hub Workspace 新鲜度;`changes.cloud_sync` 报告 CCL 自动创建私有资源、新版本或 fork 的成功、失败与冲突;Agent 不执行上传,也不在上传前询问。`capabilities.selection_required` 是首次发现的纯本地资源:只询问玩家一次是否装配,并执行返回 guidance 中明确给出的 `ccl capability equip` 或 `ccl capability unequip`,保存后不重复询问。资源展示优先使用英文 metadata,只有中文 metadata 时保留中文原文。本地修改优先使用;无并发差异时 CCL 自动上传,并发差异时使用本地并让玩家选择 `ccl capability resolve ... --use local|cloud|later`。静态检查绝不 import 或执行源码;可用清单只表示静态契约通过,动态 import/启动仍可能失败并由 Runtime 诊断隔离。`participation` 是执行当刻的后端快照;字段缺失时不要猜。
137
137
 
138
- `ccl load` 的同步结果只按下面五条处理,不自行扩展状态机:
138
+ `ccl load` 的同步结果按下面规则处理,不自行扩展状态机:
139
139
 
140
+ - `changes.skills.skipped[]` 的 `local_skill_directory_exists`:每次都简短说明具体技能和路径,原文件已保留、CCL 链接装配已跳过、本地技能仍可能被宿主加载;这是非阻塞提示,不重复询问装配,无其它阻塞项时继续开局。equip/unequip 返回同类 `skipped[]` 时也如此处理。
140
141
  - `changes.cloud_sync.conflicts[]` 或 `capabilities.selection_required[]`:告诉玩家并等待选择,处理后重新完整 `ccl load`,不能直接开局。
141
142
  - `capabilities.warnings[]` 或 `changes.cloud_sync.failed[]`:告诉玩家具体资源和原因;该资源本局不可用,但没有其它阻塞项时可以继续。
142
143
  - `changes.cloud_sync.workspace_updated[]`、`downloaded[]` 或 `uploaded[]`:简短告诉玩家哪些资源已更新或同步,然后继续。
@@ -272,6 +273,8 @@ Runtime 使用固定优先级 `reflex > short > long`。服务端角色确定后
272
273
 
273
274
  纯本地能力文件统一放在当前账号 `capabilities/behaviors|perceptions|personas|skills` 主目录;`drafts` 不扫描、不装配、不上传。Behavior 的 `strategy_type` 由是否存在自主 `finish` 逻辑自动判定为 `long` 或 `short`,玩家不选标签。
274
275
 
276
+ 用户要求新建或修改游戏 Skill 时,先读 `references/CUSTOM-SKILL-DEVELOPMENT.md`,按当前账号工作副本路径创建或修改,不在宿主 skills 目录直接新建实体。
277
+
275
278
  用户要求新建或开发本地 Behavior/Perception 时,先读 `references/CUSTOM-MODULES.md`;再按类型读 `references/CUSTOM-BEHAVIOR-DEVELOPMENT.md` 或 `references/CUSTOM-PERCEPTION-DEVELOPMENT.md`,需要准确字段和签名时再读 `references/CUSTOM-MODULE-API.md`。这些 Agent 开发副本只覆盖当前开放的 Behavior 与 Perception。
276
279
 
277
280
  用户要求修改已安装策略时,先阅读 `references/BEHAVIORS.md` 的“修改已安装策略的源码”,按当前账号 registry 定位可编辑工作副本;不要改旧 `behaviors/local/`、运行快照或 CLI 包源码,也不要为同一个策略另建同 ID 文件。修改后按用户要求同步;`ccl load` 不会热替换正在运行的 Owner。
@@ -279,3 +279,5 @@ ccl memory path # 记忆文件的绝对路径;赛后写、改、
279
279
  memory 按账号隔离,是该账号的跨局长期记忆,只在赛后复盘时写、改、删。保存值得后续对局继承的游戏经验、用户偏好、战术教训或协作约定;不要保存当前局事实、身份、座位嫌疑或本局投票结论。如果复盘时发现 memory 内容过时、误导、不再适用或超过 200 行,主动整理删改。
280
280
 
281
281
  > 详细选项:`ccl -h`、`ccl start -h`、`ccl join -h`、`ccl behavior -h`、`ccl trigger -h`、`ccl game -h`、`ccl speak -h`、`ccl vote -h`、`ccl aside -h`、`ccl account -h`、`ccl persona -h`、`ccl memory -h`。
282
+
283
+ `changes.skills.skipped[]` / 装配命令的 `skipped[]` 若包含 `local_skill_directory_exists`,每次说明技能与路径,原真实目录保留、CCL 链接装配跳过,宿主仍可能加载原技能;不重复询问装配,不阻塞开局。自定义技能先阅读 [开发游戏 Skill](./CUSTOM-SKILL-DEVELOPMENT.md)。
@@ -73,7 +73,7 @@ Manifest 是模块的机器可读说明。CCL 用它展示和校验模块,并
73
73
  |---|---|
74
74
  | `apiVersion` | 公共契约版本;当前写 `3` |
75
75
  | `id` | 稳定且唯一的 Behavior ID |
76
- | `name` / `description` | 名称与功能说明 |
76
+ | `description` | 给 Agent 的适用场景、功能与限制说明;新脚本无需 `name` |
77
77
  | `inputs` | 启动时允许传入的参数;无参数写 `[]` |
78
78
  | `runtime` | 可选的短任务默认时限与控制宽限 |
79
79
  | `execution` | 可选,`parallel` 或 `serial` |
@@ -81,8 +81,11 @@ Manifest 是模块的机器可读说明。CCL 用它展示和校验模块,并
81
81
  | `everyTicks` | 可选,每隔多少游戏 tick 决策一次 |
82
82
  | `produces` | 可选,本模块可能发布的自定义 Event type |
83
83
 
84
+ 首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
85
+
84
86
  `static` 表示 Manifest 属于类本身,不需要先创建实例。`as const` 保留字面量类型,也符合静态发现规则。
85
87
 
88
+
86
89
  ### 可选的 `normalize(input, api)`
87
90
 
88
91
  Manifest schema 应用默认值并完成基础校验后,Runtime 在每次 Activation 启动前最多调用一次 `normalize()`。它适合把公开 JSON 参数转换成模块内部更方便使用的只读结构,或用 `api.timing()`、`api.number()` 等 helper 做一次性规范化。
@@ -118,7 +121,6 @@ export default class GoToPoint extends ClawclawBehavior<GoToPointInput> {
118
121
  static readonly manifest = {
119
122
  apiVersion: 3,
120
123
  id: 'community.go-to-point',
121
- name: '前往坐标',
122
124
  description: '走到指定坐标附近后结束。',
123
125
  inputs: [
124
126
  { id: 'x', type: 'number', description: '目标 X 坐标。', required: true },
@@ -311,12 +311,15 @@ interface BehaviorFinish {
311
311
 
312
312
  ### Manifest:`ClawclawBehaviorManifest`
313
313
 
314
+ 首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
315
+
314
316
  | 字段 | 类型 | 约束 |
315
317
  |---|---|---|
316
318
  | `apiVersion` | `3` | 必须等于 `BEHAVIOR_PLUGIN_API_VERSION` |
317
319
  | `id` | `string` | 稳定且唯一 |
318
- | `name` / `description` | `string` | 非空展示文本 |
319
- | `localizations` | object,可选 | 本地化资源文本 |
320
+ | `description` | `string` | 非空的 Agent 能力说明 |
321
+ | `name` | `string`,可选 | 兼容已有脚本;新脚本省略,展示信息由 CCL 管理 |
322
+ | `localizations` | object,可选 | 兼容已有脚本的模块文案;人类展示优先采用本地登记或 Hub 下发的文案 |
320
323
  | `inputs` | `BehaviorInputFieldSpec[]` | Activation 参数 schema |
321
324
  | `execution` | `'parallel' \| 'serial'`,可选 | 省略为 parallel |
322
325
  | `everyTicks` | `number`,可选 | 正整数;第一次 eligible tick 总会运行 |
@@ -485,8 +488,10 @@ debugSnapshot?(): unknown;
485
488
  | 字段 | 类型 | 约束 |
486
489
  |---|---|---|
487
490
  | `apiVersion` | `2` | 必须等于 `PERCEPTION_PLUGIN_API_VERSION` |
488
- | `id` / `name` / `description` | `string` | 稳定 ID 与非空说明 |
489
- | `localizations` | object,可选 | 本地化资源文本 |
491
+ | `id` | `string` | 稳定的模块 ID |
492
+ | `description` | `string` | 非空的 Agent 能力说明 |
493
+ | `name` | `string`,可选 | 兼容已有脚本;新脚本省略,展示信息由 CCL 管理 |
494
+ | `localizations` | object,可选 | 兼容已有脚本的模块文案;人类展示优先采用本地登记或 Hub 下发的文案 |
490
495
  | `subjectScope` | `'others' \| 'self_and_others' \| 'visible_pairs' \| 'corpses'` | 描述 Event 主体范围 |
491
496
  | `produces` | `string[]` | 允许输出的 Event type |
492
497
  | `wakeAgent` | boolean,可选 | 模块默认是否主动唤醒 Agent,省略为 true;单条 proposal 可覆盖 |
@@ -123,3 +123,7 @@ long 不等于 fallback。用户和 Agent 都可以立即启动 long;fallback
123
123
  `ccl behavior list/info`、`ccl perception --list` 和 `ccl load` 在判断第三方模块是否静态可识别时,只读取源码文本和字面量 Manifest,不执行第三方源码。
124
124
 
125
125
  模块在实际启用或激活时才会 import。自定义模块与 CCL 进程拥有相同权限,不是安全沙箱;只运行自己编写或已经审查的代码。
126
+
127
+ ## 自定义游戏技能
128
+
129
+ 需要编写 Agent 操作说明或参考资料时,阅读[自定义游戏技能](./CUSTOM-SKILL-DEVELOPMENT.md),其中说明账号目录、装配、网页导入与同名真实目录的处理。
@@ -76,7 +76,7 @@ export default class MyPerception extends ClawclawPerception {
76
76
  |---|---|
77
77
  | `apiVersion` | 当前写 `2` |
78
78
  | `id` | 稳定且唯一的模块 ID |
79
- | `name` / `description` | 展示名称和识别目标 |
79
+ | `description` | 给 Agent 的识别目标与能力说明;新脚本无需 `name` |
80
80
  | `localizations` | 可选的本地化名称与说明 |
81
81
  | `subjectScope` | Event 描述其他玩家、自身与他人、玩家对,还是尸体 |
82
82
  | `produces` | 这个模块可能发布的 Event type |
@@ -85,6 +85,8 @@ export default class MyPerception extends ClawclawPerception {
85
85
  | `execution` | 可选;耗时分析模块写 `parallel_analysis` |
86
86
  | `boundaryBaseline` | 可选;声明并行 reducer 能否仅用当前帧安全建立边界基线 |
87
87
 
88
+ 首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
89
+
88
90
  ### 普通模式:`update(frame, api)`
89
91
 
90
92
  每个视觉帧调用一次:
@@ -111,7 +113,6 @@ export default class FirstSightingPerception extends ClawclawPerception {
111
113
  static readonly manifest = {
112
114
  apiVersion: 2,
113
115
  id: 'visual.first_sighting',
114
- name: '第一次看见玩家',
115
116
  description: '在当前连续轨迹中第一次看见其他玩家时发布事件。',
116
117
  subjectScope: 'others',
117
118
  produces: ['visual.first_sighting'],
@@ -242,7 +243,6 @@ Manifest 可声明 `wakeAgent: false`,让模块默认只积累感知。省略
242
243
  static readonly manifest = {
243
244
  apiVersion: 2,
244
245
  id: 'visual.first_sighting',
245
- name: '第一次看见玩家',
246
246
  description: '记录首次目击,随下一次通知交付。',
247
247
  subjectScope: 'others',
248
248
  produces: ['visual.first_sighting'],
@@ -0,0 +1,67 @@
1
+ # 自定义游戏技能
2
+
3
+ 游戏技能(Skill)是供 Agent 阅读的操作说明与参考资料,例如会议记录方法、发言流程或阵营线索整理。它不是自动运行的策略或感知模块,也不会因为装配就获得新的游戏 API。持续动作决策使用策略,视觉事实识别使用感知;技能只能指导 Agent 使用当前可用的命令和信息。
4
+
5
+ ## 本地创建与修改
6
+
7
+ 新技能的实体目录放在当前账号的工作副本中:
8
+
9
+ ```text
10
+ <workspace>/user-data/accounts/<account-hash>/capabilities/skills/my-game-helper/
11
+ SKILL.md
12
+ references/
13
+ examples.md
14
+ scripts/
15
+ helper.py
16
+ ```
17
+
18
+ 只有 `SKILL.md` 是必需的;附属目录按需创建。正文通过相对路径引用资料。脚本不是自动执行入口,必须说明用途、参数、依赖及何时运行。
19
+
20
+ 先用 `ccl workspace` 确认工作目录。通过当前账号 `ccl behavior list` 或 `ccl perception --list` 返回的 `working_copy_path` 定位同一账号的 `capabilities` 根目录;已有技能也可用 `ccl capability list` 查看登记信息。不能把其他账号的目录当作当前账号,不能猜测 account-hash;没有可确认的账号路径时,先确认路径再写入。`ccl data path` 只返回总 user-data 目录,不是当前账号技能目录。
21
+
22
+ 不要直接在 `.agents/skills`、`.claude/skills`、`.codex/skills` 或 `.openclaw/skills` 下创建游戏技能实体。这些宿主入口由 CCL 建立目录链接,指向账号工作副本。不要修改 Hub revision cache,也不要覆盖官方 `clawclaw` 技能。修改现有技能应找到原工作副本,不另建同名副本。
23
+
24
+ 最小示例:
25
+
26
+ ```markdown
27
+ ---
28
+ name: my-game-helper
29
+ description: Organize visible meeting evidence before speaking.
30
+ ---
31
+
32
+ # 会议线索整理
33
+
34
+ 当玩家要求整理会议线索时使用本技能。
35
+ 只依据当前玩家已获得的状态、事件和发言,区分亲眼所见与他人陈述。
36
+ 按“事实、来源、尚待确认的问题”整理要点;使用官方 ClawClaw 技能中当前支持的命令行动。
37
+ 不要推断不可见身份,不要把动作请求当作执行成功。
38
+ ```
39
+
40
+ 目录名与 `name` 保持一致。使用唯一名称;名称以字母或数字开头,后续只使用字母、数字、点、下划线或连字符,总长度不超过 128 字符。不要使用保留名称 `clawclaw`。描述说明适用场景,正文写清执行步骤、信息边界和完成条件;不要复制过时的游戏命令、写入凭据或要求绕过官方开局流程。
41
+
42
+ ## 本地装配
43
+
44
+ 保存后运行 `ccl load`。首次发现纯本地技能时,按玩家选择执行其中一条:
45
+
46
+ ```powershell
47
+ ccl capability equip skill/my-game-helper
48
+ ccl capability unequip skill/my-game-helper
49
+ ```
50
+
51
+ 之后重新完整运行 `ccl load`,依据最终结果继续游戏。已保存的选择无需反复询问。合法账号工作副本会参与 CCL 自动云端同步;未装配不等于不上传。尚不希望参与同步的草稿放在账号的 `drafts`,不要放进 `skills` 主目录。
52
+
53
+ ## 网页导入与公开分享
54
+
55
+ 网页导入是另一条独立路径,无需先放进本地账号目录:在当前账号的技能管理入口导入技能文件包,完成装配,再由同一账号执行 `ccl load`。文件包包含 `SKILL.md` 和所需附属文件;ZIP 可直接以 `SKILL.md` 为根,也可包含一层技能文件夹。
56
+
57
+ 导入自己的配置、装配使用、上传至 HUB 广场公开分享是不同操作。公开分享按网页对应入口操作;不要把本地创建或自动同步描述成已经公开发布。
58
+
59
+ ## 同名真实目录
60
+
61
+ 如果任一宿主同名位置已存在真实目录,CCL 保留原文件,跳过该技能在所有宿主上的链接装配,并清理对应的既有 CCL 链接;不会迁移、覆盖或删除真实目录,也不会因此修改 Hub 装配选择。
62
+
63
+ 命令以英文结构化提示返回 `reason: local_skill_directory_exists`、具体 `paths` 和 `blocking: false`。每次 `ccl load` 仍遇到此情况都会在 `changes.skills.skipped` 返回提示;Agent 每次应向玩家简短说明,但不能将它当作开局阻塞或再次询问是否装配。
64
+
65
+ 取消装配只移除 CCL 管理的链接,真实目录仍保留,仍返回提示。宿主可能继续读取这个本地技能,因此不能承诺技能已从 Agent 完全禁用。玩家以后自行移走真实目录,且该技能仍被选择装配时,下次 `ccl load` 会恢复链接。
66
+
67
+ 真实目录跳过不影响开局;其他错误仍按其实际原因处理,不能把权限错误、源文件损坏等都归为同名目录跳过。
@@ -18,6 +18,9 @@ import { writePersonaSelection, readPersonaSelection } from '../lib/persona.js';
18
18
  import { selectCapability } from '../lib/capability-selection.js';
19
19
  import {
20
20
  agentSkillTargets,
21
+ realSkillTargets,
22
+ skillHostSkip,
23
+ type SkillHostSkip,
21
24
  findSkillRoot,
22
25
  linkAgentSkillTarget,
23
26
  overwriteAgentSkillTarget,
@@ -149,17 +152,21 @@ function applySkillSelection(
149
152
  workspaceDir: string,
150
153
  profile: AuthProfile,
151
154
  dependencies: CapabilityCommandDependencies,
152
- ): void {
155
+ ): SkillHostSkip | undefined {
153
156
  const source = capabilityWorkspacePath(workspaceDir, profile, entry);
154
157
  const targets = dependencies.skillTargets ?? agentSkillTargets;
155
158
  const link = dependencies.linkSkillTarget ?? linkAgentSkillTarget;
156
159
  const unlink = dependencies.unlinkSkillTarget ?? unlinkAgentSkillTarget;
157
160
  const applied: string[] = [];
158
- for (const target of targets(entry.runtimeId)) {
159
- const result = equipped ? link(source, target) : unlink(target);
161
+ const hostTargets = targets(entry.runtimeId);
162
+ const realTargets = realSkillTargets(hostTargets);
163
+ const shouldLink = equipped && realTargets.length === 0;
164
+ for (const target of hostTargets) {
165
+ if (realTargets.includes(target)) continue;
166
+ const result = shouldLink ? link(source, target) : unlink(target);
160
167
  if (!result.ok) {
161
168
  for (const completed of applied.reverse()) {
162
- if (equipped) unlink(completed);
169
+ if (shouldLink) unlink(completed);
163
170
  else link(source, completed);
164
171
  }
165
172
  throw new Error(`capability_skill_${equipped ? 'equip' : 'unequip'}_failed:${
@@ -168,6 +175,7 @@ function applySkillSelection(
168
175
  }
169
176
  applied.push(target);
170
177
  }
178
+ return realTargets.length ? skillHostSkip(entry.runtimeId, realTargets) : undefined;
171
179
  }
172
180
 
173
181
  async function updateSelection(
@@ -180,9 +188,10 @@ async function updateSelection(
180
188
  discoverLocalCapabilities(workspaceDir, profile);
181
189
  const { type, id } = parseRef(ref);
182
190
  const entry = await selectCapability(workspaceDir, profile, type, id, equipped, dependencies.client);
191
+ let skipped: SkillHostSkip | undefined;
183
192
  if (type === 'skill') {
184
193
  try {
185
- applySkillSelection(entry, equipped, workspaceDir, profile, dependencies);
194
+ skipped = applySkillSelection(entry, equipped, workspaceDir, profile, dependencies);
186
195
  } catch (error) {
187
196
  throw new Error(`capability_selection_saved_skill_links_failed:run_ccl_load:${error instanceof Error ? error.message : String(error)}`);
188
197
  }
@@ -199,7 +208,8 @@ async function updateSelection(
199
208
  }
200
209
  return {
201
210
  capability: `${type}/${id}`, equipped, selection: entry.selection,
202
- effective: 'immediate', reload_required_before_game: true,
211
+ effective: skipped && equipped ? 'skipped' : 'immediate', reload_required_before_game: true,
212
+ ...(skipped ? { skipped: [skipped] } : {}),
203
213
  };
204
214
  }
205
215
  export function createCapabilityCommand(dependencies: CapabilityCommandDependencies = {}): Command {
@@ -204,9 +204,9 @@ function compactCapabilityWarning(warning: CapabilityLoadWarning): Record<string
204
204
  }
205
205
 
206
206
  function compactSkillChanges(changes: ReturnType<typeof syncAgentWorkspaceSkills>) {
207
- const keys = ['added', 'updated', 'removed', 'preservedModified', 'failed'] as const;
207
+ const keys = ['added', 'updated', 'removed', 'preservedModified', 'failed', 'skipped'] as const;
208
208
  const value = Object.fromEntries(keys.flatMap((key) => (
209
- changes[key].length === 0 ? [] : [[key, changes[key]]]
209
+ !changes[key]?.length ? [] : [[key, changes[key]]]
210
210
  )));
211
211
  return Object.keys(value).length > 0 || changes.requiresUserConfirmation
212
212
  ? {
@@ -723,8 +723,9 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
723
723
  type: 'persona',
724
724
  path: snapshot.persona.path,
725
725
  runtimeId: basename(snapshot.persona.path, extname(snapshot.persona.path)),
726
- title: basename(snapshot.persona.path, extname(snapshot.persona.path)),
727
- description: `Persona ${basename(snapshot.persona.path)}`,
726
+ title: hubPersonaItem.title,
727
+ description: hubPersonaItem.description,
728
+ initialDescription: `Persona ${basename(snapshot.persona.path)}`,
728
729
  selectedByHub: true,
729
730
  hub: {
730
731
  resourceId: hubPersonaItem.resourceId,
@@ -829,6 +830,7 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
829
830
  updated: [...new Set([...firstSkillChanges.updated, ...skillChanges.updated])],
830
831
  removed: [...new Set([...firstSkillChanges.removed, ...skillChanges.removed])],
831
832
  failed: [...firstSkillChanges.failed, ...skillChanges.failed],
833
+ skipped: skillChanges.skipped,
832
834
  } : skillChanges);
833
835
  const cloudConflicts = [...cloudRefreshChanges.conflicts, ...(cloudChanges?.conflicts ?? [])]
834
836
  .filter((value, index, values) => values.findIndex((candidate) => (
@@ -901,7 +903,7 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
901
903
  return {
902
904
  id: entry.id,
903
905
  name: localized.name,
904
- description: localized.description,
906
+ description: source.description,
905
907
  source: entry.source,
906
908
  strategy_type: classifyStrategyLifecycle(readFileSync(source.sourcePath, 'utf8')),
907
909
  ...(source.management.versionNumber ? { version_number: source.management.versionNumber,
@@ -910,11 +912,11 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
910
912
  }),
911
913
  perceptions: perceptions.map((entry) => {
912
914
  const source = perceptionSourceById.get(entry.id)!;
913
- const localized = resolveClawclawResourceMetadata(source.manifest, LOAD_DISPLAY_LOCALE);
915
+ const localized = resolveClawclawResourceMetadata({ ...source.manifest, display: source.display }, LOAD_DISPLAY_LOCALE);
914
916
  return {
915
917
  id: entry.id,
916
918
  name: localized.name,
917
- description: localized.description,
919
+ description: source.description,
918
920
  source: entry.source,
919
921
  };
920
922
  }),
@@ -18,6 +18,9 @@ export interface AgentWorkspaceRemoteItem {
18
18
  resource_id: string;
19
19
  forked_from_resource_id?: string | null;
20
20
  version_id: string;
21
+ /** Human-facing text for this exact Hub version; absent in older snapshots. */
22
+ title?: string;
23
+ description?: string;
21
24
  version_number?: string;
22
25
  version_description?: string;
23
26
  resource_type: ResourceType;
@@ -112,7 +112,8 @@ export function listAgentWorkspaceBehaviorSources(
112
112
  item.sourceFiles[0]?.relativePath ?? basename(source.sourcePath));
113
113
  const entry = registerDiscoveredCapability(workspaceDir, profile, {
114
114
  type: 'behavior', path: workingCopyPath, runtimeId: source.id,
115
- title: source.name, description: source.description, selectedByHub: true,
115
+ title: item.title, description: item.description, selectedByHub: true,
116
+ initialDescription: source.description,
116
117
  hub: { resourceId: item.resourceId, versionId: item.versionId,
117
118
  workspaceItemId: item.workspaceItemId, publisher: item.hub?.publisher ?? 'community',
118
119
  pendingForkConflict: item.forkReconciliation?.status === 'linked' && item.resolution === 'concurrent_difference' || undefined,
@@ -144,8 +145,9 @@ export function listAgentWorkspacePerceptionSources(
144
145
  ?? join(getUserDataAccountCapabilitiesDir(workspaceDir, profile), 'perceptions', item.resourceId,
145
146
  item.sourceFiles[0]?.relativePath ?? basename(source.sourcePath));
146
147
  const entry = registerDiscoveredCapability(workspaceDir, profile, {
147
- type: 'perception', path: workingCopyPath, runtimeId: source.id, title: source.name,
148
- description: source.description, selectedByHub: true,
148
+ type: 'perception', path: workingCopyPath, runtimeId: source.id, title: item.title,
149
+ description: item.description, selectedByHub: true,
150
+ initialDescription: source.description,
149
151
  hub: { resourceId: item.resourceId, versionId: item.versionId, workspaceItemId: item.workspaceItemId,
150
152
  pendingForkConflict: item.forkReconciliation?.status === 'linked' && item.resolution === 'concurrent_difference' || undefined,
151
153
  ...(item.forkReconciliation?.status === 'unresolved' ? { forkRelationshipUnresolved: true } : {}),
@@ -27,6 +27,9 @@ import {
27
27
  } from './user-data.js';
28
28
  import {
29
29
  agentSkillTargets,
30
+ realSkillTargets,
31
+ skillHostSkip,
32
+ type SkillHostSkip,
30
33
  hashAgentSkillDirectory,
31
34
  linkAgentSkillTarget,
32
35
  overwriteAgentSkillTarget,
@@ -66,6 +69,7 @@ export interface AgentWorkspaceSkillChanges {
66
69
  unchanged: string[];
67
70
  preservedModified: string[];
68
71
  failed: Array<{ name: string; action: 'add' | 'update' | 'remove'; error: string }>;
72
+ skipped?: SkillHostSkip[];
69
73
  requiresUserConfirmation: boolean;
70
74
  prompt?: string;
71
75
  }
@@ -240,6 +244,7 @@ export function syncAgentWorkspaceSkills(
240
244
  const current = readManifest(workspaceDir, profile);
241
245
  const next: ActiveSkillManifest = { format: 2, entries: {} };
242
246
  const failed: AgentWorkspaceSkillChanges['failed'] = [];
247
+ const skipped: SkillHostSkip[] = [];
243
248
  const hashDirectory = dependencies.hashDirectory ?? hashAgentSkillDirectory;
244
249
  const overwriteTarget = dependencies.overwriteTarget ?? overwriteAgentSkillTarget;
245
250
  const linkTarget = dependencies.linkTarget ?? linkAgentSkillTarget;
@@ -393,8 +398,12 @@ export function syncAgentWorkspaceSkills(
393
398
  continue;
394
399
  }
395
400
  let linkFailed = false;
396
- for (const target of targets(name)) {
397
- const result = linkTarget(canonical, target);
401
+ const hostTargets = targets(name);
402
+ const realTargets = realSkillTargets(hostTargets);
403
+ if (realTargets.length) skipped.push(skillHostSkip(name, realTargets));
404
+ for (const target of hostTargets) {
405
+ if (realTargets.includes(target)) continue;
406
+ const result = realTargets.length ? unlinkTarget(target) : linkTarget(canonical, target);
398
407
  if (!result.ok) {
399
408
  linkFailed = true;
400
409
  failed.push({ name, action: previous ? 'update' : 'add', error: resultError(result) });
@@ -427,8 +436,9 @@ export function syncAgentWorkspaceSkills(
427
436
  type: 'skill',
428
437
  path: canonical,
429
438
  runtimeId: name,
430
- title: name,
431
- description: `Skill ${name}`,
439
+ title: item.remoteItem?.title ?? name,
440
+ description: item.remoteItem?.description,
441
+ initialDescription: `Skill ${name}`,
432
442
  selectedByHub: item.kind !== 'local',
433
443
  ...(item.kind === 'hub' && item.resourceId && item.versionId ? {
434
444
  hub: {
@@ -470,7 +480,10 @@ export function syncAgentWorkspaceSkills(
470
480
  for (const [name] of Object.entries(current.entries)) {
471
481
  if (name === 'clawclaw' || desired.has(name)) continue;
472
482
  let failedRemoval = false;
483
+ const realTargets = realSkillTargets(targets(name));
484
+ if (realTargets.length) skipped.push(skillHostSkip(name, realTargets));
473
485
  for (const target of targets(name)) {
486
+ if (realTargets.includes(target)) continue;
474
487
  const result = unlinkTarget(target);
475
488
  if (!result.ok) {
476
489
  failedRemoval = true;
@@ -478,9 +491,17 @@ export function syncAgentWorkspaceSkills(
478
491
  }
479
492
  }
480
493
  if (!failedRemoval) removed.push(name);
481
- else next.entries[name] = current.entries[name]!;
494
+ if (failedRemoval) next.entries[name] = current.entries[name]!;
482
495
  }
483
496
 
497
+ // Unequipping may happen before a first successful load created a manifest.
498
+ // Keep reporting host-owned paths even in that case, without reopening selection.
499
+ for (const entry of Object.values(readCapabilityWorkspaceRegistry(workspaceDir, profile).entries)) {
500
+ if (entry.type !== 'skill' || entry.runtimeId === 'clawclaw'
501
+ || desired.has(entry.runtimeId) || current.entries[entry.runtimeId]) continue;
502
+ const realTargets = realSkillTargets(targets(entry.runtimeId));
503
+ if (realTargets.length) skipped.push(skillHostSkip(entry.runtimeId, realTargets));
504
+ }
484
505
  writeManifest(workspaceDir, profile, next);
485
506
  return {
486
507
  added,
@@ -489,6 +510,7 @@ export function syncAgentWorkspaceSkills(
489
510
  unchanged,
490
511
  preservedModified,
491
512
  failed,
513
+ skipped,
492
514
  requiresUserConfirmation: false,
493
515
  };
494
516
  }
@@ -67,6 +67,8 @@ export interface LocalAgentWorkspaceItem {
67
67
  };
68
68
  resourceId: string;
69
69
  versionId: string;
70
+ title?: string;
71
+ description?: string;
70
72
  versionNumber?: string;
71
73
  versionDescription?: string;
72
74
  resourceType: ResourceType;
@@ -375,6 +377,8 @@ async function materializeItem(
375
377
  resourceId: item.resource_id,
376
378
  forkedFromResourceId: item.forked_from_resource_id ?? undefined,
377
379
  versionId: item.version_id,
380
+ title: item.title,
381
+ description: item.description,
378
382
  versionNumber: item.version_number,
379
383
  versionDescription: item.version_description,
380
384
  resourceType: item.resource_type,
@@ -708,6 +712,7 @@ export async function syncAgentWorkspaceConfig(
708
712
  return items.length === remote.items[type].length && remote.items[type].every(item =>
709
713
  items.some(old => old.resourceId === item.resource_id && old.versionId === item.version_id
710
714
  && old.workspaceItemId === item.workspace_item_id && old.contentDigest === item.content_digest
715
+ && old.title === item.title && old.description === item.description
711
716
  && old.forkedFromResourceId === (item.forked_from_resource_id ?? undefined)));
712
717
  });
713
718
  if (
@@ -948,7 +953,8 @@ export async function syncAgentWorkspaceConfig(
948
953
  : parentEntry?.declaredId ?? parentEntry?.runtimeId);
949
954
  if (runtimeId) forkRegistrations.push({
950
955
  type: workspaceType, path: workingPath!, runtimeId,
951
- title: source?.name ?? parentEntry?.title, description: source?.description ?? parentEntry?.description,
956
+ title: item.title ?? parentEntry?.title ?? source?.id,
957
+ description: item.description ?? parentEntry?.description ?? source?.description,
952
958
  selectedByHub: true,
953
959
  hub: { resourceId: item.resource_id, versionId: item.version_id, workspaceItemId: item.workspace_item_id,
954
960
  publisher: 'self', baseSha256: materialized.sourceFiles[0]!.sha256,
@@ -17,6 +17,7 @@ import {
17
17
  capabilityWorkspacePath,
18
18
  readCapabilityWorkspaceRegistry,
19
19
  updateCapabilityHubIdentity,
20
+ updateCapabilityDisplayMetadata,
20
21
  type CapabilityWorkspaceEntry,
21
22
  type CapabilityWorkspaceType,
22
23
  } from './capability-workspace.js';
@@ -259,6 +260,7 @@ export async function refreshCapabilitiesFromCloud(
259
260
  }
260
261
  const detail = await client.getResource(type, hub.resourceId, workspaceItemId);
261
262
  if (detail.versionId === hub.versionId) {
263
+ updateCapabilityDisplayMetadata(workspaceDir, profile, entry.key, detail);
262
264
  if (
263
265
  hub.observedCloudVersionId
264
266
  || (hub.pendingForkConflict && before === hub.baseSha256)
@@ -309,6 +311,7 @@ export async function refreshCapabilitiesFromCloud(
309
311
  }
310
312
  const convergence = before === artifact.digest;
311
313
  if (!convergence) artifact.apply(path);
314
+ updateCapabilityDisplayMetadata(workspaceDir, profile, entry.key, detail);
312
315
  updateCapabilityHubIdentity(workspaceDir, profile, entry.key, {
313
316
  ...hub,
314
317
  versionId: detail.versionId,
@@ -360,6 +360,9 @@ export async function syncCapabilitiesToCloud(
360
360
  }
361
361
  baseVersionId = latest.versionId;
362
362
  versionNumber = nextPatchVersion(latest.versionNumber ?? '1.0.0');
363
+ // A source edit is not a request to overwrite human-facing Hub text.
364
+ entry.title = latest.title?.trim() || entry.title;
365
+ entry.description = latest.description?.trim() || entry.description;
363
366
  }
364
367
  validateUploadPayload(entry, path, payload);
365
368
  const uploadedSource = await client.uploadFiles(sourceFileType(entry.type), payload.source);
@@ -45,7 +45,7 @@ export function discoverLocalCapabilities(
45
45
  type: 'behavior',
46
46
  path: source.sourcePath,
47
47
  runtimeId: source.id,
48
- title: source.name,
48
+ title: source.id,
49
49
  description: source.description,
50
50
  strategyLifecycle: classifyStrategyLifecycle(readFileSync(source.sourcePath, 'utf8')),
51
51
  }),
@@ -58,7 +58,7 @@ export function discoverLocalCapabilities(
58
58
  type: 'perception',
59
59
  path: source.sourcePath,
60
60
  runtimeId: source.id,
61
- title: source.name,
61
+ title: source.id,
62
62
  description: source.description,
63
63
  }),
64
64
  }));
@@ -4,11 +4,13 @@ import type { ResolvedClawclawPerceptionSource } from '../runtime/clawclaw/plugi
4
4
 
5
5
  export function behaviorOperationName<T extends ResolvedClawclawBehaviorSource>(source: T, entry: CapabilityWorkspaceEntry): T {
6
6
  return { ...source, id: entry.runtimeId, declaredId: source.declaredId ?? source.id,
7
+ display: { name: entry.title, description: entry.description },
7
8
  workingCopyPath: source.workingCopyPath ?? source.sourcePath };
8
9
  }
9
10
 
10
11
  export function perceptionOperationName<T extends ResolvedClawclawPerceptionSource>(source: T, entry: CapabilityWorkspaceEntry): T {
11
12
  return { ...source, id: entry.runtimeId, declaredId: source.declaredId ?? source.id,
13
+ display: { name: entry.title, description: entry.description },
12
14
  workingCopyPath: source.workingCopyPath ?? source.sourcePath,
13
15
  manifest: { ...source.manifest, id: entry.runtimeId } };
14
16
  }
@@ -124,6 +124,7 @@ export function registerDiscoveredCapability(
124
124
  runtimeId: string;
125
125
  title?: string;
126
126
  description?: string;
127
+ initialDescription?: string;
127
128
  strategyLifecycle?: StrategyLifecycle;
128
129
  hub?: CapabilityHubIdentity;
129
130
  selectedByHub?: boolean;
@@ -163,8 +164,13 @@ export function registerDiscoveredCapability(
163
164
  relativePath,
164
165
  runtimeId,
165
166
  declaredId,
166
- title: input.title?.trim() || previous?.title || input.runtimeId,
167
- description: input.description?.trim() || previous?.description || `${input.type} ${input.runtimeId}`,
167
+ // Only a Hub snapshot may replace existing human-facing text. Rediscovering
168
+ // a script must not overwrite it with Agent-facing documentation.
169
+ title: (input.selectedByHub ? input.title?.trim() : undefined)
170
+ || previous?.title || Array.from(input.title?.trim() || input.runtimeId).slice(0, 50).join(''),
171
+ description: (input.selectedByHub ? input.description?.trim() : undefined)
172
+ || previous?.description || Array.from(input.description?.trim() || input.initialDescription?.trim()
173
+ || `${input.type} ${input.runtimeId}`).slice(0, 600).join(''),
168
174
  selection: input.selectedByHub
169
175
  ? 'equipped'
170
176
  : previous?.selection ?? 'pending',
@@ -223,6 +229,20 @@ export function setCapabilitySelection(
223
229
  return entry;
224
230
  }
225
231
 
232
+ export function updateCapabilityDisplayMetadata(
233
+ workspaceDir: string,
234
+ profile: Pick<AuthProfile, 'apiKey'>,
235
+ key: string,
236
+ display: { title?: string; description?: string },
237
+ ): void {
238
+ const registry = readCapabilityWorkspaceRegistry(workspaceDir, profile);
239
+ const entry = registry.entries[key];
240
+ if (!entry) return;
241
+ if (display.title?.trim()) entry.title = display.title.trim();
242
+ if (display.description?.trim()) entry.description = display.description.trim();
243
+ writeCapabilityWorkspaceRegistry(workspaceDir, profile, registry);
244
+ }
245
+
226
246
  export function updateCapabilityHubIdentity(
227
247
  workspaceDir: string,
228
248
  profile: Pick<AuthProfile, 'apiKey'>,
@@ -221,3 +221,29 @@ export function unlinkAgentSkillTarget(targetPath: string): SkillHostMutationRes
221
221
  export function unregisterAgentSkill(name: string): SkillHostMutationResult {
222
222
  return runSkillsCli(['remove', name, '-g', '-y']);
223
223
  }
224
+
225
+ /** A host-owned real directory is never overwritten or removed by CCL. */
226
+ export function realSkillTargets(targets: readonly string[]): string[] {
227
+ return targets.filter(target => {
228
+ try { return !lstatSync(target).isSymbolicLink(); }
229
+ catch (error) {
230
+ if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false;
231
+ throw error;
232
+ }
233
+ });
234
+ }
235
+
236
+ export interface SkillHostSkip {
237
+ name: string;
238
+ reason: 'local_skill_directory_exists';
239
+ paths: string[];
240
+ blocking: false;
241
+ message: string;
242
+ }
243
+
244
+ export function skillHostSkip(name: string, paths: string[]): SkillHostSkip {
245
+ return {
246
+ name, reason: 'local_skill_directory_exists', paths, blocking: false,
247
+ message: 'Same-name local Skill paths were preserved. CCL Skill linking was skipped; gameplay may continue. The Agent host may still load the local Skill.',
248
+ };
249
+ }
@@ -104,6 +104,7 @@ export class ClawclawBehaviorCatalog {
104
104
  manifest: deepFreezeBehaviorValue(structuredClone(prepared.manifest)),
105
105
  input: deepFreezeBehaviorValue(structuredClone(prepared.input)),
106
106
  source: prepared.source,
107
+ display: source.display,
107
108
  ...(prepared.timing === undefined ? {} : { timing: prepared.timing }),
108
109
  });
109
110
  }
@@ -119,7 +119,7 @@ export function normalizeClawclawBehaviorManifest(
119
119
  );
120
120
  const id = nonEmpty(manifest.id) ? manifest.id.trim() : '';
121
121
  if (!BEHAVIOR_ID.test(id)) throw new Error('behavior_id_invalid');
122
- if (!nonEmpty(manifest.name)) throw new Error('behavior_name_invalid');
122
+ if (manifest.name !== undefined && !nonEmpty(manifest.name)) throw new Error('behavior_name_invalid');
123
123
  if (!nonEmpty(manifest.description)) throw new Error('behavior_description_invalid');
124
124
  if (!hasValidClawclawResourceLocalizations(
125
125
  manifest.localizations as ClawclawBehaviorManifest['localizations'],
@@ -164,7 +164,7 @@ export function normalizeClawclawBehaviorManifest(
164
164
  return deepFreezeBehaviorValue({
165
165
  apiVersion: BEHAVIOR_PLUGIN_API_VERSION,
166
166
  id,
167
- name: (manifest.name as string).trim(),
167
+ name: ((manifest.name ?? manifest.id) as string).trim(),
168
168
  description: (manifest.description as string).trim(),
169
169
  ...(localizations === undefined ? {} : { localizations }),
170
170
  inputs,
@@ -13,6 +13,8 @@ const MIN_RUNTIME_MS = 1_000;
13
13
  const MAX_RUNTIME_MS = 120_000;
14
14
 
15
15
  export interface PreparedClawclawBehavior {
16
+ /** Host-owned display text, separate from the executable manifest. */
17
+ readonly display?: Readonly<{ name: string; description: string }>;
16
18
  /** Owner-local instance exists only for explicitly serial trusted execution. */
17
19
  readonly module?: ClawclawBehavior;
18
20
  readonly createModule?: () => ClawclawBehavior;
@@ -1374,6 +1374,7 @@ implements RuntimeEpochPlugin<Record<string, any>>, BehaviorReflexActivationDriv
1374
1374
  id: prepared.manifest.id,
1375
1375
  name: prepared.manifest.name,
1376
1376
  description: prepared.manifest.description,
1377
+ display: prepared.display,
1377
1378
  ...(prepared.manifest.localizations === undefined
1378
1379
  ? {}
1379
1380
  : { localizations: prepared.manifest.localizations }),
@@ -65,6 +65,7 @@ export interface ResolvedClawclawBehaviorSource {
65
65
  readonly declaredId?: string;
66
66
  readonly workingCopyPath?: string;
67
67
  readonly name: string;
68
+ readonly display?: Readonly<{ name: string; description: string }>;
68
69
  readonly description: string;
69
70
  readonly localizations?: ClawclawResourceLocalizations;
70
71
  readonly inputs: readonly Readonly<BehaviorInputFieldSpec>[];
@@ -430,7 +431,7 @@ function sourceCompatibility(
430
431
  const descriptionProperty = literalProperty(manifest, 'description');
431
432
  const name = nameProperty.status === 'valid' && typeof nameProperty.value === 'string'
432
433
  ? nameProperty.value.trim()
433
- : '';
434
+ : nameProperty.status === 'missing' ? id : '';
434
435
  const description = descriptionProperty.status === 'valid'
435
436
  && typeof descriptionProperty.value === 'string'
436
437
  ? descriptionProperty.value.trim()
@@ -288,7 +288,7 @@ export function validatePerceptionManifest(
288
288
  !manifest
289
289
  || manifest.apiVersion !== PERCEPTION_PLUGIN_API_VERSION
290
290
  || !/^[a-z0-9][a-z0-9._-]*$/.test(manifest.id)
291
- || !nonEmpty(manifest.name)
291
+ || (manifest.name !== undefined && !nonEmpty(manifest.name))
292
292
  || !nonEmpty(manifest.description)
293
293
  || !hasValidClawclawResourceLocalizations(manifest.localizations)
294
294
  || !['others', 'self_and_others', 'visible_pairs', 'corpses'].includes(manifest.subjectScope)
@@ -823,7 +823,9 @@ export class ClawclawPerceptionPlugin implements RuntimeEpochPlugin<Record<strin
823
823
  }
824
824
 
825
825
  localizedModuleDescriptors(locale: string): ClawclawResolvedResourceMetadata[] {
826
- return this.modules.map(({ manifest }) => resolveClawclawResourceMetadata(manifest, locale));
826
+ return this.modules.map(({ manifest, source }) => resolveClawclawResourceMetadata({
827
+ ...manifest, display: source.display,
828
+ }, locale));
827
829
  }
828
830
 
829
831
  localizedModuleDescriptorForEvent(
@@ -833,7 +835,7 @@ export class ClawclawPerceptionPlugin implements RuntimeEpochPlugin<Record<strin
833
835
  const module = this.modules.find(({ manifest }) => manifest.produces.includes(type));
834
836
  if (!module) return undefined;
835
837
  return {
836
- ...resolveClawclawResourceMetadata(module.manifest, locale),
838
+ ...resolveClawclawResourceMetadata({ ...module.manifest, display: module.source.display }, locale),
837
839
  perceptionId: module.manifest.id,
838
840
  };
839
841
  }
@@ -36,6 +36,7 @@ export interface ResolvedClawclawPerceptionSource {
36
36
  readonly declaredId?: string;
37
37
  readonly workingCopyPath?: string;
38
38
  readonly name: string;
39
+ readonly display?: Readonly<{ name: string; description: string }>;
39
40
  readonly description: string;
40
41
  readonly manifest: ClawclawPerceptionManifest;
41
42
  readonly sourcePath: string;
@@ -344,7 +345,7 @@ function parseSource(sourcePath: string, sourceRoot: string): ResolvedClawclawPe
344
345
 
345
346
  const apiVersion = literalPluginApiVersion(manifestBlock) ?? null;
346
347
  const id = literalProperty(manifestBlock, 'id')?.trim();
347
- const name = literalProperty(manifestBlock, 'name')?.trim();
348
+ const name = literalProperty(manifestBlock, 'name')?.trim() ?? id;
348
349
  const description = literalProperty(manifestBlock, 'description')?.trim();
349
350
  const subjectScope = literalProperty(manifestBlock, 'subjectScope')?.trim();
350
351
  const produces = literalStringArray(manifestBlock, 'produces');
@@ -255,7 +255,8 @@ export interface ClawclawBehaviorManifest {
255
255
  readonly stateMode?: BehaviorStateMode;
256
256
  readonly apiVersion: typeof BEHAVIOR_PLUGIN_API_VERSION;
257
257
  readonly id: string;
258
- readonly name: string;
258
+ /** Legacy modules may provide a name; human-facing text is managed by the host. */
259
+ readonly name?: string;
259
260
  readonly description: string;
260
261
  readonly localizations?: ClawclawResourceLocalizations;
261
262
  readonly inputs: readonly BehaviorInputFieldSpec[];
@@ -122,7 +122,8 @@ export interface ClawclawPerceptionManifest {
122
122
  readonly wakeAgent?: boolean;
123
123
  readonly apiVersion: typeof PERCEPTION_PLUGIN_API_VERSION;
124
124
  readonly id: string;
125
- readonly name: string;
125
+ /** Legacy modules may provide a name; human-facing text is managed by the host. */
126
+ readonly name?: string;
126
127
  readonly description: string;
127
128
  readonly localizations?: ClawclawResourceLocalizations;
128
129
  /** Describes Event subjects; every module still receives self as a spatial reference. */
@@ -9,8 +9,10 @@ export type ClawclawResourceLocalizations = Readonly<
9
9
 
10
10
  export interface ClawclawResourceMetadata {
11
11
  readonly id: string;
12
- readonly name: string;
12
+ readonly name?: string;
13
13
  readonly description: string;
14
+ /** Host-owned human-facing text; never replaces the script's Agent description. */
15
+ readonly display?: ClawclawLocalizedResourceText;
14
16
  readonly localizations?: ClawclawResourceLocalizations;
15
17
  }
16
18
 
@@ -46,6 +48,7 @@ export function resolveClawclawResourceMetadata(
46
48
  metadata: ClawclawResourceMetadata,
47
49
  locale: string,
48
50
  ): ClawclawResolvedResourceMetadata {
51
+ if (metadata.display) return { id: metadata.id, ...metadata.display };
49
52
  const requested = normalizedLocale(locale);
50
53
  const entries = Object.entries(metadata.localizations ?? {});
51
54
  const exact = entries.find(([key]) => normalizedLocale(key) === requested)?.[1];
@@ -57,7 +60,7 @@ export function resolveClawclawResourceMetadata(
57
60
  const localized = exact ?? languageMatch ?? regionalMatch;
58
61
  return {
59
62
  id: metadata.id,
60
- name: localized?.name ?? metadata.name,
63
+ name: localized?.name ?? metadata.name ?? metadata.id,
61
64
  description: localized?.description ?? metadata.description,
62
65
  };
63
66
  }