memtomem 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 (173) hide show
  1. memtomem-0.1.0/.gitignore +55 -0
  2. memtomem-0.1.0/LICENSE +191 -0
  3. memtomem-0.1.0/PKG-INFO +137 -0
  4. memtomem-0.1.0/README.md +87 -0
  5. memtomem-0.1.0/pyproject.toml +59 -0
  6. memtomem-0.1.0/src/memtomem/__init__.py +3 -0
  7. memtomem-0.1.0/src/memtomem/chunking/__init__.py +0 -0
  8. memtomem-0.1.0/src/memtomem/chunking/base.py +13 -0
  9. memtomem-0.1.0/src/memtomem/chunking/javascript.py +119 -0
  10. memtomem-0.1.0/src/memtomem/chunking/markdown.py +245 -0
  11. memtomem-0.1.0/src/memtomem/chunking/python_code.py +129 -0
  12. memtomem-0.1.0/src/memtomem/chunking/registry.py +29 -0
  13. memtomem-0.1.0/src/memtomem/chunking/structured.py +358 -0
  14. memtomem-0.1.0/src/memtomem/cli/__init__.py +42 -0
  15. memtomem-0.1.0/src/memtomem/cli/_bootstrap.py +23 -0
  16. memtomem-0.1.0/src/memtomem/cli/config_cmd.py +146 -0
  17. memtomem-0.1.0/src/memtomem/cli/context_cmd.py +190 -0
  18. memtomem-0.1.0/src/memtomem/cli/embedding_cmd.py +112 -0
  19. memtomem-0.1.0/src/memtomem/cli/indexing.py +45 -0
  20. memtomem-0.1.0/src/memtomem/cli/init_cmd.py +359 -0
  21. memtomem-0.1.0/src/memtomem/cli/memory.py +149 -0
  22. memtomem-0.1.0/src/memtomem/cli/search.py +141 -0
  23. memtomem-0.1.0/src/memtomem/cli/shell.py +252 -0
  24. memtomem-0.1.0/src/memtomem/cli/watchdog_cmd.py +182 -0
  25. memtomem-0.1.0/src/memtomem/cli/web.py +23 -0
  26. memtomem-0.1.0/src/memtomem/cli/wizard.py +102 -0
  27. memtomem-0.1.0/src/memtomem/config.py +340 -0
  28. memtomem-0.1.0/src/memtomem/context/.gitignore +1 -0
  29. memtomem-0.1.0/src/memtomem/context/__init__.py +1 -0
  30. memtomem-0.1.0/src/memtomem/context/detector.py +47 -0
  31. memtomem-0.1.0/src/memtomem/context/generator.py +281 -0
  32. memtomem-0.1.0/src/memtomem/context/parser.py +53 -0
  33. memtomem-0.1.0/src/memtomem/embedding/__init__.py +0 -0
  34. memtomem-0.1.0/src/memtomem/embedding/base.py +17 -0
  35. memtomem-0.1.0/src/memtomem/embedding/factory.py +23 -0
  36. memtomem-0.1.0/src/memtomem/embedding/ollama.py +107 -0
  37. memtomem-0.1.0/src/memtomem/embedding/openai.py +122 -0
  38. memtomem-0.1.0/src/memtomem/embedding/retry.py +74 -0
  39. memtomem-0.1.0/src/memtomem/errors.py +33 -0
  40. memtomem-0.1.0/src/memtomem/indexing/__init__.py +0 -0
  41. memtomem-0.1.0/src/memtomem/indexing/differ.py +60 -0
  42. memtomem-0.1.0/src/memtomem/indexing/engine.py +598 -0
  43. memtomem-0.1.0/src/memtomem/indexing/hasher.py +17 -0
  44. memtomem-0.1.0/src/memtomem/indexing/importers.py +164 -0
  45. memtomem-0.1.0/src/memtomem/indexing/url_fetcher.py +168 -0
  46. memtomem-0.1.0/src/memtomem/indexing/watcher.py +131 -0
  47. memtomem-0.1.0/src/memtomem/integrations/__init__.py +1 -0
  48. memtomem-0.1.0/src/memtomem/integrations/langgraph.py +265 -0
  49. memtomem-0.1.0/src/memtomem/models.py +124 -0
  50. memtomem-0.1.0/src/memtomem/py.typed +0 -0
  51. memtomem-0.1.0/src/memtomem/search/__init__.py +0 -0
  52. memtomem-0.1.0/src/memtomem/search/access.py +55 -0
  53. memtomem-0.1.0/src/memtomem/search/conflict.py +87 -0
  54. memtomem-0.1.0/src/memtomem/search/decay.py +134 -0
  55. memtomem-0.1.0/src/memtomem/search/dedup.py +181 -0
  56. memtomem-0.1.0/src/memtomem/search/expansion.py +71 -0
  57. memtomem-0.1.0/src/memtomem/search/fusion.py +63 -0
  58. memtomem-0.1.0/src/memtomem/search/importance.py +60 -0
  59. memtomem-0.1.0/src/memtomem/search/mmr.py +115 -0
  60. memtomem-0.1.0/src/memtomem/search/pipeline.py +341 -0
  61. memtomem-0.1.0/src/memtomem/search/reranker/__init__.py +1 -0
  62. memtomem-0.1.0/src/memtomem/search/reranker/base.py +31 -0
  63. memtomem-0.1.0/src/memtomem/search/reranker/cohere.py +78 -0
  64. memtomem-0.1.0/src/memtomem/search/reranker/factory.py +29 -0
  65. memtomem-0.1.0/src/memtomem/search/reranker/local.py +55 -0
  66. memtomem-0.1.0/src/memtomem/server/__init__.py +137 -0
  67. memtomem-0.1.0/src/memtomem/server/__main__.py +7 -0
  68. memtomem-0.1.0/src/memtomem/server/component_factory.py +119 -0
  69. memtomem-0.1.0/src/memtomem/server/context.py +45 -0
  70. memtomem-0.1.0/src/memtomem/server/error_handler.py +30 -0
  71. memtomem-0.1.0/src/memtomem/server/formatters.py +96 -0
  72. memtomem-0.1.0/src/memtomem/server/health_checks.py +256 -0
  73. memtomem-0.1.0/src/memtomem/server/health_maintenance.py +72 -0
  74. memtomem-0.1.0/src/memtomem/server/health_store.py +149 -0
  75. memtomem-0.1.0/src/memtomem/server/health_watchdog.py +185 -0
  76. memtomem-0.1.0/src/memtomem/server/helpers.py +113 -0
  77. memtomem-0.1.0/src/memtomem/server/lifespan.py +162 -0
  78. memtomem-0.1.0/src/memtomem/server/resources.py +78 -0
  79. memtomem-0.1.0/src/memtomem/server/scheduler.py +71 -0
  80. memtomem-0.1.0/src/memtomem/server/tool_registry.py +89 -0
  81. memtomem-0.1.0/src/memtomem/server/tools/__init__.py +1 -0
  82. memtomem-0.1.0/src/memtomem/server/tools/ask.py +114 -0
  83. memtomem-0.1.0/src/memtomem/server/tools/auto_tag.py +49 -0
  84. memtomem-0.1.0/src/memtomem/server/tools/browse.py +94 -0
  85. memtomem-0.1.0/src/memtomem/server/tools/conflict.py +49 -0
  86. memtomem-0.1.0/src/memtomem/server/tools/consolidation.py +166 -0
  87. memtomem-0.1.0/src/memtomem/server/tools/context.py +168 -0
  88. memtomem-0.1.0/src/memtomem/server/tools/cross_ref.py +112 -0
  89. memtomem-0.1.0/src/memtomem/server/tools/dedup_decay.py +183 -0
  90. memtomem-0.1.0/src/memtomem/server/tools/entity.py +157 -0
  91. memtomem-0.1.0/src/memtomem/server/tools/evaluation.py +104 -0
  92. memtomem-0.1.0/src/memtomem/server/tools/export_import.py +101 -0
  93. memtomem-0.1.0/src/memtomem/server/tools/importance.py +56 -0
  94. memtomem-0.1.0/src/memtomem/server/tools/importers.py +150 -0
  95. memtomem-0.1.0/src/memtomem/server/tools/indexing.py +69 -0
  96. memtomem-0.1.0/src/memtomem/server/tools/memory_crud.py +334 -0
  97. memtomem-0.1.0/src/memtomem/server/tools/meta.py +97 -0
  98. memtomem-0.1.0/src/memtomem/server/tools/multi_agent.py +135 -0
  99. memtomem-0.1.0/src/memtomem/server/tools/namespace.py +167 -0
  100. memtomem-0.1.0/src/memtomem/server/tools/policy.py +137 -0
  101. memtomem-0.1.0/src/memtomem/server/tools/procedure.py +91 -0
  102. memtomem-0.1.0/src/memtomem/server/tools/recall.py +87 -0
  103. memtomem-0.1.0/src/memtomem/server/tools/reflection.py +140 -0
  104. memtomem-0.1.0/src/memtomem/server/tools/scratch.py +129 -0
  105. memtomem-0.1.0/src/memtomem/server/tools/search.py +200 -0
  106. memtomem-0.1.0/src/memtomem/server/tools/search_history.py +57 -0
  107. memtomem-0.1.0/src/memtomem/server/tools/session.py +134 -0
  108. memtomem-0.1.0/src/memtomem/server/tools/status_config.py +258 -0
  109. memtomem-0.1.0/src/memtomem/server/tools/tag_management.py +83 -0
  110. memtomem-0.1.0/src/memtomem/server/tools/temporal.py +140 -0
  111. memtomem-0.1.0/src/memtomem/server/tools/url_index.py +72 -0
  112. memtomem-0.1.0/src/memtomem/server/tools/watchdog.py +80 -0
  113. memtomem-0.1.0/src/memtomem/server/webhooks.py +70 -0
  114. memtomem-0.1.0/src/memtomem/storage/__init__.py +0 -0
  115. memtomem-0.1.0/src/memtomem/storage/base.py +138 -0
  116. memtomem-0.1.0/src/memtomem/storage/factory.py +16 -0
  117. memtomem-0.1.0/src/memtomem/storage/fts_tokenizer.py +128 -0
  118. memtomem-0.1.0/src/memtomem/storage/mixins/__init__.py +19 -0
  119. memtomem-0.1.0/src/memtomem/storage/mixins/analytics.py +260 -0
  120. memtomem-0.1.0/src/memtomem/storage/mixins/entities.py +108 -0
  121. memtomem-0.1.0/src/memtomem/storage/mixins/history.py +57 -0
  122. memtomem-0.1.0/src/memtomem/storage/mixins/policies.py +101 -0
  123. memtomem-0.1.0/src/memtomem/storage/mixins/relations.py +80 -0
  124. memtomem-0.1.0/src/memtomem/storage/mixins/scratch.py +96 -0
  125. memtomem-0.1.0/src/memtomem/storage/mixins/sessions.py +97 -0
  126. memtomem-0.1.0/src/memtomem/storage/sqlite_backend.py +953 -0
  127. memtomem-0.1.0/src/memtomem/storage/sqlite_helpers.py +49 -0
  128. memtomem-0.1.0/src/memtomem/storage/sqlite_meta.py +71 -0
  129. memtomem-0.1.0/src/memtomem/storage/sqlite_namespace.py +149 -0
  130. memtomem-0.1.0/src/memtomem/storage/sqlite_schema.py +338 -0
  131. memtomem-0.1.0/src/memtomem/templates.py +113 -0
  132. memtomem-0.1.0/src/memtomem/tools/__init__.py +0 -0
  133. memtomem-0.1.0/src/memtomem/tools/auto_tag.py +269 -0
  134. memtomem-0.1.0/src/memtomem/tools/entity_extraction.py +253 -0
  135. memtomem-0.1.0/src/memtomem/tools/export_import.py +230 -0
  136. memtomem-0.1.0/src/memtomem/tools/memory_writer.py +74 -0
  137. memtomem-0.1.0/src/memtomem/tools/policy_engine.py +188 -0
  138. memtomem-0.1.0/src/memtomem/tools/temporal.py +151 -0
  139. memtomem-0.1.0/src/memtomem/web/__init__.py +1 -0
  140. memtomem-0.1.0/src/memtomem/web/app.py +179 -0
  141. memtomem-0.1.0/src/memtomem/web/deps.py +38 -0
  142. memtomem-0.1.0/src/memtomem/web/routes/__init__.py +1 -0
  143. memtomem-0.1.0/src/memtomem/web/routes/chunks.py +173 -0
  144. memtomem-0.1.0/src/memtomem/web/routes/decay.py +51 -0
  145. memtomem-0.1.0/src/memtomem/web/routes/dedup.py +68 -0
  146. memtomem-0.1.0/src/memtomem/web/routes/evaluation.py +18 -0
  147. memtomem-0.1.0/src/memtomem/web/routes/export.py +85 -0
  148. memtomem-0.1.0/src/memtomem/web/routes/namespaces.py +96 -0
  149. memtomem-0.1.0/src/memtomem/web/routes/procedures.py +37 -0
  150. memtomem-0.1.0/src/memtomem/web/routes/scratch.py +92 -0
  151. memtomem-0.1.0/src/memtomem/web/routes/search.py +45 -0
  152. memtomem-0.1.0/src/memtomem/web/routes/sessions.py +39 -0
  153. memtomem-0.1.0/src/memtomem/web/routes/sources.py +118 -0
  154. memtomem-0.1.0/src/memtomem/web/routes/system.py +648 -0
  155. memtomem-0.1.0/src/memtomem/web/routes/tags.py +46 -0
  156. memtomem-0.1.0/src/memtomem/web/routes/timeline.py +35 -0
  157. memtomem-0.1.0/src/memtomem/web/routes/watchdog.py +46 -0
  158. memtomem-0.1.0/src/memtomem/web/schemas/__init__.py +13 -0
  159. memtomem-0.1.0/src/memtomem/web/schemas/config.py +108 -0
  160. memtomem-0.1.0/src/memtomem/web/schemas/core.py +87 -0
  161. memtomem-0.1.0/src/memtomem/web/schemas/decay.py +30 -0
  162. memtomem-0.1.0/src/memtomem/web/schemas/dedup.py +37 -0
  163. memtomem-0.1.0/src/memtomem/web/schemas/memory.py +57 -0
  164. memtomem-0.1.0/src/memtomem/web/schemas/namespaces.py +41 -0
  165. memtomem-0.1.0/src/memtomem/web/schemas/scratch.py +59 -0
  166. memtomem-0.1.0/src/memtomem/web/schemas/search.py +18 -0
  167. memtomem-0.1.0/src/memtomem/web/schemas/sessions.py +39 -0
  168. memtomem-0.1.0/src/memtomem/web/schemas/sources.py +52 -0
  169. memtomem-0.1.0/src/memtomem/web/schemas/tags.py +49 -0
  170. memtomem-0.1.0/src/memtomem/web/static/app.js +6093 -0
  171. memtomem-0.1.0/src/memtomem/web/static/favicon.svg +4 -0
  172. memtomem-0.1.0/src/memtomem/web/static/index.html +1007 -0
  173. memtomem-0.1.0/src/memtomem/web/static/style.css +2336 -0
@@ -0,0 +1,55 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Test / CI artifacts
13
+ .coverage
14
+ coverage.json
15
+
16
+ # Environment
17
+ .env
18
+ .env.*
19
+ !.env.example
20
+ !.env.*.example
21
+ .mcp.json
22
+ !.mcp.json.example
23
+
24
+ # Claude Code
25
+ .claude/
26
+ CLAUDE.md
27
+ .claude-plugin/
28
+
29
+ # macOS
30
+ .DS_Store
31
+
32
+ # Jupyter checkpoints
33
+ .ipynb_checkpoints/
34
+ notebooks/**/.ipynb_checkpoints/
35
+
36
+ # Notebooks
37
+ notebooks/__pycache__/
38
+ memories/
39
+ node_modules/
40
+
41
+ # Internal development artifacts
42
+ docs/testing/
43
+ docs/marketing/
44
+ .claude-memory/
45
+ BUG_REPORT.md
46
+ *.png
47
+ main.py
48
+
49
+ # Dev repo: root tests excluded, package tests included
50
+ tests/
51
+ !packages/*/tests/
52
+ .playwright-mcp/
53
+
54
+ # Standalone test sandbox
55
+ /tmp/memtomem-test/
memtomem-0.1.0/LICENSE ADDED
@@ -0,0 +1,191 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2025 memtomem contributors
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: memtomem
3
+ Version: 0.1.0
4
+ Summary: Markdown-first memory infrastructure for AI agents with hybrid search
5
+ Project-URL: Homepage, https://github.com/memtomem/memtomem
6
+ Project-URL: Repository, https://github.com/memtomem/memtomem
7
+ Author: memtomem contributors
8
+ License: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: agent,ai,embedding,markdown,mcp,memory,rag,search
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Requires-Python: >=3.12
18
+ Requires-Dist: click>=8.1
19
+ Requires-Dist: httpx>=0.28
20
+ Requires-Dist: mcp[cli]>=1.26.0
21
+ Requires-Dist: pydantic-settings>=2.7
22
+ Requires-Dist: pydantic>=2.10
23
+ Requires-Dist: sqlite-vec>=0.1.6
24
+ Requires-Dist: watchdog>=6.0
25
+ Provides-Extra: all
26
+ Requires-Dist: fastapi>=0.115; extra == 'all'
27
+ Requires-Dist: kiwipiepy>=0.18; extra == 'all'
28
+ Requires-Dist: ollama>=0.4; extra == 'all'
29
+ Requires-Dist: openai>=1.60; extra == 'all'
30
+ Requires-Dist: tree-sitter-javascript>=0.23; extra == 'all'
31
+ Requires-Dist: tree-sitter-python>=0.23; extra == 'all'
32
+ Requires-Dist: tree-sitter-typescript>=0.23; extra == 'all'
33
+ Requires-Dist: tree-sitter>=0.25; extra == 'all'
34
+ Requires-Dist: uvicorn[standard]>=0.34; extra == 'all'
35
+ Provides-Extra: code
36
+ Requires-Dist: tree-sitter-javascript>=0.23; extra == 'code'
37
+ Requires-Dist: tree-sitter-python>=0.23; extra == 'code'
38
+ Requires-Dist: tree-sitter-typescript>=0.23; extra == 'code'
39
+ Requires-Dist: tree-sitter>=0.25; extra == 'code'
40
+ Provides-Extra: korean
41
+ Requires-Dist: kiwipiepy>=0.18; extra == 'korean'
42
+ Provides-Extra: ollama
43
+ Requires-Dist: ollama>=0.4; extra == 'ollama'
44
+ Provides-Extra: openai
45
+ Requires-Dist: openai>=1.60; extra == 'openai'
46
+ Provides-Extra: web
47
+ Requires-Dist: fastapi>=0.115; extra == 'web'
48
+ Requires-Dist: uvicorn[standard]>=0.34; extra == 'web'
49
+ Description-Content-Type: text/markdown
50
+
51
+ # memtomem
52
+
53
+ Markdown-first long-term memory infrastructure for AI agents. Hybrid keyword + semantic search across your notes, docs, and code via the Model Context Protocol.
54
+
55
+ **Core philosophy**: `.md` files are the source of truth and the vector database is a derived cache. Manage memories as plain text files — memtomem makes them instantly searchable.
56
+
57
+ **Built for:**
58
+ - AI agents (Claude Code, Cursor, Windsurf, Claude Desktop) that need to *remember* between sessions
59
+ - Developers who want a searchable knowledge base built from their existing markdown notes — no proprietary database, no vendor lock-in
60
+ - Multilingual content (English, Korean, Japanese, Chinese) via `bge-m3` embeddings
61
+
62
+ ## Installation
63
+
64
+ ```bash
65
+ # As an MCP server (most common — no install needed, uvx handles it)
66
+ ollama pull nomic-embed-text # one-time embedding model
67
+
68
+ # Add to Claude Code
69
+ claude mcp add memtomem -s user -- uvx --from memtomem memtomem-server
70
+
71
+ # Or add to .mcp.json for Cursor / Windsurf / Claude Desktop
72
+ ```
73
+
74
+ ```json
75
+ {
76
+ "mcpServers": {
77
+ "memtomem": {
78
+ "command": "uvx",
79
+ "args": ["--from", "memtomem", "memtomem-server"],
80
+ "env": {
81
+ "MEMTOMEM_INDEXING__MEMORY_DIRS": "/path/to/your/notes"
82
+ }
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ For terminal use, install the CLI separately:
89
+
90
+ ```bash
91
+ uv tool install memtomem # or: pipx install memtomem
92
+ mm init # 7-step interactive wizard
93
+ ```
94
+
95
+ ## Quick Start
96
+
97
+ In your AI editor, ask:
98
+
99
+ ```
100
+ "Index my notes folder" → mem_index(path="~/notes")
101
+ "Search for deployment" → mem_search(query="deployment checklist")
102
+ "Remember this insight" → mem_add(content="...", tags="ops")
103
+ ```
104
+
105
+ That's it. Your agent now has a long-term memory built from plain markdown files.
106
+
107
+ ## Key Features
108
+
109
+ - **🔍 Hybrid search** — BM25 (FTS5) + dense vectors (sqlite-vec) merged via Reciprocal Rank Fusion. Exact terms via keyword, meaning via semantic, both at once.
110
+ - **📦 Semantic chunking** — heading-aware Markdown, AST-based Python, tree-sitter JS/TS, structure-aware JSON/YAML/TOML
111
+ - **♻️ Incremental indexing** — chunk-level SHA-256 diff means only changed chunks get re-embedded
112
+ - **🏷️ Namespaces** — scope memories into groups (work / personal / project) with optional auto-derivation from folder names
113
+ - **🧹 Maintenance** — near-duplicate detection with merge, time-based score decay, TTL expiration, auto-tagging
114
+ - **🔄 Export / import** — JSON bundle backup and restore with re-embedding
115
+ - **🌐 Web UI** — full-featured SPA dashboard for search, sources, indexing, tags, sessions, health monitoring
116
+ - **🛠️ 72 MCP tools** — full feature surface as MCP tools, with `mem_do` meta-tool routing 64 actions in `core` mode (default) for minimal context usage
117
+
118
+ ## Documentation
119
+
120
+ Full documentation lives in the [memtomem GitHub repo](https://github.com/memtomem/memtomem):
121
+
122
+ | Guide | Topic |
123
+ |-------|-------|
124
+ | [Getting Started](https://github.com/memtomem/memtomem/blob/main/docs/guides/getting-started.md) | **Start here** — install, setup wizard, first use |
125
+ | [Hands-On Tutorial](https://github.com/memtomem/memtomem/blob/main/docs/guides/hands-on-tutorial.md) | Follow-along with example files |
126
+ | [User Guide](https://github.com/memtomem/memtomem/blob/main/docs/guides/user-guide.md) | Complete feature walkthrough — all tools and patterns |
127
+ | [Configuration](https://github.com/memtomem/memtomem/blob/main/docs/guides/configuration.md) | All `MEMTOMEM_*` environment variables |
128
+ | [Embeddings](https://github.com/memtomem/memtomem/blob/main/docs/guides/embeddings.md) | Ollama and OpenAI providers, model dimensions, switching models |
129
+ | [MCP Client Setup](https://github.com/memtomem/memtomem/blob/main/docs/guides/mcp-clients.md) | Editor-specific configuration |
130
+ | [Agent Memory Guide](https://github.com/memtomem/memtomem/blob/main/docs/guides/agent-memory-guide.md) | Sessions, working memory, procedures, multi-agent |
131
+ | [Web UI Guide](https://github.com/memtomem/memtomem/blob/main/docs/guides/web-ui.md) | Visual dashboard reference |
132
+ | [Hooks](https://github.com/memtomem/memtomem/blob/main/docs/guides/hooks.md) | Claude Code hooks for automatic indexing and search |
133
+ | [memtomem-stm](https://github.com/memtomem/memtomem-stm) | Optional STM proxy for proactive memory surfacing (separate package) |
134
+
135
+ ## License
136
+
137
+ Apache License 2.0 — see [LICENSE](https://github.com/memtomem/memtomem/blob/main/LICENSE) for details.
@@ -0,0 +1,87 @@
1
+ # memtomem
2
+
3
+ Markdown-first long-term memory infrastructure for AI agents. Hybrid keyword + semantic search across your notes, docs, and code via the Model Context Protocol.
4
+
5
+ **Core philosophy**: `.md` files are the source of truth and the vector database is a derived cache. Manage memories as plain text files — memtomem makes them instantly searchable.
6
+
7
+ **Built for:**
8
+ - AI agents (Claude Code, Cursor, Windsurf, Claude Desktop) that need to *remember* between sessions
9
+ - Developers who want a searchable knowledge base built from their existing markdown notes — no proprietary database, no vendor lock-in
10
+ - Multilingual content (English, Korean, Japanese, Chinese) via `bge-m3` embeddings
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ # As an MCP server (most common — no install needed, uvx handles it)
16
+ ollama pull nomic-embed-text # one-time embedding model
17
+
18
+ # Add to Claude Code
19
+ claude mcp add memtomem -s user -- uvx --from memtomem memtomem-server
20
+
21
+ # Or add to .mcp.json for Cursor / Windsurf / Claude Desktop
22
+ ```
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "memtomem": {
28
+ "command": "uvx",
29
+ "args": ["--from", "memtomem", "memtomem-server"],
30
+ "env": {
31
+ "MEMTOMEM_INDEXING__MEMORY_DIRS": "/path/to/your/notes"
32
+ }
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ For terminal use, install the CLI separately:
39
+
40
+ ```bash
41
+ uv tool install memtomem # or: pipx install memtomem
42
+ mm init # 7-step interactive wizard
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ In your AI editor, ask:
48
+
49
+ ```
50
+ "Index my notes folder" → mem_index(path="~/notes")
51
+ "Search for deployment" → mem_search(query="deployment checklist")
52
+ "Remember this insight" → mem_add(content="...", tags="ops")
53
+ ```
54
+
55
+ That's it. Your agent now has a long-term memory built from plain markdown files.
56
+
57
+ ## Key Features
58
+
59
+ - **🔍 Hybrid search** — BM25 (FTS5) + dense vectors (sqlite-vec) merged via Reciprocal Rank Fusion. Exact terms via keyword, meaning via semantic, both at once.
60
+ - **📦 Semantic chunking** — heading-aware Markdown, AST-based Python, tree-sitter JS/TS, structure-aware JSON/YAML/TOML
61
+ - **♻️ Incremental indexing** — chunk-level SHA-256 diff means only changed chunks get re-embedded
62
+ - **🏷️ Namespaces** — scope memories into groups (work / personal / project) with optional auto-derivation from folder names
63
+ - **🧹 Maintenance** — near-duplicate detection with merge, time-based score decay, TTL expiration, auto-tagging
64
+ - **🔄 Export / import** — JSON bundle backup and restore with re-embedding
65
+ - **🌐 Web UI** — full-featured SPA dashboard for search, sources, indexing, tags, sessions, health monitoring
66
+ - **🛠️ 72 MCP tools** — full feature surface as MCP tools, with `mem_do` meta-tool routing 64 actions in `core` mode (default) for minimal context usage
67
+
68
+ ## Documentation
69
+
70
+ Full documentation lives in the [memtomem GitHub repo](https://github.com/memtomem/memtomem):
71
+
72
+ | Guide | Topic |
73
+ |-------|-------|
74
+ | [Getting Started](https://github.com/memtomem/memtomem/blob/main/docs/guides/getting-started.md) | **Start here** — install, setup wizard, first use |
75
+ | [Hands-On Tutorial](https://github.com/memtomem/memtomem/blob/main/docs/guides/hands-on-tutorial.md) | Follow-along with example files |
76
+ | [User Guide](https://github.com/memtomem/memtomem/blob/main/docs/guides/user-guide.md) | Complete feature walkthrough — all tools and patterns |
77
+ | [Configuration](https://github.com/memtomem/memtomem/blob/main/docs/guides/configuration.md) | All `MEMTOMEM_*` environment variables |
78
+ | [Embeddings](https://github.com/memtomem/memtomem/blob/main/docs/guides/embeddings.md) | Ollama and OpenAI providers, model dimensions, switching models |
79
+ | [MCP Client Setup](https://github.com/memtomem/memtomem/blob/main/docs/guides/mcp-clients.md) | Editor-specific configuration |
80
+ | [Agent Memory Guide](https://github.com/memtomem/memtomem/blob/main/docs/guides/agent-memory-guide.md) | Sessions, working memory, procedures, multi-agent |
81
+ | [Web UI Guide](https://github.com/memtomem/memtomem/blob/main/docs/guides/web-ui.md) | Visual dashboard reference |
82
+ | [Hooks](https://github.com/memtomem/memtomem/blob/main/docs/guides/hooks.md) | Claude Code hooks for automatic indexing and search |
83
+ | [memtomem-stm](https://github.com/memtomem/memtomem-stm) | Optional STM proxy for proactive memory surfacing (separate package) |
84
+
85
+ ## License
86
+
87
+ Apache License 2.0 — see [LICENSE](https://github.com/memtomem/memtomem/blob/main/LICENSE) for details.
@@ -0,0 +1,59 @@
1
+ [project]
2
+ name = "memtomem"
3
+ version = "0.1.0"
4
+ description = "Markdown-first memory infrastructure for AI agents with hybrid search"
5
+ authors = [{name = "memtomem contributors"}]
6
+ license = {text = "Apache-2.0"}
7
+ keywords = ["memory", "ai", "mcp", "agent", "rag", "embedding", "search", "markdown"]
8
+ classifiers = [
9
+ "Development Status :: 3 - Alpha",
10
+ "Intended Audience :: Developers",
11
+ "License :: OSI Approved :: Apache Software License",
12
+ "Programming Language :: Python :: 3.12",
13
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
14
+ "Topic :: Software Development :: Libraries :: Python Modules",
15
+ ]
16
+ readme = "README.md"
17
+ requires-python = ">=3.12"
18
+ dependencies = [
19
+ "mcp[cli]>=1.26.0",
20
+ "pydantic>=2.10",
21
+ "pydantic-settings>=2.7",
22
+ "sqlite-vec>=0.1.6",
23
+ "httpx>=0.28",
24
+ "watchdog>=6.0",
25
+ "click>=8.1",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ ollama = ["ollama>=0.4"]
30
+ openai = ["openai>=1.60"]
31
+ korean = ["kiwipiepy>=0.18"]
32
+ code = [
33
+ "tree-sitter>=0.25",
34
+ "tree-sitter-python>=0.23",
35
+ "tree-sitter-javascript>=0.23",
36
+ "tree-sitter-typescript>=0.23",
37
+ ]
38
+ web = [
39
+ "fastapi>=0.115",
40
+ "uvicorn[standard]>=0.34",
41
+ ]
42
+ all = ["memtomem[ollama,openai,korean,code,web]"]
43
+
44
+ [project.scripts]
45
+ memtomem = "memtomem.cli:cli"
46
+ mm = "memtomem.cli:cli"
47
+ memtomem-server = "memtomem.server:main"
48
+ memtomem-web = "memtomem.web.app:main"
49
+
50
+ [project.urls]
51
+ Homepage = "https://github.com/memtomem/memtomem"
52
+ Repository = "https://github.com/memtomem/memtomem"
53
+
54
+ [build-system]
55
+ requires = ["hatchling"]
56
+ build-backend = "hatchling.build"
57
+
58
+ [tool.hatch.build.targets.wheel]
59
+ packages = ["src/memtomem"]
@@ -0,0 +1,3 @@
1
+ """memtomem: Markdown-first memory infrastructure for AI agents."""
2
+
3
+ __version__ = "0.1.0"
File without changes
@@ -0,0 +1,13 @@
1
+ """Chunker protocol."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from typing import Protocol
7
+
8
+ from memtomem.models import Chunk
9
+
10
+
11
+ class Chunker(Protocol):
12
+ def supported_extensions(self) -> frozenset[str]: ...
13
+ def chunk_file(self, file_path: Path, content: str) -> list[Chunk]: ...
@@ -0,0 +1,119 @@
1
+ """JavaScript/TypeScript chunker using tree-sitter AST (optional dependency)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ from pathlib import Path
7
+
8
+ from memtomem.models import Chunk, ChunkMetadata, ChunkType
9
+
10
+ logger = logging.getLogger(__name__)
11
+
12
+ _TOP_LEVEL_TYPES = frozenset(
13
+ {
14
+ "function_declaration",
15
+ "class_declaration",
16
+ "generator_function_declaration",
17
+ "export_statement",
18
+ "lexical_declaration", # const foo = () => {}
19
+ "variable_declaration", # var/let foo = function() {}
20
+ }
21
+ )
22
+
23
+
24
+ class JavaScriptChunker:
25
+ """Chunks JS/TS files by top-level declarations.
26
+
27
+ Falls back to a single whole-file chunk if tree-sitter-javascript /
28
+ tree-sitter-typescript is not installed or parsing fails.
29
+ """
30
+
31
+ def supported_extensions(self) -> frozenset[str]:
32
+ return frozenset({".js", ".ts", ".jsx", ".tsx", ".mjs"})
33
+
34
+ def chunk_file(self, file_path: Path, content: str) -> list[Chunk]:
35
+ if not content.strip():
36
+ return []
37
+ try:
38
+ return self._ast_chunk(file_path, content)
39
+ except Exception:
40
+ logger.debug(
41
+ "JS/TS AST parsing failed for %s, using fallback", file_path, exc_info=True
42
+ )
43
+ return self._fallback(file_path, content)
44
+
45
+ def _ast_chunk(self, file_path: Path, content: str) -> list[Chunk]:
46
+ from tree_sitter import Language, Parser # type: ignore[import]
47
+
48
+ if file_path.suffix in {".ts", ".tsx"}:
49
+ import tree_sitter_typescript as tsts # type: ignore[import]
50
+
51
+ lang = Language(tsts.language_typescript())
52
+ lang_name = "typescript"
53
+ else:
54
+ import tree_sitter_javascript as tsjs # type: ignore[import]
55
+
56
+ lang = Language(tsjs.language())
57
+ lang_name = "javascript"
58
+
59
+ parser = Parser(lang)
60
+ tree = parser.parse(content.encode())
61
+
62
+ lines = content.splitlines()
63
+ module_stem = file_path.stem
64
+ chunks: list[Chunk] = []
65
+
66
+ for node in tree.root_node.children:
67
+ if node.type not in _TOP_LEVEL_TYPES:
68
+ continue
69
+
70
+ name = self._extract_name(node, content)
71
+ start_line = node.start_point[0] + 1
72
+ end_line = node.end_point[0] + 1
73
+ body = "\n".join(lines[start_line - 1 : end_line])
74
+
75
+ chunks.append(
76
+ Chunk(
77
+ content=body,
78
+ metadata=ChunkMetadata(
79
+ source_file=file_path,
80
+ heading_hierarchy=(module_stem, name) if name else (module_stem,),
81
+ chunk_type=ChunkType.JS_FUNCTION,
82
+ start_line=start_line,
83
+ end_line=end_line,
84
+ language=lang_name,
85
+ ),
86
+ )
87
+ )
88
+
89
+ return chunks if chunks else self._fallback(file_path, content)
90
+
91
+ @classmethod
92
+ def _extract_name(cls, node, content: str) -> str:
93
+ for child in node.children:
94
+ if child.type in ("function_declaration", "class_declaration", "lexical_declaration"):
95
+ return cls._extract_name(child, content)
96
+ if child.type == "identifier":
97
+ return content[child.start_byte : child.end_byte]
98
+ if child.type == "variable_declarator":
99
+ for grandchild in child.children:
100
+ if grandchild.type == "identifier":
101
+ return content[grandchild.start_byte : grandchild.end_byte]
102
+ return ""
103
+
104
+ def _fallback(self, file_path: Path, content: str) -> list[Chunk]:
105
+ lang = "typescript" if file_path.suffix in {".ts", ".tsx"} else "javascript"
106
+ lines = content.splitlines()
107
+ return [
108
+ Chunk(
109
+ content=content,
110
+ metadata=ChunkMetadata(
111
+ source_file=file_path,
112
+ heading_hierarchy=(file_path.stem,),
113
+ chunk_type=ChunkType.RAW_TEXT,
114
+ start_line=1,
115
+ end_line=len(lines),
116
+ language=lang,
117
+ ),
118
+ )
119
+ ]