mindforge-memory 6.5.7__tar.gz → 6.5.9__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.7/mindforge_memory.egg-info → mindforge_memory-6.5.9}/PKG-INFO +9 -9
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/README.md +8 -8
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/cli/main.py +10 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/core/storage.py +101 -19
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/core/version.py +2 -2
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9/mindforge_memory.egg-info}/PKG-INFO +9 -9
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v568_fixes.py +1 -1
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v575_release_consistency.py +2 -2
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v612_fixes.py +2 -2
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v636_fixes.py +6 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v643_fixes.py +16 -1
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v645_fixes.py +1 -1
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v646_fixes.py +1 -1
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v649_fixes.py +2 -2
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/LICENSE +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/MindForge.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/__init__.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/adapters/__init__.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/adapters/claude_adapter.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/adapters/crewai_memory.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/adapters/generic_api.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/adapters/langgraph_store.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/adapters/openclaw_adapter.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/api/__init__.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/api/server.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/cli/__init__.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/core/__init__.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/core/embedding.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/core/encryption.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/core/indexer.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/core/mindforge.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/core/paths.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/core/query.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/core/types.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/daemon/__init__.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/daemon/server.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/mcp/__init__.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/mcp/server.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/__init__.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/categorizer.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/conflict_detector.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/connectors.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/context_window.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/event_bus.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/evolution.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/experience.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/federated.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/federated_acl.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/follow_up.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/hybrid_search.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/importer.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/integrator.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/intent_router.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/knowledge_graph.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/memory_compressor.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/memory_decay.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/memory_passport.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/multi_agent.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/multimodal.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/outcome_learning.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/personality.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/principled_forgetting.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/privacy.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/recall.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/session_focus.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/share_conflict.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/skill_extractor.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/skill_pack.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/timeline_viz.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge/modules/v6.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge_memory.egg-info/SOURCES.txt +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge_memory.egg-info/dependency_links.txt +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge_memory.egg-info/entry_points.txt +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge_memory.egg-info/requires.txt +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge_memory.egg-info/top_level.txt +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/pyproject.toml +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/setup.cfg +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/setup.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_core.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_security_hardening.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_trash_hard_delete.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v546_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v547_fixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v548_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v550_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v552_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v554_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v556_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v557_banner_insight_wal.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v557_security_fixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v557_webhook_sig_export.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v558_audit_fixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v558_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v560_decay_gc.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v560_kdf_versioning.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v560_module_coverage.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v561_security.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v562_p2_fixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v563_entry_coverage.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v563_perf_fixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v565_security.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v566_encrypted_search.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v567_security_fixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v569_fts_sync.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v570_coverage_expansion.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v570_drama_and_utils.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v570_encrypted_fallback.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v571_fixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v572_security.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v573_encrypted_export.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v573_security.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v576_bitemporal.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v576_gdpr.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v577_agent_governance.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v578_embedding.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v579_graph.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v580_experience.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v5812_bugfixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v583_security.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v584_adapters.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v585_benchmark.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v586_federated_mcp.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v590_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v592_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v593_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v595_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v600_forgetting_followup.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v600_import_timeline.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v600_multi_agent_formal.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v600_outcome_passport.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v600_skillpack_evolution.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v611_fixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v612_cascade_fixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v613_integrity.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v620_growth_governance.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v630_search_explain.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v631_scrypt.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v632_explain_interfaces.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v635_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v635_integration.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v648_fixes.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v652_context_expansion.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v654_search_multi.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v655_temporal_norm.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v656_security.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v657_six_path.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/tests/test_v65_features.py +0 -0
- {mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/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.9
|
|
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.
|
|
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)
|
|
40
40
|
>
|
|
41
|
-
> *Timeline note (v6.5.
|
|
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.
|
|
42
42
|
|
|
43
43
|
[](https://www.python.org/downloads/)
|
|
44
44
|
[](LICENSE)
|
|
45
|
-
[](https://github.com/opok-ops/MindForge/releases)
|
|
46
46
|
[](https://github.com/opok-ops/MindForge/stargazers)
|
|
47
47
|
[](https://github.com/opok-ops/MindForge/forks)
|
|
48
48
|
[](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.
|
|
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/`.
|
|
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.
|
|
117
|
+
v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,300+ tests**.
|
|
118
118
|
|
|
119
|
-
- **v6.5.
|
|
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`).
|
|
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.7 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.
|
|
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.
|
|
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.7 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,30
|
|
|
193
193
|
|
|
194
194
|
```
|
|
195
195
|
┌──────────────────────────────────────────────────────┐
|
|
196
|
-
│ MindForge v6.5.
|
|
196
|
+
│ MindForge v6.5.9 │
|
|
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
|
+
> **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)
|
|
10
10
|
>
|
|
11
|
-
> *Timeline note (v6.5.
|
|
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.
|
|
12
12
|
|
|
13
13
|
[](https://www.python.org/downloads/)
|
|
14
14
|
[](LICENSE)
|
|
15
|
-
[](https://github.com/opok-ops/MindForge/releases)
|
|
16
16
|
[](https://github.com/opok-ops/MindForge/stargazers)
|
|
17
17
|
[](https://github.com/opok-ops/MindForge/forks)
|
|
18
18
|
[](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.
|
|
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/`.
|
|
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.
|
|
87
|
+
v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,300+ tests**.
|
|
88
88
|
|
|
89
|
-
- **v6.5.
|
|
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`).
|
|
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.7 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.
|
|
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.
|
|
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.7 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,30
|
|
|
163
163
|
|
|
164
164
|
```
|
|
165
165
|
┌──────────────────────────────────────────────────────┐
|
|
166
|
-
│ MindForge v6.5.
|
|
166
|
+
│ MindForge v6.5.9 │
|
|
167
167
|
│ Cognitive Layer Personality · KnowledgeGraph │
|
|
168
168
|
│ MemoryEvolution · FederatedMemory │
|
|
169
169
|
├──────────────────────────────────────────────────────┤
|
|
@@ -3601,6 +3601,16 @@ def _json_out(data, indent=2):
|
|
|
3601
3601
|
|
|
3602
3602
|
|
|
3603
3603
|
def main(argv=None):
|
|
3604
|
+
# v6.5.8:Windows 控制台强制 UTF-8——中文 help/输出在 cp1252/cp936
|
|
3605
|
+
# 控制台直接 UnicodeEncodeError(CI Windows 矩阵首跑抓到,
|
|
3606
|
+
# 真 Windows 用户 --help 即崩)。Py3.7+ TextIOWrapper 支持
|
|
3607
|
+
# reconfigure;已重定向的流(管道)无 encoding 属性时跳过。
|
|
3608
|
+
for _stream in (sys.stdout, sys.stderr):
|
|
3609
|
+
try:
|
|
3610
|
+
if hasattr(_stream, "reconfigure"):
|
|
3611
|
+
_stream.reconfigure(encoding="utf-8")
|
|
3612
|
+
except (ValueError, AttributeError, OSError):
|
|
3613
|
+
pass
|
|
3604
3614
|
parser = argparse.ArgumentParser(
|
|
3605
3615
|
prog="mindforge",
|
|
3606
3616
|
description=f"MindForge v{__version__} - AI Agent 终身记忆系统",
|
|
@@ -85,11 +85,43 @@ def _is_network_fs(path: Path) -> bool:
|
|
|
85
85
|
# ===== 路径安全校验(v5.2.9 新增:存储层统一防护)=====
|
|
86
86
|
|
|
87
87
|
# v5.3.5 安全加固:检测 Windows 短文件名(8.3)绕过尝试
|
|
88
|
+
def _is_dangerous_component(comp: str) -> bool:
|
|
89
|
+
"""v6.5.8:结构性危险组件(.. / 分隔符 / NUL / Windows 冒号)
|
|
90
|
+
|
|
91
|
+
必须在**原始未 resolve** 的路径上检查——resolve 会把 `..` 归一化
|
|
92
|
+
掉,归一化后的组件列表里遍历痕迹消失(v6.5.7 曾因此引入回归,
|
|
93
|
+
test_path_traversal_rejected 抓住)。
|
|
94
|
+
"""
|
|
95
|
+
if not comp or len(comp) == 0:
|
|
96
|
+
return False
|
|
97
|
+
# v5.4.5 修复 #11:豁免 Unix 根路径 '/'
|
|
98
|
+
if comp == '/':
|
|
99
|
+
return False
|
|
100
|
+
# v5.3.7 修复(v6.5.8 回归补):豁免 Windows 盘符根(C:\ / C:)——
|
|
101
|
+
# 冒号在危险列表里,但盘符根是每个 Windows 绝对路径的第一个
|
|
102
|
+
# 组件,不豁免则全部导出功能炸(CI Windows 首跑抓到)
|
|
103
|
+
import re as _re
|
|
104
|
+
if len(comp) <= 3 and _re.match(r'^[A-Za-z]:\\?$', comp):
|
|
105
|
+
return False
|
|
106
|
+
import sys as _sys
|
|
107
|
+
_dangerous = ('..', '/', '\\', '\x00', ':') if _sys.platform == 'win32' else ('..', '/', '\\', '\x00')
|
|
108
|
+
if any(s in comp for s in _dangerous):
|
|
109
|
+
return True
|
|
110
|
+
return False
|
|
111
|
+
|
|
112
|
+
|
|
88
113
|
def _is_suspicious_windows_path(comp: str) -> bool:
|
|
89
|
-
"""检测 Windows 短文件名绕过模式(如 PROGRA~1、FILE~1.TXT)
|
|
114
|
+
"""检测 Windows 短文件名绕过模式(如 PROGRA~1、FILE~1.TXT)
|
|
115
|
+
|
|
116
|
+
v6.5.8:只负责短名模式匹配。调用方应在 **resolve(strict=False)
|
|
117
|
+
之后** 的组件上调用——Windows API 会展开**已存在**的短名
|
|
118
|
+
(RUNNER~1 → runneradmin,文件系统现实非攻击),展开后组件不再
|
|
119
|
+
匹配短名模式即放行;**不存在**的短名 resolve 保留原样 → 匹配 →
|
|
120
|
+
拒绝(攻击性短名)。Linux 上 resolve 不展开 8.3(无此概念),
|
|
121
|
+
恶意短名照拒。
|
|
122
|
+
"""
|
|
90
123
|
if not comp or len(comp) == 0:
|
|
91
124
|
return False
|
|
92
|
-
# v5.4.5 修复 #11:豁免 Unix 根路径 '/',否则 Linux/Mac 上所有导出功能不可用
|
|
93
125
|
if comp == '/':
|
|
94
126
|
return False
|
|
95
127
|
import re as _re
|
|
@@ -99,11 +131,6 @@ def _is_suspicious_windows_path(comp: str) -> bool:
|
|
|
99
131
|
# 匹配 短名模式:基础名 + ~N + 可选扩展名
|
|
100
132
|
if _re.match(r'^[^~]{1,6}~\d(\..{1,3})?$', comp, _re.IGNORECASE):
|
|
101
133
|
return True
|
|
102
|
-
# v5.5.1 fix: colon only dangerous on Windows
|
|
103
|
-
import sys as _sys
|
|
104
|
-
_dangerous = ('..', '/', '\\', '\x00', ':') if _sys.platform == 'win32' else ('..', '/', '\\', '\x00')
|
|
105
|
-
if any(s in comp for s in _dangerous):
|
|
106
|
-
return True
|
|
107
134
|
return False
|
|
108
135
|
|
|
109
136
|
|
|
@@ -121,11 +148,22 @@ def _safe_path(path_str, must_exist=False, allow_symlinks=False,
|
|
|
121
148
|
# 过滤双向控制字符(RLO/LRO 等)和 NUL,防止显示欺骗
|
|
122
149
|
if cat in ('Cf', 'Cc') and ch not in '\n\r\t':
|
|
123
150
|
raise ValueError("路径中包含非法控制字符")
|
|
124
|
-
# v5.3.5
|
|
151
|
+
# v5.3.5 安全:逐组件检测路径遍历/危险字符(原始路径,resolve 前)
|
|
125
152
|
target = Path(path_str)
|
|
126
153
|
if not target.is_absolute():
|
|
127
154
|
target = Path.cwd() / target
|
|
128
155
|
for comp in target.parts:
|
|
156
|
+
if comp and _is_dangerous_component(comp):
|
|
157
|
+
raise ValueError(f"路径组件不安全: {comp}")
|
|
158
|
+
# v6.5.7/v6.5.8:短名检测在 resolve 之后——Windows API 展开
|
|
159
|
+
# 已存在前缀的 8.3 短名(C:\Users\RUNNER~1 是 runner 目录的
|
|
160
|
+
# 文件系统现实,展开后不再匹配短名模式);不存在的短名
|
|
161
|
+
# (攻击性)resolve 后原样保留 → 仍匹配 → 拒绝。
|
|
162
|
+
try:
|
|
163
|
+
check_target = target.resolve(strict=False)
|
|
164
|
+
except (OSError, RuntimeError):
|
|
165
|
+
check_target = target
|
|
166
|
+
for comp in check_target.parts:
|
|
129
167
|
if comp and _is_suspicious_windows_path(comp):
|
|
130
168
|
raise ValueError(f"路径组件不安全: {comp}")
|
|
131
169
|
|
|
@@ -747,6 +785,17 @@ class StorageEngine:
|
|
|
747
785
|
conn = getattr(self._conn_local, "conn", None)
|
|
748
786
|
if conn is None:
|
|
749
787
|
conn = sqlite3.connect(str(self.db_path), timeout=10.0)
|
|
788
|
+
# v6.5.7:注册到全连接表(弱引用,GC 后自动消失)——
|
|
789
|
+
# close() 时可关闭其他线程遗留连接。Windows 上未关的
|
|
790
|
+
# sqlite 连接会锁住文件(WinError 32),临时目录清理
|
|
791
|
+
# 直接炸;Linux 无文件锁所以此前从未暴露。
|
|
792
|
+
try:
|
|
793
|
+
import weakref as _weakref
|
|
794
|
+
if not hasattr(self, "_all_conns"):
|
|
795
|
+
self._all_conns = _weakref.WeakSet()
|
|
796
|
+
self._all_conns.add(conn)
|
|
797
|
+
except Exception:
|
|
798
|
+
pass
|
|
750
799
|
conn.row_factory = sqlite3.Row
|
|
751
800
|
# v5.5.7 安全加固:网络文件系统不支持 WAL,检测后降级
|
|
752
801
|
if _is_network_fs(self.db_path):
|
|
@@ -2058,12 +2107,17 @@ class StorageEngine:
|
|
|
2058
2107
|
conn = self._get_conn()
|
|
2059
2108
|
|
|
2060
2109
|
def _meta(mid: str):
|
|
2110
|
+
# v6.5.8:附带 created_at——Windows 15.6ms 计时精度下两条
|
|
2111
|
+
# add 的 updated_at 落同一 tick,older 判定的 `<=` 平局裁决
|
|
2112
|
+
# 永远指向扫描第一位(ORDER BY created_at DESC = 新的),
|
|
2113
|
+
# keep_newer 实际杀新的。created_at 作为平局决胜键。
|
|
2061
2114
|
row = conn.execute(
|
|
2062
|
-
"SELECT updated_at, importance FROM memories WHERE id = ?",
|
|
2115
|
+
"SELECT updated_at, importance, created_at FROM memories WHERE id = ?",
|
|
2063
2116
|
(mid,)).fetchone()
|
|
2064
2117
|
if not row:
|
|
2065
|
-
return (0.0, "MEDIUM")
|
|
2066
|
-
return (float(row[0] or 0.0), row[1] or "MEDIUM"
|
|
2118
|
+
return (0.0, "MEDIUM", 0.0)
|
|
2119
|
+
return (float(row[0] or 0.0), row[1] or "MEDIUM",
|
|
2120
|
+
float(row[2] or 0.0))
|
|
2067
2121
|
|
|
2068
2122
|
for c in conflicts:
|
|
2069
2123
|
a_id, b_id = c["memory_a_id"], c["memory_b_id"]
|
|
@@ -2072,15 +2126,19 @@ class StorageEngine:
|
|
|
2072
2126
|
needs_review.append({**c, "status": "pending"})
|
|
2073
2127
|
continue
|
|
2074
2128
|
if action == "keep_newer":
|
|
2075
|
-
a_ts, _ = _meta(a_id)
|
|
2076
|
-
b_ts, _ = _meta(b_id)
|
|
2077
|
-
|
|
2129
|
+
a_ts, _, a_ct = _meta(a_id)
|
|
2130
|
+
b_ts, _, b_ct = _meta(b_id)
|
|
2131
|
+
if a_ts != b_ts:
|
|
2132
|
+
older = a_id if a_ts < b_ts else b_id
|
|
2133
|
+
else:
|
|
2134
|
+
# updated_at 同 tick → created_at 决胜(老的创建早)
|
|
2135
|
+
older = a_id if a_ct <= b_ct else b_id
|
|
2078
2136
|
ok = self.expire_memory(older, actor="reconcile")
|
|
2079
2137
|
reconciled.append({**c, "action_taken": "expire",
|
|
2080
2138
|
"expired_id": older if ok else None})
|
|
2081
2139
|
elif action == "keep_higher_importance":
|
|
2082
|
-
_, a_imp = _meta(a_id)
|
|
2083
|
-
_, b_imp = _meta(b_id)
|
|
2140
|
+
_, a_imp, _ct = _meta(a_id)
|
|
2141
|
+
_, b_imp, _ct2 = _meta(b_id)
|
|
2084
2142
|
lower = a_id if imp_map.get(a_imp, 1) <= imp_map.get(b_imp, 1) else b_id
|
|
2085
2143
|
ok = self.expire_memory(lower, actor="reconcile")
|
|
2086
2144
|
reconciled.append({**c, "action_taken": "expire",
|
|
@@ -7611,7 +7669,12 @@ class StorageEngine:
|
|
|
7611
7669
|
raise SecurityError(f"高敏感操作审计失败,拒绝执行: {action}") from e
|
|
7612
7670
|
|
|
7613
7671
|
def _close_conns(self):
|
|
7614
|
-
"""关闭当前线程持有的 SQLite 连接(v5.4.6 线程安全改造)
|
|
7672
|
+
"""关闭当前线程持有的 SQLite 连接(v5.4.6 线程安全改造)
|
|
7673
|
+
|
|
7674
|
+
v6.5.7:遍历全连接表关闭其他线程遗留连接(弱引用,已 GC 的
|
|
7675
|
+
自动跳过)。此前只关当前线程——probe/请求线程死掉后连接
|
|
7676
|
+
悬挂,Windows 文件锁导致 unlink 失败(WinError 32)。
|
|
7677
|
+
"""
|
|
7615
7678
|
conn = getattr(self._conn_local, "conn", None)
|
|
7616
7679
|
if conn is not None:
|
|
7617
7680
|
try:
|
|
@@ -7619,6 +7682,17 @@ class StorageEngine:
|
|
|
7619
7682
|
except sqlite3.Error:
|
|
7620
7683
|
pass
|
|
7621
7684
|
self._conn_local.conn = None
|
|
7685
|
+
for c in list(getattr(self, "_all_conns", ()) or ()):
|
|
7686
|
+
if c is conn:
|
|
7687
|
+
continue
|
|
7688
|
+
try:
|
|
7689
|
+
c.close()
|
|
7690
|
+
except sqlite3.Error:
|
|
7691
|
+
pass
|
|
7692
|
+
try:
|
|
7693
|
+
getattr(self, "_all_conns", None) and self._all_conns.clear()
|
|
7694
|
+
except Exception:
|
|
7695
|
+
pass
|
|
7622
7696
|
|
|
7623
7697
|
def close_thread_conn(self) -> None:
|
|
7624
7698
|
"""关闭当前线程持有的 SQLite 连接(v5.7.1 新增)
|
|
@@ -8559,7 +8633,10 @@ class StorageEngine:
|
|
|
8559
8633
|
" memory_type, layer, source_session, source_agent, metadata,"
|
|
8560
8634
|
" created_at, updated_at"
|
|
8561
8635
|
" FROM memories"
|
|
8562
|
-
|
|
8636
|
+
# v6.5.8:created_at <= cutoff(Windows 15.6ms 计时精度下
|
|
8637
|
+
# max_age_hours=0 时 created_at 与 cutoff 同 tick,严格
|
|
8638
|
+
# < 恒 False → 归档 0 条;Linux 高精度时钟从未暴露)
|
|
8639
|
+
" WHERE layer = ? AND category != 'trash' AND created_at <= ?",
|
|
8563
8640
|
(layer, cutoff_time)
|
|
8564
8641
|
).fetchall()
|
|
8565
8642
|
|
|
@@ -18761,7 +18838,12 @@ class StorageEngine:
|
|
|
18761
18838
|
# 自动选择:更新的 > 重要度高的 > 访问次数多的
|
|
18762
18839
|
imp_map = {"LOW": 0, "MEDIUM": 1, "HIGH": 2, "CRITICAL": 3}
|
|
18763
18840
|
|
|
18764
|
-
|
|
18841
|
+
# v6.5.8:updated_at 相等(Windows 15.6ms 计时精度下两条
|
|
18842
|
+
# add 落在同一 tick)时用 created_at 决胜——`>=` 恒让先
|
|
18843
|
+
# add 的条目赢,与「保留更新者」语义相反
|
|
18844
|
+
a_newer = (entry_a.updated_at > entry_b.updated_at
|
|
18845
|
+
or (entry_a.updated_at == entry_b.updated_at
|
|
18846
|
+
and entry_a.created_at > entry_b.created_at))
|
|
18765
18847
|
a_higher_imp = imp_map.get(str(entry_a.importance), 1) > \
|
|
18766
18848
|
imp_map.get(str(entry_b.importance), 1)
|
|
18767
18849
|
a_more_access = entry_a.access_count >= entry_b.access_count
|
|
@@ -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.9"
|
|
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, 9)
|
|
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.9
|
|
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.
|
|
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)
|
|
40
40
|
>
|
|
41
|
-
> *Timeline note (v6.5.
|
|
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.
|
|
42
42
|
|
|
43
43
|
[](https://www.python.org/downloads/)
|
|
44
44
|
[](LICENSE)
|
|
45
|
-
[](https://github.com/opok-ops/MindForge/releases)
|
|
46
46
|
[](https://github.com/opok-ops/MindForge/stargazers)
|
|
47
47
|
[](https://github.com/opok-ops/MindForge/forks)
|
|
48
48
|
[](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.
|
|
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/`.
|
|
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.
|
|
117
|
+
v6.1.3 – v6.5.9 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,300+ tests**.
|
|
118
118
|
|
|
119
|
-
- **v6.5.
|
|
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`).
|
|
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.7 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.
|
|
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.
|
|
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.7 shipped in two weeks (2026-11-01 → 11-14), guarded by **1,30
|
|
|
193
193
|
|
|
194
194
|
```
|
|
195
195
|
┌──────────────────────────────────────────────────────┐
|
|
196
|
-
│ MindForge v6.5.
|
|
196
|
+
│ MindForge v6.5.9 │
|
|
197
197
|
│ Cognitive Layer Personality · KnowledgeGraph │
|
|
198
198
|
│ MemoryEvolution · FederatedMemory │
|
|
199
199
|
├──────────────────────────────────────────────────────┤
|
|
@@ -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.9")
|
|
44
|
+
self.assertEqual(core_version.VERSION_INFO, (6, 5, 9))
|
|
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.9")
|
|
666
|
+
self.assertEqual(VERSION_INFO, (6, 5, 9))
|
|
667
667
|
|
|
668
668
|
def test_json_round_trip_safety_of_preview(self):
|
|
669
669
|
"""save_evolution 的预览序列化不得抛(不可 json 化的对象走 str 兜底)。"""
|
|
@@ -156,6 +156,12 @@ class TestBugDKeyFileBoundary(unittest.TestCase):
|
|
|
156
156
|
err = ""
|
|
157
157
|
except Exception as e:
|
|
158
158
|
err = str(e)
|
|
159
|
+
finally:
|
|
160
|
+
# v6.5.8:Windows 文件锁——_get_memory 构造的临时实例
|
|
161
|
+
# 未被显式 close,等 GC 会锁住 plain.db(WinError 32);
|
|
162
|
+
# 强制 GC 释放全部句柄后再交还 TemporaryDirectory
|
|
163
|
+
import gc as _gc
|
|
164
|
+
_gc.collect()
|
|
159
165
|
self.assertNotIn("密码", err)
|
|
160
166
|
self.assertNotIn("password", err.lower())
|
|
161
167
|
|
|
@@ -80,10 +80,25 @@ class TestSynchronousNormalGuard(_WALCase):
|
|
|
80
80
|
).fetchone()[0]
|
|
81
81
|
except Exception as exc: # pragma: no cover - 显形优先
|
|
82
82
|
results["error"] = repr(exc)
|
|
83
|
+
finally:
|
|
84
|
+
# v6.5.8:线程自己关自己的 thread-local 连接——主线程
|
|
85
|
+
# 调 close_thread_conn 关不到其他线程的 local 槽,
|
|
86
|
+
# Windows 上未关连接锁住 db 文件(WinError 32)
|
|
87
|
+
try:
|
|
88
|
+
self.storage.close_thread_conn()
|
|
89
|
+
except Exception:
|
|
90
|
+
pass
|
|
83
91
|
|
|
84
92
|
t = threading.Thread(target=probe)
|
|
85
93
|
t.start()
|
|
86
94
|
t.join(timeout=10)
|
|
95
|
+
# v6.5.8:Windows 文件锁——probe 线程的 thread-local 连接
|
|
96
|
+
# 显式关闭(线程死后的 GC 时机不保证,Windows 上未关连接
|
|
97
|
+
# 锁住 db 文件,tearDown unlink 炸 WinError 32)
|
|
98
|
+
try:
|
|
99
|
+
self.storage.close_thread_conn()
|
|
100
|
+
except Exception:
|
|
101
|
+
pass
|
|
87
102
|
self.assertNotIn("error", results, results.get("error", ""))
|
|
88
103
|
self.assertEqual(results.get("mode"), 1)
|
|
89
104
|
|
|
@@ -94,7 +109,7 @@ class TestVersionBump(unittest.TestCase):
|
|
|
94
109
|
钉点集合随版本数递增,发版链清单必须扫全部 test_v*fixes.py。"""
|
|
95
110
|
|
|
96
111
|
def test_version_is_current(self):
|
|
97
|
-
self.assertEqual(__version__, "6.5.
|
|
112
|
+
self.assertEqual(__version__, "6.5.9")
|
|
98
113
|
|
|
99
114
|
|
|
100
115
|
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.
|
|
122
|
-
self.assertEqual(VERSION_INFO, (6, 5,
|
|
121
|
+
self.assertEqual(__version__, "6.5.9")
|
|
122
|
+
self.assertEqual(VERSION_INFO, (6, 5, 9))
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
if __name__ == "__main__":
|
|
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.7 → mindforge_memory-6.5.9}/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
|
|
File without changes
|
{mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/mindforge_memory.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{mindforge_memory-6.5.7 → mindforge_memory-6.5.9}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|