mindforge-memory 6.5.1__tar.gz → 6.5.3__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.
- {mindforge_memory-6.5.1/mindforge_memory.egg-info → mindforge_memory-6.5.3}/PKG-INFO +4 -4
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/README.md +3 -3
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/core/mindforge.py +9 -1
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/core/query.py +60 -1
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/core/version.py +2 -2
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3/mindforge_memory.egg-info}/PKG-INFO +4 -4
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge_memory.egg-info/SOURCES.txt +1 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v568_fixes.py +1 -1
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v575_release_consistency.py +2 -2
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v612_fixes.py +2 -2
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v643_fixes.py +1 -1
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v645_fixes.py +1 -1
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v646_fixes.py +1 -1
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v649_fixes.py +2 -2
- mindforge_memory-6.5.3/tests/test_v652_context_expansion.py +128 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/LICENSE +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/MindForge.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/__init__.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/adapters/__init__.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/adapters/claude_adapter.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/adapters/crewai_memory.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/adapters/generic_api.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/adapters/langgraph_store.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/adapters/openclaw_adapter.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/api/__init__.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/api/server.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/cli/__init__.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/cli/main.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/core/__init__.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/core/embedding.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/core/encryption.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/core/indexer.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/core/paths.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/core/storage.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/core/types.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/daemon/__init__.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/daemon/server.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/mcp/__init__.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/mcp/server.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/__init__.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/categorizer.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/conflict_detector.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/connectors.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/context_window.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/event_bus.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/evolution.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/experience.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/federated.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/federated_acl.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/follow_up.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/hybrid_search.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/importer.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/integrator.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/intent_router.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/knowledge_graph.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/memory_compressor.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/memory_decay.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/memory_passport.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/multi_agent.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/multimodal.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/outcome_learning.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/personality.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/principled_forgetting.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/privacy.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/recall.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/session_focus.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/share_conflict.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/skill_extractor.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/skill_pack.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/timeline_viz.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/v6.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge_memory.egg-info/dependency_links.txt +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge_memory.egg-info/entry_points.txt +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge_memory.egg-info/requires.txt +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge_memory.egg-info/top_level.txt +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/pyproject.toml +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/setup.cfg +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/setup.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_core.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_security_hardening.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_trash_hard_delete.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v546_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v547_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v548_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v550_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v552_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v554_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v556_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v557_banner_insight_wal.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v557_security_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v557_webhook_sig_export.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v558_audit_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v558_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v560_decay_gc.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v560_kdf_versioning.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v560_module_coverage.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v561_security.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v562_p2_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v563_entry_coverage.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v563_perf_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v565_security.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v566_encrypted_search.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v567_security_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v569_fts_sync.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v570_coverage_expansion.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v570_drama_and_utils.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v570_encrypted_fallback.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v571_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v572_security.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v573_encrypted_export.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v573_security.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v576_bitemporal.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v576_gdpr.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v577_agent_governance.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v578_embedding.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v579_graph.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v580_experience.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v5812_bugfixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v583_security.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v584_adapters.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v585_benchmark.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v586_federated_mcp.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v590_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v592_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v593_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v595_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v600_forgetting_followup.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v600_import_timeline.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v600_multi_agent_formal.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v600_outcome_passport.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v600_skillpack_evolution.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v611_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v612_cascade_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v613_integrity.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v620_growth_governance.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v630_search_explain.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v631_scrypt.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v632_explain_interfaces.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v635_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v635_integration.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v636_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v648_fixes.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/tests/test_v65_features.py +0 -0
- {mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/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.
|
|
3
|
+
Version: 6.5.3
|
|
4
4
|
Summary: AI Agent 终身记忆系统 - 四层记忆架构 · 知识图谱 · 多模态支持
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/opok-ops/MindForge
|
|
@@ -36,11 +36,11 @@ 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.
|
|
39
|
+
> **The story** — one developer, seven months, from v1.0 (March 2026) to v6.5.3: no team, no funding, 1,272 passing tests. [Read the journey →](https://opok-ops.github.io/MindForge/#developer)
|
|
40
40
|
|
|
41
41
|
[](https://www.python.org/downloads/)
|
|
42
42
|
[](LICENSE)
|
|
43
|
-
[](https://github.com/opok-ops/MindForge/releases)
|
|
44
44
|
[](https://github.com/opok-ops/MindForge/stargazers)
|
|
45
45
|
[](https://github.com/opok-ops/MindForge/forks)
|
|
46
46
|
[](https://github.com/opok-ops/MindForge/issues)
|
|
@@ -188,7 +188,7 @@ v6.1.3 – v6.4.9 shipped in ten days (2026-11-01 → 11-11; four releases in th
|
|
|
188
188
|
|
|
189
189
|
```
|
|
190
190
|
┌──────────────────────────────────────────────────────┐
|
|
191
|
-
│ MindForge v6.5.
|
|
191
|
+
│ MindForge v6.5.3 │
|
|
192
192
|
│ Cognitive Layer Personality · KnowledgeGraph │
|
|
193
193
|
│ MemoryEvolution · FederatedMemory │
|
|
194
194
|
├──────────────────────────────────────────────────────┤
|
|
@@ -6,11 +6,11 @@
|
|
|
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
|
+
> **The story** — one developer, seven months, from v1.0 (March 2026) to v6.5.3: no team, no funding, 1,272 passing tests. [Read the journey →](https://opok-ops.github.io/MindForge/#developer)
|
|
10
10
|
|
|
11
11
|
[](https://www.python.org/downloads/)
|
|
12
12
|
[](LICENSE)
|
|
13
|
-
[](https://github.com/opok-ops/MindForge/releases)
|
|
14
14
|
[](https://github.com/opok-ops/MindForge/stargazers)
|
|
15
15
|
[](https://github.com/opok-ops/MindForge/forks)
|
|
16
16
|
[](https://github.com/opok-ops/MindForge/issues)
|
|
@@ -158,7 +158,7 @@ v6.1.3 – v6.4.9 shipped in ten days (2026-11-01 → 11-11; four releases in th
|
|
|
158
158
|
|
|
159
159
|
```
|
|
160
160
|
┌──────────────────────────────────────────────────────┐
|
|
161
|
-
│ MindForge v6.5.
|
|
161
|
+
│ MindForge v6.5.3 │
|
|
162
162
|
│ Cognitive Layer Personality · KnowledgeGraph │
|
|
163
163
|
│ MemoryEvolution · FederatedMemory │
|
|
164
164
|
├──────────────────────────────────────────────────────┤
|
|
@@ -810,13 +810,20 @@ class MindForge:
|
|
|
810
810
|
agent_id: str = "",
|
|
811
811
|
session_id: str = "",
|
|
812
812
|
use_embedding: bool = True,
|
|
813
|
-
explain: bool = False
|
|
813
|
+
explain: bool = False,
|
|
814
|
+
expand_context: int = 0):
|
|
814
815
|
"""搜索记忆
|
|
815
816
|
|
|
816
817
|
v5.4.5 新增 use_embedding 参数:
|
|
817
818
|
- True(默认):启用向量召回 + TF-IDF + Fuzzy 多路融合搜索
|
|
818
819
|
- False:降级为 TF-IDF + Fuzzy 两路搜索(资源受限时使用)
|
|
819
820
|
|
|
821
|
+
v6.5.2 新增 expand_context 参数(证据上下文窗口扩展):
|
|
822
|
+
- N>0:命中条目若带 ctxgrp:/ctxseq: 坐标 tags,按组拉取
|
|
823
|
+
±N 邻居轮填充 chunk.context_expansion(LoCoMo 评测验证:
|
|
824
|
+
multi-hop 正确率 +27pt 的核心机制产品化)
|
|
825
|
+
- 0(默认):行为与旧版完全一致
|
|
826
|
+
|
|
820
827
|
v6.3.0 新增 explain 参数(检索可解释性):
|
|
821
828
|
- True:每个返回的 MemoryChunk.score_breakdown 携带各召回路
|
|
822
829
|
(tfidf/fts5/fuzzy/vector)原始分数、融合明细与最终胜出
|
|
@@ -847,6 +854,7 @@ class MindForge:
|
|
|
847
854
|
session_id=session_id,
|
|
848
855
|
use_embedding=use_embedding,
|
|
849
856
|
explain=explain,
|
|
857
|
+
expand_context=expand_context,
|
|
850
858
|
_update_access=False,
|
|
851
859
|
_record_search=False,
|
|
852
860
|
)
|
|
@@ -5,7 +5,7 @@ MindForge 查询引擎
|
|
|
5
5
|
|
|
6
6
|
import logging
|
|
7
7
|
from dataclasses import dataclass, field
|
|
8
|
-
from typing import List, Optional, Dict, Any
|
|
8
|
+
from typing import List, Optional, Dict, Any, Tuple
|
|
9
9
|
from .storage import StorageEngine, MemoryEntry
|
|
10
10
|
from .indexer import IndexEngine
|
|
11
11
|
from .types import MemoryLayer
|
|
@@ -44,6 +44,11 @@ class MemoryChunk:
|
|
|
44
44
|
# "final": 0.42, "winner": "tfidf",
|
|
45
45
|
# "fusion": {"text":…, "vector":…, "fused":…}(仅融合时存在)}
|
|
46
46
|
score_breakdown: Optional[Dict[str, Any]] = None
|
|
47
|
+
# v6.5.2:证据上下文窗口扩展(AdaptiveContextEngine 雏形)。
|
|
48
|
+
# search(expand_context=N>0) 且命中条目带坐标 tags
|
|
49
|
+
# (ctxgrp:<组id> + ctxseq:<序号>)时填充:[(seq, content),...]
|
|
50
|
+
# 升序含命中轮自身;其余恒为 None(序列化兼容)。
|
|
51
|
+
context_expansion: Optional[List[Tuple[int, str]]] = None
|
|
47
52
|
|
|
48
53
|
|
|
49
54
|
@dataclass
|
|
@@ -191,6 +196,7 @@ class QueryEngine:
|
|
|
191
196
|
session_id: str = "",
|
|
192
197
|
use_embedding: bool = True,
|
|
193
198
|
explain: bool = False,
|
|
199
|
+
expand_context: int = 0,
|
|
194
200
|
*, _update_access: bool = True,
|
|
195
201
|
_record_search: bool = True) -> RecallResult:
|
|
196
202
|
"""搜索记忆
|
|
@@ -496,6 +502,13 @@ class QueryEngine:
|
|
|
496
502
|
except Exception:
|
|
497
503
|
pass
|
|
498
504
|
|
|
505
|
+
# v6.5.2:证据上下文窗口扩展(AdaptiveContextEngine 雏形)。
|
|
506
|
+
# 命中 chunk 带 ctxgrp:/ctxseq: 坐标 tags 时,按组拉邻居轮填充
|
|
507
|
+
# context_expansion。expand_context=0(默认)零开销直通,行为与
|
|
508
|
+
# 旧版完全一致(1273 项既有测试契约不变)。
|
|
509
|
+
if expand_context and expand_context > 0:
|
|
510
|
+
self._expand_chunk_context(chunks, expand_context)
|
|
511
|
+
|
|
499
512
|
elapsed = (time.time() - start) * 1000
|
|
500
513
|
token_estimate = sum(len(c.content) for c in chunks) // 4
|
|
501
514
|
|
|
@@ -511,6 +524,52 @@ class QueryEngine:
|
|
|
511
524
|
approximate=approximate,
|
|
512
525
|
)
|
|
513
526
|
|
|
527
|
+
def _expand_chunk_context(self, chunks: List[MemoryChunk],
|
|
528
|
+
radius: int) -> None:
|
|
529
|
+
"""按 ctxgrp/ctxseq 坐标 tags 填充 context_expansion(v6.5.2)
|
|
530
|
+
|
|
531
|
+
坐标协议:入库 tags 携带 "ctxgrp:<组id>" 与 "ctxseq:<序号>"。
|
|
532
|
+
无坐标或组内邻居缺失时该 chunk 字段保持 None(降级安全)。
|
|
533
|
+
窗口 = [seq-radius, seq+radius](含命中轮),升序输出。
|
|
534
|
+
"""
|
|
535
|
+
import json as _json
|
|
536
|
+
for chunk in chunks:
|
|
537
|
+
if chunk.context_expansion is not None:
|
|
538
|
+
continue
|
|
539
|
+
grp = seq = None
|
|
540
|
+
for t in (chunk.tags or []):
|
|
541
|
+
if t.startswith("ctxgrp:"):
|
|
542
|
+
grp = t[7:]
|
|
543
|
+
elif t.startswith("ctxseq:"):
|
|
544
|
+
try:
|
|
545
|
+
seq = int(t[7:])
|
|
546
|
+
except ValueError:
|
|
547
|
+
pass
|
|
548
|
+
if grp is None or seq is None:
|
|
549
|
+
continue
|
|
550
|
+
try:
|
|
551
|
+
group_entries = self.storage.search_by_tag(
|
|
552
|
+
f"ctxgrp:{grp}", limit=4096)
|
|
553
|
+
except Exception:
|
|
554
|
+
continue
|
|
555
|
+
neighbours = []
|
|
556
|
+
for e in group_entries:
|
|
557
|
+
e_seq = None
|
|
558
|
+
for t in (e.tags or []):
|
|
559
|
+
if t.startswith("ctxseq:"):
|
|
560
|
+
try:
|
|
561
|
+
e_seq = int(t[7:])
|
|
562
|
+
except ValueError:
|
|
563
|
+
pass
|
|
564
|
+
break
|
|
565
|
+
if e_seq is None:
|
|
566
|
+
continue
|
|
567
|
+
if abs(e_seq - seq) <= radius:
|
|
568
|
+
neighbours.append((e_seq, e.content))
|
|
569
|
+
if neighbours:
|
|
570
|
+
neighbours.sort(key=lambda x: x[0])
|
|
571
|
+
chunk.context_expansion = neighbours
|
|
572
|
+
|
|
514
573
|
def get_session_context(self,
|
|
515
574
|
session_id: str,
|
|
516
575
|
max_items: int = 20) -> List[MemoryEntry]:
|
|
@@ -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.
|
|
23
|
+
__version__: str = "6.5.3"
|
|
24
24
|
|
|
25
25
|
#: 结构化版本元组,便于比较(如 `VERSION_INFO >= (6, 1, 0)`)
|
|
26
|
-
VERSION_INFO: Tuple[int, int, int] = (6, 5,
|
|
26
|
+
VERSION_INFO: Tuple[int, int, int] = (6, 5, 3)
|
|
27
27
|
|
|
28
28
|
#: 下一个大版本的目标版本号(供 v6 端口预留引用)
|
|
29
29
|
NEXT_MAJOR_TARGET: str = "7.0.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mindforge-memory
|
|
3
|
-
Version: 6.5.
|
|
3
|
+
Version: 6.5.3
|
|
4
4
|
Summary: AI Agent 终身记忆系统 - 四层记忆架构 · 知识图谱 · 多模态支持
|
|
5
5
|
License: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/opok-ops/MindForge
|
|
@@ -36,11 +36,11 @@ 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.
|
|
39
|
+
> **The story** — one developer, seven months, from v1.0 (March 2026) to v6.5.3: no team, no funding, 1,272 passing tests. [Read the journey →](https://opok-ops.github.io/MindForge/#developer)
|
|
40
40
|
|
|
41
41
|
[](https://www.python.org/downloads/)
|
|
42
42
|
[](LICENSE)
|
|
43
|
-
[](https://github.com/opok-ops/MindForge/releases)
|
|
44
44
|
[](https://github.com/opok-ops/MindForge/stargazers)
|
|
45
45
|
[](https://github.com/opok-ops/MindForge/forks)
|
|
46
46
|
[](https://github.com/opok-ops/MindForge/issues)
|
|
@@ -188,7 +188,7 @@ v6.1.3 – v6.4.9 shipped in ten days (2026-11-01 → 11-11; four releases in th
|
|
|
188
188
|
|
|
189
189
|
```
|
|
190
190
|
┌──────────────────────────────────────────────────────┐
|
|
191
|
-
│ MindForge v6.5.
|
|
191
|
+
│ MindForge v6.5.3 │
|
|
192
192
|
│ Cognitive Layer Personality · KnowledgeGraph │
|
|
193
193
|
│ MemoryEvolution · FederatedMemory │
|
|
194
194
|
├──────────────────────────────────────────────────────┤
|
|
@@ -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.
|
|
44
|
-
self.assertEqual(core_version.VERSION_INFO, (6, 5,
|
|
43
|
+
self.assertEqual(core_version.__version__, "6.5.3")
|
|
44
|
+
self.assertEqual(core_version.VERSION_INFO, (6, 5, 3))
|
|
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.
|
|
666
|
-
self.assertEqual(VERSION_INFO, (6, 5,
|
|
665
|
+
self.assertEqual(__version__, "6.5.3")
|
|
666
|
+
self.assertEqual(VERSION_INFO, (6, 5, 3))
|
|
667
667
|
|
|
668
668
|
def test_json_round_trip_safety_of_preview(self):
|
|
669
669
|
"""save_evolution 的预览序列化不得抛(不可 json 化的对象走 str 兜底)。"""
|
|
@@ -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.
|
|
122
|
-
self.assertEqual(VERSION_INFO, (6, 5,
|
|
121
|
+
self.assertEqual(__version__, "6.5.3")
|
|
122
|
+
self.assertEqual(VERSION_INFO, (6, 5, 3))
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""v6.5.2 证据上下文窗口扩展(AdaptiveContextEngine 雏形)行为契约
|
|
3
|
+
|
|
4
|
+
坐标协议:入库 tags 携带 ctxgrp:<组id> + ctxseq:<序号>;
|
|
5
|
+
search(expand_context=N>0) 时按组拉邻居填充 context_expansion。
|
|
6
|
+
默认 expand_context=0 行为与 v6.5.1 完全一致(兼容性契约)。
|
|
7
|
+
背景:LoCoMo conv-26 实验窗口扩展使 multi-hop 正确率 +27pt。
|
|
8
|
+
"""
|
|
9
|
+
import os
|
|
10
|
+
import tempfile
|
|
11
|
+
|
|
12
|
+
import pytest
|
|
13
|
+
|
|
14
|
+
from mindforge.core.mindforge import MindForge
|
|
15
|
+
from mindforge.core.types import MemoryConfig
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@pytest.fixture
|
|
19
|
+
def mf():
|
|
20
|
+
tmp = tempfile.mkdtemp()
|
|
21
|
+
inst = MindForge(config=MemoryConfig(
|
|
22
|
+
db_path=f"{tmp}/mf.db", key_file=None, encrypted=False))
|
|
23
|
+
# 无向量依赖的纯词法测试环境
|
|
24
|
+
yield inst
|
|
25
|
+
inst.close()
|
|
26
|
+
import shutil
|
|
27
|
+
shutil.rmtree(tmp, ignore_errors=True)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _seed(mf, group="g1", n=6, prefix="turn"):
|
|
31
|
+
"""入库带坐标的 6 轮对话"""
|
|
32
|
+
for i in range(n):
|
|
33
|
+
mf.add(f"{prefix} {i}: unique-words-{prefix}-{i}",
|
|
34
|
+
category="session",
|
|
35
|
+
tags=[f"ctxgrp:{group}", f"ctxseq:{i}"])
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class TestContextExpansion:
|
|
39
|
+
def test_default_off_compat(self, mf):
|
|
40
|
+
"""默认 expand_context=0:context_expansion 恒 None(兼容契约)"""
|
|
41
|
+
_seed(mf)
|
|
42
|
+
res = mf.search("unique-words", max_results=3)
|
|
43
|
+
assert res.chunks
|
|
44
|
+
for c in res.chunks:
|
|
45
|
+
assert c.context_expansion is None
|
|
46
|
+
|
|
47
|
+
def test_expansion_window(self, mf):
|
|
48
|
+
"""expand_context=2:窗口 = 命中轮 ±2(含自身),升序"""
|
|
49
|
+
_seed(mf)
|
|
50
|
+
res = mf.search("unique-words-turn-2", max_results=1,
|
|
51
|
+
expand_context=2)
|
|
52
|
+
assert res.chunks
|
|
53
|
+
hit = res.chunks[0]
|
|
54
|
+
hit_seq = None
|
|
55
|
+
for t in hit.tags:
|
|
56
|
+
if t.startswith("ctxseq:"):
|
|
57
|
+
hit_seq = int(t[7:])
|
|
58
|
+
assert hit_seq is not None
|
|
59
|
+
exp = hit.context_expansion
|
|
60
|
+
assert exp is not None
|
|
61
|
+
seqs = [s for s, _ in exp]
|
|
62
|
+
assert seqs == sorted(seqs), "窗口应按 seq 升序"
|
|
63
|
+
lo = max(0, hit_seq - 2)
|
|
64
|
+
hi = min(5, hit_seq + 2)
|
|
65
|
+
assert set(seqs) == set(range(lo, hi + 1)), (
|
|
66
|
+
f"命中 seq={hit_seq} 期望窗口 [{lo}..{hi}] 实得 {sorted(seqs)}")
|
|
67
|
+
|
|
68
|
+
def test_boundary_clamp(self, mf):
|
|
69
|
+
"""seq=0 命中:窗口不越界(无负 seq)"""
|
|
70
|
+
_seed(mf)
|
|
71
|
+
res = mf.search("unique-words-turn-0", max_results=1,
|
|
72
|
+
expand_context=3)
|
|
73
|
+
assert res.chunks
|
|
74
|
+
exp = res.chunks[0].context_expansion
|
|
75
|
+
assert exp is not None
|
|
76
|
+
seqs = [s for s, _ in exp]
|
|
77
|
+
assert seqs == [0, 1, 2, 3]
|
|
78
|
+
|
|
79
|
+
def test_no_coords_degrade(self, mf):
|
|
80
|
+
"""无坐标 tags 的记忆:字段 None,不炸(降级安全)"""
|
|
81
|
+
mf.add("plain memory without coords", category="general")
|
|
82
|
+
res = mf.search("plain memory", max_results=2,
|
|
83
|
+
expand_context=2)
|
|
84
|
+
assert res.chunks
|
|
85
|
+
for c in res.chunks:
|
|
86
|
+
if "ctxgrp" not in (c.tags or []):
|
|
87
|
+
assert c.context_expansion is None
|
|
88
|
+
|
|
89
|
+
def test_groups_isolated(self, mf):
|
|
90
|
+
"""两个组:g1 窗口不混入 g2 的条目"""
|
|
91
|
+
_seed(mf, group="g1", n=6, prefix="alpha")
|
|
92
|
+
_seed(mf, group="g2", n=6, prefix="beta")
|
|
93
|
+
res = mf.search("unique-words-alpha-3", max_results=1,
|
|
94
|
+
expand_context=5)
|
|
95
|
+
assert res.chunks
|
|
96
|
+
exp = res.chunks[0].context_expansion
|
|
97
|
+
assert exp is not None
|
|
98
|
+
texts = " ".join(t for _, t in exp)
|
|
99
|
+
assert "beta" not in texts, "跨组隔离被破坏"
|
|
100
|
+
|
|
101
|
+
def test_radius_one(self, mf):
|
|
102
|
+
"""expand_context=1:紧邻 ±1(以实际命中轮为中心)"""
|
|
103
|
+
_seed(mf)
|
|
104
|
+
res = mf.search("unique-words-turn-3", max_results=1,
|
|
105
|
+
expand_context=1)
|
|
106
|
+
assert res.chunks
|
|
107
|
+
hit = res.chunks[0]
|
|
108
|
+
hit_seq = None
|
|
109
|
+
for t in hit.tags:
|
|
110
|
+
if t.startswith("ctxseq:"):
|
|
111
|
+
hit_seq = int(t[7:])
|
|
112
|
+
exp = hit.context_expansion
|
|
113
|
+
assert exp is not None
|
|
114
|
+
seqs = [s for s, _ in exp]
|
|
115
|
+
lo = max(0, hit_seq - 1)
|
|
116
|
+
hi = min(5, hit_seq + 1)
|
|
117
|
+
assert set(seqs) == set(range(lo, hi + 1))
|
|
118
|
+
|
|
119
|
+
def test_chunk_serializable(self, mf):
|
|
120
|
+
"""context_expansion 不破坏 MemoryChunk 基本序列化路径"""
|
|
121
|
+
_seed(mf)
|
|
122
|
+
res = mf.search("unique-words-turn-1", max_results=1,
|
|
123
|
+
expand_context=1)
|
|
124
|
+
c = res.chunks[0]
|
|
125
|
+
assert c.context_expansion is not None
|
|
126
|
+
# dataclass 基本字段完整
|
|
127
|
+
assert c.memory_id and c.content
|
|
128
|
+
assert isinstance(c.relevance_score, float)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge/modules/principled_forgetting.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge_memory.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{mindforge_memory-6.5.1 → mindforge_memory-6.5.3}/mindforge_memory.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|