mindforge-memory 6.5.9__tar.gz → 6.5.11__tar.gz

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 (148) hide show
  1. {mindforge_memory-6.5.9/mindforge_memory.egg-info → mindforge_memory-6.5.11}/PKG-INFO +9 -9
  2. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/README.md +8 -8
  3. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/core/query.py +68 -19
  4. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/core/version.py +2 -2
  5. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/knowledge_graph.py +2 -1
  6. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11/mindforge_memory.egg-info}/PKG-INFO +9 -9
  7. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v568_fixes.py +1 -1
  8. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v575_release_consistency.py +2 -2
  9. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v612_fixes.py +2 -2
  10. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v643_fixes.py +1 -1
  11. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v645_fixes.py +1 -1
  12. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v646_fixes.py +1 -1
  13. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v649_fixes.py +2 -2
  14. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v657_six_path.py +66 -7
  15. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/LICENSE +0 -0
  16. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/MindForge.py +0 -0
  17. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/__init__.py +0 -0
  18. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/adapters/__init__.py +0 -0
  19. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/adapters/claude_adapter.py +0 -0
  20. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/adapters/crewai_memory.py +0 -0
  21. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/adapters/generic_api.py +0 -0
  22. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/adapters/langgraph_store.py +0 -0
  23. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/adapters/openclaw_adapter.py +0 -0
  24. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/api/__init__.py +0 -0
  25. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/api/server.py +0 -0
  26. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/cli/__init__.py +0 -0
  27. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/cli/main.py +0 -0
  28. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/core/__init__.py +0 -0
  29. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/core/embedding.py +0 -0
  30. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/core/encryption.py +0 -0
  31. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/core/indexer.py +0 -0
  32. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/core/mindforge.py +0 -0
  33. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/core/paths.py +0 -0
  34. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/core/storage.py +0 -0
  35. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/core/types.py +0 -0
  36. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/daemon/__init__.py +0 -0
  37. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/daemon/server.py +0 -0
  38. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/mcp/__init__.py +0 -0
  39. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/mcp/server.py +0 -0
  40. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/__init__.py +0 -0
  41. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/categorizer.py +0 -0
  42. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/conflict_detector.py +0 -0
  43. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/connectors.py +0 -0
  44. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/context_window.py +0 -0
  45. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/event_bus.py +0 -0
  46. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/evolution.py +0 -0
  47. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/experience.py +0 -0
  48. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/federated.py +0 -0
  49. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/federated_acl.py +0 -0
  50. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/follow_up.py +0 -0
  51. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/hybrid_search.py +0 -0
  52. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/importer.py +0 -0
  53. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/integrator.py +0 -0
  54. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/intent_router.py +0 -0
  55. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/memory_compressor.py +0 -0
  56. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/memory_decay.py +0 -0
  57. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/memory_passport.py +0 -0
  58. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/multi_agent.py +0 -0
  59. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/multimodal.py +0 -0
  60. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/outcome_learning.py +0 -0
  61. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/personality.py +0 -0
  62. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/principled_forgetting.py +0 -0
  63. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/privacy.py +0 -0
  64. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/recall.py +0 -0
  65. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/session_focus.py +0 -0
  66. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/share_conflict.py +0 -0
  67. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/skill_extractor.py +0 -0
  68. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/skill_pack.py +0 -0
  69. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/timeline_viz.py +0 -0
  70. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge/modules/v6.py +0 -0
  71. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge_memory.egg-info/SOURCES.txt +0 -0
  72. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge_memory.egg-info/dependency_links.txt +0 -0
  73. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge_memory.egg-info/entry_points.txt +0 -0
  74. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge_memory.egg-info/requires.txt +0 -0
  75. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/mindforge_memory.egg-info/top_level.txt +0 -0
  76. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/pyproject.toml +0 -0
  77. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/setup.cfg +0 -0
  78. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/setup.py +0 -0
  79. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_core.py +0 -0
  80. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_security_hardening.py +0 -0
  81. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_trash_hard_delete.py +0 -0
  82. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v546_features.py +0 -0
  83. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v547_fixes.py +0 -0
  84. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v548_features.py +0 -0
  85. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v550_features.py +0 -0
  86. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v552_features.py +0 -0
  87. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v554_features.py +0 -0
  88. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v556_features.py +0 -0
  89. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v557_banner_insight_wal.py +0 -0
  90. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v557_security_fixes.py +0 -0
  91. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v557_webhook_sig_export.py +0 -0
  92. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v558_audit_fixes.py +0 -0
  93. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v558_features.py +0 -0
  94. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v560_decay_gc.py +0 -0
  95. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v560_kdf_versioning.py +0 -0
  96. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v560_module_coverage.py +0 -0
  97. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v561_security.py +0 -0
  98. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v562_p2_fixes.py +0 -0
  99. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v563_entry_coverage.py +0 -0
  100. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v563_perf_fixes.py +0 -0
  101. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v565_security.py +0 -0
  102. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v566_encrypted_search.py +0 -0
  103. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v567_security_fixes.py +0 -0
  104. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v569_fts_sync.py +0 -0
  105. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v570_coverage_expansion.py +0 -0
  106. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v570_drama_and_utils.py +0 -0
  107. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v570_encrypted_fallback.py +0 -0
  108. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v571_fixes.py +0 -0
  109. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v572_security.py +0 -0
  110. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v573_encrypted_export.py +0 -0
  111. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v573_security.py +0 -0
  112. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v576_bitemporal.py +0 -0
  113. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v576_gdpr.py +0 -0
  114. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v577_agent_governance.py +0 -0
  115. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v578_embedding.py +0 -0
  116. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v579_graph.py +0 -0
  117. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v580_experience.py +0 -0
  118. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v5812_bugfixes.py +0 -0
  119. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v583_security.py +0 -0
  120. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v584_adapters.py +0 -0
  121. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v585_benchmark.py +0 -0
  122. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v586_federated_mcp.py +0 -0
  123. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v590_features.py +0 -0
  124. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v592_features.py +0 -0
  125. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v593_features.py +0 -0
  126. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v595_features.py +0 -0
  127. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v600_forgetting_followup.py +0 -0
  128. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v600_import_timeline.py +0 -0
  129. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v600_multi_agent_formal.py +0 -0
  130. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v600_outcome_passport.py +0 -0
  131. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v600_skillpack_evolution.py +0 -0
  132. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v611_fixes.py +0 -0
  133. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v612_cascade_fixes.py +0 -0
  134. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v613_integrity.py +0 -0
  135. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v620_growth_governance.py +0 -0
  136. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v630_search_explain.py +0 -0
  137. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v631_scrypt.py +0 -0
  138. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v632_explain_interfaces.py +0 -0
  139. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v635_features.py +0 -0
  140. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v635_integration.py +0 -0
  141. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v636_fixes.py +0 -0
  142. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v648_fixes.py +0 -0
  143. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v652_context_expansion.py +0 -0
  144. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v654_search_multi.py +0 -0
  145. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v655_temporal_norm.py +0 -0
  146. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v656_security.py +0 -0
  147. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v65_features.py +0 -0
  148. {mindforge_memory-6.5.9 → mindforge_memory-6.5.11}/tests/test_v6_ports.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mindforge-memory
3
- Version: 6.5.9
3
+ Version: 6.5.11
4
4
  Summary: AI Agent 终身记忆系统 - 四层记忆架构 · 知识图谱 · 多模态支持
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/opok-ops/MindForge
@@ -36,13 +36,13 @@ Dynamic: license-file
36
36
 
37
37
  MindForge gives AI agents a persistent, structured long-term memory: a four-tier lifecycle model, knowledge graphs, hybrid retrieval, end-to-end encryption, and MCP / CLI / REST interfaces. All data stays on your machine.
38
38
 
39
- > **The story** — one developer, seven months, from v1.0 (March 2026) to v6.5.9: no team, no funding, 1,305 passing tests. [Read the journey →](https://opok-ops.github.io/MindForge/#developer)
39
+ > **The story** — one developer, seven months, from v1.0 (March 2026) to v6.5.11: no team, no funding, 1,305 passing tests. [Read the journey →](https://opok-ops.github.io/MindForge/#developer)
40
40
  >
41
- > *Timeline note (v6.5.9):* "seven months" counts from project start (2026-03, pre-git prototyping era). Git history begins 2026-07-17 with the v5.7.x repository consolidation — earlier code lived outside this repo. The 416+ commits reflect consolidated history only.
41
+ > *Timeline note (v6.5.11):* "seven months" counts from project start (2026-03, pre-git prototyping era). Git history begins 2026-07-17 with the v5.7.x repository consolidation — earlier code lived outside this repo. The 416+ commits reflect consolidated history only.
42
42
 
43
43
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
44
44
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
45
- [![Version](https://img.shields.io/badge/version-6.5.9-green.svg)](https://github.com/opok-ops/MindForge/releases)
45
+ [![Version](https://img.shields.io/badge/version-6.5.11-green.svg)](https://github.com/opok-ops/MindForge/releases)
46
46
  [![Stars](https://img.shields.io/github/stars/opok-ops/MindForge.svg)](https://github.com/opok-ops/MindForge/stargazers)
47
47
  [![Forks](https://img.shields.io/github/forks/opok-ops/MindForge.svg)](https://github.com/opok-ops/MindForge/forks)
48
48
  [![Open Issues](https://img.shields.io/github/issues/opok-ops/MindForge.svg)](https://github.com/opok-ops/MindForge/issues)
@@ -108,15 +108,15 @@ MindForge stats
108
108
  - **Ten-million-character library, millisecond-class across all query types (v6.4.9)**: pathological 218→**0.4ms** (−99.8%), mixed 143→**3.0ms** (−98%), rare 6.8ms, combined 17.8ms (100k full-pipeline, clean environment). The last bottleneck — FTS5 high-frequency-phrase bm25 scoring — is now pruned query-side via trigram-df pre-check (df upper bound = min trigram df, pruned at 5% corpus size, symmetric to the TF-IDF max_df design; df served from an in-process cache — fts5vocab is a streaming virtual table, per-term probes scan it fully).
109
109
  - **Index-blindness fix (v6.4.8)**: TF-IDF vocabulary was locked to the first 5 documents since v6.4.6 — incremental adds indexed as empty vectors (TF-IDF effectively half-dead; previous numbers carried by FTS5/fuzzy). Fixed with incremental vocabulary growth; all pipeline numbers above are now *true full-pipeline* measurements.
110
110
  - Retrieval quality (fixed-seed, `benchmarks/quality_bench.py`, 2k entries): needle Recall@1 = 1.0, MRR = 1.0, topic Recall@1 = 1.0, noise false-recall = 0.
111
- - **LoCoMo full-suite, LLM-judged (v6.5.9, 2026-11-13)**: 1,986 questions across all 10 conversations — **51.5% accuracy (≥9/10 judge score)**, 2.13× over the 24.2% pre-assembly baseline; cross-validated by two independent judges (DeepSeek 51.5% / Kimi K3.1 52.72%, Δ1.2pt); excluding the adversarial "should-refuse" bucket, **43.05%** (663/1540). Per-bucket: adversarial 93.9%, single-hop 57.8%, multi-hop 25.2%, temporal 9.6%, open-domain 10.4% — temporal evidence recall and two-hop chain retrieval are the named v6.6 targets. Data: `benchmarks/results/`, judge pipeline in `benchmarks/`.
111
+ - **LoCoMo full-suite, LLM-judged (v6.5.11, 2026-11-13)**: 1,986 questions across all 10 conversations — **51.5% accuracy (≥9/10 judge score)**, 2.13× over the 24.2% pre-assembly baseline; cross-validated by two independent judges (DeepSeek 51.5% / Kimi K3.1 52.72%, Δ1.2pt); excluding the adversarial "should-refuse" bucket, **43.05%** (663/1540). Per-bucket: adversarial 93.9%, single-hop 57.8%, multi-hop 25.2%, temporal 9.6%, open-domain 10.4% — temporal evidence recall and two-hop chain retrieval are the named v6.6 targets. Data: `benchmarks/results/`, judge pipeline in `benchmarks/`.
112
112
  - LongMemEval — interface ready, not yet run (requires external LLM API key).
113
113
  - TF-IDF degraded mode process memory at 100k: ~700 MB. Index LRU cap: 100,000 docs (MINDFORGE_INDEX_MAX_DOCS).
114
114
 
115
115
  ## What's New
116
116
 
117
- v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,300+ tests**.
117
+ v6.1.3 – v6.5.11 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,300+ tests**.
118
118
 
119
- - **v6.5.9 — security fix pack from dual-judge external review** (2026-11-14). Qwen4-Max (Doubao) and Kimi K3.1 independently reviewed the codebase; their overlapping findings became this release. (1) **GDPR erasure completed**: `gdpr_erase_all` now cascades to 17 tables — added `knowledge_graph` entities, `memory_snapshots`, `memory_templates`, and the four drama_* creation-content tables that previously survived erasure (the "right to be forgotten" had a real gap). (2) **Legacy key-file verification fixed**: v5.5-era key files (no `verify_blob`) previously accepted *any* password during `rekey` — a wrong old password could rewrite the key file and orphan all data. Rekey now probe-decrypts a real ciphertext from the store; empty stores fall back to the old behavior. (3) **KDF cost floor**: `KDFParams.from_dict` rejects tampered parameters (PBKDF2 < 60k, scrypt N < 4096) that would downgrade brute-force cost — key files and ciphertext headers are attacker-visible input. (4) **Compression × encryption unblocked**: `compress_memories` previously raised `SecurityError` on encrypted stores, making the two flagship features mutually exclusive by default. Compression now hydrates its TF-IDF index via the same in-memory decryption path as `fuzzy_search` (`_plaintext_for_index`) — plaintext never touches disk or FTS5. (5) **Interface matrix completed**: REST gains `/api/gdpr/report`, `/api/gdpr/export`, `/api/gdpr/erase` (confirm=true required), `/api/compress`, `/api/compressions`; MCP gains `gdpr_report`, `gdpr_erase` (confirm required), `memory_compress` — 87→90 tools, all three interfaces now expose the full governance surface. (6) **Honesty fixes**: README previously claimed "six-way hybrid search"; the actual retrieval count is four (vector/FTS5/TF-IDF/fuzzy) — wording corrected, and the cross-encoder/heuristic distinction is now explicit. LoCoMo full-suite results (51.5%, dual-judge) added to the benchmarks section. 7+ new contract tests (`tests/test_v656_security.py`).
119
+ - **v6.5.11 — security fix pack from dual-judge external review** (2026-11-14). Qwen4-Max (Doubao) and Kimi K3.1 independently reviewed the codebase; their overlapping findings became this release. (1) **GDPR erasure completed**: `gdpr_erase_all` now cascades to 17 tables — added `knowledge_graph` entities, `memory_snapshots`, `memory_templates`, and the four drama_* creation-content tables that previously survived erasure (the "right to be forgotten" had a real gap). (2) **Legacy key-file verification fixed**: v5.5-era key files (no `verify_blob`) previously accepted *any* password during `rekey` — a wrong old password could rewrite the key file and orphan all data. Rekey now probe-decrypts a real ciphertext from the store; empty stores fall back to the old behavior. (3) **KDF cost floor**: `KDFParams.from_dict` rejects tampered parameters (PBKDF2 < 60k, scrypt N < 4096) that would downgrade brute-force cost — key files and ciphertext headers are attacker-visible input. (4) **Compression × encryption unblocked**: `compress_memories` previously raised `SecurityError` on encrypted stores, making the two flagship features mutually exclusive by default. Compression now hydrates its TF-IDF index via the same in-memory decryption path as `fuzzy_search` (`_plaintext_for_index`) — plaintext never touches disk or FTS5. (5) **Interface matrix completed**: REST gains `/api/gdpr/report`, `/api/gdpr/export`, `/api/gdpr/erase` (confirm=true required), `/api/compress`, `/api/compressions`; MCP gains `gdpr_report`, `gdpr_erase` (confirm required), `memory_compress` — 87→90 tools, all three interfaces now expose the full governance surface. (6) **Honesty fixes**: README previously claimed "six-way hybrid search"; the actual retrieval count is four (vector/FTS5/TF-IDF/fuzzy) — wording corrected, and the cross-encoder/heuristic distinction is now explicit. LoCoMo full-suite results (51.5%, dual-judge) added to the benchmarks section. 7+ new contract tests (`tests/test_v656_security.py`).
120
120
 
121
121
  - **v6.4.9 — ten-million-char library at millisecond latency: FTS5 high-frequency-phrase scoring pruned** (2026-11-11). The last honest bottleneck from v6.4.8's ledger. Root cause (30k per-path timing): under the trigram tokenizer, corpus-wide phrases (template data's "陈述性记忆") match every row — bm25 full-match scoring cost 50.5ms/query, the dominant remainder of 100k mixed latency. Fix, query-side df pre-pruning symmetric to TF-IDF max_df: a phrase's df upper bound = min df of its trigrams (phrase matches ⊆ every trigram's row set); prune at 5% of corpus size; keep the lowest-ub phrase if all pruned. df is served from an in-process cache keyed by `max(rowid)` (add/update invalidate; hard-delete leaves df slightly stale = prunes more conservatively) — **two real pitfalls found en route: fts5vocab is a *streaming virtual table* — per-term probes AND `IN` batches trigger full scans (combined regressed 17→45ms before the cache)**. Plus: FTS5 path skipped on pathological fallback (no discriminating signal). Clean-environment 100k re-bench: pathological 122→**0.4ms** (−99.7%), mixed 134.9→**3.0ms** (−98%), all query types millisecond-class at ~10M chars. AI-flavored comment cleanup (essay-style docstrings → engineer-speak, info preserved). 5 new guards.
122
122
 
@@ -149,7 +149,7 @@ v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,30
149
149
 
150
150
  **Retrieval**
151
151
 
152
- - **Six-way hybrid retrieval (real, as of v6.5.9)** — six recall paths fused into one ranked result set: vector, FTS5, TF-IDF, fuzzy (the four core paths, RRF-style max-fusion with per-path score breakdown via `search --explain`), **temporal anchoring** (query absolute dates / anchored relative phrases → windowed SQL recall; v6.5.9) and **knowledge-graph adjacency** (entity match → 2-hop relation walk → memory back-references; v6.5.9). Paths 5-6 run in "blind-spot fill" mode — they only add candidates the four core paths missed, never re-rank existing high-quality hits. Degradation is per-path and safe: encrypted stores skip temporal (ciphertext is not SQL-matchable), empty KG skips graph, missing time anchor degrades to absolute-date-only.
152
+ - **Six-way hybrid retrieval (real, as of v6.5.11)** — six recall paths fused into one ranked result set: vector, FTS5, TF-IDF, fuzzy (the four core paths, RRF-style max-fusion with per-path score breakdown via `search --explain`), **temporal anchoring** (query absolute dates / anchored relative phrases → windowed SQL recall; v6.5.11) and **knowledge-graph adjacency** (entity match → 2-hop relation walk → memory back-references; v6.5.11). Paths 5-6 run in "blind-spot fill" mode — they only add candidates the four core paths missed, never re-rank existing high-quality hits. Degradation is per-path and safe: encrypted stores skip temporal (ciphertext is not SQL-matchable), empty KG skips graph, missing time anchor degrades to absolute-date-only.
153
153
  - **Knowledge graph** — automatic entity and relation extraction, path finding, and associative recall.
154
154
  - **Weighted recall** — multi-factor scoring (coverage, importance, access frequency, time decay) instead of similarity alone.
155
155
 
@@ -193,7 +193,7 @@ v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,30
193
193
 
194
194
  ```
195
195
  ┌──────────────────────────────────────────────────────┐
196
- │ MindForge v6.5.9 │
196
+ │ MindForge v6.5.11 │
197
197
  │ Cognitive Layer Personality · KnowledgeGraph │
198
198
  │ MemoryEvolution · FederatedMemory │
199
199
  ├──────────────────────────────────────────────────────┤
@@ -6,13 +6,13 @@
6
6
 
7
7
  MindForge gives AI agents a persistent, structured long-term memory: a four-tier lifecycle model, knowledge graphs, hybrid retrieval, end-to-end encryption, and MCP / CLI / REST interfaces. All data stays on your machine.
8
8
 
9
- > **The story** — one developer, seven months, from v1.0 (March 2026) to v6.5.9: no team, no funding, 1,305 passing tests. [Read the journey →](https://opok-ops.github.io/MindForge/#developer)
9
+ > **The story** — one developer, seven months, from v1.0 (March 2026) to v6.5.11: no team, no funding, 1,305 passing tests. [Read the journey →](https://opok-ops.github.io/MindForge/#developer)
10
10
  >
11
- > *Timeline note (v6.5.9):* "seven months" counts from project start (2026-03, pre-git prototyping era). Git history begins 2026-07-17 with the v5.7.x repository consolidation — earlier code lived outside this repo. The 416+ commits reflect consolidated history only.
11
+ > *Timeline note (v6.5.11):* "seven months" counts from project start (2026-03, pre-git prototyping era). Git history begins 2026-07-17 with the v5.7.x repository consolidation — earlier code lived outside this repo. The 416+ commits reflect consolidated history only.
12
12
 
13
13
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
14
14
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
15
- [![Version](https://img.shields.io/badge/version-6.5.9-green.svg)](https://github.com/opok-ops/MindForge/releases)
15
+ [![Version](https://img.shields.io/badge/version-6.5.11-green.svg)](https://github.com/opok-ops/MindForge/releases)
16
16
  [![Stars](https://img.shields.io/github/stars/opok-ops/MindForge.svg)](https://github.com/opok-ops/MindForge/stargazers)
17
17
  [![Forks](https://img.shields.io/github/forks/opok-ops/MindForge.svg)](https://github.com/opok-ops/MindForge/forks)
18
18
  [![Open Issues](https://img.shields.io/github/issues/opok-ops/MindForge.svg)](https://github.com/opok-ops/MindForge/issues)
@@ -78,15 +78,15 @@ MindForge stats
78
78
  - **Ten-million-character library, millisecond-class across all query types (v6.4.9)**: pathological 218→**0.4ms** (−99.8%), mixed 143→**3.0ms** (−98%), rare 6.8ms, combined 17.8ms (100k full-pipeline, clean environment). The last bottleneck — FTS5 high-frequency-phrase bm25 scoring — is now pruned query-side via trigram-df pre-check (df upper bound = min trigram df, pruned at 5% corpus size, symmetric to the TF-IDF max_df design; df served from an in-process cache — fts5vocab is a streaming virtual table, per-term probes scan it fully).
79
79
  - **Index-blindness fix (v6.4.8)**: TF-IDF vocabulary was locked to the first 5 documents since v6.4.6 — incremental adds indexed as empty vectors (TF-IDF effectively half-dead; previous numbers carried by FTS5/fuzzy). Fixed with incremental vocabulary growth; all pipeline numbers above are now *true full-pipeline* measurements.
80
80
  - Retrieval quality (fixed-seed, `benchmarks/quality_bench.py`, 2k entries): needle Recall@1 = 1.0, MRR = 1.0, topic Recall@1 = 1.0, noise false-recall = 0.
81
- - **LoCoMo full-suite, LLM-judged (v6.5.9, 2026-11-13)**: 1,986 questions across all 10 conversations — **51.5% accuracy (≥9/10 judge score)**, 2.13× over the 24.2% pre-assembly baseline; cross-validated by two independent judges (DeepSeek 51.5% / Kimi K3.1 52.72%, Δ1.2pt); excluding the adversarial "should-refuse" bucket, **43.05%** (663/1540). Per-bucket: adversarial 93.9%, single-hop 57.8%, multi-hop 25.2%, temporal 9.6%, open-domain 10.4% — temporal evidence recall and two-hop chain retrieval are the named v6.6 targets. Data: `benchmarks/results/`, judge pipeline in `benchmarks/`.
81
+ - **LoCoMo full-suite, LLM-judged (v6.5.11, 2026-11-13)**: 1,986 questions across all 10 conversations — **51.5% accuracy (≥9/10 judge score)**, 2.13× over the 24.2% pre-assembly baseline; cross-validated by two independent judges (DeepSeek 51.5% / Kimi K3.1 52.72%, Δ1.2pt); excluding the adversarial "should-refuse" bucket, **43.05%** (663/1540). Per-bucket: adversarial 93.9%, single-hop 57.8%, multi-hop 25.2%, temporal 9.6%, open-domain 10.4% — temporal evidence recall and two-hop chain retrieval are the named v6.6 targets. Data: `benchmarks/results/`, judge pipeline in `benchmarks/`.
82
82
  - LongMemEval — interface ready, not yet run (requires external LLM API key).
83
83
  - TF-IDF degraded mode process memory at 100k: ~700 MB. Index LRU cap: 100,000 docs (MINDFORGE_INDEX_MAX_DOCS).
84
84
 
85
85
  ## What's New
86
86
 
87
- v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,300+ tests**.
87
+ v6.1.3 – v6.5.11 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,300+ tests**.
88
88
 
89
- - **v6.5.9 — security fix pack from dual-judge external review** (2026-11-14). Qwen4-Max (Doubao) and Kimi K3.1 independently reviewed the codebase; their overlapping findings became this release. (1) **GDPR erasure completed**: `gdpr_erase_all` now cascades to 17 tables — added `knowledge_graph` entities, `memory_snapshots`, `memory_templates`, and the four drama_* creation-content tables that previously survived erasure (the "right to be forgotten" had a real gap). (2) **Legacy key-file verification fixed**: v5.5-era key files (no `verify_blob`) previously accepted *any* password during `rekey` — a wrong old password could rewrite the key file and orphan all data. Rekey now probe-decrypts a real ciphertext from the store; empty stores fall back to the old behavior. (3) **KDF cost floor**: `KDFParams.from_dict` rejects tampered parameters (PBKDF2 < 60k, scrypt N < 4096) that would downgrade brute-force cost — key files and ciphertext headers are attacker-visible input. (4) **Compression × encryption unblocked**: `compress_memories` previously raised `SecurityError` on encrypted stores, making the two flagship features mutually exclusive by default. Compression now hydrates its TF-IDF index via the same in-memory decryption path as `fuzzy_search` (`_plaintext_for_index`) — plaintext never touches disk or FTS5. (5) **Interface matrix completed**: REST gains `/api/gdpr/report`, `/api/gdpr/export`, `/api/gdpr/erase` (confirm=true required), `/api/compress`, `/api/compressions`; MCP gains `gdpr_report`, `gdpr_erase` (confirm required), `memory_compress` — 87→90 tools, all three interfaces now expose the full governance surface. (6) **Honesty fixes**: README previously claimed "six-way hybrid search"; the actual retrieval count is four (vector/FTS5/TF-IDF/fuzzy) — wording corrected, and the cross-encoder/heuristic distinction is now explicit. LoCoMo full-suite results (51.5%, dual-judge) added to the benchmarks section. 7+ new contract tests (`tests/test_v656_security.py`).
89
+ - **v6.5.11 — security fix pack from dual-judge external review** (2026-11-14). Qwen4-Max (Doubao) and Kimi K3.1 independently reviewed the codebase; their overlapping findings became this release. (1) **GDPR erasure completed**: `gdpr_erase_all` now cascades to 17 tables — added `knowledge_graph` entities, `memory_snapshots`, `memory_templates`, and the four drama_* creation-content tables that previously survived erasure (the "right to be forgotten" had a real gap). (2) **Legacy key-file verification fixed**: v5.5-era key files (no `verify_blob`) previously accepted *any* password during `rekey` — a wrong old password could rewrite the key file and orphan all data. Rekey now probe-decrypts a real ciphertext from the store; empty stores fall back to the old behavior. (3) **KDF cost floor**: `KDFParams.from_dict` rejects tampered parameters (PBKDF2 < 60k, scrypt N < 4096) that would downgrade brute-force cost — key files and ciphertext headers are attacker-visible input. (4) **Compression × encryption unblocked**: `compress_memories` previously raised `SecurityError` on encrypted stores, making the two flagship features mutually exclusive by default. Compression now hydrates its TF-IDF index via the same in-memory decryption path as `fuzzy_search` (`_plaintext_for_index`) — plaintext never touches disk or FTS5. (5) **Interface matrix completed**: REST gains `/api/gdpr/report`, `/api/gdpr/export`, `/api/gdpr/erase` (confirm=true required), `/api/compress`, `/api/compressions`; MCP gains `gdpr_report`, `gdpr_erase` (confirm required), `memory_compress` — 87→90 tools, all three interfaces now expose the full governance surface. (6) **Honesty fixes**: README previously claimed "six-way hybrid search"; the actual retrieval count is four (vector/FTS5/TF-IDF/fuzzy) — wording corrected, and the cross-encoder/heuristic distinction is now explicit. LoCoMo full-suite results (51.5%, dual-judge) added to the benchmarks section. 7+ new contract tests (`tests/test_v656_security.py`).
90
90
 
91
91
  - **v6.4.9 — ten-million-char library at millisecond latency: FTS5 high-frequency-phrase scoring pruned** (2026-11-11). The last honest bottleneck from v6.4.8's ledger. Root cause (30k per-path timing): under the trigram tokenizer, corpus-wide phrases (template data's "陈述性记忆") match every row — bm25 full-match scoring cost 50.5ms/query, the dominant remainder of 100k mixed latency. Fix, query-side df pre-pruning symmetric to TF-IDF max_df: a phrase's df upper bound = min df of its trigrams (phrase matches ⊆ every trigram's row set); prune at 5% of corpus size; keep the lowest-ub phrase if all pruned. df is served from an in-process cache keyed by `max(rowid)` (add/update invalidate; hard-delete leaves df slightly stale = prunes more conservatively) — **two real pitfalls found en route: fts5vocab is a *streaming virtual table* — per-term probes AND `IN` batches trigger full scans (combined regressed 17→45ms before the cache)**. Plus: FTS5 path skipped on pathological fallback (no discriminating signal). Clean-environment 100k re-bench: pathological 122→**0.4ms** (−99.7%), mixed 134.9→**3.0ms** (−98%), all query types millisecond-class at ~10M chars. AI-flavored comment cleanup (essay-style docstrings → engineer-speak, info preserved). 5 new guards.
92
92
 
@@ -119,7 +119,7 @@ v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,30
119
119
 
120
120
  **Retrieval**
121
121
 
122
- - **Six-way hybrid retrieval (real, as of v6.5.9)** — six recall paths fused into one ranked result set: vector, FTS5, TF-IDF, fuzzy (the four core paths, RRF-style max-fusion with per-path score breakdown via `search --explain`), **temporal anchoring** (query absolute dates / anchored relative phrases → windowed SQL recall; v6.5.9) and **knowledge-graph adjacency** (entity match → 2-hop relation walk → memory back-references; v6.5.9). Paths 5-6 run in "blind-spot fill" mode — they only add candidates the four core paths missed, never re-rank existing high-quality hits. Degradation is per-path and safe: encrypted stores skip temporal (ciphertext is not SQL-matchable), empty KG skips graph, missing time anchor degrades to absolute-date-only.
122
+ - **Six-way hybrid retrieval (real, as of v6.5.11)** — six recall paths fused into one ranked result set: vector, FTS5, TF-IDF, fuzzy (the four core paths, RRF-style max-fusion with per-path score breakdown via `search --explain`), **temporal anchoring** (query absolute dates / anchored relative phrases → windowed SQL recall; v6.5.11) and **knowledge-graph adjacency** (entity match → 2-hop relation walk → memory back-references; v6.5.11). Paths 5-6 run in "blind-spot fill" mode — they only add candidates the four core paths missed, never re-rank existing high-quality hits. Degradation is per-path and safe: encrypted stores skip temporal (ciphertext is not SQL-matchable), empty KG skips graph, missing time anchor degrades to absolute-date-only.
123
123
  - **Knowledge graph** — automatic entity and relation extraction, path finding, and associative recall.
124
124
  - **Weighted recall** — multi-factor scoring (coverage, importance, access frequency, time decay) instead of similarity alone.
125
125
 
@@ -163,7 +163,7 @@ v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,30
163
163
 
164
164
  ```
165
165
  ┌──────────────────────────────────────────────────────┐
166
- │ MindForge v6.5.9 │
166
+ │ MindForge v6.5.11 │
167
167
  │ Cognitive Layer Personality · KnowledgeGraph │
168
168
  │ MemoryEvolution · FederatedMemory │
169
169
  ├──────────────────────────────────────────────────────┤
@@ -757,12 +757,17 @@ class QueryEngine:
757
757
  return _entry_cache[mid]
758
758
 
759
759
  # ===== v6.5.7 第 5/6 路:temporal + graph 召回 =====
760
- # 设计为「补盲区」语义:仅当记忆未被四路捞到(或四路分更低)时
761
- # 生效(score_map 取 max),不重排既有高质量命中。
762
- # 降级矩阵:加密库 temporal 跳过(密文不可 SQL 匹配)、KG 空
763
- # graph 空转、无 time_anchor 时相对词降级仅绝对日期可用——
764
- # 全部零异常退出,四路结果不受影响。
765
- five_six_used = []
760
+ # v6.5.10 分路施策(conv0 三轮小样 + 全量 1986 问校准):
761
+ # - **temporal 混排**(v6.5.7 语义保留):窗口日期命中的证据
762
+ # 与 query 时间语义强相关,0.6/0.85 分进主排序——conv0 上
763
+ # 混排版 temporal +5.4pt / open-domain +7.7pt 的增益来源。
764
+ # - **graph 尾部补位**:2 跳邻接天然宽泛,0.55/0.45 混进四路
765
+ # 0.6-0.8 区间占 top-k 名额,把四路正确证据挤出(全量
766
+ # cat1 multi-hop 25.2%→10.3%,-14.9pt 的元凶)——只在四路
767
+ # 不足 max_results 时追加。
768
+ # 降级矩阵不变:加密库 temporal 跳过、KG 空空转、无锚降级。
769
+ fill_candidates: Dict[str, Tuple[float, str]] = {}
770
+ temporal_mixed = False
766
771
  if not self.storage.encrypted and query:
767
772
  for mid, s, lbl in self._temporal_candidates(query, time_anchor):
768
773
  if explain:
@@ -770,6 +775,8 @@ class QueryEngine:
770
775
  if s >= score_map.get(mid, 0.0):
771
776
  is_new = mid not in score_map
772
777
  score_map[mid] = s
778
+ if is_new:
779
+ temporal_mixed = True
773
780
  if explain and is_new:
774
781
  _bd(mid)["winner"] = "temporal"
775
782
  _bd(mid)["final"] = s
@@ -777,17 +784,8 @@ class QueryEngine:
777
784
  for mid, s, lbl in self._graph_candidates(query):
778
785
  if explain:
779
786
  _bd(mid)["graph"] = max(s, _bd(mid).get("graph", 0.0))
780
- if s >= score_map.get(mid, 0.0):
781
- is_new = mid not in score_map
782
- score_map[mid] = s
783
- if explain and is_new:
784
- _bd(mid)["winner"] = "graph"
785
- _bd(mid)["final"] = s
786
- if explain and breakdown_map:
787
- if any("temporal" in (v or {}) for v in breakdown_map.values()):
788
- five_six_used.append("temporal")
789
- if any("graph" in (v or {}) for v in breakdown_map.values()):
790
- five_six_used.append("graph")
787
+ if mid not in score_map and s >= fill_candidates.get(mid, (0.0, ""))[0]:
788
+ fill_candidates[mid] = (s, "graph")
791
789
 
792
790
  # 预过滤:按 categories/layers 筛选 score_map,避免非匹配记忆占据排序位
793
791
  if categories or layers:
@@ -805,8 +803,7 @@ class QueryEngine:
805
803
 
806
804
  # 合并排序
807
805
  raw_results = sorted(score_map.items(), key=lambda x: x[1], reverse=True)
808
- if five_six_used:
809
- strategy_used = strategy_used + "+" + "+".join(five_six_used)
806
+
810
807
 
811
808
  # ===== 第二阶段:构建结果 =====
812
809
  chunks = []
@@ -871,6 +868,58 @@ class QueryEngine:
871
868
  if len(chunks) >= max_results:
872
869
  break
873
870
 
871
+ # ===== v6.5.9 第 5/6 路尾部补位 =====
872
+ # 四路结果不足 max_results 时,按分降序追加补盲候选(temporal
873
+ # 优先于 graph 同分)。绝不挤四路既有命中——LoCoMo 全量校准。
874
+ fill_used: set = set()
875
+ if fill_candidates and len(chunks) < max_results:
876
+ for mid, (s, src_path) in sorted(
877
+ fill_candidates.items(), key=lambda kv: -kv[1][0]):
878
+ if len(chunks) >= max_results:
879
+ break
880
+ entry = _cached_get(mid)
881
+ if not entry:
882
+ continue
883
+ if categories and entry.category not in categories:
884
+ continue
885
+ if layers and entry.layer not in layers:
886
+ continue
887
+ content_text = entry.content
888
+ if entry.encrypted and not content_text:
889
+ try:
890
+ content_text = self.storage.decrypt_content(entry)
891
+ except Exception:
892
+ continue
893
+ if content_text in seen_contents:
894
+ continue
895
+ seen_contents.add(content_text)
896
+ fill_used.add(src_path)
897
+ chunks.append(MemoryChunk(
898
+ memory_id=entry.id,
899
+ content=content_text,
900
+ category=entry.category,
901
+ relevance_score=s,
902
+ layer=entry.layer,
903
+ tags=entry.tags,
904
+ metadata=entry.metadata,
905
+ score_breakdown=breakdown_map.get(entry.id) if explain else None,
906
+ ))
907
+ if _update_access:
908
+ self.storage._update_access(entry, agent_id, session_id)
909
+
910
+ # v6.5.10:temporal 混排 + graph 补位——标记两类贡献
911
+ # (temporal 看 breakdown 命中;graph 看 fill 实际追加)
912
+ _six_used = set(fill_used)
913
+ if explain and any("temporal" in (v or {}) for v in breakdown_map.values()):
914
+ _six_used.add("temporal")
915
+ if not explain:
916
+ if fill_candidates:
917
+ _six_used.add("graph")
918
+ if temporal_mixed:
919
+ _six_used.add("temporal")
920
+ if _six_used:
921
+ strategy_used = strategy_used + "+" + "+".join(sorted(_six_used))
922
+
874
923
  # v5.7.0 P2:记录搜索历史(审计写入失败不阻断主路径)
875
924
  if _record_search:
876
925
  try:
@@ -20,10 +20,10 @@ core/mindforge.py、cli/main.py、mcp/server.py),每处都带一份硬编码
20
20
  from typing import Tuple
21
21
 
22
22
  #: 当前发布版本(唯一真值)
23
- __version__: str = "6.5.9"
23
+ __version__: str = "6.5.11"
24
24
 
25
25
  #: 结构化版本元组,便于比较(如 `VERSION_INFO >= (6, 1, 0)`)
26
- VERSION_INFO: Tuple[int, int, int] = (6, 5, 9)
26
+ VERSION_INFO: Tuple[int, int, int] = (6, 5, 11)
27
27
 
28
28
  #: 下一个大版本的目标版本号(供 v6 端口预留引用)
29
29
  NEXT_MAJOR_TARGET: str = "7.0.0"
@@ -77,6 +77,7 @@ RELATION_PATTERNS = [
77
77
  (r'\b([A-Z][a-z]+)\s+(?:met|saw|visited|called|emailed|texted)\s+([A-Z][A-Za-z ]{1,30})', "interacted_with"),
78
78
  (r'\b([A-Z][a-z]+)\s+(?:is\s+)?(?:married|engaged)\s+to\s+([A-Z][a-z]+)', "spouse_of"),
79
79
  (r'\b([A-Z][a-z]+)\s+(?:studied|study)\s+(?:at|in)\s+([A-Z][A-Za-z ]{1,30})', "studied_at"),
80
+ (r'([\u4e00-\u9fa5A-Za-z]{1,12})\s*(?:认识|结识)\s+([\u4e00-\u9fa5A-Za-z]{1,12})', "knows"),
80
81
  (r'(.+?)\s+(?:使用|利用|采用|运用)\s+(.+)', "uses"),
81
82
  (r'(.+?)\s+(?:是|属于|归类为)\s+(.+)', "is_a"),
82
83
  (r'(.+?)\s+(?:包含|包括|有)\s+(.+)', "contains"),
@@ -166,7 +167,7 @@ class KnowledgeGraph:
166
167
  # 单次出现的人名兜底:出现在关系动词模式中的大写词
167
168
  # (Melanie met Pamela——Pamela 仅出现一次也必须入图,
168
169
  # 否则关系链断裂、multi-hop 检索无路)
169
- for pat, _rt in RELATION_PATTERNS[:6]:
170
+ for pat, _rt in RELATION_PATTERNS:
170
171
  for m in re.finditer(pat, text, re.IGNORECASE):
171
172
  for g in m.groups():
172
173
  if not g:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mindforge-memory
3
- Version: 6.5.9
3
+ Version: 6.5.11
4
4
  Summary: AI Agent 终身记忆系统 - 四层记忆架构 · 知识图谱 · 多模态支持
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/opok-ops/MindForge
@@ -36,13 +36,13 @@ Dynamic: license-file
36
36
 
37
37
  MindForge gives AI agents a persistent, structured long-term memory: a four-tier lifecycle model, knowledge graphs, hybrid retrieval, end-to-end encryption, and MCP / CLI / REST interfaces. All data stays on your machine.
38
38
 
39
- > **The story** — one developer, seven months, from v1.0 (March 2026) to v6.5.9: no team, no funding, 1,305 passing tests. [Read the journey →](https://opok-ops.github.io/MindForge/#developer)
39
+ > **The story** — one developer, seven months, from v1.0 (March 2026) to v6.5.11: no team, no funding, 1,305 passing tests. [Read the journey →](https://opok-ops.github.io/MindForge/#developer)
40
40
  >
41
- > *Timeline note (v6.5.9):* "seven months" counts from project start (2026-03, pre-git prototyping era). Git history begins 2026-07-17 with the v5.7.x repository consolidation — earlier code lived outside this repo. The 416+ commits reflect consolidated history only.
41
+ > *Timeline note (v6.5.11):* "seven months" counts from project start (2026-03, pre-git prototyping era). Git history begins 2026-07-17 with the v5.7.x repository consolidation — earlier code lived outside this repo. The 416+ commits reflect consolidated history only.
42
42
 
43
43
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
44
44
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
45
- [![Version](https://img.shields.io/badge/version-6.5.9-green.svg)](https://github.com/opok-ops/MindForge/releases)
45
+ [![Version](https://img.shields.io/badge/version-6.5.11-green.svg)](https://github.com/opok-ops/MindForge/releases)
46
46
  [![Stars](https://img.shields.io/github/stars/opok-ops/MindForge.svg)](https://github.com/opok-ops/MindForge/stargazers)
47
47
  [![Forks](https://img.shields.io/github/forks/opok-ops/MindForge.svg)](https://github.com/opok-ops/MindForge/forks)
48
48
  [![Open Issues](https://img.shields.io/github/issues/opok-ops/MindForge.svg)](https://github.com/opok-ops/MindForge/issues)
@@ -108,15 +108,15 @@ MindForge stats
108
108
  - **Ten-million-character library, millisecond-class across all query types (v6.4.9)**: pathological 218→**0.4ms** (−99.8%), mixed 143→**3.0ms** (−98%), rare 6.8ms, combined 17.8ms (100k full-pipeline, clean environment). The last bottleneck — FTS5 high-frequency-phrase bm25 scoring — is now pruned query-side via trigram-df pre-check (df upper bound = min trigram df, pruned at 5% corpus size, symmetric to the TF-IDF max_df design; df served from an in-process cache — fts5vocab is a streaming virtual table, per-term probes scan it fully).
109
109
  - **Index-blindness fix (v6.4.8)**: TF-IDF vocabulary was locked to the first 5 documents since v6.4.6 — incremental adds indexed as empty vectors (TF-IDF effectively half-dead; previous numbers carried by FTS5/fuzzy). Fixed with incremental vocabulary growth; all pipeline numbers above are now *true full-pipeline* measurements.
110
110
  - Retrieval quality (fixed-seed, `benchmarks/quality_bench.py`, 2k entries): needle Recall@1 = 1.0, MRR = 1.0, topic Recall@1 = 1.0, noise false-recall = 0.
111
- - **LoCoMo full-suite, LLM-judged (v6.5.9, 2026-11-13)**: 1,986 questions across all 10 conversations — **51.5% accuracy (≥9/10 judge score)**, 2.13× over the 24.2% pre-assembly baseline; cross-validated by two independent judges (DeepSeek 51.5% / Kimi K3.1 52.72%, Δ1.2pt); excluding the adversarial "should-refuse" bucket, **43.05%** (663/1540). Per-bucket: adversarial 93.9%, single-hop 57.8%, multi-hop 25.2%, temporal 9.6%, open-domain 10.4% — temporal evidence recall and two-hop chain retrieval are the named v6.6 targets. Data: `benchmarks/results/`, judge pipeline in `benchmarks/`.
111
+ - **LoCoMo full-suite, LLM-judged (v6.5.11, 2026-11-13)**: 1,986 questions across all 10 conversations — **51.5% accuracy (≥9/10 judge score)**, 2.13× over the 24.2% pre-assembly baseline; cross-validated by two independent judges (DeepSeek 51.5% / Kimi K3.1 52.72%, Δ1.2pt); excluding the adversarial "should-refuse" bucket, **43.05%** (663/1540). Per-bucket: adversarial 93.9%, single-hop 57.8%, multi-hop 25.2%, temporal 9.6%, open-domain 10.4% — temporal evidence recall and two-hop chain retrieval are the named v6.6 targets. Data: `benchmarks/results/`, judge pipeline in `benchmarks/`.
112
112
  - LongMemEval — interface ready, not yet run (requires external LLM API key).
113
113
  - TF-IDF degraded mode process memory at 100k: ~700 MB. Index LRU cap: 100,000 docs (MINDFORGE_INDEX_MAX_DOCS).
114
114
 
115
115
  ## What's New
116
116
 
117
- v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,300+ tests**.
117
+ v6.1.3 – v6.5.11 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,300+ tests**.
118
118
 
119
- - **v6.5.9 — security fix pack from dual-judge external review** (2026-11-14). Qwen4-Max (Doubao) and Kimi K3.1 independently reviewed the codebase; their overlapping findings became this release. (1) **GDPR erasure completed**: `gdpr_erase_all` now cascades to 17 tables — added `knowledge_graph` entities, `memory_snapshots`, `memory_templates`, and the four drama_* creation-content tables that previously survived erasure (the "right to be forgotten" had a real gap). (2) **Legacy key-file verification fixed**: v5.5-era key files (no `verify_blob`) previously accepted *any* password during `rekey` — a wrong old password could rewrite the key file and orphan all data. Rekey now probe-decrypts a real ciphertext from the store; empty stores fall back to the old behavior. (3) **KDF cost floor**: `KDFParams.from_dict` rejects tampered parameters (PBKDF2 < 60k, scrypt N < 4096) that would downgrade brute-force cost — key files and ciphertext headers are attacker-visible input. (4) **Compression × encryption unblocked**: `compress_memories` previously raised `SecurityError` on encrypted stores, making the two flagship features mutually exclusive by default. Compression now hydrates its TF-IDF index via the same in-memory decryption path as `fuzzy_search` (`_plaintext_for_index`) — plaintext never touches disk or FTS5. (5) **Interface matrix completed**: REST gains `/api/gdpr/report`, `/api/gdpr/export`, `/api/gdpr/erase` (confirm=true required), `/api/compress`, `/api/compressions`; MCP gains `gdpr_report`, `gdpr_erase` (confirm required), `memory_compress` — 87→90 tools, all three interfaces now expose the full governance surface. (6) **Honesty fixes**: README previously claimed "six-way hybrid search"; the actual retrieval count is four (vector/FTS5/TF-IDF/fuzzy) — wording corrected, and the cross-encoder/heuristic distinction is now explicit. LoCoMo full-suite results (51.5%, dual-judge) added to the benchmarks section. 7+ new contract tests (`tests/test_v656_security.py`).
119
+ - **v6.5.11 — security fix pack from dual-judge external review** (2026-11-14). Qwen4-Max (Doubao) and Kimi K3.1 independently reviewed the codebase; their overlapping findings became this release. (1) **GDPR erasure completed**: `gdpr_erase_all` now cascades to 17 tables — added `knowledge_graph` entities, `memory_snapshots`, `memory_templates`, and the four drama_* creation-content tables that previously survived erasure (the "right to be forgotten" had a real gap). (2) **Legacy key-file verification fixed**: v5.5-era key files (no `verify_blob`) previously accepted *any* password during `rekey` — a wrong old password could rewrite the key file and orphan all data. Rekey now probe-decrypts a real ciphertext from the store; empty stores fall back to the old behavior. (3) **KDF cost floor**: `KDFParams.from_dict` rejects tampered parameters (PBKDF2 < 60k, scrypt N < 4096) that would downgrade brute-force cost — key files and ciphertext headers are attacker-visible input. (4) **Compression × encryption unblocked**: `compress_memories` previously raised `SecurityError` on encrypted stores, making the two flagship features mutually exclusive by default. Compression now hydrates its TF-IDF index via the same in-memory decryption path as `fuzzy_search` (`_plaintext_for_index`) — plaintext never touches disk or FTS5. (5) **Interface matrix completed**: REST gains `/api/gdpr/report`, `/api/gdpr/export`, `/api/gdpr/erase` (confirm=true required), `/api/compress`, `/api/compressions`; MCP gains `gdpr_report`, `gdpr_erase` (confirm required), `memory_compress` — 87→90 tools, all three interfaces now expose the full governance surface. (6) **Honesty fixes**: README previously claimed "six-way hybrid search"; the actual retrieval count is four (vector/FTS5/TF-IDF/fuzzy) — wording corrected, and the cross-encoder/heuristic distinction is now explicit. LoCoMo full-suite results (51.5%, dual-judge) added to the benchmarks section. 7+ new contract tests (`tests/test_v656_security.py`).
120
120
 
121
121
  - **v6.4.9 — ten-million-char library at millisecond latency: FTS5 high-frequency-phrase scoring pruned** (2026-11-11). The last honest bottleneck from v6.4.8's ledger. Root cause (30k per-path timing): under the trigram tokenizer, corpus-wide phrases (template data's "陈述性记忆") match every row — bm25 full-match scoring cost 50.5ms/query, the dominant remainder of 100k mixed latency. Fix, query-side df pre-pruning symmetric to TF-IDF max_df: a phrase's df upper bound = min df of its trigrams (phrase matches ⊆ every trigram's row set); prune at 5% of corpus size; keep the lowest-ub phrase if all pruned. df is served from an in-process cache keyed by `max(rowid)` (add/update invalidate; hard-delete leaves df slightly stale = prunes more conservatively) — **two real pitfalls found en route: fts5vocab is a *streaming virtual table* — per-term probes AND `IN` batches trigger full scans (combined regressed 17→45ms before the cache)**. Plus: FTS5 path skipped on pathological fallback (no discriminating signal). Clean-environment 100k re-bench: pathological 122→**0.4ms** (−99.7%), mixed 134.9→**3.0ms** (−98%), all query types millisecond-class at ~10M chars. AI-flavored comment cleanup (essay-style docstrings → engineer-speak, info preserved). 5 new guards.
122
122
 
@@ -149,7 +149,7 @@ v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,30
149
149
 
150
150
  **Retrieval**
151
151
 
152
- - **Six-way hybrid retrieval (real, as of v6.5.9)** — six recall paths fused into one ranked result set: vector, FTS5, TF-IDF, fuzzy (the four core paths, RRF-style max-fusion with per-path score breakdown via `search --explain`), **temporal anchoring** (query absolute dates / anchored relative phrases → windowed SQL recall; v6.5.9) and **knowledge-graph adjacency** (entity match → 2-hop relation walk → memory back-references; v6.5.9). Paths 5-6 run in "blind-spot fill" mode — they only add candidates the four core paths missed, never re-rank existing high-quality hits. Degradation is per-path and safe: encrypted stores skip temporal (ciphertext is not SQL-matchable), empty KG skips graph, missing time anchor degrades to absolute-date-only.
152
+ - **Six-way hybrid retrieval (real, as of v6.5.11)** — six recall paths fused into one ranked result set: vector, FTS5, TF-IDF, fuzzy (the four core paths, RRF-style max-fusion with per-path score breakdown via `search --explain`), **temporal anchoring** (query absolute dates / anchored relative phrases → windowed SQL recall; v6.5.11) and **knowledge-graph adjacency** (entity match → 2-hop relation walk → memory back-references; v6.5.11). Paths 5-6 run in "blind-spot fill" mode — they only add candidates the four core paths missed, never re-rank existing high-quality hits. Degradation is per-path and safe: encrypted stores skip temporal (ciphertext is not SQL-matchable), empty KG skips graph, missing time anchor degrades to absolute-date-only.
153
153
  - **Knowledge graph** — automatic entity and relation extraction, path finding, and associative recall.
154
154
  - **Weighted recall** — multi-factor scoring (coverage, importance, access frequency, time decay) instead of similarity alone.
155
155
 
@@ -193,7 +193,7 @@ v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,30
193
193
 
194
194
  ```
195
195
  ┌──────────────────────────────────────────────────────┐
196
- │ MindForge v6.5.9 │
196
+ │ MindForge v6.5.11 │
197
197
  │ Cognitive Layer Personality · KnowledgeGraph │
198
198
  │ MemoryEvolution · FederatedMemory │
199
199
  ├──────────────────────────────────────────────────────┤
@@ -39,7 +39,7 @@ import mindforge.core.version as core_version
39
39
 
40
40
 
41
41
  _REPO = Path(__file__).resolve().parent.parent
42
- _EXPECTED_VERSION = "6.5.9"
42
+ _EXPECTED_VERSION = "6.5.11"
43
43
 
44
44
  # 本轮修复涉及的、必须与 mindforge/core/version.py 保持一致的源码文件
45
45
  _VERSION_TRUTH_FILES = (
@@ -40,8 +40,8 @@ class TestVersionTruth(unittest.TestCase):
40
40
  def test_core_version_matches_release(self):
41
41
  # 版本推进时必须一并更新此处的钉值(与 test_v568_fixes 的
42
42
  # _EXPECTED_VERSION 同一约定:让「忘记 bump 版本」在测试里显形)。
43
- self.assertEqual(core_version.__version__, "6.5.9")
44
- self.assertEqual(core_version.VERSION_INFO, (6, 5, 9))
43
+ self.assertEqual(core_version.__version__, "6.5.11")
44
+ self.assertEqual(core_version.VERSION_INFO, (6, 5, 11))
45
45
 
46
46
  def test_pyproject_matches_core_version(self):
47
47
  # v5.8.13 起 pyproject 不再写死静态版本:
@@ -662,8 +662,8 @@ class TestVersionConsistency(unittest.TestCase):
662
662
  def test_version_is_612(self):
663
663
  from mindforge.core.version import VERSION_INFO, __version__
664
664
  # v6.1.3:版本钉值随发版推进更新(历史方法名保留)
665
- self.assertEqual(__version__, "6.5.9")
666
- self.assertEqual(VERSION_INFO, (6, 5, 9))
665
+ self.assertEqual(__version__, "6.5.11")
666
+ self.assertEqual(VERSION_INFO, (6, 5, 11))
667
667
 
668
668
  def test_json_round_trip_safety_of_preview(self):
669
669
  """save_evolution 的预览序列化不得抛(不可 json 化的对象走 str 兜底)。"""
@@ -109,7 +109,7 @@ class TestVersionBump(unittest.TestCase):
109
109
  钉点集合随版本数递增,发版链清单必须扫全部 test_v*fixes.py。"""
110
110
 
111
111
  def test_version_is_current(self):
112
- self.assertEqual(__version__, "6.5.9")
112
+ self.assertEqual(__version__, "6.5.11")
113
113
 
114
114
 
115
115
  if __name__ == "__main__":
@@ -101,7 +101,7 @@ class TestVersionBump(unittest.TestCase):
101
101
  """版本钉值:忘记 bump 时在此显形。"""
102
102
 
103
103
  def test_version_is_current(self):
104
- self.assertEqual(__version__, "6.5.9")
104
+ self.assertEqual(__version__, "6.5.11")
105
105
 
106
106
 
107
107
  if __name__ == "__main__":
@@ -85,7 +85,7 @@ class TestVersionBump(unittest.TestCase):
85
85
  """版本钉值(v6.4.5 教训:每版 fixes 断言随发版一并 bump)。"""
86
86
 
87
87
  def test_version_is_646(self):
88
- self.assertEqual(__version__, "6.5.9")
88
+ self.assertEqual(__version__, "6.5.11")
89
89
 
90
90
 
91
91
  if __name__ == "__main__":
@@ -118,8 +118,8 @@ class TestVersionBump(unittest.TestCase):
118
118
  """版本钉值(每版随发版一并 bump,v6.4.5 教训)。"""
119
119
 
120
120
  def test_version_is_649(self):
121
- self.assertEqual(__version__, "6.5.9")
122
- self.assertEqual(VERSION_INFO, (6, 5, 9))
121
+ self.assertEqual(__version__, "6.5.11")
122
+ self.assertEqual(VERSION_INFO, (6, 5, 11))
123
123
 
124
124
 
125
125
  if __name__ == "__main__":
@@ -114,13 +114,20 @@ class TestGraphPath(unittest.TestCase):
114
114
  self.assertGreaterEqual(stats["total_relations"], 2)
115
115
 
116
116
  def test_two_hop_chain_recall(self):
117
- """两跳链召回:query「Melanie 的朋友在哪工作」命中 Google 条目"""
118
- r = self.mf.search("Where does Melanie's friend work?",
119
- explain=True, max_results=5)
120
- graph_hits = [c for c in r.chunks
121
- if (c.score_breakdown or {}).get("graph")]
122
- self.assertGreaterEqual(len(graph_hits), 1)
123
- self.assertIn("graph", r.strategy_used)
117
+ """两跳链召回:Melanie→Pamela→Google 链上记忆可由图路召回
118
+
119
+ v6.5.9 改尾部补位语义后,graph 命中是否出现在最终结果取决于
120
+ 四路是否捞满(补位只在四路不足时追加)——因此这里直接验证
121
+ 图路候选层(召回能力),而非结果混排表现(混排契约归
122
+ TestTailFill)。
123
+ """
124
+ cands = self.mf._query._graph_candidates(
125
+ "Where does Melanie's friend work?")
126
+ self.assertGreaterEqual(len(cands), 1)
127
+ mids = {mid for mid, _s, _lbl in cands}
128
+ entries = [self.mf.get(mid) for mid in mids]
129
+ self.assertTrue(any("Google" in (e.content or "")
130
+ for e in entries if e))
124
131
 
125
132
  def test_empty_graph_degrades_silently(self):
126
133
  """KG 空库(禁用自动建图)graph 路空转、四路不受影响"""
@@ -182,3 +189,55 @@ class TestSixPathExplain(unittest.TestCase):
182
189
 
183
190
  if __name__ == "__main__":
184
191
  unittest.main()
192
+
193
+
194
+ class TestTailFill(unittest.TestCase):
195
+ """v6.5.9 尾部补位语义:graph/temporal 候选不混排主排序
196
+
197
+ LoCoMo 全量校准:补盲分(0.55/0.45)混排进四路 0.6-0.8 区间
198
+ 会占 top-k 名额挤掉正确证据(cat1 multi-hop -14.9pt)。
199
+ 契约:四路命中数 >= max_results 时补盲候选一个都不进结果;
200
+ 四路不足时按分降序追加、绝不挤位。
201
+ """
202
+
203
+ def setUp(self):
204
+ import tempfile
205
+ tmp = tempfile.mkdtemp(prefix="mf_tailfill_")
206
+ self.mf = MindForge(db_path=os.path.join(tmp, "m.db"),
207
+ encrypted=False)
208
+ self.tmp = tmp
209
+
210
+ def tearDown(self):
211
+ self.mf.close()
212
+ import shutil
213
+ shutil.rmtree(self.tmp, ignore_errors=True)
214
+
215
+ def test_full_core_results_no_fill(self):
216
+ """四路已满 top-k:graph 候选不进结果"""
217
+ for i in range(6):
218
+ self.mf.add(f"机器学习训练数据 augmentation 技术文档 {i}",
219
+ category="ml")
220
+ self.mf.add("Bob 认识 Alice", category="people")
221
+ self.mf.add("Alice works at Google", category="people")
222
+ r = self.mf.search("机器学习训练数据", max_results=5)
223
+ # 四路命中已满 5 条
224
+ self.assertGreaterEqual(len(r.chunks), 5)
225
+ # graph 候选(bob/alice/google)不应出现在结果里
226
+ contents = [c.content for c in r.chunks]
227
+ self.assertTrue(all("bob 认识 alice" not in c for c in contents))
228
+
229
+ def test_fill_only_when_core_short(self):
230
+ """四路不足时补位生效:图可达但词面/语义捞不到的记忆被追加"""
231
+ self.mf.add("极其罕见的独角兽词汇 quokkaberry", category="x")
232
+ self.mf.add("Bob 认识 Alice", category="people")
233
+ self.mf.add("Alice lives in Reykjavik", category="people")
234
+ # query 只含 Bob:目标记忆(Alice lives in Reykjavik)与
235
+ # query 无词面重叠 → 四路捞不到;graph 路 2 跳
236
+ # (Bob→Alice→Reykjavik)可达 → 尾部补位追加
237
+ r = self.mf.search("Bob 的 rare quokkaberry",
238
+ max_results=5, explain=True)
239
+ self.assertTrue("graph" in r.strategy_used,
240
+ f"strategy={r.strategy_used}")
241
+ contents = [c.content for c in r.chunks]
242
+ self.assertTrue(any("Reykjavik" in c for c in contents),
243
+ contents)