mem-os-python 1.6.27__py3-none-any.whl

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 (253) hide show
  1. mem_os_python-1.6.27.dist-info/METADATA +1032 -0
  2. mem_os_python-1.6.27.dist-info/RECORD +253 -0
  3. mem_os_python-1.6.27.dist-info/WHEEL +4 -0
  4. mem_os_python-1.6.27.dist-info/entry_points.txt +2 -0
  5. mem_os_python-1.6.27.dist-info/licenses/LICENSE +21 -0
  6. memos/__init__.py +16 -0
  7. memos/_js/adapters/anthropic.d.ts +279 -0
  8. memos/_js/adapters/anthropic.d.ts.map +1 -0
  9. memos/_js/adapters/anthropic.js +348 -0
  10. memos/_js/adapters/anthropic.js.map +1 -0
  11. memos/_js/adapters/base.d.ts +10 -0
  12. memos/_js/adapters/base.d.ts.map +1 -0
  13. memos/_js/adapters/base.js +2 -0
  14. memos/_js/adapters/base.js.map +1 -0
  15. memos/_js/adapters/openai.d.ts +264 -0
  16. memos/_js/adapters/openai.d.ts.map +1 -0
  17. memos/_js/adapters/openai.js +342 -0
  18. memos/_js/adapters/openai.js.map +1 -0
  19. memos/_js/apps/explorer.d.ts +244 -0
  20. memos/_js/apps/explorer.d.ts.map +1 -0
  21. memos/_js/apps/explorer.js +738 -0
  22. memos/_js/apps/explorer.js.map +1 -0
  23. memos/_js/citations.d.ts +65 -0
  24. memos/_js/citations.d.ts.map +1 -0
  25. memos/_js/citations.js +143 -0
  26. memos/_js/citations.js.map +1 -0
  27. memos/_js/cli-browse.d.ts +3 -0
  28. memos/_js/cli-browse.d.ts.map +1 -0
  29. memos/_js/cli-browse.js +129 -0
  30. memos/_js/cli-browse.js.map +1 -0
  31. memos/_js/cli-completion.d.ts +31 -0
  32. memos/_js/cli-completion.d.ts.map +1 -0
  33. memos/_js/cli-completion.js +340 -0
  34. memos/_js/cli-completion.js.map +1 -0
  35. memos/_js/cli-help.d.ts +18 -0
  36. memos/_js/cli-help.d.ts.map +1 -0
  37. memos/_js/cli-help.js +357 -0
  38. memos/_js/cli-help.js.map +1 -0
  39. memos/_js/cli.d.ts +28 -0
  40. memos/_js/cli.d.ts.map +1 -0
  41. memos/_js/cli.js +2880 -0
  42. memos/_js/cli.js.map +1 -0
  43. memos/_js/compression.d.ts +25 -0
  44. memos/_js/compression.d.ts.map +1 -0
  45. memos/_js/compression.js +319 -0
  46. memos/_js/compression.js.map +1 -0
  47. memos/_js/confidence-machine.d.ts +99 -0
  48. memos/_js/confidence-machine.d.ts.map +1 -0
  49. memos/_js/confidence-machine.js +222 -0
  50. memos/_js/confidence-machine.js.map +1 -0
  51. memos/_js/context-pack.d.ts +506 -0
  52. memos/_js/context-pack.d.ts.map +1 -0
  53. memos/_js/context-pack.js +1435 -0
  54. memos/_js/context-pack.js.map +1 -0
  55. memos/_js/contradictions.d.ts +160 -0
  56. memos/_js/contradictions.d.ts.map +1 -0
  57. memos/_js/contradictions.js +255 -0
  58. memos/_js/contradictions.js.map +1 -0
  59. memos/_js/dashboard.d.ts +30 -0
  60. memos/_js/dashboard.d.ts.map +1 -0
  61. memos/_js/dashboard.js +302 -0
  62. memos/_js/dashboard.js.map +1 -0
  63. memos/_js/ebbinghaus.d.ts +29 -0
  64. memos/_js/ebbinghaus.d.ts.map +1 -0
  65. memos/_js/ebbinghaus.js +32 -0
  66. memos/_js/ebbinghaus.js.map +1 -0
  67. memos/_js/embedding-queue.d.ts +190 -0
  68. memos/_js/embedding-queue.d.ts.map +1 -0
  69. memos/_js/embedding-queue.js +316 -0
  70. memos/_js/embedding-queue.js.map +1 -0
  71. memos/_js/embeddings.d.ts +187 -0
  72. memos/_js/embeddings.d.ts.map +1 -0
  73. memos/_js/embeddings.js +633 -0
  74. memos/_js/embeddings.js.map +1 -0
  75. memos/_js/entity-extraction.d.ts +54 -0
  76. memos/_js/entity-extraction.d.ts.map +1 -0
  77. memos/_js/entity-extraction.js +325 -0
  78. memos/_js/entity-extraction.js.map +1 -0
  79. memos/_js/entity-index.d.ts +93 -0
  80. memos/_js/entity-index.d.ts.map +1 -0
  81. memos/_js/entity-index.js +165 -0
  82. memos/_js/entity-index.js.map +1 -0
  83. memos/_js/event-memory.d.ts +147 -0
  84. memos/_js/event-memory.d.ts.map +1 -0
  85. memos/_js/event-memory.js +290 -0
  86. memos/_js/event-memory.js.map +1 -0
  87. memos/_js/external-import.d.ts +98 -0
  88. memos/_js/external-import.d.ts.map +1 -0
  89. memos/_js/external-import.js +669 -0
  90. memos/_js/external-import.js.map +1 -0
  91. memos/_js/fidelity.d.ts +367 -0
  92. memos/_js/fidelity.d.ts.map +1 -0
  93. memos/_js/fidelity.js +911 -0
  94. memos/_js/fidelity.js.map +1 -0
  95. memos/_js/graph-expansion.d.ts +119 -0
  96. memos/_js/graph-expansion.d.ts.map +1 -0
  97. memos/_js/graph-expansion.js +213 -0
  98. memos/_js/graph-expansion.js.map +1 -0
  99. memos/_js/graph-mermaid.d.ts +13 -0
  100. memos/_js/graph-mermaid.d.ts.map +1 -0
  101. memos/_js/graph-mermaid.js +32 -0
  102. memos/_js/graph-mermaid.js.map +1 -0
  103. memos/_js/graph.d.ts +170 -0
  104. memos/_js/graph.d.ts.map +1 -0
  105. memos/_js/graph.js +482 -0
  106. memos/_js/graph.js.map +1 -0
  107. memos/_js/harness.d.ts +63 -0
  108. memos/_js/harness.d.ts.map +1 -0
  109. memos/_js/harness.js +93 -0
  110. memos/_js/harness.js.map +1 -0
  111. memos/_js/importance.d.ts +118 -0
  112. memos/_js/importance.d.ts.map +1 -0
  113. memos/_js/importance.js +144 -0
  114. memos/_js/importance.js.map +1 -0
  115. memos/_js/index.d.ts +51 -0
  116. memos/_js/index.d.ts.map +1 -0
  117. memos/_js/index.js +53 -0
  118. memos/_js/index.js.map +1 -0
  119. memos/_js/mcp.d.ts +58 -0
  120. memos/_js/mcp.d.ts.map +1 -0
  121. memos/_js/mcp.js +1853 -0
  122. memos/_js/mcp.js.map +1 -0
  123. memos/_js/memory.d.ts +1762 -0
  124. memos/_js/memory.d.ts.map +1 -0
  125. memos/_js/memory.js +6283 -0
  126. memos/_js/memory.js.map +1 -0
  127. memos/_js/procedural.d.ts +74 -0
  128. memos/_js/procedural.d.ts.map +1 -0
  129. memos/_js/procedural.js +125 -0
  130. memos/_js/procedural.js.map +1 -0
  131. memos/_js/project-config.d.ts +68 -0
  132. memos/_js/project-config.d.ts.map +1 -0
  133. memos/_js/project-config.js +59 -0
  134. memos/_js/project-config.js.map +1 -0
  135. memos/_js/proof-of-forgetting.d.ts +57 -0
  136. memos/_js/proof-of-forgetting.d.ts.map +1 -0
  137. memos/_js/proof-of-forgetting.js +80 -0
  138. memos/_js/proof-of-forgetting.js.map +1 -0
  139. memos/_js/provenance.d.ts +122 -0
  140. memos/_js/provenance.d.ts.map +1 -0
  141. memos/_js/provenance.js +182 -0
  142. memos/_js/provenance.js.map +1 -0
  143. memos/_js/quarantine-commands.d.ts +23 -0
  144. memos/_js/quarantine-commands.d.ts.map +1 -0
  145. memos/_js/quarantine-commands.js +42 -0
  146. memos/_js/quarantine-commands.js.map +1 -0
  147. memos/_js/quarantine.d.ts +120 -0
  148. memos/_js/quarantine.d.ts.map +1 -0
  149. memos/_js/quarantine.js +873 -0
  150. memos/_js/quarantine.js.map +1 -0
  151. memos/_js/redact.d.ts +12 -0
  152. memos/_js/redact.d.ts.map +1 -0
  153. memos/_js/redact.js +26 -0
  154. memos/_js/redact.js.map +1 -0
  155. memos/_js/repl.d.ts +57 -0
  156. memos/_js/repl.d.ts.map +1 -0
  157. memos/_js/repl.js +295 -0
  158. memos/_js/repl.js.map +1 -0
  159. memos/_js/rerank-local.d.ts +61 -0
  160. memos/_js/rerank-local.d.ts.map +1 -0
  161. memos/_js/rerank-local.js +210 -0
  162. memos/_js/rerank-local.js.map +1 -0
  163. memos/_js/retain-filter.d.ts +98 -0
  164. memos/_js/retain-filter.d.ts.map +1 -0
  165. memos/_js/retain-filter.js +232 -0
  166. memos/_js/retain-filter.js.map +1 -0
  167. memos/_js/retrieval.d.ts +265 -0
  168. memos/_js/retrieval.d.ts.map +1 -0
  169. memos/_js/retrieval.js +1018 -0
  170. memos/_js/retrieval.js.map +1 -0
  171. memos/_js/revert.d.ts +77 -0
  172. memos/_js/revert.d.ts.map +1 -0
  173. memos/_js/revert.js +252 -0
  174. memos/_js/revert.js.map +1 -0
  175. memos/_js/scope.d.ts +30 -0
  176. memos/_js/scope.d.ts.map +1 -0
  177. memos/_js/scope.js +71 -0
  178. memos/_js/scope.js.map +1 -0
  179. memos/_js/semantic-screen.d.ts +152 -0
  180. memos/_js/semantic-screen.d.ts.map +1 -0
  181. memos/_js/semantic-screen.js +290 -0
  182. memos/_js/semantic-screen.js.map +1 -0
  183. memos/_js/session-hooks.d.ts +127 -0
  184. memos/_js/session-hooks.d.ts.map +1 -0
  185. memos/_js/session-hooks.js +482 -0
  186. memos/_js/session-hooks.js.map +1 -0
  187. memos/_js/storage/sqlite.d.ts +427 -0
  188. memos/_js/storage/sqlite.d.ts.map +1 -0
  189. memos/_js/storage/sqlite.js +2428 -0
  190. memos/_js/storage/sqlite.js.map +1 -0
  191. memos/_js/sync.d.ts +213 -0
  192. memos/_js/sync.d.ts.map +1 -0
  193. memos/_js/sync.js +389 -0
  194. memos/_js/sync.js.map +1 -0
  195. memos/_js/tamper-log.d.ts +98 -0
  196. memos/_js/tamper-log.d.ts.map +1 -0
  197. memos/_js/tamper-log.js +327 -0
  198. memos/_js/tamper-log.js.map +1 -0
  199. memos/_js/temporal.d.ts +92 -0
  200. memos/_js/temporal.d.ts.map +1 -0
  201. memos/_js/temporal.js +536 -0
  202. memos/_js/temporal.js.map +1 -0
  203. memos/_js/time-travel.d.ts +38 -0
  204. memos/_js/time-travel.d.ts.map +1 -0
  205. memos/_js/time-travel.js +46 -0
  206. memos/_js/time-travel.js.map +1 -0
  207. memos/_js/timestamp-format.d.ts +18 -0
  208. memos/_js/timestamp-format.d.ts.map +1 -0
  209. memos/_js/timestamp-format.js +52 -0
  210. memos/_js/timestamp-format.js.map +1 -0
  211. memos/_js/triple-extraction.d.ts +31 -0
  212. memos/_js/triple-extraction.d.ts.map +1 -0
  213. memos/_js/triple-extraction.js +116 -0
  214. memos/_js/triple-extraction.js.map +1 -0
  215. memos/_js/types.d.ts +2474 -0
  216. memos/_js/types.d.ts.map +1 -0
  217. memos/_js/types.js +20 -0
  218. memos/_js/types.js.map +1 -0
  219. memos/_js/updater.d.ts +95 -0
  220. memos/_js/updater.d.ts.map +1 -0
  221. memos/_js/updater.js +268 -0
  222. memos/_js/updater.js.map +1 -0
  223. memos/_js/version.d.ts +17 -0
  224. memos/_js/version.d.ts.map +1 -0
  225. memos/_js/version.js +34 -0
  226. memos/_js/version.js.map +1 -0
  227. memos/_js/vision/clip-query-cache.d.ts +58 -0
  228. memos/_js/vision/clip-query-cache.d.ts.map +1 -0
  229. memos/_js/vision/clip-query-cache.js +79 -0
  230. memos/_js/vision/clip-query-cache.js.map +1 -0
  231. memos/_js/vision/clip.d.ts +113 -0
  232. memos/_js/vision/clip.d.ts.map +1 -0
  233. memos/_js/vision/clip.js +224 -0
  234. memos/_js/vision/clip.js.map +1 -0
  235. memos/_js/vision/fake-clip.d.ts +55 -0
  236. memos/_js/vision/fake-clip.d.ts.map +1 -0
  237. memos/_js/vision/fake-clip.js +122 -0
  238. memos/_js/vision/fake-clip.js.map +1 -0
  239. memos/_js/vision/index.d.ts +15 -0
  240. memos/_js/vision/index.d.ts.map +1 -0
  241. memos/_js/vision/index.js +13 -0
  242. memos/_js/vision/index.js.map +1 -0
  243. memos/_js/vision/store.d.ts +137 -0
  244. memos/_js/vision/store.d.ts.map +1 -0
  245. memos/_js/vision/store.js +383 -0
  246. memos/_js/vision/store.js.map +1 -0
  247. memos/adapters/__init__.py +0 -0
  248. memos/adapters/crewai.py +385 -0
  249. memos/adapters/langchain.py +301 -0
  250. memos/adapters/ollama.py +396 -0
  251. memos/server/__init__.py +0 -0
  252. memos/server/main.py +547 -0
  253. memos/server/routes.py +360 -0
@@ -0,0 +1,1032 @@
1
+ Metadata-Version: 2.5
2
+ Name: mem-os-python
3
+ Version: 1.6.27
4
+ Summary: Universal, local-first, persistent memory layer for AI agents, LLM apps, and chatbots.
5
+ Project-URL: Homepage, https://context-core.dev/memos/
6
+ Project-URL: Repository, https://github.com/Markgatcha/memos
7
+ Project-URL: Issues, https://github.com/Markgatcha/memos/issues
8
+ Project-URL: Documentation, https://memos.readthedocs.io
9
+ Project-URL: Changelog, https://github.com/Markgatcha/memos/blob/main/CHANGELOG.md
10
+ Author: Markgatcha
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: agent,ai,chatbot,graph,langchain,llm,local-first,memory,ollama,persistent-memory,sqlite
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: fastapi>=0.141.1
27
+ Requires-Dist: pydantic>=2.13.4
28
+ Requires-Dist: uvicorn[standard]>=0.52.3
29
+ Provides-Extra: all
30
+ Requires-Dist: langchain-core>=1.5.5; extra == 'all'
31
+ Requires-Dist: langchain>=1.3.15; extra == 'all'
32
+ Requires-Dist: ollama>=0.6.2; extra == 'all'
33
+ Provides-Extra: dev
34
+ Requires-Dist: httpx>=0.28.1; extra == 'dev'
35
+ Requires-Dist: mypy>=2.3.1; extra == 'dev'
36
+ Requires-Dist: pytest-asyncio>=1.4.0; extra == 'dev'
37
+ Requires-Dist: pytest>=9.1.1; extra == 'dev'
38
+ Requires-Dist: ruff>=0.16.3; extra == 'dev'
39
+ Provides-Extra: langchain
40
+ Requires-Dist: langchain-core>=1.5.5; extra == 'langchain'
41
+ Requires-Dist: langchain>=1.3.15; extra == 'langchain'
42
+ Provides-Extra: ollama
43
+ Requires-Dist: ollama>=0.6.2; extra == 'ollama'
44
+ Description-Content-Type: text/markdown
45
+
46
+ <p align="center">
47
+ <img src="https://raw.githubusercontent.com/Markgatcha/memos/main/assets/memos-logo.svg" alt="MemOS" width="200" />
48
+ </p>
49
+
50
+ <h1 align="center">MemOS</h1>
51
+
52
+ <p align="center">
53
+ <strong>Universal, local-first, persistent memory layer for AI agents.</strong><br>
54
+ Give any LLM a memory that survives restarts — no cloud, no API keys, no vendor lock-in.
55
+ </p>
56
+
57
+ <p align="center">
58
+ <b>English</b> · <a href="translations/README.zh-CN.md">简体中文</a> · <a href="translations/README.es.md">Español</a> · <a href="translations/README.ja.md">日本語</a> · <a href="translations/README.ko.md">한국어</a> · <a href="translations/README.fr.md">Français</a> · <a href="translations/README.de.md">Deutsch</a> · <a href="translations/README.pt-BR.md">Português</a> · <a href="translations/README.ru.md">Русский</a> · <a href="translations/README.hi.md">हिन्दी</a> · <a href="translations/README.ar.md">العربية</a>
59
+ </p>
60
+
61
+ <p align="center">
62
+ <a href="https://www.npmjs.com/package/@mem-os/sdk"><img src="https://img.shields.io/npm/v/@mem-os/sdk?style=flat-square&color=cb3837" alt="npm"></a>
63
+ <a href="https://github.com/Markgatcha/memos/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Markgatcha/memos?style=flat-square&color=green" alt="License"></a>
64
+ <a href="https://github.com/Markgatcha/memos/actions"><img src="https://img.shields.io/github/actions/workflow/status/Markgatcha/memos/ci.yml?style=flat-square" alt="CI"></a>
65
+ <img src="https://img.shields.io/badge/100%25%20local-zero%20cloud%20deps-brightgreen?style=flat-square" alt="100% Local">
66
+ <a href="https://github.com/Markgatcha/memos/stargazers"><img src="https://img.shields.io/github/stars/Markgatcha/memos?style=flat-square" alt="Stars"></a>
67
+ </p>
68
+
69
+ <p align="center">
70
+ <img src="https://raw.githubusercontent.com/Markgatcha/memos/main/assets/demo-animated.svg" alt="MemOS demo: store a memory, kill the process, recall it — all local" width="720" />
71
+ </p>
72
+
73
+ <p align="center">
74
+ <a href="https://context-core.dev/memos/"><strong>Website</strong></a> ·
75
+ <a href="https://memos.readthedocs.io"><strong>Docs</strong></a> ·
76
+ <a href="https://discord.gg/DyQGgPuueu"><strong>Discord</strong></a> ·
77
+ <a href="https://x.com/Context_Core"><strong>Twitter/X</strong></a>
78
+ </p>
79
+
80
+ > **Release status:** The GitHub source is the canonical, always-current build (v1.6.26). The npm package (`@mem-os/sdk`) is updated on each tagged release but may briefly lag the source. The Python package currently installs [from source](#from-source). For the latest features, install from source.
81
+
82
+ ---
83
+
84
+ ## 🔗 Part of the AI Trio
85
+
86
+ MemOS is one of three sibling projects that compose into a complete agent memory + tooling stack:
87
+
88
+ | Project | Role |
89
+ | --- | --- |
90
+ | **[universal-mcp-toolkit](https://github.com/Markgatcha/universal-mcp-toolkit)** | MCP protocol, server registry, and tool routing |
91
+ | **[memos](https://github.com/Markgatcha/memos)** | Graph-based persistent memory across agent sessions |
92
+ | **[llm-guardian](https://github.com/Markgatcha/llm-guardian)** | Token-cost guardian that compresses prompts and injects MemOS memory slices |
93
+
94
+ Together they cover transport + tools (UMT), memory + persistence (MemOS), and LLM inference cost control (llm-guardian). MemOS publishes the `@mem-os/sdk` MCP adapter, which pairs directly with UMT's `link memos` command and feeds memory slices into llm-guardian's prompt optimization.
95
+
96
+ ## One-liner install
97
+
98
+ ```bash
99
+ # TypeScript / Node.js (from source — always current)
100
+ npm install @mem-os/sdk
101
+ # The published npm package is updated on each tagged release but may briefly
102
+ # lag the GitHub source. For the absolute latest, clone and build from source
103
+ # (see Installation → From source below).
104
+ ```
105
+
106
+ > **Note:** `@mem-os/sdk` is published to npm, but the live package can trail the
107
+ > main branch. If you need a feature that just landed on `main`, install from source.
108
+
109
+ Start the HTTP server (Python):
110
+
111
+ ```bash
112
+ memos-server
113
+ # → Listening on http://localhost:7400
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Why MemOS?
119
+
120
+ Every LLM forgets everything the moment a conversation ends. Frameworks like LangChain have memory modules, but they're tightly coupled, cloud-dependent, or stateless. Ollama has no memory at all.
121
+
122
+ **MemOS solves this with three principles:**
123
+
124
+ | Principle | What it means |
125
+ |-----------|---------------|
126
+ | **Local-first** | Your data never leaves your machine. SQLite-backed, zero cloud dependencies. |
127
+ | **Framework-agnostic** | Works with Ollama, LangChain, CrewAI, or raw HTTP. Write an adapter, plug it in. |
128
+ | **Graph-native** | Memories aren't flat logs — they're a graph of connected nodes with typed edges. Contradictions, derivations, and relationships are first-class citizens. |
129
+
130
+ **What makes MemOS different from `langchain.memory`:**
131
+
132
+ - **Persistent** — survives process restarts (SQLite WAL mode)
133
+ - **Searchable** — full-text search via FTS5, not just buffer retrieval
134
+ - **Graph-structured** — memories link to each other, enabling associative recall
135
+ - **Zero-config** — `new MemOS()` just works, no vector DB, no API keys
136
+ - **Privacy-first** — no telemetry, no analytics, no phone-home, ever
137
+
138
+ ---
139
+
140
+ ## Features
141
+
142
+ | Feature | Status |
143
+ |---------|--------|
144
+ | Store / Retrieve / Search / Forget | ✅ |
145
+ | Graph-based memory (nodes + edges) | ✅ |
146
+ | Full-text search (SQLite FTS5) | ✅ |
147
+ | Auto-linking by text similarity | ✅ |
148
+ | Extractive summarisation (local) | ✅ |
149
+ | TypeScript SDK | ✅ |
150
+ | Python HTTP server (FastAPI) | ✅ |
151
+ | CLI tool (`memos` command) | ✅ |
152
+ | Ollama adapter | ✅ |
153
+ | LangChain adapter | ✅ |
154
+ | CrewAI adapter | ✅ |
155
+ | Import from JSON/Markdown/Obsidian | ✅ |
156
+ | Export to JSON/Markdown/Obsidian | ✅ |
157
+ | Memory TTL / Expiration | ✅ |
158
+ | Custom memory tags | ✅ |
159
+ | WebSocket API (real-time events) | ✅ |
160
+ | Docker Compose deployment | ✅ |
161
+ | Edge types (relates_to, contradicts, supports, ...) | ✅ |
162
+ | LRU eviction with configurable max | ✅ |
163
+ | Event system (node:created, eviction, ...) | ✅ |
164
+ | Custom storage adapter interface | ✅ |
165
+ | Backup and restore | ✅ |
166
+ | MCP adapter (stdio) | ✅ |
167
+ | Performance benchmarks | ✅ |
168
+ | Background embedding queue | ✅ v1.6.26 |
169
+ | AI Trio context pack (LLM Guardian compat) | ✅ v1.6.26 |
170
+ | MCP 2026-07-28 protocol | ✅ v1.6.26 |
171
+ | Memory consolidation ("dreaming") | ✅ v1.6.26 |
172
+ | Voyage / Cohere / FastEmbed providers | ✅ v1.6.26 |
173
+ | Interactive TUI (`memos browse`) | ✅ |
174
+ | Retrieval-quality benchmark | ✅ v1.6.26 |
175
+ | Tag index (node_tags join table) | ✅ v1.6.26 |
176
+ | Access-count debounce | ✅ v1.6.26 |
177
+ | Cross-OS SQLite pragmas | ✅ v1.6.26 |
178
+ | Semantic search (embeddings) | ✅ v1.6.26 |
179
+ | Hermes-style retain pre-filter | ✅ v1.6.26 |
180
+ | Temporal knowledge graphs | ✅ v1.6.26 |
181
+ | Trust scoring & provenance | ✅ v1.6.26 |
182
+ | Fact extraction from conversations | ✅ v1.6.26 |
183
+ | Diagnostics & health monitoring | ✅ v1.6.26 |
184
+ | OpenAI SDK adapter | ✅ v1.6.26 |
185
+ | Anthropic SDK adapter | ✅ v1.6.26 |
186
+ | Trust-weighted hybrid search | ✅ v1.6.26 |
187
+ | Parallel hybrid retrieval | ✅ v1.6.26 |
188
+ | Interactive TUI (`memos browse`) | ✅ |
189
+ | Mermaid graph export (`memos graph --mermaid`) | ✅ |
190
+ | Multi-granularity pools (event / note / procedure) | ✅ |
191
+ | Multi-scope memory (user / agent / run) | ✅ |
192
+ | Consolidation with decay-based forgetting (`memos consolidate`, `--watch`) | ✅ |
193
+ | Entity-fused retrieval scoring + aliasing | ✅ |
194
+ | Contextual write-time enrichment hook | ✅ |
195
+ | Multi-stream context packs | ✅ |
196
+ | Bounded graph expansion in packs | ✅ |
197
+ | ChatGPT / Claude memory import (`memos import-external`) | ✅ |
198
+ | Version timeline audit (`memos history`) | ✅ |
199
+ | Encryption at rest (`memos encrypt`) | ✅ |
200
+ | Token-savings telemetry (`memos stats`, `memos_usage`) | ✅ |
201
+ | Claude Code plugin (auto-recall + auto-consolidation hooks) | ✅ |
202
+ | Retrieval regression eval in CI | ✅ |
203
+ | Image memory — captions + CLIP pixel search (`memos image`, `memos_image_*`) | ✅ v1.6.27 |
204
+ | Multi-user isolation | 🔜 v3.0 |
205
+ | Plugin system for custom backends | 🔜 v3.0 |
206
+ | Admin dashboard | 🔜 v4.0 |
207
+
208
+ ---
209
+
210
+ ## Embedding-backed search
211
+
212
+ MemOS still works with zero setup through local keyword search and graph similarity. Configure an `embeddings` provider and it will persist embedding vectors and merge semantic similarity with SQLite FTS keyword results — no experimental flag needed.
213
+
214
+ ```ts
215
+ import { MemOS } from "@mem-os/sdk";
216
+
217
+ const memos = new MemOS({
218
+ experimental: { namespaces: true },
219
+ embeddings: {
220
+ provider: "ollama",
221
+ model: "nomic-embed-text",
222
+ baseUrl: "http://127.0.0.1:11434",
223
+ },
224
+ });
225
+
226
+ await memos.init();
227
+ await memos.store("User prefers dark mode in editors", { namespace: "demo" });
228
+
229
+ const hybrid = await memos.search({
230
+ query: "favorite editor theme",
231
+ namespace: "demo",
232
+ limit: 5,
233
+ });
234
+ ```
235
+
236
+ LM Studio and other no-key OpenAI-compatible embedding servers work by leaving `apiKey` unset:
237
+
238
+ ```ts
239
+ const memos = new MemOS({
240
+ embeddings: {
241
+ provider: "openai-compatible",
242
+ baseUrl: "http://127.0.0.1:1234/v1",
243
+ model: "text-embedding-nomic-embed-text-v1.5",
244
+ dimensions: 768,
245
+ },
246
+ });
247
+ ```
248
+
249
+ CLI and server deployments can use `MEMOS_EMBEDDING_PROVIDER`, `MEMOS_EMBEDDING_MODEL`, `MEMOS_EMBEDDING_BASE_URL`, `MEMOS_EMBEDDING_API_KEY`, and `MEMOS_EMBEDDINGS=false` to control embedding behavior. `MEMOS_EMBEDDING_API_KEY` is optional for local no-key endpoints.
250
+
251
+ ### GPU embeddings
252
+
253
+ The built-in Node embedding pipeline (fastembed/ONNX) is CPU-only. If you have a GPU — NVIDIA CUDA, or AMD via ROCm (Linux) — serve the same model weights from sentence-transformers on the GPU instead. MemOS talks to it through the `openai-compatible` provider, so nothing else changes.
254
+
255
+ ```bash
256
+ # 1. Install the server deps
257
+ pip install sentence-transformers
258
+ # NVIDIA: the default torch wheel already includes CUDA support
259
+ pip install torch
260
+ # AMD (Linux): install the ROCm torch build instead of the default wheel
261
+ pip install torch torchvision --index-url https://download.pytorch.org/whl/rocm6.4
262
+
263
+ # 2. Start the embedding server
264
+ python scripts/embed-server.py --model BAAI/bge-base-en-v1.5 --port 8081
265
+ # → check the startup log for "backend: ROCm …" (AMD) or "backend: CUDA …"
266
+ # (NVIDIA) to confirm you're on the GPU
267
+
268
+ # 3. Point MemOS at it
269
+ MEMOS_EMBEDDING_PROVIDER=openai-compatible \
270
+ MEMOS_EMBEDDING_MODEL=BAAI/bge-base-en-v1.5 \
271
+ MEMOS_EMBEDDING_BASE_URL=http://127.0.0.1:8081/v1 \
272
+ MEMOS_EMBEDDING_DIMENSIONS=768 \
273
+ npx @mem-os/sdk store "remember this"
274
+ ```
275
+
276
+ The `model` you configure in MemOS must match the model the server loads — MemOS only compares vectors produced by the same model. The server also respects `EMBED_MODEL` / `EMBED_PORT` environment variables, and `--device` overrides GPU auto-detection (handy for forcing `--device cpu` to test the wiring without a GPU).
277
+
278
+ ---
279
+
280
+ ## Architecture
281
+
282
+ ```
283
+ ┌─────────────────────────────────────────────────────────┐
284
+ │ Your Application │
285
+ │ (Ollama chatbot · LangChain agent · Custom LLM app) │
286
+ └────────────────────────┬────────────────────────────────┘
287
+ │
288
+ ┌──────────────┴──────────────┐
289
+ ▼ ▼
290
+ ┌─────────────┐ ┌──────────────┐
291
+ │ TypeScript │ │ Python HTTP │
292
+ │ SDK (local) │ │ Server │
293
+ │ │ │ (FastAPI) │
294
+ │ new MemOS() │ │ POST /api/* │
295
+ └──────┬───────┘ └──────┬───────┘
296
+ │ │
297
+ └──────────┬──────────────────┘
298
+ ▼
299
+ ┌─────────────────────┐
300
+ │ Memory Engine │
301
+ │ │
302
+ │ • Graph (nodes + │
303
+ │ typed edges) │
304
+ │ • Auto-linking │
305
+ │ • Extractive │
306
+ │ summarisation │
307
+ │ • FTS5 search │
308
+ └──────────┬──────────┘
309
+ │
310
+ ┌──────────┴──────────┐
311
+ │ Storage Layer │
312
+ │ │
313
+ │ SQLite (WAL mode) │
314
+ │ ~/.memos/memos.db │
315
+ │ │
316
+ │ Interface for: │
317
+ │ Postgres, Redis, │
318
+ │ Qdrant adapters │
319
+ └──────────────────────┘
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Quick start
325
+
326
+ ### CLI — 60 seconds to first memory
327
+
328
+ ```bash
329
+ npm install -g @mem-os/sdk # or: pnpm add -g @mem-os/sdk
330
+
331
+ memos init # interactive setup (database path, embeddings)
332
+ memos store "User prefers dark mode"
333
+ memos search "dark mode"
334
+ # → User prefers dark mode
335
+ ```
336
+
337
+ Kill the terminal, come back tomorrow — the memory is still there.
338
+ Every command has focused help: `memos <command> --help`
339
+ (e.g. `memos search --help`). Full tour: `memos --help`.
340
+
341
+ Tab-completion for bash/zsh/fish:
342
+
343
+ ```bash
344
+ memos completion bash >> ~/.bashrc # bash
345
+ memos completion zsh > ~/.zfunc/_memos # zsh (with ~/.zfunc on $fpath)
346
+ memos completion fish > ~/.config/fish/completions/memos.fish # fish
347
+ ```
348
+
349
+ ### TypeScript
350
+
351
+ ```typescript
352
+ import { MemOS } from "@mem-os/sdk";
353
+
354
+ const memos = new MemOS();
355
+ await memos.init();
356
+
357
+ // Store memories
358
+ await memos.store("User prefers dark mode", { type: "preference" });
359
+ await memos.store("Project uses TypeScript and React", { type: "fact" });
360
+ await memos.store("User is in UTC+2 timezone", { type: "context" });
361
+
362
+ // Search
363
+ const results = await memos.search("dark mode");
364
+ // → [{ node: { content: "User prefers dark mode", ... }, score: 1.0 }]
365
+
366
+ // Get a summary
367
+ const summary = await memos.summarize();
368
+ // → "User prefers dark mode."
369
+
370
+ // Link memories manually
371
+ await memos.link(nodeA.id, nodeB.id, "supports");
372
+
373
+ // Explore the graph
374
+ const { nodes, edges } = await memos.getGraph();
375
+ const neighbours = await memos.getNeighbours(someNodeId);
376
+ ```
377
+
378
+ ### Python (HTTP Server)
379
+
380
+ ```python
381
+ import requests
382
+
383
+ # Start server: memos-server
384
+ BASE = "http://localhost:7400/api/mem"
385
+
386
+ # Store
387
+ requests.post(f"{BASE}/store", json={"content": "User prefers dark mode", "type": "preference"})
388
+
389
+ # Search
390
+ results = requests.post(f"{BASE}/search", json={"query": "dark mode", "limit": 5}).json()
391
+
392
+ # Get graph
393
+ graph = requests.get(f"{BASE}/graph").json()
394
+
395
+ # Import memories
396
+ requests.post(f"{BASE}/import", json={"source": "./memories.json"})
397
+
398
+ # WebSocket for real-time events
399
+ import websocket
400
+
401
+ ws = websocket.create_connection("ws://localhost:7400/ws")
402
+ ```
403
+
404
+ ### Ollama Adapter (Python)
405
+
406
+ ```python
407
+ from memos.adapters.ollama import OllamaMemory
408
+
409
+ chat = OllamaMemory(model="llama3")
410
+ await chat.init()
411
+
412
+ # Memories are automatically injected and extracted
413
+ response = await chat.chat("I prefer dark mode in all my apps")
414
+ response = await chat.chat("What theme do I like?")
415
+ # → Model recalls "dark mode" from memory
416
+ ```
417
+
418
+ ### LangChain Adapter (Python)
419
+
420
+ ```python
421
+ from langchain_openai import ChatOpenAI
422
+ from langchain.chains import ConversationChain
423
+ from memos.adapters.langchain import MemOSMemory
424
+
425
+ memory = MemOSMemory()
426
+ chain = ConversationChain(llm=ChatOpenAI(), memory=memory)
427
+
428
+ chain.invoke({"input": "I prefer dark mode"})
429
+ chain.invoke({"input": "What theme do I like?"})
430
+ # → Chain recalls "dark mode" from MemOS
431
+ ```
432
+
433
+ ### CrewAI Adapter (Python)
434
+
435
+ ```python
436
+ from memos.adapters.crewai import MemOSTool, MemOSMemory
437
+
438
+ # Use as a tool for agents
439
+ tool = MemOSTool()
440
+ result = tool._run("store", content="User prefers dark mode")
441
+ result = tool._run("search", query="dark mode")
442
+
443
+ # Use as CrewAI memory backend
444
+ memory = MemOSMemory()
445
+ memory.save("User prefers dark mode", type="preference")
446
+ context = memory.get_context("What theme do I like?")
447
+ ```
448
+
449
+ ### CLI
450
+
451
+ ```bash
452
+ # Store
453
+ memos store "User prefers dark mode" --type preference
454
+
455
+ # Search
456
+ memos search "dark mode" --limit 5
457
+
458
+ # View the graph
459
+ memos graph
460
+
461
+ # Export the graph as a Mermaid diagram (renders on GitHub)
462
+ memos graph --mermaid > graph.mmd
463
+
464
+ # Browse interactively — search, inspect, forget from the terminal
465
+ memos browse
466
+
467
+ # Scope memories per user / agent / run (hierarchical: a user query
468
+ # sees everything their agents and runs stored)
469
+ memos store "Prefers concise answers" --scope user:alice
470
+ memos search "answers" --scope user:alice
471
+
472
+ # Self-maintaining memory: consolidation with decay-based forgetting
473
+ memos consolidate # one pass (+ digest)
474
+ memos consolidate --watch # run it on a schedule instead
475
+ memos history <id> # version timeline: what replaced what
476
+
477
+ # Bring memories from ChatGPT or Claude
478
+ memos import-external ~/chatgpt-export/memories.json --source auto
479
+
480
+ # Encrypt the database in place (AES-256 via better-sqlite3-multiple-ciphers)
481
+ memos encrypt --key "<passphrase>" --db ~/.memos/memos.db
482
+
483
+ # Get a summary
484
+ memos summarize
485
+
486
+ # Export memories
487
+ memos export --format markdown --output ./my-export
488
+
489
+ # Import a chat export (ChatGPT/Claude/Slack)
490
+ memos import --from chatgpt --file ./chatgpt-export.json --dry-run
491
+
492
+ # Start the HTTP server (Python package)
493
+ memos-server
494
+ # → Listening on http://localhost:7400
495
+
496
+ # Boot the full AI Trio (MemOS + LLM-Guardian + Universal-MCP-Toolkit)
497
+ memos trio # print the compose plan
498
+ memos trio --up # launch Guardian + UMT alongside this MemOS instance
499
+ ```
500
+
501
+ ### MCP Server
502
+
503
+ Expose MemOS directly to any MCP-compatible agent over stdio:
504
+
505
+ ```bash
506
+ npx -y @mem-os/sdk mcp
507
+ ```
508
+
509
+ Use a specific local database:
510
+
511
+ ```bash
512
+ npx -y @mem-os/sdk mcp --db ~/.memos/memos.db
513
+ ```
514
+
515
+ The MCP adapter provides **21 tools** covering the full capability surface — store/search/retrieve/forget, link, graph + neighbour context, `memos_context_pack` (token-budgeted slice for prompt injection), temporal search, validity/supersede/revert, trust, quarantine release, fact extraction, diagnostics, reindex, consolidate, usage, history, and reminders. It is intentionally local-first: the server reads and writes the SQLite database you point it at and does not require cloud credentials.
516
+
517
+ #### Plugin for Claude Code (and every other harness)
518
+
519
+ ```bash
520
+ memos connect claude-code # prints the exact setup; --write saves ./.mcp.json
521
+ ```
522
+
523
+ Or install as a plugin (bundles the MCP server + `/memos` and `/recall` commands + a memory skill):
524
+
525
+ ```
526
+ /plugin marketplace add Markgatcha/memos
527
+ /plugin install memos@memos-marketplace
528
+ ```
529
+
530
+ Same one-line MCP registration works in Cursor, Windsurf, Cline, OpenCode, Codex CLI, Gemini CLI and anything else that speaks MCP — see [docs/integrations.md](docs/integrations.md) for the per-harness table.
531
+
532
+ ### WebSocket API
533
+
534
+ Connect to the WebSocket endpoint for real-time memory events:
535
+
536
+ ```javascript
537
+ const ws = new WebSocket("ws://localhost:7400/ws");
538
+
539
+ ws.onmessage = (event) => {
540
+ const data = JSON.parse(event.data);
541
+ console.log(`${data.event}:`, data.data);
542
+ };
543
+
544
+ // Events: node:created, node:updated, node:deleted,
545
+ // edge:created, edge:deleted, link:auto,
546
+ // eviction, ttl:expired
547
+ ```
548
+
549
+ ---
550
+
551
+ ## Advanced usage
552
+
553
+ ### Temporal validity
554
+
555
+ Memories can carry a validity window. When `validTo` is in the past, a memory
556
+ becomes "historical" — excluded from default search but still queryable as-of a
557
+ point in time.
558
+
559
+ ```ts
560
+ import { MemOS } from "@mem-os/sdk";
561
+
562
+ const memos = new MemOS();
563
+ await memos.init();
564
+
565
+ const { node } = await memos.store("User lives in Berlin", { type: "fact" });
566
+
567
+ // The user moves. Mark the old fact as historical…
568
+ await memos.setValidity(node.id, node.validFrom, Date.now());
569
+
570
+ // …and store the replacement, linking the two with a temporal_precedes edge.
571
+ const { node: moved } = await memos.store("User lives in Tokyo", { type: "fact" });
572
+ await memos.supersede(node.id, moved.id);
573
+
574
+ // Default search excludes superseded memories
575
+ const current = await memos.search("where does the user live");
576
+ // → "User lives in Tokyo"
577
+
578
+ // Temporal search: "What did we know at time T?"
579
+ const yesterday = Date.now() - 86_400_000;
580
+ const history = await memos.searchTemporal("where does the user live", yesterday);
581
+ // → "User lives in Berlin"
582
+ ```
583
+
584
+ ### Retain pre-filter (Hermes-style)
585
+
586
+ Not everything an agent says is worth storing. The retain filter scores candidate memories on length, signal density, action/preference verbs, and novelty against existing content — anything below `RETAIN_THRESHOLD` (0.3) is skipped before the write, keeping the graph clean and search fast. This mirrors the same technique llm-guardian uses on its read path, so the AI Trio applies consistent quality gating on both ends.
587
+
588
+ ```ts
589
+ import { MemOS, MemorySkippedError, scoreRetain } from "@mem-os/sdk";
590
+
591
+ const memos = new MemOS();
592
+ await memos.init();
593
+
594
+ // Greet-noise never reaches SQLite
595
+ try {
596
+ await memos.store("Sure, I can help with that!", { filterRetain: true });
597
+ } catch (e) {
598
+ if (e instanceof MemorySkippedError) {
599
+ console.log(e.message); // → "memory skipped by retain filter (score 0.08 < 0.3)"
600
+ }
601
+ }
602
+
603
+ // High-signal content passes through
604
+ await memos.store("User prefers TypeScript over JavaScript", { filterRetain: true });
605
+ // → stored, score 0.78
606
+
607
+ // Inspect the score without storing
608
+ scoreRetain({ content: "ok sounds good", existingContent: "" });
609
+ // → { retain: false, score: 0.05, reason: "low-signal" }
610
+ ```
611
+
612
+ `filterRetain` is opt-in per call — plain `store()` is unchanged for callers that want to write everything and dedupe later. Tune the threshold or swap in a custom classifier with `setRetainClassifier()`.
613
+
614
+ ### Trust scoring & provenance
615
+
616
+ Every memory carries a `source` (provenance) and a `trustScore` in `[0, 1]`.
617
+ Trust influences retrieval ranking — higher-trust memories rank above
618
+ lower-trust ones for the same relevance.
619
+
620
+ ```ts
621
+ import { MemOS } from "@mem-os/sdk";
622
+
623
+ const memos = new MemOS();
624
+ await memos.init();
625
+
626
+ // Default trust comes from the provenance source:
627
+ // user_input → 1.0, agent_inferred → 0.7, external_data → 0.5, system → 0.3
628
+ const { node } = await memos.store("Deploy is scheduled for Friday", {
629
+ source: "agent_inferred",
630
+ });
631
+
632
+ await memos.trust(node.id); // → 0.7
633
+ await memos.setTrust(node.id, 0.95); // override explicitly
634
+ await memos.adjustTrust(node.id, -0.2); // nudge by a delta (clamped) → 0.75
635
+
636
+ // Trust-weighted search: rank by trust and filter out low-trust memories
637
+ const trusted = await memos.search({
638
+ query: "deploy schedule",
639
+ sortBy: "trustScore",
640
+ sortOrder: "desc",
641
+ minTrustScore: 0.8,
642
+ });
643
+ ```
644
+
645
+ ### Fact extraction
646
+
647
+ A local, rule-based extractor pulls candidate facts (preferences, entities,
648
+ context) out of a conversation and can auto-store the high-confidence ones.
649
+ No LLM API calls required. Near-duplicates are skipped automatically when
650
+ embeddings are available.
651
+
652
+ ```ts
653
+ import { MemOS } from "@mem-os/sdk";
654
+
655
+ const memos = new MemOS();
656
+ await memos.init();
657
+
658
+ const conversation = [
659
+ { role: "user", content: "I prefer dark mode in all my editors." },
660
+ { role: "assistant", content: "Got it — I'll remember that." },
661
+ { role: "user", content: "My name is Alice and I work at Acme Corp." },
662
+ ];
663
+
664
+ const { facts, storedIds, duplicates } = await memos.extractFacts(conversation, {
665
+ autoStore: true,
666
+ minConfidence: 0.6,
667
+ dedupe: true,
668
+ });
669
+
670
+ console.log(facts); // → [{ content: "I prefer dark mode ...", type: "preference", confidence: 0.9 }, ...]
671
+ console.log(storedIds); // → ["node-uuid-1", "node-uuid-2"]
672
+ console.log(duplicates); // → 0
673
+ ```
674
+
675
+ ### Diagnostics
676
+
677
+ Get a full health snapshot of the memory store — counts by source, type, and
678
+ namespace; temporal and trust statistics; embedding coverage; and DB size.
679
+
680
+ ```ts
681
+ import { MemOS } from "@mem-os/sdk";
682
+
683
+ const memos = new MemOS();
684
+ await memos.init();
685
+
686
+ const diag = await memos.diagnostics();
687
+ console.log(diag);
688
+ // {
689
+ // totalNodes: 42,
690
+ // totalEdges: 17,
691
+ // nodesWithEmbeddings: 42,
692
+ // nodesWithValidity: 3,
693
+ // historicalNodes: 1,
694
+ // nodesWithTTL: 0,
695
+ // expiredNodes: 0,
696
+ // avgImportance: 0.51,
697
+ // avgTrustScore: 0.83,
698
+ // bySource: { user_input: 30, agent_inferred: 12 },
699
+ // byType: { preference: 18, fact: 16, context: 8 },
700
+ // byNamespace: { default: 42 },
701
+ // dbSizeBytes: 106496,
702
+ // embeddingQueue: { pending: 0, running: 0, total: 42, nodes: [...] },
703
+ // storageCapabilities: { peekNode: true, evictLeastImportant: true, ... }
704
+ // }
705
+ ```
706
+
707
+ ### Image memory
708
+
709
+ Remember images alongside text. An image memory is an ordinary memory whose
710
+ `content` is a **caption**, plus the image bytes in a content-addressed blob
711
+ store next to the database. Identical bytes are stored once.
712
+
713
+ ```ts
714
+ import { MemOS } from "@mem-os/sdk";
715
+
716
+ const memos = new MemOS({
717
+ vision: {
718
+ enabled: true,
719
+ // Optional: match the PIXELS, not just the caption's wording.
720
+ clip: { enabled: true },
721
+ },
722
+ });
723
+ await memos.init();
724
+
725
+ // Store — path, URL, base64, or raw bytes.
726
+ const { node, image } = await memos.addImageMemory("./diagram.png", {
727
+ caption: "gateway → auth → orders → postgres, with a retry loop on orders",
728
+ kind: "diagram",
729
+ tags: ["arch"],
730
+ });
731
+
732
+ // Find it by text.
733
+ const hits = await memos.searchImages("the retry-loop diagram");
734
+
735
+ // Resolve a ref back to bytes (for a vision-capable model).
736
+ const { buffer, mime } = await memos.imageMemory(image.ref);
737
+ ```
738
+
739
+ Two independent tracks:
740
+
741
+ | Track | What is embedded | What it gives you | Extra download |
742
+ |---|---|---|---|
743
+ | **A — caption (default)** | the caption, by your normal text embedder | keyword + semantic search find the image on every install | none |
744
+ | **B — CLIP (opt-in)** | the image itself, in a separate vector space | matches the **pixels** when the query's wording differs from the caption's | ~350 MB on first use |
745
+
746
+ Track B degrades to Track A when the model isn't available — it never throws
747
+ and never substitutes a text vector for an image one. CLIP vectors live in
748
+ their own `image_embeddings` table, so the two spaces can never be mixed.
749
+
750
+ **Context packs carry references, never bytes.** An image item renders as
751
+ `[img:<ref>]` in TOON and as an `images` array in JSON, so a pack stays
752
+ byte-stable for provider prompt caching. The token survives compression and
753
+ every fidelity level, and `memos.imageMemory(ref)` resolves it when a
754
+ vision-capable host needs to actually see the image.
755
+
756
+ ```bash
757
+ memos image add ./diagram.png --caption "deploy topology" --kind diagram
758
+ memos image list
759
+ memos image search "the retry-loop diagram"
760
+ memos image show img_3f9a2b8c1a2b --out ./out.png
761
+ memos image purge # delete blobs no live node references
762
+ ```
763
+
764
+ MCP tools: `memos_image_add`, `memos_image_search`, `memos_image_recall`.
765
+
766
+ ### OpenAI adapter
767
+
768
+ The OpenAI adapter ships as a built-in subpath export — no separate install
769
+ beyond `@mem-os/sdk`. It prepares memories as tools, tool messages, and
770
+ system-prompt strings for your own `openai.chat.completions` calls.
771
+
772
+ ```ts
773
+ import OpenAI from "openai";
774
+ import { createOpenAIMemory } from "@mem-os/sdk/openai";
775
+
776
+ const { memos, plugin } = await createOpenAIMemory({
777
+ dbPath: "./my-app.db",
778
+ plugin: { maxContextMemories: 6 },
779
+ });
780
+
781
+ const openai = new OpenAI();
782
+
783
+ // addMessages() extracts & stores facts automatically
784
+ await plugin.addMessages([
785
+ { role: "user", content: "I prefer dark mode in all my apps." },
786
+ { role: "assistant", content: "Got it — dark mode it is." },
787
+ ]);
788
+
789
+ // Context-injection style: fold relevant memories into the system prompt
790
+ const systemCtx = await plugin.getMemoryContext([
791
+ { role: "user", content: "What theme do I like?" },
792
+ ]);
793
+
794
+ const completion = await openai.chat.completions.create({
795
+ model: "gpt-4o",
796
+ messages: [
797
+ { role: "system", content: `You are a helpful assistant.\n\n${systemCtx}` },
798
+ { role: "user", content: "What theme do I like?" },
799
+ ],
800
+ });
801
+
802
+ // Tool style: let the model call search_memories itself
803
+ const res = await openai.chat.completions.create({
804
+ model: "gpt-4o",
805
+ messages: [{ role: "user", content: "What theme do I like?" }],
806
+ tools: [plugin.memoryTool],
807
+ });
808
+ ```
809
+
810
+ ---
811
+
812
+ ## Configuration
813
+
814
+ ```typescript
815
+ const memos = new MemOS({
816
+ dbPath: "./my-app.db", // SQLite file path (default: ~/.memos/memos.db)
817
+ wal: true, // WAL mode for concurrent reads (default: true)
818
+ maxMemories: 10000, // LRU eviction limit (default: 0 = unlimited)
819
+ autoLinkThreshold: 0.3, // Auto-link similarity threshold (default: 0.3)
820
+ storage: customAdapter, // Custom StorageAdapter implementation
821
+ });
822
+ ```
823
+
824
+ Environment variables (Python server):
825
+
826
+ | Variable | Default | Description |
827
+ |----------|---------|-------------|
828
+ | `MEMOS_PORT` | `7400` | Server port |
829
+ | `MEMOS_HOST` | `0.0.0.0` | Server bind address |
830
+ | `MEMOS_DB_PATH` | `~/.memos/memos.db` | SQLite database path |
831
+ | `MEMOS_LOG_LEVEL` | `info` | Log verbosity |
832
+
833
+ ---
834
+
835
+ ## Adapter list
836
+
837
+ | Adapter | Language | Framework | Status |
838
+ |---------|----------|-----------|--------|
839
+ | [Ollama](adapters/ollama.py) | Python | Ollama | ✅ |
840
+ | [LangChain](adapters/langchain.py) | Python | LangChain | ✅ |
841
+ | [CrewAI](adapters/crewai.py) | Python | CrewAI | ✅ |
842
+ | [OpenAI SDK](src/adapters/openai.ts) | TypeScript | OpenAI | ✅ Built-in |
843
+ | [Anthropic SDK](src/adapters/anthropic.ts) | TypeScript | Anthropic | ✅ Built-in |
844
+ | Vercel AI SDK | TypeScript | Vercel AI | 🔜 Contrib welcome |
845
+ | HuggingFace | Python | transformers | 🔜 Contrib welcome |
846
+
847
+ **Want to build an adapter?** See [CONTRIBUTING.md](CONTRIBUTING.md) — we actively support community adapter contributions and will list yours in this table.
848
+
849
+ ---
850
+
851
+ ## Installation
852
+
853
+ MemOS works on **Windows**, **macOS**, and **Linux**. Choose your preferred method:
854
+
855
+ ### One-line install (no Node.js required)
856
+
857
+ ```bash
858
+ curl -fsSL https://raw.githubusercontent.com/Markgatcha/memos/main/scripts/install.sh | sh
859
+ ```
860
+
861
+ Installs everything under `~/.memos` (downloads Node.js for you if needed),
862
+ then follow the PATH hint it prints and run `memos init`. See
863
+ [docs/installation.md](docs/installation.md) for details.
864
+
865
+ ### npm (TypeScript/Node.js)
866
+
867
+ ```bash
868
+ npm install @mem-os/sdk
869
+ ```
870
+
871
+ Prebuilt native `better-sqlite3` bindings for Linux, macOS, and Windows (Node 22 and 24) are built and verified on every push and attached to every [GitHub Release](https://github.com/Markgatcha/memos/releases) — useful if your platform has no upstream prebuild and you'd rather not run a compiler.
872
+
873
+ ### Python (PyPI)
874
+
875
+ ```bash
876
+ pip install mem-os-python
877
+
878
+ # With optional framework adapters
879
+ pip install "mem-os-python[langchain]" # LangChain adapter
880
+ pip install "mem-os-python[ollama]" # Ollama adapter
881
+ pip install "mem-os-python[all]" # both adapters
882
+ ```
883
+
884
+ The Python package wraps the TypeScript SDK, so **Node.js >= 18 is required**
885
+ at runtime. On first server start it installs the native `better-sqlite3`
886
+ module automatically (via npm).
887
+
888
+ Or install straight from the repo (you get exactly what's on `main`):
889
+
890
+ ```bash
891
+ git clone https://github.com/Markgatcha/memos.git
892
+ cd memos
893
+ pnpm install && pnpm build # compile the TypeScript SDK
894
+ pip install -e ".[all]"
895
+ ```
896
+
897
+ ### From source
898
+
899
+ ```bash
900
+ git clone https://github.com/Markgatcha/memos.git
901
+ cd memos
902
+
903
+ # TypeScript
904
+ pnpm install
905
+ pnpm build
906
+
907
+ # Python
908
+ pip install -e ".[dev]"
909
+ ```
910
+
911
+ ### Docker
912
+
913
+ ```bash
914
+ # Build and run
915
+ docker compose up -d
916
+
917
+ # Check health
918
+ curl http://localhost:7400/health
919
+
920
+ # View API docs
921
+ open http://localhost:7400/docs
922
+ ```
923
+
924
+ ### Docker image
925
+
926
+ ```bash
927
+ docker pull ghcr.io/markgatcha/memos:latest
928
+ docker run -p 7400:7400 ghcr.io/markgatcha/memos:latest
929
+ ```
930
+
931
+ ---
932
+
933
+ ## Privacy
934
+
935
+ MemOS is built on a strict privacy-first foundation:
936
+
937
+ - **Zero telemetry** — no analytics, no tracking, no phone-home
938
+ - **Zero cloud dependencies** — no API keys required for core functionality
939
+ - **100% local storage** — SQLite on your filesystem, your data stays with you
940
+ - **Open source** — every line of code is auditable
941
+ - **No data collection** — we don't know what you store, and we never will
942
+
943
+ ---
944
+
945
+ ## Contributing
946
+
947
+ We welcome contributions of all kinds — bug fixes, new adapters, documentation improvements, and feature proposals.
948
+
949
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the full guide. The fastest way to contribute is to **build an adapter** for a framework we don't support yet.
950
+
951
+ ---
952
+
953
+ ## Roadmap
954
+
955
+ | Phase | Target | Highlights |
956
+ |-------|--------|------------|
957
+ | **v1.6.x** (current) | Core engine | Graph memory, SQLite FTS5, TypeScript SDK, Python server, Ollama + LangChain + CrewAI adapters, CLI, import/export, WebSocket API, MCP |
958
+ | **v2.0** | Semantic intelligence | Harden embedding search at scale, temporal knowledge graphs, memory consolidation, provenance tracking |
959
+ | **v3.0** | Multi-user | User isolation, RBAC, plugin system, Postgres/Redis/Qdrant backends |
960
+ | **v4.0** | Intelligence | Memory poisoning defense, graph dashboard, agent self-editing, benchmark suite |
961
+ | **v5.0** | Ecosystem | MCP 2026 compliance, cross-framework adapters, enterprise features, standards |
962
+
963
+ See [ROADMAP.md](ROADMAP.md) for the detailed milestone plan.
964
+
965
+
966
+ ## Ecosystem — The Local-First AI Trio
967
+
968
+ MemOS is the **memory layer** of the local-first AI stack. It forms an **AI Trio** with two sibling projects:
969
+
970
+ | Tool | Role | Works with MemOS |
971
+ |------|------|------------------|
972
+ | [universal-mcp-toolkit](https://github.com/Markgatcha/universal-mcp-toolkit) | MCP transport & tool registry | ✅ Native MCP adapter (stdio + HTTP+SSE) |
973
+ | [llm-guardian](https://github.com/Markgatcha/llm-guardian) | LLM cost guardian & prompt compression | ✅ Context pack contract (`ai.trio.memos.context-pack.v1`) |
974
+ | Ollama | Local LLM inference | ✅ Adapter included |
975
+ | OpenAI SDK | Cloud LLM + embeddings | ✅ Adapter included |
976
+ | Anthropic SDK | Claude integration | ✅ Adapter included |
977
+ | LangChain | Agent framework | ✅ Adapter included |
978
+ | CrewAI | Multi-agent orchestration | ✅ Adapter included |
979
+
980
+ ### How the Trio works together
981
+
982
+ 1. **MemOS** stores and retrieves memories locally via SQLite + embeddings
983
+ 2. **llm-guardian** calls `memos.contextPack({ query, tokenBudget })` to get a token-budgeted, ranked memory slice
984
+ 3. **universal-mcp-toolkit** exposes MemOS as MCP tools (`memos_store`, `memos_search`, `memos_extract_facts`, etc.) so any MCP-compatible agent (Claude, Hermes, etc.) gets persistent memory
985
+
986
+ > **Building with MCP?** The official MemOS MCP adapter works out of the box with [universal-mcp-toolkit](https://github.com/Markgatcha/universal-mcp-toolkit), giving every Claude, OpenClaw, and MCP-compatible agent persistent memory in one step. The HTTP+SSE transport is the same one UMT ships, so web-based MCP hosts work too.
987
+
988
+ > **Building with LLM Guardian?** The `contextPack()` method implements the `ai.trio.memos.context-pack.v1` contract — Guardian consumes it directly, no adapter needed. Trust scores and provenance flow through the pack so Guardian can make cost-aware decisions about which memories to fold into the prompt.
989
+
990
+ ### MemOS vs. Mem0
991
+
992
+ | Feature | MemOS | Mem0 |
993
+ |---------|-------|------|
994
+ | **Local-first** | ✅ SQLite, no server required | ❌ Cloud-first, self-host needs Docker |
995
+ | **Temporal validity** | ✅ `validFrom`/`validTo`, `searchTemporal()` | ✅ Time-aware retrieval (Apr 2026) |
996
+ | **Trust & provenance** | ✅ `source`, `trustScore`, trust-weighted search | ❌ Not available |
997
+ | **Memory consolidation** | ✅ `dedupe()`, `archive()`, `summarizeCluster()` | ❌ ADD-only (no UPDATE/DELETE) |
998
+ | **Fact extraction** | ✅ Local rule-based (`extractFacts()`) | ✅ LLM-based (requires API calls) |
999
+ | **MCP native** | ✅ stdio (2026-07-28 spec) | ❌ |
1000
+ | **Graph edges** | ✅ First-class (`derived_from`, `temporal_precedes`, etc.) | ✅ Entity linking (Apr 2026) |
1001
+ | **Embedding providers** | ✅ 6 (local-hash, Ollama, OpenAI, Voyage, Cohere, FastEmbed) | ✅ OpenAI, Qwen |
1002
+ | **Background queue** | ✅ Bounded concurrency, retry, backpressure | ❌ |
1003
+ | **CLI** | ✅ Interactive TUI + 40+ commands | ✅ Basic add/search |
1004
+ | **Privacy** | ✅ 100% local, zero network calls | ❌ Cloud calls by default |
1005
+ | **Diagnostics** | ✅ `diagnostics()` with source/type/namespace breakdown | ❌ |
1006
+ | **Price** | ✅ Free forever — MIT, no paid tier | ❌ Platform: free tier capped, $19–$249/mo; graph memory is Pro-only |
1007
+
1008
+ > **Free and open source, actually.** MemOS is MIT-licensed: use it, modify it, self-host it, ship it in your product — no account, no usage metering, no paid tier hiding features. Mem0's platform (mem0.ai/pricing) starts at $19/month and charges $249/month for graph memory — a feature MemOS includes by default. Your memories in MemOS are a SQLite file on your disk; on the Mem0 platform they live in their cloud.
1009
+
1010
+ ---
1011
+
1012
+ ## ⭐ Star history
1013
+
1014
+ If MemOS earns a place in your stack, the star button is right up there — it helps more than you'd think.
1015
+
1016
+ <p align="center">
1017
+ <a href="https://star-history.com/#Markgatcha/memos&Date">
1018
+ <img src="https://api.star-history.com/svg?repos=Markgatcha/memos&type=Date" alt="Star History Chart" width="640" />
1019
+ </a>
1020
+ </p>
1021
+
1022
+ ---
1023
+
1024
+ ## License
1025
+
1026
+ [MIT](LICENSE) — use it anywhere, for any purpose, no attribution required.
1027
+
1028
+ ---
1029
+
1030
+ <p align="center">
1031
+ <sub>Built with intent. Star the repo if MemOS solves a problem for you.</sub>
1032
+ </p>