mem-mesh 1.4.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 (316) hide show
  1. mem_mesh-1.4.0/LICENSE +21 -0
  2. mem_mesh-1.4.0/PKG-INFO +479 -0
  3. mem_mesh-1.4.0/README.md +421 -0
  4. mem_mesh-1.4.0/app/__init__.py +9 -0
  5. mem_mesh-1.4.0/app/cli/__init__.py +0 -0
  6. mem_mesh-1.4.0/app/cli/config_cmd.py +118 -0
  7. mem_mesh-1.4.0/app/cli/hooks/__init__.py +74 -0
  8. mem_mesh-1.4.0/app/cli/hooks/colors.py +60 -0
  9. mem_mesh-1.4.0/app/cli/hooks/constants.py +49 -0
  10. mem_mesh-1.4.0/app/cli/hooks/cursor_adapters.py +41 -0
  11. mem_mesh-1.4.0/app/cli/hooks/doctor.py +209 -0
  12. mem_mesh-1.4.0/app/cli/hooks/installer.py +726 -0
  13. mem_mesh-1.4.0/app/cli/hooks/interactive.py +90 -0
  14. mem_mesh-1.4.0/app/cli/hooks/json_ops.py +194 -0
  15. mem_mesh-1.4.0/app/cli/hooks/keywords.py +117 -0
  16. mem_mesh-1.4.0/app/cli/hooks/renderer.py +88 -0
  17. mem_mesh-1.4.0/app/cli/hooks/shell/cursor-project-auto-save.sh +32 -0
  18. mem_mesh-1.4.0/app/cli/hooks/shell/cursor-project-session-end.sh +30 -0
  19. mem_mesh-1.4.0/app/cli/hooks/shell/cursor-project-session-start.sh +50 -0
  20. mem_mesh-1.4.0/app/cli/hooks/shell/cursor-session-start.sh +36 -0
  21. mem_mesh-1.4.0/app/cli/hooks/shell/cursor-stop.sh +34 -0
  22. mem_mesh-1.4.0/app/cli/hooks/shell/enhanced-stop.sh +104 -0
  23. mem_mesh-1.4.0/app/cli/hooks/shell/kiro-stop.sh +39 -0
  24. mem_mesh-1.4.0/app/cli/hooks/shell/local-enhanced-stop.sh +94 -0
  25. mem_mesh-1.4.0/app/cli/hooks/shell/local-precompact.sh +182 -0
  26. mem_mesh-1.4.0/app/cli/hooks/shell/local-reflect.sh +80 -0
  27. mem_mesh-1.4.0/app/cli/hooks/shell/local-session-end.sh +34 -0
  28. mem_mesh-1.4.0/app/cli/hooks/shell/local-session-start.sh +107 -0
  29. mem_mesh-1.4.0/app/cli/hooks/shell/local-stop.sh +35 -0
  30. mem_mesh-1.4.0/app/cli/hooks/shell/local-subagent-start.sh +59 -0
  31. mem_mesh-1.4.0/app/cli/hooks/shell/local-subagent-stop.sh +61 -0
  32. mem_mesh-1.4.0/app/cli/hooks/shell/local-task-completed.sh +49 -0
  33. mem_mesh-1.4.0/app/cli/hooks/shell/local-user-prompt-submit.sh +166 -0
  34. mem_mesh-1.4.0/app/cli/hooks/shell/precompact.sh +152 -0
  35. mem_mesh-1.4.0/app/cli/hooks/shell/reflect.sh +96 -0
  36. mem_mesh-1.4.0/app/cli/hooks/shell/session-end.sh +21 -0
  37. mem_mesh-1.4.0/app/cli/hooks/shell/session-start.sh +114 -0
  38. mem_mesh-1.4.0/app/cli/hooks/shell/stop-decide.sh +121 -0
  39. mem_mesh-1.4.0/app/cli/hooks/shell/stop.sh +45 -0
  40. mem_mesh-1.4.0/app/cli/hooks/shell/subagent-start.sh +56 -0
  41. mem_mesh-1.4.0/app/cli/hooks/shell/subagent-stop.sh +58 -0
  42. mem_mesh-1.4.0/app/cli/hooks/shell/task-completed.sh +45 -0
  43. mem_mesh-1.4.0/app/cli/hooks/shell/user-prompt-submit.sh +169 -0
  44. mem_mesh-1.4.0/app/cli/hooks/status.py +394 -0
  45. mem_mesh-1.4.0/app/cli/hooks/sync.py +144 -0
  46. mem_mesh-1.4.0/app/cli/hooks/templates.py +40 -0
  47. mem_mesh-1.4.0/app/cli/hooks/uninstaller.py +73 -0
  48. mem_mesh-1.4.0/app/cli/install_hooks.py +1733 -0
  49. mem_mesh-1.4.0/app/cli/main.py +216 -0
  50. mem_mesh-1.4.0/app/cli/mcp_config.py +514 -0
  51. mem_mesh-1.4.0/app/cli/onboarding.py +485 -0
  52. mem_mesh-1.4.0/app/cli/prompts/__init__.py +43 -0
  53. mem_mesh-1.4.0/app/cli/prompts/behaviors.py +188 -0
  54. mem_mesh-1.4.0/app/cli/prompts/renderers.py +308 -0
  55. mem_mesh-1.4.0/app/cli/system_status.py +111 -0
  56. mem_mesh-1.4.0/app/cli/updater.py +148 -0
  57. mem_mesh-1.4.0/app/core/__init__.py +18 -0
  58. mem_mesh-1.4.0/app/core/auth/__init__.py +56 -0
  59. mem_mesh-1.4.0/app/core/auth/models.py +172 -0
  60. mem_mesh-1.4.0/app/core/auth/schemas.py +232 -0
  61. mem_mesh-1.4.0/app/core/auth/service.py +630 -0
  62. mem_mesh-1.4.0/app/core/auth/utils.py +163 -0
  63. mem_mesh-1.4.0/app/core/config.py +415 -0
  64. mem_mesh-1.4.0/app/core/database/__init__.py +16 -0
  65. mem_mesh-1.4.0/app/core/database/base.py +322 -0
  66. mem_mesh-1.4.0/app/core/database/connection.py +261 -0
  67. mem_mesh-1.4.0/app/core/database/initializer.py +494 -0
  68. mem_mesh-1.4.0/app/core/database/migrator.py +220 -0
  69. mem_mesh-1.4.0/app/core/database/models.py +121 -0
  70. mem_mesh-1.4.0/app/core/database/schema_migrator.py +273 -0
  71. mem_mesh-1.4.0/app/core/embeddings/__init__.py +15 -0
  72. mem_mesh-1.4.0/app/core/embeddings/service.py +752 -0
  73. mem_mesh-1.4.0/app/core/errors.py +266 -0
  74. mem_mesh-1.4.0/app/core/notifier.py +75 -0
  75. mem_mesh-1.4.0/app/core/schemas/__init__.py +98 -0
  76. mem_mesh-1.4.0/app/core/schemas/optimization.py +104 -0
  77. mem_mesh-1.4.0/app/core/schemas/pins.py +102 -0
  78. mem_mesh-1.4.0/app/core/schemas/projects.py +63 -0
  79. mem_mesh-1.4.0/app/core/schemas/relations.py +79 -0
  80. mem_mesh-1.4.0/app/core/schemas/requests.py +258 -0
  81. mem_mesh-1.4.0/app/core/schemas/responses.py +251 -0
  82. mem_mesh-1.4.0/app/core/schemas/sessions.py +102 -0
  83. mem_mesh-1.4.0/app/core/services/__init__.py +28 -0
  84. mem_mesh-1.4.0/app/core/services/alert.py +381 -0
  85. mem_mesh-1.4.0/app/core/services/cache_manager.py +355 -0
  86. mem_mesh-1.4.0/app/core/services/conflict_detector.py +224 -0
  87. mem_mesh-1.4.0/app/core/services/context.py +575 -0
  88. mem_mesh-1.4.0/app/core/services/context_optimizer.py +266 -0
  89. mem_mesh-1.4.0/app/core/services/embedding_manager.py +322 -0
  90. mem_mesh-1.4.0/app/core/services/importance_analyzer.py +264 -0
  91. mem_mesh-1.4.0/app/core/services/memory.py +679 -0
  92. mem_mesh-1.4.0/app/core/services/metrics_collector.py +586 -0
  93. mem_mesh-1.4.0/app/core/services/monitoring.py +523 -0
  94. mem_mesh-1.4.0/app/core/services/noise_filter.py +270 -0
  95. mem_mesh-1.4.0/app/core/services/pin.py +716 -0
  96. mem_mesh-1.4.0/app/core/services/project.py +206 -0
  97. mem_mesh-1.4.0/app/core/services/project_detector.py +215 -0
  98. mem_mesh-1.4.0/app/core/services/quality_gate.py +89 -0
  99. mem_mesh-1.4.0/app/core/services/query_expander.py +535 -0
  100. mem_mesh-1.4.0/app/core/services/relation.py +345 -0
  101. mem_mesh-1.4.0/app/core/services/reranker.py +132 -0
  102. mem_mesh-1.4.0/app/core/services/score_normalizer.py +289 -0
  103. mem_mesh-1.4.0/app/core/services/scoring.py +370 -0
  104. mem_mesh-1.4.0/app/core/services/search.py +900 -0
  105. mem_mesh-1.4.0/app/core/services/search_quality.py +719 -0
  106. mem_mesh-1.4.0/app/core/services/search_warmup.py +197 -0
  107. mem_mesh-1.4.0/app/core/services/session.py +1250 -0
  108. mem_mesh-1.4.0/app/core/services/stats.py +689 -0
  109. mem_mesh-1.4.0/app/core/services/token_estimator.py +203 -0
  110. mem_mesh-1.4.0/app/core/services/token_tracker.py +391 -0
  111. mem_mesh-1.4.0/app/core/services/unified_search.py +1547 -0
  112. mem_mesh-1.4.0/app/core/storage/__init__.py +7 -0
  113. mem_mesh-1.4.0/app/core/storage/api.py +457 -0
  114. mem_mesh-1.4.0/app/core/storage/base.py +141 -0
  115. mem_mesh-1.4.0/app/core/storage/direct.py +521 -0
  116. mem_mesh-1.4.0/app/core/utils/logger.py +483 -0
  117. mem_mesh-1.4.0/app/core/utils/user.py +60 -0
  118. mem_mesh-1.4.0/app/core/version.py +61 -0
  119. mem_mesh-1.4.0/app/mcp_common/__init__.py +12 -0
  120. mem_mesh-1.4.0/app/mcp_common/batch_tools.py +593 -0
  121. mem_mesh-1.4.0/app/mcp_common/descriptions.py +79 -0
  122. mem_mesh-1.4.0/app/mcp_common/dispatcher.py +402 -0
  123. mem_mesh-1.4.0/app/mcp_common/prompt_optimizer.py +380 -0
  124. mem_mesh-1.4.0/app/mcp_common/schemas.py +679 -0
  125. mem_mesh-1.4.0/app/mcp_common/storage.py +100 -0
  126. mem_mesh-1.4.0/app/mcp_common/token_estimator.py +110 -0
  127. mem_mesh-1.4.0/app/mcp_common/tools.py +1461 -0
  128. mem_mesh-1.4.0/app/mcp_common/transport.py +61 -0
  129. mem_mesh-1.4.0/app/mcp_integration/auto_context.py +168 -0
  130. mem_mesh-1.4.0/app/mcp_stdio/__init__.py +5 -0
  131. mem_mesh-1.4.0/app/mcp_stdio/__main__.py +41 -0
  132. mem_mesh-1.4.0/app/mcp_stdio/server.py +327 -0
  133. mem_mesh-1.4.0/app/mcp_stdio_pure/__init__.py +5 -0
  134. mem_mesh-1.4.0/app/mcp_stdio_pure/__main__.py +12 -0
  135. mem_mesh-1.4.0/app/mcp_stdio_pure/server.py +256 -0
  136. mem_mesh-1.4.0/app/web/__init__.py +5 -0
  137. mem_mesh-1.4.0/app/web/__main__.py +62 -0
  138. mem_mesh-1.4.0/app/web/app.py +68 -0
  139. mem_mesh-1.4.0/app/web/common/__init__.py +5 -0
  140. mem_mesh-1.4.0/app/web/common/dependencies.py +132 -0
  141. mem_mesh-1.4.0/app/web/common/middleware.py +94 -0
  142. mem_mesh-1.4.0/app/web/common/server.py +200 -0
  143. mem_mesh-1.4.0/app/web/dashboard/__init__.py +5 -0
  144. mem_mesh-1.4.0/app/web/dashboard/__main__.py +48 -0
  145. mem_mesh-1.4.0/app/web/dashboard/app.py +62 -0
  146. mem_mesh-1.4.0/app/web/dashboard/pages.py +149 -0
  147. mem_mesh-1.4.0/app/web/dashboard/route_modules/__init__.py +30 -0
  148. mem_mesh-1.4.0/app/web/dashboard/route_modules/memories.py +196 -0
  149. mem_mesh-1.4.0/app/web/dashboard/route_modules/oauth.py +129 -0
  150. mem_mesh-1.4.0/app/web/dashboard/route_modules/relations.py +131 -0
  151. mem_mesh-1.4.0/app/web/dashboard/route_modules/search.py +226 -0
  152. mem_mesh-1.4.0/app/web/dashboard/route_modules/stats.py +105 -0
  153. mem_mesh-1.4.0/app/web/dashboard/routes.py +794 -0
  154. mem_mesh-1.4.0/app/web/lifespan.py +359 -0
  155. mem_mesh-1.4.0/app/web/mcp/__init__.py +5 -0
  156. mem_mesh-1.4.0/app/web/mcp/__main__.py +57 -0
  157. mem_mesh-1.4.0/app/web/mcp/app.py +41 -0
  158. mem_mesh-1.4.0/app/web/mcp/lifespan.py +119 -0
  159. mem_mesh-1.4.0/app/web/mcp/sse.py +488 -0
  160. mem_mesh-1.4.0/app/web/monitoring/__init__.py +5 -0
  161. mem_mesh-1.4.0/app/web/monitoring/routes.py +482 -0
  162. mem_mesh-1.4.0/app/web/oauth/__init__.py +13 -0
  163. mem_mesh-1.4.0/app/web/oauth/basic_auth.py +310 -0
  164. mem_mesh-1.4.0/app/web/oauth/login_routes.py +102 -0
  165. mem_mesh-1.4.0/app/web/oauth/middleware.py +146 -0
  166. mem_mesh-1.4.0/app/web/oauth/routes.py +251 -0
  167. mem_mesh-1.4.0/app/web/rules/DEFAULT_PROMPT.md +151 -0
  168. mem_mesh-1.4.0/app/web/rules/README.md +86 -0
  169. mem_mesh-1.4.0/app/web/rules/all-tools-full.md +211 -0
  170. mem_mesh-1.4.0/app/web/rules/index.json +96 -0
  171. mem_mesh-1.4.0/app/web/rules/mem-mesh-ide-prompt.md +41 -0
  172. mem_mesh-1.4.0/app/web/rules/mem-mesh-mcp-guide.md +33 -0
  173. mem_mesh-1.4.0/app/web/rules/mem-mesh-session-rules.md +37 -0
  174. mem_mesh-1.4.0/app/web/rules/modules/api-usage.md +7 -0
  175. mem_mesh-1.4.0/app/web/rules/modules/batch.md +39 -0
  176. mem_mesh-1.4.0/app/web/rules/modules/core.md +41 -0
  177. mem_mesh-1.4.0/app/web/rules/modules/mcp-helper.md +9 -0
  178. mem_mesh-1.4.0/app/web/rules/modules/memory-log.md +67 -0
  179. mem_mesh-1.4.0/app/web/rules/modules/minimal.md +12 -0
  180. mem_mesh-1.4.0/app/web/rules/modules/pins.md +81 -0
  181. mem_mesh-1.4.0/app/web/rules/modules/quick-start.md +87 -0
  182. mem_mesh-1.4.0/app/web/rules/modules/relations.md +59 -0
  183. mem_mesh-1.4.0/app/web/rules/modules/search.md +62 -0
  184. mem_mesh-1.4.0/app/web/rules/modules/security.md +24 -0
  185. mem_mesh-1.4.0/app/web/rules/modules/team-context.md +5 -0
  186. mem_mesh-1.4.0/app/web/static/AGENTS.md +34 -0
  187. mem_mesh-1.4.0/app/web/static/css/main.css +39 -0
  188. mem_mesh-1.4.0/app/web/static/css/modules/about.css +298 -0
  189. mem_mesh-1.4.0/app/web/static/css/modules/base.css +993 -0
  190. mem_mesh-1.4.0/app/web/static/css/modules/charts.css +392 -0
  191. mem_mesh-1.4.0/app/web/static/css/modules/code.css +246 -0
  192. mem_mesh-1.4.0/app/web/static/css/modules/components.css +520 -0
  193. mem_mesh-1.4.0/app/web/static/css/modules/dashboard.css +1491 -0
  194. mem_mesh-1.4.0/app/web/static/css/modules/hero-features.css +1016 -0
  195. mem_mesh-1.4.0/app/web/static/css/modules/monitoring.css +436 -0
  196. mem_mesh-1.4.0/app/web/static/css/modules/project-analytics.css +867 -0
  197. mem_mesh-1.4.0/app/web/static/css/modules/search.css +1637 -0
  198. mem_mesh-1.4.0/app/web/static/css/modules/work.css +199 -0
  199. mem_mesh-1.4.0/app/web/static/js/components/alert-panel.js +245 -0
  200. mem_mesh-1.4.0/app/web/static/js/components/chroma-charts.js +653 -0
  201. mem_mesh-1.4.0/app/web/static/js/components/chroma-header.js +517 -0
  202. mem_mesh-1.4.0/app/web/static/js/components/chroma-search-bar.js +608 -0
  203. mem_mesh-1.4.0/app/web/static/js/components/connection-status.js +226 -0
  204. mem_mesh-1.4.0/app/web/static/js/components/context-timeline.js +685 -0
  205. mem_mesh-1.4.0/app/web/static/js/components/dashboard-preview.js +929 -0
  206. mem_mesh-1.4.0/app/web/static/js/components/feature-card.js +270 -0
  207. mem_mesh-1.4.0/app/web/static/js/components/features-section.js +337 -0
  208. mem_mesh-1.4.0/app/web/static/js/components/filter-panel.js +427 -0
  209. mem_mesh-1.4.0/app/web/static/js/components/hero-section.js +334 -0
  210. mem_mesh-1.4.0/app/web/static/js/components/memory-card.js +896 -0
  211. mem_mesh-1.4.0/app/web/static/js/components/network-graph.js +886 -0
  212. mem_mesh-1.4.0/app/web/static/js/components/search-bar.js +676 -0
  213. mem_mesh-1.4.0/app/web/static/js/components/searchable-combobox.js +531 -0
  214. mem_mesh-1.4.0/app/web/static/js/main.js +539 -0
  215. mem_mesh-1.4.0/app/web/static/js/pages/about.js +163 -0
  216. mem_mesh-1.4.0/app/web/static/js/pages/analytics.js +1176 -0
  217. mem_mesh-1.4.0/app/web/static/js/pages/create-memory.js +923 -0
  218. mem_mesh-1.4.0/app/web/static/js/pages/dashboard.js +1232 -0
  219. mem_mesh-1.4.0/app/web/static/js/pages/edit-memory.js +904 -0
  220. mem_mesh-1.4.0/app/web/static/js/pages/memories.js +2866 -0
  221. mem_mesh-1.4.0/app/web/static/js/pages/memory-detail.js +1813 -0
  222. mem_mesh-1.4.0/app/web/static/js/pages/monitoring.js +851 -0
  223. mem_mesh-1.4.0/app/web/static/js/pages/oauth.js +426 -0
  224. mem_mesh-1.4.0/app/web/static/js/pages/onboarding.js +594 -0
  225. mem_mesh-1.4.0/app/web/static/js/pages/project-analytics.js +920 -0
  226. mem_mesh-1.4.0/app/web/static/js/pages/project-detail-simple.js +30 -0
  227. mem_mesh-1.4.0/app/web/static/js/pages/project-detail-v2.js +580 -0
  228. mem_mesh-1.4.0/app/web/static/js/pages/project-detail.js +1087 -0
  229. mem_mesh-1.4.0/app/web/static/js/pages/projects.js +864 -0
  230. mem_mesh-1.4.0/app/web/static/js/pages/search.js +862 -0
  231. mem_mesh-1.4.0/app/web/static/js/pages/settings-page.js +1548 -0
  232. mem_mesh-1.4.0/app/web/static/js/pages/settings.js +285 -0
  233. mem_mesh-1.4.0/app/web/static/js/pages/work.js +2218 -0
  234. mem_mesh-1.4.0/app/web/static/js/services/api-client.js +251 -0
  235. mem_mesh-1.4.0/app/web/static/js/services/app-state.js +355 -0
  236. mem_mesh-1.4.0/app/web/static/js/services/router.js +280 -0
  237. mem_mesh-1.4.0/app/web/static/js/services/websocket-client.js +572 -0
  238. mem_mesh-1.4.0/app/web/static/js/tests/components.test.js +429 -0
  239. mem_mesh-1.4.0/app/web/static/js/tests/services.test.js +413 -0
  240. mem_mesh-1.4.0/app/web/static/js/tests/test-runner.js +531 -0
  241. mem_mesh-1.4.0/app/web/static/js/utils/error-handler.js +347 -0
  242. mem_mesh-1.4.0/app/web/static/js/utils/keyboard-shortcuts.js +650 -0
  243. mem_mesh-1.4.0/app/web/static/js/utils/theme-manager.js +202 -0
  244. mem_mesh-1.4.0/app/web/static/js/utils/toast-notifications.js +517 -0
  245. mem_mesh-1.4.0/app/web/static/js/utils/virtual-scroll.js +334 -0
  246. mem_mesh-1.4.0/app/web/static/test-api.js +134 -0
  247. mem_mesh-1.4.0/app/web/static/test-search.html +151 -0
  248. mem_mesh-1.4.0/app/web/templates/index.html +75 -0
  249. mem_mesh-1.4.0/app/web/websocket/__init__.py +7 -0
  250. mem_mesh-1.4.0/app/web/websocket/realtime.py +455 -0
  251. mem_mesh-1.4.0/mem_mesh.egg-info/PKG-INFO +479 -0
  252. mem_mesh-1.4.0/mem_mesh.egg-info/SOURCES.txt +314 -0
  253. mem_mesh-1.4.0/mem_mesh.egg-info/dependency_links.txt +1 -0
  254. mem_mesh-1.4.0/mem_mesh.egg-info/entry_points.txt +6 -0
  255. mem_mesh-1.4.0/mem_mesh.egg-info/requires.txt +37 -0
  256. mem_mesh-1.4.0/mem_mesh.egg-info/top_level.txt +1 -0
  257. mem_mesh-1.4.0/pyproject.toml +174 -0
  258. mem_mesh-1.4.0/setup.cfg +4 -0
  259. mem_mesh-1.4.0/tests/test_alert_service.py +211 -0
  260. mem_mesh-1.4.0/tests/test_api_mode.py +202 -0
  261. mem_mesh-1.4.0/tests/test_auto_complete_strategy.py +253 -0
  262. mem_mesh-1.4.0/tests/test_batch_mcp.py +127 -0
  263. mem_mesh-1.4.0/tests/test_conflict_detector.py +374 -0
  264. mem_mesh-1.4.0/tests/test_content_quality_gate.py +148 -0
  265. mem_mesh-1.4.0/tests/test_context_optimizer.py +481 -0
  266. mem_mesh-1.4.0/tests/test_context_service.py +260 -0
  267. mem_mesh-1.4.0/tests/test_database_schema_optimization.py +323 -0
  268. mem_mesh-1.4.0/tests/test_debug_filtering.py +49 -0
  269. mem_mesh-1.4.0/tests/test_embedding_analysis.py +127 -0
  270. mem_mesh-1.4.0/tests/test_empty_query_filtering.py +50 -0
  271. mem_mesh-1.4.0/tests/test_error_centralization.py +116 -0
  272. mem_mesh-1.4.0/tests/test_hook_ab_comparison.py +577 -0
  273. mem_mesh-1.4.0/tests/test_hook_scripts.py +362 -0
  274. mem_mesh-1.4.0/tests/test_hook_session_end.py +163 -0
  275. mem_mesh-1.4.0/tests/test_hook_snapshots.py +117 -0
  276. mem_mesh-1.4.0/tests/test_importance_analyzer.py +249 -0
  277. mem_mesh-1.4.0/tests/test_install_hooks_idempotency.py +163 -0
  278. mem_mesh-1.4.0/tests/test_integration_quality_conflict.py +355 -0
  279. mem_mesh-1.4.0/tests/test_mcp.py +160 -0
  280. mem_mesh-1.4.0/tests/test_mcp_dispatcher.py +533 -0
  281. mem_mesh-1.4.0/tests/test_mcp_stdio.py +462 -0
  282. mem_mesh-1.4.0/tests/test_mcp_stdio_pure.py +1161 -0
  283. mem_mesh-1.4.0/tests/test_mcp_tools_context_token_optimization.py +296 -0
  284. mem_mesh-1.4.0/tests/test_memory_service.py +250 -0
  285. mem_mesh-1.4.0/tests/test_metrics_collector.py +323 -0
  286. mem_mesh-1.4.0/tests/test_metrics_integration.py +321 -0
  287. mem_mesh-1.4.0/tests/test_monitoring_api.py +309 -0
  288. mem_mesh-1.4.0/tests/test_oauth.py +1118 -0
  289. mem_mesh-1.4.0/tests/test_packaging.py +166 -0
  290. mem_mesh-1.4.0/tests/test_pin_deep_analysis.py +377 -0
  291. mem_mesh-1.4.0/tests/test_pin_service.py +380 -0
  292. mem_mesh-1.4.0/tests/test_pin_service_extended.py +404 -0
  293. mem_mesh-1.4.0/tests/test_pin_session_e2e.py +272 -0
  294. mem_mesh-1.4.0/tests/test_priority_improvements.py +289 -0
  295. mem_mesh-1.4.0/tests/test_properties.py +422 -0
  296. mem_mesh-1.4.0/tests/test_real_data_search.py +403 -0
  297. mem_mesh-1.4.0/tests/test_real_data_search_detailed.py +312 -0
  298. mem_mesh-1.4.0/tests/test_real_data_search_relevance.py +294 -0
  299. mem_mesh-1.4.0/tests/test_schema_migration.py +189 -0
  300. mem_mesh-1.4.0/tests/test_scoring.py +251 -0
  301. mem_mesh-1.4.0/tests/test_search_edge_cases.py +375 -0
  302. mem_mesh-1.4.0/tests/test_search_improvements.py +291 -0
  303. mem_mesh-1.4.0/tests/test_search_modes.py +85 -0
  304. mem_mesh-1.4.0/tests/test_search_quality_comparison.py +215 -0
  305. mem_mesh-1.4.0/tests/test_search_quality_improvements.py +235 -0
  306. mem_mesh-1.4.0/tests/test_search_service.py +225 -0
  307. mem_mesh-1.4.0/tests/test_session_service.py +310 -0
  308. mem_mesh-1.4.0/tests/test_session_service_extended.py +435 -0
  309. mem_mesh-1.4.0/tests/test_sqlite_vec.py +98 -0
  310. mem_mesh-1.4.0/tests/test_temporal_search.py +382 -0
  311. mem_mesh-1.4.0/tests/test_token_estimator.py +215 -0
  312. mem_mesh-1.4.0/tests/test_token_tracker.py +509 -0
  313. mem_mesh-1.4.0/tests/test_unified_search_context_optimization.py +251 -0
  314. mem_mesh-1.4.0/tests/test_unified_search_integration.py +51 -0
  315. mem_mesh-1.4.0/tests/test_vector_search_debug.py +176 -0
  316. mem_mesh-1.4.0/tests/test_work_tracking_properties.py +425 -0
mem_mesh-1.4.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 mem-mesh contributors
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.
@@ -0,0 +1,479 @@
1
+ Metadata-Version: 2.4
2
+ Name: mem-mesh
3
+ Version: 1.4.0
4
+ Summary: Centralized memory system for AI development tools
5
+ Author: mem-mesh
6
+ Project-URL: Homepage, https://github.com/x-mesh/mem-mesh
7
+ Project-URL: Repository, https://github.com/x-mesh/mem-mesh
8
+ Project-URL: Documentation, https://github.com/x-mesh/mem-mesh/blob/main/README.md
9
+ Project-URL: Bug Tracker, https://github.com/x-mesh/mem-mesh/issues
10
+ Keywords: mcp,memory,ai-agent,sqlite,vector-search,llm,claude,cursor,kiro
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: pydantic>=2.5.0
25
+ Requires-Dist: pydantic-settings>=2.1.0
26
+ Requires-Dist: python-dotenv>=1.0.0
27
+ Provides-Extra: server
28
+ Requires-Dist: fastapi>=0.104.0; extra == "server"
29
+ Requires-Dist: uvicorn[standard]>=0.24.0; extra == "server"
30
+ Requires-Dist: sentence-transformers>=2.2.2; extra == "server"
31
+ Requires-Dist: sqlite-vec>=0.0.1a12; extra == "server"
32
+ Requires-Dist: mcp>=1.0.0; extra == "server"
33
+ Requires-Dist: sqlmodel>=0.0.14; extra == "server"
34
+ Requires-Dist: python-multipart>=0.0.6; extra == "server"
35
+ Requires-Dist: fastmcp>=2.14.2; extra == "server"
36
+ Requires-Dist: httpx>=0.25.0; extra == "server"
37
+ Requires-Dist: sse-starlette>=2.0.0; extra == "server"
38
+ Requires-Dist: tiktoken>=0.5.0; extra == "server"
39
+ Requires-Dist: requests>=2.31.0; extra == "server"
40
+ Requires-Dist: urllib3>=1.26.0; extra == "server"
41
+ Requires-Dist: pysqlite3-binary>=0.5.3; sys_platform == "linux" and extra == "server"
42
+ Provides-Extra: dev
43
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
44
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
45
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
46
+ Requires-Dist: hypothesis>=6.88.0; extra == "dev"
47
+ Requires-Dist: black>=23.0.0; extra == "dev"
48
+ Requires-Dist: isort>=5.12.0; extra == "dev"
49
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
50
+ Requires-Dist: mypy>=1.7.0; extra == "dev"
51
+ Requires-Dist: types-requests>=2.31.0; extra == "dev"
52
+ Requires-Dist: coverage>=7.3.0; extra == "dev"
53
+ Requires-Dist: pre-commit>=3.5.0; extra == "dev"
54
+ Requires-Dist: tiktoken>=0.5.0; extra == "dev"
55
+ Requires-Dist: matplotlib>=3.8.0; extra == "dev"
56
+ Requires-Dist: seaborn>=0.13.0; extra == "dev"
57
+ Dynamic: license-file
58
+
59
+ # mem-mesh
60
+
61
+ [![PyPI version](https://img.shields.io/pypi/v/mem-mesh.svg)](https://pypi.org/project/mem-mesh/)
62
+ [![CI](https://github.com/x-mesh/mem-mesh/actions/workflows/ci.yml/badge.svg)](https://github.com/x-mesh/mem-mesh/actions/workflows/ci.yml)
63
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
64
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
65
+ [![MCP Protocol](https://img.shields.io/badge/MCP-2024--11--05%20%7C%202025--03--26-green.svg)](https://modelcontextprotocol.io/)
66
+
67
+ > Persistent memory for AI agents — hybrid vector + FTS5 search, pin-based session tracking, and NLI conflict detection. Zero external dependencies.
68
+
69
+ [한국어](./README.ko.md) · [Quick Start](#quick-start) · [MCP Setup](#mcp-setup) · [MCP Tools](#mcp-tools-15) · [Session & Pins](#session--pins) · [Architecture](#architecture) · [Docker](#docker) · [Contributing](#contributing)
70
+
71
+ ---
72
+
73
+ ## Why mem-mesh?
74
+
75
+ Most MCP memory servers are glorified key-value stores. mem-mesh is built for how AI agents actually work — sessions with multiple steps, decisions that need to survive reboots, and cross-machine context that has to stay coherent.
76
+
77
+ | Differentiator | What it means |
78
+ |---|---|
79
+ | **Pin lifecycle** | Lightweight kanban inside every session: `pin_add` → `pin_complete` → `pin_promote`. No other MCP memory server has this. |
80
+ | **Hybrid search** | sqlite-vec vector embeddings + FTS5 full-text fused with Reciprocal Rank Fusion (RRF). Korean n-gram optimized out of the box. |
81
+ | **NLI conflict detection** | 2-stage pipeline: vector similarity pre-filter → mDeBERTa NLI model catches contradictory memories before they're stored. |
82
+ | **4-Tier Smart Expand** | `session_resume(expand="smart")` uses an importance × status matrix to load only what matters — ~60% token savings. |
83
+ | **Zero external services** | Single SQLite file. `pip install mem-mesh` and you're running. No Postgres, no Redis, no cloud. |
84
+ | **Dual MCP transport** | stdio (Cursor, Claude Desktop, Kiro) + Streamable HTTP/SSE (MCP spec 2025-03-26). |
85
+ | **25+ client auto-detection** | Identifies the calling IDE/AI platform from MCP handshake or User-Agent. |
86
+ | **Batch operations** | Pack multiple memory ops into one round-trip: 30–50% token savings. |
87
+
88
+ ---
89
+
90
+ ## Features
91
+
92
+ - **Memory CRUD** — `add`, `search`, `context`, `update`, `delete`
93
+ - **Hybrid search** — sentence-transformers vectors + FTS5 RRF fusion, Korean n-gram support
94
+ - **Session & pins** — short-lived work tracking with importance-based promotion to permanent memory
95
+ - **Memory relations** — `link`, `unlink`, `get_links` across 7 relation types
96
+ - **Conflict detection** — mDeBERTa NLI prevents storing contradictory facts
97
+ - **Batch operations** — 30–50% fewer tokens per multi-op workflow
98
+ - **Web dashboard** — FastAPI REST API + real-time UI at `localhost:8000`
99
+
100
+ ---
101
+
102
+ ## Quick Start
103
+
104
+ ### Recommended: uvx (zero Python management)
105
+
106
+ One tool to install — [uv](https://github.com/astral-sh/uv) — and mem-mesh handles the rest. No virtualenv, no pyenv tweaks, no `sqlite-vec` compile errors. Your MCP client spawns a cached, isolated mem-mesh on-demand.
107
+
108
+ ```bash
109
+ # 1. Install uv (one-time, ~15 seconds)
110
+ curl -LsSf https://astral.sh/uv/install.sh | sh
111
+
112
+ # 2. Run the interactive installer — writes MCP config for detected tools,
113
+ # offers to install hooks, warms the uv cache.
114
+ uvx --from "mem-mesh[server]" mem-mesh install
115
+ ```
116
+
117
+ That's it. Restart Cursor / Claude Desktop / Kiro and mem-mesh MCP tools are live.
118
+
119
+ Want the web dashboard too? `uvx --from "mem-mesh[server]" mem-mesh serve` — open http://localhost:8000.
120
+
121
+ ### Alternative: pip install
122
+
123
+ If you prefer managing Python environments yourself:
124
+
125
+ ```bash
126
+ pip install "mem-mesh[server]"
127
+ mem-mesh install # same interactive installer
128
+ mem-mesh serve # web server + SSE MCP at localhost:8000
129
+ ```
130
+
131
+ ### Prerequisites (only if NOT using uvx)
132
+
133
+ mem-mesh loads the `sqlite-vec` extension at runtime, so Python's `sqlite3` module must support **loadable extensions**.
134
+
135
+ - **uvx users** — uv's managed Python builds already have extension loading enabled. Nothing to do.
136
+ - **Linux** — `pysqlite3-binary` wheel installs automatically as a fallback.
137
+ - **macOS** — system Python and Homebrew Python both work. Only pyenv's default build is broken.
138
+ - **Windows** — system Python works; install `pysqlite3-binary` manually if needed.
139
+
140
+ **macOS + pyenv users** who hit `Migration failed: no such module: vec0`:
141
+
142
+ ```bash
143
+ # Option A: rebuild Python against Homebrew sqlite3
144
+ brew install sqlite3
145
+ SQLITE_PREFIX="$(brew --prefix sqlite3)"
146
+ PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions" \
147
+ LDFLAGS="-L${SQLITE_PREFIX}/lib" \
148
+ CPPFLAGS="-I${SQLITE_PREFIX}/include" \
149
+ CFLAGS="-I${SQLITE_PREFIX}/include" \
150
+ pyenv install 3.13 --force
151
+ pyenv rehash
152
+
153
+ # Option B (simplest): just use uvx — it bypasses system Python entirely
154
+ ```
155
+
156
+ Linux distro Python, Docker images, and conda Python ship with extension loading enabled — no extra steps needed.
157
+
158
+ ---
159
+
160
+ ## MCP Setup
161
+
162
+ `mem-mesh install` writes these entries for you automatically. The snippets below are what gets written, for reference.
163
+
164
+ ### uvx (recommended)
165
+
166
+ Zero Python-env management. The MCP client spawns a cached mem-mesh process per call; the first run downloads it, subsequent runs are instant.
167
+
168
+ ```json
169
+ {
170
+ "mcpServers": {
171
+ "mem-mesh": {
172
+ "command": "uvx",
173
+ "args": ["--from", "mem-mesh[server]", "mem-mesh-mcp-stdio"],
174
+ "env": { "MEM_MESH_CLIENT": "cursor" }
175
+ }
176
+ }
177
+ }
178
+ ```
179
+
180
+ ### Stdio (local Python)
181
+
182
+ Use your own Python install. Good if you need `-e .` dev installs.
183
+
184
+ ```json
185
+ {
186
+ "mcpServers": {
187
+ "mem-mesh": {
188
+ "command": "python",
189
+ "args": ["-m", "app.mcp_stdio"],
190
+ "cwd": "/absolute/path/to/mem-mesh",
191
+ "env": { "MCP_LOG_LEVEL": "INFO" }
192
+ }
193
+ }
194
+ }
195
+ ```
196
+
197
+ ### SSE (shared running server)
198
+
199
+ For web clients or when multiple tools share one process. Requires `mem-mesh serve` running.
200
+
201
+ ```json
202
+ {
203
+ "mcpServers": {
204
+ "mem-mesh": {
205
+ "url": "http://localhost:8000/mcp/sse",
206
+ "type": "http"
207
+ }
208
+ }
209
+ }
210
+ ```
211
+
212
+ **Config file locations by tool:**
213
+
214
+ | Tool | Config file |
215
+ |---|---|
216
+ | Cursor | `.cursor/mcp.json` |
217
+ | Claude Desktop | `~/Library/Application Support/Claude/claude_desktop_config.json` |
218
+ | Kiro | `~/.kiro/settings/mcp.json` |
219
+
220
+ ### Mode comparison
221
+
222
+ | | uvx | Stdio | SSE |
223
+ |---|---|---|---|
224
+ | Prereq | `uv` only | Python env with `mem-mesh[server]` | Running `mem-mesh serve` |
225
+ | First call | ~15s (cache warm) | Instant | Instant |
226
+ | Server to manage | None | None | Yes |
227
+ | Dashboard | Optional (`uvx … serve`) | Optional | Included |
228
+ | Hooks support | Requires separate server | Yes (local mode) | Yes (api mode) |
229
+
230
+ ---
231
+
232
+ ## MCP Tools (15)
233
+
234
+ | Tool | Description | Key parameters |
235
+ |---|---|---|
236
+ | `add` | Store a memory | `content`, `project_id`, `category`, `tags` |
237
+ | `search` | Hybrid vector + FTS5 search | `query`, `project_id`, `category`, `limit`, `recency_weight`, `response_format` |
238
+ | `context` | Retrieve memories surrounding a given memory | `memory_id`, `depth`, `project_id` |
239
+ | `update` | Edit a memory | `memory_id`, `content`, `category`, `tags` |
240
+ | `delete` | Remove a memory | `memory_id` |
241
+ | `stats` | Usage statistics | `project_id`, `start_date`, `end_date` |
242
+ | `link` | Create a typed relation between memories | `source_id`, `target_id`, `relation_type` |
243
+ | `unlink` | Remove a relation | `source_id`, `target_id` |
244
+ | `get_links` | Query relations | `memory_id`, `relation_type`, `direction` |
245
+ | `pin_add` | Add a short-lived work-tracking pin | `content`, `project_id`, `importance`, `tags` |
246
+ | `pin_complete` | Mark a pin done; optionally promote to permanent memory | `pin_id`, `promote`, `category` |
247
+ | `pin_promote` | Promote an already-completed pin to permanent memory | `pin_id`, `category` |
248
+ | `session_resume` | Restore context from the previous session | `project_id`, `expand`, `limit` |
249
+ | `session_end` | Close a session with a summary | `project_id`, `summary`, `auto_complete_pins` |
250
+ | `batch_operations` | Execute multiple ops in one call | `operations` (array of add/search/pin_add/pin_complete) |
251
+
252
+ **`search` response formats:** `minimal` | `compact` | `standard` | `full`
253
+
254
+ ---
255
+
256
+ ## Search
257
+
258
+ mem-mesh runs two retrieval engines in parallel and merges results with Reciprocal Rank Fusion:
259
+
260
+ - **Vector** — `sentence-transformers/all-MiniLM-L6-v2` (384-dim) by default; E5 models supported
261
+ - **FTS5** — SQLite full-text search with n-gram tokenization for CJK languages
262
+ - **RRF fusion** — balances semantic similarity and keyword precision
263
+ - **Quality filters** — noise removal, intent analysis, vector pre-filter overfetch to improve recall
264
+
265
+ ---
266
+
267
+ ## Session & Pins
268
+
269
+ ### Session lifecycle
270
+
271
+ ```
272
+ session_resume(project_id, expand="smart") → work → session_end(project_id, summary)
273
+ ```
274
+
275
+ - `session_resume` restores incomplete pins and context from the previous session. Stale pins are auto-closed. `expand="smart"` applies an importance × status matrix that cuts token usage by ~60%.
276
+ - `session_end` records a summary and closes the session. If the session terminates abnormally, the next `session_resume` automatically recovers open pins.
277
+
278
+ ### Pin lifecycle
279
+
280
+ Pins are **the unit of work inside a session**. Track code changes, implementations, and configuration work as pins — not in permanent memory.
281
+
282
+ ```
283
+ pin_add(content, project_id) → do the work → pin_complete(pin_id, promote=True)
284
+ # promote=True completes and promotes in one call
285
+ ```
286
+
287
+ **Status flow:** `open` (planned, not started) → `in_progress` (active; **default on pin_add**) → `completed`
288
+
289
+ Multi-step work can pre-register later steps as `open` pins, then activate them one at a time.
290
+
291
+ **Auto-stale cleanup** (triggered on `session_resume`):
292
+ - `in_progress` pins older than 7 days → auto-completed
293
+ - `open` pins older than 30 days → auto-completed
294
+
295
+ **When to pin:** only when files change. Questions, explanations, and read-only lookups do not need pins. Multi-step tasks get one pin per step.
296
+
297
+ **Importance levels:**
298
+ | Level | Use for |
299
+ |---|---|
300
+ | `5` | Architecture decisions, core design changes |
301
+ | `3–4` | Feature implementations, significant fixes |
302
+ | `1–2` | Minor edits, typo fixes |
303
+ | omit | Auto-inferred from content |
304
+
305
+ **Promote:** `pin_complete(pin_id, promote=True)` completes and promotes to permanent memory in one call. To promote after the fact: `pin_promote(pin_id)`.
306
+
307
+ **Client detection:** In HTTP mode, the calling client is identified from the MCP initialize handshake or User-Agent header (25+ IDE/AI platforms supported). In stdio mode, set `MEM_MESH_CLIENT` in the environment.
308
+
309
+ ### AI agent checklist
310
+
311
+ ```
312
+ 1. Session start → session_resume(project_id, expand="smart")
313
+ 2. Past context → search() before coding if referencing previous decisions
314
+ 3. Track work → pin_add → pin_complete (promote=True to merge into memory)
315
+ 4. Permanent store → decision / bug / incident / idea / code_snippet only
316
+ 5. Session end → session_end(project_id, summary, auto_complete_pins=True)
317
+ 6. Never store → API keys / tokens / passwords / PII
318
+ ```
319
+
320
+ > **Principle:** Hooks are read-only signals. All pin creation, completion, and promotion decisions are made by the LLM with full context.
321
+
322
+ ---
323
+
324
+ ## Memory Relations
325
+
326
+ Seven relation types: `related` | `parent` | `child` | `supersedes` | `references` | `depends_on` | `similar`
327
+
328
+ `get_links` direction: `outgoing` | `incoming` | `both`
329
+
330
+ ---
331
+
332
+ ## Configuration
333
+
334
+ | Variable | Description | Default |
335
+ |---|---|---|
336
+ | `MEM_MESH_DATABASE_PATH` | SQLite database path | `./data/memories.db` |
337
+ | `MEM_MESH_EMBEDDING_MODEL` | Embedding model name | `all-MiniLM-L6-v2` |
338
+ | `MEM_MESH_EMBEDDING_DIM` | Vector dimensions | `384` |
339
+ | `MEM_MESH_SERVER_PORT` | Web server port | `8000` |
340
+ | `MEM_MESH_SEARCH_THRESHOLD` | Minimum similarity score | `0.5` |
341
+ | `MEM_MESH_USE_UNIFIED_SEARCH` | Enable hybrid search | `true` |
342
+ | `MEM_MESH_ENABLE_KOREAN_OPTIMIZATION` | Korean n-gram FTS | `true` |
343
+ | `MCP_LOG_LEVEL` | MCP server log level | `INFO` |
344
+ | `MCP_LOG_FILE` | MCP log output file | (none) |
345
+
346
+ See `.env.example` for the full list.
347
+
348
+ ---
349
+
350
+ ## Web Dashboard
351
+
352
+ - **Dashboard:** http://localhost:8000
353
+ - **API docs (Swagger):** http://localhost:8000/docs
354
+ - **Health check:** http://localhost:8000/health
355
+
356
+ ---
357
+
358
+ ## Architecture
359
+
360
+ ```mermaid
361
+ flowchart LR
362
+ subgraph Clients
363
+ Cursor[Cursor]
364
+ Claude[Claude Desktop]
365
+ Kiro[Kiro]
366
+ Web[Web Client]
367
+ end
368
+
369
+ subgraph Transport
370
+ Stdio[Stdio MCP]
371
+ SSE[SSE / Streamable HTTP]
372
+ end
373
+
374
+ subgraph Core
375
+ MCP[mcp_common]
376
+ Storage[Storage Service]
377
+ end
378
+
379
+ subgraph Data
380
+ SQLite[(SQLite + sqlite-vec + FTS5)]
381
+ end
382
+
383
+ Cursor --> Stdio
384
+ Claude --> Stdio
385
+ Kiro --> Stdio
386
+ Web --> SSE
387
+ Stdio --> MCP
388
+ SSE --> MCP
389
+ MCP --> Storage
390
+ Storage --> SQLite
391
+ ```
392
+
393
+ ### Directory structure
394
+
395
+ ```
396
+ mem-mesh/
397
+ ├── app/
398
+ │ ├── core/ # DB, embeddings, services, schemas
399
+ │ ├── mcp_common/ # Shared MCP tools, dispatcher, batch
400
+ │ ├── mcp_stdio/ # FastMCP stdio server
401
+ │ ├── mcp_stdio_pure/ # Pure MCP stdio server
402
+ │ └── web/ # FastAPI (dashboard, SSE MCP, OAuth, WebSocket)
403
+ ├── static/ # Frontend (Vanilla JS, Web Components)
404
+ ├── tests/ # pytest
405
+ ├── scripts/ # Migration and benchmark scripts
406
+ ├── docs/rules/ # AI agent rule modules
407
+ ├── data/ # memories.db
408
+ └── logs/
409
+ ```
410
+
411
+ ---
412
+
413
+ ## Docker
414
+
415
+ ```bash
416
+ # Build and start
417
+ make quickstart
418
+ # or step by step:
419
+ make docker-build && make docker-up
420
+
421
+ # Open http://localhost:8000
422
+ ```
423
+
424
+ ---
425
+
426
+ ## Development
427
+
428
+ ```bash
429
+ # Install dev dependencies
430
+ pip install -e ".[dev]"
431
+
432
+ # Run tests
433
+ python -m pytest tests/ -v
434
+
435
+ # Format and lint
436
+ black app/ tests/
437
+ ruff check app/ tests/
438
+
439
+ # Check embedding migration status
440
+ python scripts/migrate_embeddings.py --check-only
441
+ ```
442
+
443
+ ---
444
+
445
+ ## Documentation
446
+
447
+ - [CLAUDE.md](./CLAUDE.md) — AI tool checklist (MUST/SHOULD/MAY rules, security policy)
448
+ - [AGENTS.md](./AGENTS.md) — Project context, Golden Rules, Context Map, session management details
449
+
450
+ ### AI agent rule modules (`docs/rules/`)
451
+
452
+ | File | Purpose |
453
+ |---|---|
454
+ | [DEFAULT_PROMPT.md](./docs/rules/DEFAULT_PROMPT.md) | **Default behavior rules** — copy into your project's CLAUDE.md or Cursor rules |
455
+ | [all-tools-full.md](./docs/rules/all-tools-full.md) | Full rules for all 15 tools |
456
+ | [mem-mesh-ide-prompt.md](./docs/rules/mem-mesh-ide-prompt.md) | Compact IDE prompt (~300 tokens) |
457
+ | [modules/quick-start.md](./docs/rules/modules/quick-start.md) | 5-minute quick start |
458
+ | [modules/](./docs/rules/modules/) | Feature modules: core, search, pins, relations, batch |
459
+
460
+ ### Architecture docs
461
+
462
+ - [app/core/AGENTS.md](./app/core/AGENTS.md) — Core service internals
463
+ - [app/mcp_common/AGENTS.md](./app/mcp_common/AGENTS.md) — MCP common layer
464
+
465
+ ---
466
+
467
+ ## Contributing
468
+
469
+ 1. Open an issue or pull request
470
+ 2. Follow `black` and `ruff` formatting
471
+ 3. Add tests for any new behavior
472
+
473
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for details and [CHANGELOG.md](./CHANGELOG.md) for release history.
474
+
475
+ ---
476
+
477
+ ## License
478
+
479
+ [MIT](./LICENSE)