hippocampus-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. hippocampus_mcp-0.1.0/.gitignore +172 -0
  2. hippocampus_mcp-0.1.0/CITATION.cff +28 -0
  3. hippocampus_mcp-0.1.0/CODE_OF_CONDUCT.md +57 -0
  4. hippocampus_mcp-0.1.0/CONTRIBUTING.md +140 -0
  5. hippocampus_mcp-0.1.0/LICENSE +21 -0
  6. hippocampus_mcp-0.1.0/PKG-INFO +365 -0
  7. hippocampus_mcp-0.1.0/README.md +320 -0
  8. hippocampus_mcp-0.1.0/README.zh-CN.md +496 -0
  9. hippocampus_mcp-0.1.0/docs/ARCHITECTURE.md +475 -0
  10. hippocampus_mcp-0.1.0/docs/BENCHMARKS.md +120 -0
  11. hippocampus_mcp-0.1.0/docs/INTEGRATION.md +270 -0
  12. hippocampus_mcp-0.1.0/docs/PRIVACY.md +153 -0
  13. hippocampus_mcp-0.1.0/docs/SELECTION.md +100 -0
  14. hippocampus_mcp-0.1.0/docs/assets/layer-merge.svg +84 -0
  15. hippocampus_mcp-0.1.0/examples/quickstart.py +132 -0
  16. hippocampus_mcp-0.1.0/pyproject.toml +113 -0
  17. hippocampus_mcp-0.1.0/src/hippocampus_mcp/__init__.py +52 -0
  18. hippocampus_mcp-0.1.0/src/hippocampus_mcp/application/__init__.py +37 -0
  19. hippocampus_mcp-0.1.0/src/hippocampus_mcp/application/base.py +194 -0
  20. hippocampus_mcp-0.1.0/src/hippocampus_mcp/application/bootstrap_service.py +115 -0
  21. hippocampus_mcp-0.1.0/src/hippocampus_mcp/application/library_admin_service.py +377 -0
  22. hippocampus_mcp-0.1.0/src/hippocampus_mcp/application/maintain_service.py +172 -0
  23. hippocampus_mcp-0.1.0/src/hippocampus_mcp/application/organize_service.py +197 -0
  24. hippocampus_mcp-0.1.0/src/hippocampus_mcp/application/recall_service.py +1208 -0
  25. hippocampus_mcp-0.1.0/src/hippocampus_mcp/application/tags.py +38 -0
  26. hippocampus_mcp-0.1.0/src/hippocampus_mcp/application/write_service.py +603 -0
  27. hippocampus_mcp-0.1.0/src/hippocampus_mcp/benchmarks/__init__.py +50 -0
  28. hippocampus_mcp-0.1.0/src/hippocampus_mcp/benchmarks/baselines.py +458 -0
  29. hippocampus_mcp-0.1.0/src/hippocampus_mcp/benchmarks/evaluator.py +448 -0
  30. hippocampus_mcp-0.1.0/src/hippocampus_mcp/benchmarks/metrics.py +350 -0
  31. hippocampus_mcp-0.1.0/src/hippocampus_mcp/brain/__init__.py +32 -0
  32. hippocampus_mcp-0.1.0/src/hippocampus_mcp/brain/core.py +4968 -0
  33. hippocampus_mcp-0.1.0/src/hippocampus_mcp/brain/entity.py +1248 -0
  34. hippocampus_mcp-0.1.0/src/hippocampus_mcp/brain/pure.py +1170 -0
  35. hippocampus_mcp-0.1.0/src/hippocampus_mcp/brain/session.py +1476 -0
  36. hippocampus_mcp-0.1.0/src/hippocampus_mcp/bridge.py +320 -0
  37. hippocampus_mcp-0.1.0/src/hippocampus_mcp/cli.py +1718 -0
  38. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/__init__.py +1 -0
  39. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/config_bridge.py +45 -0
  40. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/constants.py +756 -0
  41. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/params.py +189 -0
  42. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/present.py +224 -0
  43. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/recency.py +128 -0
  44. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/session_ctx.py +103 -0
  45. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/session_task.py +87 -0
  46. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/sidecar_lock.py +340 -0
  47. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/stats.py +71 -0
  48. hippocampus_mcp-0.1.0/src/hippocampus_mcp/common/write_origin.py +128 -0
  49. hippocampus_mcp-0.1.0/src/hippocampus_mcp/config.py +846 -0
  50. hippocampus_mcp-0.1.0/src/hippocampus_mcp/daemon.py +854 -0
  51. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/__init__.py +1 -0
  52. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/adaptive_select.py +357 -0
  53. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/aliases.py +541 -0
  54. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/conflict_annotate.py +142 -0
  55. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/consolidate_flow.py +303 -0
  56. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/constants.py +58 -0
  57. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/context_slots.py +218 -0
  58. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/drift_ops.py +126 -0
  59. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/entity_link.py +193 -0
  60. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/file_registry_flow.py +156 -0
  61. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/forget_cleanup.py +85 -0
  62. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/forget_entry.py +118 -0
  63. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/forget_flow.py +139 -0
  64. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/ingest_batch_flow.py +361 -0
  65. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/ingest_entry.py +177 -0
  66. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/ingest_flow.py +189 -0
  67. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/ingest_pipeline.py +292 -0
  68. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/knowledge_batch.py +229 -0
  69. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/knowledge_brief.py +88 -0
  70. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/knowledge_map_view.py +230 -0
  71. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/knowledge_ops.py +122 -0
  72. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/long_content.py +230 -0
  73. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/map_drift.py +140 -0
  74. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/map_ops.py +150 -0
  75. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/map_view.py +283 -0
  76. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/metacog.py +163 -0
  77. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/miss_log_flow.py +100 -0
  78. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/novelty_gate.py +328 -0
  79. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/policies.py +183 -0
  80. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/profile_ops.py +223 -0
  81. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/project_view.py +153 -0
  82. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/promote_candidates.py +128 -0
  83. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/prospective.py +219 -0
  84. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/pure_checks.py +77 -0
  85. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/recall_flow.py +405 -0
  86. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/refresh_knowledge_flow.py +292 -0
  87. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/scope_recall.py +233 -0
  88. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/sensitive.py +173 -0
  89. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/stats_projection.py +190 -0
  90. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/stats_report.py +209 -0
  91. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/stats_views.py +275 -0
  92. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/summarize_batch_flow.py +166 -0
  93. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/supersede_views.py +149 -0
  94. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/tag_select.py +83 -0
  95. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/tag_update.py +307 -0
  96. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/tagging.py +699 -0
  97. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/task_directory.py +289 -0
  98. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/task_profile.py +186 -0
  99. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/topic.py +1460 -0
  100. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/topic_material.py +107 -0
  101. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/user_scope.py +94 -0
  102. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/write_boundary.py +240 -0
  103. hippocampus_mcp-0.1.0/src/hippocampus_mcp/domain/write_quarantine.py +128 -0
  104. hippocampus_mcp-0.1.0/src/hippocampus_mcp/engine/__init__.py +1 -0
  105. hippocampus_mcp-0.1.0/src/hippocampus_mcp/engine/embeddings.py +1320 -0
  106. hippocampus_mcp-0.1.0/src/hippocampus_mcp/engine/manager.py +1961 -0
  107. hippocampus_mcp-0.1.0/src/hippocampus_mcp/engine/model_cache.py +467 -0
  108. hippocampus_mcp-0.1.0/src/hippocampus_mcp/engine/model_lifecycle.py +256 -0
  109. hippocampus_mcp-0.1.0/src/hippocampus_mcp/engine/onnx_embedder.py +640 -0
  110. hippocampus_mcp-0.1.0/src/hippocampus_mcp/hook_client.py +492 -0
  111. hippocampus_mcp-0.1.0/src/hippocampus_mcp/hook_shims/__init__.py +14 -0
  112. hippocampus_mcp-0.1.0/src/hippocampus_mcp/hook_shims/hippo_context.py +94 -0
  113. hippocampus_mcp-0.1.0/src/hippocampus_mcp/hook_shims/hippo_session.py +91 -0
  114. hippocampus_mcp-0.1.0/src/hippocampus_mcp/hook_shims/hippo_stop.py +95 -0
  115. hippocampus_mcp-0.1.0/src/hippocampus_mcp/host_configs.py +297 -0
  116. hippocampus_mcp-0.1.0/src/hippocampus_mcp/init_project.py +197 -0
  117. hippocampus_mcp-0.1.0/src/hippocampus_mcp/installer.py +332 -0
  118. hippocampus_mcp-0.1.0/src/hippocampus_mcp/launcher.py +1555 -0
  119. hippocampus_mcp-0.1.0/src/hippocampus_mcp/library/__init__.py +461 -0
  120. hippocampus_mcp-0.1.0/src/hippocampus_mcp/library/access_log.py +91 -0
  121. hippocampus_mcp-0.1.0/src/hippocampus_mcp/library/registry.py +183 -0
  122. hippocampus_mcp-0.1.0/src/hippocampus_mcp/library/task_directory.py +186 -0
  123. hippocampus_mcp-0.1.0/src/hippocampus_mcp/lnn/__init__.py +25 -0
  124. hippocampus_mcp-0.1.0/src/hippocampus_mcp/lnn/checkpoint.py +400 -0
  125. hippocampus_mcp-0.1.0/src/hippocampus_mcp/lnn/memory_core.py +424 -0
  126. hippocampus_mcp-0.1.0/src/hippocampus_mcp/lnn/numpy_cfc.py +297 -0
  127. hippocampus_mcp-0.1.0/src/hippocampus_mcp/lnn/projector.py +37 -0
  128. hippocampus_mcp-0.1.0/src/hippocampus_mcp/lnn/pt_migrate.py +61 -0
  129. hippocampus_mcp-0.1.0/src/hippocampus_mcp/map/__init__.py +1 -0
  130. hippocampus_mcp-0.1.0/src/hippocampus_mcp/map/auto.py +1010 -0
  131. hippocampus_mcp-0.1.0/src/hippocampus_mcp/map/constants.py +154 -0
  132. hippocampus_mcp-0.1.0/src/hippocampus_mcp/map/file_registry.py +780 -0
  133. hippocampus_mcp-0.1.0/src/hippocampus_mcp/map/mention.py +378 -0
  134. hippocampus_mcp-0.1.0/src/hippocampus_mcp/map/store.py +501 -0
  135. hippocampus_mcp-0.1.0/src/hippocampus_mcp/prewarm.py +185 -0
  136. hippocampus_mcp-0.1.0/src/hippocampus_mcp/retrieval/__init__.py +4 -0
  137. hippocampus_mcp-0.1.0/src/hippocampus_mcp/retrieval/bm25.py +169 -0
  138. hippocampus_mcp-0.1.0/src/hippocampus_mcp/retrieval/intent.py +94 -0
  139. hippocampus_mcp-0.1.0/src/hippocampus_mcp/retrieval/query_variants.py +142 -0
  140. hippocampus_mcp-0.1.0/src/hippocampus_mcp/retrieval/recall_pipeline.py +272 -0
  141. hippocampus_mcp-0.1.0/src/hippocampus_mcp/retrieval/sampler.py +58 -0
  142. hippocampus_mcp-0.1.0/src/hippocampus_mcp/retrieval/scoring.py +148 -0
  143. hippocampus_mcp-0.1.0/src/hippocampus_mcp/server.py +1907 -0
  144. hippocampus_mcp-0.1.0/src/hippocampus_mcp/server_runtime/__init__.py +39 -0
  145. hippocampus_mcp-0.1.0/src/hippocampus_mcp/server_runtime/composition.py +670 -0
  146. hippocampus_mcp-0.1.0/src/hippocampus_mcp/server_runtime/dispatch.py +140 -0
  147. hippocampus_mcp-0.1.0/src/hippocampus_mcp/server_runtime/entry.py +114 -0
  148. hippocampus_mcp-0.1.0/src/hippocampus_mcp/server_runtime/profiles.py +205 -0
  149. hippocampus_mcp-0.1.0/src/hippocampus_mcp/server_runtime/routing.py +400 -0
  150. hippocampus_mcp-0.1.0/src/hippocampus_mcp/server_runtime/stdout_guard.py +94 -0
  151. hippocampus_mcp-0.1.0/src/hippocampus_mcp/server_runtime/telemetry.py +75 -0
  152. hippocampus_mcp-0.1.0/src/hippocampus_mcp/server_runtime/warmup.py +571 -0
  153. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/__init__.py +24 -0
  154. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/backend.py +1081 -0
  155. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/contradictions.py +228 -0
  156. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/idem.py +141 -0
  157. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/layer_gc.py +225 -0
  158. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/layer_save.py +325 -0
  159. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/layer_view.py +234 -0
  160. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/ledger.py +256 -0
  161. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/mem_history.py +150 -0
  162. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/memory.py +408 -0
  163. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/recent_memories.py +58 -0
  164. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/source_sig.py +348 -0
  165. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/supersede.py +134 -0
  166. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/tag_ops.py +152 -0
  167. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/tag_ops_undo.py +199 -0
  168. hippocampus_mcp-0.1.0/src/hippocampus_mcp/store/vector_store.py +1693 -0
  169. hippocampus_mcp-0.1.0/src/hippocampus_mcp/templates/agents_snippet.md +21 -0
  170. hippocampus_mcp-0.1.0/src/hippocampus_mcp/tree_view.py +702 -0
@@ -0,0 +1,172 @@
1
+ # ==================================================================
2
+ # HippoMCP .gitignore
3
+ # 原则:**源码进库,数据不进库**。
4
+ # 本仓库是研究型项目,工作目录里混有私人语料、模型缓存与实验产物,
5
+ # 这些都必须在 push 前挡在门外。
6
+ # ==================================================================
7
+
8
+ # ------------------------------------------------------------------
9
+ # P0 · 本地数据与训练产物不进库
10
+ # ------------------------------------------------------------------
11
+ # data/ 内含真实记忆库、备份快照、评测数据集与训练权重,一旦推上去无法撤回。
12
+ data/
13
+
14
+ # 个人知识系统与工作日志
15
+ # (另有私人目录字面名在本机 .git/info/exclude——字面名不得进公开面)
16
+ .workbuddy/
17
+
18
+ # 内部流程记录与特定宿主接入单,脱敏后再公开
19
+ docs/integration/
20
+ docs/guides/ZCode恢复使用操作单.md
21
+ docs/guides/ZCode操作说明.md
22
+ docs/guides/ZCode接入指南.md
23
+
24
+ # ------------------------------------------------------------------
25
+ # P0 · 密钥(即使已改用环境变量,也防手滑留下 .env)
26
+ # ------------------------------------------------------------------
27
+ .env
28
+ .env.*
29
+ !.env.example
30
+ *.key
31
+ *.pem
32
+ secrets.json
33
+ credentials.json
34
+
35
+ # ------------------------------------------------------------------
36
+ # 依赖缓存:175M 的内置包(py3.10 编译的老包,不该进版本库)
37
+ # ------------------------------------------------------------------
38
+ libs/
39
+ *.whl
40
+ .venv/
41
+ venv/
42
+ env/
43
+
44
+ # ------------------------------------------------------------------
45
+ # 实验产物与代码快照
46
+ # ------------------------------------------------------------------
47
+ # 各版本评测结果(脚本按字面路径写入,本地保留以便复现)
48
+ eval_v*/
49
+ eval_t1_attribution/
50
+
51
+ # 源码/脚本快照目录(本地做 A/B 对照用,不进库)
52
+ *_snap_*/
53
+
54
+ # 脱敏前的本地快照(回滚用)与公开层导出测试目录
55
+ snap_prekeys_*/
56
+ _public_test/
57
+
58
+ # 改动前的本地快照(如 docs/TODO.md.bak-2026xxxx)。**故意不进库**:
59
+ # 一是快照会跟正文一起漂移、污染 diff;二是 TODO 快照里同样含真实库名/项目名,
60
+ # 而公开层白名单只认 docs/TODO.md 本体,快照漏进来就是绕过白名单。
61
+ # 2026-09-22 加:上一轮用的 `git add -A` 会把这类文件一并扫进暂存区。
62
+ *.bak
63
+ *.bak-*
64
+ *.bak_*
65
+
66
+ # 评测报告产物
67
+ hippocampus-evaluation-report/
68
+ mem0-comparison/
69
+ phase5-evaluation-report/
70
+ *_report.html
71
+ *_report_st.html
72
+ evaluation-painpoint-analysis.html
73
+ research-retrospective.html
74
+
75
+ # ------------------------------------------------------------------
76
+ # 实验残留:根目录散落的临时脚本与输出
77
+ # ------------------------------------------------------------------
78
+ # 一次性脚本(已被 scripts/ 下的版本取代)
79
+ /run_eval.py
80
+ /run_eval_st.py
81
+ /run_locomo_eval.py
82
+ /run_pro_eval.py
83
+ /test_minimal_loop.py
84
+ /_probe_loopback_mcp.py
85
+ /train_cfc.py
86
+ /train_cfc_retrieval.py
87
+ /migrate_package.py
88
+ /migrate_package.ps1
89
+ /README_TEST.txt
90
+
91
+ # 一次性输出
92
+ /*.log
93
+ /*_test.txt
94
+ /permission_test_v2.txt
95
+ /sandbox_test.txt
96
+ /visibility_test.txt
97
+ /win32_direct_test.txt
98
+ /real_write_test.txt
99
+ /perf_after_fix.log
100
+ /perf_baseline_before_fix.log
101
+
102
+ # 根目录散落的评测结果 JSON(正式结果统一放 eval_vXX/)
103
+ /crl_eval_results.json
104
+ /eval_results.json
105
+ /eval_results_st.json
106
+ /llm_eval_results.json
107
+ /locomo_eval_results.json
108
+ /p7_corrected_metrics.json
109
+ /pro_eval_results.json
110
+
111
+ # ------------------------------------------------------------------
112
+ # 模型权重与二进制
113
+ # ------------------------------------------------------------------
114
+ *.pt
115
+ *.pth
116
+ *.onnx
117
+ *.npz
118
+ *.bin
119
+ *.safetensors
120
+ !docs/**/*.json
121
+
122
+ # ------------------------------------------------------------------
123
+ # 调试现场
124
+ # ------------------------------------------------------------------
125
+ _probe_out/
126
+ mcp_server_debug.log
127
+ # 改动前的版本快照(`_backup/<日期>_<主题>/<原路径>`)。是回滚用的本机副本,
128
+ # 不是交付物:进库只会让 diff 里混进整份旧文件。
129
+ _backup/
130
+
131
+ # GitHub 建仓(B1-4)一次性注册现场:含浏览器自动化脚本、截图、cookies.txt、
132
+ # hosts 文件,71MB,**绝不可进库**(cookies 属凭据)。注册完即弃。
133
+ _gh_signup/
134
+
135
+ # ------------------------------------------------------------------
136
+ # Python
137
+ # ------------------------------------------------------------------
138
+ __pycache__/
139
+ *.py[cod]
140
+ *$py.class
141
+ *.so
142
+ .Python
143
+ build/
144
+ dist/
145
+ *.egg-info/
146
+ .eggs/
147
+ .pytest_cache/
148
+ .mypy_cache/
149
+ .ruff_cache/
150
+ .coverage
151
+ htmlcov/
152
+
153
+ # ------------------------------------------------------------------
154
+ # 编辑器与系统
155
+ # ------------------------------------------------------------------
156
+ .vscode/
157
+ .idea/
158
+ *.swp
159
+ *~
160
+ .DS_Store
161
+ Thumbs.db
162
+ desktop.ini
163
+
164
+ # ------------------------------------------------------------------
165
+ # 本机宿主/引导配置(2026-10-16)
166
+ # .hippocampus.json 优先级高于 HIPPOCAMPUS_PERSIST_DIR,且含本机绝对路径。
167
+ # 从仓库根跑测试时它会把「自行指定库目录」的用例静默重定向到引导库,
168
+ # 实测造成 4 个套件假失败(10-16)。这类文件绝不进仓。
169
+ # ------------------------------------------------------------------
170
+ .hippocampus.json
171
+ .mcp.json
172
+ .zcode/
@@ -0,0 +1,28 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ title: "HippoMCP: A Long-Term Memory Layer for LLM Hosts via MCP"
4
+ abstract: >-
5
+ A service that provides long-term memory to LLM hosts through MCP
6
+ (Model Context Protocol). Unlike "adding a vector store to an app",
7
+ it covers the full path from writing, retrieval, and curation to
8
+ hand-assembled context slots: a four-layer memory model (raw stream /
9
+ facts / summaries / profile), cascade deletion with tombstones,
10
+ a superseded state machine (old facts are marked superseded, not erased),
11
+ CfC-based temporal encoding inspired by liquid neural networks,
12
+ and 5-slot context assembly with an independent token budget.
13
+ authors:
14
+ - name: "cstksniper"
15
+ email: "cstksniper@qq.com"
16
+ version: 0.1.0
17
+ date-released: "2026-09-20"
18
+ license: MIT
19
+ repository-code: "https://github.com/cstksniper/hippocampus-mcp"
20
+ keywords:
21
+ - memory
22
+ - MCP
23
+ - model-context-protocol
24
+ - LLM agent
25
+ - retrieval
26
+ - temporal-reasoning
27
+ - liquid-neural-network
28
+ - knowledge-management
@@ -0,0 +1,57 @@
1
+ # Code of Conduct
2
+
3
+ ## Our pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to make participation in our community a
7
+ harassment-free experience for everyone, regardless of age, body size, visible
8
+ or invisible disability, ethnicity, gender identity and expression, level of
9
+ experience, education, socio-economic status, nationality, personal appearance,
10
+ race, religion, or sexual identity and orientation.
11
+
12
+ ## Our standards
13
+
14
+ Behavior that contributes to a positive environment includes:
15
+
16
+ - Using welcoming and inclusive language
17
+ - Being respectful of differing viewpoints and experiences
18
+ - Gracefully accepting constructive criticism
19
+ - Focusing on what is best for the community
20
+ - Showing empathy towards other community members
21
+
22
+ Unacceptable behavior includes:
23
+
24
+ - The use of sexualized language or imagery, and unwelcome sexual attention or advances
25
+ - Trolling, insulting or derogatory comments, and personal or political attacks
26
+ - Public or private harassment
27
+ - Publishing others' private information (such as an address or email) without explicit permission
28
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
29
+
30
+ ## Our responsibilities
31
+
32
+ Maintainers are responsible for clarifying the standards of acceptable behavior
33
+ and are expected to take appropriate and fair corrective action in response to
34
+ any instances of unacceptable behavior, including removal, editing, or rejection
35
+ of comments, commits, code, issues, and other contributions that do not align
36
+ with this Code of Conduct.
37
+
38
+ ## Scope
39
+
40
+ This Code of Conduct applies within all project spaces (repository, issues,
41
+ pull requests, discussions), and also applies when an individual officially
42
+ represents the project or its community in public spaces.
43
+
44
+ ## Enforcement
45
+
46
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
47
+ reported through an issue; for anything private or unsuitable for public
48
+ discussion, email [cstksniper@qq.com](mailto:cstksniper@qq.com) directly.
49
+ All complaints will be reviewed and investigated and will result in a response
50
+ that is deemed necessary and appropriate to the circumstances. The project team
51
+ is obligated to maintain confidentiality with regard to the reporter of an incident.
52
+
53
+ ## Attribution
54
+
55
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
56
+ version 2.1, available at
57
+ <https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
@@ -0,0 +1,140 @@
1
+ # Contributing
2
+
3
+ Thank you for spending time on this project. This document explains **how to get
4
+ changes in safely**, plus a few hard constraints — most of them come from real
5
+ incidents, not style preferences.
6
+
7
+ ---
8
+
9
+ ## Development environment
10
+
11
+ ```bash
12
+ git clone <your fork>
13
+ cd hippocampus-mcp
14
+
15
+ # Base dependencies
16
+ pip install -e .
17
+
18
+ # Full development chain (including NER / evaluation)
19
+ pip install -e ".[dev,ner]"
20
+ ```
21
+
22
+ Python **>= 3.11** is required (verified baseline; 3.10 is untested and unsupported).
23
+
24
+ **Quick smoke run** (downloads no models):
25
+
26
+ ```bash
27
+ PYTHONPATH=src python examples/quickstart.py
28
+ ```
29
+
30
+ It uses `embedder_backend="hash"` — no sentence-transformers, no API key.
31
+
32
+ ---
33
+
34
+ ## Read before coding: five hard constraints
35
+
36
+ These are not suggestions. PRs that violate them get bounced — not for style,
37
+ but because they **cause silent errors**.
38
+
39
+ ### 1. The embedding model has exactly one source of truth
40
+
41
+ Model-name resolution happens only in `embeddings.resolve_embedder_model()`,
42
+ with priority **argument > env > default**. Do not copy env literals elsewhere.
43
+
44
+ Reason: multiple entry points used to read the env independently; one forgot to
45
+ set it and a Chinese library silently ran on the English model, with no error
46
+ anywhere. `brain_stats()["embedder_model_source"]` now self-reports the source —
47
+ keep it valid when touching related code.
48
+
49
+ ### 2. The only legal entry point for switching embedding models is `scripts/reembed.py`
50
+
51
+ Changing the model via raw config makes stored vectors mismatch the new model.
52
+ `MemoryManager._sync_embedder_with_store()` handles it:
53
+ explicitly specified but mismatched → error; default but mismatched → **follow the model already in the library**.
54
+
55
+ ### 3. Deletion must cascade
56
+
57
+ L2 / L3 / index layers are derived copies of L1 — **deleting L1 alone is a fake
58
+ deletion**. The only entry point is `brain.forget(id, reason)`, which runs a
59
+ 6-step cascade internally.
60
+
61
+ ### 4. Filtering must happen before retrieval
62
+
63
+ Structured tag filtering must use `search(allow_ids=)`, masking out-of-whitelist
64
+ entries with `-inf`. **The BM25 path must filter explicitly**, otherwise the
65
+ filter is bypassed.
66
+
67
+ ### 5. Every MCP tool must pass `structured_output=False`
68
+
69
+ All of them, no exceptions — otherwise the host receives duplicated returns.
70
+
71
+ More engineering conventions: the "engineering constraints" section of
72
+ [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md).
73
+
74
+ ---
75
+
76
+ ## Testing
77
+
78
+ ```bash
79
+ # Run all public suites (~16 min, ~155 suites / 4700+ assertions)
80
+ python scripts/run_all_tests.py
81
+
82
+ # Only suites whose name contains "forget"
83
+ python scripts/run_all_tests.py -k forget
84
+
85
+ # Also run private suites under scripts/
86
+ python scripts/run_all_tests.py --include-scripts
87
+ ```
88
+
89
+ `scripts/run_all_tests.py` **uses only the standard library**; pytest is not
90
+ required. If pytest is installed, `pytest tests/` works too (`pytest.ini` is
91
+ configured).
92
+
93
+ **Bar for new tests**: discoverable by `run_all_tests.py`, no private data, no
94
+ real model downloads, no absolute paths written into the repo. Only tests
95
+ meeting all four go into `tests/`; everything else goes to `scripts/`
96
+ (the private layer).
97
+
98
+ ---
99
+
100
+ ## Commits and PRs
101
+
102
+ - Commit messages in **Chinese or English**, but they must say **why**, not just what
103
+ - One PR does one thing; keep refactors and feature changes separate
104
+ - `src/` changes must attach test results (which suites were run)
105
+ - Evaluation changes must state whether the numbers moved
106
+
107
+ ---
108
+
109
+ ## ⚠️ Public / private boundary
110
+
111
+ This repository is exported from a research repository containing private data,
112
+ and **the boundary is hard**:
113
+
114
+ | Layer | Content | Rule |
115
+ |---|---|---|
116
+ | Public layer | whitelisted `src/`, `tests/`, `examples/`, `docs/` | free to change |
117
+ | Private layer | `data/`, `.env`, personal corpora | **never commit**; mounted via `HIPPOCAMPUS_PERSIST_DIR` |
118
+ | Process layer | `eval_v*/`, `*_snap_*/`, `_probe_out/` | already in `.gitignore`, never enters the repo |
119
+
120
+ **Self-check before committing**:
121
+
122
+ ```bash
123
+ python tools/export_public.py --audit
124
+ ```
125
+
126
+ It scans the whole repository and reports hits for secrets, private data, and
127
+ absolute paths. Files that hit sensitive content are **refused at export time**
128
+ instead of being silently copied.
129
+
130
+ ---
131
+
132
+ ## Reporting issues
133
+
134
+ Use the templates in `.github/ISSUE_TEMPLATE/`. When reporting a bug, attach the
135
+ output of `brain_stats()` — its self-report fields (NER backend, embedding model
136
+ source, L0 dangling count, tag coverage) usually pinpoint the problem directly.
137
+
138
+ For security issues, private-data exposure, and anything unsuitable for public
139
+ discussion, email [cstksniper@qq.com](mailto:cstksniper@qq.com) directly instead
140
+ of opening an issue first.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cstksniper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.