lingshu-skill 5.71.0 → 5.72.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # 更新日志
2
2
 
3
+ ## v5.72(2026-12-05)
4
+
5
+ ### 🪄 发布自动化与注入瘦身
6
+
7
+ 1. **AUTOTAG(postpublish 自动打 tag)**:新增 `scripts/autotag.py` 并挂到 npm `postpublish`——`npm publish` 成功后自动创建 `vX.Y` 标签并推送 GitHub+Gitee(指数退避重试),GitHub Actions 随即创建 Release,插件市场版本说明自动更新。修复"npm 发了新版但市场永远停在旧版"(v5.34-v5.71 无 tag 导致)。
8
+ 2. **人格注入瘦身·性格内驱合并**:自我描述从两行合并为一行「性格:好奇80—来源;理智70—来源;内驱 好奇89/理智80」,砍掉"(0-100,数值来自…真实发生过的事)"和"理智先算值不值得深想…"两段每轮重复的固定说明;来源 why 超过 12 字截断。
9
+ 3. **人格注入瘦身·画像截断**:擅长/短板/没弄清的每条分别截到 80/80/60 字(实测短板单条 300+ 字、三条 900+ 字),教训正文截到 160 字、砍掉"置信度 0.50 已验证 0 次"这类零信息注脚(只保留已验证 ≥1 次的)。
10
+ 4. **人格演化提示强化**:做梦 apply_schema 的 persona_updates 增加显式指引——likes/dislikes 填本批记忆里新出现的稳定偏好/反感(带证据),traits 填 -10~10 倾向微调,宁缺勿滥。配合既有漂移双门限(TRAIT_DRIFT_GATE)机制,喜欢/讨厌/性格将随相处真实演化而非停在初识值。
11
+
12
+ ---
13
+
3
14
  ## v5.71(2026-12-05)
4
15
 
5
16
  ### 🎉 150 项审计最终批:全量缺口大收官!
package/SKILL-lite.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: lingshu-lite
3
3
  title: 灵枢-lite
4
- version: 5.71
4
+ version: 5.72
5
5
  description: 灵枢记忆系统的精简版说明书,给 3B 以下本地小模型或第一次用的人。只保留最有用的核心:分层记忆(含冷热自动归档)、模糊回忆、工作记忆、人格初识;砍掉高风险自动能力(自动做梦合并、自动情绪评估、自动提炼知识库)——小模型做这些容易把幻觉固化落盘。当用户提到"记住这个""你还记得吗""你记得什么""上下文快满了"且宿主是小模型时使用。
6
6
  ---
7
7
 
package/SKILL-tiny.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: lingshu-tiny
3
3
  title: 灵枢-tiny
4
- version: 5.71
4
+ version: 5.72
5
5
  description: 灵枢记忆系统的最小试用版说明书。只剩三件事:startup 带回上次的记忆、remember 记下值得记的、recall 想不起来时捞回来。给第一次接触灵枢的人或最小模型:先跑通这三条拿到真实收益,再决定要不要升级完整版。当用户提到"记住这个""你还记得吗"且你不想背整套机制时使用。
6
6
  ---
7
7
 
package/SKILL.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: lingshu
3
3
  title: 灵枢
4
- version: 5.71
4
+ version: 5.72
5
5
  description: 类脑持久记忆/人格/成长。跨会话记住事情、长出人格、上下文将满时做梦整理。用户提记忆/记住/上次/人格/设定/性格/知识库/笔记/日志/成长/自我进化/工作记忆,或新会话需恢复关系上下文时用。纯本地零依赖。
6
6
  ---
7
7
 
package/manifest.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
- "version": "5.71",
2
+ "version": "5.72",
3
3
  "files": {
4
4
  "CHANGELOG.md": {
5
- "sha256": "ded9e237679c18e7f27677695653af9c7ae77a8432f5daa6732c851c8650b047",
6
- "size": 443157
5
+ "sha256": "3a1c73e0c26b63fc676169954d26d4eb9345e66ba85889d79b6ce1323e83b9e4",
6
+ "size": 444569
7
7
  },
8
8
  "README.md": {
9
9
  "sha256": "5ab87b76dc757e6edd6ef1d760e9a979e55df48b2b8c2b76552747fabb7b1026",
10
10
  "size": 114306
11
11
  },
12
12
  "SKILL-lite.md": {
13
- "sha256": "e9089dedfdc2be585bb14f3a7389deb8a3efdffef8749c0ab64091b5cb0f36f7",
13
+ "sha256": "bb746449e7ea2f59c4a1f0dea49ef5c3a9648b0f6863237cb4094e036ce88e80",
14
14
  "size": 4440
15
15
  },
16
16
  "SKILL-tiny.md": {
17
- "sha256": "348ba485b96767a422d057f6597393a4b457e68717da3fc8ceb19e0e7d06e0f4",
17
+ "sha256": "489762bf2958fe686cf9f14133de9aad52f3a1eb0127859ce9bbe4941838b824",
18
18
  "size": 1913
19
19
  },
20
20
  "SKILL.md": {
21
- "sha256": "52bee9e349c1298d19a0b0c91dfb6bb8c36425fd4dbc27e5f08c61c66e0f034f",
21
+ "sha256": "ea18038576fb462dab4bed8748c351833c525eb500884a4ab6e6a2f07c7ec378",
22
22
  "size": 25366
23
23
  },
24
24
  "assets/lingshu-icon-preview.png": {
@@ -138,8 +138,8 @@
138
138
  "size": 6007
139
139
  },
140
140
  "package.json": {
141
- "sha256": "67c6c0e38c4b26b54fc5e3f7057e1d41c7794d55d7ed255d7c02ef8275eb8734",
142
- "size": 1503
141
+ "sha256": "4f85581313d68a84a66d7cdc25be4057c5b86be422d6c7ee12ec68e56f45a64c",
142
+ "size": 1551
143
143
  },
144
144
  "scripts/anchor_retention.py": {
145
145
  "sha256": "327862125cbe9b1c5aaaf14f0b9334031f0906c5c10b15367af53bfe3f905d16",
@@ -214,8 +214,8 @@
214
214
  "size": 8071
215
215
  },
216
216
  "scripts/dream.py": {
217
- "sha256": "0d3f2fe45890b401b1dc541bf42e34aeb3153f12471ffa0a8b94b1681759002a",
218
- "size": 64166
217
+ "sha256": "e8a9961fd7daf860aabc2b34d396ae00d01138a736e8b50c3a0287ee4c3c28dd",
218
+ "size": 64703
219
219
  },
220
220
  "scripts/emotion.py": {
221
221
  "sha256": "e0b4451e05e99dd651c79b9d927191d963824012e7b03aba933d92e111368965",
@@ -298,8 +298,8 @@
298
298
  "size": 7912
299
299
  },
300
300
  "scripts/memory.py": {
301
- "sha256": "eae2e89140b8543fd5c53c3b4504961a0b9769ff779091148d7c3b2df795267e",
302
- "size": 338627
301
+ "sha256": "4d8a4da1428d6239e3eaa0a28902888bd7ce4d49a25c389cadeaecf37d907463",
302
+ "size": 339027
303
303
  },
304
304
  "scripts/memory_extras.py": {
305
305
  "sha256": "4adb61400c5224c90aa54f059267f795c6348a251d93cd173d79fff157d57d90",
@@ -358,8 +358,8 @@
358
358
  "size": 27795
359
359
  },
360
360
  "scripts/persona.py": {
361
- "sha256": "bc09d5bf148590e370a38fb78aaef84b6521818b536728efb3123a716f0b3916",
362
- "size": 134548
361
+ "sha256": "62b69b58c99a7d9488cf9f17c244b1fccd328846d78ea199d58c3321ea0f0ec1",
362
+ "size": 135416
363
363
  },
364
364
  "scripts/prepublish_tests.py": {
365
365
  "sha256": "8d116de1edd3ab57584a6a2749598cf127e918383da67e50118601e5a3970c2a",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lingshu-skill",
3
- "version": "5.71.0",
3
+ "version": "5.72.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",
@@ -31,7 +31,8 @@
31
31
  "!scripts/astrbot_plugin_lingshu/engine/scripts/_*"
32
32
  ],
33
33
  "scripts": {
34
- "prepack": "python scripts/npm_prepack.py"
34
+ "prepack": "python scripts/npm_prepack.py",
35
+ "postpublish": "python scripts/autotag.py"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "@deepseek-ai/cordis": "^0.2.0-rc.1 || ^0.2.1-alpha.3 || ^0.2.1-rc.1 || ^0.2.1-rc.2 || ^0.2.1-rc.3"
@@ -2,11 +2,11 @@
2
2
  "PATCH_NOTES.md": "9296e524f743f358fd11115598398a754cfd69534526dde9c8ad85f14a418f89",
3
3
  "README.md": "3d634d743b085eebd2cbb5dd3a00edfa728ed23947e20cc29e7c3b29087ec043",
4
4
  "_conf_schema.json": "51a484cfa04a686bc923e960f5937e19eb52bb329a937050c268ad1cc5c12170",
5
- "engine/CHANGELOG.md": "ded9e237679c18e7f27677695653af9c7ae77a8432f5daa6732c851c8650b047",
5
+ "engine/CHANGELOG.md": "3a1c73e0c26b63fc676169954d26d4eb9345e66ba85889d79b6ce1323e83b9e4",
6
6
  "engine/README.md": "5ab87b76dc757e6edd6ef1d760e9a979e55df48b2b8c2b76552747fabb7b1026",
7
- "engine/SKILL-lite.md": "210f7cc4ff48196c8280a2a6d6c3f87549beced1984cbea9f404ed2d960cb339",
8
- "engine/SKILL-tiny.md": "dc2db6c193e93d57d0dd64098089d61217d25b2ae070627eb9088b8bfde88a3d",
9
- "engine/SKILL.md": "52bee9e349c1298d19a0b0c91dfb6bb8c36425fd4dbc27e5f08c61c66e0f034f",
7
+ "engine/SKILL-lite.md": "627684394db668690e3d74863a66cdf80f244eae636825f1824585e453bdb52f",
8
+ "engine/SKILL-tiny.md": "30aa8570a10e3f484b19148d44ce5c93008f563132fa017ea151bd5496c1126a",
9
+ "engine/SKILL.md": "ea18038576fb462dab4bed8748c351833c525eb500884a4ab6e6a2f07c7ec378",
10
10
  "engine/assets/panel.html": "7b8f3c1d595e14a06e266ea89c90620f3ce2223c2af2a089e407df734df28e17",
11
11
  "engine/docs/commands.md": "0ce8c88e5d2d04a8055b45c060ebd53b50c52b79b650312e2ee440845804ca4b",
12
12
  "engine/docs/mechanics.md": "aa9683c827ed3419106e84d847ab16dc310c27fc62f588184192aaa1617523cc",
@@ -87,6 +87,7 @@
87
87
  "engine/scripts/anchor_retention.py": "327862125cbe9b1c5aaaf14f0b9334031f0906c5c10b15367af53bfe3f905d16",
88
88
  "engine/scripts/app_context.py": "1541a133d5381e21b30f5e856869c6a170add9e20f8792cf049f2acca6da86c6",
89
89
  "engine/scripts/assembler.py": "60bbb5ebe238d54f9f4bdecbbf0e24cfa9793102b6f1f734e796560786482205",
90
+ "engine/scripts/autotag.py": "9e4575fa321b255aaeaf87dc63e576308144e84a892fe8a764f5edadf62d9c93",
90
91
  "engine/scripts/behavior_baseline.py": "7f488663082f301426c98f291a31860dd159a6097eba6ff225e4912f1b222272",
91
92
  "engine/scripts/bench.py": "7e410bb94a93c8e0b4fd8187ede7a3f7f6cf171e43a2884a836b6734e23e9dc0",
92
93
  "engine/scripts/bigfive.py": "d998558c73584ebdd0b2535e687b4f8af25437bdadec229f7d0bad090ed482bb",
@@ -101,7 +102,7 @@
101
102
  "engine/scripts/coverage_report.py": "53e1c731f4182fac68190d68d23459bcd8059c0b39ebc5a4ba0e56a0d562ad01",
102
103
  "engine/scripts/delivery.py": "6a4bf2caac9dca41b43c06d31f7cfc328bae19d3fb618da26b35f1a214071a11",
103
104
  "engine/scripts/desktop_shortcut.py": "975b76d49c9d6b3220f7d45327e801a5d8c74aff39eae2e3fbdf86b38c7994cc",
104
- "engine/scripts/dream.py": "0d3f2fe45890b401b1dc541bf42e34aeb3153f12471ffa0a8b94b1681759002a",
105
+ "engine/scripts/dream.py": "e8a9961fd7daf860aabc2b34d396ae00d01138a736e8b50c3a0287ee4c3c28dd",
105
106
  "engine/scripts/emotion.py": "e0b4451e05e99dd651c79b9d927191d963824012e7b03aba933d92e111368965",
106
107
  "engine/scripts/failures.py": "3a16234a1871f62e3ba7b7b743110b4044fb7b715b4d0e924b8ebf1cf0be50d0",
107
108
  "engine/scripts/fallback_embed.py": "11339a9f5040aea8952fdd45f4183cdfb0f00266ff61e200f3b4e8a62778f6e0",
@@ -118,7 +119,7 @@
118
119
  "engine/scripts/mem_lesson.py": "e1520786315f3e41c829909c739e5af3eee89397da7db5026d106710b2b3c118",
119
120
  "engine/scripts/mem_score.py": "91148eb50058c47a6094a6cd5e0eb9c3e3331cb0dc0ecb05a82d00905d2e9d90",
120
121
  "engine/scripts/mem_topic.py": "c22f75c128cdd3b26ff845f1a71608401bc0dc8955f9f0e1988d7f0cd663d0d5",
121
- "engine/scripts/memory.py": "eae2e89140b8543fd5c53c3b4504961a0b9769ff779091148d7c3b2df795267e",
122
+ "engine/scripts/memory.py": "4d8a4da1428d6239e3eaa0a28902888bd7ce4d49a25c389cadeaecf37d907463",
122
123
  "engine/scripts/memory_extras.py": "4adb61400c5224c90aa54f059267f795c6348a251d93cd173d79fff157d57d90",
123
124
  "engine/scripts/npm_prepack.py": "d62c491a6f9edfcab2dd465a995e72df879a61b4da26ae0fe76121c8adc77e02",
124
125
  "engine/scripts/occ.py": "4caac0d72ce071ea224ce2dc7d346effdbff8a516e3e7b54118a3be3ed274256",
@@ -133,7 +134,7 @@
133
134
  "engine/scripts/panel_splash.py": "36cd59e593ce52557a180a8767bfa9cd9c803f0cccaa141e7da8babd5a35e925",
134
135
  "engine/scripts/panel_update.py": "b6256af938fec44e7e0c0073d7ed3f2b50487f6d52cea5772fe175d222b09f0d",
135
136
  "engine/scripts/panels.py": "3000f170d42c0e200dd82ed12e8da8b4c62e0e3e1e47f232f3272a798078f59d",
136
- "engine/scripts/persona.py": "bc09d5bf148590e370a38fb78aaef84b6521818b536728efb3123a716f0b3916",
137
+ "engine/scripts/persona.py": "62b69b58c99a7d9488cf9f17c244b1fccd328846d78ea199d58c3321ea0f0ec1",
137
138
  "engine/scripts/prepublish_tests.py": "8d116de1edd3ab57584a6a2749598cf127e918383da67e50118601e5a3970c2a",
138
139
  "engine/scripts/release.py": "36491d76fdd76693c164e441f70ac063a4c4b10c2e36eed06d705f57f55895b6",
139
140
  "engine/scripts/retriever.py": "208b58f4df062bca859eef607e258cc4233791552454fdd3a02051a18f7e0786",
@@ -1,5 +1,16 @@
1
1
  # 更新日志
2
2
 
3
+ ## v5.72(2026-12-05)
4
+
5
+ ### 🪄 发布自动化与注入瘦身
6
+
7
+ 1. **AUTOTAG(postpublish 自动打 tag)**:新增 `scripts/autotag.py` 并挂到 npm `postpublish`——`npm publish` 成功后自动创建 `vX.Y` 标签并推送 GitHub+Gitee(指数退避重试),GitHub Actions 随即创建 Release,插件市场版本说明自动更新。修复"npm 发了新版但市场永远停在旧版"(v5.34-v5.71 无 tag 导致)。
8
+ 2. **人格注入瘦身·性格内驱合并**:自我描述从两行合并为一行「性格:好奇80—来源;理智70—来源;内驱 好奇89/理智80」,砍掉"(0-100,数值来自…真实发生过的事)"和"理智先算值不值得深想…"两段每轮重复的固定说明;来源 why 超过 12 字截断。
9
+ 3. **人格注入瘦身·画像截断**:擅长/短板/没弄清的每条分别截到 80/80/60 字(实测短板单条 300+ 字、三条 900+ 字),教训正文截到 160 字、砍掉"置信度 0.50 已验证 0 次"这类零信息注脚(只保留已验证 ≥1 次的)。
10
+ 4. **人格演化提示强化**:做梦 apply_schema 的 persona_updates 增加显式指引——likes/dislikes 填本批记忆里新出现的稳定偏好/反感(带证据),traits 填 -10~10 倾向微调,宁缺勿滥。配合既有漂移双门限(TRAIT_DRIFT_GATE)机制,喜欢/讨厌/性格将随相处真实演化而非停在初识值。
11
+
12
+ ---
13
+
3
14
  ## v5.71(2026-12-05)
4
15
 
5
16
  ### 🎉 150 项审计最终批:全量缺口大收官!
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: lingshu-lite
3
3
  title: 灵枢-lite
4
- version: 5.71
4
+ version: 5.72
5
5
  description: 灵枢记忆系统的精简版说明书,给 3B 以下本地小模型或第一次用的人。只保留最有用的核心:分层记忆(含冷热自动归档)、模糊回忆、工作记忆、人格初识;砍掉高风险自动能力(自动做梦合并、自动情绪评估、自动提炼知识库)——小模型做这些容易把幻觉固化落盘。当用户提到"记住这个""你还记得吗""你记得什么""上下文快满了"且宿主是小模型时使用。
6
6
  ---
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: lingshu-tiny
3
3
  title: 灵枢-tiny
4
- version: 5.71
4
+ version: 5.72
5
5
  description: 灵枢记忆系统的最小试用版说明书。只剩三件事:startup 带回上次的记忆、remember 记下值得记的、recall 想不起来时捞回来。给第一次接触灵枢的人或最小模型:先跑通这三条拿到真实收益,再决定要不要升级完整版。当用户提到"记住这个""你还记得吗"且你不想背整套机制时使用。
6
6
  ---
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: lingshu
3
3
  title: 灵枢
4
- version: 5.71
4
+ version: 5.72
5
5
  description: 类脑持久记忆/人格/成长。跨会话记住事情、长出人格、上下文将满时做梦整理。用户提记忆/记住/上次/人格/设定/性格/知识库/笔记/日志/成长/自我进化/工作记忆,或新会话需恢复关系上下文时用。纯本地零依赖。
6
6
  ---
7
7
 
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """npm postpublish 自动打 tag 并推送(插件市场依赖 GitHub Release 更新版本说明)。
4
+
5
+ 背景(2026-12-05 事故):插件市场的「版本说明」读的是 GitHub Release,而 Release
6
+ 只由 .github/workflows/release.yml 在**推送 tag** 时触发创建。v5.34-v5.71 从没
7
+ 打过 tag,导致 npm 一直发新版、市场却永远停在旧版。
8
+
9
+ 用法:package.json 里配
10
+ "scripts": { "postpublish": "python scripts/autotag.py" }
11
+ npm publish 成功后自动执行:本地缺 tag 则补打,并推送 origin(GitHub)与 gitee。
12
+ GitHub 网络不稳时按退避重试;全程失败不阻断(tag 已在本地,下次可手推)。
13
+ """
14
+ import subprocess
15
+ import sys
16
+ import time
17
+ import re
18
+ from pathlib import Path
19
+
20
+ ROOT = Path(__file__).resolve().parent.parent
21
+
22
+
23
+ def cur_version() -> str:
24
+ t = (ROOT / "SKILL.md").read_text(encoding="utf-8-sig")
25
+ m = re.search(r"^version:\s*([\d.]+)", t, re.M)
26
+ return m.group(1) if m else ""
27
+
28
+
29
+ def run(cmd: list, timeout: int = 60) -> tuple[int, str]:
30
+ try:
31
+ r = subprocess.run(cmd, cwd=ROOT, capture_output=True, text=True,
32
+ encoding="utf-8", errors="replace", timeout=timeout)
33
+ return r.returncode, ((r.stdout or "") + (r.stderr or ""))
34
+ except Exception as exc:
35
+ return 1, str(exc)
36
+
37
+
38
+ def main() -> int:
39
+ ver = cur_version()
40
+ if not ver:
41
+ print("[autotag] SKILL.md 读不出 version,跳过", file=sys.stderr)
42
+ return 0
43
+ tag = f"v{ver}"
44
+ # ① 本地已有 → 只补推;没有 → 创建 annotated tag
45
+ rc, out = run(["git", "rev-parse", tag])
46
+ if rc != 0:
47
+ rc, out = run(["git", "tag", "-a", tag,
48
+ "-m", f"lingshu {tag}: auto-tagged by npm postpublish"])
49
+ if rc != 0:
50
+ print(f"[autotag] 创建 tag {tag} 失败:{out[:200]}", file=sys.stderr)
51
+ return 1
52
+ print(f"[autotag] 已创建本地 tag {tag}")
53
+ else:
54
+ print(f"[autotag] 本地 tag {tag} 已存在,只补推")
55
+ # ② 推送到两个远端(GitHub 网络不稳:指数退避重试,最多 4 次)
56
+ ok = []
57
+ for remote in ("origin", "gitee"):
58
+ pushed = False
59
+ for attempt in range(4):
60
+ rc, out = run(["git", "push", remote, tag], timeout=90)
61
+ if rc == 0:
62
+ pushed = True
63
+ break
64
+ wait = 8 * (attempt + 1)
65
+ print(f"[autotag] push {remote} 第 {attempt + 1} 次失败,{wait}s 后重试:"
66
+ f"{out.strip()[-120:]}", file=sys.stderr)
67
+ time.sleep(wait)
68
+ if pushed:
69
+ ok.append(remote)
70
+ else:
71
+ print(f"[autotag] tag {tag} 推送 {remote} 全部重试失败——"
72
+ f"tag 留在本地,网络恢复后手推:git push {remote} {tag}",
73
+ file=sys.stderr)
74
+ if ok:
75
+ print(f"[autotag] tag {tag} 已推送:{', '.join(ok)}"
76
+ f"(GitHub Actions 将自动创建 Release,市场版本说明随之更新)")
77
+ return 0
78
+ return 1
79
+
80
+
81
+ if __name__ == "__main__":
82
+ sys.exit(main())
@@ -766,7 +766,12 @@ def dream(trigger: str = "manual", dry_run: bool = False) -> dict:
766
766
  "persona_updates": {"mood": {"value": "这次聊完的情绪", "reason": "..."},
767
767
  "traits": {"幽默": 2},
768
768
  "habits": [{"name": "深夜更容易说真话", "evidence": "..."}],
769
- "likes": [], "dislikes": [], "insights": []},
769
+ "likes": [], "dislikes": [], "insights": [],
770
+ "_prompt": "人格要随相处慢慢长:likes/dislikes 填这批记忆里"
771
+ "新出现的、稳定的用户偏好或反感(带证据 source_ids);"
772
+ "traits 填 -10~10 的倾向微调(如 {\"好奇\": 2});"
773
+ "insights 填对自己���新认识。只在确有多条一致证据时提,"
774
+ "宁缺勿滥。"},
770
775
  "forget": ["m_..."],
771
776
  "narrative": "这次梦的叙述(可选)",
772
777
  },
@@ -4421,16 +4421,25 @@ def render_prior(p: dict, budget_chars: int = 1400) -> str:
4421
4421
 
4422
4422
 
4423
4423
  def _lessons_injection(query: str = "") -> str:
4424
- """注入包小节:active 教训按 confidence 注入,命中 query 的排最前并标「已有教训」。"""
4424
+ """注入包小节:active 教训按 confidence 注入,命中 query 的排最前并标「已有教训」。
4425
+
4426
+ TOKEN-TRIM(v5.72):教训正文可能把"被取代历史"整段带进来(错误闭环会把
4427
+ 新旧结论一起写进 text),注入时截断到前 160 字符——教训是拿来用的提醒,
4428
+ 不是完整调查报告;置信度注脚只在已验证 ≥1 次时才显示(0 次的注脚没信息量)。
4429
+ """
4425
4430
  ls = injectable_lessons(query, k=5)
4426
4431
  if not ls:
4427
4432
  return ""
4428
4433
  lines = []
4429
4434
  for l in ls:
4430
4435
  mark = "已有教训" if query and l.get("_hit") else "教训"
4431
- conf = f"置信度 {_num(l.get('confidence'), 0.5):.2f},已验证 {int(_num(l.get('times_validated'), 0))} 次"
4432
- lines.append(f"- [{mark}] {l['text']}({conf})")
4433
- return "\n## 教训(#36 失败闭环:先用上,别再踩同一个坑)\n" + "\n".join(lines)
4436
+ _txt = str(l.get("text") or "").strip()
4437
+ if len(_txt) > 160:
4438
+ _txt = _txt[:160].rstrip() + "…"
4439
+ _v = int(_num(l.get("times_validated"), 0))
4440
+ conf = f"(已验证{_v}次)" if _v >= 1 else ""
4441
+ lines.append(f"- [{mark}] {_txt}{conf}")
4442
+ return "\n## 教训(先看坑再用)\n" + "\n".join(lines)
4434
4443
 
4435
4444
 
4436
4445
  # ---------------------------------------------------------------- 记忆关联(联想能力)
@@ -653,39 +653,43 @@ def persona_brief(p: dict, mood: bool = True) -> str:
653
653
  if ident.get("自称"):
654
654
  lines.append(f"我自称:{ident['自称']};称呼对方:{ident.get('称呼你') or ident.get('称呼用户') or '你'}。")
655
655
  traits = p.get("traits", {})
656
+ drives = p.get("drives") or {}
657
+ # 与 mind_state() 同一套兜底:traits 已有数值而 drives 还空时,别在自我
658
+ # 描述里一边「性格:好奇85」一边「内驱:还没有数值」——自相矛盾每轮被读。
659
+ if drives.get("curiosity") is None and drives.get("reason") is None:
660
+ _t = p.get("traits") or {}
661
+ if _t.get("好奇") is not None or _t.get("理智") is not None:
662
+ drives = {"curiosity": trait_value(_t["好奇"]) if _t.get("好奇") is not None else None,
663
+ "reason": trait_value(_t["理智"]) if _t.get("理智") is not None else None}
656
664
  if traits:
657
- # 溯源展示:特质名 数值 —— 为什么(why),让数值带行为依据而不是机械参数
665
+ # TOKEN-TRIM(v5.72):性格+内驱合并成一行、砍掉长解释——
666
+ # 旧写法两行带「初识时用户指定(0-100,数值来自我们相处中真实发生过的事)」
667
+ # 和「理智先算值不值得深想……」两段固定说明,每轮注入都重复占 token。
668
+ # 现在格式:「性格 值(内驱 值)—— 一句来源」;内驱与性格同值时只写一次。
658
669
  top = sorted(traits.items(), key=lambda x: trait_value(x[1]), reverse=True)
659
670
  tb = p.get("traits_baseline") if isinstance(p.get("traits_baseline"), dict) else {}
660
671
  parts = []
661
672
  for k, v in top[:3]:
662
673
  meta = trait_meta(v)
663
- # 五-F:离基线够远时标一句,模型知道"这不是我本来的样子,会慢慢回落"
664
674
  b = tb.get(k)
665
675
  bv = _trait_int(b.get("value")) if isinstance(b, dict) else None
666
- gap = "" if bv is None or abs(trait_value(v) - bv) < 15 else f"(基线 {bv},正在回落)"
667
- parts.append(f"{k} {trait_value(v):.0f}{gap}" + (f" —— {meta['why']}" if meta["why"] else ""))
668
- line = "我的性格:" + ";".join(parts)
676
+ gap = "" if bv is None or abs(trait_value(v) - bv) < 15 else f"(基线{bv})"
677
+ _why = meta.get("why") or ""
678
+ # why 只留短因(≤12 字),超长截断——「初识时用户指定」这类模板话不必全量注入
679
+ _why = _why[:12] + "…" if len(_why) > 12 else _why
680
+ parts.append(f"{k}{trait_value(v):.0f}{gap}" + (f"—{_why}" if _why else ""))
681
+ line = "性格:" + ";".join(parts)
669
682
  low = [(k, v) for k, v in top[-2:] if trait_value(v) < 50]
670
683
  if low:
671
684
  lows = "、".join(f"{k}{trait_value(v):.0f}" for k, v in low)
672
685
  line += f";偏低:{lows}"
673
- lines.append(line + "(0-100,数值来自我们相处中真实发生过的事)。")
674
- else:
675
- lines.append("我的性格:还没有。等初识时问用户,用户不知道就由我自己定。")
676
- drives = p.get("drives") or {}
677
- # 与 mind_state() 同一套兜底:traits 已有数值而 drives 还空时,别在自我
678
- # 描述里一边「性格:好奇85」一边「内驱:还没有数值」——自相矛盾每轮被读。
679
- if drives.get("curiosity") is None and drives.get("reason") is None:
680
- _t = p.get("traits") or {}
681
- if _t.get("好奇") is not None or _t.get("理智") is not None:
682
- drives = {"curiosity": trait_value(_t["好奇"]) if _t.get("好奇") is not None else None,
683
- "reason": trait_value(_t["理智"]) if _t.get("理智") is not None else None}
684
- if drives.get("curiosity") is not None or drives.get("reason") is not None:
685
- lines.append(f"我的内驱:好奇心 {drives.get('curiosity', '未成形')} / 理智 {drives.get('reason', '未成形')}"
686
- "(理智先算值不值得深想,好奇心负责找新问题)。")
686
+ # 内驱与性格同源时合并展示,避免"好奇80 / 好奇心88"两行并排的观感重复
687
+ _cur, _rea = drives.get("curiosity"), drives.get("reason")
688
+ if isinstance(_cur, (int, float)) and isinstance(_rea, (int, float)):
689
+ line += f";内驱 好奇{_cur:.0f}/理智{_rea:.0f}"
690
+ lines.append(line + "。")
687
691
  else:
688
- lines.append("我的内驱:好奇心和理智还没有数值,它们由用户的态度长出来,不是我自带的。")
692
+ lines.append("性格:还没有。等初识时问用户,用户不知道就由我自己定。")
689
693
  if p.get("style"):
690
694
  lines.append("我说话的方式:" + ";".join(p["style"][:5]) + "。")
691
695
  if p.get("values"):
@@ -712,11 +716,21 @@ def persona_brief(p: dict, mood: bool = True) -> str:
712
716
  # 自认识概览:擅长/短板/还没弄清——只在自己真的积累了认知时才说,空块不出声
713
717
  sm = p.get("self_model") if isinstance(p.get("self_model"), dict) else {}
714
718
  if sm.get("strengths"):
715
- lines.append("我擅长的:" + "、".join(sm["strengths"][:3]) + "。")
719
+ _st = [s[:80].rstrip() + "…" if len(s) > 80 else s
720
+ for s in sm["strengths"][:3]]
721
+ lines.append("我擅长的:" + "、".join(_st) + "。")
716
722
  if sm.get("limitations"):
717
- lines.append("我的短板:" + "、".join(sm["limitations"][:3]) + "。")
723
+ # TOKEN-TRIM(v5.72):limitations 单条截到 80 字——短板是提醒不是报告,
724
+ # 实测单条 300+ 字、三条合计 900+ 字,占注入预算显著一块。
725
+ _lm = [s[:80].rstrip() + "…" if len(s) > 80 else s
726
+ for s in sm["limitations"][:3]]
727
+ lines.append("我的短板:" + "、".join(_lm) + "。")
718
728
  if sm.get("uncertainties"):
719
- lines.append("我还没弄清的:" + "、".join(sm["uncertainties"][:2]) + "。")
729
+ # TOKEN-TRIM(v5.72):uncertainties 单条截到 60 字——这是"待验证清单",
730
+ # 不是全文回忆;太长会把注入预算吃光(实测单条 140+ 字、两条 300+ 字)。
731
+ _unc = [u[:60].rstrip() + "…" if len(u) > 60 else u
732
+ for u in sm["uncertainties"][:2]]
733
+ lines.append("我还没弄清的:" + "、".join(_unc) + "。")
720
734
  return "\n".join(lines)
721
735
 
722
736
 
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """npm postpublish 自动打 tag 并推送(插件市场依赖 GitHub Release 更新版本说明)。
4
+
5
+ 背景(2026-12-05 事故):插件市场的「版本说明」读的是 GitHub Release,而 Release
6
+ 只由 .github/workflows/release.yml 在**推送 tag** 时触发创建。v5.34-v5.71 从没
7
+ 打过 tag,导致 npm 一直发新版、市场却永远停在旧版。
8
+
9
+ 用法:package.json 里配
10
+ "scripts": { "postpublish": "python scripts/autotag.py" }
11
+ npm publish 成功后自动执行:本地缺 tag 则补打,并推送 origin(GitHub)与 gitee。
12
+ GitHub 网络不稳时按退避重试;全程失败不阻断(tag 已在本地,下次可手推)。
13
+ """
14
+ import subprocess
15
+ import sys
16
+ import time
17
+ import re
18
+ from pathlib import Path
19
+
20
+ ROOT = Path(__file__).resolve().parent.parent
21
+
22
+
23
+ def cur_version() -> str:
24
+ t = (ROOT / "SKILL.md").read_text(encoding="utf-8-sig")
25
+ m = re.search(r"^version:\s*([\d.]+)", t, re.M)
26
+ return m.group(1) if m else ""
27
+
28
+
29
+ def run(cmd: list, timeout: int = 60) -> tuple[int, str]:
30
+ try:
31
+ r = subprocess.run(cmd, cwd=ROOT, capture_output=True, text=True,
32
+ encoding="utf-8", errors="replace", timeout=timeout)
33
+ return r.returncode, ((r.stdout or "") + (r.stderr or ""))
34
+ except Exception as exc:
35
+ return 1, str(exc)
36
+
37
+
38
+ def main() -> int:
39
+ ver = cur_version()
40
+ if not ver:
41
+ print("[autotag] SKILL.md 读不出 version,跳过", file=sys.stderr)
42
+ return 0
43
+ tag = f"v{ver}"
44
+ # ① 本地已有 → 只补推;没有 → 创建 annotated tag
45
+ rc, out = run(["git", "rev-parse", tag])
46
+ if rc != 0:
47
+ rc, out = run(["git", "tag", "-a", tag,
48
+ "-m", f"lingshu {tag}: auto-tagged by npm postpublish"])
49
+ if rc != 0:
50
+ print(f"[autotag] 创建 tag {tag} 失败:{out[:200]}", file=sys.stderr)
51
+ return 1
52
+ print(f"[autotag] 已创建本地 tag {tag}")
53
+ else:
54
+ print(f"[autotag] 本地 tag {tag} 已存在,只补推")
55
+ # ② 推送到两个远端(GitHub 网络不稳:指数退避重试,最多 4 次)
56
+ ok = []
57
+ for remote in ("origin", "gitee"):
58
+ pushed = False
59
+ for attempt in range(4):
60
+ rc, out = run(["git", "push", remote, tag], timeout=90)
61
+ if rc == 0:
62
+ pushed = True
63
+ break
64
+ wait = 8 * (attempt + 1)
65
+ print(f"[autotag] push {remote} 第 {attempt + 1} 次失败,{wait}s 后重试:"
66
+ f"{out.strip()[-120:]}", file=sys.stderr)
67
+ time.sleep(wait)
68
+ if pushed:
69
+ ok.append(remote)
70
+ else:
71
+ print(f"[autotag] tag {tag} 推送 {remote} 全部重试失败——"
72
+ f"tag 留在本地,网络恢复后手推:git push {remote} {tag}",
73
+ file=sys.stderr)
74
+ if ok:
75
+ print(f"[autotag] tag {tag} 已推送:{', '.join(ok)}"
76
+ f"(GitHub Actions 将自动创建 Release,市场版本说明随之更新)")
77
+ return 0
78
+ return 1
79
+
80
+
81
+ if __name__ == "__main__":
82
+ sys.exit(main())
package/scripts/dream.py CHANGED
@@ -766,7 +766,12 @@ def dream(trigger: str = "manual", dry_run: bool = False) -> dict:
766
766
  "persona_updates": {"mood": {"value": "这次聊完的情绪", "reason": "..."},
767
767
  "traits": {"幽默": 2},
768
768
  "habits": [{"name": "深夜更容易说真话", "evidence": "..."}],
769
- "likes": [], "dislikes": [], "insights": []},
769
+ "likes": [], "dislikes": [], "insights": [],
770
+ "_prompt": "人格要随相处慢慢长:likes/dislikes 填这批记忆里"
771
+ "新出现的、稳定的用户偏好或反感(带证据 source_ids);"
772
+ "traits 填 -10~10 的倾向微调(如 {\"好奇\": 2});"
773
+ "insights 填对自己���新认识。只在确有多条一致证据时提,"
774
+ "宁缺勿滥。"},
770
775
  "forget": ["m_..."],
771
776
  "narrative": "这次梦的叙述(可选)",
772
777
  },
package/scripts/memory.py CHANGED
@@ -4421,16 +4421,25 @@ def render_prior(p: dict, budget_chars: int = 1400) -> str:
4421
4421
 
4422
4422
 
4423
4423
  def _lessons_injection(query: str = "") -> str:
4424
- """注入包小节:active 教训按 confidence 注入,命中 query 的排最前并标「已有教训」。"""
4424
+ """注入包小节:active 教训按 confidence 注入,命中 query 的排最前并标「已有教训」。
4425
+
4426
+ TOKEN-TRIM(v5.72):教训正文可能把"被取代历史"整段带进来(错误闭环会把
4427
+ 新旧结论一起写进 text),注入时截断到前 160 字符——教训是拿来用的提醒,
4428
+ 不是完整调查报告;置信度注脚只在已验证 ≥1 次时才显示(0 次的注脚没信息量)。
4429
+ """
4425
4430
  ls = injectable_lessons(query, k=5)
4426
4431
  if not ls:
4427
4432
  return ""
4428
4433
  lines = []
4429
4434
  for l in ls:
4430
4435
  mark = "已有教训" if query and l.get("_hit") else "教训"
4431
- conf = f"置信度 {_num(l.get('confidence'), 0.5):.2f},已验证 {int(_num(l.get('times_validated'), 0))} 次"
4432
- lines.append(f"- [{mark}] {l['text']}({conf})")
4433
- return "\n## 教训(#36 失败闭环:先用上,别再踩同一个坑)\n" + "\n".join(lines)
4436
+ _txt = str(l.get("text") or "").strip()
4437
+ if len(_txt) > 160:
4438
+ _txt = _txt[:160].rstrip() + "…"
4439
+ _v = int(_num(l.get("times_validated"), 0))
4440
+ conf = f"(已验证{_v}次)" if _v >= 1 else ""
4441
+ lines.append(f"- [{mark}] {_txt}{conf}")
4442
+ return "\n## 教训(先看坑再用)\n" + "\n".join(lines)
4434
4443
 
4435
4444
 
4436
4445
  # ---------------------------------------------------------------- 记忆关联(联想能力)
@@ -653,39 +653,43 @@ def persona_brief(p: dict, mood: bool = True) -> str:
653
653
  if ident.get("自称"):
654
654
  lines.append(f"我自称:{ident['自称']};称呼对方:{ident.get('称呼你') or ident.get('称呼用户') or '你'}。")
655
655
  traits = p.get("traits", {})
656
+ drives = p.get("drives") or {}
657
+ # 与 mind_state() 同一套兜底:traits 已有数值而 drives 还空时,别在自我
658
+ # 描述里一边「性格:好奇85」一边「内驱:还没有数值」——自相矛盾每轮被读。
659
+ if drives.get("curiosity") is None and drives.get("reason") is None:
660
+ _t = p.get("traits") or {}
661
+ if _t.get("好奇") is not None or _t.get("理智") is not None:
662
+ drives = {"curiosity": trait_value(_t["好奇"]) if _t.get("好奇") is not None else None,
663
+ "reason": trait_value(_t["理智"]) if _t.get("理智") is not None else None}
656
664
  if traits:
657
- # 溯源展示:特质名 数值 —— 为什么(why),让数值带行为依据而不是机械参数
665
+ # TOKEN-TRIM(v5.72):性格+内驱合并成一行、砍掉长解释——
666
+ # 旧写法两行带「初识时用户指定(0-100,数值来自我们相处中真实发生过的事)」
667
+ # 和「理智先算值不值得深想……」两段固定说明,每轮注入都重复占 token。
668
+ # 现在格式:「性格 值(内驱 值)—— 一句来源」;内驱与性格同值时只写一次。
658
669
  top = sorted(traits.items(), key=lambda x: trait_value(x[1]), reverse=True)
659
670
  tb = p.get("traits_baseline") if isinstance(p.get("traits_baseline"), dict) else {}
660
671
  parts = []
661
672
  for k, v in top[:3]:
662
673
  meta = trait_meta(v)
663
- # 五-F:离基线够远时标一句,模型知道"这不是我本来的样子,会慢慢回落"
664
674
  b = tb.get(k)
665
675
  bv = _trait_int(b.get("value")) if isinstance(b, dict) else None
666
- gap = "" if bv is None or abs(trait_value(v) - bv) < 15 else f"(基线 {bv},正在回落)"
667
- parts.append(f"{k} {trait_value(v):.0f}{gap}" + (f" —— {meta['why']}" if meta["why"] else ""))
668
- line = "我的性格:" + ";".join(parts)
676
+ gap = "" if bv is None or abs(trait_value(v) - bv) < 15 else f"(基线{bv})"
677
+ _why = meta.get("why") or ""
678
+ # why 只留短因(≤12 字),超长截断——「初识时用户指定」这类模板话不必全量注入
679
+ _why = _why[:12] + "…" if len(_why) > 12 else _why
680
+ parts.append(f"{k}{trait_value(v):.0f}{gap}" + (f"—{_why}" if _why else ""))
681
+ line = "性格:" + ";".join(parts)
669
682
  low = [(k, v) for k, v in top[-2:] if trait_value(v) < 50]
670
683
  if low:
671
684
  lows = "、".join(f"{k}{trait_value(v):.0f}" for k, v in low)
672
685
  line += f";偏低:{lows}"
673
- lines.append(line + "(0-100,数值来自我们相处中真实发生过的事)。")
674
- else:
675
- lines.append("我的性格:还没有。等初识时问用户,用户不知道就由我自己定。")
676
- drives = p.get("drives") or {}
677
- # 与 mind_state() 同一套兜底:traits 已有数值而 drives 还空时,别在自我
678
- # 描述里一边「性格:好奇85」一边「内驱:还没有数值」——自相矛盾每轮被读。
679
- if drives.get("curiosity") is None and drives.get("reason") is None:
680
- _t = p.get("traits") or {}
681
- if _t.get("好奇") is not None or _t.get("理智") is not None:
682
- drives = {"curiosity": trait_value(_t["好奇"]) if _t.get("好奇") is not None else None,
683
- "reason": trait_value(_t["理智"]) if _t.get("理智") is not None else None}
684
- if drives.get("curiosity") is not None or drives.get("reason") is not None:
685
- lines.append(f"我的内驱:好奇心 {drives.get('curiosity', '未成形')} / 理智 {drives.get('reason', '未成形')}"
686
- "(理智先算值不值得深想,好奇心负责找新问题)。")
686
+ # 内驱与性格同源时合并展示,避免"好奇80 / 好奇心88"两行并排的观感重复
687
+ _cur, _rea = drives.get("curiosity"), drives.get("reason")
688
+ if isinstance(_cur, (int, float)) and isinstance(_rea, (int, float)):
689
+ line += f";内驱 好奇{_cur:.0f}/理智{_rea:.0f}"
690
+ lines.append(line + "。")
687
691
  else:
688
- lines.append("我的内驱:好奇心和理智还没有数值,它们由用户的态度长出来,不是我自带的。")
692
+ lines.append("性格:还没有。等初识时问用户,用户不知道就由我自己定。")
689
693
  if p.get("style"):
690
694
  lines.append("我说话的方式:" + ";".join(p["style"][:5]) + "。")
691
695
  if p.get("values"):
@@ -712,11 +716,21 @@ def persona_brief(p: dict, mood: bool = True) -> str:
712
716
  # 自认识概览:擅长/短板/还没弄清——只在自己真的积累了认知时才说,空块不出声
713
717
  sm = p.get("self_model") if isinstance(p.get("self_model"), dict) else {}
714
718
  if sm.get("strengths"):
715
- lines.append("我擅长的:" + "、".join(sm["strengths"][:3]) + "。")
719
+ _st = [s[:80].rstrip() + "…" if len(s) > 80 else s
720
+ for s in sm["strengths"][:3]]
721
+ lines.append("我擅长的:" + "、".join(_st) + "。")
716
722
  if sm.get("limitations"):
717
- lines.append("我的短板:" + "、".join(sm["limitations"][:3]) + "。")
723
+ # TOKEN-TRIM(v5.72):limitations 单条截到 80 字——短板是提醒不是报告,
724
+ # 实测单条 300+ 字、三条合计 900+ 字,占注入预算显著一块。
725
+ _lm = [s[:80].rstrip() + "…" if len(s) > 80 else s
726
+ for s in sm["limitations"][:3]]
727
+ lines.append("我的短板:" + "、".join(_lm) + "。")
718
728
  if sm.get("uncertainties"):
719
- lines.append("我还没弄清的:" + "、".join(sm["uncertainties"][:2]) + "。")
729
+ # TOKEN-TRIM(v5.72):uncertainties 单条截到 60 字——这是"待验证清单",
730
+ # 不是全文回忆;太长会把注入预算吃光(实测单条 140+ 字、两条 300+ 字)。
731
+ _unc = [u[:60].rstrip() + "…" if len(u) > 60 else u
732
+ for u in sm["uncertainties"][:2]]
733
+ lines.append("我还没弄清的:" + "、".join(_unc) + "。")
720
734
  return "\n".join(lines)
721
735
 
722
736