lingshu-skill 3.92.0 → 3.94.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.
- package/CHANGELOG.md +28 -0
- package/README.md +1 -1
- package/SKILL.md +1 -1
- package/docs//350/277/233/345/261/225/344/270/216/345/276/205/345/212/236.md +4 -0
- package/package.json +1 -1
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +5 -5
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +28 -0
- package/scripts/astrbot_plugin_lingshu/engine/README.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/memory.py +33 -3
- package/scripts/astrbot_plugin_lingshu/engine/scripts/release.py +10 -2
- package/scripts/memory.py +33 -3
- package/scripts/release.py +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## v3.94(2026-11-23)
|
|
4
|
+
|
|
5
|
+
> 主题:**发布门禁的可诊断性**——失败要能点名,别再让人白排查。
|
|
6
|
+
|
|
7
|
+
- **问题**:v3.93 发版时 `release.py publish` 只报 `tests: FAIL`(60/61),没有说是哪个测试,白排查一轮。实际原因是 `test_engine_sync_docs.py`——我改了 `scripts/release.py` 却没重生成 engine 副本(派生文件纪律)。
|
|
8
|
+
- **修**:
|
|
9
|
+
- `do_verify()` 捕获测试输出,失败时逐行打印 `FAIL <测试名>`(最多 10 条);
|
|
10
|
+
- 六项检查失败时透出末尾 3 行真实原因,不再只有一个 `FAIL` 字样;
|
|
11
|
+
- 成功时也打印末尾统计行(看得出 61/61 还是 60/61)。
|
|
12
|
+
- **纪律补充**:`bump` 之后到 `publish` 之间**不要再改 `scripts/` 或 `docs/`**,否则 engine 副本 / checksums / manifest 立刻过期、门禁必红;要改就再 bump 一次。
|
|
13
|
+
|
|
14
|
+
验证:`test_engine_sync_docs.py` 同步后 ALL PASS;`do_verify()` 全绿;全量测试 61/61。
|
|
15
|
+
|
|
16
|
+
## v3.93(2026-11-23)
|
|
17
|
+
|
|
18
|
+
> 主题:**prior 结果质量**——上线首战就暴露:注入块被做梦聚合垃圾占满。
|
|
19
|
+
|
|
20
|
+
- **问题**:`prior`(v3.92)实战时,注入的 4 条里 2-3 条是做梦机械拼接的 `最近关于「X」的一组事情(N 条):…`。它只是把 N 条原文用「;」连起来,对"以前做过吗"零增量,却挤占注入预算(真库 265 条里 18 条,占 6%)。
|
|
21
|
+
- **修**:
|
|
22
|
+
- 新增 `memory._is_dream_aggregate()` / `_agg_like()`:标题或正文命中聚合模式即判为低价值;
|
|
23
|
+
- `prior` 的**四路来源**(知识/笔记/教训/记忆)统一排除聚合条目;
|
|
24
|
+
- `build_injection` 的「最近的记忆」「相关记忆」候选也排除(启动注入不再被聚合条目占预算);
|
|
25
|
+
- 补护栏:内容过短的退化条目(如 body 只有一个 `list`)跳过。
|
|
26
|
+
- **不动数据**:原文各条仍在库里,`recall`/`deref` 照常可单独取到,可追溯性不受影响。
|
|
27
|
+
- 实测:`prior "灵枢 记忆 注入 上下文"` 从"2 条聚合+2 条真实"变为纯真实条目;`prior "laneai compat"` 仍正确返回那条 compat 结论。
|
|
28
|
+
|
|
29
|
+
验证:`tests/test_prior_work.py` 8/8(新增聚合排除、短内容排除);六项检查 + 行为基线 + 全量测试全过。
|
|
30
|
+
|
|
3
31
|
## v3.92(2026-11-23)
|
|
4
32
|
|
|
5
33
|
> 主题:**开工前先查(prior)**——把"做过的事又重新调研"从提示词自觉变成机制。
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> 名字取自《黄帝内经》:**算力给思考,人格给灵魂,记忆给生命。**
|
|
4
4
|
|
|
5
|
-
> 当前版本 **v3.
|
|
5
|
+
> 当前版本 **v3.94**(变更见 [CHANGELOG.md](CHANGELOG.md))
|
|
6
6
|
|
|
7
7
|
> 🔁 **双仓库镜像**:GitHub(主)与 Gitee(镜像)保持同步——[gitee.com/htmcwy_0/lingshu-skill](https://gitee.com/htmcwy_0/lingshu-skill)。灵枢的更新检查会探测两边最新提交,**谁更新就自动从谁拉取**;任一边不可达(Gitee 匿名风控 / GitHub 限额)时走另一边兜底。
|
|
8
8
|
|
package/SKILL.md
CHANGED
|
@@ -377,6 +377,10 @@ startup 注入的记忆块与 cron 的瞬态提醒**同名**,于是 cron 的 p
|
|
|
377
377
|
- `SKILL.md` 加"开工前先查"为**第一条**沉淀纪律(提示词兜底)。
|
|
378
378
|
- 实测:真库 `prior "laneai compat 开关"` 直接取回当时那条 compat 结论;`prior "水位联动"` 取回排水位修复记录。
|
|
379
379
|
|
|
380
|
+
62. **【已修 v3.93】prior 结果被做梦聚合垃圾占满**:`prior` 上线后首次实战,注入块里 4 条有 2-3 条是做梦机械拼接的 `最近关于「X」的一组事情(N 条):…`(真库 265 条里 18 条,占 6%)——它不是结论、只是原文用「;」相连,对"以前做过吗"零增量,却挤占注入预算。**修**:`_is_dream_aggregate()` / `_agg_like()` 在 `prior` 的四路来源(知识/笔记/教训/记忆)与 `build_injection` 的最近/相关记忆候选里统一排除;另补"内容过短退化条目(如 body 只有 `list`)跳过"的护栏。原文各自仍在库里、recall 可单独取到,不影响可追溯性。
|
|
381
|
+
|
|
382
|
+
63. **【已修 v3.94】发布验证失败时只报"tests: FAIL"不点名**:v3.93 发版时 `release.py publish` 报 60/61 失败但没说是哪个测试,白排查一轮(实际是 `test_engine_sync_docs.py`——我改了 `scripts/release.py` 却没重生成 engine 副本)。**修**:`do_verify()` 现在捕获测试输出,失败时逐行打印 `FAIL <测试名>`(最多 10 条);六项检查失败也透出末尾 3 行真实原因。**教训(写进纪律)**:bump 之后到 publish 之间**不要再改 scripts/ 或 docs/**,否则 engine 副本/checksums/manifest 立刻过期,门禁会红——真要改就再 bump 一次。
|
|
383
|
+
|
|
380
384
|
## 三、已知问题与风险
|
|
381
385
|
|
|
382
386
|
| # | 现象 | 影响 | 处置 |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lingshu-skill",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.94.0",
|
|
4
4
|
"description": "Brain-inspired persistent memory, persona and growth system for AI coding agents. Local-only, zero-dependency Python. Requires Python 3.10+.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"PATCH_NOTES.md": "9296e524f743f358fd11115598398a754cfd69534526dde9c8ad85f14a418f89",
|
|
3
3
|
"README.md": "3d634d743b085eebd2cbb5dd3a00edfa728ed23947e20cc29e7c3b29087ec043",
|
|
4
|
-
"engine/CHANGELOG.md": "
|
|
5
|
-
"engine/README.md": "
|
|
4
|
+
"engine/CHANGELOG.md": "b87d2a60b60eac739b4aaba696cf13bc8e44cbc3929140a34662e726e024f32b",
|
|
5
|
+
"engine/README.md": "e6f847bc8e8f021635a3796742884557c2471b89a899dbe40f1a138b1b8e0e56",
|
|
6
6
|
"engine/SKILL-lite.md": "04b87789232a0f7537c861c857888b4a0e947bcf92a461cbad5328af05361c58",
|
|
7
7
|
"engine/SKILL-tiny.md": "74e1955cc5bf4ec0ca28d52030f799f039283de27a52345a33ce783d6ee0c608",
|
|
8
|
-
"engine/SKILL.md": "
|
|
8
|
+
"engine/SKILL.md": "97d14585e55f3f5538109c86dbad22d42469d06aa00012d29f9e6de1064ce2c7",
|
|
9
9
|
"engine/assets/panel.html": "8b368f16f0c1447413456a16cb4666daa4df08983bd30d627af04ad2a0fbda26",
|
|
10
10
|
"engine/docs/commands.md": "bdc2ab68088b93cd204063f1c60723488073206f9bfa53d90c53ceb4b6e5717e",
|
|
11
11
|
"engine/docs/mechanics.md": "e8a6602a434ed5b78cac64a98884f65a6888eb48daa7a1c0be1f6c3984041b34",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"engine/scripts/mem_lesson.py": "6d9c26d4307dccb80f01d406e5253fe26f3540e0774b212f5fbd939d2ac442f0",
|
|
36
36
|
"engine/scripts/mem_score.py": "95dcecba5f4db7c0c16ebc415434e1cb58cc7dd8b8213360b4df36e2a90faf6e",
|
|
37
37
|
"engine/scripts/mem_topic.py": "c22f75c128cdd3b26ff845f1a71608401bc0dc8955f9f0e1988d7f0cd663d0d5",
|
|
38
|
-
"engine/scripts/memory.py": "
|
|
38
|
+
"engine/scripts/memory.py": "25643f70574d05e3756207afe657d52e753783f2c2bbf2601d8167f944520b76",
|
|
39
39
|
"engine/scripts/npm_prepack.py": "d62c491a6f9edfcab2dd465a995e72df879a61b4da26ae0fe76121c8adc77e02",
|
|
40
40
|
"engine/scripts/panel_build.py": "6394c1d74d203093e43b2106d7acca6e0ca9db61ca1cd6cd3a1616053653414b",
|
|
41
41
|
"engine/scripts/panel_cloud.py": "fff72888123d45bbf05ab329a06b2126f1c0b972c76283ecff32454bc4155c58",
|
|
42
42
|
"engine/scripts/panel_server.py": "51c735de0d78d8cc9d3aae5bee4ca1e66a551f200cab37f327bf9c2666abd297",
|
|
43
43
|
"engine/scripts/panels.py": "87dfce47693340af7c9bc6010a593256331e32c2e8504a0ac0745cf2ef992fd6",
|
|
44
44
|
"engine/scripts/persona.py": "fb748d2fb7b176d9dd0d7394de69ba4560da7f4205f62256477d3a69dcbdf0f5",
|
|
45
|
-
"engine/scripts/release.py": "
|
|
45
|
+
"engine/scripts/release.py": "2552fb634cc06050fcdcf7cdf34f5966df99c938ffb9ed021ef0c91e66c6838b",
|
|
46
46
|
"engine/scripts/retriever.py": "85a35f8f660767cff1c068e722b51e3b5623c4dffe4822527eee96f9220240d3",
|
|
47
47
|
"engine/scripts/safety.py": "7586d8d4a627eec67a4891b758665289a33e07a45fd27d526d45c70d1178cd53",
|
|
48
48
|
"engine/scripts/session_import.py": "31c68069800e6ca8c91aad7869e7e174adc0b1e027ac0a4f7361a2c3a5363b3f",
|
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## v3.94(2026-11-23)
|
|
4
|
+
|
|
5
|
+
> 主题:**发布门禁的可诊断性**——失败要能点名,别再让人白排查。
|
|
6
|
+
|
|
7
|
+
- **问题**:v3.93 发版时 `release.py publish` 只报 `tests: FAIL`(60/61),没有说是哪个测试,白排查一轮。实际原因是 `test_engine_sync_docs.py`——我改了 `scripts/release.py` 却没重生成 engine 副本(派生文件纪律)。
|
|
8
|
+
- **修**:
|
|
9
|
+
- `do_verify()` 捕获测试输出,失败时逐行打印 `FAIL <测试名>`(最多 10 条);
|
|
10
|
+
- 六项检查失败时透出末尾 3 行真实原因,不再只有一个 `FAIL` 字样;
|
|
11
|
+
- 成功时也打印末尾统计行(看得出 61/61 还是 60/61)。
|
|
12
|
+
- **纪律补充**:`bump` 之后到 `publish` 之间**不要再改 `scripts/` 或 `docs/`**,否则 engine 副本 / checksums / manifest 立刻过期、门禁必红;要改就再 bump 一次。
|
|
13
|
+
|
|
14
|
+
验证:`test_engine_sync_docs.py` 同步后 ALL PASS;`do_verify()` 全绿;全量测试 61/61。
|
|
15
|
+
|
|
16
|
+
## v3.93(2026-11-23)
|
|
17
|
+
|
|
18
|
+
> 主题:**prior 结果质量**——上线首战就暴露:注入块被做梦聚合垃圾占满。
|
|
19
|
+
|
|
20
|
+
- **问题**:`prior`(v3.92)实战时,注入的 4 条里 2-3 条是做梦机械拼接的 `最近关于「X」的一组事情(N 条):…`。它只是把 N 条原文用「;」连起来,对"以前做过吗"零增量,却挤占注入预算(真库 265 条里 18 条,占 6%)。
|
|
21
|
+
- **修**:
|
|
22
|
+
- 新增 `memory._is_dream_aggregate()` / `_agg_like()`:标题或正文命中聚合模式即判为低价值;
|
|
23
|
+
- `prior` 的**四路来源**(知识/笔记/教训/记忆)统一排除聚合条目;
|
|
24
|
+
- `build_injection` 的「最近的记忆」「相关记忆」候选也排除(启动注入不再被聚合条目占预算);
|
|
25
|
+
- 补护栏:内容过短的退化条目(如 body 只有一个 `list`)跳过。
|
|
26
|
+
- **不动数据**:原文各条仍在库里,`recall`/`deref` 照常可单独取到,可追溯性不受影响。
|
|
27
|
+
- 实测:`prior "灵枢 记忆 注入 上下文"` 从"2 条聚合+2 条真实"变为纯真实条目;`prior "laneai compat"` 仍正确返回那条 compat 结论。
|
|
28
|
+
|
|
29
|
+
验证:`tests/test_prior_work.py` 8/8(新增聚合排除、短内容排除);六项检查 + 行为基线 + 全量测试全过。
|
|
30
|
+
|
|
3
31
|
## v3.92(2026-11-23)
|
|
4
32
|
|
|
5
33
|
> 主题:**开工前先查(prior)**——把"做过的事又重新调研"从提示词自觉变成机制。
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> 名字取自《黄帝内经》:**算力给思考,人格给灵魂,记忆给生命。**
|
|
4
4
|
|
|
5
|
-
> 当前版本 **v3.
|
|
5
|
+
> 当前版本 **v3.94**(变更见 [CHANGELOG.md](CHANGELOG.md))
|
|
6
6
|
|
|
7
7
|
> 🔁 **双仓库镜像**:GitHub(主)与 Gitee(镜像)保持同步——[gitee.com/htmcwy_0/lingshu-skill](https://gitee.com/htmcwy_0/lingshu-skill)。灵枢的更新检查会探测两边最新提交,**谁更新就自动从谁拉取**;任一边不可达(Gitee 匿名风控 / GitHub 限额)时走另一边兜底。
|
|
8
8
|
|
|
@@ -2875,6 +2875,24 @@ def _is_noise_text(text: str) -> bool:
|
|
|
2875
2875
|
return len(rest) < 40
|
|
2876
2876
|
|
|
2877
2877
|
|
|
2878
|
+
# 做梦机械聚合条目:`最近关于「X」的一组事情(N 条):原文;原文;…`
|
|
2879
|
+
# 它不是结论,只是把 N 条原文用「;」连起来——对"以前做过吗"没有增量信息
|
|
2880
|
+
# (原文各自还在库里,recall 能单独取到),却会占满注入预算。真库实测占 6%。
|
|
2881
|
+
_AGG_RE = re.compile(r"^最近关于「[^」]*」的一组事情(\d+\s*条)[::]")
|
|
2882
|
+
|
|
2883
|
+
|
|
2884
|
+
def _is_dream_aggregate(text: str) -> bool:
|
|
2885
|
+
"""是否是做梦机械拼接的聚合条目(低信息量,不该进注入/prior)。"""
|
|
2886
|
+
return bool(_AGG_RE.match(str(text or "").lstrip()))
|
|
2887
|
+
|
|
2888
|
+
|
|
2889
|
+
def _agg_like(rec: dict) -> bool:
|
|
2890
|
+
"""记录(记忆/知识/笔记)是否本质是做梦聚合条目——标题或正文命中都算。"""
|
|
2891
|
+
if not isinstance(rec, dict):
|
|
2892
|
+
return False
|
|
2893
|
+
return any(_is_dream_aggregate(rec.get(k, "")) for k in ("text", "title", "body"))
|
|
2894
|
+
|
|
2895
|
+
|
|
2878
2896
|
|
|
2879
2897
|
def _split_segments(text: str) -> list:
|
|
2880
2898
|
"""把一段会话原文切成可独立成条的片段:空行 / 分隔线 / 说话人切换。
|
|
@@ -3095,6 +3113,8 @@ def prior_work(task: str, k: int = 6) -> dict:
|
|
|
3095
3113
|
try:
|
|
3096
3114
|
import growth as _growth
|
|
3097
3115
|
for rec, score in _growth.search_knowledge(task, k=k)[:_PRIOR_MAX_ITEMS]:
|
|
3116
|
+
if _agg_like(rec):
|
|
3117
|
+
continue
|
|
3098
3118
|
out["knowledge"].append({
|
|
3099
3119
|
"id": rec.get("id", ""),
|
|
3100
3120
|
"title": str(rec.get("title") or "")[:120],
|
|
@@ -3104,7 +3124,7 @@ def prior_work(task: str, k: int = 6) -> dict:
|
|
|
3104
3124
|
})
|
|
3105
3125
|
# 1b) 笔记:交接笔记/日记里常有"这轮做了什么、结论是什么"的浓缩
|
|
3106
3126
|
for rec, score in _growth.search_notes(task, k=k)[:2]:
|
|
3107
|
-
if score <= 0.02:
|
|
3127
|
+
if score <= 0.02 or _agg_like(rec):
|
|
3108
3128
|
continue
|
|
3109
3129
|
out["notes"].append({
|
|
3110
3130
|
"id": rec.get("id", ""),
|
|
@@ -3117,6 +3137,8 @@ def prior_work(task: str, k: int = 6) -> dict:
|
|
|
3117
3137
|
# 2) 教训:踩过的坑(词面命中优先)
|
|
3118
3138
|
try:
|
|
3119
3139
|
for les in injectable_lessons(task, k=k)[:_PRIOR_MAX_ITEMS]:
|
|
3140
|
+
if _agg_like(les):
|
|
3141
|
+
continue
|
|
3120
3142
|
out["lessons"].append({
|
|
3121
3143
|
"id": les.get("id", ""),
|
|
3122
3144
|
"text": str(les.get("text") or "")[:200],
|
|
@@ -3132,6 +3154,9 @@ def prior_work(task: str, k: int = 6) -> dict:
|
|
|
3132
3154
|
for m, score, _parts in recall(task, k=k, strengthen=False, mode="fast")[:_PRIOR_MAX_ITEMS]:
|
|
3133
3155
|
if score < _PRIOR_MEM_SCORE:
|
|
3134
3156
|
continue
|
|
3157
|
+
# 做梦机械聚合条目对"以前做过吗"没有增量信息(原文各自还在库里),跳过
|
|
3158
|
+
if _agg_like(m):
|
|
3159
|
+
continue
|
|
3135
3160
|
out["memories"].append({
|
|
3136
3161
|
"id": m.get("id", ""),
|
|
3137
3162
|
"text": str(m.get("text") or "")[:200],
|
|
@@ -3170,6 +3195,9 @@ def prior_work(task: str, k: int = 6) -> dict:
|
|
|
3170
3195
|
kept = []
|
|
3171
3196
|
for it in out[key]:
|
|
3172
3197
|
s = _sig(it)
|
|
3198
|
+
# 内容过短的退化条目(如 body 只有一个 "list")没有复用价值
|
|
3199
|
+
if len(s) < 10:
|
|
3200
|
+
continue
|
|
3173
3201
|
if _dup(s, seen):
|
|
3174
3202
|
continue
|
|
3175
3203
|
seen.append(s)
|
|
@@ -3901,7 +3929,8 @@ def build_injection(query: str = "", budget_tokens: int | None = None,
|
|
|
3901
3929
|
_recent40 = []
|
|
3902
3930
|
try:
|
|
3903
3931
|
_recent40 = [m for m in recent(40)
|
|
3904
|
-
if not m.get("frozen") and _inject_memory_visible(m, cfg)
|
|
3932
|
+
if not m.get("frozen") and _inject_memory_visible(m, cfg)
|
|
3933
|
+
and not _is_dream_aggregate(m.get("text", ""))]
|
|
3905
3934
|
_mistakes = [m for m in _recent40 if m.get("kind") == "mistake"
|
|
3906
3935
|
and m.get("layer") != "dust"][:3]
|
|
3907
3936
|
_rels = [m for m in _recent40 if m.get("kind") == "relationship"
|
|
@@ -4072,7 +4101,8 @@ def build_injection(query: str = "", budget_tokens: int | None = None,
|
|
|
4072
4101
|
if query:
|
|
4073
4102
|
mems = [(m, score, parts)
|
|
4074
4103
|
for m, score, parts in recall(query, k=10, strengthen=not READONLY)
|
|
4075
|
-
if _inject_memory_visible(m, cfg)
|
|
4104
|
+
if _inject_memory_visible(m, cfg)
|
|
4105
|
+
and not _is_dream_aggregate(m.get("text", ""))]
|
|
4076
4106
|
header = f"\n## 与「{query[:24]}」相关的记忆"
|
|
4077
4107
|
new_mem: list = []
|
|
4078
4108
|
else:
|
|
@@ -137,20 +137,28 @@ def do_bump(new_ver: str, title: str) -> int:
|
|
|
137
137
|
def do_verify() -> int:
|
|
138
138
|
bad = []
|
|
139
139
|
for name, args in CHECKS:
|
|
140
|
-
code,
|
|
140
|
+
code, out = _run(args, capture=True)
|
|
141
141
|
print(f" {name}: {'OK' if code == 0 else 'FAIL'}")
|
|
142
142
|
if code != 0:
|
|
143
143
|
bad.append(name)
|
|
144
|
+
tail = (out or "").strip().splitlines()[-3:]
|
|
145
|
+
for ln in tail:
|
|
146
|
+
print(f" {ln}", file=sys.stderr)
|
|
144
147
|
print("[release] 行为基线...")
|
|
145
148
|
code, _ = _run(["scripts/behavior_baseline.py", "check"])
|
|
146
149
|
print(f" baseline: {'OK' if code == 0 else 'FAIL'}")
|
|
147
150
|
if code != 0:
|
|
148
151
|
bad.append("baseline")
|
|
149
152
|
print("[release] 全量测试...")
|
|
150
|
-
code,
|
|
153
|
+
code, out = _run(["scripts/run_tests.py"], capture=True)
|
|
154
|
+
print(out.rstrip()[-400:] if out else "") # 透出末尾统计行
|
|
151
155
|
print(f" tests: {'OK' if code == 0 else 'FAIL'}")
|
|
152
156
|
if code != 0:
|
|
153
157
|
bad.append("tests")
|
|
158
|
+
# 失败时必须点名:否则发版日志只说"tests: FAIL",事后无法定位
|
|
159
|
+
fails = [ln.strip() for ln in out.splitlines() if ln.strip().startswith("FAIL ")]
|
|
160
|
+
for ln in fails[:10]:
|
|
161
|
+
print(f" {ln}", file=sys.stderr)
|
|
154
162
|
if bad:
|
|
155
163
|
print(f"[release] 验证失败:{', '.join(bad)}", file=sys.stderr)
|
|
156
164
|
return 1
|
package/scripts/memory.py
CHANGED
|
@@ -2875,6 +2875,24 @@ def _is_noise_text(text: str) -> bool:
|
|
|
2875
2875
|
return len(rest) < 40
|
|
2876
2876
|
|
|
2877
2877
|
|
|
2878
|
+
# 做梦机械聚合条目:`最近关于「X」的一组事情(N 条):原文;原文;…`
|
|
2879
|
+
# 它不是结论,只是把 N 条原文用「;」连起来——对"以前做过吗"没有增量信息
|
|
2880
|
+
# (原文各自还在库里,recall 能单独取到),却会占满注入预算。真库实测占 6%。
|
|
2881
|
+
_AGG_RE = re.compile(r"^最近关于「[^」]*」的一组事情(\d+\s*条)[::]")
|
|
2882
|
+
|
|
2883
|
+
|
|
2884
|
+
def _is_dream_aggregate(text: str) -> bool:
|
|
2885
|
+
"""是否是做梦机械拼接的聚合条目(低信息量,不该进注入/prior)。"""
|
|
2886
|
+
return bool(_AGG_RE.match(str(text or "").lstrip()))
|
|
2887
|
+
|
|
2888
|
+
|
|
2889
|
+
def _agg_like(rec: dict) -> bool:
|
|
2890
|
+
"""记录(记忆/知识/笔记)是否本质是做梦聚合条目——标题或正文命中都算。"""
|
|
2891
|
+
if not isinstance(rec, dict):
|
|
2892
|
+
return False
|
|
2893
|
+
return any(_is_dream_aggregate(rec.get(k, "")) for k in ("text", "title", "body"))
|
|
2894
|
+
|
|
2895
|
+
|
|
2878
2896
|
|
|
2879
2897
|
def _split_segments(text: str) -> list:
|
|
2880
2898
|
"""把一段会话原文切成可独立成条的片段:空行 / 分隔线 / 说话人切换。
|
|
@@ -3095,6 +3113,8 @@ def prior_work(task: str, k: int = 6) -> dict:
|
|
|
3095
3113
|
try:
|
|
3096
3114
|
import growth as _growth
|
|
3097
3115
|
for rec, score in _growth.search_knowledge(task, k=k)[:_PRIOR_MAX_ITEMS]:
|
|
3116
|
+
if _agg_like(rec):
|
|
3117
|
+
continue
|
|
3098
3118
|
out["knowledge"].append({
|
|
3099
3119
|
"id": rec.get("id", ""),
|
|
3100
3120
|
"title": str(rec.get("title") or "")[:120],
|
|
@@ -3104,7 +3124,7 @@ def prior_work(task: str, k: int = 6) -> dict:
|
|
|
3104
3124
|
})
|
|
3105
3125
|
# 1b) 笔记:交接笔记/日记里常有"这轮做了什么、结论是什么"的浓缩
|
|
3106
3126
|
for rec, score in _growth.search_notes(task, k=k)[:2]:
|
|
3107
|
-
if score <= 0.02:
|
|
3127
|
+
if score <= 0.02 or _agg_like(rec):
|
|
3108
3128
|
continue
|
|
3109
3129
|
out["notes"].append({
|
|
3110
3130
|
"id": rec.get("id", ""),
|
|
@@ -3117,6 +3137,8 @@ def prior_work(task: str, k: int = 6) -> dict:
|
|
|
3117
3137
|
# 2) 教训:踩过的坑(词面命中优先)
|
|
3118
3138
|
try:
|
|
3119
3139
|
for les in injectable_lessons(task, k=k)[:_PRIOR_MAX_ITEMS]:
|
|
3140
|
+
if _agg_like(les):
|
|
3141
|
+
continue
|
|
3120
3142
|
out["lessons"].append({
|
|
3121
3143
|
"id": les.get("id", ""),
|
|
3122
3144
|
"text": str(les.get("text") or "")[:200],
|
|
@@ -3132,6 +3154,9 @@ def prior_work(task: str, k: int = 6) -> dict:
|
|
|
3132
3154
|
for m, score, _parts in recall(task, k=k, strengthen=False, mode="fast")[:_PRIOR_MAX_ITEMS]:
|
|
3133
3155
|
if score < _PRIOR_MEM_SCORE:
|
|
3134
3156
|
continue
|
|
3157
|
+
# 做梦机械聚合条目对"以前做过吗"没有增量信息(原文各自还在库里),跳过
|
|
3158
|
+
if _agg_like(m):
|
|
3159
|
+
continue
|
|
3135
3160
|
out["memories"].append({
|
|
3136
3161
|
"id": m.get("id", ""),
|
|
3137
3162
|
"text": str(m.get("text") or "")[:200],
|
|
@@ -3170,6 +3195,9 @@ def prior_work(task: str, k: int = 6) -> dict:
|
|
|
3170
3195
|
kept = []
|
|
3171
3196
|
for it in out[key]:
|
|
3172
3197
|
s = _sig(it)
|
|
3198
|
+
# 内容过短的退化条目(如 body 只有一个 "list")没有复用价值
|
|
3199
|
+
if len(s) < 10:
|
|
3200
|
+
continue
|
|
3173
3201
|
if _dup(s, seen):
|
|
3174
3202
|
continue
|
|
3175
3203
|
seen.append(s)
|
|
@@ -3901,7 +3929,8 @@ def build_injection(query: str = "", budget_tokens: int | None = None,
|
|
|
3901
3929
|
_recent40 = []
|
|
3902
3930
|
try:
|
|
3903
3931
|
_recent40 = [m for m in recent(40)
|
|
3904
|
-
if not m.get("frozen") and _inject_memory_visible(m, cfg)
|
|
3932
|
+
if not m.get("frozen") and _inject_memory_visible(m, cfg)
|
|
3933
|
+
and not _is_dream_aggregate(m.get("text", ""))]
|
|
3905
3934
|
_mistakes = [m for m in _recent40 if m.get("kind") == "mistake"
|
|
3906
3935
|
and m.get("layer") != "dust"][:3]
|
|
3907
3936
|
_rels = [m for m in _recent40 if m.get("kind") == "relationship"
|
|
@@ -4072,7 +4101,8 @@ def build_injection(query: str = "", budget_tokens: int | None = None,
|
|
|
4072
4101
|
if query:
|
|
4073
4102
|
mems = [(m, score, parts)
|
|
4074
4103
|
for m, score, parts in recall(query, k=10, strengthen=not READONLY)
|
|
4075
|
-
if _inject_memory_visible(m, cfg)
|
|
4104
|
+
if _inject_memory_visible(m, cfg)
|
|
4105
|
+
and not _is_dream_aggregate(m.get("text", ""))]
|
|
4076
4106
|
header = f"\n## 与「{query[:24]}」相关的记忆"
|
|
4077
4107
|
new_mem: list = []
|
|
4078
4108
|
else:
|
package/scripts/release.py
CHANGED
|
@@ -137,20 +137,28 @@ def do_bump(new_ver: str, title: str) -> int:
|
|
|
137
137
|
def do_verify() -> int:
|
|
138
138
|
bad = []
|
|
139
139
|
for name, args in CHECKS:
|
|
140
|
-
code,
|
|
140
|
+
code, out = _run(args, capture=True)
|
|
141
141
|
print(f" {name}: {'OK' if code == 0 else 'FAIL'}")
|
|
142
142
|
if code != 0:
|
|
143
143
|
bad.append(name)
|
|
144
|
+
tail = (out or "").strip().splitlines()[-3:]
|
|
145
|
+
for ln in tail:
|
|
146
|
+
print(f" {ln}", file=sys.stderr)
|
|
144
147
|
print("[release] 行为基线...")
|
|
145
148
|
code, _ = _run(["scripts/behavior_baseline.py", "check"])
|
|
146
149
|
print(f" baseline: {'OK' if code == 0 else 'FAIL'}")
|
|
147
150
|
if code != 0:
|
|
148
151
|
bad.append("baseline")
|
|
149
152
|
print("[release] 全量测试...")
|
|
150
|
-
code,
|
|
153
|
+
code, out = _run(["scripts/run_tests.py"], capture=True)
|
|
154
|
+
print(out.rstrip()[-400:] if out else "") # 透出末尾统计行
|
|
151
155
|
print(f" tests: {'OK' if code == 0 else 'FAIL'}")
|
|
152
156
|
if code != 0:
|
|
153
157
|
bad.append("tests")
|
|
158
|
+
# 失败时必须点名:否则发版日志只说"tests: FAIL",事后无法定位
|
|
159
|
+
fails = [ln.strip() for ln in out.splitlines() if ln.strip().startswith("FAIL ")]
|
|
160
|
+
for ln in fails[:10]:
|
|
161
|
+
print(f" {ln}", file=sys.stderr)
|
|
154
162
|
if bad:
|
|
155
163
|
print(f"[release] 验证失败:{', '.join(bad)}", file=sys.stderr)
|
|
156
164
|
return 1
|