dsh-hypatia-auto-memory 2.4.0 → 2.4.2

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/README.md CHANGED
@@ -699,6 +699,15 @@ Deliberate, and worth knowing before you rely on them:
699
699
  flush), but older binaries lack it, so the plugin still never edits an entry
700
700
  in place: a second session title does not replace the first, and a work unit
701
701
  is never rewritten.
702
+ - **`knowledge-update --data=""` empties the body, and nothing rolls it back.**
703
+ hypatia stores what it is given and answers `Updated knowledge: <name>` either
704
+ way — tags, scopes and `created_at` survive, the text does not, and a
705
+ whitespace-only payload is the same accident (measured on 4.0.0). The plugin
706
+ never calls the command (see above), but an agent writing a rule by hand does,
707
+ and the way memory is lost is a `--data="$(cat …)"` whose file was never
708
+ written. The guard therefore lives in the instruction layer: the
709
+ `hypatia-memory` skill and the `smart-memory` preset both say to verify the
710
+ payload is non-blank, pass it, then read the entry back with `knowledge-get`.
702
711
  - **Duplicate `knowledge-create` is detected by error text.** hypatia has no
703
712
  upsert for knowledge entries, so `hypatia-cli.js` recognises
704
713
  `UNIQUE constraint failed:` / `duplicate key` to make a replay idempotent.
package/README.zh-CN.md CHANGED
@@ -547,6 +547,12 @@ shelf 清单本来就不是配置,而设置域现在只投影插件的 Config
547
547
  - **插件尚未使用 `knowledge-update`。** hypatia 在 #20 加入它(保留 `created_at`、
548
548
  丢弃旧向量并在下次 flush 时重新嵌入),但更旧的二进制没有,所以插件仍从不在原地
549
549
  编辑条目:第二个会话标题不会替换第一个,工作单元也从不重写。
550
+ - **`knowledge-update --data=""` 会清空正文,且没有回滚。** hypatia 给什么存什么,
551
+ 两种情况都打印 `Updated knowledge: <name>`——tags、scopes、`created_at` 全在,
552
+ 文字没了;纯空白 payload 是同一个事故(在 4.0.0 上实测)。插件自己从不调用这个命令
553
+ (见上一条),但手写规则的 agent 会,而丢记忆的写法就是 `--data="$(cat …)"` 里的
554
+ 文件从未生成。因此这道防线放在指令层:`hypatia-memory` 技能与 `smart-memory`
555
+ 预设都要求先确认 payload 含非空白字符、再传、再用 `knowledge-get` 回读。
550
556
  - **重复的 `knowledge-create` 靠错误文本识别。** hypatia 对知识条目没有 upsert,所以
551
557
  `hypatia-cli.js` 识别 `UNIQUE constraint failed:` / `duplicate key` 使重放幂等。
552
558
  `statement-create` 自 hypatia #20 起自身幂等(重复执行退出 0 并打印 `Statement
package/cordis.patch.yml CHANGED
@@ -81,12 +81,12 @@
81
81
  查到既有决策就遵循它,并在回答里点明依据(条目名或结论)。记忆与当前代码或用户要求冲突时,明确说出冲突,以用户当前指令为准,并用 `supersedes` 语句把新结论落库——绝不删除旧条目。确实没有记录时,直接说明"记忆库中没有相关记录",再按第一性原理推进,不要编造记忆内容。
82
82
 
83
83
  ## 写入纪律
84
- 用户给出永久性规则、禁忌或纠正时立即写库(`rule` / `taboo` / `memory`,scope 用本项目的实际 scope):先 `knowledge-get`,已存在就 `knowledge-update`,不存在才 `knowledge-create`,不要删除后重建。过程流水不要手工写。
84
+ 用户给出永久性规则、禁忌或纠正时立即写库(`rule` / `taboo` / `memory`,scope 用本项目的实际 scope):先 `knowledge-get`,已存在就 `knowledge-update`,不存在才 `knowledge-create`,不要删除后重建。覆盖正文前先确认 payload 含非空白字符(空或纯空白的 `--data` 会清空正文,且没有历史可回滚),写后用 `knowledge-get` 回读核对。过程流水不要手工写。
85
85
 
86
86
  ## 长程任务
87
87
  复杂任务先用 todo_write 拆解并跟踪;跨轮目标用 goal 机制续跑,没有完成证据不要宣称完成。阶段收尾时把"值得留存的结论"落库,而不是把过程日志落库。
88
88
  suffix: |-
89
- 你的工作目录是 {{cwd}}。记忆的检索与落库通过 bash 调用 hypatia CLI 完成,scope 归属由插件决定。
89
+ 记忆的检索与落库通过 bash 调用 hypatia CLI 完成,scope 归属由插件决定。
90
90
  - id: agent-instructions
91
91
  name: '@deepseek-ai/dsh-agent-instructions'
92
92
  config:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-hypatia-auto-memory",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Event-driven Hypatia memory for DSH: automatic conversation logging via session events, queued background consolidation (span summaries + work-unit extraction) with a dedicated model route, and recall injection — zero per-call model work in the main session.",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",
@@ -139,6 +139,8 @@ hypatia knowledge-update <name> [-d "<data>"] [-t "<tags>"] [--synonyms "<csv>"]
139
139
 
140
140
  Only the fields you pass change. An omitted field keeps its stored value, and exactly `""` clears a field, such as `-t ""`; for tags, `","` or `" "` would store blank tags instead. `--scopes` replaces the stored scopes and is parsed as on create: end the list with a comma, such as `"q,"`, to include the global scope, or the entry drops out of global lookups. The entry keeps its `created_at`. Its old vector is discarded, and a new one is generated on the next flush, as after `knowledge-create`. Updating an entry that does not exist is an error. An update that changes nothing prints `Knowledge unchanged: <name>` and writes nothing.
141
141
 
142
+ **`-d ""` / `--data=""` is destructive, not a no-op.** It replaces the body with the empty string and still prints `Updated knowledge: <name>`; tags, scopes and `created_at` survive, the text is gone, and there is no revision history to restore from (measured on 4.0.0). The usual accident is a command substitution over a file that was never written — `--data="$(cat /tmp/x.md)"` expands to empty — and `--data=" "` is the same accident once trimmed, which is why `test -s` is not a sufficient check. Verify the payload holds a non-blank character (`grep -q '[^[:space:]]' /tmp/x.md`), pass it, then read the entry back with `hypatia knowledge-get <name>`. When the body is not what changes, omit `-d` entirely.
143
+
142
144
  | User says | Command |
143
145
  |---|---|
144
146
  | "update Rust's description to mention memory safety" | `hypatia knowledge-update "Rust" -d "systems programming language with memory safety"` |
@@ -164,6 +164,18 @@ hypatia knowledge-create "<short-kebab-name>" \
164
164
  vector is regenerated on the next flush. An update that changes nothing
165
165
  prints `Knowledge unchanged: <name>` and writes nothing. Updating a missing
166
166
  entry exits 1.
167
+ - **An empty `--data` erases the body, and nothing undoes it.** The classic
168
+ accident is `--data="$(cat /tmp/fact.md)"` whose file was never written: the
169
+ expansion is empty, hypatia still answers `Updated knowledge: <name>`, and the
170
+ entry keeps its tags, scopes and `created_at` while its body becomes nothing.
171
+ A whitespace-only payload (`" "`) does the same, so `test -s` is NOT enough
172
+ — check for a non-blank character (`grep -q '[^[:space:]]' /tmp/fact.md`).
173
+ Write the payload to a file, verify it, pass `--data="$(cat /tmp/fact.md)"`,
174
+ then read it back with `hypatia knowledge-get "<exact-name>"` and confirm the
175
+ body is what you meant to say. There is no revision history: a wiped body can
176
+ only be rebuilt from the conversation or the session log. When the update is
177
+ not about the body, omit `--data` altogether — an omitted field keeps its
178
+ value; only a passed empty value clears one.
167
179
  - Pass only the fields you mean to change. `--scopes` **replaces** the stored
168
180
  scopes, with the syntax above: leave off the trailing comma and a global rule
169
181
  drops out of the session seed. `--tags ""` clears every tag, and an entry