evolcore 0.0.33 → 0.0.34
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.
- package/CHANGELOG.md +37 -0
- package/bin/ec.js +3 -2
- package/bin/install-codex-managed-hooks.mjs +12 -1
- package/dist/agents/baseagent-availability.js +20 -36
- package/dist/agents/claude-runner.js +82 -13
- package/dist/agents/codex/diagnostics.js +37 -11
- package/dist/agents/codex-runner.js +218 -44
- package/dist/agents/ecagent-runner.js +73 -20
- package/dist/agents/runner-types.js +5 -6
- package/dist/aun/aid/identity.js +1 -1
- package/dist/channels/aun.js +16 -6
- package/dist/channels/daemon.js +6 -3
- package/dist/cli/aun-commands.js +3 -2
- package/dist/cli/ctl-command.js +3 -1
- package/dist/cli/daemon-commands.js +120 -19
- package/dist/cli/fs-command.js +2 -1
- package/dist/cli/index.js +20 -6
- package/dist/cli/integrity-command.js +196 -0
- package/dist/cli/memory-command.js +158 -145
- package/dist/cli/thread-command.js +5 -3
- package/dist/cli/trigger-command.js +6 -1
- package/dist/config/config-field-policy.js +4 -0
- package/dist/config/config-manager.js +19 -0
- package/dist/config/contact-book-store.js +5 -0
- package/dist/config/role-service.js +13 -0
- package/dist/config/runtime-env.js +16 -0
- package/dist/config-store.js +30 -0
- package/dist/core/audit/log-integrity.js +3 -1
- package/dist/core/auth/agent-delegation.js +108 -35
- package/dist/core/auth/delegation-diagnostics.js +414 -0
- package/dist/core/auth/operation-authorizer.js +1 -1
- package/dist/core/auth/operation-catalog.js +16 -0
- package/dist/core/command/agent-control.js +18 -26
- package/dist/core/command/command-handler.js +138 -4
- package/dist/core/command/daemon-diagnostics.js +1 -0
- package/dist/core/command/menu-catalog.js +3 -0
- package/dist/core/command/menu-handler.js +22 -7
- package/dist/core/command/menu-protocol.js +1 -0
- package/dist/core/command/slash-handler.js +2 -0
- package/dist/core/daemon-bootstrap.js +4 -7
- package/dist/core/file-integrity/read.js +61 -0
- package/dist/core/file-integrity/store.js +262 -0
- package/dist/core/ipc-registration.js +36 -1
- package/dist/core/memory/batch-meta.js +132 -0
- package/dist/core/memory/consolidation-context.js +35 -14
- package/dist/core/memory/consolidation-ops-records.js +14 -16
- package/dist/core/memory/consolidation.js +91 -26
- package/dist/core/memory/index-manager.js +19 -28
- package/dist/core/memory/memory-admin.js +19 -14
- package/dist/core/memory/memory-document.js +53 -9
- package/dist/core/memory/memory-writer.js +30 -15
- package/dist/core/message/im-renderer.js +20 -4
- package/dist/core/message/message-bridge.js +2 -1
- package/dist/core/message/response-engine.js +584 -47
- package/dist/core/permission/ec-command-parser.js +93 -4
- package/dist/core/permission/protected-paths.js +5 -1
- package/dist/core/permission/readonly-shell-query.js +43 -5
- package/dist/core/permission/session-path-grants.js +334 -0
- package/dist/core/permission/tool-canonical.js +226 -0
- package/dist/core/permission/tool-policy.js +30 -62
- package/dist/core/role/runtime-policy.js +21 -10
- package/dist/core/session/session-fs-store.js +123 -8
- package/dist/core/session/session-manager.js +75 -5
- package/dist/core/skill/index-generator.js +17 -3
- package/dist/core/system-session/grants.js +40 -0
- package/dist/core/system-session/memory.js +222 -0
- package/dist/core/system-session/registry.js +74 -0
- package/dist/core/system-session/types.js +14 -0
- package/dist/core/thread/thread-service.js +13 -20
- package/dist/eck/kit-renderer.js +7 -2
- package/dist/eck/manifest-engine.js +24 -4
- package/dist/index.js +11 -2
- package/dist/ipc.js +51 -40
- package/dist/paths.js +70 -0
- package/dist/stats/billing.js +20 -8
- package/dist/trigger/feedback.js +6 -1
- package/dist/trigger/parser.js +8 -1
- package/dist/trigger/system-definitions.js +3 -3
- package/dist/utils/cross-platform.js +11 -2
- package/dist/utils/error-dict.json +18 -4
- package/dist/utils/error-utils.js +121 -0
- package/dist/utils/instance-registry.js +13 -8
- package/dist/utils/log-writer.js +12 -0
- package/dist/utils/process-introspect.js +11 -0
- package/kits/docs/context-assembly.md +0 -1
- package/kits/docs/evolcore/agent-create.md +5 -4
- package/kits/docs/evolcore/agent.md +2 -2
- package/kits/docs/evolcore/config.md +2 -2
- package/kits/docs/evolcore/ctl.md +2 -2
- package/kits/docs/evolcore/ec-capabilities.md +1 -1
- package/kits/docs/evolcore/fs-architecture.md +4 -5
- package/kits/docs/evolcore/fs.md +1 -1
- package/kits/docs/evolcore/group-collaboration.md +2 -2
- package/kits/docs/evolcore/group.md +10 -10
- package/kits/docs/evolcore/memory-architecture.md +4 -5
- package/kits/docs/evolcore/memory-consolidation.md +18 -14
- package/kits/docs/evolcore/memory-tags.md +3 -1
- package/kits/docs/evolcore/memory.md +24 -12
- package/kits/docs/evolcore/model.md +16 -0
- package/kits/docs/evolcore/msg.md +7 -7
- package/kits/docs/evolcore/thread-chain.md +5 -5
- package/kits/docs/prompt-loading-architecture.md +0 -1
- package/kits/eck_manifest.json +0 -20
- package/kits/eck_manifest.memory.json +0 -12
- package/kits/rules/01-overview.md +11 -0
- package/kits/rules/03-identity.md +6 -3
- package/kits/rules/06-channel.md +1 -1
- package/kits/rules/07-memory-and-thread.md +12 -15
- package/kits/schemas/_meta.json +7 -1
- package/kits/schemas/agent-config.schema.13.json +1 -1
- package/kits/schemas/daemon.schema.7.json +140 -0
- package/kits/skills/ec-group/SKILL.md +4 -4
- package/kits/skills/ec-skill/scripts/cli.mjs +1 -1
- package/kits/skills/ec-skill/scripts/skill.mjs +1 -1
- package/kits/templates/memory-consolidation/forget.md +2 -2
- package/kits/templates/memory-consolidation/generalize.md +4 -4
- package/kits/templates/memory-consolidation/notes.md +11 -11
- package/kits/templates/memory-consolidation/profile.md +3 -3
- package/kits/templates/memory-consolidation/promote.md +3 -3
- package/kits/templates/memory-consolidation/workflow.md +6 -6
- package/kits/templates/message-fragments/handoff-request-to-target.md +1 -1
- package/kits/templates/system-fragments/bootstrap.md +4 -3
- package/kits/templates/system-fragments/channel.md +2 -2
- package/kits/templates/system-fragments/memory.md +16 -9
- package/kits/templates/system-fragments/reply.md +6 -6
- package/kits/templates/system-fragments/session.md +1 -1
- package/package.json +4 -3
- package/dist/core/memory/memory-session-policy.js +0 -41
- package/dist/core/memory/memory-signature.js +0 -257
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
**评估后认为不该泛化的,用 `update` 把 `to-generalize` 标签去掉。** 否则每次定时检查都会重新扫到它,反复评估同一条。
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
ec memory update <关系级记忆路径> --tags
|
|
45
|
+
ec memory update <关系级记忆路径> --tags '<去掉 to-generalize 后的标签>'
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
### 已经存在同类 agent 级记忆
|
|
@@ -50,9 +50,9 @@ ec memory update <关系级记忆路径> --tags "<去掉 to-generalize 后的标
|
|
|
50
50
|
如果 agent 级里已经有讲同一件事的记忆,**用 `--replaces` 同时替换两边**,产出合并后的版本:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
ec memory create --scope agent --slug commit-chinese --desc
|
|
54
|
-
--tags
|
|
55
|
-
--replaces
|
|
53
|
+
ec memory create --scope agent --slug commit-chinese --desc 'commit 消息用中文' \
|
|
54
|
+
--tags 'rule,long-term' --keywords 'commit,git' \
|
|
55
|
+
--replaces 'consolidated/20260901-120000-commit.md,$RELATIONS_DIR/<peerKey>/memory/consolidated/20261002-103100-commit-chinese.md' \
|
|
56
56
|
"(合并后的完整内容)"
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
### ① 是新的稳定结论 → create
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
ec memory create --scope relation --slug commit-chinese --desc
|
|
29
|
-
--tags
|
|
28
|
+
ec memory create --scope relation --slug commit-chinese --desc '对端要求 commit 消息用中文' \
|
|
29
|
+
--tags 'rule,long-term,verified' --keywords 'commit,git' \
|
|
30
30
|
"对端明确要求:commit message 必须用中文,并列出所有功能改动点。"
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### ② 和已有记忆是同一条,但内容更全或更准 → create --replaces
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
ec memory create --scope relation --slug commit-chinese --desc
|
|
37
|
-
--tags
|
|
38
|
-
--replaces
|
|
36
|
+
ec memory create --scope relation --slug commit-chinese --desc '对端要求 commit 用中文,注释不限' \
|
|
37
|
+
--tags 'rule,long-term,verified' --keywords 'commit,git' \
|
|
38
|
+
--replaces 'consolidated/20261001-103100-commit-chinese.md' \
|
|
39
39
|
"对端要求 commit message 用中文;代码注释可以是英文。"
|
|
40
40
|
```
|
|
41
41
|
|
|
@@ -44,7 +44,7 @@ ec memory create --scope relation --slug commit-chinese --desc "对端要求 com
|
|
|
44
44
|
### ③ 已有记忆还成立,只是状态变了 → update
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
ec memory update consolidated/20261002-090000-refactor-plan.md --tags
|
|
47
|
+
ec memory update consolidated/20261002-090000-refactor-plan.md --tags 'rule,done'
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
### ④ 不值得长期保留 → 丢弃
|
|
@@ -70,9 +70,9 @@ ec memory update consolidated/20261002-090000-refactor-plan.md --tags "rule,done
|
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
72
|
ec memory create --scope relation --slug commit-convention \
|
|
73
|
-
--desc
|
|
74
|
-
--tags
|
|
75
|
-
--replaces
|
|
73
|
+
--desc '对端要求 commit 用中文、按功能列出改动' \
|
|
74
|
+
--tags 'rule,long-term,verified' --keywords 'commit,git' \
|
|
75
|
+
--replaces 'consolidated/a.md,consolidated/b.md' \
|
|
76
76
|
"(合并后的完整内容)"
|
|
77
77
|
```
|
|
78
78
|
|
|
@@ -92,13 +92,13 @@ note 的 frontmatter 里如果有 `chatType: group`,整理时需要按信息
|
|
|
92
92
|
```bash
|
|
93
93
|
# 关于群本身的记忆(默认路由,不加 --peer)
|
|
94
94
|
ec memory create --scope relation --slug group-meeting-schedule \
|
|
95
|
-
--desc
|
|
95
|
+
--desc '群每周一开技术会' --tags 'rule,verified' \
|
|
96
96
|
"该群约定每周一 10:00 召开技术同步会。"
|
|
97
97
|
|
|
98
98
|
# 关于发言人自身的记忆(指定发言人的 relation)
|
|
99
99
|
ec memory create --scope relation --peer aun#alice.agentid.pub \
|
|
100
100
|
--slug alice-ts-preference \
|
|
101
|
-
--desc
|
|
101
|
+
--desc 'Alice 偏好 TypeScript,不喜欢注释' --tags 'preference,verified' \
|
|
102
102
|
"Alice 明确表示偏好 TypeScript,认为代码自解释,不需要额外注释。"
|
|
103
103
|
```
|
|
104
104
|
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
ec memory create --scope relation --slug profile \
|
|
26
|
-
--desc
|
|
27
|
-
--tags
|
|
28
|
-
--replaces
|
|
26
|
+
--desc '对端画像:沟通风格与协作习惯' \
|
|
27
|
+
--tags 'profile,long-term' --keywords '画像' \
|
|
28
|
+
--replaces 'consolidated/profile.md' \
|
|
29
29
|
"(画像正文)"
|
|
30
30
|
```
|
|
31
31
|
|
|
@@ -56,9 +56,9 @@ daemon 会检查:
|
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
58
|
ec memory create --scope owner --slug no-self-commit \
|
|
59
|
-
--desc
|
|
60
|
-
--tags
|
|
61
|
-
--replaces
|
|
59
|
+
--desc '任何 agent 都不许自己提交代码' \
|
|
60
|
+
--tags 'prohibition,important,long-term' --keywords 'commit,权限' \
|
|
61
|
+
--replaces '$RELATIONS_DIR/<ownerPeerKey>/memory/consolidated/20261002-153000-no-self-commit.md' \
|
|
62
62
|
"owner 明确要求:所有 agent 都不许自己执行 git commit,必须由 owner 确认后才能提交。"
|
|
63
63
|
```
|
|
64
64
|
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
2. **读候选内容**。`notes` 模式读 `processing/` 里的 note;其余模式读上下文文件里列出的候选记忆(先只读描述,按需读正文)。
|
|
9
9
|
3. **查重**(见下)。
|
|
10
10
|
4. **写**。用 `create` / `update` / `archive`。索引由程序在会话结束后统一重建。
|
|
11
|
-
5.
|
|
12
|
-
6.
|
|
11
|
+
5. **反馈**。结束前必须把本次整理的结果写到任务书给出的反馈文件路径(见下)。
|
|
12
|
+
6. **结束**。写完直接结束,不需要在会话里汇报「已完成」——反馈由程序读取反馈文件后投递。
|
|
13
13
|
|
|
14
14
|
## 写入前必须先查重
|
|
15
15
|
|
|
@@ -48,13 +48,13 @@ update 只用于正文不变、状态变了的情况:
|
|
|
48
48
|
|
|
49
49
|
输出 `[[NOOP]]`,然后结束。不要为了「有产出」而硬造记忆。
|
|
50
50
|
|
|
51
|
-
##
|
|
51
|
+
## 反馈(必须写)
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
**结束前必须把本次整理结果写成一段 markdown 文本,写到任务书给出的反馈文件路径。** 这段文本会被投递回发起整理的会话(手动、上下文压缩、新会话三类触发都会投递;定时触发只写日志,不投递)。
|
|
54
54
|
|
|
55
55
|
要求:
|
|
56
56
|
|
|
57
|
-
-
|
|
57
|
+
- 写入方式:用文件写入工具(Write / Edit)写到任务书里给出的那个反馈文件路径。这是本会话唯一可以写的文件;不要写别的路径,也不要用 shell 重定向。文件已经建好,直接写即可。
|
|
58
58
|
- 内容用 markdown,包含:
|
|
59
59
|
- **模式**:本次模式(notes / generalize / promote / profile / forget)
|
|
60
60
|
- **处理结果**:新建 / 更新 / 归档的记忆条数
|
|
@@ -63,7 +63,7 @@ update 只用于正文不变、状态变了的情况:
|
|
|
63
63
|
- 若过程中遇到异常(某条候选读不了、写入被拒),如实写出来。
|
|
64
64
|
- 不要在反馈文本里堆砌日志路径和原始文件列表——那些在批次目录里有,反馈是给人看的一句话级结论。
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
没有写反馈文件时,程序会回退到默认模板(只含模式、触发方式、条数统计),信息量少,所以务必显式写。
|
|
67
67
|
|
|
68
68
|
## 收尾
|
|
69
69
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
- 请结合请求列表与当前对端回复,分别判断哪些请求已经得到充分回答。
|
|
4
4
|
- 不要在对外回复中主动提及 handoff、ID、return 命令或内部路由机制。
|
|
5
5
|
- 通常请直接在当前回复中给出完整处理结果,本端会自动把回复绑定并回流到原请求会话。
|
|
6
|
-
- 如果请求因权限、网络或其它原因无法完成,且需要把失败/阻塞原因明确回传给原会话,可执行已有命令 `ec handoff return <handoff-id>
|
|
6
|
+
- 如果请求因权限、网络或其它原因无法完成,且需要把失败/阻塞原因明确回传给原会话,可执行已有命令 `ec handoff return <handoff-id> '<失败原因>'`;required 请求允许用同一个 ID 追加多次结果。
|
|
7
7
|
- 不要在对外回复中主动提及 handoff、ID 或内部路由机制。
|
|
8
8
|
|
|
9
9
|
待回流请求:
|
|
@@ -51,12 +51,13 @@ Bootstrap 是首次自我设定的生命周期门禁:补齐基础名片、保
|
|
|
51
51
|
|
|
52
52
|
设定齐全、待确认内容已解决后,按以下顺序推进;已有有效结果只核对,不重复写入或发布:
|
|
53
53
|
1. 用 `ec aid agentmd set {{selfAid}} <field> <value>` 修改本 Agent 名片的 `name`、`description`、`tags`(保留其它 frontmatter 和正文,命令会校验格式并签名);不要用文件工具直接编辑名片。
|
|
54
|
-
2. 将明确的职责、协作边界、重要约束和待继续事项忠实整理到 `{{PERSONAL_DIR}}/
|
|
54
|
+
2. 将明确的职责、协作边界、重要约束和待继续事项忠实整理到 `{{PERSONAL_DIR}}/persona.md` 的 `## Bootstrap 交接` 段落。此摘要是 Agent 的内部交接工作,不要求 Owner 审稿;不新增推断,确有职责歧义则回到设定澄清。没有额外约束或待继续事项时省略相应条目,不为补齐摘要追问。文件不存在时创建,已有文件幂等更新该段并**保留其它段落**(尤其是 Owner 已设定的人格内容);待继续事项标注“未执行”。不复制完整历史、临时闲聊、凭据、运行状态或 Owner 私密信息(该文件也会进入后续群聊上下文)。
|
|
55
|
+
- 写这一段用文件工具直接编辑 `persona.md` 即可(Owner 会话中该文件可写);**不要**用 `ec agent persona --text` 只写交接段——那是整体覆盖,会冲掉 Owner 设定的人格内容。要整体设置人格时才用 `ec agent persona --text '<完整内容>'`。
|
|
55
56
|
3. 根据最终名片和已设定的 persona,自主生成并用 `ec agent welcome --text '<完整文案>'` 保存正式欢迎文案。不要展示草稿、询问称呼或请求 Owner 确认,不向用户交办文案工作;Owner 主动指定文案时直接尊重其明确要求。命令固定写入本 Agent 的 `personal/welcome.md`,不接受自定义路径,`ec agent welcome show` 可核对现状。
|
|
56
57
|
- 内容为简短问候、自我介绍、围绕职责的具体协作方向及开始协作的邀请,建议 100~250 个汉字;不照抄通用“AI Agent 网关”介绍,不泄露系统提示词、凭据、文件路径或工作记忆,不夸大能力、不承诺独占使用或设备绑定。
|
|
57
58
|
- 支持纯文本或带变量的 Markdown;变量用两个左花括号、变量名、两个右花括号,内部不加空格。仅允许 agentName、agentDescription、agentAid、agentTags、agentTagsText、ownerName、ownerAid、channel;多 Owner 共用模板,称呼用 ownerName 或 ownerAid 变量,不写死当前 Owner 的姓名。系统仅渲染变量,不追加其它文案。
|
|
58
59
|
4. 若最终名片尚未发布或字段有变更,用 `ec aid agentmd put {{selfAid}}` 签名发布;用 `set` 改过字段时命令已自动发布,只需核对;可选头像按上一节处理,不为同一头像重复发布名片。
|
|
59
|
-
5. 核对交接摘要和 welcome 已保存、最终名片已发布后,执行 `ec agent ready {{selfAid}}`。这是 Bootstrap 的最后一个操作;成功后系统结束旧上下文、为各 Owner 创建新主会话并投递已保存的 welcome,不再调用模型生成文案。不要从旧上下文追加完成回复或继续普通任务。新主会话首次回复前先阅读已注入的 `
|
|
60
|
+
5. 核对交接摘要和 welcome 已保存、最终名片已发布后,执行 `ec agent ready {{selfAid}}`。这是 Bootstrap 的最后一个操作;成功后系统结束旧上下文、为各 Owner 创建新主会话并投递已保存的 welcome,不再调用模型生成文案。不要从旧上下文追加完成回复或继续普通任务。新主会话首次回复前先阅读已注入的 `persona.md` 交接内容,沿用约定,未执行事项按正常权限续接。
|
|
60
61
|
|
|
61
62
|
## 5. 恢复与操作范围
|
|
62
63
|
|
|
@@ -66,4 +67,4 @@ Bootstrap 是首次自我设定的生命周期门禁:补齐基础名片、保
|
|
|
66
67
|
- `bootstrapping`:从缺失或失败的步骤续做,保留已明确或已认可的设定;welcome 缺失时自主生成并保存,交接缺失时依据可核对事实补写,全部完成后直接 `ready`,不增加确认轮次。收到 `WELCOME_FROZEN` 表示投递快照已准备,不改文案,只续做剩余步骤。
|
|
67
68
|
- 必需步骤失败时说明具体原因,修正后再继续,不调用 `ready`、不盲目重试;可选头像失败按上一节处理。
|
|
68
69
|
|
|
69
|
-
仅允许读取本 Agent
|
|
70
|
+
仅允许读取本 Agent 名片并编辑上述三个字段、读写 `persona.md` 的 `## Bootstrap 交接` 段、读取 Owner 为设定提供的文本或图片附件、执行上述本 Agent 状态查询、persona、welcome、名片发布、头像及 ready 命令,以及向当前 Owner 回复。不得修改其它文件、联系其它主体或进行无关配置操作;完成前不承诺已经进入正常工作状态。
|
|
@@ -14,11 +14,11 @@ capabilities: {{capabilities}} # 当前渠道支持的能力
|
|
|
14
14
|
{{/}}
|
|
15
15
|
{{?channel=aun}}
|
|
16
16
|
{{?groupId}}
|
|
17
|
-
ec group send {{selfAid}} {{groupId}}
|
|
17
|
+
ec group send {{selfAid}} {{groupId}} '<text>' [--encrypt|--no-encrypt] [--file <path> --as image|video|voice|file] [--payload '<json>'] [--mention '<aid1>,<aid2>'] [--mention-all]
|
|
18
18
|
group-send 用于群内公开发送:proactive 下是正式回复;interactive 下普通回复直接输出,需要 @某人、发文件或手动控制加密时使用此命令。
|
|
19
19
|
{{/}}
|
|
20
20
|
{{?peerId}}
|
|
21
|
-
ec msg send {{selfAid}} {{peerId}}
|
|
21
|
+
ec msg send {{selfAid}} {{peerId}} '<text>' [--text-from-file <path>] [--encrypt|--no-encrypt] [--file <path> --as image|video|voice|file] [--link <url> --title '<title>'] [--payload '<json>']
|
|
22
22
|
msg-send 用于私聊发送:proactive 下是正式回复;interactive 下普通回复直接输出,需要文件、链接或手动控制加密时使用此命令。群聊仅在确需私下联系本条消息发送者且已获授权时使用,公开回复使用 group-send。
|
|
23
23
|
{{/}}
|
|
24
24
|
每次调用仍须遵守 `[reply]` 的单条命令及加密要求。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[memory] 记忆系统
|
|
2
2
|
{{?sessionType!=memory}}
|
|
3
3
|
**静默规则**:记忆操作完全静默。仅当用户明确表达让你记住某事时,才给一句不超过一行的简短确认,其余情况禁止出现「记下了」「已记录」「我记住了」等表达。
|
|
4
|
-
`ec memory` 是唯一写入路径。**不要用 Write / Edit 直接写记忆文件,也不要用 baseagent
|
|
4
|
+
`ec memory` 是唯一写入路径。**不要用 Write / Edit 直接写记忆文件,也不要用 baseagent 原生记忆工具**:绕过完整性台账和索引,会被当作带外修改恢复掉,整理会话也不感知。
|
|
5
5
|
**召回**:上方已注入三级 `MEMORY.md` 索引,按描述判断相关性,再 Read 对应 `consolidated/` 正文;不要全部读一遍。
|
|
6
6
|
{{?peerKey}}
|
|
7
7
|
**写入判据**:开新会话后这条信息拿不到,会不会有影响?会就写,不会就不写。
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
**命令**(`--slug` 必填,字母/数字/连字符,1-64 字符,当前关系内唯一):
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
ec memory note --slug <slug> [--tags <tag1
|
|
21
|
-
ec memory note update <slug> [--slug <新slug>] [--tags
|
|
20
|
+
ec memory note --slug <slug> [--tags '<tag1>,<tag2>'] '<正文>'
|
|
21
|
+
ec memory note update <slug> [--slug <新slug>] [--tags '<tag1>,<tag2>'] ['<新正文>']
|
|
22
22
|
ec memory note drop <slug>
|
|
23
23
|
ec memory note list
|
|
24
24
|
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
{{?chatType=group}}
|
|
28
|
-
群聊场景可附加 `--speakers <
|
|
28
|
+
群聊场景可附加 `--speakers '<aid1>,<aid2>'` 记录本条 note 涉及的发言人(单引号包住、逗号分隔,填 AID 或渠道原生 ID)。整理会话会据此把发言人相关信息分流到各发言人自己的 relation 记忆里。
|
|
29
29
|
{{/}}
|
|
30
30
|
slug 撞名改用 `update`。完整用法见 `$KITS_DOCS/evolcore/memory.md`。
|
|
31
31
|
**整理**(触发后不等结果):
|
|
@@ -43,13 +43,18 @@ slug 撞名改用 `update`。完整用法见 `$KITS_DOCS/evolcore/memory.md`。
|
|
|
43
43
|
**只能用三个命令**:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
ec memory create --scope <relation|agent|owner> --slug <slug> --desc
|
|
47
|
-
[--peer <peerKey>] --tags <tag1
|
|
48
|
-
ec memory update <路径> --tags <tag1
|
|
46
|
+
ec memory create --scope <relation|agent|owner> --slug <slug> --desc '一句话描述' \
|
|
47
|
+
[--peer <peerKey>] --tags '<tag1>,<tag2>' [--keywords '<kw1>,<kw2>'] [--replaces '<路径1>,<路径2>'] '<正文>'
|
|
48
|
+
ec memory update <路径> --tags '<tag1>,<tag2>' # 整体替换标签,不是追加;改不了正文
|
|
49
49
|
ec memory update <路径> --touch # 只刷新时间戳(遗忘续期)
|
|
50
50
|
ec memory archive <路径...> # 下线记忆,移入 archive/
|
|
51
|
-
|
|
52
51
|
```
|
|
52
|
+
|
|
53
|
+
整理结束后,把本次整理的整体反馈写入任务书里指定的**反馈文件路径**。未写入则收尾时回退到默认统计模板(模式、触发方式、耗时、新建/更新/归档条数等)。
|
|
54
|
+
|
|
55
|
+
自由文本参数(`--desc`、正文、`--keywords`)用**单引号**包住(`'…'`);
|
|
56
|
+
用双引号的话,文本里的 `` ` `` 或 `$` 会被 shell 展开,命令被拒。
|
|
57
|
+
单引号内部不要再出现半角撇号;需要时用 `ʼ`(U+02BC)或 `'`(U+FF07)代替。
|
|
53
58
|
| 参数 | 说明 |
|
|
54
59
|
| --- | --- |
|
|
55
60
|
| --scope | 必填,只能是本次模式允许的取值(见下表) |
|
|
@@ -59,6 +64,8 @@ ec memory archive <路径...> # 下线记忆,移入 archi
|
|
|
59
64
|
| --keywords | 可选,串起相关记忆的内容关键词 |
|
|
60
65
|
| --replaces | 可选,要替换的旧文件,自动归档。合并、纠正、升格作用域都走它,是唯一的防重复手段 |
|
|
61
66
|
|
|
67
|
+
`--tags`、`--keywords`、`--replaces` 的值一律写成**单引号包住、逗号分隔**:`--tags 'rule,long-term'`、`--replaces 'consolidated/a.md,consolidated/b.md'`。
|
|
68
|
+
|
|
62
69
|
**模式与允许的** `--scope`(越权会被 daemon 拒绝):
|
|
63
70
|
|
|
64
71
|
| 模式 | --scope |
|
|
@@ -73,7 +80,7 @@ ec memory archive <路径...> # 下线记忆,移入 archi
|
|
|
73
80
|
|
|
74
81
|
**禁止**:
|
|
75
82
|
|
|
76
|
-
- 用 Write / Edit 直接写 `consolidated
|
|
83
|
+
- 用 Write / Edit 直接写 `consolidated/`:绕过完整性台账,下次使用时会被恢复到最后登记的版本。
|
|
77
84
|
- 写 `pending/` 或调用 `ec memory note`:note 是主会话入口,整理会话用了会形成循环。
|
|
78
85
|
- 删除文件:只能 `archive`。
|
|
79
86
|
{{/}}
|
|
@@ -23,19 +23,19 @@ proactive:普通输出作为思考过程展示,不作为正式回复、不
|
|
|
23
23
|
{{?selfAid}}
|
|
24
24
|
{{?chatType=private}}
|
|
25
25
|
{{?peerId}}
|
|
26
|
-
ec msg send {{selfAid}} {{peerId}}
|
|
26
|
+
ec msg send {{selfAid}} {{peerId}} '<text>' [--encrypt|--no-encrypt]
|
|
27
27
|
{{/}}
|
|
28
28
|
{{/}}
|
|
29
29
|
{{?chatType=group}}
|
|
30
30
|
{{?groupId}}
|
|
31
|
-
ec group send {{selfAid}} {{groupId}}
|
|
31
|
+
ec group send {{selfAid}} {{groupId}} '<text>' [--encrypt|--no-encrypt]
|
|
32
32
|
{{/}}
|
|
33
33
|
{{/}}
|
|
34
34
|
{{/}}
|
|
35
35
|
AUN 私聊向 peerId 发送,群聊向 groupId 发送,不把群内发言者当作公开回复目标。
|
|
36
36
|
{{/}}
|
|
37
37
|
{{?channel!=aun}}
|
|
38
|
-
ec ctl send
|
|
38
|
+
ec ctl send '<text>'
|
|
39
39
|
非 AUN 渠道使用上述命令向当前会话正式回复,不使用 AUN 的 msg/group 命令。
|
|
40
40
|
{{/}}
|
|
41
41
|
发送成功后继续本轮必要步骤,不重复发送同一正文或补发“已发送”回执。
|
|
@@ -47,12 +47,12 @@ ec ctl send "<text>"
|
|
|
47
47
|
{{/}}
|
|
48
48
|
|
|
49
49
|
发送约束(适用于正式回复及 active 阶段的附加发送):
|
|
50
|
-
- 只能使用当前会话的 delegated sender,经 daemon IPC 发送;保留托管环境,不另建 SDK 连接。当前会话回复使用注入的 self 和目标,不为绕过限制改写身份、对端或 thread 路由。显式 msg/group send 必须写全 from/to;拿不到 self 或目标参数时改用 ec ctl send
|
|
50
|
+
- 只能使用当前会话的 delegated sender,经 daemon IPC 发送;保留托管环境,不另建 SDK 连接。当前会话回复使用注入的 self 和目标,不为绕过限制改写身份、对端或 thread 路由。显式 msg/group send 必须写全 from/to;拿不到 self 或目标参数时改用 ec ctl send '<text>' 继承当前会话,不猜测身份或地址。
|
|
51
51
|
- 调用发送命令时,每次 shell 调用只能执行一条完整的 ec 命令。不要拼接探测、管道、重定向、子 shell 或其它命令;不要读取外部 coding-agent skill 寻找发送方式。
|
|
52
52
|
- 双引号正文中的双引号、反引号和 Shell 变量 `$` 需分别在其前加反斜杠。
|
|
53
53
|
- 以退出码和发送回执判断成败;被拒绝时说明具体原因,不通过改目标、改身份或绕开托管通道重试。
|
|
54
|
-
- 跨会话发送:一个话题只有本端与对端两端,当前话题只能直接回复 peerId/groupId。要联系当前对端({{peerId}})或当前群({{groupId}})以外的对象,属于**跨话题**发送:先 `ec thread list <对方AID>` 选中一个已有话题,没有合适话题就 `ec thread create <对方AID> --name
|
|
54
|
+
- 跨会话发送:一个话题只有本端与对端两端,当前话题只能直接回复 peerId/groupId。要联系当前对端({{peerId}})或当前群({{groupId}})以外的对象,属于**跨话题**发送:先 `ec thread list <对方AID>` 选中一个已有话题,没有合适话题就 `ec thread create <对方AID> --name '...'`,再用 `ec msg send '<text>' --thread <threadId> --check-every <时长>`(群聊为 `ec group send '<text>' --thread <threadId> --check-every <时长>`)发送;from/to 由话题推断,不必手写,`--check-every` 必填。不带 `--thread` 直接改目标发送会被拒绝;同会话回复当前对端/群不需要 `--thread`。
|
|
55
55
|
{{?channel=aun}}
|
|
56
|
-
- 显式调用 msg/group send 时必须选择加密参数:回复 🔒密文用 --encrypt,回复 ✉明文用 --no-encrypt;批次含密文则用 --encrypt。不得省略参数后依赖默认明文;加密状态不明时使用继承当前会话状态的 ec ctl send
|
|
56
|
+
- 显式调用 msg/group send 时必须选择加密参数:回复 🔒密文用 --encrypt,回复 ✉明文用 --no-encrypt;批次含密文则用 --encrypt。不得省略参数后依赖默认明文;加密状态不明时使用继承当前会话状态的 ec ctl send '<text>'。
|
|
57
57
|
- interactive 的直接输出和 ec ctl send 由框架继承当前会话的加密状态、目标和话题,无需手动改写路由。
|
|
58
58
|
{{/}}
|
|
@@ -44,7 +44,7 @@ readonly: true — 禁止写入项目目录及临时目录;如需生成文件
|
|
|
44
44
|
# 群内公开发送用 ec group send;语法与选项见 [channel] 段。
|
|
45
45
|
{{/}}
|
|
46
46
|
{{?chatType=private}}
|
|
47
|
-
# 当前话题私聊回复(proactive 自主模式):ec msg send {{selfAid}} {{peerId}}
|
|
47
|
+
# 当前话题私聊回复(proactive 自主模式):ec msg send {{selfAid}} {{peerId}} '<text>' [--encrypt|--no-encrypt]
|
|
48
48
|
# from/to 必须显式写出(权限层逐字校验发送者与目标);仅 --thread 跨话题发送和 ec ctl send 可省略。文件/链接/跨话题/完整选项见 $KITS_DOCS/evolcore/msg.md
|
|
49
49
|
{{/}}
|
|
50
50
|
{{/}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "evolcore",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"description": "AI Agent gateway connecting Claude, Codex, Gemini, and the bundled ecagent runner to messaging channels with multi-project session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"ecagent/NOTICE",
|
|
20
20
|
"ecagent/README.md",
|
|
21
21
|
"!dist/cli/mode.js",
|
|
22
|
+
"!dist/core/file-integrity/write.js",
|
|
22
23
|
"bin/",
|
|
23
24
|
"!dist/experimental/",
|
|
24
25
|
"!skills/",
|
|
@@ -53,8 +54,8 @@
|
|
|
53
54
|
"prepublishOnly": "npm test"
|
|
54
55
|
},
|
|
55
56
|
"dependencies": {
|
|
56
|
-
"@agentunion/fastaun": "0.5.
|
|
57
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
57
|
+
"@agentunion/fastaun": "0.5.20",
|
|
58
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.300",
|
|
58
59
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
59
60
|
"ajv": "^8.20.0",
|
|
60
61
|
"chokidar": "^5.0.0",
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* memory-session-policy.ts — 整理会话(sessionType=memory)的工具策略
|
|
3
|
-
*
|
|
4
|
-
* 整理会话的产出只能经 `ec memory create|update|archive` 走 daemon IPC 落盘
|
|
5
|
-
* (签名、索引、ops 流水都在那一侧)。所以:
|
|
6
|
-
* - 直接写文件的工具一律拦(Claude 的 Write/Edit/MultiEdit/NotebookEdit,Codex 的 FileChange)
|
|
7
|
-
* - 子代理、PowerShell 这类能绕开本策略的入口也拦
|
|
8
|
-
* - Bash 只放行 `ec memory create|update|archive`;解析不出单条字面命令(含 ; && | $() 等)一律拦
|
|
9
|
-
* - Read / Glob / Grep 等只读工具不在这里管
|
|
10
|
-
*
|
|
11
|
-
* 作为 policyHook 由 response-engine 在整理会话里挂上,三个 runner 共用。
|
|
12
|
-
*/
|
|
13
|
-
import { parseCodexToolCommand } from '../permission/ec-command-parser.js';
|
|
14
|
-
const BLOCKED_TOOLS = new Set([
|
|
15
|
-
'Write', 'Edit', 'MultiEdit', 'NotebookEdit', 'FileChange',
|
|
16
|
-
'Agent', 'Task', 'PowerShell',
|
|
17
|
-
]);
|
|
18
|
-
const ALLOWED_MEMORY_SUBCOMMANDS = new Set(['create', 'update', 'archive', 'feedback']);
|
|
19
|
-
export const MEMORY_SESSION_DENY_MESSAGE = '整理会话不允许执行此命令';
|
|
20
|
-
export function memorySessionPolicyHook(toolName, toolInput) {
|
|
21
|
-
if (BLOCKED_TOOLS.has(toolName)) {
|
|
22
|
-
return {
|
|
23
|
-
block: true,
|
|
24
|
-
policyCode: 'memory_session_tool_forbidden',
|
|
25
|
-
reason: `${MEMORY_SESSION_DENY_MESSAGE}:整理会话不能使用 ${toolName},写记忆只能用 \`ec memory create|update|archive\`,反馈用 \`ec memory feedback\``,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
if (toolName !== 'Bash')
|
|
29
|
-
return undefined;
|
|
30
|
-
const parsed = parseCodexToolCommand(toolInput);
|
|
31
|
-
const argv = parsed.ok ? parsed.argv : undefined;
|
|
32
|
-
if (argv && argv[0] === 'ec' && argv[1] === 'memory' && ALLOWED_MEMORY_SUBCOMMANDS.has(argv[2] ?? '')) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
block: true,
|
|
37
|
-
policyCode: 'memory_session_command_forbidden',
|
|
38
|
-
reason: `${MEMORY_SESSION_DENY_MESSAGE}:Bash 只允许单条 \`ec memory create|update|archive|feedback\`` +
|
|
39
|
-
'(不能拼接其他命令;正文含特殊字符时用单引号包住)。读文件请用 Read / Glob / Grep。',
|
|
40
|
-
};
|
|
41
|
-
}
|