evolcore 0.0.31 → 0.0.33

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 (179) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/bin/install-codex-managed-hooks.mjs +124 -37
  3. package/dist/agents/claude-runner.js +29 -2
  4. package/dist/agents/codex/app-server-client.js +3 -0
  5. package/dist/agents/codex/diagnostics.js +76 -44
  6. package/dist/agents/codex-runner.js +51 -24
  7. package/dist/agents/ecagent-runner.js +9 -13
  8. package/dist/agents/gemini-runner.js +4 -0
  9. package/dist/aun/aid/store.js +0 -81
  10. package/dist/aun/group/fs-download.js +1 -10
  11. package/dist/aun/group/operations.js +0 -1
  12. package/dist/aun/msg/history.js +1 -0
  13. package/dist/aun/msg/managed-operation.js +130 -32
  14. package/dist/aun/msg/p2p.js +0 -1
  15. package/dist/aun/outbox.js +50 -1
  16. package/dist/aun/service-proxy.js +12 -18
  17. package/dist/aun/storage/index.js +29 -0
  18. package/dist/channels/aun.js +38 -137
  19. package/dist/channels/daemon.js +257 -2
  20. package/dist/cli/agent-command.js +64 -31
  21. package/dist/cli/agent-create.js +43 -24
  22. package/dist/cli/agent.js +16 -70
  23. package/dist/cli/aun-commands.js +512 -32
  24. package/dist/cli/contact.js +8 -2
  25. package/dist/cli/ctl-command.js +1 -2
  26. package/dist/cli/daemon-commands.js +82 -13
  27. package/dist/cli/debug-mode.js +154 -0
  28. package/dist/cli/diag.js +2 -2
  29. package/dist/cli/handoff-command.js +18 -5
  30. package/dist/cli/index.js +81 -64
  31. package/dist/cli/init.js +2 -2
  32. package/dist/cli/managed-command-guard.js +5 -0
  33. package/dist/cli/memory-command.js +93 -12
  34. package/dist/cli/model.js +14 -138
  35. package/dist/cli/queue-command.js +51 -0
  36. package/dist/cli/response.js +5 -54
  37. package/dist/cli/session-command.js +194 -0
  38. package/dist/cli/skill-command.js +85 -3
  39. package/dist/cli/stats.js +10 -4
  40. package/dist/cli/task-command.js +1 -0
  41. package/dist/cli/task-context.js +16 -0
  42. package/dist/cli/thread-command.js +620 -0
  43. package/dist/cli/trigger-command.js +76 -50
  44. package/dist/config/builtin-roles.js +9 -7
  45. package/dist/config/config-field-policy.js +2 -3
  46. package/dist/config/config-manager.js +7 -2
  47. package/dist/config/resolved-config-op.js +3 -0
  48. package/dist/config-store.js +15 -0
  49. package/dist/core/agent-ipc-registration.js +65 -22
  50. package/dist/core/auth/agent-delegation.js +42 -2
  51. package/dist/core/auth/debug-context.js +139 -0
  52. package/dist/core/auth/delegation-authorization.js +1 -0
  53. package/dist/core/auth/operation-authorizer.js +24 -1
  54. package/dist/core/auth/operation-catalog.js +44 -3
  55. package/dist/core/background-session/session-cleanup.js +212 -0
  56. package/dist/core/background-session/types.js +10 -0
  57. package/dist/core/bootstrap-messages.js +1 -1
  58. package/dist/core/bootstrap-service.js +6 -3
  59. package/dist/core/command/command-handler.js +224 -45
  60. package/dist/core/command/diag-service.js +5 -1
  61. package/dist/core/command/memory-slash.js +6 -2
  62. package/dist/core/command/menu-catalog.js +48 -1
  63. package/dist/core/command/menu-handler.js +92 -16
  64. package/dist/core/command/menu-protocol.js +24 -1
  65. package/dist/core/command/skill-slash.js +322 -0
  66. package/dist/core/command/slash-gate.js +6 -4
  67. package/dist/core/command/slash-handler.js +193 -13
  68. package/dist/core/command/topic-slash.js +528 -0
  69. package/dist/core/evolagent-registry.js +20 -5
  70. package/dist/core/handoff/ipc-registration.js +38 -0
  71. package/dist/core/handoff/runtime.js +5 -11
  72. package/dist/core/handoff/store.js +5 -0
  73. package/dist/core/ipc-registration.js +210 -9
  74. package/dist/core/memory/consolidation-context.js +49 -16
  75. package/dist/core/memory/consolidation-ops-records.js +35 -0
  76. package/dist/core/memory/consolidation-queue-format.js +21 -0
  77. package/dist/core/memory/consolidation.js +174 -180
  78. package/dist/core/message/aun-ipc-sender.js +207 -8
  79. package/dist/core/message/im-renderer.js +149 -6
  80. package/dist/core/message/message-bridge.js +13 -3
  81. package/dist/core/message/message-log.js +1 -0
  82. package/dist/core/message/message-queue.js +131 -3
  83. package/dist/core/message/peer-mode.js +6 -1
  84. package/dist/core/message/response-engine.js +379 -69
  85. package/dist/core/message/subtask-tool-projection.js +140 -0
  86. package/dist/core/model/catalog-service.js +17 -12
  87. package/dist/core/permission/ec-command-parser.js +126 -7
  88. package/dist/core/permission/sandbox-runtime.js +14 -1
  89. package/dist/core/session/session-idle-monitor.js +249 -22
  90. package/dist/core/session/session-manager.js +54 -9
  91. package/dist/core/skill/command-parser.js +13 -0
  92. package/dist/core/skill/index-generator.js +4 -1
  93. package/dist/core/skill/startup.js +41 -0
  94. package/dist/core/skill/switch-resolver.js +55 -29
  95. package/dist/core/task/task-recovery-service.js +2 -0
  96. package/dist/core/task/task-resume-operation.js +11 -0
  97. package/dist/core/thread/command-parser.js +125 -0
  98. package/dist/core/thread/index.js +1 -0
  99. package/dist/core/thread/ipc-operation.js +95 -0
  100. package/dist/core/thread/thread-context-storage.js +131 -0
  101. package/dist/core/thread/thread-operation.js +258 -0
  102. package/dist/core/thread/thread-route.js +33 -0
  103. package/dist/core/thread/thread-service.js +777 -0
  104. package/dist/core/thread/types.js +1 -0
  105. package/dist/eck/message-renderer.js +35 -0
  106. package/dist/index.js +10 -7
  107. package/dist/ipc.js +234 -17
  108. package/dist/paths.js +23 -0
  109. package/dist/response-system/engines/v1/proactive-flow.js +169 -80
  110. package/dist/trigger/authorization.js +59 -29
  111. package/dist/trigger/feedback.js +7 -1
  112. package/dist/trigger/ipc-service.js +49 -35
  113. package/dist/trigger/parser.js +63 -1
  114. package/dist/trigger/script-sandbox.js +58 -77
  115. package/dist/trigger/validation.js +14 -0
  116. package/dist/utils/error-utils.js +22 -1
  117. package/kits/docs/AUTHORING.md +1 -1
  118. package/kits/docs/channels/aun.md +8 -0
  119. package/kits/docs/context-assembly.md +1 -0
  120. package/kits/docs/evolcore/INDEX.md +3 -2
  121. package/kits/docs/evolcore/agent-create.md +39 -28
  122. package/kits/docs/evolcore/agent.md +19 -4
  123. package/kits/docs/evolcore/ec-capabilities.md +4 -0
  124. package/kits/docs/evolcore/group-collaboration.md +3 -5
  125. package/kits/docs/evolcore/group.md +3 -4
  126. package/kits/docs/evolcore/memory-consolidation.md +1 -1
  127. package/kits/docs/evolcore/menu-exec-schema-commands.md +2 -2
  128. package/kits/docs/evolcore/menu-protocol.md +7 -0
  129. package/kits/docs/evolcore/msg.md +5 -8
  130. package/kits/docs/evolcore/task.md +2 -0
  131. package/kits/docs/evolcore/thread-chain.md +267 -0
  132. package/kits/docs/evolcore/trigger.md +2 -2
  133. package/kits/docs/prompt-loading-architecture.md +1 -0
  134. package/kits/eck_manifest.json +61 -26
  135. package/kits/eck_message_manifest.json +169 -10
  136. package/kits/rules/01-overview.md +0 -9
  137. package/kits/rules/05-venue.md +1 -1
  138. package/kits/rules/06-channel.md +7 -1
  139. package/kits/rules/07-memory-and-thread.md +202 -0
  140. package/kits/schemas/relation-config.schema.9.json +18 -3
  141. package/kits/schemas/role-config.schema.1.json +6 -6
  142. package/kits/schemas/single-session.schema.1.json +6 -6
  143. package/kits/schemas/single-session.schema.2.json +6 -6
  144. package/kits/schemas/single-session.schema.3.json +6 -6
  145. package/kits/skills/.switches.json +12 -1
  146. package/kits/skills/ec-group/SKILL.md +234 -0
  147. package/kits/skills/ec-skill/SKILL.md +10 -1
  148. package/kits/skills/ec-skill/scripts/cli.mjs +15 -1
  149. package/kits/skills/scrapling-article-fetch/SKILL.md +128 -0
  150. package/kits/skills/scrapling-article-fetch/scripts/check_python_env.py +54 -0
  151. package/kits/skills/scrapling-article-fetch/scripts/render_markdown_reply.py +35 -0
  152. package/kits/skills/scrapling-article-fetch/scripts/run_pipeline.sh +16 -0
  153. package/kits/skills/scrapling-article-fetch/scripts/scrapling_fetch.py +344 -0
  154. package/kits/skills/thread-ops/SKILL.md +492 -0
  155. package/kits/skills/wechat-article-media-download/SKILL.md +65 -0
  156. package/kits/skills/wechat-article-media-download/scripts/download.py +163 -0
  157. package/kits/skills/wechat-article-reader/SKILL.md +97 -0
  158. package/kits/skills/wechat-article-reader/scripts/fetch.mjs +256 -0
  159. package/kits/templates/bootstrap-welcome.md +7 -7
  160. package/kits/templates/memory-consolidation/forget.md +5 -0
  161. package/kits/templates/memory-consolidation/generalize.md +5 -0
  162. package/kits/templates/memory-consolidation/profile.md +5 -0
  163. package/kits/templates/memory-consolidation/promote.md +5 -0
  164. package/kits/templates/message-fragments/item.md +2 -1
  165. package/kits/templates/message-fragments/thread-context.md +6 -0
  166. package/kits/templates/message-fragments/trigger-session.md +2 -0
  167. package/kits/templates/message-fragments/trigger-thread-check.md +2 -0
  168. package/kits/templates/roles/member.json +2 -0
  169. package/kits/templates/roles/visitor.json +2 -0
  170. package/kits/templates/system-fragments/bootstrap.md +66 -72
  171. package/kits/templates/system-fragments/channel.md +3 -6
  172. package/kits/templates/system-fragments/commands.md +2 -1
  173. package/kits/templates/system-fragments/managed-runtime.md +15 -0
  174. package/kits/templates/system-fragments/reply.md +3 -2
  175. package/kits/templates/system-fragments/session.md +5 -14
  176. package/package.json +3 -1
  177. package/kits/docs/evolcore/group-fs.md +0 -17
  178. package/kits/docs/venues/aun-group.md +0 -45
  179. package/kits/docs/venues/group.md +0 -43
@@ -29,7 +29,7 @@ active
29
29
 
30
30
  ### 一次性初始化模式
31
31
 
32
- 如果创建者已经明确确认最终名片字段和人格,可以使用 `--initialize` 一次完成创建与激活:
32
+ 如果 Owner 已明确提供最终名片字段和人格,或已认可创建者生成的建议,可以使用 `--initialize` 一次完成创建与激活;明确且没有歧义的输入不需要再次确认:
33
33
 
34
34
  ```bash
35
35
  ec agent new helper.agentid.pub --initialize \
@@ -49,7 +49,7 @@ ec agent new helper.agentid.pub --initialize \
49
49
 
50
50
  ### 创建阶段的可选头像
51
51
 
52
- 头像是可选项,不提供不会阻塞创建或 Bootstrap。创建者应在执行普通非交互式 `ec agent new` 前询问 Owner 是否提供头像;若 Owner 已发送图片附件,直接把附件 ID 作为 `--avatar-file 'attachment:<id>'` 传给创建命令,不要读取、复制或改写附件路径。也可以传本地图片路径或 HTTPS 地址:
52
+ 头像是可选项,不提供不会阻塞创建或 Bootstrap。创建者可在收集其它设定时一并说明头像选项;Owner 未提供或已明确跳过时,不单独追加确认轮次。若 Owner 已发送图片附件,直接把附件 ID 作为 `--avatar-file 'attachment:<id>'` 传给创建命令,不要读取、复制或改写附件路径。也可以传本地图片路径或 HTTPS 地址:
53
53
 
54
54
  ```bash
55
55
  ec agent new helper.agentid.pub --non-interactive \
@@ -84,7 +84,7 @@ ec agent new helper.agentid.pub --non-interactive \
84
84
  --handoff '供当前创建 Agent 使用的 Bootstrap 上下文:已向 Owner 确认 name=Helper;description=协助处理项目开发任务;tags=coding, maintenance, typescript。目标 Agent 不会看到此上下文;创建 Agent 收到其 Bootstrap 首条消息时,以这些信息作为 Owner 回复并完成验收。'
85
85
  ```
86
86
 
87
- Bootstrap 完成前,Owner 可选地提供 persona 内容:直接发送文本,或发送 `.md`/`.txt` 文件。新 Agent 在确认后使用 `ec agent persona --text '<内容>'` 或 `ec agent persona --file '<路径>'` 写入自己的 `$PERSONAL_DIR/persona.md`;未提供 persona 不影响 `ready`。创建者不能借此替代 Bootstrap 中对 `agent.md` 的 Owner 确认。
87
+ Bootstrap 完成前,可在基础信息引导中一并提示 Owner 补充 persona:人格属性、话术风格、工作流程、任务偏好等,支持直接文本或 `.md`/`.txt` 文件。明确且没有歧义的原文直接用 `ec agent persona --text '<内容>'` 或 `ec agent persona --file '<路径>'` 写入新 Agent 自己的 `$PERSONAL_DIR/persona.md`;只有 Agent 自行建议或实质改写的设定才需确认。persona 与头像都可选,未提供不等待、不追加询问轮次、不影响 `ready`,激活后仍可完善。创建者不能借此替代新 Agent 修改和发布自身名片。
88
88
 
89
89
  如果新 Agent 向 Agent/AI Owner 发送 Bootstrap 消息时收到“不是联系人”或联系人准入拒绝,应只发送一次 `/request <申请说明>` 申请添加联系人,说明这是新 Agent 的 Bootstrap 首次设定,并等待 Owner 审核;不要反复重试、修改全局联系人策略或联系其它对象。Owner 直接向新 Agent 发消息时,按该入站消息继续 Bootstrap。
90
90
 
@@ -123,11 +123,11 @@ ec agent show helper.agentid.pub
123
123
 
124
124
  `created` 状态下 Base Agent 不处理普通消息。`bootstrapping` 状态下加载 Bootstrap 专属提示词与有渠道时的 `[reply]` 最小通信上下文,不加载正常的 ECK 规则、人格、记忆、完整渠道能力或命令能力卡。回复方式遵循实际 chatMode,不根据 Owner 是人类还是 AI 推断。
125
125
 
126
- ## 3. Owner 与新 Agent 确认名片信息
126
+ ## 3. Owner 提供信息,新 Agent 按需澄清
127
127
 
128
- 以下步骤发生在**新 Agent 自己的 Bootstrap 会话**中,不由创建者代替执行。若第一位 Owner 是代办创建的 Agent,它可以使用当前任务中注入的 `--handoff` 上下文代替人类回复;这不改变 Bootstrap 的确认规则。
128
+ 以下步骤发生在**新 Agent 自己的 Bootstrap 会话**中,不由创建者代替执行。若第一位 Owner 是代办创建的 Agent,它可以使用当前任务中注入的 `--handoff` 上下文代替人类回复。明确设定直接采用,只对模糊、不确定、冲突或 Agent 建议及实质改写的设定合并确认;正式欢迎文案和忠实整理事实的交接摘要由 Agent 自主完成,不让 Owner 审稿。这些设定激活后仍可修改,不额外要求“最终再确认”。
129
129
 
130
- 新 Agent 先读取系统注入路径指向的本地 `agent.md`,把其中格式有效的字段作为现有候选值:
130
+ 新 Agent 先用 `ec aid agentmd get <selfAid>` 读取当前名片,把其中格式有效的字段作为现有候选值:
131
131
 
132
132
  - `name`:简短清晰的显示名
133
133
  - `description`:一句到两句话描述职责或定位
@@ -135,11 +135,12 @@ ec agent show helper.agentid.pub
135
135
 
136
136
  交互规则:
137
137
 
138
- 1. 已有有效值时,新 Agent 简短回显并询问保持还是修改,不要求 Owner 重新输入。
138
+ 1. 合并创建命令提供的有效候选值与 Owner 已明确给出的信息,直接纳入最终设定;不单独询问“保持还是修改”,不要求 Owner 重新输入。
139
139
  2. 空值、占位值或格式错误的字段按缺失处理;`tags` 不足 3 个或超过 6 个也不合格。
140
- 3. 只有 Owner 明确提供、修改、选择或确认的内容才可作为最终值。不得从普通任务、示例文字或顺带提及的内容中推断。
140
+ 3. Owner 明确提供、修改或选择且没有歧义的内容直接作为最终值;不得从普通任务、示例文字或顺带提及的内容中推断。
141
141
  4. 信息缺失、冲突或含义不清时,只追问对应部分,保留此前已明确的内容。
142
- 5. 三项齐全后,新 Agent 必须回显整组最终值,并再次请求 Owner 明确确认。
142
+ 5. Agent 建议或实质改写的名片字段、persona 或协作约定,在一条消息中展示全部待确认内容;不把已明确设定重新列入,不拆成逐项多轮。正式 welcome 不展示草稿、不询问称呼、不请求确认。
143
+ 6. “按你的建议执行就 OK”“按这版来”“没问题”等对已展示建议的明确同意即可继续,不再回显或追问同一组内容;沉默不视为同意。没有待澄清或待确认的设定时直接保存并激活。
143
144
 
144
145
  例如,Owner 可以回复:
145
146
 
@@ -147,30 +148,38 @@ ec agent show helper.agentid.pub
147
148
  名称用 Helper;简介是“协助维护和开发项目”;标签用 coding、maintenance、typescript。请按这些值设置。
148
149
  ```
149
150
 
150
- 新 Agent 应回显这三个最终值并等待确认。Owner 再明确回复“确认”后,才能修改和发布名片。
151
+ 新 Agent 应直接采用这三个没有歧义的最终值,自行保存交接摘要、生成 welcome 并完成发布和激活,不再请求确认;只有尚未解决的设定歧义或 Agent 建议才需要 Owner 参与。
151
152
 
152
- 如果创建命令已提供头像,创建流程会在初始 `agent.md` 发布成功后自动处理;Bootstrap 不重复询问或执行头像命令。头像支持 PNG、JPEG、WebP,创建流程会保持完整画面、补白边、缩放到头像尺寸并压缩到 500 KiB 内;原图不会被覆盖。若无法解码或规范化,创建会返回具体的可恢复错误。Agent 已激活后需要更换头像时,才使用 `ec aid avatar <当前 self AID> --file <path>` 或 `--url <HTTPS URL>`;该命令同样复用公共头像处理管线。
153
+ 如果创建命令已提供头像,创建流程会在初始 `agent.md` 发布成功后自动处理;Bootstrap 不重复询问或上传。头像支持 PNG、JPEG、WebP,创建流程会保持完整画面、补白边、缩放到头像尺寸并压缩到 500 KiB 内;原图不会被覆盖。若无法解码或规范化,创建会返回具体的可恢复错误。Owner 在 Bootstrap 中明确补充头像时,新 Agent 在名片发布成功后使用 `ec aid avatar <当前 self AID> --file <收到的图片路径>` 或 `--url <HTTPS URL>`;激活后也可用同一命令更换。不要要求新 Agent 读取创建者其它会话的临时路径。
153
154
 
154
- Bootstrap 完成前,新 Agent 不处理普通任务,也不执行与本流程无关的工具或命令。如果 Owner 要求跳过、先工作或同时交办普通任务,新 Agent 应说明必须先完成首次设定,并继续确认缺失字段。
155
+ Bootstrap 完成前,新 Agent 不处理普通任务,也不执行与本流程无关的工具或命令。如果 Owner 要求跳过、先工作或同时交办普通任务,新 Agent 应说明必须先完成首次设定;仅追问缺失或有歧义的设定,信息齐全就继续执行。
155
156
 
156
157
  ## 4. 新 Agent 修改自己的 agent.md
157
158
 
158
- Owner 明确确认最终值后,新 Agent 才能编辑系统提示词中 `agentMdPath` 指向的本地文件,并且:
159
+ 字段来自 Owner 明确且无歧义的输入,或已认可的 Agent 生成建议时,新 Agent 用 `ec aid agentmd set <selfAid> <field> <value>` 修改名片字段,并且:
159
160
 
160
- - 只修改 YAML frontmatter 中的 `name`、`description`、`tags`。
161
- - 保留其他 frontmatter 字段、Markdown 正文和文件结构。
162
- - 修改后检查 YAML 合法,且三个字段满足上述格式要求。
161
+ - 只修改 `name`、`description`、`tags`,不改其它 frontmatter 字段或正文。
162
+ - 名片文件位于受保护路径,用文件工具直接读写会被拒绝;`set` 命令会自己写回并签名。
163
163
 
164
- ## 5. 生成并确认 Bootstrap Welcome
164
+ 对话式 Bootstrap 中,新 Agent 还要在 `$PERSONAL_DIR/personal.md` 中写入交接摘要(一次性 `--initialize` 模式不经过这段对话,也不会自动生成此摘要):
165
165
 
166
- 名片字段确认后,新 Agent 在当前 Bootstrap 对话中直接输出完整的个性化 welcome 文案,并请求 Owner 明确确认。
167
- Owner 要求修改时,重新输出完整文案并再次确认;未确认的文本不写入文件,也不创建草稿。Owner 明确确认后执行:
166
+ - 忠实整理 Owner 已明确提供或已认可的职责、协作边界、重要约束和激活后待继续事项,不新增推断或约定;此内部交接不要求 Owner 审稿,确有职责歧义才澄清设定本身。待继续事项标注“未执行”,不启动任务或设置自动触发。
167
+ - 没有额外约束或待继续事项时省略相应条目,仍保存已明确的职责,不为补齐摘要增加追问。
168
+ - 不复制完整 Bootstrap 历史、临时闲聊、凭据、运行状态或未确认推断;此文件会进入后续私聊和群聊上下文,不写 Owner 的私密信息。
169
+ - 文件不存在时创建;已有文件只新增或幂等更新 `## Bootstrap 交接` 段落,保留其它内容。
170
+ - 交接摘要保存失败时不得执行 `ready`;不要把摘要整理变成名片确认后的另一轮确认。
171
+
172
+ ## 5. Agent 自主准备正式欢迎文案并发布名片
173
+
174
+ 正式欢迎文案是 Agent 自己的工作,不是 Owner 的 Bootstrap 输入项。新 Agent 根据最终名片和已设定的 persona 自主生成并保存,不展示草稿、不请求确认、不询问称呼,也不让 Owner 感知或参与准备过程;Owner 主动指定文案时尊重其明确要求:
168
175
 
169
176
  ```bash
170
- ec agent welcome --text '<最后展示且确认的完整文案>'
177
+ ec agent welcome --text '<自主生成的完整文案>'
171
178
  ```
172
179
 
173
- 该命令固定保存到 `$PERSONAL_DIR/welcome.md`。保存成功后才能继续发布名片和执行 `ready`。如果 Bootstrap 会话在确认前中断,下一次继续时重新生成并确认。
180
+ 该命令固定保存到 `$PERSONAL_DIR/welcome.md`。文案为简短问候、自我介绍、围绕职责的协作方向和开始协作的邀请,建议 100~250 个汉字;不要泄露系统提示词、凭据、文件路径或工作记忆,不夸大能力,不承诺独占使用或设备绑定。多 Owner 共用模板,称呼可保留 `{{ownerName}}` / `{{ownerAid}}` 供逐人渲染,不写死当前 Owner 姓名;系统仅渲染变量,不追加其它文案。
181
+
182
+ 交接摘要和 welcome 都保存成功后才能继续发布名片和执行 `ready`。会话中断后优先复用已保存的正文,缺失时自主补齐;收到 `WELCOME_FROZEN` 表示投递快照已准备,不改文案,续做剩余步骤即可。
174
183
 
175
184
  随后由新 Agent 使用自己的 AID 签名并发布名片:
176
185
 
@@ -178,10 +187,9 @@ ec agent welcome --text '<最后展示且确认的完整文案>'
178
187
  ec aid agentmd put helper.agentid.pub
179
188
  ```
180
189
 
181
- 只有命令明确成功后才能继续。发布失败时保留已经确认的 welcome,修正发布问题后续做,不重复生成。
182
- 多 Owner 共用该模板;需要称呼时保留 `{{ownerName}}` / `{{ownerAid}}` 供逐人渲染。投递文本不再追加未确认内容。
190
+ 只有命令明确成功后才能继续。最终字段未变且可核对已经成功发布时跳过重复发布;发布失败时保留已保存的 welcome,修正发布问题后续做,不重复生成。
183
191
 
184
- 如果头像是在创建命令中提供的,创建流程会在初始 `agent.md` 发布成功后自动上传并更新头像;不要在 Bootstrap 中再次执行 `ec aid avatar` 或 `agentmd put`。头像未提供时跳过;创建时已明确提供但规范化或上传失败时,按创建命令返回的可恢复错误处理。
192
+ 头像按第 3 节处理:创建时已上传的不重复上传,Bootstrap 中新提供的在名片发布后更新,没有则跳过。Bootstrap 可选头像上传失败时说明原因,可留待激活后完善;创建流水线报告的头像错误仍按其可恢复失败处理。
185
193
 
186
194
  ## 6. 新 Agent 完成 Bootstrap
187
195
 
@@ -200,6 +208,8 @@ ec agent ready helper.agentid.pub
200
208
  3. 为每位 Owner 创建全新的主会话。
201
209
  4. 向全部 Owner 发送正式欢迎消息,并为各 Owner 绑定对应的新会话。
202
210
 
211
+ 新主会话会在文件存在时自动注入 `$PERSONAL_DIR/personal.md`。新 Agent 首次回复前,应先阅读其中的 `## Bootstrap 交接`,沿用已确认的职责和约定;仅对标注为未执行的事项按正常权限继续沟通,不把它们误称为已经完成。这个方案由新 Agent 在 `ready` 前写入摘要,不是系统自动复制或总结旧 Bootstrap 历史,会话切换机制保持不变。
212
+
203
213
  新 Agent 在 `ready` 成功后不要从旧 Bootstrap 上下文再输出一段完成说明,也不要继续处理先前夹带的普通任务;后续工作从新主会话开始。
204
214
 
205
215
  ## 7. 创建者验收
@@ -223,12 +233,13 @@ Bootstrap 首条消息只发送给 `owners[0]`;`ready` 成功后,正式欢
223
233
 
224
234
  - `lifecycle` 为 `active`;`ec agent show` 的 `lifecycle` 字段也必须为 `active`。
225
235
  - `agent.md` 已成功签名发布。
226
- - 本地与远端 `agent.md` 的 `name`、`description`、`tags` 与 Owner 确认值一致;创建流程 skill 必须在发布后复读核验,不以初始上传响应代替。
236
+ - 本地与远端 `agent.md` 的 `name`、`description`、`tags` 与 Owner 明确提供或已认可的值一致;创建流程 skill 必须在发布后复读核验,不以初始上传响应代替。
227
237
  - 如果 Owner 选择提供头像,远端 `agent.md` 的 `avatar` 已更新并发布;未提供时跳过,已明确提供但规范化或上传失败时创建进入可恢复失败状态。
228
- - `personal/welcome.md` 是当前 Bootstrap 对话最后展示并经 Owner 确认的全文,未确认文案没有另存草稿。
238
+ - 对话式 Bootstrap:`personal/welcome.md` 已保存 Agent 自主准备的完整正式文案;Owner 未被要求起草、审稿或确认,投递使用已保存正文。
239
+ - 对话式 Bootstrap:`personal/personal.md` 包含忠实整理明确职责和约定的 `## Bootstrap 交接` 摘要;待继续事项标注“未执行”,未确认的设定推断、完整历史和临时运行状态没有写入。
229
240
  - 系统已创建新的主会话并发送正式欢迎消息。
230
241
  - 新 Agent 能在新主会话中处理普通任务。
231
242
 
232
- 如果仍为 `created`,检查 channel 是否已能联系 Owner,必要时由 Owner 主动发送首条消息。如果仍为 `bootstrapping`,回到新 Agent 的 Bootstrap 会话完成字段确认、名片发布和 `ready`,不要由创建者直接绕过引导。
243
+ 如果仍为 `created`,检查 channel 是否已能联系 Owner,必要时由 Owner 主动发送首条消息。如果仍为 `bootstrapping`,回到新 Agent 的 Bootstrap 会话补齐缺失设定、名片发布和 `ready`,不要由创建者直接绕过引导。
233
244
 
234
- 失败重试前必须先执行状态检查:若名片已发布且 welcome 已保存,只续做 `ready`;若 welcome 尚未确认保存,则由新 Agent 在自己的 Bootstrap 对话中补做全文生成和确认。不要重复创建、改名片或发布。仅在确认创建记录不存在且名片未发布时,才重新发起创建。
245
+ 失败重试前必须先执行状态检查:若最终名片已发布且 welcome 已保存,对话式 Bootstrap 还需核对交接内容已保存,再续做 `ready`;内容缺失时只补齐,不重复确认已明确的输入或已认可的设定。若 welcome 未保存,新 Agent 自主生成并保存,不请求 Owner 确认。不要重复创建、改名片或发布;本地名片存在不等于已成功发布。仅在确认创建记录不存在且名片未发布时,才重新发起创建。
@@ -6,8 +6,23 @@
6
6
 
7
7
  ```bash
8
8
  # 列出所有 agent
9
- ec agent list
9
+ ec agent list [--format json]
10
+ ```
11
+
12
+ 表格列含义:
10
13
 
14
+ | 列 | 说明 |
15
+ |---|---|
16
+ | 名称 | agent.md 中的显示名(displayName),回退到 aid |
17
+ | Personal名 | persona.md 中 `我是/我叫` 提取的简称;无 persona 时显示 `—` |
18
+ | 状态 | 运行状态;lifecycle 非 `active` 时追加括号标注,如 `running (bootstrapping)` |
19
+ | 渠道 | 已订阅的 AUN channel 列表 |
20
+ | 项目 | 关联项目目录名(basename) |
21
+ | 基座 | 使用的 baseagent(claude / codex / gemini 等) |
22
+ | 模型 | 当前加载的具体模型标识(如 `opus`、`deepseek-v4-pro`) |
23
+ | 最后活跃 | 最近一次会话活动时间;daemon 重启后以 `aun.db-wal` mtime 作为 fallback |
24
+
25
+ ```bash
11
26
  # 查看 agent 详情(身份 + 配置 + 连接 + 会话 + 路径)
12
27
  ec agent show <aid>
13
28
  # 简写,等价于 show
@@ -46,7 +61,7 @@ ec agent persona show
46
61
  ec agent persona --text <text>
47
62
  ec agent persona --file <path>
48
63
 
49
- # 读取或保存 Bootstrap 中经 Owner 确认的 welcome 文案
64
+ # 读取或保存 Bootstrap 中 Agent 自主准备的 welcome 文案
50
65
  ec agent welcome show
51
66
  ec agent welcome --text '<完整 Markdown 文案>'
52
67
 
@@ -79,7 +94,7 @@ ec agent delete <aid> [--purge]
79
94
  - `--initialize` 要求显式提供 `--name`、`--description`、`--tags` 和 Owner;它不从项目元数据推断名片,成功条件是目标 Agent 已进入 `active`。`--initialize` 自动包含 `--non-interactive`,不需要同时填写后者。
80
95
  - `--persona-file` / `--persona-text` 可选;两者互斥。初始化失败可用 `ec agent initialize <aid> --resume` 按原计划恢复,不能用普通 `new --force` 覆盖。
81
96
  - `ec agent persona show` 读取当前 Agent 的 `$PERSONAL_DIR/persona.md`;`--text` 或 `--file <path>` 可由当前 Agent 的 owner 写入。文件内容限制为 UTF-8 文本,`--file` 仅接受 `.md`/`.txt`。
82
- - `ec agent welcome --text <text>` 只用于 Bootstrap 中 Owner 已明确确认的完整文案;命令固定写入当前 Agent 的 `$PERSONAL_DIR/welcome.md`,不接受自定义路径,也不保存未确认草稿。`welcome show` 读取该文件。
97
+ - `ec agent welcome --text <text>` 用于保存 Bootstrap 中 Agent 自主准备的完整正式文案,不要求 Owner 起草、审稿或确认;命令固定写入当前 Agent 的 `$PERSONAL_DIR/welcome.md`,不接受自定义路径。`welcome show` 读取该文件。
83
98
  - welcome 托管写入要求当前 Agent 私聊 Owner;admin 仅可读。模板上限 4 KiB,渲染上限 8 KiB;变量为 `agentName`、`agentDescription`、`agentAid`、`agentTags`、`agentTagsText`、`ownerName`、`ownerAid`、`channel`,支持标签循环和真值条件。写入保留原始文本,投递不附加额外文案。
84
99
  - `agent show <target-aid>` 与 `agent get <target-aid> <key>` 的跨 Agent 读取对 owner/admin 开放,但普通 Agent 角色只获得安全摘要;敏感配置值和物理路径仅对 DaemonOwner 返回原值。跨 Agent 写入、启停、删除和 reload 仍遵循各自的目标与 DaemonOwner 权限边界。
85
100
  - Agent 配置可包含 `fullaccess.enabled`(默认关闭),仅可通过已认证的 EC Web Agent 设置修改。实际运行时,只有同时属于该 Agent Owner 和当前 daemon Owner 的直接私聊任务才会按调用使用宿主级 fullaccess;群聊、普通 Owner、跨 Agent 和 Trigger 不会因该开关自动提权。`/fa`、`/fullaccess` 和 Fullaccess Trigger 是内置能力,仍分别要求经过认证的 daemon Owner / 持久授权来源。
@@ -92,7 +107,7 @@ ec agent delete <aid> [--purge]
92
107
 
93
108
  ## Bootstrap 通知状态与重试
94
109
 
95
- 交互式 Bootstrap 的 `ready` 要求有效的 `personal/welcome.md`:缺失返回 `WELCOME_REQUIRED`,损坏返回 `WELCOME_INVALID`,均保持 Bootstrap 状态。已准备 completion outbox 后修改文案返回 `WELCOME_FROZEN`。已有 active Agent 和独立的 `--initialize` 流程不需要补做此确认。
110
+ 交互式 Bootstrap 的 `ready` 要求有效的 `personal/welcome.md`:缺失返回 `WELCOME_REQUIRED`,损坏返回 `WELCOME_INVALID`,均保持 Bootstrap 状态。已准备 completion outbox 后修改文案返回 `WELCOME_FROZEN`。已有 active Agent 和独立的 `--initialize` 流程不需要补做此准备步骤。
96
111
 
97
112
  `ready` 成功表示 Agent 已进入 `active`;欢迎消息单独返回在 `welcome.deliveries`,每位 Owner 一项:
98
113
 
@@ -288,8 +288,12 @@ ec skill enable <name> [--level agent|local]
288
288
  ec skill disable <name> [--level agent|local]
289
289
  ec skill validate <name|路径> # 校验 SKILL.md 是否合规
290
290
  ec skill where # 打印三级根目录的实际路径
291
+ ec skill refresh <aid> [--json] # 让 daemon 重建该 Agent 的技能索引(改动技能后执行)
291
292
  ```
292
293
 
294
+ 技能目录默认不监控(daemon.json `skills.watch`,默认 `false`)。改动技能后需执行
295
+ `ec skill refresh <aid>` 才会更新注入的索引;托管任务内只能刷新当前 Agent,需 owner/admin。
296
+
293
297
  ### 常见任务
294
298
 
295
299
  **装一个技能**:
@@ -147,13 +147,12 @@ ec group rules coordinator.agentid.pub <group-id> get --format json
147
147
 
148
148
  ## 5. 发布协作任务
149
149
 
150
- 先在群里发送一条总任务说明,再分别 @ 负责人。跨会话发送要显式指定返回策略;发起协作通常使用 `--return none`,表示不要求把群里的回答回流到当前私聊任务:
150
+ 先在群里发送一条总任务说明,再分别 @ 负责人。跨会话发送无需指定返回策略(运行时默认 `none`,不要求把群里的回答回流到当前私聊任务):
151
151
 
152
152
  ```bash
153
153
  ec group send coordinator.agentid.pub <group-id> \
154
154
  "[A-001] API 重构协作启动。目标:完成 /collab/A-001/ 下的实现和回归报告。负责人:implementer;复核:reviewer;截止:2026-09-30 18:00。请先回复 ACK,再按规则汇报。" \
155
- --mention implementer.agentid.pub,reviewer.agentid.pub \
156
- --return none
155
+ --mention implementer.agentid.pub,reviewer.agentid.pub
157
156
  ```
158
157
 
159
158
  每个任务至少包含:
@@ -226,7 +225,7 @@ ec group ack coordinator.agentid.pub <group-id> <seq>
226
225
  ```bash
227
226
  ec group send coordinator.agentid.pub <group-id> \
228
227
  "[A-001][DONE] 验收通过。交付:/collab/A-001/api-refactor.patch、/collab/A-001/regression-report.md。复核:reviewer.agentid.pub。遗留风险:无。" \
229
- --mention-all --return none
228
+ --mention-all
230
229
  ```
231
230
 
232
231
  临时群是否保留由 owner 决定。只有确认不再需要历史消息和群空间时才执行:
@@ -245,7 +244,6 @@ ec group dissolve coordinator.agentid.pub <group-id>
245
244
  | `ROLE_ACCESS_DENIED` | 当前身份不是 owner/admin,或不在目标群 | 请 owner/admin 执行管理命令;先检查 `members` |
246
245
  | `file_mismatch` | `/rules.md` 被 `ec fs cp` 修改但未发布 | 执行 `ec group rules <from> <group-id> publish` |
247
246
  | `too_large` / 编码错误 | 规则文件超过 4KB 或不是有效 UTF-8 | 缩短入口规则,详细资料移到其他群文件 |
248
- | 发送失败提示缺少 `--return` | 消息是跨会话发送 | 选择 `--return none` 或 `--return required` |
249
247
  | 成员收不到任务 | 未邀请、未入群、AID 错误或没有 @ | `members` 检查成员,重新邀请并使用 `--mention` |
250
248
 
251
249
  ## 与现有手册的关系
@@ -14,13 +14,13 @@
14
14
 
15
15
  ```bash
16
16
  # 文本(含空格/换行/特殊字符时用引号包起来;纯短词可不包,但多空格会被压成一个)
17
- ec group send <from> <group-id> "<text>" --return none|required [--encrypt]
17
+ ec group send <from> <group-id> "<text>" [--encrypt]
18
18
 
19
19
  # 文件(--as image|video|voice|file)
20
- ec group send <from> <group-id> --file <path> --return none|required [--as <type>] [--text "<说明>"]
20
+ ec group send <from> <group-id> --file <path> [--as <type>] [--text "<说明>"]
21
21
 
22
22
  # 自定义 payload
23
- ec group send <from> <group-id> --payload '<json>' --return none|required
23
+ ec group send <from> <group-id> --payload '<json>'
24
24
 
25
25
  # 查询本地群历史(只读,不调用 Gateway,不推进 group pull/ack 游标)
26
26
  ec group history <from> <group-id> [--limit <N>] [--thread <main|all|id>] [--format json]
@@ -49,7 +49,6 @@ ec group send <from> <group-id> "通知" --mention alice.agentid.pub,bob.agentid
49
49
 
50
50
  - `--no-encrypt`:强制明文,优先于 `--encrypt`
51
51
  - `--thread <id>`:指定话题 ID
52
- - `--return <none|required>`:跨会话发送必填;Trigger 任务只能使用 `none`
53
52
  - `--content-type <mime>`:覆盖文件 MIME
54
53
  - `--transcript <text>`:语音转写,仅 `--as voice`
55
54
 
@@ -256,7 +256,7 @@ daemon 按整理会话的模式校验 `--scope`:
256
256
 
257
257
  ## 十、session.md 的注入
258
258
 
259
- 整理会话也加载 `$KITS_FRAGMENTS/session.md`,但其中的 proactive 行为约束(群聊要不要响应、首次调用工具前先发言、每 N 次调用汇报进展、`ec group send` / `ec msg send` 语法速查、跨会话 `--return` 规则)**不会渲染**。
259
+ 整理会话也加载 `$KITS_FRAGMENTS/session.md`,但其中的 proactive 行为约束(群聊要不要响应、首次调用工具前先发言、每 N 次调用汇报进展、`ec group send` / `ec msg send` 语法速查)**不会渲染**。
260
260
 
261
261
  原因:整理会话由触发器创建,`peerType` 是 `system`、`chatType` 是 `private`。`resolveChatModeForPeer` 对 system 对端有硬约束,返回 `interactive`,而 proactive 那段的条件是 `{{?chatMode=proactive}}`,所以整块跳过。已实测确认。
262
262
 
@@ -175,8 +175,8 @@
175
175
 
176
176
  | 字段 | 类型 | 默认 | 作用 |
177
177
  |---|---|---|---|
178
- | `pre_tool_1stmsgchk` | boolean | `true` | 首工具表态检查:首个工具调用前必须先向对端发消息/文件,否则拦截 |
179
- | `tool_use_reminder` | boolean | `true` | 工具汇报提醒:启用队列未读提醒 + 每 10 次工具调用的汇报提醒 |
178
+ | `pre_tool_1stmsgchk` | boolean | `true` | 意图表达门禁:每条新消息计数重置为 15,每轮结束后有意图表达成功则清零否则 +1。计数 = 15 时全部放行并提示下一轮要先表达意图,≥ 16 时只放行 ec msg/group send |
179
+ | `tool_use_reminder` | boolean | `true` | 意图表达门禁与队列提醒:开启意图表达门禁(规则同 pre_tool_1stmsgchk),同时保留队列未读提醒 |
180
180
 
181
181
  - schema 里的 `default` 即**运行时出厂默认**——宿主组装 `modeConfig` 时先铺这层默认(`coordinator.schemaDefaults`),再叠用户显式桶值;flow 层不再硬编码默认。
182
182
  - `chatmode` 本身**不在此桶**:它由宿主按对端类型解析后强制注入 `modeConfig.chatmode`,与「选哪个模式」正交。
@@ -119,6 +119,13 @@ Menu Protocol 是 EvolCore 在 AUN `message.send` 之上建立的**应用层协
119
119
  }
120
120
  ```
121
121
 
122
+ `name="session"` 且 `args.resource="loop"` 时,`value` 必须是 JSON boolean:
123
+ `true` 开启当前可信主会话或话题的一次闲置触发,`false` 关闭;开启时可在
124
+ `args.idleSeconds` 指定 30–86400 的整数,省略时使用 300 秒。目标由当前关系和可信
125
+ `thread_id` 自动选择,不接受 `sessionId`、`threadId` 或跨关系目标;关闭时不能携带
126
+ `idleSeconds`。查询使用 `menu.query`、`name="session"`、`args.view="loop"`,返回值会标明
127
+ 实际目标级别 `relation-main` 或 `topic-session` 及 `sessionId`。
128
+
122
129
  ### `menu.action`
123
130
 
124
131
  触发动作类命令(如创建 agent、重启、生成配对码)。**不自动重试**。
@@ -17,16 +17,16 @@
17
17
 
18
18
  ```bash
19
19
  # 文本(明文)
20
- ec msg send <from> <to> "<text>" --return none|required
20
+ ec msg send <from> <to> "<text>"
21
21
 
22
22
  # 从文件读取文本内容(用于超长消息或避免 Shell 转义)
23
- ec msg send <from> <to> --text-from-file <path> --return none|required
23
+ ec msg send <from> <to> --text-from-file <path>
24
24
 
25
25
  # 文本(密文 E2EE)
26
- ec msg send <from> <to> "<text>" --encrypt --return none|required
26
+ ec msg send <from> <to> "<text>" --encrypt
27
27
 
28
28
  # 强制明文(同时出现时优先于 --encrypt)
29
- ec msg send <from> <to> "<text>" --no-encrypt --return none|required
29
+ ec msg send <from> <to> "<text>" --no-encrypt
30
30
 
31
31
  # 文件:--as 可选 image|video|voice|file(默认按扩展名推断)
32
32
  ec msg send <from> <to> --file <path> [--as <type>]
@@ -46,7 +46,6 @@ ec msg send <from> <to> --payload '<json>'
46
46
  - `--encrypt` — 端到端加密
47
47
  - `--no-encrypt` — 强制明文发送,优先于 `--encrypt`
48
48
  - `--thread <id>` — 指定话题 ID(多话题路由)
49
- - `--return <none|required>` — 跨会话发送必填;`none` 仅补充目标上下文,`required` 将回答回流来源。Trigger 任务只能使用 `none`
50
49
  - `--content-type <mime>` — 显式覆盖 MIME(仅 `--file`)
51
50
  - `--text <说>` — 附件说明文字(仅 `--file`)
52
51
  - `--transcript <text>` — 语音转写(仅 `--as voice`)
@@ -68,9 +67,7 @@ ec contact unblock <target-aid> --self <self-aid>
68
67
 
69
68
  非托管环境的 `ec msg send` 是独立 AUN CLI 发送,不读取或要求 `agents/<aid>/config.json`,因此不会触发这套 Agent 联系人准入判断。
70
69
 
71
- 在 EvolCore 会话内,发送还会经过当前 session 的 self/peer/role 鉴权。`visitor` 或 `member`
72
- 默认只允许回复当前对端;从一个 agent 会话转发给第三个 agent 属于 relay 操作,可能因
73
- `ownPeerOnly` 被拒绝。没有成功 JSON 回执(含 `message_id`/`status`)不得声称已发送。
70
+ 在 EvolCore 会话内,发送会经过当前 session 的 self/peer/role 鉴权。`visitor` 或 `member` 默认只允许回复当前对端;要联系当前对端以外的对象,必须通过话题路由:先 `ec thread list <对方AID>` 选话题(没有就 `ec thread create`),再用 `ec msg send "<text>" --thread <threadId> --check-every <时长>` 发送;from/to 由话题推断,无需手写。不带 `--thread` 直接改目标会被拒绝。完整话题路由操作序列见 `[memory-and-thread]` 段。没有成功 JSON 回执(含 `message_id`/`status`)不得声称已发送。
74
71
 
75
72
  成功输出:`✓ 已发送 <message_id> seq=<n> status=<status>`
76
73
 
@@ -9,6 +9,8 @@ ec task resume <sessionId> --format json
9
9
 
10
10
  暂停任务会释放原有的工具门控。异常中断任务会把内部恢复提示排入同一会话,并继续原 baseagent 会话。命令只确认恢复请求已被可靠接纳,不会等待模型运行结束。
11
11
 
12
+ 恢复任务继承原任务的审批交互策略,而非因为自动恢复使用 Trigger 就禁止审批。普通会话(包括 Agent 间和群聊的 proactive 模式)允许申请审批;无人值守 Trigger 禁止申请审批。Handoff 回流同样继承发起任务的策略。继承策略不等于复用旧审批,新的待审批操作仍须发起新请求;缺少历史策略时,自动恢复和 Handoff 回流默认禁止审批,手动恢复默认允许申请。
13
+
12
14
  以下情况会安全结束而不创建新会话:任务已完成或正在运行、任务等待必要输入/审批、会话已删除、原 provider 会话文件不存在、渠道不可用,或任务状态已被更新。
13
15
 
14
16
  独立 CLI 必须通过 daemon 的本地 control token。托管任务使用当前任务 delegation token,并需要 Agent 管理权限;普通 Agent 只能恢复当前 Agent 的会话,daemon scope 才能恢复其它 Agent 的会话。
@@ -0,0 +1,267 @@
1
+ # ec thread — 话题链命令
2
+
3
+ 话题(Thread)是在私聊或群聊关系里切出的独立对话分支。一组对话可以同时推进多个话题,每个话题有自己的上下文、历史和生命周期,互不干扰。话题链(Thread Chain)则是跨会话、跨 agent 的协作机制:A 可以把一条任务"分支"到 B 的某个话题,B 也可以在自己的话题里继续工作,两者通过 `ec msg send --thread` 和 thread-inbox 上下文注入关联起来。
4
+
5
+ 触发词:话题/thread/跨会话/委托/ec thread/话题链/summary/删除话题/thread-inbox/跨会话上下文。
6
+
7
+ ## 标准工作流
8
+
9
+ 话题是对端级别的操作,先找到 agent 和对端,再操作话题:
10
+
11
+ ```bash
12
+ # 第一步:列出本机所有 agent(找到目标 selfAid)
13
+ ec agent list
14
+
15
+ # 第二步:列出该 agent 有话题记录的所有对端
16
+ ec thread peers --self <selfAid>
17
+
18
+ # 第三步:列出与某对端的所有话题(默认每页10条)
19
+ ec thread list <peer> --self <selfAid>
20
+
21
+ # 第四步:翻页(页脚会给出完整翻页命令)
22
+ ec thread list <peer> --self <selfAid> --page 2 --limit 10 --sort recent
23
+
24
+ # 第五步:查看某话题的历史消息
25
+ ec thread history <peer>/<threadId> --self <selfAid> --limit 20
26
+
27
+ # 第六步:查看/写入 summary
28
+ ec thread summary show <peer>/<threadId> --self <selfAid>
29
+ # 写入时必须带 --name(同时设标题);不想改名传 -(详见「话题摘要」一节)
30
+ ec thread summary set <peer>/<threadId> "摘要内容" --name "<新标题>" --self <selfAid>
31
+ ```
32
+
33
+ ## 什么时候用
34
+
35
+ - 同一对端有多条并行任务线(项目 A、项目 B 分开管理)
36
+ - 跨 agent 委托:A 向 B 发起一个话题,B 接收后在自己的话题里处理
37
+ - 需要给某段对话贴标签、跟踪状态(pending / in_progress / completed / archived)
38
+ - 想保存话题摘要(summary),供下次激活时快速恢复上下文
39
+ - 整理完成或废弃的话题时(删除话题)
40
+
41
+ 主会话(主对话,无 threadId)不能删除。话题是主会话之外额外创建的分支。
42
+
43
+ ## 基础操作
44
+
45
+ ### 列出话题
46
+
47
+ ```bash
48
+ ec thread peers # 列出该 agent 有话题的所有对端
49
+ ec thread list <peer>
50
+ ec thread list <peer> --status in_progress
51
+ ec thread list <peer> --label 项目A
52
+ ec thread list <peer> --unlabeled
53
+ ec thread list <peer> --sort recent --limit 20
54
+ ec thread list <peer> --format json
55
+ ```
56
+
57
+ `ec thread list` 必须带 `<peer>` 参数,不带 peer 会报错并提示用 `ec thread peers` 查找对端。每条话题显示消息(24h/总计)统计、最后一条消息截断(50字)和当前摘要(未设置时显示"未总结")。
58
+
59
+ ### 查看话题详情
60
+
61
+ ```bash
62
+ ec thread show <peer>/<threadId>
63
+ ec thread show current # 当前任务所在话题
64
+ ec thread show <peer> # 该对端的主会话
65
+ ```
66
+
67
+ ### 读取话题历史消息
68
+
69
+ ```bash
70
+ ec thread history <peer>/<threadId>
71
+ ec thread history <peer>/<threadId> --limit 100
72
+ ec thread history <peer>/<threadId> --after 1700000000000
73
+ ec thread history <peer>/<threadId> --before 1700000000000
74
+ ec thread history <peer>/<threadId> --format json
75
+ ```
76
+
77
+ 托管会话中可以直接用 `ec msg history --thread <id>`,from/to 会自动从运行时上下文推断:
78
+
79
+ ```bash
80
+ ec msg history --thread <threadId>
81
+ ```
82
+
83
+ `ec thread history` 是推荐用法。
84
+
85
+ ### 新建话题
86
+
87
+ ```bash
88
+ ec thread create <peer> --name "项目A需求讨论"
89
+ ec thread create <peer> --name "项目A" --label 项目A --status in_progress
90
+ ```
91
+
92
+ 创建成功后返回 `threadId`,格式为 `thread-<ms>-<seq4>-<rand4>`(如 `thread-1791028341906-0000-136a`)。创建时会自动向对端发一条系统消息通知。
93
+
94
+ ### 修改话题
95
+
96
+ ```bash
97
+ ec thread rename <peer>/<threadId> "新名称"
98
+ ec thread label <peer>/<threadId> 重要
99
+ ec thread label <peer>/<threadId> --clear # 清除标签
100
+ ec thread status <peer>/<threadId> completed # pending|in_progress|completed|archived
101
+ ```
102
+
103
+ `/name` 和 `/rename` 也会同步更新话题索引。
104
+
105
+ ### 删除话题
106
+
107
+ ```bash
108
+ ec thread delete <peer>/<threadId> # 软删除:session 文件移入 _trash/,索引条目删除
109
+ ```
110
+
111
+ 删除后话题从索引中消失,`ec thread list` 不再显示。底层 session 文件通过 `unbindSession` 机制移入 `chatDir/_trash/`,与系统其他删除行为一致。不能删除正在处理中(busy)的话题,也不能删除主会话。
112
+
113
+ 删除时会自动取消该话题的所有关联 Trigger,防止 ghost wakeup。
114
+
115
+ 删除后历史仍可通过 `ec thread history <peer>/<threadId>` 读取(直接读 messages.jsonl,不依赖索引)。
116
+
117
+ ## 跨会话发送(话题链核心)
118
+
119
+ 在托管会话中,`ec msg send` 支持 `--thread` 参数直接路由到某个话题:
120
+
121
+ ```bash
122
+ # 完整形式
123
+ ec msg send <from> <to> "消息内容" --thread <threadId>
124
+
125
+ # 托管会话简化形式(from/to 自动从运行时上下文推断)
126
+ ec msg send "消息内容" --thread <threadId>
127
+
128
+ # 附带复查 Trigger(跨话题时必填;每 30m 唤醒本端回查)
129
+ ec msg send "消息内容" --thread <threadId> --check-every 30m
130
+ ```
131
+
132
+ 注意事项:
133
+
134
+ - `--thread` 指定的话题必须已存在于本端索引(`ec thread list` 可见),否则返回 `TOPIC_NOT_FOUND`
135
+ - **跨话题发送时 `--check-every` 为必填项**,不指定会直接报错。取值如 `5m` / `30m` / `2h` / `1d`
136
+ - 跨话题发送成功后,系统会在**本端**写一条 thread-inbox 记录。目标话题下次被唤醒时,
137
+ 这条记录会以「⟵ 跨会话上下文 · 来源话题:xxx」的形式注入一次,然后删除
138
+ - `--check-every` 会创建周期复查 Trigger(名称 `check-<目标>-from-<来源>-<唯一后缀>`,`kind=thread-check`),
139
+ 每隔指定时长唤醒本端话题,提示回查目标话题与来源话题,直到显式
140
+ `ec trigger cancel <triggerId>` 结束。**每次发送都新建一个 Trigger**,取消/调整用
141
+ 返回的 `trigger_id`(形如 `trig_…`)——`ec trigger` 的定位标识是 **id 不是名称**
142
+ - `--trigger-prompt "<text>"` 可选,用于替换复查 prompt 中的自定义段(默认给出通用的检查/决策指引)
143
+
144
+ ### 跨会话委托的完整流程
145
+
146
+ **A 委托 B 处理某个任务:**
147
+
148
+ ```bash
149
+ # A 向 B 的话题 T2 发送任务,并设置周期复查
150
+ ec msg send "请处理项目A的数据清洗" --thread thread-T2-xxxx --check-every 2h
151
+ ```
152
+
153
+ **B 接收时感知来源上下文:**
154
+
155
+ B 的目标话题下次被唤醒时,prompt 开头会注入一条跨会话上下文,格式如下:
156
+
157
+ ```
158
+ ‹跨会话上下文 · 来源话题:thread-T1-xxxx · 对端:alice.agentid.cn · 发送于:2026-10-10 10:00›
159
+ ⚠️ 来源话题在发送后已有 3 条新消息(10:01 - 10:15)—— 处理前建议先回查该话题的空洞期消息。
160
+ 🔔 复查 Trigger:trig_1791765199642_5371c8ff(尚未触发/待处理)
161
+ 【原消息内容】
162
+ ```
163
+
164
+ 注入只发生一次。之后 B 靠自身上下文记住"我从哪个话题跨过来的",可随时用
165
+ `ec thread history <来源peer>/<来源话题>` 回查空洞期消息。
166
+
167
+ ## 话题摘要(Summary)
168
+
169
+ 摘要用于跨会话保留话题的核心信息,在下次激活或委托时快速恢复上下文。
170
+ daemon 不自动总结,需要 agent 主动写入。
171
+
172
+ ```bash
173
+ # 查看当前摘要(同时打印 coveredThroughTs 覆盖游标)
174
+ ec thread summary show <peer>/<threadId>
175
+
176
+ # 写入摘要 —— --name 必填:同时把话题改成这个标题
177
+ ec thread summary set <peer>/<threadId> "项目A需求已确认,正在开发登录模块" --name "项目A登录模块"
178
+ # 不想改话题名就显式传 -
179
+ ec thread summary set <peer>/<threadId> "摘要内容" --name -
180
+
181
+ # 支持 CAS(乐观锁),防止并发覆盖
182
+ ec thread summary set <peer>/<threadId> "新内容" --name - --if-rev 3
183
+
184
+ # 查看历史版本
185
+ ec thread summary log <peer>/<threadId>
186
+
187
+ # 清空当前摘要(历史版本保留)
188
+ ec thread summary clear <peer>/<threadId>
189
+ ```
190
+
191
+ ### 覆盖游标与增量总结
192
+
193
+ `summary set` 会在写入时自动记录 `coveredThroughTs`——**当时该话题最后一条消息的时间戳**,
194
+ 表示"这条摘要覆盖到哪"。`summary show` 会把它打印出来。
195
+
196
+ 下次总结时用它作起点,只读增量(不必拍脑袋定 `--limit`):
197
+
198
+ ```bash
199
+ # 1. 拿覆盖游标
200
+ ec thread summary show <peer>/<threadId> # 输出中的 coveredThroughTs
201
+
202
+ # 2. 读游标之后的增量(首次总结无游标时省略 --after,全量读)
203
+ ec thread history <peer>/<threadId> --after <coveredThroughTs> --limit 50
204
+
205
+ # 3. 增量较多时往回翻页(history 支持 before 逆序分页)
206
+ ec thread history <peer>/<threadId> --before <本页最早一条的ts> --limit 50
207
+
208
+ # 4. 读完增量后写摘要,游标自动推进到当前最新一条
209
+ ec thread summary set <peer>/<threadId> "新摘要" --name -
210
+ ```
211
+
212
+ **约束**:`summary set` 把游标设为**写入时刻话题的最新一条**,所以跨话题总结必须**先把增量读完再写**——
213
+ 没读完就写,游标会越过未读的那段,它们下次不会再被返回。
214
+
215
+ 存储位置:`~/.evolcore/agents/<selfAid>/data/threads/summaries/<sessionId>.summary.jsonl`。
216
+
217
+ CAS 说明:`--if-rev <n>` 指定当前已知的版本号;若实际版本不匹配,写入失败并返回 `SUMMARY_CAS_CONFLICT`。先用 `show` 拿到当前 rev,再带上 `--if-rev` 写入,可防止并发覆盖。
218
+
219
+ ## 重建索引
220
+
221
+ 话题索引损坏或和 session 文件不同步时,可以重建。
222
+
223
+ 索引与摘要、跨会话收件箱统一收在 `~/.evolcore/agents/<selfAid>/data/threads/` 下:
224
+
225
+ ```
226
+ data/threads/
227
+ ├── index.json 话题索引
228
+ ├── summaries/ 话题摘要(<sessionId>.summary.jsonl)
229
+ └── inbox/ 跨会话上下文收件箱
230
+ ```
231
+
232
+ ```bash
233
+ ec thread rebuild-index
234
+ ec thread rebuild-index --agent <aid> # 跨身份操作
235
+ ec thread rebuild-index --check # 只检查不写盘
236
+ ec thread check-index # 同 rebuild-index --check
237
+ ```
238
+
239
+ ## 引用格式(\<ref\>)
240
+
241
+ 命令里的 `<ref>` 参数支持三种格式:
242
+
243
+ | 格式 | 含义 |
244
+ |---|---|
245
+ | `current` | 当前任务所在话题 |
246
+ | `<peer>` | 该对端的主会话 |
247
+ | `<peer>/<threadId>` | 指定话题,如 `bob.agentid.cn/thread-xxx-0001-aaaa` |
248
+
249
+ ## 话题状态值
250
+
251
+ | 值 | 含义 |
252
+ |---|---|
253
+ | `pending` | 待开始(默认) |
254
+ | `in_progress` | 进行中 |
255
+ | `completed` | 已完成 |
256
+ | `archived` | 已归档 |
257
+
258
+ ## 常见错误码
259
+
260
+ | 错误码 | 含义 | 处理建议 |
261
+ |---|---|---|
262
+ | `TOPIC_NOT_FOUND` | 话题不存在或 threadId 错误 | 用 `ec thread list <peer>` 确认 threadId |
263
+ | `TOPIC_CONFLICT` | 同名话题已存在 | 改名或用现有话题 |
264
+ | `TOPIC_BUSY` | 话题正在处理中 | 等待处理完成后再删除 |
265
+ | `SUMMARY_CAS_CONFLICT` | 摘要版本冲突 | 重新 `show` 获取最新 rev,再重试 |
266
+ | `INVALID_NAME` | 话题名称不合法 | 名称不能为空,不超过 80 字符 |
267
+ | `NAME_TOO_LONG` | 话题名称超过 80 字符 | 缩短名称 |