dsh-subagent-memory
v1.1.4
Published
Subagent-scoped memory for DeepSeek Harness: memory_add/list/get tools for a delegated child's own notes, a cascade delete when the child settles, an adjacency-checked service API (ctx.agentMemory read/write/summary) for the delegating parent or other hos
Downloads
1,061
Readme
Agent Memory(子代理记忆)
给子代理用的工作记忆——单一职责:没有全局仓库、没有跨会话库。
能力
被动(子代理自己用):memory_add / memory_list / memory_get 三个工具,只能读写调用者自己会话的记忆。
主动(委派方或宿主插件):ctx.agentMemory 服务 API:
| 方法 | 签名 | 说明 |
|---|---|---|
| read | read(childId, callerId, {tag?}) | 读某子代理的记忆条目 |
| write | await write(childId, callerId, {title, content, tags?}) | 往某子代理记忆里写一条 |
| summary | summary(childId, callerId) | 紧凑文本摘要,供委派方注入提示 |
API 安全(邻接校验):调用者只能触碰自己直接父级的子会话记忆——sessions.get(child).header.parentSession 必须等于 callerId(或 callerId === childId 自省);未物化会话、非父子关系一律拒绝。
级联清理:子代理结束(subagent/end)时自动删除其全部记忆。
能力发现:向 dsh-compat-layer 的能力注册表声明 agentMemory(v2),其他插件可自动匹配发现,无需硬依赖本包。
界面(1.1.0 新增)
- 记忆查看器:插件页 → 本插件行(
plugins.row.config)里的只读为主视图,按ownerSession分组展示脱敏快照(标题/标签/长度/时间,不含正文)。每条可删除,但先弹确认;删除只是写一条请求到 volatile 字段deleteRequestJson,由宿主执行并复用同一套邻接校验(_assertAdjacent)——浏览器侧无法绕开、也无法放宽权限。 - 可发现入口:
settings.general.item摘要行(idsubagent-memory),打开「设置 → 通用」即可见:子代理记忆:N 条 / M 个子代理。
存储
插件自身的 volatile 设置命名空间 agent-memory(官方运行时可变偏好管线),无需文件、无自定义协议。宿主另写两个 volatile 字段:snapshotJson(脱敏快照)与 deleteRequestJson(删除请求)。
配套
与 dsh-subagent-pro 自动匹配:装了本包后 subagent-pro 会多出一个 subagent_memory 工具(读某个子代理的记忆摘要);不装则没有该工具,双方互不影响。
安装
桌面端:插件 → 添加插件 → 输入包名 dsh-subagent-memory(或本地路径安装 tgz)。
English
Narrow, subagent-scoped memory: three tools for a delegated child's own notes, an adjacency-checked service API (read / write / summary) for the delegating parent, cascade deletion when the child settles, capability discovery through dsh-compat-layer, plus a read-mostly browser viewer over a desensitized snapshot (delete is a host-executed, adjacency-checked request) and a Settings -> General summary row.
License: MIT. Author: jd962.
