langchain-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.
@@ -0,0 +1,102 @@
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
+ .venv-workflows/
12
+
13
+ # Test / CI artifacts
14
+ .coverage
15
+ coverage.json
16
+
17
+ # Environment
18
+ .env
19
+ .env.*
20
+ !.env.example
21
+ !.env.*.example
22
+ .mcp.json
23
+ .mcp.json.bak.*
24
+ !.mcp.json.example
25
+ # The Claude Code plugin ships its MCP server declaration — keep it tracked
26
+ !packages/memtomem-claude-plugin/.mcp.json
27
+ # The Codex plugin also ships its MCP server declaration
28
+ !plugins/memtomem/.mcp.json
29
+
30
+ # Claude Code
31
+ .claude/
32
+ CLAUDE.local.md
33
+
34
+ # Other agent harnesses — context gateway outputs (user-local, derived from
35
+ # CLAUDE.md). Regenerate via `mm context init` + `mm context sync`.
36
+ AGENTS.md
37
+ GEMINI.md
38
+ .cursorrules
39
+ .github/copilot-instructions.md
40
+ .memtomem/
41
+
42
+ # macOS
43
+ .DS_Store
44
+
45
+ # Jupyter checkpoints
46
+ .ipynb_checkpoints/
47
+ notebooks/**/.ipynb_checkpoints/
48
+
49
+ # Notebooks
50
+ notebooks/__pycache__/
51
+ memories/
52
+ node_modules/
53
+
54
+ # Internal development artifacts
55
+ docs/testing/
56
+ docs/marketing/
57
+ docs/reports/
58
+ docs/plans/
59
+ docs/qa/
60
+ .claude-memory/
61
+ BUG_REPORT.md
62
+ *.png
63
+ # The Claude plugin directory takes its listing icon from this file
64
+ !packages/memtomem-claude-plugin/.claude-plugin/icon.png
65
+ # The Codex plugin's interface.composerIcon, the same image
66
+ !plugins/memtomem/assets/icon.png
67
+ # The Cursor plugin's manifest logo, the same image
68
+ !packages/memtomem-cursor-plugin/assets/icon.png
69
+ main.py
70
+ scripts/
71
+ .agents-dev/
72
+ # dev-trio plugin: per-run Codex/Gemini reviewer transcripts. Contain local
73
+ # paths, session metadata, prompts, and reviewer output — never commit.
74
+ .dev-trio/
75
+ # debate-conductor plugin: generator/critic transcripts, same contents and the
76
+ # same reason.
77
+ .debate-conductor/
78
+
79
+ # Experimental plugins kept private until promoted
80
+ packages/memtomem-openclaw-plugin/
81
+
82
+ # Dev repo: root tests excluded, package tests included
83
+ tests/
84
+ !packages/*/tests/
85
+ .playwright-mcp/
86
+
87
+ # Standalone test sandbox
88
+ /tmp/memtomem-test/
89
+
90
+ # memtomem local artifacts (ADR-0011 project_local tier)
91
+ .memtomem/*.local/
92
+ .memtomem/.staging/
93
+
94
+ # Cross-process file-lock sidecars. Indexing drops an empty `.{name}.lock`
95
+ # next to each file it locks, and context/_atomic.py forbids unlinking them
96
+ # (deleting a sidecar reintroduces the os.replace inode race), so ignore
97
+ # rather than delete. The leading dot is required and is what keeps the
98
+ # tracked `uv.lock` unmatched. Which files get one, and when it is safe to
99
+ # remove them, are documented once in docs/guides/configuration.md under
100
+ # "Lock sidecars" — kept there rather than restated here, since only the
101
+ # guide's copy is pinned by tests. See #2387.
102
+ .*.lock
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ All notable changes to `langchain-memtomem` are recorded here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.1.0] — 2026-11-04
9
+
10
+ ### Added
11
+
12
+ - `MemtomemPipelineStore`, a LangGraph `BaseStore` whose `search(query=...)` runs the memtomem
13
+ pipeline over one Markdown projection per item, in an index the store owns under its root
14
+ (ADR-0042).
@@ -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-2026 DAPADA Inc. and 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,151 @@
1
+ Metadata-Version: 2.5
2
+ Name: langchain-memtomem
3
+ Version: 0.1.0
4
+ Summary: A LangGraph BaseStore whose query search runs the memtomem pipeline over Markdown projections
5
+ Project-URL: Homepage, https://github.com/memtomem/memtomem
6
+ Project-URL: Repository, https://github.com/memtomem/memtomem
7
+ Project-URL: Issues, https://github.com/memtomem/memtomem/issues
8
+ Author: memtomem contributors
9
+ Author-email: "DAPADA Inc." <contact@dapada.co.kr>
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: langchain,langgraph,markdown,memory,memtomem,store
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.12
22
+ Requires-Dist: langgraph<2,>=1.0
23
+ Requires-Dist: memtomem<0.8,>=0.7.4
24
+ Description-Content-Type: text/markdown
25
+
26
+ # langchain-memtomem
27
+
28
+ A [LangGraph](https://github.com/langchain-ai/langgraph) `BaseStore` whose
29
+ `search(query=...)` runs the [memtomem](https://github.com/memtomem/memtomem)
30
+ search pipeline — query expansion, BM25 and dense fusion, optional
31
+ cross-encoder rerank, time decay, MMR, entity boost — over one Markdown
32
+ projection per item, in an index the store owns.
33
+
34
+ - **Each item is a file a person can open and diff.** A JSON record is the
35
+ source of truth; an indexed item also has a Markdown projection beside it.
36
+ - **The index is the store's.** It lives under the root you choose, built
37
+ from a configuration the store assembles itself: nothing from your own
38
+ memtomem's `config.json`, `config.d` or `MEMTOMEM_*` variables reaches it,
39
+ and the store writes its records and index only under its root. It reads
40
+ that configuration once, to find which project tier the root is in.
41
+ Outside the root, the store can also touch memtomem's shared paths: with
42
+ ONNX embedding or the default reranker, model files are downloaded to
43
+ memtomem's model cache (`~/.memtomem/cache/fastembed` unless
44
+ `MEMTOMEM_FASTEMBED_CACHE` or `FASTEMBED_CACHE_PATH` names another
45
+ directory), and opening an index that needs a schema migration takes a lock
46
+ in memtomem's runtime directory (`/tmp/memtomem-<uid>` on POSIX) and removes
47
+ aged stale entries from the instance registries it reads. `docs/protocol.md` lists these.
48
+ - **The store is the application's memory**, not the developer's: its
49
+ namespaces are your users and threads. If you want to read it from your
50
+ own memtomem, add `<root>/projections` to `indexing.read_only_memory_dirs`
51
+ in your personal configuration.
52
+
53
+ ## Install
54
+
55
+ ```bash
56
+ pip install langchain-memtomem
57
+ ```
58
+
59
+ Requires Python 3.12+, `langgraph>=1.0,<2` and `memtomem>=0.7.4,<0.8`, the
60
+ first memtomem release that carries the ADR-0042 public names (the package
61
+ refuses to import against an older memtomem). Embedding is off by default (`embedding.provider = "none"`,
62
+ BM25 only, no model download); pass an `embedding` section to turn it on.
63
+
64
+ ## Use
65
+
66
+ ```python
67
+ from langchain_memtomem import MemtomemPipelineStore
68
+
69
+ store = await MemtomemPipelineStore.open("/var/app/memory")
70
+
71
+ await store.aput(("users", "alice"), "pref-1", {"text": "prefers window seats", "kind": "pref"})
72
+ await store.aput(("users", "alice"), "pref-2", {"text": "allergic to peanuts"}, index=False)
73
+
74
+ hits = await store.asearch(("users",), query="seat preference", filter={"kind": "pref"}, limit=5)
75
+ for item in hits:
76
+ print(item.namespace, item.key, item.score, item.value)
77
+
78
+ await store.adelete(("users", "alice"), "pref-1")
79
+ await store.aclose()
80
+ ```
81
+
82
+ `get`, `list_namespaces` and a query-less `search` read the records only.
83
+ `search(query=...)` ranks projections through the pipeline and returns whole
84
+ items, paginated over items. `index=False` stores an item without a
85
+ projection; it is listed and filtered, never ranked. `async with
86
+ MemtomemPipelineStore(root) as store:` opens on entry and closes on exit. A synchronous
87
+ `store.put(...)` / `store.search(...)` works outside a running event loop.
88
+
89
+ With an embedder and a reranker, both of which need memtomem's `onnx` extra in
90
+ the same environment:
91
+
92
+ ```bash
93
+ pip install langchain-memtomem 'memtomem[onnx]'
94
+ ```
95
+
96
+ ```python
97
+ store = await MemtomemPipelineStore.open(
98
+ "/var/app/memory",
99
+ config={
100
+ "embedding": {"provider": "onnx", "model": "multilingual-e5-small"},
101
+ "rerank": {"enabled": True},
102
+ "search": {"cache_ttl": 5.0},
103
+ },
104
+ max_chunks_per_search=400,
105
+ )
106
+ ```
107
+
108
+ `config` takes the sections of memtomem's `Mem2MemConfig` you want to set
109
+ (`embedding`, `search`, `rerank`, …). `storage` and `indexing` belong to the
110
+ store and are refused, so this release has no chunking override. A top-level
111
+ section `Mem2MemConfig` does not define is ignored, not refused; an unknown key
112
+ inside a known section is refused.
113
+
114
+ ## What to know
115
+
116
+ - **Recall is bounded.** A query search asks the pipeline for at most
117
+ `max_chunks_per_search` chunks in one pass (default 200). It starts with a
118
+ smaller window and doubles it until it has `offset + limit` items or the
119
+ window reaches that bound, so a query whose filter matches little can run
120
+ several passes; `rerank.max_pool` does not lower the bound.
121
+ - **Read-after-write.** The instance that wrote sees its write at once.
122
+ Another store instance over the same root sees it after its
123
+ `search.cache_ttl` (30 s by default), or at once if a cached hit disagrees
124
+ with the files.
125
+ - **Two instances over one root** — two processes, or two stores in one —
126
+ serialise per item on memtomem's own file lock. An interrupted write is
127
+ repaired when the store is next opened, or when a query hits the item.
128
+ - **Project tiers.** If the root is inside a directory registered in your
129
+ memtomem as a `project_shared` tier (git-tracked), opening it requires
130
+ `confirm_project_shared=True`, and `force_unsafe` is refused there. The
131
+ project registry is the one thing the store reads from your personal
132
+ memtomem configuration.
133
+ - **Secrets.** Every write runs memtomem's redaction guard over the record
134
+ and over the projection text before anything is written. A hit refuses the
135
+ write; `force_unsafe=True` on the store lets it through, except in a
136
+ `project_shared` tier.
137
+ - **Names.** Each namespace segment and the key encode to at most 200
138
+ characters on disk (up to 124 bytes of UTF-8 each), and a whole namespace
139
+ to at most 256; a longer one is refused at `put`. The encoding is
140
+ single-case, so names that differ only in case stay apart on macOS and
141
+ Windows too.
142
+ - **TTLs** are not supported in this version: an explicit `ttl=` raises
143
+ `NotImplementedError` (LangGraph's own check, since `supports_ttl` is
144
+ `False`).
145
+
146
+ The full protocol — write order, repair table, interruption matrix, search
147
+ widening, measurements — is in [`docs/protocol.md`](docs/protocol.md).
148
+
149
+ ## License
150
+
151
+ Apache-2.0, the same as memtomem.
@@ -0,0 +1,126 @@
1
+ # langchain-memtomem
2
+
3
+ A [LangGraph](https://github.com/langchain-ai/langgraph) `BaseStore` whose
4
+ `search(query=...)` runs the [memtomem](https://github.com/memtomem/memtomem)
5
+ search pipeline — query expansion, BM25 and dense fusion, optional
6
+ cross-encoder rerank, time decay, MMR, entity boost — over one Markdown
7
+ projection per item, in an index the store owns.
8
+
9
+ - **Each item is a file a person can open and diff.** A JSON record is the
10
+ source of truth; an indexed item also has a Markdown projection beside it.
11
+ - **The index is the store's.** It lives under the root you choose, built
12
+ from a configuration the store assembles itself: nothing from your own
13
+ memtomem's `config.json`, `config.d` or `MEMTOMEM_*` variables reaches it,
14
+ and the store writes its records and index only under its root. It reads
15
+ that configuration once, to find which project tier the root is in.
16
+ Outside the root, the store can also touch memtomem's shared paths: with
17
+ ONNX embedding or the default reranker, model files are downloaded to
18
+ memtomem's model cache (`~/.memtomem/cache/fastembed` unless
19
+ `MEMTOMEM_FASTEMBED_CACHE` or `FASTEMBED_CACHE_PATH` names another
20
+ directory), and opening an index that needs a schema migration takes a lock
21
+ in memtomem's runtime directory (`/tmp/memtomem-<uid>` on POSIX) and removes
22
+ aged stale entries from the instance registries it reads. `docs/protocol.md` lists these.
23
+ - **The store is the application's memory**, not the developer's: its
24
+ namespaces are your users and threads. If you want to read it from your
25
+ own memtomem, add `<root>/projections` to `indexing.read_only_memory_dirs`
26
+ in your personal configuration.
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ pip install langchain-memtomem
32
+ ```
33
+
34
+ Requires Python 3.12+, `langgraph>=1.0,<2` and `memtomem>=0.7.4,<0.8`, the
35
+ first memtomem release that carries the ADR-0042 public names (the package
36
+ refuses to import against an older memtomem). Embedding is off by default (`embedding.provider = "none"`,
37
+ BM25 only, no model download); pass an `embedding` section to turn it on.
38
+
39
+ ## Use
40
+
41
+ ```python
42
+ from langchain_memtomem import MemtomemPipelineStore
43
+
44
+ store = await MemtomemPipelineStore.open("/var/app/memory")
45
+
46
+ await store.aput(("users", "alice"), "pref-1", {"text": "prefers window seats", "kind": "pref"})
47
+ await store.aput(("users", "alice"), "pref-2", {"text": "allergic to peanuts"}, index=False)
48
+
49
+ hits = await store.asearch(("users",), query="seat preference", filter={"kind": "pref"}, limit=5)
50
+ for item in hits:
51
+ print(item.namespace, item.key, item.score, item.value)
52
+
53
+ await store.adelete(("users", "alice"), "pref-1")
54
+ await store.aclose()
55
+ ```
56
+
57
+ `get`, `list_namespaces` and a query-less `search` read the records only.
58
+ `search(query=...)` ranks projections through the pipeline and returns whole
59
+ items, paginated over items. `index=False` stores an item without a
60
+ projection; it is listed and filtered, never ranked. `async with
61
+ MemtomemPipelineStore(root) as store:` opens on entry and closes on exit. A synchronous
62
+ `store.put(...)` / `store.search(...)` works outside a running event loop.
63
+
64
+ With an embedder and a reranker, both of which need memtomem's `onnx` extra in
65
+ the same environment:
66
+
67
+ ```bash
68
+ pip install langchain-memtomem 'memtomem[onnx]'
69
+ ```
70
+
71
+ ```python
72
+ store = await MemtomemPipelineStore.open(
73
+ "/var/app/memory",
74
+ config={
75
+ "embedding": {"provider": "onnx", "model": "multilingual-e5-small"},
76
+ "rerank": {"enabled": True},
77
+ "search": {"cache_ttl": 5.0},
78
+ },
79
+ max_chunks_per_search=400,
80
+ )
81
+ ```
82
+
83
+ `config` takes the sections of memtomem's `Mem2MemConfig` you want to set
84
+ (`embedding`, `search`, `rerank`, …). `storage` and `indexing` belong to the
85
+ store and are refused, so this release has no chunking override. A top-level
86
+ section `Mem2MemConfig` does not define is ignored, not refused; an unknown key
87
+ inside a known section is refused.
88
+
89
+ ## What to know
90
+
91
+ - **Recall is bounded.** A query search asks the pipeline for at most
92
+ `max_chunks_per_search` chunks in one pass (default 200). It starts with a
93
+ smaller window and doubles it until it has `offset + limit` items or the
94
+ window reaches that bound, so a query whose filter matches little can run
95
+ several passes; `rerank.max_pool` does not lower the bound.
96
+ - **Read-after-write.** The instance that wrote sees its write at once.
97
+ Another store instance over the same root sees it after its
98
+ `search.cache_ttl` (30 s by default), or at once if a cached hit disagrees
99
+ with the files.
100
+ - **Two instances over one root** — two processes, or two stores in one —
101
+ serialise per item on memtomem's own file lock. An interrupted write is
102
+ repaired when the store is next opened, or when a query hits the item.
103
+ - **Project tiers.** If the root is inside a directory registered in your
104
+ memtomem as a `project_shared` tier (git-tracked), opening it requires
105
+ `confirm_project_shared=True`, and `force_unsafe` is refused there. The
106
+ project registry is the one thing the store reads from your personal
107
+ memtomem configuration.
108
+ - **Secrets.** Every write runs memtomem's redaction guard over the record
109
+ and over the projection text before anything is written. A hit refuses the
110
+ write; `force_unsafe=True` on the store lets it through, except in a
111
+ `project_shared` tier.
112
+ - **Names.** Each namespace segment and the key encode to at most 200
113
+ characters on disk (up to 124 bytes of UTF-8 each), and a whole namespace
114
+ to at most 256; a longer one is refused at `put`. The encoding is
115
+ single-case, so names that differ only in case stay apart on macOS and
116
+ Windows too.
117
+ - **TTLs** are not supported in this version: an explicit `ttl=` raises
118
+ `NotImplementedError` (LangGraph's own check, since `supports_ttl` is
119
+ `False`).
120
+
121
+ The full protocol — write order, repair table, interruption matrix, search
122
+ widening, measurements — is in [`docs/protocol.md`](docs/protocol.md).
123
+
124
+ ## License
125
+
126
+ Apache-2.0, the same as memtomem.