lingshu-skill 5.61.0 → 5.63.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 (209) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +1 -1
  3. package/SKILL-lite.md +1 -1
  4. package/SKILL-tiny.md +1 -1
  5. package/SKILL.md +1 -1
  6. package/assets/panel.html +2 -2
  7. package/manifest.json +461 -0
  8. package/package.json +8 -2
  9. package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +11 -11
  10. package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +30 -0
  11. package/scripts/astrbot_plugin_lingshu/engine/README.md +1 -1
  12. package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +1 -1
  13. package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +1 -1
  14. package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +1 -1
  15. package/scripts/astrbot_plugin_lingshu/engine/assets/panel.html +2 -2
  16. package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +3 -4
  17. package/scripts/astrbot_plugin_lingshu/engine/scripts/make_dsh_tgz.py +20 -3
  18. package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_build.py +13 -0
  19. package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +30 -10
  20. package/scripts/astrbot_plugin_lingshu/engine/scripts/panels.py +1 -0
  21. package/scripts/growth.py +3 -4
  22. package/scripts/make_dsh_tgz.py +20 -3
  23. package/scripts/make_manifest.py +15 -10
  24. package/scripts/make_plugin_zip.py +7 -3
  25. package/scripts/panel_build.py +13 -0
  26. package/scripts/panel_server.py +30 -10
  27. package/scripts/panels.py +1 -0
  28. package/scripts/_ci_env_probe.py +0 -81
  29. package/scripts/_panel_smoke_v299.py +0 -27
  30. package/scripts/_scratch/_tmp_backup_race.py +0 -70
  31. package/scripts/_scratch/_tmp_cleanup_move.py +0 -34
  32. package/scripts/_scratch/_tmp_count_kinds.py +0 -25
  33. package/scripts/_scratch/_tmp_diag_paths.py +0 -48
  34. package/scripts/_scratch/_tmp_facts.py +0 -63
  35. package/scripts/_scratch/_tmp_find_copies.py +0 -31
  36. package/scripts/_scratch/_tmp_find_pin.py +0 -29
  37. package/scripts/_scratch/_tmp_fix_pin.py +0 -36
  38. package/scripts/_scratch/_tmp_fold_fixture.py +0 -55
  39. package/scripts/_scratch/_tmp_fold_test.mjs +0 -81
  40. package/scripts/_scratch/_tmp_inject_secs.py +0 -30
  41. package/scripts/_scratch/_tmp_kb_balance.py +0 -159
  42. package/scripts/_scratch/_tmp_lines.py +0 -15
  43. package/scripts/_scratch/_tmp_market_probe.py +0 -13
  44. package/scripts/_scratch/_tmp_move_partial.py +0 -16
  45. package/scripts/_scratch/_tmp_patch_b3.py +0 -41
  46. package/scripts/_scratch/_tmp_patch_b5.py +0 -62
  47. package/scripts/_scratch/_tmp_patch_crash_excl.py +0 -24
  48. package/scripts/_scratch/_tmp_patch_handoff.py +0 -21
  49. package/scripts/_scratch/_tmp_patch_ps1.py +0 -25
  50. package/scripts/_scratch/_tmp_patch_stat.py +0 -27
  51. package/scripts/_scratch/_tmp_patch_todo.py +0 -25
  52. package/scripts/_scratch/_tmp_patch_todo2.py +0 -64
  53. package/scripts/_scratch/_tmp_probe_session.py +0 -51
  54. package/scripts/_scratch/_tmp_style_probe.py +0 -40
  55. package/scripts/_scratch/_tmp_write_note.py +0 -139
  56. package/scripts/_scratch/_/346/235/245/346/272/220/350/256/260/345/275/225.txt +0 -1
  57. package/scripts/_scratch/asar_compaction/dsh-compaction-basic__lib__index.js +0 -1044
  58. package/scripts/_scratch/asar_compaction/dsh-compaction-tool-result-pruner__lib__index.js +0 -194
  59. package/scripts/_scratch/asar_compaction/dsh-compaction__lib__index.js +0 -175
  60. package/scripts/_scratch/asar_compaction/dsh-compaction__lib__types__tool-pairing.js +0 -97
  61. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__image-offload.js +0 -47
  62. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__index.js +0 -40
  63. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__project-message.js +0 -37
  64. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__brand.js +0 -9
  65. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__checkpoint.js +0 -36
  66. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__types.js +0 -10
  67. package/scripts/_scratch/commit_msg_occ.txt +0 -16
  68. package/scripts/_scratch/commit_msg_struct.txt +0 -16
  69. package/scripts/_scratch/v5.34_changelog.txt +0 -36
  70. package/scripts/_smoke_v299.py +0 -31
  71. package/scripts/_sync_trae_cn.py +0 -102
  72. package/scripts/_tmp_add_s10.py +0 -54
  73. package/scripts/_tmp_add_s11.py +0 -61
  74. package/scripts/_tmp_add_s12.py +0 -66
  75. package/scripts/_tmp_add_s13.py +0 -69
  76. package/scripts/_tmp_add_s14.py +0 -80
  77. package/scripts/_tmp_add_s9.py +0 -68
  78. package/scripts/_tmp_cache_load.py +0 -82
  79. package/scripts/_tmp_clean_market.py +0 -40
  80. package/scripts/_tmp_clean_pruned.py +0 -81
  81. package/scripts/_tmp_cleanup_docs.py +0 -39
  82. package/scripts/_tmp_cmp_ranker.py +0 -17
  83. package/scripts/_tmp_dolater_note.py +0 -35
  84. package/scripts/_tmp_dust_why.py +0 -27
  85. package/scripts/_tmp_explicit_import.py +0 -40
  86. package/scripts/_tmp_extract_compaction.py +0 -35
  87. package/scripts/_tmp_extract_compaction2.py +0 -63
  88. package/scripts/_tmp_extract_compaction3.py +0 -51
  89. package/scripts/_tmp_extract_compaction4.py +0 -54
  90. package/scripts/_tmp_finalize_s14.py +0 -39
  91. package/scripts/_tmp_find_compaction.py +0 -43
  92. package/scripts/_tmp_fix_b4.py +0 -22
  93. package/scripts/_tmp_fix_cli76.py +0 -26
  94. package/scripts/_tmp_fix_docs.py +0 -38
  95. package/scripts/_tmp_fix_docs_b.py +0 -46
  96. package/scripts/_tmp_fix_docs_b2.py +0 -22
  97. package/scripts/_tmp_fix_i3.py +0 -23
  98. package/scripts/_tmp_fix_s10.py +0 -83
  99. package/scripts/_tmp_fix_s11.py +0 -14
  100. package/scripts/_tmp_fix_s9_status.py +0 -19
  101. package/scripts/_tmp_fix_shadow_sim.py +0 -37
  102. package/scripts/_tmp_fix_traits_value.py +0 -41
  103. package/scripts/_tmp_import_idem.py +0 -106
  104. package/scripts/_tmp_log_ack.py +0 -45
  105. package/scripts/_tmp_mark_batch.py +0 -28
  106. package/scripts/_tmp_mark_batch2.py +0 -32
  107. package/scripts/_tmp_mark_dolater.py +0 -26
  108. package/scripts/_tmp_mark_dolater2.py +0 -31
  109. package/scripts/_tmp_move_self.py +0 -16
  110. package/scripts/_tmp_occ_cli.py +0 -22
  111. package/scripts/_tmp_occ_link.py +0 -108
  112. package/scripts/_tmp_optimize_recall.py +0 -54
  113. package/scripts/_tmp_panel_audit.py +0 -26
  114. package/scripts/_tmp_patch_batch3.py +0 -65
  115. package/scripts/_tmp_patch_rrf.py +0 -46
  116. package/scripts/_tmp_patch_s2s3.py +0 -80
  117. package/scripts/_tmp_patch_s4.py +0 -39
  118. package/scripts/_tmp_patch_s7.py +0 -43
  119. package/scripts/_tmp_patch_s8.py +0 -91
  120. package/scripts/_tmp_patch_skill.py +0 -17
  121. package/scripts/_tmp_release_guard.py +0 -57
  122. package/scripts/_tmp_rerank_breaker.py +0 -62
  123. package/scripts/_tmp_s16.py +0 -41
  124. package/scripts/_tmp_scan_asar.py +0 -41
  125. package/scripts/_tmp_scan_asar2.py +0 -37
  126. package/scripts/_tmp_speed_survey.py +0 -49
  127. package/scripts/_tmp_struct_docs.py +0 -49
  128. package/scripts/_tmp_sum_fallback.py +0 -42
  129. package/scripts/_tmp_sweep.py +0 -81
  130. package/scripts/_tmp_sync_check.py +0 -69
  131. package/scripts/_tmp_sync_tail.py +0 -39
  132. package/scripts/_tmp_todo_clean.py +0 -67
  133. package/scripts/_tmp_verify_copy.py +0 -17
  134. package/scripts/_tmp_wire_extras.py +0 -93
  135. package/scripts/_tmp_wire_hsum.py +0 -34
  136. package/scripts/_tmp_wire_occ_b5.py +0 -40
  137. package/scripts/_tmp_wire_ranker.py +0 -13
  138. package/scripts/_tmp_wire_shadow_timeline.py +0 -45
  139. package/scripts/astrbot_plugin_lingshu/engine/scripts/_ci_env_probe.py +0 -81
  140. package/scripts/astrbot_plugin_lingshu/engine/scripts/_panel_smoke_v299.py +0 -27
  141. package/scripts/astrbot_plugin_lingshu/engine/scripts/_smoke_v299.py +0 -31
  142. package/scripts/astrbot_plugin_lingshu/engine/scripts/_sync_trae_cn.py +0 -102
  143. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s10.py +0 -54
  144. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s11.py +0 -61
  145. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s12.py +0 -66
  146. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s13.py +0 -69
  147. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s14.py +0 -80
  148. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s9.py +0 -68
  149. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cache_load.py +0 -82
  150. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_market.py +0 -40
  151. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_pruned.py +0 -81
  152. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cleanup_docs.py +0 -39
  153. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cmp_ranker.py +0 -17
  154. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dolater_note.py +0 -35
  155. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dust_why.py +0 -27
  156. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_explicit_import.py +0 -40
  157. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction.py +0 -35
  158. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction2.py +0 -63
  159. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction3.py +0 -51
  160. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction4.py +0 -54
  161. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_finalize_s14.py +0 -39
  162. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_find_compaction.py +0 -43
  163. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_b4.py +0 -22
  164. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_cli76.py +0 -26
  165. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs.py +0 -38
  166. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b.py +0 -46
  167. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b2.py +0 -22
  168. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_i3.py +0 -23
  169. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s10.py +0 -83
  170. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s11.py +0 -14
  171. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s9_status.py +0 -19
  172. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_shadow_sim.py +0 -37
  173. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_traits_value.py +0 -41
  174. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_import_idem.py +0 -106
  175. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_log_ack.py +0 -45
  176. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch.py +0 -28
  177. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch2.py +0 -32
  178. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater.py +0 -26
  179. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater2.py +0 -31
  180. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_move_self.py +0 -16
  181. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_cli.py +0 -22
  182. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_link.py +0 -108
  183. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_optimize_recall.py +0 -54
  184. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_panel_audit.py +0 -26
  185. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_batch3.py +0 -65
  186. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_rrf.py +0 -46
  187. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s2s3.py +0 -80
  188. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s4.py +0 -39
  189. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s7.py +0 -43
  190. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s8.py +0 -91
  191. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_skill.py +0 -17
  192. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_release_guard.py +0 -57
  193. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_rerank_breaker.py +0 -62
  194. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_s16.py +0 -41
  195. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar.py +0 -41
  196. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar2.py +0 -37
  197. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_speed_survey.py +0 -49
  198. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_struct_docs.py +0 -49
  199. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sum_fallback.py +0 -42
  200. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sweep.py +0 -81
  201. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_check.py +0 -69
  202. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_tail.py +0 -39
  203. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_todo_clean.py +0 -67
  204. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_verify_copy.py +0 -17
  205. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_extras.py +0 -93
  206. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_hsum.py +0 -34
  207. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_occ_b5.py +0 -40
  208. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_ranker.py +0 -13
  209. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_shadow_timeline.py +0 -45
@@ -1,49 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:更新结构性两项状态(可删)。"""
3
- import re
4
- from pathlib import Path
5
-
6
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
7
- d = p.read_text(encoding="utf-8")
8
-
9
- d = d.replace(
10
- "| 拆分 `scripts/` 与 `engine/scripts/` 双份维护 | ⬜ 未做(改动量最大,需单独立项;当前靠 `sync_engine.py` + doctor `engine-sync` 兜着) |",
11
- "| 拆分 `scripts/` 与 `engine/scripts/` 双份维护 | ✅ **已按方案 B(流程固化)完成**(2026-11-30):\n"
12
- "① `run_tests.py` 跑测前幂等同步;② `_sync_trae_cn.py` 加 `--check`(只读校验已安装副本);\n"
13
- "③ `release.py publish` 加**发布前置守卫**(两份副本任一过期就中止发布——发布物过期是最隐蔽的事故);\n"
14
- "④ doctor `engine-sync` 已是 FAIL 级。**真拆(符号链接/构建时拷)不做**:`engine/` 本就是发布产物且被 gitignore,\n"
15
- "风险在'忘记同步'而非'合并冲突',流程固化已根治 |")
16
- d = d.replace(
17
- "| 三个 4500 行模块继续拆(growth/cli/memory) | ⬜ 未做(同上,属结构性重构,不适合夹在功能里做) |",
18
- "| 三个 4500 行模块继续拆(growth/cli/memory) | 🟡 **第一步已完成**(2026-11-30):`memory.py` 的\n"
19
- "`from mem_score import *` 换成**按 `__all__` 显式导入**(13 个名字,含 `_num`/`_cosine_sim` 等私有名),\n"
20
- "调用面契约(同一对象、`from memory import *` 可用)由测试锁住。剩余:cli 按命令组拆包、\n"
21
- "memory 按 store/recall/archive 分文件、growth 最后动 |")
22
-
23
- SEC = """
24
- ### 结构性两项落地记录(2026-11-30,用户要求"弄3")
25
-
26
- **① 双份维护 → 按方案 B 完成(流程固化,不真拆)**
27
-
28
- | 环节 | 做法 |
29
- |---|---|
30
- | 跑测 | `run_tests.py` 开头幂等跑 `sync_engine.py`(漏同步不再把测试弄红) |
31
- | 校验 | `sync_engine.py --check` 与 `_sync_trae_cn.py --check` 都可只读判漂移 |
32
- | 发布 | `release.py publish` 前置守卫:engine 副本 + 已安装副本任一不一致 → **中止发布** |
33
- | 体检 | doctor `engine-sync` 已是 FAIL 级 |
34
-
35
- 守卫上线即抓到一次真漂移(`release.py` 自己没同步)——说明它不是摆设。
36
-
37
- **② 三模块拆分 → 只做第一步**
38
-
39
- `memory.py` 末尾的 `from mem_score import *` 改成按 `__all__` 显式导入。契约(同一对象、
40
- `from memory import *` 仍可用、不留同名空壳)由 `test_memory_surface_reexport_contract` 锁住;
41
- 该测试原先断言"必须保留星号",已改为断言"显式导入存在且星号已消失"——**契约本意是调用面不变,不是实现方式不变**。
42
-
43
- 其余(cli 拆包、memory 分 store/recall/archive、growth 最后动)仍按 `docs/重构方案-20261130.md` 排期。
44
- """
45
-
46
- if "### 结构性两项落地记录" not in d:
47
- d = d.rstrip() + "\n\n" + SEC
48
- p.write_text(d, encoding="utf-8")
49
- print("文档已更新")
@@ -1,42 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:离线摘要的兜底补段(降低'未提取到'比例)(可删)。"""
3
- from pathlib import Path
4
-
5
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\summarizer.py")
6
- d = p.read_text(encoding="utf-8")
7
-
8
- old = """ quotes = pick([u for u in users if _QUOTE.search(u)], 80)[-3:]
9
- """
10
- new = """ quotes = pick([u for u in users if _QUOTE.search(u)], 80)[-3:]
11
-
12
- # 兜底补段(v5.34 残余风险):离线抽取只认明确信号,实测"未决/约束/原话"经常空着。
13
- # 空着比缺信息更糟——读摘要的人会以为"这轮确实没有未决"。这里用保守规则兜一层:
14
- # 只把**已经存在的内容**换个角度呈现,不编造。
15
- if not pending:
16
- _rest_u = [u for u in users if _clip(u, 120) not in used]
17
- if _rest_u:
18
- pending = [f"- 待确认:{_clip(_rest_u[-1], 120)}"]
19
- if not constraints:
20
- _cue = re.compile(r"不要|必须|只能|务必|别|预算|期限|deadline|时间只|最多|最少", re.I)
21
- _c = [x for x in (users + bots) if _cue.search(x) and _clip(x, 120) not in used]
22
- if _c:
23
- constraints = [f"- {_clip(_c[-1], 120)}"]
24
- if not quotes:
25
- _rest_q = [u for u in users if _clip(u, 80) not in used]
26
- if _rest_q:
27
- quotes = [f"- 「{_clip(_rest_q[-1], 80)}」"]
28
- """
29
- assert old in d
30
- d = d.replace(old, new, 1)
31
-
32
- # 空段文案更诚实:不是"未提取到",而是"这轮没有"
33
- d = d.replace('block("已做", done, "- (未提取到)")',
34
- 'block("已做", done, "- (本轮没有助手产出)")')
35
- d = d.replace('block("未决", pending, "- (未提取到)")',
36
- 'block("未决", pending, "- (本轮没有明显未决)")')
37
- d = d.replace('block("约束", constraints, "- (未提取到)")',
38
- 'block("约束", constraints, "- (本轮没有明显约束)")')
39
- d = d.replace('block("原话引用", quotes, "- (未提取到)")',
40
- 'block("原话引用", quotes, "- (本轮没有引号原话)")')
41
- p.write_text(d, encoding="utf-8")
42
- print("兜底补段已加")
@@ -1,81 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:自检扫描——把当前可发现的问题都列出来(可删)。"""
3
- import glob
4
- import json
5
- import os
6
- import sys
7
- import time
8
-
9
- sys.path.insert(0, r"E:\丁厚同\文档\程序\灵枢-skill\scripts")
10
- import brain
11
- import core
12
-
13
- NOW = time.time()
14
- issues = []
15
-
16
-
17
- def add(cat, sev, text):
18
- issues.append((cat, sev, text))
19
-
20
-
21
- # 1) 心跳
22
- p = Path(core.HOME) / ".host-heartbeat.json"
23
- if p.is_file():
24
- try:
25
- ts = float((brain._num(json.loads(p.read_text(encoding="utf-8")).get("ts"), 0)))
26
- age = (NOW - ts) / 60
27
- if age > 10:
28
- add("心跳", "warn", f"心跳 {age:.0f} 分钟未更新(#55 诊断中)")
29
- except Exception as e:
30
- add("心跳", "warn", f"心跳文件不可解析:{e}")
31
-
32
- # 2) 最近日志的 error/warn(按 kind 聚类)
33
- LOG = Path(core.HOME) / "lingshu.log"
34
- if LOG.is_file():
35
- from collections import Counter
36
- cut = NOW - 7 * 86400
37
- c = Counter()
38
- for ln in LOG.read_text(encoding="utf-8", errors="replace").splitlines():
39
- ln = ln.strip()
40
- if not ln:
41
- continue
42
- try:
43
- o = json.loads(ln)
44
- except Exception:
45
- continue
46
- if o.get("kind") == "inject":
47
- continue
48
- ts = float(o.get("ts") or 0)
49
- if ts < cut:
50
- continue
51
- if str(o.get("level", "")).lower() in ("error", "warn"):
52
- c[(o.get("kind"), str(o.get("msg"))[:60])] += 1
53
- for (kind, msg), n in c.most_common(6):
54
- sev = "warn" if kind == "cron-task" else "info"
55
- add("日志", sev, f"{n}x [{kind}] {msg}")
56
-
57
- # 3) 只读环境下的写入口 / 磁盘
58
- p2 = Path(core.HOME) / ".safety" / ".pruned"
59
- if p2.is_dir():
60
- files = [f for f in p2.rglob("*") if f.is_file()]
61
- if files:
62
- sz = sum(f.stat().st_size for f in files) / 1024 / 1024
63
- if sz > 30:
64
- add("磁盘", "warn", f"快照 .pruned 又积累 {sz:.1f}MB/{len(files)} 文件(上轮清过)")
65
-
66
- # 4) 未做的人为检查(pending review)
67
- try:
68
- rows = [m for m in brain.load_all() if m.get("review") == "pending"]
69
- if rows:
70
- add("审核", "warn", f"待审核记忆 {len(rows)} 条未裁决")
71
- except Exception:
72
- pass
73
-
74
- # 5) 汇总
75
- cur_cat = None
76
- for cat, sev, text in issues:
77
- if cat != cur_cat:
78
- print(f"\n== {cat} ==")
79
- cur_cat = cat
80
- print(f" [{sev}] {text}")
81
- print(f"\n共发现 {len(issues)} 条")
@@ -1,69 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:给 _sync_trae_cn 加 --check(只校验副本是否落后,不写文件)(可删)。"""
3
- from pathlib import Path
4
-
5
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\_sync_trae_cn.py")
6
- d = p.read_text(encoding="utf-8")
7
-
8
- # 1) 顶部加 argparse
9
- old_imp = "import json\nimport os\nimport shutil\nimport sys\nfrom pathlib import Path"
10
- new_imp = "import argparse\nimport json\nimport os\nimport shutil\nimport sys\nfrom pathlib import Path"
11
- if "import argparse" not in d:
12
- d = d.replace(old_imp, new_imp, 1)
13
- print("argparse 已加")
14
-
15
- # 2) 主循环里区分 check / 同步
16
- old_loop = "for dst in targets:\n ok = miss = same = 0"
17
- new_loop = '''_ap = argparse.ArgumentParser(description="把源码交付物同步到已安装副本(--check 只校验)")
18
- _ap.add_argument("--check", action="store_true", help="只报告副本是否落后,不写文件")
19
- _args = _ap.parse_args()
20
- _check_only = bool(_args.check)
21
- _drift: list = []
22
-
23
- for dst in targets:
24
- ok = miss = same = 0'''
25
- if "_check_only" not in d:
26
- d = d.replace(old_loop, new_loop, 1)
27
- print("参数已加")
28
-
29
- # 3) check 模式下不写,改记 drift
30
- old_write = """ try:
31
- _new = s.read_bytes()
32
- if d.is_file() and d.read_bytes() == _new:
33
- same += 1
34
- continue
35
- _tmp = d.with_name(d.name + ".syncing")
36
- _tmp.write_bytes(_new)
37
- os.replace(_tmp, d) # 同卷 rename,原子
38
- ok += 1"""
39
- new_write = """ try:
40
- _new = s.read_bytes()
41
- if d.is_file() and d.read_bytes() == _new:
42
- same += 1
43
- continue
44
- if _check_only:
45
- _drift.append(f"{dst.name}:{rel}")
46
- ok += 1
47
- continue
48
- _tmp = d.with_name(d.name + ".syncing")
49
- _tmp.write_bytes(_new)
50
- os.replace(_tmp, d) # 同卷 rename,原子
51
- ok += 1"""
52
- if "_drift.append" not in d:
53
- d = d.replace(old_write, new_write, 1)
54
- print("check 分支已加")
55
-
56
- # 4) 结尾汇总 + 退出码
57
- d = d.rstrip() + '''
58
-
59
- if _check_only:
60
- if _drift:
61
- print(f"[check] 副本落后 {len(_drift)} 个文件:", file=sys.stderr)
62
- for x in _drift[:15]:
63
- print(f" - {x}", file=sys.stderr)
64
- print("跑 python scripts/_sync_trae_cn.py 修复。", file=sys.stderr)
65
- sys.exit(1)
66
- print("[check] OK:已安装副本与源码一致")
67
- '''
68
- p.write_text(d, encoding="utf-8")
69
- print("退出码已加")
@@ -1,39 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:修 _sync_trae_cn 尾部顺序(check 块被 sys.exit 短路)(可删)。"""
3
- from pathlib import Path
4
-
5
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\_sync_trae_cn.py")
6
- d = p.read_text(encoding="utf-8")
7
-
8
- # 删掉文件末尾那段死代码
9
- dead = '''
10
- if _check_only:
11
- if _drift:
12
- print(f"[check] 副本落后 {len(_drift)} 个文件:", file=sys.stderr)
13
- for x in _drift[:15]:
14
- print(f" - {x}", file=sys.stderr)
15
- print("跑 python scripts/_sync_trae_cn.py 修复。", file=sys.stderr)
16
- sys.exit(1)
17
- print("[check] OK:已安装副本与源码一致")
18
- '''
19
- if dead in d:
20
- d = d.replace(dead, "\n")
21
- print("死代码已删")
22
-
23
- # 在自检的 sys.exit 之前插入 check 汇总,并让退出码合并
24
- old_exit = "sys.exit(1 if bad else 0)"
25
- new_exit = '''# --check 汇总(必须在 sys.exit 之前,否则永远是死代码——踩过)
26
- if _check_only:
27
- if _drift:
28
- print(f"[check] 副本落后 {len(_drift)} 个文件:", file=sys.stderr)
29
- for x in _drift[:15]:
30
- print(f" - {x}", file=sys.stderr)
31
- print("跑 python scripts/_sync_trae_cn.py 修复。", file=sys.stderr)
32
- else:
33
- print("[check] OK:已安装副本与源码一致")
34
-
35
- sys.exit(1 if (bad or (_check_only and _drift)) else 0)'''
36
- if old_exit in d:
37
- d = d.replace(old_exit, new_exit, 1)
38
- print("退出码已合并")
39
- p.write_text(d, encoding="utf-8")
@@ -1,67 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:清过期标记 + 记 OCC 联动与摘要兜底(可删)。"""
3
- import re
4
- from pathlib import Path
5
-
6
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
7
- d = p.read_text(encoding="utf-8")
8
-
9
- # 1) 过期标记:RSS / BM25 早已完成
10
- d = d.replace('- **P2-1 RSS 摄入**(20h)未做。建议收窄为"本地 RSS/Atom 文件或显式 URL 列表 + 默认关闭"。',
11
- '- ~~**P2-1 RSS 摄入**(20h)未做~~ → ✅ **已完成**(窄口径:本地 feed / URL 列表,'
12
- '`brain.py rss ingest`,见 commit e71e88c)')
13
- d = d.replace("| P2-1 RSS 摄入 | ⬜ 未做(20h;建议按\"本地 RSS/Atom 文件或显式 URL 列表 + 默认关闭\"收窄后再立项) |",
14
- "| P2-1 RSS 摄入 | ✅ **已完成**(窄口径):`rss ingest --file/--url-list`,零依赖、按 link 去重、不内置定时抓取 |")
15
- d = d.replace("- **#3 BM25 未做**:它改的是 relevance(占五元权重 0.55 的最大项),必须先用",
16
- "- ~~**#3 BM25 未做**~~ → ✅ **已完成**(`TermSet` + `bm25(k1=1.2,b=0.75)`,bench 无回退)。"
17
- "原注:它改的是 relevance(五元权重最大项),必须先用")
18
-
19
- # 2) 残余风险:已兜底
20
- d = d.replace("- ⬜ **残余风险(没去掉)**:离线抽取式只挑明确信号,`未决/约束/原话引用`经常空着;",
21
- "- ✅ **残余风险已缓解(2026-11-30)**:`extractive_fallback` 加兜底补段——"
22
- "未决用最后一条用户消息、原话引用最近一句、约束再扫一遍线索词;"
23
- "空段文案改为**诚实表述**(\"本轮没有明显约束\"),不再统一写\"未提取到\"。原风险描述:"
24
- "离线抽取式只挑明确信号,`未决/约束/原话引用`经常空着;")
25
-
26
- # 3) 状态统计刷新
27
- def recount(text):
28
- done = len(re.findall(r"^\|\s*[A-Z]?\d+\s*\|.*✅", text, re.M))
29
- todo = len(re.findall(r"^\|\s*[A-Z]?\d+\s*\|.*⬜", text, re.M))
30
- excl = len(re.findall(r"^\|\s*[A-Z]?\d+\s*\|.*🔍", text, re.M))
31
- return done, todo, excl
32
-
33
- done, todo, excl = recount(d)
34
- d = re.sub(r"> \*\*状态统计(编号任务行)\*\*[^\n]*",
35
- f"> **状态统计(编号任务行)**:✅ {done} 已修 / ⬜ {todo} 待修 / 🔍 {excl} 已排除(含 §7/§8)",
36
- d, count=1)
37
-
38
- SEC = """
39
- ### OCC × 七情六欲 联动(2026-11-30)
40
-
41
- 用户要求:OCC 情绪要联动灵枢的七情六欲。已落:
42
-
43
- | OCC | 七情 | 具体情绪 | 六欲联动 |
44
- |---|---|---|---|
45
- | 失望 | 哀 | 失落 | 成就欲 −8、连接欲 −2 |
46
- | 释然 | 静 | 平静 | 安全欲 +10 |
47
- | 满意 | 喜 | 满足 | 成就欲 +10 |
48
- | 感激 | 爱 | 感动 | 连接欲 +12 |
49
- | 愤怒 | 怒 | 生气 | 连接欲 −6、掌控欲 −3 |
50
- | 焦虑 | 惧 | 焦虑 | 安全欲 −10 |
51
-
52
- - `brain.py occ apply "<话>"`:识别 OCC → `emotion_evaluate(polarity, why="OCC:…")` → `desire_nudge(...)`;
53
- `--dry-run` 只看不改;识别不出时**不动任何状态**(不瞎记情绪)。
54
- - 注意:`静` 组只有 平静/疲惫/无聊,没有"安心"——映射已改 平静(映射到不存在的情绪会被拒)。
55
-
56
- ### 待办扫描结论(2026-11-30)
57
-
58
- - 过期标记已清:RSS(早已完成)、BM25(早已完成)、摘要残余风险(本轮兜底)。
59
- - **仍然没做的只有 3 项**:① 拆分 `scripts/`↔`engine/scripts/` 双份维护;② growth/cli/memory 三模块拆分;
60
- ③ #54 第二步(写 lingshu compaction provider)。三项都是**结构性/需专门时间**,方案在
61
- `docs/重构方案-20261130.md` 与 §13。
62
- """
63
-
64
- if "### OCC × 七情六欲 联动" not in d:
65
- d = d.rstrip() + "\n\n" + SEC
66
- p.write_text(d, encoding="utf-8")
67
- print("文档已清理并追加联动记录")
@@ -1,17 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:用 glob 找到副本并跑 startup(可删)。"""
3
- import glob
4
- import os
5
- import subprocess
6
- import sys
7
-
8
- py = r"D:\ServBay\packages\python\current\python.exe"
9
- hits = glob.glob(os.path.expanduser("~") + r"\.*\profiles\desktop\node_modules\lingshu-skill\scripts\brain.py")
10
- print("副本:", hits)
11
- if hits:
12
- r = subprocess.run([py, hits[0], "startup"], capture_output=True, text=True,
13
- encoding="utf-8", errors="replace", timeout=60)
14
- print("exit =", r.returncode, "| 输出字符 =", len(r.stdout))
15
- print("首行:", (r.stdout or "").splitlines()[0] if r.stdout else "(无)")
16
- if r.stderr.strip():
17
- print("stderr:", r.stderr.strip()[:200])
@@ -1,93 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:接 abstract/seed/loops 三个命令 + #48 亲和度漂移(flag 门控)(可删)。"""
3
- from pathlib import Path
4
-
5
- cli = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\cli.py")
6
- d = cli.read_text(encoding="utf-8")
7
-
8
- anchor = " # #49 影子记忆:写下记忆时的\"人格底色\",用于检测人格断裂风险(只提醒不阻止)"
9
- block = ''' # #43 abstract:给记忆补模型级摘要(没配模型就不补,不造假)
10
- p_abs = sub.add_parser("abstract", help="给记忆补一行模型摘要(检索/展示优先用它)")
11
- _ab = p_abs.add_subparsers(dest="abstract_action", parser_class=_BrainParser)
12
- _ab_s = _ab.add_parser("stamp-recent", help="给最近 N 天没有摘要的记忆补(需要 config summary)")
13
- _ab_s.add_argument("--limit", type=int, default=30)
14
- _ab_s.add_argument("--days", type=int, default=7)
15
- _ab_s.add_argument("--dry-run", action="store_true")
16
-
17
- # #52 代际种子:把当前人格底色固化一代(不参与日常检索)
18
- p_seed = sub.add_parser("seed", help="代际种子:固化一代人格底色作为演化压力")
19
- _sd = p_seed.add_subparsers(dest="seed_action", parser_class=_BrainParser)
20
- _sd_m = _sd.add_parser("make", help="拍一代种子")
21
- _sd_m.add_argument("--label", default="")
22
- _sd_l = _sd.add_parser("list", help="列出现有种子")
23
- _sd_l.add_argument("--limit", type=int, default=20)
24
-
25
- # #53 时序褶皱:给"同一思维循环"的记忆连边
26
- p_loop = sub.add_parser("loops", help="时序褶皱:把同一思维循环的记忆连成演化线")
27
- _lp = p_loop.add_subparsers(dest="loops_action", parser_class=_BrainParser)
28
- _lp_b = _lp.add_parser("build", help="扫描并连边(mistake/insight/gap)")
29
- _lp_b.add_argument("--min-overlap", type=int, default=4)
30
- _lp_b.add_argument("--limit", type=int, default=60)
31
-
32
- '''
33
- if "p_abs = sub.add_parser" not in d:
34
- d = d.replace(anchor, block + anchor, 1)
35
- print("解析器已加")
36
-
37
- disp_anchor = ' if args.cmd == "shadow":'
38
- disp = ''' if args.cmd == "abstract":
39
- import memory_extras
40
- return memory_extras.run_abstract(args)
41
-
42
- if args.cmd == "seed":
43
- import memory_extras
44
- return memory_extras.run_seed(args)
45
-
46
- if args.cmd == "loops":
47
- import memory_extras
48
- return memory_extras.run_loops(args)
49
-
50
- '''
51
- if 'args.cmd == "abstract"' not in d:
52
- d = d.replace(disp_anchor, disp + disp_anchor, 1)
53
- print("分派已加")
54
-
55
- cli.write_text(d, encoding="utf-8")
56
-
57
- # ---------------- #48 亲和度漂移(flag 门控,默认关) ----------------
58
- mem = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\memory.py")
59
- m = mem.read_text(encoding="utf-8")
60
-
61
- old = """ for m in records:
62
- rel = relevance(q_terms, all_terms[m["id"]], idf, _avgdl) if q_terms else 0.0"""
63
- new = """ # §2 do-later #48(亲和度漂移,opt-in):人格变了,检索排序自然跟着变。
64
- # 近似做法:记忆的 tags/entities 命中当前人格 traits 越多的,给一点亲和加成。
65
- # 默认关闭——它改的是召回秩序,属调优项(和 RRF/MMR 同一理由)。
66
- _aff_on = bool(cfg.get("affinity_drift"))
67
- _ptraits = set()
68
- if _aff_on:
69
- try:
70
- _ptraits = {str(k) for k in ((load_persona() or {}).get("traits") or {})}
71
- except Exception:
72
- _ptraits = set()
73
-
74
- for m in records:
75
- rel = relevance(q_terms, all_terms[m["id"]], idf, _avgdl) if q_terms else 0.0"""
76
- if old in m:
77
- m = m.replace(old, new, 1)
78
- print("亲和度:插桩已加")
79
-
80
- old2 = """ score = w["relevance"] * rel + w["recency"] * rec + w["importance"] * imp"""
81
- new2 = """ score = w["relevance"] * rel + w["recency"] * rec + w["importance"] * imp
82
- if _aff_on and _ptraits:
83
- try:
84
- _hit = {str(t) for t in (m.get("tags") or [])} | {str(e) for e in (m.get("entities") or [])}
85
- _aff = len(_hit & _ptraits) / max(1, len(_ptraits))
86
- if _aff:
87
- score *= (1.0 + 0.15 * _aff) # 最多 +15%,属"轻微偏好",不抢相关性
88
- except Exception:
89
- pass"""
90
- if old2 in m:
91
- m = m.replace(old2, new2, 1)
92
- print("亲和度:打分已加")
93
- mem.write_text(m, encoding="utf-8")
@@ -1,34 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:接 hsum 命令(可删)。"""
3
- from pathlib import Path
4
-
5
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\cli.py")
6
- d = p.read_text(encoding="utf-8")
7
-
8
- anchor = " # #43 abstract:给记忆补模型级摘要(没配模型就不补,不造假)"
9
- block = ''' # 增量分层摘要:L1/L2/L3 账本,按 covers 幂等,保留率闸门
10
- p_hsum = sub.add_parser("hsum", help="增量分层摘要:按覆盖范围幂等,不反复重压同一段历史")
11
- _hs = p_hsum.add_subparsers(dest="hsum_action", parser_class=_BrainParser)
12
- _hs_b = _hs.add_parser("build", help="生成一层摘要(已存在的 covers 自动跳过)")
13
- _hs_b.add_argument("--level", type=int, default=1, choices=[1, 2, 3])
14
- _hs_b.add_argument("--max-units", type=int, default=8)
15
- _hs_b.add_argument("--dry-run", action="store_true")
16
- _hs_s = _hs.add_parser("show", help="查看某层最近的摘要")
17
- _hs_s.add_argument("--level", type=int, default=1, choices=[1, 2, 3])
18
-
19
- '''
20
- if "p_hsum = sub.add_parser" not in d:
21
- d = d.replace(anchor, block + anchor, 1)
22
- print("解析器已加")
23
-
24
- disp_anchor = ' if args.cmd == "abstract":'
25
- disp = ''' if args.cmd == "hsum":
26
- import hsum
27
- return hsum.run(args)
28
-
29
- '''
30
- if 'args.cmd == "hsum"' not in d:
31
- d = d.replace(disp_anchor, disp + disp_anchor, 1)
32
- print("分派已加")
33
-
34
- p.write_text(d, encoding="utf-8")
@@ -1,40 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:接 occ / bigfive 两个命令(可删)。"""
3
- from pathlib import Path
4
-
5
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\cli.py")
6
- d = p.read_text(encoding="utf-8")
7
-
8
- anchor = " # 增量分层摘要:L1/L2/L3 账本,按 covers 幂等,保留率闸门"
9
- block = ''' # OCC 结构情绪(6 类 + 预期违背拆正负两向)
10
- p_occ = sub.add_parser("occ", help="OCC 结构情绪:认'承诺没做到/担心没发生'这类结构")
11
- _os = p_occ.add_subparsers(dest="occ_action", parser_class=_BrainParser)
12
- _os_l = _os.add_parser("label", help="给一句话打 OCC 标签")
13
- _os_l.add_argument("text")
14
- _os_v = _os.add_parser("violation", help="只看预期违背(负向=失望 / 正向=释然)")
15
- _os_v.add_argument("text")
16
-
17
- # Big Five 数值化(固定 5 维,便于跨时间比较)
18
- p_b5 = sub.add_parser("bigfive", help="Big Five:把自由命名的 traits 归并成固定 5 维")
19
- p_b5.add_argument("--save", action="store_true", help="写进 persona.json 的 big_five")
20
-
21
- '''
22
- if "p_occ = sub.add_parser" not in d:
23
- d = d.replace(anchor, block + anchor, 1)
24
- print("解析器已加")
25
-
26
- disp_anchor = ' if args.cmd == "hsum":'
27
- disp = ''' if args.cmd == "occ":
28
- import occ
29
- return occ.run(args)
30
-
31
- if args.cmd == "bigfive":
32
- import bigfive
33
- return bigfive.run(args)
34
-
35
- '''
36
- if 'args.cmd == "occ"' not in d:
37
- d = d.replace(disp_anchor, disp + disp_anchor, 1)
38
- print("分派已加")
39
-
40
- p.write_text(d, encoding="utf-8")
@@ -1,13 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:把 summarize 里的 extractive_fallback 调用带上 ranker(可删)。"""
3
- from pathlib import Path
4
-
5
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\summarizer.py")
6
- d = p.read_text(encoding="utf-8")
7
- old = "text = extractive_fallback(turns, max_chars)"
8
- new = ('text = extractive_fallback(turns, max_chars, '
9
- 'ranker=str(sec.get("ranker") or "position"))')
10
- n = d.count(old)
11
- d = d.replace(old, new)
12
- p.write_text(d, encoding="utf-8")
13
- print("替换", n, "处")
@@ -1,45 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:给 cli 接 shadow / timeline 两个命令(可删)。"""
3
- from pathlib import Path
4
-
5
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\cli.py")
6
- d = p.read_text(encoding="utf-8")
7
-
8
- anchor = " # 联网调研(web_search 工具欠费时的备胎;能联网就联网,连不上再本地取证)"
9
- if "p_shadow = sub.add_parser" not in d:
10
- block = ''' # #49 影子记忆:写下记忆时的"人格底色",用于检测人格断裂风险(只提醒不阻止)
11
- p_shadow = sub.add_parser("shadow", help="影子记忆:记录/审计写下记忆时的人格底色")
12
- _sh = p_shadow.add_subparsers(dest="shadow_action", parser_class=_BrainParser)
13
- _sh_s = _sh.add_parser("stamp", help="给一条记忆补影子")
14
- _sh_s.add_argument("id")
15
- _sh_r = _sh.add_parser("stamp-recent", help="给最近 N 天没影子的记忆批量补")
16
- _sh_r.add_argument("--days", type=int, default=1)
17
- _sh_r.add_argument("--limit", type=int, default=50)
18
- _sh_a = _sh.add_parser("audit", help="检测人格断裂风险(相似度低于阈值)")
19
- _sh_a.add_argument("--threshold", type=float, default=0.55)
20
- _sh_a.add_argument("--limit", type=int, default=20)
21
-
22
- # #46 成长时间线:把梦/人格快照/教训/缺口按时间并成一条线
23
- p_tl = sub.add_parser("timeline", help="成长时间线:'我是怎么变成现在这样的'")
24
- p_tl.add_argument("--days", type=int, default=30)
25
- p_tl.add_argument("--limit", type=int, default=40)
26
-
27
- '''
28
- d = d.replace(anchor, block + anchor, 1)
29
- print("解析器已加")
30
-
31
- disp_anchor = ' if args.cmd == "web":'
32
- if 'args.cmd == "shadow"' not in d:
33
- disp = ''' if args.cmd == "shadow":
34
- import shadow_memory
35
- return shadow_memory.run(args)
36
-
37
- if args.cmd == "timeline":
38
- import timeline
39
- return timeline.run(args)
40
-
41
- '''
42
- d = d.replace(disp_anchor, disp + disp_anchor, 1)
43
- print("分派已加")
44
-
45
- p.write_text(d, encoding="utf-8")