mindforge-memory 6.5.3__tar.gz → 6.5.5__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.3/mindforge_memory.egg-info → mindforge_memory-6.5.5}/PKG-INFO +4 -4
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/README.md +3 -3
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/core/mindforge.py +63 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/core/query.py +94 -2
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/core/version.py +2 -2
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5/mindforge_memory.egg-info}/PKG-INFO +4 -4
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge_memory.egg-info/SOURCES.txt +2 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v568_fixes.py +1 -1
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v575_release_consistency.py +2 -2
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v612_fixes.py +2 -2
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v643_fixes.py +1 -1
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v645_fixes.py +1 -1
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v646_fixes.py +1 -1
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v649_fixes.py +2 -2
- mindforge_memory-6.5.5/tests/test_v654_search_multi.py +100 -0
- mindforge_memory-6.5.5/tests/test_v655_temporal_norm.py +97 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/LICENSE +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/MindForge.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/__init__.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/adapters/__init__.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/adapters/claude_adapter.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/adapters/crewai_memory.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/adapters/generic_api.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/adapters/langgraph_store.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/adapters/openclaw_adapter.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/api/__init__.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/api/server.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/cli/__init__.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/cli/main.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/core/__init__.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/core/embedding.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/core/encryption.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/core/indexer.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/core/paths.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/core/storage.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/core/types.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/daemon/__init__.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/daemon/server.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/mcp/__init__.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/mcp/server.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/__init__.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/categorizer.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/conflict_detector.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/connectors.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/context_window.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/event_bus.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/evolution.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/experience.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/federated.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/federated_acl.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/follow_up.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/hybrid_search.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/importer.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/integrator.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/intent_router.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/knowledge_graph.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/memory_compressor.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/memory_decay.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/memory_passport.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/multi_agent.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/multimodal.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/outcome_learning.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/personality.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/principled_forgetting.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/privacy.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/recall.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/session_focus.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/share_conflict.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/skill_extractor.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/skill_pack.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/timeline_viz.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge/modules/v6.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge_memory.egg-info/dependency_links.txt +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge_memory.egg-info/entry_points.txt +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge_memory.egg-info/requires.txt +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/mindforge_memory.egg-info/top_level.txt +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/pyproject.toml +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/setup.cfg +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/setup.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_core.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_security_hardening.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_trash_hard_delete.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v546_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v547_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v548_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v550_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v552_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v554_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v556_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v557_banner_insight_wal.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v557_security_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v557_webhook_sig_export.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v558_audit_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v558_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v560_decay_gc.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v560_kdf_versioning.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v560_module_coverage.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v561_security.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v562_p2_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v563_entry_coverage.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v563_perf_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v565_security.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v566_encrypted_search.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v567_security_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v569_fts_sync.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v570_coverage_expansion.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v570_drama_and_utils.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v570_encrypted_fallback.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v571_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v572_security.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v573_encrypted_export.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v573_security.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v576_bitemporal.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v576_gdpr.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v577_agent_governance.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v578_embedding.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v579_graph.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v580_experience.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v5812_bugfixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v583_security.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v584_adapters.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v585_benchmark.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v586_federated_mcp.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v590_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v592_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v593_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v595_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v600_forgetting_followup.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v600_import_timeline.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v600_multi_agent_formal.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v600_outcome_passport.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v600_skillpack_evolution.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v611_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v612_cascade_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v613_integrity.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v620_growth_governance.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v630_search_explain.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v631_scrypt.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v632_explain_interfaces.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v635_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v635_integration.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v636_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v648_fixes.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v652_context_expansion.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/tests/test_v65_features.py +0 -0
- {mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/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.5
|
|
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.5: 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.5 │
|
|
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.5: 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.5 │
|
|
162
162
|
│ Cognitive Layer Personality · KnowledgeGraph │
|
|
163
163
|
│ MemoryEvolution · FederatedMemory │
|
|
164
164
|
├──────────────────────────────────────────────────────┤
|
|
@@ -888,6 +888,69 @@ class MindForge:
|
|
|
888
888
|
result.total_found = len(result.chunks)
|
|
889
889
|
return result
|
|
890
890
|
|
|
891
|
+
def search_multi(self, queries: Optional[List[str]],
|
|
892
|
+
per_query: int = 3,
|
|
893
|
+
max_results: int = 10,
|
|
894
|
+
expand_context: int = 0,
|
|
895
|
+
min_relevance: float = 0.3,
|
|
896
|
+
categories: Optional[List[str]] = None,
|
|
897
|
+
layers: Optional[List[str]] = None,
|
|
898
|
+
agent_id: str = "",
|
|
899
|
+
session_id: str = "",
|
|
900
|
+
use_embedding: bool = True,
|
|
901
|
+
explain: bool = False) -> "RecallResult":
|
|
902
|
+
"""多查询融合检索(v6.5.4)
|
|
903
|
+
|
|
904
|
+
各子查询独立检索(保留每条查询的词法锚点),按 memory_id
|
|
905
|
+
去重合并,结果顺序 = 首次出现的查询序位(保查询优先级)。
|
|
906
|
+
用途:查询拆解 / 实体扩展 / 多视角召回等应用层策略的检索
|
|
907
|
+
融合基座——拆解策略本身由调用方提供(LLM 或规则),本层只
|
|
908
|
+
负责融合与去重,不引入任何模型调用。
|
|
909
|
+
|
|
910
|
+
v6.5.4 实验背景(LoCoMo conv-26 cat2 多跳,199 问中的 37 问):
|
|
911
|
+
LLM 拆解与实体扩展两条 eval 层路径当日均证伪(高峰期拆解
|
|
912
|
+
质量不可控 / 实体子查询无增益),本 API 作为中性基座保留,
|
|
913
|
+
供后续 AdaptiveContextEngine 的两跳链检索使用。
|
|
914
|
+
|
|
915
|
+
副作用契约:每条子查询按普通 search 记审计与访问统计
|
|
916
|
+
(多查询=多次真实检索行为,如实记录)。
|
|
917
|
+
"""
|
|
918
|
+
import time as _time
|
|
919
|
+
start = _time.perf_counter()
|
|
920
|
+
empty = self._query_result_empty() if hasattr(
|
|
921
|
+
self, "_query_result_empty") else None
|
|
922
|
+
if not queries:
|
|
923
|
+
from mindforge.core.query import RecallResult as _RR
|
|
924
|
+
return _RR(chunks=[], total_found=0,
|
|
925
|
+
query_time_ms=0.0,
|
|
926
|
+
strategy_used="multi:0queries",
|
|
927
|
+
token_estimate=0)
|
|
928
|
+
merged = []
|
|
929
|
+
seen = set()
|
|
930
|
+
for i, q in enumerate(queries[:8]): # 上限 8 条防御
|
|
931
|
+
if not q:
|
|
932
|
+
continue
|
|
933
|
+
res = self.search(
|
|
934
|
+
q, max_results=per_query,
|
|
935
|
+
min_relevance=min_relevance,
|
|
936
|
+
categories=categories, layers=layers,
|
|
937
|
+
agent_id=agent_id, session_id=session_id,
|
|
938
|
+
use_embedding=use_embedding, explain=explain,
|
|
939
|
+
expand_context=expand_context)
|
|
940
|
+
for ch in res.chunks:
|
|
941
|
+
if ch.memory_id not in seen:
|
|
942
|
+
seen.add(ch.memory_id)
|
|
943
|
+
merged.append(ch)
|
|
944
|
+
merged = merged[:max_results]
|
|
945
|
+
elapsed = (_time.perf_counter() - start) * 1000
|
|
946
|
+
from mindforge.core.query import RecallResult as _RR
|
|
947
|
+
return _RR(
|
|
948
|
+
chunks=merged,
|
|
949
|
+
total_found=len(merged),
|
|
950
|
+
query_time_ms=round(elapsed, 2),
|
|
951
|
+
strategy_used=f"multi:{len(queries)}queries",
|
|
952
|
+
token_estimate=sum(len(c.content) for c in merged) // 4)
|
|
953
|
+
|
|
891
954
|
def rebuild_embeddings(self, batch_size: int = 100,
|
|
892
955
|
incremental: bool = True) -> dict:
|
|
893
956
|
"""重建/增量构建嵌入向量(v5.4.5 新增,v5.4.6 增量模式)
|
|
@@ -4,6 +4,7 @@ MindForge 查询引擎
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
import logging
|
|
7
|
+
import re
|
|
7
8
|
from dataclasses import dataclass, field
|
|
8
9
|
from typing import List, Optional, Dict, Any, Tuple
|
|
9
10
|
from .storage import StorageEngine, MemoryEntry
|
|
@@ -64,6 +65,85 @@ class RecallResult:
|
|
|
64
65
|
approximate: bool = False
|
|
65
66
|
|
|
66
67
|
|
|
68
|
+
# v6.5.5:相对时间词归一化表(窗口扩展时就地换算为绝对日期)。
|
|
69
|
+
# 锚定来源:轮次 tags 携带 "ctxdate:YYYY-MM-DD"(可选协议位)。
|
|
70
|
+
# 缺 ctxdate 时原样返回(降级安全)。纯规则零 LLM。
|
|
71
|
+
_TEMPORAL_RULES = [
|
|
72
|
+
("today", 0), ("tonight", 0), ("this morning", 0),
|
|
73
|
+
("this afternoon", 0), ("this evening", 0), ("right now", 0),
|
|
74
|
+
("yesterday", -1), ("yesterday morning", -1), ("last night", -1),
|
|
75
|
+
("tomorrow", 1), ("tomorrow morning", 1),
|
|
76
|
+
("last week", -7), ("next week", 7), ("last weekend", -7),
|
|
77
|
+
("next weekend", 7), ("last month", -30), ("next month", 30),
|
|
78
|
+
("last year", -365), ("next year", 365),
|
|
79
|
+
]
|
|
80
|
+
_N_REL = re.compile(
|
|
81
|
+
r"(\b\d+\s+(?:day|week|month|year)s?\s+ago\b"
|
|
82
|
+
r"|\bin\s+\d+\s+(?:day|week|month|year)s?\b"
|
|
83
|
+
r"|[两二三四五六七八九十0-9]+\s*(?:天|周|月|年)(?:之)?\s*[前后以])", re.IGNORECASE)
|
|
84
|
+
_CN_NUM = {"两": 2, "二": 2, "三": 3, "四": 4, "五": 5, "六": 6,
|
|
85
|
+
"七": 7, "八": 8, "九": 9, "十": 10}
|
|
86
|
+
_REL_DUR = {"day": 1, "week": 7, "month": 30, "year": 365,
|
|
87
|
+
"天": 1, "周": 7, "月": 30, "年": 365}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _normalize_temporal(text: str, anchor: Optional[str]) -> str:
|
|
91
|
+
"""把 text 中的相对时间词换算为 [绝对日期±N] 标注(v6.5.5)
|
|
92
|
+
|
|
93
|
+
anchor 为该轮所属日期(YYYY-MM-DD);None 时原样返回。
|
|
94
|
+
"""
|
|
95
|
+
if not anchor or not text:
|
|
96
|
+
return text
|
|
97
|
+
try:
|
|
98
|
+
from datetime import datetime, timedelta
|
|
99
|
+
base = datetime.strptime(anchor, "%Y-%m-%d")
|
|
100
|
+
except Exception:
|
|
101
|
+
return text
|
|
102
|
+
|
|
103
|
+
def fmt(d):
|
|
104
|
+
return d.strftime("%Y-%m-%d")
|
|
105
|
+
|
|
106
|
+
out = text
|
|
107
|
+
# 显式「N 天/周/月 前(后)」
|
|
108
|
+
def rel_repl(m):
|
|
109
|
+
s = m.group(0).lower()
|
|
110
|
+
import re as _r
|
|
111
|
+
cn = _r.search(r"([两二三四五六七八九十]+)", s)
|
|
112
|
+
if cn:
|
|
113
|
+
# 中文数字(十以内单字;十X=10+X、X十=X*10 简化处理)
|
|
114
|
+
t = cn.group(1)
|
|
115
|
+
if len(t) == 1:
|
|
116
|
+
n = _CN_NUM.get(t, 1)
|
|
117
|
+
else:
|
|
118
|
+
n = 10 + _CN_NUM.get(t[1], 0) if t[0] == "十" else _CN_NUM.get(t[0], 1) * 10 + _CN_NUM.get(t[1], 0)
|
|
119
|
+
else:
|
|
120
|
+
num = _r.search(r"(\d+)", s)
|
|
121
|
+
if not num:
|
|
122
|
+
return m.group(0)
|
|
123
|
+
n = int(num.group(1))
|
|
124
|
+
unit = None
|
|
125
|
+
for k in _REL_DUR:
|
|
126
|
+
if k in s:
|
|
127
|
+
unit = k
|
|
128
|
+
break
|
|
129
|
+
if unit is None:
|
|
130
|
+
return m.group(0)
|
|
131
|
+
delta = n * _REL_DUR[unit]
|
|
132
|
+
if "前" in s or "ago" in s:
|
|
133
|
+
d = base - timedelta(days=delta)
|
|
134
|
+
else:
|
|
135
|
+
d = base + timedelta(days=delta)
|
|
136
|
+
return f"[{fmt(d)}]"
|
|
137
|
+
|
|
138
|
+
out = _N_REL.sub(rel_repl, out)
|
|
139
|
+
# 固定短语表(倒序替换避免子串误伤:先长后短)
|
|
140
|
+
for phrase, delta_days in sorted(_TEMPORAL_RULES, key=lambda x: -len(x[0])):
|
|
141
|
+
pat = re.compile(r"\b" + re.escape(phrase) + r"\b", re.IGNORECASE)
|
|
142
|
+
d = base + timedelta(days=delta_days)
|
|
143
|
+
out = pat.sub(f"[{fmt(d)}]", out)
|
|
144
|
+
return out
|
|
145
|
+
|
|
146
|
+
|
|
67
147
|
# v5.5.5 P1 新增:中文技术同义词词典(50+ 组)
|
|
68
148
|
# 用于查询扩展,提升中文检索召回率
|
|
69
149
|
_CHINESE_SYNONYMS: Dict[str, List[str]] = {
|
|
@@ -524,11 +604,15 @@ class QueryEngine:
|
|
|
524
604
|
approximate=approximate,
|
|
525
605
|
)
|
|
526
606
|
|
|
607
|
+
|
|
527
608
|
def _expand_chunk_context(self, chunks: List[MemoryChunk],
|
|
528
609
|
radius: int) -> None:
|
|
529
610
|
"""按 ctxgrp/ctxseq 坐标 tags 填充 context_expansion(v6.5.2)
|
|
530
611
|
|
|
531
|
-
坐标协议:入库 tags 携带 "ctxgrp:<组id>" 与 "ctxseq:<序号>"
|
|
612
|
+
坐标协议:入库 tags 携带 "ctxgrp:<组id>" 与 "ctxseq:<序号>";
|
|
613
|
+
v6.5.5 起可选 "ctxdate:YYYY-MM-DD"(轮次日期锚)——携带时邻居
|
|
614
|
+
文本中的相对时间词(yesterday/两周前…)就地归一化为绝对日期,
|
|
615
|
+
temporal 类问题的证据自包含时间戳。
|
|
532
616
|
无坐标或组内邻居缺失时该 chunk 字段保持 None(降级安全)。
|
|
533
617
|
窗口 = [seq-radius, seq+radius](含命中轮),升序输出。
|
|
534
618
|
"""
|
|
@@ -565,7 +649,15 @@ class QueryEngine:
|
|
|
565
649
|
if e_seq is None:
|
|
566
650
|
continue
|
|
567
651
|
if abs(e_seq - seq) <= radius:
|
|
568
|
-
|
|
652
|
+
# v6.5.5:邻居轮时间归一化(ctxdate 存在时)
|
|
653
|
+
e_date = None
|
|
654
|
+
for t in (e.tags or []):
|
|
655
|
+
if t.startswith("ctxdate:"):
|
|
656
|
+
e_date = t[8:]
|
|
657
|
+
break
|
|
658
|
+
content = (_normalize_temporal(e.content, e_date)
|
|
659
|
+
if e_date else e.content)
|
|
660
|
+
neighbours.append((e_seq, content))
|
|
569
661
|
if neighbours:
|
|
570
662
|
neighbours.sort(key=lambda x: x[0])
|
|
571
663
|
chunk.context_expansion = neighbours
|
|
@@ -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.5"
|
|
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, 5)
|
|
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.5
|
|
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.5: 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.5 │
|
|
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.5")
|
|
44
|
+
self.assertEqual(core_version.VERSION_INFO, (6, 5, 5))
|
|
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.5")
|
|
666
|
+
self.assertEqual(VERSION_INFO, (6, 5, 5))
|
|
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.5")
|
|
122
|
+
self.assertEqual(VERSION_INFO, (6, 5, 5))
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""v6.5.4 多查询融合检索(search_multi)行为契约
|
|
3
|
+
|
|
4
|
+
背景:LLM 拆解与实体扩展两条 eval 路径当日证伪(LoCoMo cat2 多跳
|
|
5
|
+
实验),本 API 作为中性融合基座保留——拆解策略由调用方提供。
|
|
6
|
+
契约:去重合并、查询序位保序、副作用只记一次、空输入降级安全。
|
|
7
|
+
"""
|
|
8
|
+
import tempfile
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
|
|
12
|
+
from mindforge.core.mindforge import MindForge
|
|
13
|
+
from mindforge.core.types import MemoryConfig
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.fixture
|
|
17
|
+
def mf():
|
|
18
|
+
tmp = tempfile.mkdtemp()
|
|
19
|
+
inst = MindForge(config=MemoryConfig(
|
|
20
|
+
db_path=f"{tmp}/mf.db", key_file=None, encrypted=False))
|
|
21
|
+
yield inst
|
|
22
|
+
inst.close()
|
|
23
|
+
import shutil
|
|
24
|
+
shutil.rmtree(tmp, ignore_errors=True)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _seed(mf):
|
|
28
|
+
mf.add("alpha project kickoff meeting notes", category="work")
|
|
29
|
+
mf.add("beta launch timeline discussion", category="work")
|
|
30
|
+
mf.add("alpha budget review with finance", category="work")
|
|
31
|
+
mf.add("gamma unrelated memo", category="general")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class TestSearchMulti:
|
|
35
|
+
def test_merge_dedup(self, mf):
|
|
36
|
+
"""两查询命中交集记忆:结果无重复 memory_id"""
|
|
37
|
+
_seed(mf)
|
|
38
|
+
res = mf.search_multi(["alpha project", "alpha budget"], per_query=3)
|
|
39
|
+
ids = [c.memory_id for c in res.chunks]
|
|
40
|
+
assert len(ids) == len(set(ids)), "memory_id 出现重复"
|
|
41
|
+
|
|
42
|
+
def test_query_priority_order(self, mf):
|
|
43
|
+
"""第一查询的命中整体排在后续查询之前"""
|
|
44
|
+
_seed(mf)
|
|
45
|
+
res = mf.search_multi(["beta launch", "alpha"], per_query=2)
|
|
46
|
+
assert res.chunks, "应有结果"
|
|
47
|
+
first_query_ids = set()
|
|
48
|
+
r1 = mf.search("beta launch", max_results=2)
|
|
49
|
+
for ch in r1.chunks:
|
|
50
|
+
first_query_ids.add(ch.memory_id)
|
|
51
|
+
# 首查全部命中应在合并结果的前 len(first_query_ids) 位内
|
|
52
|
+
got = set(c.memory_id for c in res.chunks[:len(first_query_ids)])
|
|
53
|
+
assert first_query_ids <= got or first_query_ids == set(
|
|
54
|
+
c.memory_id for c in res.chunks), "首查优先级被破坏"
|
|
55
|
+
|
|
56
|
+
def test_empty_queries(self, mf):
|
|
57
|
+
"""空查询列表:空结果不炸"""
|
|
58
|
+
_seed(mf)
|
|
59
|
+
res = mf.search_multi([], per_query=3)
|
|
60
|
+
assert res.chunks == []
|
|
61
|
+
assert res.strategy_used == "multi:0queries"
|
|
62
|
+
|
|
63
|
+
def test_none_queries(self, mf):
|
|
64
|
+
"""None 查询:等价空"""
|
|
65
|
+
_seed(mf)
|
|
66
|
+
res = mf.search_multi(None)
|
|
67
|
+
assert res.chunks == []
|
|
68
|
+
|
|
69
|
+
def test_single_query_equivalence(self, mf):
|
|
70
|
+
"""单查询(放宽序):合并结果 ⊆ 单 search 结果集"""
|
|
71
|
+
_seed(mf)
|
|
72
|
+
res = mf.search_multi(["alpha"], per_query=3)
|
|
73
|
+
r1 = mf.search("alpha", max_results=3)
|
|
74
|
+
assert {c.memory_id for c in res.chunks} == {
|
|
75
|
+
c.memory_id for c in r1.chunks}
|
|
76
|
+
|
|
77
|
+
def test_max_results_cap(self, mf):
|
|
78
|
+
"""合并结果不超过 max_results"""
|
|
79
|
+
_seed(mf)
|
|
80
|
+
res = mf.search_multi(["alpha", "beta", "gamma"], per_query=3,
|
|
81
|
+
max_results=2)
|
|
82
|
+
assert len(res.chunks) <= 2
|
|
83
|
+
|
|
84
|
+
def test_strategy_and_timing(self, mf):
|
|
85
|
+
"""strategy_used 标记多查询数"""
|
|
86
|
+
_seed(mf)
|
|
87
|
+
res = mf.search_multi(["alpha", "beta"], per_query=2)
|
|
88
|
+
assert res.strategy_used == "multi:2queries"
|
|
89
|
+
assert res.query_time_ms >= 0
|
|
90
|
+
|
|
91
|
+
def test_expand_context_passthrough(self, mf):
|
|
92
|
+
"""expand_context 透传到子查询"""
|
|
93
|
+
for i in range(6):
|
|
94
|
+
mf.add(f"unique-seq-{i} anchor-text",
|
|
95
|
+
category="session",
|
|
96
|
+
tags=[f"ctxgrp:sm", f"ctxseq:{i}"])
|
|
97
|
+
res = mf.search_multi(["unique-seq-2", "unique-seq-4"],
|
|
98
|
+
per_query=1, expand_context=2)
|
|
99
|
+
any_exp = any(c.context_expansion for c in res.chunks)
|
|
100
|
+
assert any_exp, "context_expansion 未透传"
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""v6.5.5 时间归一化窗口扩展(preview)行为契约
|
|
3
|
+
|
|
4
|
+
ctxdate 协议:入库 tags 可选携带 ctxdate:YYYY-MM-DD;窗口扩展时
|
|
5
|
+
邻居文本相对时间词(today/yesterday/两周前…)就地换算绝对日期。
|
|
6
|
+
缺 ctxdate 降级安全;无时间词文本不受影响。
|
|
7
|
+
"""
|
|
8
|
+
import tempfile
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
|
|
12
|
+
from mindforge.core.mindforge import MindForge
|
|
13
|
+
from mindforge.core.query import _normalize_temporal
|
|
14
|
+
from mindforge.core.types import MemoryConfig
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@pytest.fixture
|
|
18
|
+
def mf():
|
|
19
|
+
tmp = tempfile.mkdtemp()
|
|
20
|
+
inst = MindForge(config=MemoryConfig(
|
|
21
|
+
db_path=f"{tmp}/mf.db", key_file=None, encrypted=False))
|
|
22
|
+
yield inst
|
|
23
|
+
inst.close()
|
|
24
|
+
import shutil
|
|
25
|
+
shutil.rmtree(tmp, ignore_errors=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class TestNormalizeUnit:
|
|
29
|
+
def test_yesterday(self):
|
|
30
|
+
out = _normalize_temporal("I went there yesterday", "2023-05-07")
|
|
31
|
+
assert "[2023-05-06]" in out
|
|
32
|
+
|
|
33
|
+
def test_today(self):
|
|
34
|
+
out = _normalize_temporal("meeting is today", "2023-05-07")
|
|
35
|
+
assert "[2023-05-07]" in out
|
|
36
|
+
|
|
37
|
+
def test_n_days_ago(self):
|
|
38
|
+
out = _normalize_temporal("we met 3 days ago", "2023-05-07")
|
|
39
|
+
assert "[2023-05-04]" in out
|
|
40
|
+
|
|
41
|
+
def test_in_n_weeks(self):
|
|
42
|
+
out = _normalize_temporal("leaving in 2 weeks", "2023-05-07")
|
|
43
|
+
assert "[2023-05-21]" in out
|
|
44
|
+
|
|
45
|
+
def test_chinese(self):
|
|
46
|
+
out = _normalize_temporal("两周前我们讨论过", "2023-05-07")
|
|
47
|
+
assert "[2023-04-23]" in out
|
|
48
|
+
|
|
49
|
+
def test_no_anchor(self):
|
|
50
|
+
assert _normalize_temporal("went yesterday", None) == "went yesterday"
|
|
51
|
+
|
|
52
|
+
def test_bad_anchor(self):
|
|
53
|
+
assert _normalize_temporal("went yesterday", "not-a-date") == "went yesterday"
|
|
54
|
+
|
|
55
|
+
def test_no_temporal_words(self):
|
|
56
|
+
out = _normalize_temporal("she likes hiking", "2023-05-07")
|
|
57
|
+
assert out == "she likes hiking"
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class TestExpandWithDate:
|
|
61
|
+
def test_ctxdate_normalized(self, mf):
|
|
62
|
+
"""带 ctxdate 的邻居:相对词被换算"""
|
|
63
|
+
for i in range(5):
|
|
64
|
+
mf.add(f"day-{i} we visited the museum yesterday",
|
|
65
|
+
category="session",
|
|
66
|
+
tags=["ctxgrp:tn", f"ctxseq:{i}", "ctxdate:2023-05-10"])
|
|
67
|
+
res = mf.search("day-2 visited museum", max_results=1,
|
|
68
|
+
expand_context=2)
|
|
69
|
+
assert res.chunks
|
|
70
|
+
exp = res.chunks[0].context_expansion
|
|
71
|
+
assert exp is not None
|
|
72
|
+
joined = " ".join(t for _, t in exp)
|
|
73
|
+
assert "[2023-05-09]" in joined, "yesterday 未按 ctxdate 归一化"
|
|
74
|
+
|
|
75
|
+
def test_no_ctxdate_untouched(self, mf):
|
|
76
|
+
"""无 ctxdate:邻居原文保留(降级安全)"""
|
|
77
|
+
for i in range(5):
|
|
78
|
+
mf.add(f"nd-{i} we watched a movie yesterday",
|
|
79
|
+
category="session",
|
|
80
|
+
tags=["ctxgrp:nd", f"ctxseq:{i}"])
|
|
81
|
+
res = mf.search("nd-2 watched movie", max_results=1,
|
|
82
|
+
expand_context=2)
|
|
83
|
+
exp = res.chunks[0].context_expansion
|
|
84
|
+
assert exp is not None
|
|
85
|
+
joined = " ".join(t for _, t in exp)
|
|
86
|
+
assert "yesterday" in joined and "[2023" not in joined
|
|
87
|
+
|
|
88
|
+
def test_mixed_dates(self, mf):
|
|
89
|
+
"""不同邻居不同日期锚:各自归一化"""
|
|
90
|
+
mf.add("ma-0 breakfast today", category="session",
|
|
91
|
+
tags=["ctxgrp:mx", "ctxseq:0", "ctxdate:2023-01-01"])
|
|
92
|
+
mf.add("ma-1 lunch tomorrow", category="session",
|
|
93
|
+
tags=["ctxgrp:mx", "ctxseq:1", "ctxdate:2023-01-02"])
|
|
94
|
+
res = mf.search("ma-0 breakfast", max_results=1, expand_context=1)
|
|
95
|
+
exp = res.chunks[0].context_expansion
|
|
96
|
+
joined = " ".join(t for _, t in exp)
|
|
97
|
+
assert "[2023-01-01]" in joined and "[2023-01-03]" in joined
|
|
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.3 → mindforge_memory-6.5.5}/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.3 → mindforge_memory-6.5.5}/mindforge_memory.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{mindforge_memory-6.5.3 → mindforge_memory-6.5.5}/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
|
|
File without changes
|