lingshu-skill 5.33.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.
- package/CHANGELOG.md +4281 -4227
- package/README.md +1584 -1577
- package/SKILL-lite.md +59 -59
- package/SKILL-tiny.md +38 -38
- package/SKILL.md +356 -331
- package/assets/panel.html +6753 -5698
- package/cordis-plugin/lingshu-cron/plugin.js +1455 -1417
- package/cordis-plugin/lingshu-startup/context-fold.js +170 -0
- package/cordis-plugin/lingshu-startup/context-pressure.js +16 -0
- package/cordis-plugin/lingshu-startup/context-snapshot.js +176 -0
- package/cordis-plugin/lingshu-startup/plugin.js +499 -467
- 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
- 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
- package/docs/audit_notes//345/276/205/345/212/236/346/250/241/346/235/277.md +140 -0
- package/docs/commands.md +278 -247
- package/docs/mechanics.md +610 -610
- 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
- 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
- package/package.json +52 -52
- package/scripts/_scratch/_tmp_backup_race.py +70 -0
- package/scripts/_scratch/_tmp_cleanup_move.py +34 -0
- package/scripts/_scratch/_tmp_count_kinds.py +25 -0
- package/scripts/_scratch/_tmp_diag_paths.py +48 -0
- package/scripts/_scratch/_tmp_facts.py +63 -0
- package/scripts/_scratch/_tmp_find_copies.py +31 -0
- package/scripts/_scratch/_tmp_find_pin.py +29 -0
- package/scripts/_scratch/_tmp_fix_pin.py +36 -0
- package/scripts/_scratch/_tmp_fold_fixture.py +55 -0
- package/scripts/_scratch/_tmp_fold_test.mjs +81 -0
- package/scripts/_scratch/_tmp_inject_secs.py +30 -0
- package/scripts/_scratch/_tmp_kb_balance.py +159 -0
- package/scripts/_scratch/_tmp_lines.py +15 -0
- package/scripts/_scratch/_tmp_market_probe.py +13 -0
- package/scripts/_scratch/_tmp_move_partial.py +16 -0
- package/scripts/_scratch/_tmp_patch_b3.py +41 -0
- package/scripts/_scratch/_tmp_patch_b5.py +62 -0
- package/scripts/_scratch/_tmp_patch_crash_excl.py +24 -0
- package/scripts/_scratch/_tmp_patch_handoff.py +21 -0
- package/scripts/_scratch/_tmp_patch_ps1.py +25 -0
- package/scripts/_scratch/_tmp_patch_stat.py +27 -0
- package/scripts/_scratch/_tmp_patch_todo.py +25 -0
- package/scripts/_scratch/_tmp_patch_todo2.py +64 -0
- package/scripts/_scratch/_tmp_probe_session.py +51 -0
- package/scripts/_scratch/_tmp_style_probe.py +40 -0
- package/scripts/_scratch/_tmp_write_note.py +139 -0
- package/scripts/_scratch/_/346/235/245/346/272/220/350/256/260/345/275/225.txt +1 -0
- package/scripts/_scratch/asar_compaction/dsh-compaction-basic__lib__index.js +1044 -0
- package/scripts/_scratch/asar_compaction/dsh-compaction-tool-result-pruner__lib__index.js +194 -0
- package/scripts/_scratch/asar_compaction/dsh-compaction__lib__index.js +175 -0
- package/scripts/_scratch/asar_compaction/dsh-compaction__lib__types__tool-pairing.js +97 -0
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__image-offload.js +47 -0
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__index.js +40 -0
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__project-message.js +37 -0
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__brand.js +9 -0
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__checkpoint.js +36 -0
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__types.js +10 -0
- package/scripts/_scratch/commit_msg_occ.txt +16 -0
- package/scripts/_scratch/commit_msg_struct.txt +16 -0
- package/scripts/_scratch/v5.34_changelog.txt +36 -0
- package/scripts/_sync_trae_cn.py +102 -34
- package/scripts/_tmp_add_s10.py +54 -0
- package/scripts/_tmp_add_s11.py +61 -0
- package/scripts/_tmp_add_s12.py +66 -0
- package/scripts/_tmp_add_s13.py +69 -0
- package/scripts/_tmp_add_s14.py +80 -0
- package/scripts/_tmp_add_s9.py +68 -0
- package/scripts/_tmp_cache_load.py +82 -0
- package/scripts/_tmp_clean_market.py +40 -0
- package/scripts/_tmp_clean_pruned.py +81 -0
- package/scripts/_tmp_cleanup_docs.py +39 -0
- package/scripts/_tmp_cmp_ranker.py +17 -0
- package/scripts/_tmp_dolater_note.py +35 -0
- package/scripts/_tmp_dust_why.py +27 -0
- package/scripts/_tmp_explicit_import.py +40 -0
- package/scripts/_tmp_extract_compaction.py +35 -0
- package/scripts/_tmp_extract_compaction2.py +63 -0
- package/scripts/_tmp_extract_compaction3.py +51 -0
- package/scripts/_tmp_extract_compaction4.py +54 -0
- package/scripts/_tmp_finalize_s14.py +39 -0
- package/scripts/_tmp_find_compaction.py +43 -0
- package/scripts/_tmp_fix_b4.py +22 -0
- package/scripts/_tmp_fix_cli76.py +26 -0
- package/scripts/_tmp_fix_docs.py +38 -0
- package/scripts/_tmp_fix_docs_b.py +46 -0
- package/scripts/_tmp_fix_docs_b2.py +22 -0
- package/scripts/_tmp_fix_i3.py +23 -0
- package/scripts/_tmp_fix_s10.py +83 -0
- package/scripts/_tmp_fix_s11.py +14 -0
- package/scripts/_tmp_fix_s9_status.py +19 -0
- package/scripts/_tmp_fix_shadow_sim.py +37 -0
- package/scripts/_tmp_fix_traits_value.py +41 -0
- package/scripts/_tmp_import_idem.py +106 -0
- package/scripts/_tmp_log_ack.py +45 -0
- package/scripts/_tmp_mark_batch.py +28 -0
- package/scripts/_tmp_mark_batch2.py +32 -0
- package/scripts/_tmp_mark_dolater.py +26 -0
- package/scripts/_tmp_mark_dolater2.py +31 -0
- package/scripts/_tmp_move_self.py +16 -0
- package/scripts/_tmp_occ_cli.py +22 -0
- package/scripts/_tmp_occ_link.py +108 -0
- package/scripts/_tmp_optimize_recall.py +54 -0
- package/scripts/_tmp_panel_audit.py +26 -0
- package/scripts/_tmp_patch_batch3.py +65 -0
- package/scripts/_tmp_patch_rrf.py +46 -0
- package/scripts/_tmp_patch_s2s3.py +80 -0
- package/scripts/_tmp_patch_s4.py +39 -0
- package/scripts/_tmp_patch_s7.py +43 -0
- package/scripts/_tmp_patch_s8.py +91 -0
- package/scripts/_tmp_patch_skill.py +17 -0
- package/scripts/_tmp_release_guard.py +57 -0
- package/scripts/_tmp_rerank_breaker.py +62 -0
- package/scripts/_tmp_s16.py +41 -0
- package/scripts/_tmp_scan_asar.py +41 -0
- package/scripts/_tmp_scan_asar2.py +37 -0
- package/scripts/_tmp_struct_docs.py +49 -0
- package/scripts/_tmp_sum_fallback.py +42 -0
- package/scripts/_tmp_sweep.py +81 -0
- package/scripts/_tmp_sync_check.py +69 -0
- package/scripts/_tmp_sync_tail.py +39 -0
- package/scripts/_tmp_todo_clean.py +67 -0
- package/scripts/_tmp_verify_copy.py +17 -0
- package/scripts/_tmp_wire_extras.py +93 -0
- package/scripts/_tmp_wire_hsum.py +34 -0
- package/scripts/_tmp_wire_occ_b5.py +40 -0
- package/scripts/_tmp_wire_ranker.py +13 -0
- package/scripts/_tmp_wire_shadow_timeline.py +45 -0
- package/scripts/anchor_retention.py +68 -0
- package/scripts/app_context.py +1160 -0
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +38 -22
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +4281 -4227
- package/scripts/astrbot_plugin_lingshu/engine/README.md +1584 -1577
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +59 -59
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +38 -38
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +356 -331
- package/scripts/astrbot_plugin_lingshu/engine/assets/panel.html +6753 -5698
- package/scripts/astrbot_plugin_lingshu/engine/docs/commands.md +278 -247
- package/scripts/astrbot_plugin_lingshu/engine/docs/mechanics.md +610 -610
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_sync_trae_cn.py +102 -34
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s10.py +54 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s11.py +61 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s12.py +66 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s13.py +69 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s14.py +80 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s9.py +68 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cache_load.py +82 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_market.py +40 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_pruned.py +81 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cleanup_docs.py +39 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cmp_ranker.py +17 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dolater_note.py +35 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dust_why.py +27 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_explicit_import.py +40 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction.py +35 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction2.py +63 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction3.py +51 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction4.py +54 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_finalize_s14.py +39 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_find_compaction.py +43 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_b4.py +22 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_cli76.py +26 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs.py +38 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b.py +46 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b2.py +22 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_i3.py +23 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s10.py +83 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s11.py +14 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s9_status.py +19 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_shadow_sim.py +37 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_traits_value.py +41 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_import_idem.py +106 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_log_ack.py +45 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch.py +28 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch2.py +32 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater.py +26 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater2.py +31 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_move_self.py +16 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_cli.py +22 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_link.py +108 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_optimize_recall.py +54 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_panel_audit.py +26 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_batch3.py +65 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_rrf.py +46 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s2s3.py +80 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s4.py +39 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s7.py +43 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s8.py +91 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_skill.py +17 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_release_guard.py +57 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_rerank_breaker.py +62 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_s16.py +41 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar.py +41 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar2.py +37 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_struct_docs.py +49 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sum_fallback.py +42 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sweep.py +81 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_check.py +69 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_tail.py +39 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_todo_clean.py +67 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_verify_copy.py +17 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_extras.py +93 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_hsum.py +34 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_occ_b5.py +40 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_ranker.py +13 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_shadow_timeline.py +45 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/anchor_retention.py +68 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/app_context.py +1160 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/bigfive.py +90 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/brain.py +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/check_docs.py +191 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/cli.py +921 -86
- package/scripts/astrbot_plugin_lingshu/engine/scripts/core.py +2468 -2406
- package/scripts/astrbot_plugin_lingshu/engine/scripts/coverage_report.py +5 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/delivery.py +112 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/dream.py +41 -3
- package/scripts/astrbot_plugin_lingshu/engine/scripts/emotion.py +202 -23
- package/scripts/astrbot_plugin_lingshu/engine/scripts/gap_memory.py +186 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +72 -8
- package/scripts/astrbot_plugin_lingshu/engine/scripts/hsum.py +206 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/mem_score.py +92 -7
- package/scripts/astrbot_plugin_lingshu/engine/scripts/memory.py +530 -60
- package/scripts/astrbot_plugin_lingshu/engine/scripts/memory_extras.py +200 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/occ.py +190 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +232 -142
- package/scripts/astrbot_plugin_lingshu/engine/scripts/persona.py +2498 -2349
- package/scripts/astrbot_plugin_lingshu/engine/scripts/prepublish_tests.py +90 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/release.py +326 -287
- package/scripts/astrbot_plugin_lingshu/engine/scripts/rss_ingest.py +181 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/session_import.py +832 -764
- package/scripts/astrbot_plugin_lingshu/engine/scripts/shadow_memory.py +173 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/style_check.py +220 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/summarizer.py +343 -252
- package/scripts/astrbot_plugin_lingshu/engine/scripts/timeline.py +118 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/watchdog.py +110 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/web_research.py +125 -0
- package/scripts/bigfive.py +90 -0
- package/scripts/brain.py +1 -1
- package/scripts/check_docs.py +191 -0
- package/scripts/cli.py +921 -86
- package/scripts/core.py +2468 -2406
- package/scripts/coverage_report.py +5 -0
- package/scripts/delivery.py +112 -0
- package/scripts/dream.py +41 -3
- package/scripts/emotion.py +202 -23
- package/scripts/gap_memory.py +186 -0
- package/scripts/growth.py +72 -8
- package/scripts/hsum.py +206 -0
- package/scripts/mem_score.py +92 -7
- package/scripts/memory.py +530 -60
- package/scripts/memory_extras.py +200 -0
- package/scripts/occ.py +190 -0
- package/scripts/panel_server.py +232 -142
- package/scripts/persona.py +2498 -2349
- package/scripts/prepublish_tests.py +90 -0
- package/scripts/release.py +326 -287
- package/scripts/rss_ingest.py +181 -0
- package/scripts/run_tests.py +13 -0
- package/scripts/session_import.py +832 -764
- package/scripts/shadow_memory.py +173 -0
- package/scripts/style_check.py +220 -0
- package/scripts/summarizer.py +343 -252
- package/scripts/timeline.py +118 -0
- package/scripts/update_dsh_copy.ps1 +110 -107
- package/scripts/watchdog.py +110 -0
- package/scripts/web_research.py +125 -0
- package/docs//344/272/244/346/216/245/347/254/224/350/256/260-20261128.md +0 -128
- package/docs//345/256/241/346/240/270/346/224/271/350/277/233/345/276/205/345/212/236.md +0 -408
|
@@ -0,0 +1,93 @@
|
|
|
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")
|
|
@@ -0,0 +1,34 @@
|
|
|
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")
|
|
@@ -0,0 +1,40 @@
|
|
|
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")
|
|
@@ -0,0 +1,13 @@
|
|
|
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, "处")
|
|
@@ -0,0 +1,45 @@
|
|
|
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")
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""信息保留率度量(§2 do-now #1)。
|
|
4
|
+
|
|
5
|
+
问题:做梦合并/蒸馏之后**丢了什么完全无法量化**——`dream verify` 只抽 3 组人工看,
|
|
6
|
+
还是首/中/尾均匀抽样,不是风险抽样。于是调梦阈值、换摘要器、加层级全是盲调。
|
|
7
|
+
|
|
8
|
+
做法:抽"硬锚"(数字、版本号、路径、日期、否定/强制词、引号实体),
|
|
9
|
+
算 `保留率 = 留在新文本里的锚 / 源文本的锚`,按类别给明细。写进梦报,低于阈值告警。
|
|
10
|
+
|
|
11
|
+
命令行:
|
|
12
|
+
python scripts/brain.py retention "<源文本>" "<新文本>"
|
|
13
|
+
"""
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import re
|
|
17
|
+
|
|
18
|
+
PATTERNS = {
|
|
19
|
+
"number": r"\d+(?:\.\d+)?",
|
|
20
|
+
"version": r"\bv?\d+\.\d+(?:\.\d+)?\b",
|
|
21
|
+
"path": r"(?:[A-Za-z]:\\[^\s,。;))\"']+|~/[^\s,。;))\"']+|/[\w.\-]+/[\w.\-/]+)",
|
|
22
|
+
"date": r"\d{4}[-/]\d{1,2}[-/]\d{1,2}|\d{1,2}[-/]\d{1,2}",
|
|
23
|
+
}
|
|
24
|
+
KEYWORDS = ("不要", "不能", "不许", "别", "禁止", "务必", "必须", "只能", "绝不", "永远")
|
|
25
|
+
QUOTED = re.compile(r"[「『\"“](.{2,40}?)[」』\"”]")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def anchors(text: str) -> dict:
|
|
29
|
+
"""把文本里的硬锚按类别抽出来(去掉空白、去重、保序)。"""
|
|
30
|
+
t = str(text or "")
|
|
31
|
+
out: dict = {}
|
|
32
|
+
for name, pat in PATTERNS.items():
|
|
33
|
+
vals = [m.group(0).strip() for m in re.finditer(pat, t)]
|
|
34
|
+
out[name] = list(dict.fromkeys(v for v in vals if v))
|
|
35
|
+
out["keyword"] = [k for k in KEYWORDS if k in t]
|
|
36
|
+
out["quoted"] = list(dict.fromkeys(q.strip() for q in QUOTED.findall(t) if q.strip()))
|
|
37
|
+
return {k: v for k, v in out.items() if v}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def compare(src: str, dst: str) -> dict:
|
|
41
|
+
"""源文本的锚有多少留在了新文本里。返回 {by_kind, total, kept, rate, missing}。"""
|
|
42
|
+
a_src, a_dst = anchors(src), anchors(dst)
|
|
43
|
+
dst_text = str(dst or "")
|
|
44
|
+
by_kind, missing = {}, []
|
|
45
|
+
total = kept = 0
|
|
46
|
+
for kind, vals in a_src.items():
|
|
47
|
+
hit = 0
|
|
48
|
+
for v in vals:
|
|
49
|
+
if v in dst_text:
|
|
50
|
+
hit += 1
|
|
51
|
+
else:
|
|
52
|
+
missing.append({"kind": kind, "value": v})
|
|
53
|
+
total += len(vals)
|
|
54
|
+
kept += hit
|
|
55
|
+
by_kind[kind] = {"src": len(vals), "kept": hit,
|
|
56
|
+
"rate": round(hit / len(vals), 3) if vals else 1.0}
|
|
57
|
+
return {"by_kind": by_kind, "total": total, "kept": kept,
|
|
58
|
+
"rate": round(kept / total, 3) if total else 1.0,
|
|
59
|
+
"missing": missing[:20]}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def render(d: dict) -> list[str]:
|
|
63
|
+
lines = [f"硬锚保留率:{d['kept']}/{d['total']} = {d['rate']:.1%}"]
|
|
64
|
+
for kind, v in (d.get("by_kind") or {}).items():
|
|
65
|
+
lines.append(f" {kind:<9} {v['kept']}/{v['src']}({v['rate']:.0%})")
|
|
66
|
+
if d.get("missing"):
|
|
67
|
+
lines.append(" 丢掉的锚:" + "、".join(f"{m['value']}" for m in d["missing"][:8]))
|
|
68
|
+
return lines
|