lingshu-skill 5.32.0 → 5.37.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 (265) hide show
  1. package/CHANGELOG.md +4281 -4173
  2. package/README.md +1584 -1577
  3. package/SKILL-lite.md +59 -59
  4. package/SKILL-tiny.md +38 -38
  5. package/SKILL.md +356 -317
  6. package/assets/panel.html +6753 -5698
  7. package/cordis-plugin/lingshu-cron/plugin.js +1455 -1417
  8. package/cordis-plugin/lingshu-startup/context-fold.js +170 -0
  9. package/cordis-plugin/lingshu-startup/context-pressure.js +16 -0
  10. package/cordis-plugin/lingshu-startup/context-snapshot.js +176 -0
  11. package/cordis-plugin/lingshu-startup/plugin.js +499 -467
  12. package/docs/audit_notes//345/276/205/345/212/236-20261201-/351/235/242/346/235/277/344/270/245/346/237/245/344/270/216/345/256/241/350/256/241.md +162 -0
  13. package/docs/audit_notes//345/276/205/345/212/236-20261202-/351/235/242/346/235/277/344/272/244/344/272/222/344/270/216/346/225/260/346/215/256/345/245/221/347/272/246/345/256/241/350/256/241.md +92 -0
  14. package/docs/audit_notes//345/276/205/345/212/236/346/250/241/346/235/277.md +140 -0
  15. package/docs/commands.md +278 -247
  16. package/docs/mechanics.md +610 -610
  17. package/docs//345/276/205/345/212/236-20261201-/351/235/242/346/235/277/344/270/245/346/237/245/344/270/216/345/256/241/350/256/241.md +162 -0
  18. package/docs//345/276/205/345/212/236-20261202-/351/235/242/346/235/277/344/272/244/344/272/222/344/270/216/346/225/260/346/215/256/345/245/221/347/272/246/345/256/241/350/256/241.md +92 -0
  19. package/package.json +52 -52
  20. package/scripts/_scratch/_tmp_backup_race.py +70 -0
  21. package/scripts/_scratch/_tmp_cleanup_move.py +34 -0
  22. package/scripts/_scratch/_tmp_count_kinds.py +25 -0
  23. package/scripts/_scratch/_tmp_diag_paths.py +48 -0
  24. package/scripts/_scratch/_tmp_facts.py +63 -0
  25. package/scripts/_scratch/_tmp_find_copies.py +31 -0
  26. package/scripts/_scratch/_tmp_find_pin.py +29 -0
  27. package/scripts/_scratch/_tmp_fix_pin.py +36 -0
  28. package/scripts/_scratch/_tmp_fold_fixture.py +55 -0
  29. package/scripts/_scratch/_tmp_fold_test.mjs +81 -0
  30. package/scripts/_scratch/_tmp_inject_secs.py +30 -0
  31. package/scripts/_scratch/_tmp_kb_balance.py +159 -0
  32. package/scripts/_scratch/_tmp_lines.py +15 -0
  33. package/scripts/_scratch/_tmp_market_probe.py +13 -0
  34. package/scripts/_scratch/_tmp_move_partial.py +16 -0
  35. package/scripts/_scratch/_tmp_patch_b3.py +41 -0
  36. package/scripts/_scratch/_tmp_patch_b5.py +62 -0
  37. package/scripts/_scratch/_tmp_patch_crash_excl.py +24 -0
  38. package/scripts/_scratch/_tmp_patch_handoff.py +21 -0
  39. package/scripts/_scratch/_tmp_patch_ps1.py +25 -0
  40. package/scripts/_scratch/_tmp_patch_stat.py +27 -0
  41. package/scripts/_scratch/_tmp_patch_todo.py +25 -0
  42. package/scripts/_scratch/_tmp_patch_todo2.py +64 -0
  43. package/scripts/_scratch/_tmp_probe_session.py +51 -0
  44. package/scripts/_scratch/_tmp_style_probe.py +40 -0
  45. package/scripts/_scratch/_tmp_write_note.py +139 -0
  46. package/scripts/_scratch/_/346/235/245/346/272/220/350/256/260/345/275/225.txt +1 -0
  47. package/scripts/_scratch/asar_compaction/dsh-compaction-basic__lib__index.js +1044 -0
  48. package/scripts/_scratch/asar_compaction/dsh-compaction-tool-result-pruner__lib__index.js +194 -0
  49. package/scripts/_scratch/asar_compaction/dsh-compaction__lib__index.js +175 -0
  50. package/scripts/_scratch/asar_compaction/dsh-compaction__lib__types__tool-pairing.js +97 -0
  51. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__image-offload.js +47 -0
  52. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__index.js +40 -0
  53. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__project-message.js +37 -0
  54. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__brand.js +9 -0
  55. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__checkpoint.js +36 -0
  56. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__types.js +10 -0
  57. package/scripts/_scratch/commit_msg_occ.txt +16 -0
  58. package/scripts/_scratch/commit_msg_struct.txt +16 -0
  59. package/scripts/_scratch/v5.34_changelog.txt +36 -0
  60. package/scripts/_sync_trae_cn.py +102 -34
  61. package/scripts/_tmp_add_s10.py +54 -0
  62. package/scripts/_tmp_add_s11.py +61 -0
  63. package/scripts/_tmp_add_s12.py +66 -0
  64. package/scripts/_tmp_add_s13.py +69 -0
  65. package/scripts/_tmp_add_s14.py +80 -0
  66. package/scripts/_tmp_add_s9.py +68 -0
  67. package/scripts/_tmp_cache_load.py +82 -0
  68. package/scripts/_tmp_clean_market.py +40 -0
  69. package/scripts/_tmp_clean_pruned.py +81 -0
  70. package/scripts/_tmp_cleanup_docs.py +39 -0
  71. package/scripts/_tmp_cmp_ranker.py +17 -0
  72. package/scripts/_tmp_dolater_note.py +35 -0
  73. package/scripts/_tmp_dust_why.py +27 -0
  74. package/scripts/_tmp_explicit_import.py +40 -0
  75. package/scripts/_tmp_extract_compaction.py +35 -0
  76. package/scripts/_tmp_extract_compaction2.py +63 -0
  77. package/scripts/_tmp_extract_compaction3.py +51 -0
  78. package/scripts/_tmp_extract_compaction4.py +54 -0
  79. package/scripts/_tmp_finalize_s14.py +39 -0
  80. package/scripts/_tmp_find_compaction.py +43 -0
  81. package/scripts/_tmp_fix_b4.py +22 -0
  82. package/scripts/_tmp_fix_cli76.py +26 -0
  83. package/scripts/_tmp_fix_docs.py +38 -0
  84. package/scripts/_tmp_fix_docs_b.py +46 -0
  85. package/scripts/_tmp_fix_docs_b2.py +22 -0
  86. package/scripts/_tmp_fix_i3.py +23 -0
  87. package/scripts/_tmp_fix_s10.py +83 -0
  88. package/scripts/_tmp_fix_s11.py +14 -0
  89. package/scripts/_tmp_fix_s9_status.py +19 -0
  90. package/scripts/_tmp_fix_shadow_sim.py +37 -0
  91. package/scripts/_tmp_fix_traits_value.py +41 -0
  92. package/scripts/_tmp_import_idem.py +106 -0
  93. package/scripts/_tmp_log_ack.py +45 -0
  94. package/scripts/_tmp_mark_batch.py +28 -0
  95. package/scripts/_tmp_mark_batch2.py +32 -0
  96. package/scripts/_tmp_mark_dolater.py +26 -0
  97. package/scripts/_tmp_mark_dolater2.py +31 -0
  98. package/scripts/_tmp_move_self.py +16 -0
  99. package/scripts/_tmp_occ_cli.py +22 -0
  100. package/scripts/_tmp_occ_link.py +108 -0
  101. package/scripts/_tmp_optimize_recall.py +54 -0
  102. package/scripts/_tmp_panel_audit.py +26 -0
  103. package/scripts/_tmp_patch_batch3.py +65 -0
  104. package/scripts/_tmp_patch_rrf.py +46 -0
  105. package/scripts/_tmp_patch_s2s3.py +80 -0
  106. package/scripts/_tmp_patch_s4.py +39 -0
  107. package/scripts/_tmp_patch_s7.py +43 -0
  108. package/scripts/_tmp_patch_s8.py +91 -0
  109. package/scripts/_tmp_patch_skill.py +17 -0
  110. package/scripts/_tmp_release_guard.py +57 -0
  111. package/scripts/_tmp_rerank_breaker.py +62 -0
  112. package/scripts/_tmp_s16.py +41 -0
  113. package/scripts/_tmp_scan_asar.py +41 -0
  114. package/scripts/_tmp_scan_asar2.py +37 -0
  115. package/scripts/_tmp_struct_docs.py +49 -0
  116. package/scripts/_tmp_sum_fallback.py +42 -0
  117. package/scripts/_tmp_sweep.py +81 -0
  118. package/scripts/_tmp_sync_check.py +69 -0
  119. package/scripts/_tmp_sync_tail.py +39 -0
  120. package/scripts/_tmp_todo_clean.py +67 -0
  121. package/scripts/_tmp_verify_copy.py +17 -0
  122. package/scripts/_tmp_wire_extras.py +93 -0
  123. package/scripts/_tmp_wire_hsum.py +34 -0
  124. package/scripts/_tmp_wire_occ_b5.py +40 -0
  125. package/scripts/_tmp_wire_ranker.py +13 -0
  126. package/scripts/_tmp_wire_shadow_timeline.py +45 -0
  127. package/scripts/anchor_retention.py +68 -0
  128. package/scripts/app_context.py +1160 -0
  129. package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +38 -22
  130. package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +4281 -4173
  131. package/scripts/astrbot_plugin_lingshu/engine/README.md +1584 -1577
  132. package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +59 -59
  133. package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +38 -38
  134. package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +356 -317
  135. package/scripts/astrbot_plugin_lingshu/engine/assets/panel.html +6753 -5698
  136. package/scripts/astrbot_plugin_lingshu/engine/docs/commands.md +278 -247
  137. package/scripts/astrbot_plugin_lingshu/engine/docs/mechanics.md +610 -610
  138. package/scripts/astrbot_plugin_lingshu/engine/scripts/_sync_trae_cn.py +102 -34
  139. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s10.py +54 -0
  140. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s11.py +61 -0
  141. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s12.py +66 -0
  142. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s13.py +69 -0
  143. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s14.py +80 -0
  144. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s9.py +68 -0
  145. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cache_load.py +82 -0
  146. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_market.py +40 -0
  147. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_pruned.py +81 -0
  148. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cleanup_docs.py +39 -0
  149. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cmp_ranker.py +17 -0
  150. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dolater_note.py +35 -0
  151. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dust_why.py +27 -0
  152. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_explicit_import.py +40 -0
  153. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction.py +35 -0
  154. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction2.py +63 -0
  155. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction3.py +51 -0
  156. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction4.py +54 -0
  157. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_finalize_s14.py +39 -0
  158. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_find_compaction.py +43 -0
  159. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_b4.py +22 -0
  160. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_cli76.py +26 -0
  161. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs.py +38 -0
  162. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b.py +46 -0
  163. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b2.py +22 -0
  164. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_i3.py +23 -0
  165. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s10.py +83 -0
  166. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s11.py +14 -0
  167. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s9_status.py +19 -0
  168. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_shadow_sim.py +37 -0
  169. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_traits_value.py +41 -0
  170. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_import_idem.py +106 -0
  171. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_log_ack.py +45 -0
  172. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch.py +28 -0
  173. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch2.py +32 -0
  174. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater.py +26 -0
  175. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater2.py +31 -0
  176. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_move_self.py +16 -0
  177. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_cli.py +22 -0
  178. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_link.py +108 -0
  179. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_optimize_recall.py +54 -0
  180. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_panel_audit.py +26 -0
  181. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_batch3.py +65 -0
  182. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_rrf.py +46 -0
  183. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s2s3.py +80 -0
  184. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s4.py +39 -0
  185. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s7.py +43 -0
  186. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s8.py +91 -0
  187. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_skill.py +17 -0
  188. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_release_guard.py +57 -0
  189. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_rerank_breaker.py +62 -0
  190. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_s16.py +41 -0
  191. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar.py +41 -0
  192. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar2.py +37 -0
  193. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_struct_docs.py +49 -0
  194. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sum_fallback.py +42 -0
  195. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sweep.py +81 -0
  196. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_check.py +69 -0
  197. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_tail.py +39 -0
  198. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_todo_clean.py +67 -0
  199. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_verify_copy.py +17 -0
  200. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_extras.py +93 -0
  201. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_hsum.py +34 -0
  202. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_occ_b5.py +40 -0
  203. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_ranker.py +13 -0
  204. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_shadow_timeline.py +45 -0
  205. package/scripts/astrbot_plugin_lingshu/engine/scripts/anchor_retention.py +68 -0
  206. package/scripts/astrbot_plugin_lingshu/engine/scripts/app_context.py +1160 -0
  207. package/scripts/astrbot_plugin_lingshu/engine/scripts/bigfive.py +90 -0
  208. package/scripts/astrbot_plugin_lingshu/engine/scripts/brain.py +1 -1
  209. package/scripts/astrbot_plugin_lingshu/engine/scripts/check_docs.py +191 -0
  210. package/scripts/astrbot_plugin_lingshu/engine/scripts/cli.py +940 -88
  211. package/scripts/astrbot_plugin_lingshu/engine/scripts/core.py +2468 -2406
  212. package/scripts/astrbot_plugin_lingshu/engine/scripts/coverage_report.py +5 -0
  213. package/scripts/astrbot_plugin_lingshu/engine/scripts/delivery.py +112 -0
  214. package/scripts/astrbot_plugin_lingshu/engine/scripts/dream.py +41 -3
  215. package/scripts/astrbot_plugin_lingshu/engine/scripts/emotion.py +202 -23
  216. package/scripts/astrbot_plugin_lingshu/engine/scripts/gap_memory.py +186 -0
  217. package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +72 -8
  218. package/scripts/astrbot_plugin_lingshu/engine/scripts/hsum.py +206 -0
  219. package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_score.py +92 -7
  220. package/scripts/astrbot_plugin_lingshu/engine/scripts/memory.py +533 -60
  221. package/scripts/astrbot_plugin_lingshu/engine/scripts/memory_extras.py +200 -0
  222. package/scripts/astrbot_plugin_lingshu/engine/scripts/occ.py +190 -0
  223. package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +232 -142
  224. package/scripts/astrbot_plugin_lingshu/engine/scripts/persona.py +2498 -2349
  225. package/scripts/astrbot_plugin_lingshu/engine/scripts/prepublish_tests.py +90 -0
  226. package/scripts/astrbot_plugin_lingshu/engine/scripts/release.py +326 -287
  227. package/scripts/astrbot_plugin_lingshu/engine/scripts/rss_ingest.py +181 -0
  228. package/scripts/astrbot_plugin_lingshu/engine/scripts/session_import.py +832 -764
  229. package/scripts/astrbot_plugin_lingshu/engine/scripts/shadow_memory.py +173 -0
  230. package/scripts/astrbot_plugin_lingshu/engine/scripts/style_check.py +220 -0
  231. package/scripts/astrbot_plugin_lingshu/engine/scripts/summarizer.py +343 -252
  232. package/scripts/astrbot_plugin_lingshu/engine/scripts/timeline.py +118 -0
  233. package/scripts/astrbot_plugin_lingshu/engine/scripts/watchdog.py +110 -0
  234. package/scripts/astrbot_plugin_lingshu/engine/scripts/web_research.py +125 -0
  235. package/scripts/bigfive.py +90 -0
  236. package/scripts/brain.py +1 -1
  237. package/scripts/check_docs.py +191 -0
  238. package/scripts/cli.py +940 -88
  239. package/scripts/core.py +2468 -2406
  240. package/scripts/coverage_report.py +5 -0
  241. package/scripts/delivery.py +112 -0
  242. package/scripts/dream.py +41 -3
  243. package/scripts/emotion.py +202 -23
  244. package/scripts/gap_memory.py +186 -0
  245. package/scripts/growth.py +72 -8
  246. package/scripts/hsum.py +206 -0
  247. package/scripts/mem_score.py +92 -7
  248. package/scripts/memory.py +533 -60
  249. package/scripts/memory_extras.py +200 -0
  250. package/scripts/occ.py +190 -0
  251. package/scripts/panel_server.py +232 -142
  252. package/scripts/persona.py +2498 -2349
  253. package/scripts/prepublish_tests.py +90 -0
  254. package/scripts/release.py +326 -287
  255. package/scripts/rss_ingest.py +181 -0
  256. package/scripts/run_tests.py +13 -0
  257. package/scripts/session_import.py +832 -764
  258. package/scripts/shadow_memory.py +173 -0
  259. package/scripts/style_check.py +220 -0
  260. package/scripts/summarizer.py +343 -252
  261. package/scripts/timeline.py +118 -0
  262. package/scripts/update_dsh_copy.ps1 +110 -107
  263. package/scripts/watchdog.py +110 -0
  264. package/scripts/web_research.py +125 -0
  265. package/docs//345/256/241/346/240/270/346/224/271/350/277/233/345/276/205/345/212/236.md +0 -370
@@ -0,0 +1,40 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:清理插件市场 journal 里 lingshu 的陈旧记录(§0.2 的修法)。
3
+
4
+ 按用户规矩:先备份到「垃圾桶」,再改原文件(这里改的是**行**,不是删文件)。
5
+ """
6
+ import glob
7
+ import os
8
+ import shutil
9
+ import time
10
+ from pathlib import Path
11
+
12
+ home = os.path.expanduser("~")
13
+ trash = Path(r"E:\丁厚同\文档\程序\灵枢-skill\垃圾桶")
14
+ trash.mkdir(parents=True, exist_ok=True)
15
+ stamp = time.strftime("%Y%m%d_%H%M%S")
16
+
17
+ pat = os.path.join(home, ".*", "profiles", "desktop", ".*market", "*compatibility*.journal")
18
+ files = glob.glob(pat)
19
+ print("journal 数:", len(files))
20
+ total_removed = 0
21
+ for f in files:
22
+ p = Path(f)
23
+ lines = p.read_text(encoding="utf-8", errors="replace").splitlines()
24
+ keep = [l for l in lines if "lingshu" not in l]
25
+ removed = len(lines) - len(keep)
26
+ if removed == 0:
27
+ print(f" {p.name}: 没有 lingshu 行,跳过")
28
+ continue
29
+ bak = trash / f"{p.name}.{stamp}.bak"
30
+ shutil.copy2(p, bak)
31
+ p.write_text("\n".join(keep) + ("\n" if keep else ""), encoding="utf-8")
32
+ total_removed += removed
33
+ print(f" {p.name}: 删 {removed} 行(原 {len(lines)} → {len(keep)});备份 {bak.name}")
34
+
35
+ note = trash / "_来源记录.txt"
36
+ with note.open("a", encoding="utf-8") as f:
37
+ f.write(f"[{stamp}] 插件市场 journal 清理 lingshu 行 {total_removed} 条 | 来源: "
38
+ f"{os.path.join(home, '.*', 'profiles', 'desktop', '.*market')} | "
39
+ "原因: 市场显示旧版本,§0.2 修法(清缓存触发重查)\n")
40
+ print("合计删除行:", total_removed)
@@ -0,0 +1,81 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:把 .pruned 隔离区搬到仓库垃圾桶(只移不删 + 留来源记录)。
3
+
4
+ 规矩:任何"清理"都不物理删除——移到 `灵枢-skill/垃圾桶/<时间戳>_<来源>/`,
5
+ 并在该目录写 `来源记录.md`(原路径、文件数、总大小、为什么移)。
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import shutil
10
+ import sys
11
+ import time
12
+ from pathlib import Path
13
+
14
+ sys.path.insert(0, r"E:\丁厚同\文档\程序\灵枢-skill\scripts")
15
+ import core
16
+
17
+ REPO = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
18
+ TRASH = REPO / "垃圾桶"
19
+ STAMP = time.strftime("%Y%m%d_%H%M%S")
20
+
21
+ candidates = []
22
+ # 1) 安全快照隔离区
23
+ candidates.append((Path(core.HOME) / ".safety" / ".pruned", "安全快照-pruned"))
24
+ # 2) 备份产物的隔离区(可能在 HOME/backups/.pruned,也可能在跨卷备份根)
25
+ for base in (Path(core.HOME), Path("D:/brain-memory-backups"), Path("E:/brain-memory-backups")):
26
+ p = base / "backups" / ".pruned"
27
+ if p.is_dir() and p not in [c[0] for c in candidates]:
28
+ candidates.append((p, "备份-pruned"))
29
+ p2 = base / ".pruned"
30
+ if p2.is_dir() and p2 not in [c[0] for c in candidates]:
31
+ candidates.append((p2, "备份产物-pruned"))
32
+
33
+ moved_total = 0
34
+ size_total = 0
35
+ report = []
36
+ for src, label in candidates:
37
+ if not src.is_dir():
38
+ continue
39
+ files = [f for f in src.rglob("*") if f.is_file()]
40
+ if not files:
41
+ continue
42
+ size = sum(f.stat().st_size for f in files)
43
+ dst = TRASH / f"{STAMP}_{label}"
44
+ dst.mkdir(parents=True, exist_ok=True)
45
+ n = 0
46
+ for f in files:
47
+ rel = f.relative_to(src)
48
+ target = dst / rel
49
+ target.parent.mkdir(parents=True, exist_ok=True)
50
+ try:
51
+ shutil.move(str(f), str(target))
52
+ n += 1
53
+ except OSError as e:
54
+ print(f" 跳过 {f}: {e}")
55
+ # 清掉空目录
56
+ for d in sorted([d for d in src.rglob("*") if d.is_dir()], reverse=True):
57
+ try:
58
+ d.rmdir()
59
+ except OSError:
60
+ pass
61
+ moved_total += n
62
+ size_total += size
63
+ report.append((label, str(src), n, size, str(dst)))
64
+
65
+ TRASH.mkdir(exist_ok=True)
66
+ if report:
67
+ rec = TRASH / f"{STAMP}_来源记录.md"
68
+ lines = [f"# 清理记录 {STAMP}", "",
69
+ "按「只移不删」规矩:以下文件从隔离区移到垃圾桶,可随时搬回。", "",
70
+ "| 来源 | 原路径 | 文件数 | 大小 | 去向 |", "|---|---|---|---|---|"]
71
+ for label, src, n, size, dst in report:
72
+ lines.append(f"| {label} | `{src}` | {n} | {size/1024/1024:.1f}MB | `{dst}` |")
73
+ lines.append("")
74
+ lines.append("为什么移:doctor `disk-usage` 报快照 `.pruned` 超 30MB 阈值;")
75
+ lines.append("这些是写盘失败时被隔离的半成品 zip / 旧快照,确认无用后清理,原始数据不受影响。")
76
+ rec.write_text("\n".join(lines) + "\n", encoding="utf-8")
77
+ print(f"来源记录:{rec}")
78
+
79
+ print(f"共移动 {moved_total} 个文件 / {size_total/1024/1024:.1f}MB → {TRASH}")
80
+ for label, src, n, size, dst in report:
81
+ print(f" {label}: {n} 个 / {size/1024/1024:.1f}MB")
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:按用户要求,将已完成的待办文档移入垃圾桶(只移不删)。"""
3
+ import shutil
4
+ import time
5
+ from pathlib import Path
6
+
7
+ REPO = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
8
+ TRASH = REPO / "垃圾桶"
9
+ STAMP = time.strftime("%Y%m%d_%H%M%S")
10
+
11
+ # 待办文档及其相关阶段性方案
12
+ targets = [
13
+ REPO / "docs" / "审核改进待办.md",
14
+ REPO / "docs" / "重构方案-20261130.md"
15
+ ]
16
+
17
+ moved = []
18
+ for p in targets:
19
+ if p.exists():
20
+ dst_dir = TRASH / f"{STAMP}_待办清理"
21
+ dst_dir.mkdir(parents=True, exist_ok=True)
22
+ dst_path = dst_dir / p.name
23
+ try:
24
+ shutil.move(str(p), str(dst_path))
25
+ moved.append((str(p), str(dst_path)))
26
+ except Exception as e:
27
+ print(f"移动失败 {p.name}: {e}")
28
+
29
+ if moved:
30
+ rec = TRASH / f"{STAMP}_清理记录.md"
31
+ lines = [f"# 文档清理记录 {STAMP}", "",
32
+ "所有待办事项已确认为 ✅ 已完成,按用户要求移入垃圾桶。", "",
33
+ "| 原路径 | 去向 |", "|---|---|"]
34
+ for src, dst in moved:
35
+ lines.append(f"| `{src}` | `{dst}` |")
36
+ rec.write_text("\n".join(lines) + "\n", encoding="utf-8")
37
+ print(f"已清理 {len(moved)} 份文档,记录见:{rec}")
38
+ else:
39
+ print("未发现待清理文档。")
@@ -0,0 +1,17 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:对比 position vs textrank 的"已做"段(可删)。"""
3
+ import sys
4
+
5
+ sys.path.insert(0, r"E:\丁厚同\文档\程序\灵枢-skill\scripts")
6
+ import summarizer as s
7
+
8
+ turns = [
9
+ {"role": "user", "text": "帮我查下发布流程"},
10
+ {"role": "assistant", "text": "发布前要跑测试、生成产物、核对版本。"},
11
+ {"role": "assistant", "text": "预算只有 3 天,所以这周必须发出去。"},
12
+ {"role": "assistant", "text": "另外记得备份。"},
13
+ ]
14
+ for mode in ("position", "textrank"):
15
+ txt = s.extractive_fallback(turns, 400, ranker=mode)
16
+ done = [ln for ln in txt.splitlines() if ln.startswith("- ")][:3]
17
+ print(f"{mode:<9}", done)
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:do-later 落地记录(可删)。"""
3
+ import time
4
+ from pathlib import Path
5
+
6
+ p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
7
+ d = p.read_text(encoding="utf-8")
8
+
9
+ SEC = """
10
+ ### do-later 落地记录(2026-11-30)
11
+
12
+ do-later 表原来只有成本列、没有状态列,容易误以为"都没做"。实际状态:
13
+
14
+ | 项 | 状态 |
15
+ |---|---|
16
+ | RRF 倒数排名融合 | ✅ `config rrf_fusion=true`(名次融合替代 max 抢占) |
17
+ | MMR 最大边际相关 | ✅ `config mmr_diversity=true`(λ=`mmr_lambda` 默认 0.75) |
18
+ | ACT-R base-level activation | ✅ 频次入打分(`mem_score.actr_base_level`,小额加成 ≤0.08) |
19
+ | 优先级重放 | ✅ `replay_recent` 做相似去重 + 每类上限 + 回填 |
20
+ | TextRank / LexRank | ✅ `summary.ranker=textrank`(TextRank 选句替代"最后 3 条") |
21
+ | persona drift 向量散度 | ✅ diff 带 `magnitude`,stability 按幅度扣分(+1 与 +30 不再同分) |
22
+ | 熔断推广到 rerank | ✅ `rerank.fail_cooldown_sec=300`,失败后不再每次白等 3s |
23
+ | 幂等键 | ✅ `session_import_idempotent`(**默认关**,按"源文件+会话+行"哈希去重) |
24
+ | **增量分层摘要** | ⬜ **未做**(L 级,方案在 `docs/重构方案-20261130.md` 第一节) |
25
+ | **Big Five 数值化** | ⬜ **未做**(M):需要先定 traits→5 维的映射表,属产品决策 |
26
+ | **OCC 结构情绪** | ⬜ **未做**(M):需要先定 OCC 22 类里用哪几类、怎么触发,属产品决策 |
27
+
28
+ > 后两条不是"技术做不了",是**要先定语义**(映射表 / 分类表)。定下来我半天能落。
29
+ """
30
+
31
+ if "### do-later 落地记录" in d:
32
+ print("已存在")
33
+ else:
34
+ p.write_text(d.rstrip() + "\n\n" + SEC, encoding="utf-8")
35
+ print("已追加 do-later 落地记录")
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:淡忘区里为什么这么多"不可归档"(可删)。"""
3
+ import collections
4
+ import sys
5
+
6
+ sys.path.insert(0, r"E:\丁厚同\文档\程序\灵枢-skill\scripts")
7
+ import brain
8
+
9
+ recs = brain.load_all()
10
+ dust = [m for m in recs if m.get("layer") == "dust"]
11
+ print("dust 总数 =", len(dust))
12
+ c = collections.Counter()
13
+ for m in dust:
14
+ if m.get("pinned"):
15
+ c["pinned"] += 1
16
+ elif m.get("verbatim"):
17
+ c["verbatim"] += 1
18
+ elif m.get("kind") == "identity":
19
+ c["identity"] += 1
20
+ elif m.get("review") == "pending":
21
+ c["pending"] += 1
22
+ elif not m.get("id"):
23
+ c["no-id"] += 1
24
+ else:
25
+ c["可归档"] += 1
26
+ print("分类:", dict(c))
27
+ print("kind 分布:", dict(collections.Counter(m.get("kind") for m in dust).most_common(6)))
@@ -0,0 +1,40 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:把 memory.py 的 star import 换成显式 import(重构方案 三-1)(可删)。"""
3
+ import ast
4
+ from pathlib import Path
5
+
6
+ ROOT = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
7
+ mem = ROOT / "scripts" / "memory.py"
8
+ src = mem.read_text(encoding="utf-8")
9
+
10
+ # mem_score 的公开名字
11
+ import sys
12
+ sys.path.insert(0, str(ROOT / "scripts"))
13
+ import mem_score
14
+
15
+ public = sorted(n for n in dir(mem_score) if not n.startswith("_"))
16
+ tree = ast.parse(src)
17
+ used = {n.id for n in ast.walk(tree) if isinstance(n, ast.Name)}
18
+ used |= {n.attr for n in ast.walk(tree) if isinstance(n, ast.Attribute)}
19
+ need = [n for n in public if n in used]
20
+
21
+ old = "from mem_score import * # noqa: E402,F401,F403"
22
+ if old not in src:
23
+ print("星号 import 已不存在")
24
+ raise SystemExit(0)
25
+
26
+ lines = []
27
+ cur = "from mem_score import ("
28
+ for i, n in enumerate(need):
29
+ piece = n + ", "
30
+ if len(cur) + len(piece) > 96:
31
+ lines.append(cur.rstrip())
32
+ cur = " "
33
+ cur += piece
34
+ lines.append(cur.rstrip().rstrip(",") + ") # noqa: E402,F401")
35
+ replacement = "\n".join(lines)
36
+
37
+ src2 = src.replace(old, replacement, 1)
38
+ mem.write_text(src2, encoding="utf-8")
39
+ print(f"显式 import {len(need)} 个名字(原星号覆盖 {len(public)} 个)")
40
+ print(replacement[:200] + ("…" if len(replacement) > 200 else ""))
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:从 asar 按索引抽 compaction 相关源码(可删)。"""
3
+ import glob
4
+ import json
5
+ import re
6
+
7
+ PATH = glob.glob("D:/*/resources/app.asar")[0]
8
+
9
+ with open(PATH, "rb") as f:
10
+ f.seek(0)
11
+ head = f.read(3 << 20) # 索引在头部区域
12
+
13
+ text = head.decode("utf-8", "replace")
14
+ # 该 asar 的索引是 JSON(可能在 header 里),先定位以 { 开头的 JSON 段
15
+ start = text.find('{"files"')
16
+ if start < 0:
17
+ # 有的打包器把 header 放在别处,暴力找 "compaction.ts" 附近的 JSON
18
+ i = text.find('"compaction.ts"')
19
+ start = text.rfind("{", 0, i - 2000) if i > 0 else -1
20
+
21
+ targets = {}
22
+ for name in ("compaction.ts", "trajectory-compaction-definition.ts"):
23
+ m = re.search(r'"' + re.escape(name) + r'":\{"size":(\d+),"offset":"(\d+)"', text)
24
+ if m:
25
+ targets[name] = (int(m.group(1)), int(m.group(2)))
26
+
27
+ print("定位:", targets)
28
+
29
+ with open(PATH, "rb") as f:
30
+ for name, (size, off) in targets.items():
31
+ f.seek(off)
32
+ body = f.read(size)
33
+ print("=" * 20, name, f"({size} 字节)")
34
+ print(body.decode("utf-8", "replace")[:3000])
35
+ print()
@@ -0,0 +1,63 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:正规解析 asar 头,抽出 dsh-compaction* 包源码(可删)。
3
+
4
+ asar 布局:uint32(4) + uint32(headerSize) + JSON header + 数据区。
5
+ header.files 是树,节点有 {files:{...}} 或 {size, offset}。
6
+ """
7
+ import glob
8
+ import json
9
+ import struct
10
+ import sys
11
+
12
+ PATH = glob.glob("D:/*/resources/app.asar")[0]
13
+ OUT = r"E:\丁厚同\文档\程序\灵枢-skill\scripts\_scratch\asar_compaction"
14
+ import os
15
+ os.makedirs(OUT, exist_ok=True)
16
+
17
+ with open(PATH, "rb") as f:
18
+ head = f.read(16)
19
+ _a, hsize = struct.unpack("<II", head[:8])
20
+ header = f.read(hsize)
21
+ base = 8 + hsize
22
+ meta, _end = json.JSONDecoder().raw_decode(header.decode("utf-8", "replace"))
23
+
24
+ files = meta.get("files", {})
25
+
26
+
27
+ def walk(node, prefix=""):
28
+ for name, sub in (node or {}).items():
29
+ path = f"{prefix}/{name}" if prefix else name
30
+ if "files" in sub:
31
+ yield from walk(sub["files"], path)
32
+ else:
33
+ yield path, sub
34
+
35
+
36
+ targets = []
37
+ for path, sub in walk(files):
38
+ low = path.lower()
39
+ if "compaction" not in low:
40
+ continue
41
+ if not (low.endswith(".js") or low.endswith(".mjs") or low.endswith(".cjs")):
42
+ continue
43
+ targets.append((path, sub.get("size", 0), sub.get("offset")))
44
+
45
+ print(f"命中 {len(targets)} 个压缩相关 JS 文件:")
46
+ for p, s, o in targets[:40]:
47
+ print(f" {s:>7} {p}")
48
+
49
+ # 抽前若干个(按大小升序,先看小文件了解接口)
50
+ targets.sort(key=lambda x: x[1])
51
+ with open(PATH, "rb") as f:
52
+ for p, s, o in targets[:6]:
53
+ if o is None or s > 400_000:
54
+ continue
55
+ f.seek(base + int(o))
56
+ body = f.read(int(s))
57
+ safe = p.replace("/", "__")
58
+ dst = os.path.join(OUT, safe)
59
+ with open(dst, "wb") as w:
60
+ w.write(body)
61
+ print(f"\n===== {p} ({s} 字节) → {dst} =====")
62
+ txt = body.decode("utf-8", "replace")
63
+ print(txt[:1600])
@@ -0,0 +1,51 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:按名字精确抽 compaction 主实现(可删)。"""
3
+ import glob
4
+ import json
5
+ import os
6
+ import struct
7
+
8
+ PATH = glob.glob("D:/*/resources/app.asar")[0]
9
+ OUT = r"E:\丁厚同\文档\程序\灵枢-skill\scripts\_scratch\asar_compaction"
10
+ os.makedirs(OUT, exist_ok=True)
11
+
12
+ WANT = (
13
+ "dsh-compaction/lib/index.js",
14
+ "dsh-compaction-tool-result-pruner/lib/index.js",
15
+ "dsh-compaction/lib/types/tool-pairing.js",
16
+ )
17
+
18
+ with open(PATH, "rb") as f:
19
+ _a, hsize = struct.unpack("<II", f.read(8))
20
+ meta, _ = json.JSONDecoder().raw_decode(f.read(hsize).decode("utf-8", "replace"))
21
+ base = 8 + hsize
22
+
23
+
24
+ def walk(node, prefix=""):
25
+ for name, sub in (node or {}).items():
26
+ path = f"{prefix}/{name}" if prefix else name
27
+ if "files" in sub:
28
+ yield from walk(sub["files"], path)
29
+ else:
30
+ yield path, sub
31
+
32
+
33
+ found = {}
34
+ for path, sub in walk(meta.get("files", {})):
35
+ for w in WANT:
36
+ if path.endswith(w):
37
+ found[w] = (sub.get("size", 0), sub.get("offset"))
38
+
39
+ with open(PATH, "rb") as f:
40
+ for w in WANT:
41
+ if w not in found:
42
+ print(f"缺失: {w}")
43
+ continue
44
+ size, off = found[w]
45
+ f.seek(base + int(off))
46
+ body = f.read(int(size))
47
+ dst = os.path.join(OUT, w.replace("/", "__"))
48
+ with open(dst, "wb") as o:
49
+ o.write(body)
50
+ print(f"\n===== {w} ({size}B) =====")
51
+ print(body.decode("utf-8", "replace")[:5200])
@@ -0,0 +1,54 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:复用已验证的 asar 解析,抽 compaction 主实现(可删)。"""
3
+ import glob
4
+ import json
5
+ import os
6
+ import struct
7
+
8
+ PATH = glob.glob("D:/*/resources/app.asar")[0]
9
+ OUT = r"E:\丁厚同\文档\程序\灵枢-skill\scripts\_scratch\asar_compaction"
10
+ os.makedirs(OUT, exist_ok=True)
11
+
12
+ WANT = (
13
+ "dsh-compaction/lib/index.js",
14
+ "dsh-compaction-tool-result-pruner/lib/index.js",
15
+ "dsh-compaction/lib/types/tool-pairing.js",
16
+ "dsh-compaction-basic/lib/index.js",
17
+ )
18
+
19
+ with open(PATH, "rb") as f:
20
+ head = f.read(16)
21
+ _a, hsize = struct.unpack("<II", head[:8])
22
+ header = f.read(hsize)
23
+ base = 8 + hsize
24
+ meta, _end = json.JSONDecoder().raw_decode(header.decode("utf-8", "replace"))
25
+
26
+
27
+ def walk(node, prefix=""):
28
+ for name, sub in (node or {}).items():
29
+ path = f"{prefix}/{name}" if prefix else name
30
+ if "files" in sub:
31
+ yield from walk(sub["files"], path)
32
+ else:
33
+ yield path, sub
34
+
35
+
36
+ found = {}
37
+ for path, sub in walk(meta.get("files", {})):
38
+ for w in WANT:
39
+ if path.endswith(w):
40
+ found.setdefault(w, (sub.get("size", 0), sub.get("offset")))
41
+
42
+ with open(PATH, "rb") as f:
43
+ for w in WANT:
44
+ if w not in found:
45
+ print(f"缺失: {w}")
46
+ continue
47
+ size, off = found[w]
48
+ f.seek(base + int(off))
49
+ body = f.read(int(size))
50
+ dst = os.path.join(OUT, w.replace("/", "__"))
51
+ with open(dst, "wb") as o:
52
+ o.write(body)
53
+ print(f"\n===== {w} ({size}B) =====")
54
+ print(body.decode("utf-8", "replace")[:4600])
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:§14 标为已落地 + README CLI 数(可删)。"""
3
+ from pathlib import Path
4
+
5
+ ROOT = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
6
+
7
+ rp = ROOT / "README.md"
8
+ d = rp.read_text(encoding="utf-8")
9
+ n = d.count("82 个 CLI 命令")
10
+ rp.write_text(d.replace("82 个 CLI 命令", "84 个 CLI 命令"), encoding="utf-8")
11
+ print("README CLI 82→84 x", n)
12
+
13
+ p = ROOT / "docs" / "审核改进待办.md"
14
+ d = p.read_text(encoding="utf-8")
15
+
16
+ d = d.replace("| **Big Five 数值化** | ⬜ **未做**(M):需要先定 traits→5 维的映射表,属产品决策 |",
17
+ "| **Big Five 数值化** | ✅ 已做:`brain.py bigfive [--save]`——固定 5 维按关键词归并,"
18
+ "未映射计分不计(`{value,why,evidence}` 嵌套结构已正确处理) |", 1)
19
+ d = d.replace("| **OCC 结构情绪** | ⬜ **未做**(M):需要先定 OCC 22 类里用哪几类、怎么触发,属产品决策 |",
20
+ "| **OCC 结构情绪** | ✅ 已做(**6 类 + 预期违背拆正负两向**):`brain.py occ label|violation`,"
21
+ "失望=负向 / 释然=正向 |", 1)
22
+
23
+ SEC = """
24
+ ### 14.3 决定与落地(2026-11-30)
25
+
26
+ 用户拍板:**OCC 先上 6 类,「预期违背」拆正负两向**;Big Five 按 14.1 候选表落地。
27
+
28
+ - `scripts/occ.py`:6 类规则(失望/释然/满意/感激/愤怒/焦虑),每类要求"事件线索 + 方向线索"
29
+ 同时命中才算,避免单词误报;`expected_violation()` 单独给出 violated + direction。
30
+ 实测六句各命中一类,且"答应却没做到"=负向、"担心却没事"=正向。
31
+ - `scripts/bigfive.py`:5 维归并(未映射 traits **不计分**,不瞎归),`--save` 写入
32
+ `persona.json.big_five`;顺带修了 traits 嵌套结构 `{value,why,evidence}` 被当裸数字读成 0 的 bug
33
+ (`persona_drift` 的 magnitude 同样受益,原来对嵌套结构只能记 0.5 当量)。
34
+ """
35
+
36
+ if "### 14.3 决定与落地" not in d:
37
+ d = d.rstrip() + "\n\n" + SEC
38
+ p.write_text(d, encoding="utf-8")
39
+ print("§14.3 已补")
@@ -0,0 +1,43 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:在 app.asar 里找 compaction 的真实实现/接口(跳过索引条目)(可删)。"""
3
+ import glob
4
+
5
+ PATH = glob.glob("D:/*/resources/app.asar")[0]
6
+ NEEDLES = [b"compaction", b"compactS", b"autoCompact", b"requestContext()"]
7
+
8
+
9
+ def scan(needle, limit=6, ctx=520):
10
+ hits = 0
11
+ overlap = b""
12
+ with open(PATH, "rb") as f:
13
+ while True:
14
+ chunk = f.read(8 << 20)
15
+ if not chunk:
16
+ break
17
+ buf = overlap + chunk
18
+ start = 0
19
+ while hits < limit:
20
+ i = buf.find(needle, start)
21
+ if i < 0:
22
+ break
23
+ seg = buf[max(0, i - 200): i + ctx]
24
+ text = seg.decode("utf-8", "replace")
25
+ start = i + 1
26
+ # 跳过 asar 的文件索引(这类片段里有 integrity/offset 元数据)
27
+ if '"integrity"' in text or '"blockSize"' in text:
28
+ continue
29
+ if "sourceMappingURL" in text and len(text) < 300:
30
+ continue
31
+ print(f"--- {needle.decode()} ---")
32
+ print(text.replace("\x00", " ").strip()[:900])
33
+ print()
34
+ hits += 1
35
+ if hits >= limit:
36
+ return hits
37
+ overlap = buf[-len(needle) - 16:]
38
+ return hits
39
+
40
+
41
+ for n in NEEDLES:
42
+ got = scan(n)
43
+ print(f"[{n.decode()}] 有效命中 {got}\n")
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:把 B4 行标为已修(默认关闭)(可删)。"""
3
+ from pathlib import Path
4
+
5
+ p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
6
+ lines = p.read_text(encoding="utf-8").splitlines()
7
+ NEW = ("| B4 | **周期性风格摘要注入**:每 6 小时从近期对话算语气特征,自动生成紧凑注入提示 "
8
+ "| `persona suggest` 从**记忆**归纳候选特征,没有从**近期对话**实时提炼 "
9
+ "| ✅ **已修(默认关闭)**(2026-11-29):`style_check.hint()` 从近期回复提炼一句"
10
+ "`【语气】…`(平均句长/列表占比 + 具体建议),**6 小时缓存**(`config.style_hint_cache`);"
11
+ "注入侧只有 `config style_hint: true` 才追加(记 `rules` 段)。"
12
+ "**默认关闭**——属注入主链路改动,水位 >50% 时不该默认生效;实测默认关时注入包无该块 |")
13
+ hit = 0
14
+ for i, ln in enumerate(lines):
15
+ if ln.startswith("| B4 |"):
16
+ lines[i] = NEW
17
+ hit += 1
18
+ if hit != 1:
19
+ print("命中异常:", hit)
20
+ raise SystemExit(1)
21
+ p.write_text("\n".join(lines) + "\n", encoding="utf-8")
22
+ print("B4 已标已修")
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:README CLI 数 75→76 + SKILL 补 web 命令(可删)。"""
3
+ from pathlib import Path
4
+
5
+ ROOT = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
6
+
7
+ rp = ROOT / "README.md"
8
+ d = rp.read_text(encoding="utf-8")
9
+ n = d.count("75 个 CLI 命令")
10
+ rp.write_text(d.replace("75 个 CLI 命令", "76 个 CLI 命令"), encoding="utf-8")
11
+ print("README CLI 75→76 x", n)
12
+
13
+ sp = ROOT / "SKILL.md"
14
+ sd = sp.read_text(encoding="utf-8")
15
+ anchor = "python scripts/brain.py rss ingest --file feed.xml"
16
+ line = ('python scripts/brain.py web search "<关键词>" / web fetch <url> '
17
+ "# 联网调研(web_search 欠费时的备胎,Bing HTML)")
18
+ if "web search" not in sd and anchor in sd:
19
+ # 插到 rss 行之后
20
+ idx = sd.index(anchor)
21
+ end = sd.index("\n", idx)
22
+ sd = sd[:end + 1] + line + "\n" + sd[end + 1:]
23
+ sp.write_text(sd, encoding="utf-8")
24
+ print("SKILL.md 已补 web 行")
25
+ else:
26
+ print("SKILL.md 跳过(已有或找不到锚点)")
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+ """一次性:按 check_docs 的结果修正文档数字与命令名(§3 A)(可删)。"""
3
+ from pathlib import Path
4
+
5
+ ROOT = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
6
+
7
+ FIXES = {
8
+ "SKILL.md": [
9
+ ("# 17 项体检", "# 22 项体检"),
10
+ ],
11
+ "README.md": [
12
+ ("(13 项体检", "(22 项体检"),
13
+ ("**15 个页签**", "**16 个页签**"),
14
+ ("**设置页 29 项**", "**设置页 39 项**"),
15
+ ("**75 个 CLI 命令**", "**72 个 CLI 命令**"),
16
+ ("brain.py panel", "brain.py serve"),
17
+ ("设置页 29 项 / 分 6 组", "设置页 39 项 / 分 7 组"),
18
+ ("分 6 组", "分 7 组"),
19
+ ],
20
+ }
21
+
22
+ for rel, pairs in FIXES.items():
23
+ p = ROOT / rel
24
+ d = p.read_text(encoding="utf-8")
25
+ for old, new in pairs:
26
+ n = d.count(old)
27
+ if n:
28
+ d = d.replace(old, new)
29
+ print(f"{rel}: {old!r} → {new!r} ×{n}")
30
+ p.write_text(d, encoding="utf-8")
31
+
32
+ # 文档审查 B 里可当场核实的两条
33
+ p = ROOT / "SKILL.md"
34
+ d = p.read_text(encoding="utf-8")
35
+ old = "status --json # 水位唯一数据源(0/1=60%/2=75%/3=90%)"
36
+ if "--exit-code" not in old and "status --json" in d:
37
+ print("SKILL.md status 行保持原样(退出码需 --exit-code,已在文档里标明)")
38
+ print("完成")