dsh-daoing-memory 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +91 -0
  3. package/README.zh-CN.md +91 -0
  4. package/cordis.patch.yml +22 -0
  5. package/lib/client.js +10339 -0
  6. package/lib/client.js.map +1 -0
  7. package/lib/index.js +3138 -0
  8. package/lib/invariant.js +33 -0
  9. package/lib/tools.js +1472 -0
  10. package/lib/typert.host.d.ts +3 -0
  11. package/lib/typert.host.js +4058 -0
  12. package/lib/typert.remote-client.d.ts +149 -0
  13. package/lib/typert.remote-client.d.ts.map +1 -0
  14. package/lib/typert.remote-client.js +3167 -0
  15. package/lib/types/client/ExperiencePage.d.ts +15 -0
  16. package/lib/types/client/ExperiencePage.d.ts.map +1 -0
  17. package/lib/types/client/ExperiencePage.js +117 -0
  18. package/lib/types/client/ExperiencePage.js.map +1 -0
  19. package/lib/types/client/FactDiaryPage.d.ts +17 -0
  20. package/lib/types/client/FactDiaryPage.d.ts.map +1 -0
  21. package/lib/types/client/FactDiaryPage.js +155 -0
  22. package/lib/types/client/FactDiaryPage.js.map +1 -0
  23. package/lib/types/client/HumanOpsPage.d.ts +16 -0
  24. package/lib/types/client/HumanOpsPage.d.ts.map +1 -0
  25. package/lib/types/client/HumanOpsPage.js +208 -0
  26. package/lib/types/client/HumanOpsPage.js.map +1 -0
  27. package/lib/types/client/LedgerPage.d.ts +13 -0
  28. package/lib/types/client/LedgerPage.d.ts.map +1 -0
  29. package/lib/types/client/LedgerPage.js +113 -0
  30. package/lib/types/client/LedgerPage.js.map +1 -0
  31. package/lib/types/client/MemoryNavSection.d.ts +20 -0
  32. package/lib/types/client/MemoryNavSection.d.ts.map +1 -0
  33. package/lib/types/client/MemoryNavSection.js +23 -0
  34. package/lib/types/client/MemoryNavSection.js.map +1 -0
  35. package/lib/types/client/Workbench.d.ts +23 -0
  36. package/lib/types/client/Workbench.d.ts.map +1 -0
  37. package/lib/types/client/Workbench.js +140 -0
  38. package/lib/types/client/Workbench.js.map +1 -0
  39. package/lib/types/client/actions.d.ts +165 -0
  40. package/lib/types/client/actions.d.ts.map +1 -0
  41. package/lib/types/client/actions.js +51 -0
  42. package/lib/types/client/actions.js.map +1 -0
  43. package/lib/types/client/index.d.ts +24 -0
  44. package/lib/types/client/index.d.ts.map +1 -0
  45. package/lib/types/client/index.js +103 -0
  46. package/lib/types/client/index.js.map +1 -0
  47. package/lib/types/client/navStore.d.ts +45 -0
  48. package/lib/types/client/navStore.d.ts.map +1 -0
  49. package/lib/types/client/navStore.js +36 -0
  50. package/lib/types/client/navStore.js.map +1 -0
  51. package/lib/types/core.d.ts +195 -0
  52. package/lib/types/core.d.ts.map +1 -0
  53. package/lib/types/core.js +1304 -0
  54. package/lib/types/core.js.map +1 -0
  55. package/lib/types/index.d.ts +71 -0
  56. package/lib/types/index.d.ts.map +1 -0
  57. package/lib/types/index.js +97 -0
  58. package/lib/types/index.js.map +1 -0
  59. package/lib/types/invariant.d.ts +21 -0
  60. package/lib/types/invariant.d.ts.map +1 -0
  61. package/lib/types/invariant.js +33 -0
  62. package/lib/types/invariant.js.map +1 -0
  63. package/lib/types/service.d.ts +130 -0
  64. package/lib/types/service.d.ts.map +1 -0
  65. package/lib/types/service.js +417 -0
  66. package/lib/types/service.js.map +1 -0
  67. package/lib/types/store.d.ts +244 -0
  68. package/lib/types/store.d.ts.map +1 -0
  69. package/lib/types/store.js +864 -0
  70. package/lib/types/store.js.map +1 -0
  71. package/lib/types/tools.d.ts +25 -0
  72. package/lib/types/tools.d.ts.map +1 -0
  73. package/lib/types/tools.js +1144 -0
  74. package/lib/types/tools.js.map +1 -0
  75. package/lib/types/types.d.ts +836 -0
  76. package/lib/types/types.d.ts.map +1 -0
  77. package/lib/types/types.js +8 -0
  78. package/lib/types/types.js.map +1 -0
  79. package/package.json +106 -0
  80. package/skill/memory-extraction.md +62 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 daoing
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # dsh-daoing-memory
2
+
3
+ > Self-evolving memory for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH) — earned experiences, diary/fact semantic memory, concern tracking, and an append-only audit ledger.
4
+
5
+ [中文文档 →](./README.zh-CN.md)
6
+
7
+ An agent without memory starts from zero every session. `dsh-daoing-memory` gives a DSH agent a **persistent, self-improving memory** that it *earns* through use: it keeps a diary, distills durable facts and open concerns about the user, accumulates verified experiences, recalls what is relevant, revises what turned out wrong, and records every change in an auditable ledger.
8
+
9
+ The design follows four verbs — **生 · 用 · 修 · 记** (*Generate · Use · Revise · Record*).
10
+
11
+ ---
12
+
13
+ ## Why
14
+
15
+ Most "memory" bolt-ons either dump raw conversation into a vector store, or let the model write anything it likes into a key-value blob. Both fail in practice: the first buries signal in noise, the second lets a single hallucination poison every future session.
16
+
17
+ `dsh-daoing-memory` takes a different stance:
18
+
19
+ - **Memory must be earned.** An experience starts as a low-trust *candidate* and is promoted only after it is corroborated by real use. Nothing reaches high trust by fiat.
20
+ - **Two distinct memories.** *Semantic* memory (durable facts about the user + open concerns they care about) is separated from *experiential* memory (how-to knowledge with a lifecycle). They are written, recalled, and governed differently.
21
+ - **Every write is auditable.** An append-only ledger records each mutation, so memory drift or poisoning can be detected, attributed, and rolled back.
22
+ - **The human stays in the loop.** A browser workbench lets you read, correct, promote, and delete memories — memory is a shared artifact, not a black box.
23
+
24
+ ## Features
25
+
26
+ | Area | What you get |
27
+ | --- | --- |
28
+ | **Diary (记)** | `memory_fact` — append raw session notes; the substrate everything else is distilled from. |
29
+ | **Extraction (生)** | `memory_extract` — distill diary entries into durable **facts** (9 user-centric categories, deduplicated & corroborated) and **concerns** (todo / thinking / idea / question / decision / commitment, each with a background scene). |
30
+ | **Experience lifecycle (生·用·修)** | `memory_ingest`, `memory_report`, `memory_revise`, `memory_refine`, `memory_verify` — experiences are born as candidates, earn trust through reported use, get revised when wrong, and roll back cleanly. |
31
+ | **Recall (用)** | `memory_recall` — keyword/situation relevance over the shared experience library, with optional context scoping. |
32
+ | **Audit** | `memory_ledger`, `memory_verify` — query the append-only ledger and verify integrity. |
33
+ | **Consolidation** | `memory_consolidate` — periodic compaction/housekeeping of the store. |
34
+ | **Profile injection** | A compact profile snapshot (top facts + open concerns) is injected into the system prompt, so the agent *knows the user* without being asked. |
35
+ | **Workbench UI** | A browser panel (Fact Diary / Experiences / Ledger / Human Ops) to inspect and curate memory by hand. |
36
+ | **Extraction skill** | A bundled `memory-extraction` skill that teaches the agent *when and how* to extract high-quality memory. |
37
+
38
+ ## Install
39
+
40
+ Two DSH environments are supported — a **source checkout** of DSH and an **officially installed** DSH — and two install channels (npm package name, or a git/GitHub URL). See **[docs/INSTALL.md](./docs/INSTALL.md)** for the full matrix including uninstall and skill placement.
41
+
42
+ Quick start for an officially installed DSH:
43
+
44
+ ```sh
45
+ # from npm (once published)
46
+ dsh plugin --profile web add dsh-daoing-memory
47
+
48
+ # or straight from GitHub
49
+ dsh plugin --profile web add github:daoing/dsh-daoing-memory
50
+
51
+ # place the extraction skill where DSH loads skills from
52
+ node node_modules/dsh-daoing-memory/scripts/install-skill.mjs
53
+ ```
54
+
55
+ Then restart DSH. The memory tools become available to your agent, the profile snapshot starts being injected, and a **Memory** section appears in the web sidebar.
56
+
57
+ ## Usage
58
+
59
+ Once installed, the agent gains the `memory_*` tools. Typical flow:
60
+
61
+ 1. During a session the agent appends raw notes with `memory_fact`.
62
+ 2. At a natural pause it runs `memory_extract` to distill facts + concerns (guided by the `memory-extraction` skill).
63
+ 3. In later sessions `memory_recall` surfaces relevant experiences; a compact profile snapshot is already present in the system prompt.
64
+ 4. When an experience is confirmed useful the agent calls `memory_report`; when it is wrong, `memory_revise`.
65
+ 5. You can inspect and curate everything in the **Memory** workbench.
66
+
67
+ See **[docs/INSTALL.md](./docs/INSTALL.md)** for usage details and **[docs/STATUS.md](./docs/STATUS.md)** for what is implemented today.
68
+
69
+ ## Design
70
+
71
+ The architecture, the trust/earning model, the data schema, and the anti-pollution boundaries are documented in **[docs/DESIGN.md](./docs/DESIGN.md)**. Current implementation status and extension directions live in **[docs/STATUS.md](./docs/STATUS.md)**.
72
+
73
+ ## Project layout
74
+
75
+ ```
76
+ dsh-daoing-memory/
77
+ ├── lib/ # prebuilt artifacts (host + browser bundle + typert)
78
+ ├── src/ # TypeScript source (for reference & iteration)
79
+ ├── skill/ # bundled memory-extraction skill (standalone .md)
80
+ ├── cordis.patch.yml # profile patch that wires the plugin into DSH
81
+ ├── scripts/ # prepare + install-skill helpers
82
+ └── docs/ # INSTALL · DESIGN · STATUS · BUILDING · FAQ
83
+ ```
84
+
85
+ ## Building & publishing
86
+
87
+ This repository ships its build output (`lib/`) so that installing it never requires the DSH monorepo toolchain. See **[docs/BUILDING.md](./docs/BUILDING.md)** for how the package is produced, published to npm, and listed on the DSH plugin marketplace.
88
+
89
+ ## License
90
+
91
+ [MIT](./LICENSE) © daoing
@@ -0,0 +1,91 @@
1
+ # dsh-daoing-memory
2
+
3
+ > 面向 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)的自进化记忆系统 —— 挣得式经验、日记/事实语义记忆、关心事项追踪,以及只增不删的审计账本。
4
+
5
+ [English →](./README.md)
6
+
7
+ 没有记忆的 agent,每个会话都从零开始。`dsh-daoing-memory` 为 DSH agent 提供一套**持久、能自我进化**的记忆,而且这份记忆是靠*使用*一点点“挣”来的:它记日记、从中提炼关于用户的持久事实与未了心事、沉淀经过验证的经验、在需要时召回相关内容、发现错了就修订,并把每一次变更都记进可审计的账本。
8
+
9
+ 整套设计围绕四个字 —— **生 · 用 · 修 · 记**。
10
+
11
+ ---
12
+
13
+ ## 为什么做
14
+
15
+ 市面上大多数“记忆”方案,要么把原始对话一股脑灌进向量库,要么让模型随意往一个键值块里写东西。两者在实践中都会失败:前者让信号淹没在噪声里,后者让一次幻觉污染此后所有会话。
16
+
17
+ `dsh-daoing-memory` 采取了不同的立场:
18
+
19
+ - **记忆必须靠挣。** 一条经验以低信任的*候选*身份诞生,只有在真实使用中被反复证实后才晋升。没有任何东西能靠“钦定”直接获得高信任。
20
+ - **两种截然不同的记忆。** *语义记忆*(关于用户的持久事实 + 他们在意的未了心事)与*经验记忆*(带生命周期的 how-to 知识)分离,二者的写入、召回与治理方式各不相同。
21
+ - **每次写入都可审计。** 只增不删的账本记录每一次变更,记忆漂移或被投毒时可被察觉、可被归因、可被回滚。
22
+ - **人始终在回路中。** 浏览器工作台让你阅读、纠正、晋升、删除记忆——记忆是人机共享的资产,而非黑盒。
23
+
24
+ ## 功能一览
25
+
26
+ | 模块 | 提供能力 |
27
+ | --- | --- |
28
+ | **日记(记)** | `memory_fact` —— 追加原始会话笔记,是一切提炼的原料。 |
29
+ | **提炼(生)** | `memory_extract` —— 把日记蒸馏成持久**事实**(9 类以用户为中心的类别,自动去重并累积佐证)与**关心事项**(todo / 思考 / 想法 / 问题 / 决定 / 承诺,均带背景场景)。 |
30
+ | **经验生命周期(生·用·修)** | `memory_ingest`、`memory_report`、`memory_revise`、`memory_refine`、`memory_verify` —— 经验以候选身份诞生,靠上报使用挣得信任,错了就修订,并能干净回滚。 |
31
+ | **召回(用)** | `memory_recall` —— 在共享经验库上做关键词/情境相关性匹配,支持可选的 context 范围限定。 |
32
+ | **审计** | `memory_ledger`、`memory_verify` —— 查询只增不删的账本并校验完整性。 |
33
+ | **整合** | `memory_consolidate` —— 周期性的压实与库内清理。 |
34
+ | **画像注入** | 把一份精简画像快照(头部事实 + 未了心事)注入系统提示词,让 agent *无需发问就了解用户*。 |
35
+ | **工作台 UI** | 浏览器面板(事实日记 / 经验 / 账本 / 人工运维),可手动检视与治理记忆。 |
36
+ | **提炼 skill** | 随包附带 `memory-extraction` skill,教会 agent *何时、如何*提炼出高质量记忆。 |
37
+
38
+ ## 安装
39
+
40
+ 支持两种 DSH 环境 —— **源码启动**的 DSH 与**官方命令安装**的 DSH;也支持两种安装渠道(npm 包名,或 git/GitHub 地址)。完整的安装/卸载/skill 放置矩阵见 **[docs/INSTALL.zh-CN.md](./docs/INSTALL.zh-CN.md)**。
41
+
42
+ 官方安装版 DSH 的快速上手:
43
+
44
+ ```sh
45
+ # 从 npm(发布后)
46
+ dsh plugin --profile web add dsh-daoing-memory
47
+
48
+ # 或直接从 GitHub
49
+ dsh plugin --profile web add github:daoing/dsh-daoing-memory
50
+
51
+ # 把提炼 skill 放到 DSH 加载 skill 的目录
52
+ node node_modules/dsh-daoing-memory/scripts/install-skill.mjs
53
+ ```
54
+
55
+ 然后重启 DSH。记忆工具即对 agent 可用,画像快照开始注入,网页侧边栏出现 **Memory** 分区。
56
+
57
+ ## 使用
58
+
59
+ 安装后,agent 获得一组 `memory_*` 工具。典型流程:
60
+
61
+ 1. 会话进行中,agent 用 `memory_fact` 追加原始笔记。
62
+ 2. 到自然停点,运行 `memory_extract` 提炼事实与关心事项(由 `memory-extraction` skill 引导)。
63
+ 3. 之后的会话里,`memory_recall` 召回相关经验;系统提示词中已自带一份精简画像快照。
64
+ 4. 某条经验被证实有用就 `memory_report`;发现错了就 `memory_revise`。
65
+ 5. 你也可以在 **Memory** 工作台里手动检视与治理一切。
66
+
67
+ 使用细节见 **[docs/INSTALL.zh-CN.md](./docs/INSTALL.zh-CN.md)**;当前已实现的范围见 **[docs/STATUS.zh-CN.md](./docs/STATUS.zh-CN.md)**。
68
+
69
+ ## 设计
70
+
71
+ 架构、信任/挣得模型、数据 schema、防投毒边界,见 **[docs/DESIGN.zh-CN.md](./docs/DESIGN.zh-CN.md)**。实现现状与扩展方向见 **[docs/STATUS.zh-CN.md](./docs/STATUS.zh-CN.md)**。
72
+
73
+ ## 目录结构
74
+
75
+ ```
76
+ dsh-daoing-memory/
77
+ ├── lib/ # 预构建产物(host + 浏览器 bundle + typert)
78
+ ├── src/ # TypeScript 源码(供参考与迭代)
79
+ ├── skill/ # 随包附带的 memory-extraction skill(独立 .md)
80
+ ├── cordis.patch.yml # 把插件接进 DSH 的 profile patch
81
+ ├── scripts/ # prepare 与 install-skill 辅助脚本
82
+ └── docs/ # INSTALL · DESIGN · STATUS · BUILDING · FAQ
83
+ ```
84
+
85
+ ## 构建与发布
86
+
87
+ 本仓库直接携带构建产物(`lib/`),因此安装它**无需** DSH monorepo 工具链。包如何产出、如何发布到 npm、如何上架 DSH 插件市场,见 **[docs/BUILDING.zh-CN.md](./docs/BUILDING.zh-CN.md)**。
88
+
89
+ ## 许可
90
+
91
+ [MIT](./LICENSE) © daoing
@@ -0,0 +1,22 @@
1
+ # dsh-daoing-memory bundle patch
2
+ #
3
+ # Inserts the self-evolving memory plugin into a DSH profile composition.
4
+ # Applied as a patch layer by `dsh plugin add` (the CLI reconciles this
5
+ # package into `dsh.profile.bundles` because its manifest declares
6
+ # `dsh.bundle.patch`).
7
+ #
8
+ # Row ids `memory` / `memory-tools` follow the DSH memory convention. Patch
9
+ # rows are last-write-wins per id, so if the profile's base bundle already
10
+ # carries an in-box memory row, installing this plugin re-points that row to
11
+ # the dsh-daoing-memory implementation instead of duplicating it. If the
12
+ # profile has no memory row yet, this patch simply adds one.
13
+ #
14
+ # The browser workbench half rides the `memory` row's dsh.client declaration
15
+ # in package.json; the model-facing tools live behind the `memory-tools` row.
16
+
17
+ - insert:
18
+ - id: memory
19
+ name: 'dsh-daoing-memory'
20
+
21
+ - id: memory-tools
22
+ name: 'dsh-daoing-memory/tools'