rewind-memory-pro 0.4.5__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 (56) hide show
  1. rewind_memory_pro-0.4.5/LICENSE +191 -0
  2. rewind_memory_pro-0.4.5/PKG-INFO +359 -0
  3. rewind_memory_pro-0.4.5/README.md +317 -0
  4. rewind_memory_pro-0.4.5/pyproject.toml +44 -0
  5. rewind_memory_pro-0.4.5/rewind/__init__.py +7 -0
  6. rewind_memory_pro-0.4.5/rewind/__main__.py +545 -0
  7. rewind_memory_pro-0.4.5/rewind/api/__init__.py +1 -0
  8. rewind_memory_pro-0.4.5/rewind/api/auth.py +26 -0
  9. rewind_memory_pro-0.4.5/rewind/api/checkout.py +162 -0
  10. rewind_memory_pro-0.4.5/rewind/api/metering.py +29 -0
  11. rewind_memory_pro-0.4.5/rewind/api/routes.py +138 -0
  12. rewind_memory_pro-0.4.5/rewind/api/server.py +53 -0
  13. rewind_memory_pro-0.4.5/rewind/api/stripe_webhook.py +223 -0
  14. rewind_memory_pro-0.4.5/rewind/client.py +467 -0
  15. rewind_memory_pro-0.4.5/rewind/config.py +231 -0
  16. rewind_memory_pro-0.4.5/rewind/embedding/__init__.py +13 -0
  17. rewind_memory_pro-0.4.5/rewind/embedding/base.py +32 -0
  18. rewind_memory_pro-0.4.5/rewind/embedding/nv_embed.py +48 -0
  19. rewind_memory_pro-0.4.5/rewind/embedding/ollama.py +55 -0
  20. rewind_memory_pro-0.4.5/rewind/embedding/openai.py +63 -0
  21. rewind_memory_pro-0.4.5/rewind/feedback/__init__.py +11 -0
  22. rewind_memory_pro-0.4.5/rewind/feedback/boosts.py +104 -0
  23. rewind_memory_pro-0.4.5/rewind/feedback/corrections.py +131 -0
  24. rewind_memory_pro-0.4.5/rewind/feedback/demotions.py +108 -0
  25. rewind_memory_pro-0.4.5/rewind/ingest.py +775 -0
  26. rewind_memory_pro-0.4.5/rewind/integrations/__init__.py +1 -0
  27. rewind_memory_pro-0.4.5/rewind/integrations/mcp_server.py +453 -0
  28. rewind_memory_pro-0.4.5/rewind/integrations/openclaw.py +312 -0
  29. rewind_memory_pro-0.4.5/rewind/integrations/openclaw_gateway.py +232 -0
  30. rewind_memory_pro-0.4.5/rewind/intelligence.py +382 -0
  31. rewind_memory_pro-0.4.5/rewind/intelligence_pro.py +275 -0
  32. rewind_memory_pro-0.4.5/rewind/layers/__init__.py +29 -0
  33. rewind_memory_pro-0.4.5/rewind/layers/l0_fts.py +178 -0
  34. rewind_memory_pro-0.4.5/rewind/layers/l1_system.py +143 -0
  35. rewind_memory_pro-0.4.5/rewind/layers/l2_orchestrator.py +295 -0
  36. rewind_memory_pro-0.4.5/rewind/layers/l3_graph.py +317 -0
  37. rewind_memory_pro-0.4.5/rewind/layers/l3_graph_sqlite.py +335 -0
  38. rewind_memory_pro-0.4.5/rewind/layers/l4_vector.py +198 -0
  39. rewind_memory_pro-0.4.5/rewind/layers/l5_comms.py +208 -0
  40. rewind_memory_pro-0.4.5/rewind/layers/l6_docs.py +576 -0
  41. rewind_memory_pro-0.4.5/rewind/migrate.py +662 -0
  42. rewind_memory_pro-0.4.5/rewind/session/__init__.py +10 -0
  43. rewind_memory_pro-0.4.5/rewind/session/continuity.py +203 -0
  44. rewind_memory_pro-0.4.5/rewind/session/extractor.py +249 -0
  45. rewind_memory_pro-0.4.5/rewind/utils.py +83 -0
  46. rewind_memory_pro-0.4.5/rewind_memory_pro.egg-info/PKG-INFO +359 -0
  47. rewind_memory_pro-0.4.5/rewind_memory_pro.egg-info/SOURCES.txt +54 -0
  48. rewind_memory_pro-0.4.5/rewind_memory_pro.egg-info/dependency_links.txt +1 -0
  49. rewind_memory_pro-0.4.5/rewind_memory_pro.egg-info/entry_points.txt +4 -0
  50. rewind_memory_pro-0.4.5/rewind_memory_pro.egg-info/requires.txt +31 -0
  51. rewind_memory_pro-0.4.5/rewind_memory_pro.egg-info/top_level.txt +1 -0
  52. rewind_memory_pro-0.4.5/setup.cfg +4 -0
  53. rewind_memory_pro-0.4.5/tests/test_feedback.py +121 -0
  54. rewind_memory_pro-0.4.5/tests/test_l0_fts.py +68 -0
  55. rewind_memory_pro-0.4.5/tests/test_l2_orchestrator.py +126 -0
  56. rewind_memory_pro-0.4.5/tests/test_modal_e2e.py +217 -0
@@ -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 2026 Engram 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,359 @@
1
+ Metadata-Version: 2.4
2
+ Name: rewind-memory-pro
3
+ Version: 0.4.5
4
+ Summary: 7-layer bio-inspired memory architecture for AI agents
5
+ Author-email: SARAI Defence <vova@saraidefence.com>
6
+ License: Proprietary
7
+ Keywords: memory,ai,agents,rag,bio-inspired
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: pyyaml>=6.0
19
+ Requires-Dist: httpx>=0.24
20
+ Provides-Extra: graph
21
+ Requires-Dist: neo4j>=5.0; extra == "graph"
22
+ Provides-Extra: vector
23
+ Requires-Dist: sqlite-vec>=0.0.1; extra == "vector"
24
+ Provides-Extra: comms
25
+ Requires-Dist: qdrant-client>=1.7; extra == "comms"
26
+ Provides-Extra: docs
27
+ Requires-Dist: sentence-transformers>=2.0; extra == "docs"
28
+ Provides-Extra: api
29
+ Requires-Dist: fastapi>=0.100; extra == "api"
30
+ Requires-Dist: uvicorn>=0.20; extra == "api"
31
+ Requires-Dist: pydantic>=2.0; extra == "api"
32
+ Requires-Dist: stripe>=7.0; extra == "api"
33
+ Provides-Extra: mcp
34
+ Requires-Dist: httpx>=0.24; extra == "mcp"
35
+ Provides-Extra: all
36
+ Requires-Dist: rewind-memory[api,comms,docs,graph,mcp,vector]; extra == "all"
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest>=7.0; extra == "dev"
39
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
40
+ Requires-Dist: ruff>=0.1; extra == "dev"
41
+ Dynamic: license-file
42
+
43
+ # Rewind Memory
44
+
45
+ **Persistent, bio-inspired memory for AI agents — local-first, production-ready.**
46
+
47
+ - Remembers everything across sessions: conversations, files, decisions, relationships
48
+ - Classifies memories by type (user, feedback, project, reference) with drift detection
49
+ - LLM-powered relevance selection + GPU cross-encoder reranking
50
+ - 7-layer architecture modelled on biological memory (sensory → STM → knowledge graph → documents)
51
+ - Ships as a Claude Code plugin — one command to set up, zero config to start
52
+ - Full 7-layer stack with cloud GPU endpoints (NV-Embed-v2, Graph-PReFLexOR, cross-encoder reranker)
53
+
54
+ ---
55
+
56
+ ## Architecture
57
+
58
+ ```
59
+ ┌──────────────────────────────────────────────────────┐
60
+ │ L2 Orchestrator │
61
+ │ fusion · ranking · entity extraction │
62
+ ├─────────┬─────────┬──────────┬──────────┬─────┬──────┤
63
+ │ L0 │ L1 │ L3 │ L4 │ L5 │ L6 │
64
+ │ Sensory │ STM │ Graph │Workspace │Comms│ Docs │
65
+ │ Buffer │(Vector) │ │ (Files) │ │ │
66
+ │ │ │ │ │ │ │
67
+ │FTS5/BM25│sqlite- │ SQLite / │sqlite- │Qdrant│Qdrant│
68
+ │ │ vec │ Neo4j │ vec │ │+FTS5 │
69
+ └─────────┴─────────┴──────────┴──────────┴─────┴──────┘
70
+ +
71
+ Bio Layer (Pro / Enterprise)
72
+ decay curves · consolidation · Hebbian weighting
73
+ ```
74
+
75
+ | Layer | Name | Bio analogue | Default backend |
76
+ |-------|------|--------------|-----------------|
77
+ | L0 | Sensory Buffer | Sensory cortex | SQLite FTS5 + BM25 |
78
+ | L1 | Short-Term Memory | Hippocampus | sqlite-vec |
79
+ | L2 | Orchestrator | Prefrontal cortex | In-process |
80
+ | L3 | Graph Memory | Association cortex | SQLite / Neo4j |
81
+ | L4 | Workspace | Working memory | sqlite-vec |
82
+ | L5 | Communications | Social memory | Qdrant |
83
+ | L6 | Documents | Declarative memory | Qdrant + FTS5 |
84
+
85
+ ---
86
+
87
+ ## Quick Start
88
+
89
+ ```bash
90
+ pip install git+https://github.com/saraidefence/rewind-memory-pro.git
91
+ ```
92
+
93
+ Then, inside Claude Code:
94
+
95
+ ```
96
+ /rewind-setup
97
+ ```
98
+
99
+ That's it. The command detects your environment, picks the best available
100
+ configuration, and writes `~/.rewind/config.yaml`.
101
+
102
+ ---
103
+
104
+ ## Tiers
105
+
106
+ | Feature | Free | Pro ($18/mo — $9 for early adopters) | Enterprise |
107
+ |---------|------|-------------|------------|
108
+ | **Memory Intelligence** | | | |
109
+ | Memory type taxonomy (user/feedback/project/reference) | ✅ | ✅ | ✅ |
110
+ | Recency weighting (type-aware decay) | ✅ | ✅ | ✅ |
111
+ | Query-intent matching | ✅ | ✅ | ✅ |
112
+ | Memory drift detection | ✅ | ✅ | ✅ |
113
+ | OpenClaw gateway autopatcher | ✅ | ✅ | ✅ |
114
+ | LLM relevance selection (side-query) | — | ✅ | ✅ |
115
+ | Cross-encoder reranking (GPU) | — | ✅ | ✅ |
116
+ | Memory extraction (post-turn auto) | — | ✅ | ✅ |
117
+ | Partial compaction | — | ✅ | ✅ |
118
+ | **Infrastructure** | | | |
119
+ | Embedding model | all-MiniLM-L6-v2 (768-dim, local) | NV-Embed-v2 (4096-dim, Modal cloud) | Custom |
120
+ | KG extraction | Heuristic (regex) or Ollama local | Graph-PReFLexOR on Modal T4 | Custom LLM |
121
+ | Reranking | Heuristic | Cross-encoder on Modal T4 | Custom |
122
+ | Batch extraction | No | Yes | Yes |
123
+ | Storage | Local SQLite | Local SQLite + Qdrant + Neo4j | Managed |
124
+ | API server | Self-hosted | Self-hosted + cloud relay | Managed |
125
+ | Support | Community | Email | SLA |
126
+
127
+ ---
128
+
129
+ ## Claude Code Plugin Setup
130
+
131
+ ### Install
132
+
133
+ ```bash
134
+ pip install git+https://github.com/saraidefence/rewind-memory-pro.git
135
+ git clone https://github.com/saraidefence/rewind-memory.git ~/.claude-plugins/rewind-memory
136
+ ```
137
+
138
+ ### Activate
139
+
140
+ ```bash
141
+ claude --plugin-dir ~/.claude-plugins/rewind-memory/plugin
142
+ ```
143
+
144
+ ### Initialise
145
+
146
+ ```
147
+ /rewind-setup
148
+ ```
149
+
150
+ ### Available commands
151
+
152
+ | Command | Description |
153
+ |---------|-------------|
154
+ | `/rewind-setup` | Detect environment and write config |
155
+ | `/remember <text>` | Store a note in memory |
156
+ | `/recall <query>` | Search all memory layers |
157
+ | `/rewind-status` | Show active layers and stats |
158
+
159
+ ---
160
+
161
+ ## Pro Setup
162
+
163
+ ### 1. Subscribe
164
+
165
+ Visit [saraidefence.com](https://www.saraidefence.com) and sign up for Pro from the dashboard.
166
+
167
+ After payment, you'll be invited as a collaborator to this repo.
168
+
169
+ ### 2. Install
170
+
171
+ ```bash
172
+ pip install git+https://github.com/saraidefence/rewind-memory-pro.git
173
+ ```
174
+
175
+ ### 3. Configure
176
+
177
+ Add the key to `~/.rewind/config.yaml`:
178
+
179
+ ```yaml
180
+ tier: pro
181
+ modal:
182
+ auth_token: rwnd_live_<your-key>
183
+ embedding:
184
+ provider: modal
185
+ model: nvidia/NV-Embed-v2
186
+ dim: 4096
187
+ kg:
188
+ provider: modal
189
+ model: graph-preflexor
190
+ ```
191
+
192
+ Or set it with the CLI:
193
+
194
+ ```bash
195
+ rewind config set tier pro
196
+ rewind config set modal.auth_token rwnd_live_<your-key>
197
+ ```
198
+
199
+ ### 4. Re-embed (if upgrading from Free)
200
+
201
+ If you have existing data from the free tier, re-embed your chunks through
202
+ NV-Embed-v2 for 4096-dim vectors:
203
+
204
+ ```bash
205
+ rewind migrate --reindex
206
+ ```
207
+
208
+ This reads your token from `config.yaml`. Progress is shown per batch.
209
+
210
+ ### 5. Verify
211
+
212
+ ```bash
213
+ rewind health
214
+ ```
215
+
216
+ ### Manage your subscription
217
+
218
+ ```
219
+ GET /portal?customer_id=<stripe-customer-id>
220
+ ```
221
+
222
+ Or visit your Stripe customer portal directly at [rewind.sh/portal](https://rewind.sh/portal).
223
+
224
+ ---
225
+
226
+ ## Configuration Reference
227
+
228
+ Full path: `~/.rewind/config.yaml`
229
+
230
+ ```yaml
231
+ # Tier: free | pro | enterprise
232
+ tier: free
233
+
234
+ # Data storage root
235
+ data_dir: ~/.rewind/data
236
+
237
+ embedding:
238
+ provider: local # local | modal
239
+ model: all-MiniLM-L6-v2 # or nvidia/NV-Embed-v2 for Pro
240
+ dim: 768 # 768 (free) | 4096 (pro)
241
+
242
+ kg:
243
+ provider: heuristic # heuristic | ollama | modal
244
+ model: null # e.g. saraidefence/graph-preflexor:latest
245
+
246
+ modal:
247
+ auth_token: null # rwnd_live_<key> — Pro/Enterprise only
248
+
249
+ # Optional: Neo4j backend for L3 (enterprise)
250
+ neo4j:
251
+ uri: bolt://localhost:7687
252
+ user: neo4j
253
+ password: null
254
+ ```
255
+
256
+ Config files for each tier live in `configs/`:
257
+
258
+ | File | Purpose |
259
+ |------|---------|
260
+ | `configs/free.yaml` | Default free tier |
261
+ | `configs/pro.yaml` | Pro cloud settings |
262
+ | `configs/enterprise.yaml` | Enterprise / self-managed |
263
+
264
+ ---
265
+
266
+ ## OpenClaw Integration
267
+
268
+ Route OpenClaw's `memory_search` through Rewind's full stack:
269
+
270
+ ```bash
271
+ # Configure memory_search to use Rewind
272
+ rewind-openclaw setup
273
+
274
+ # Patch the gateway for pre-turn memory injection (recommended)
275
+ # Every inbound message gets memory context BEFORE the LLM sees it
276
+ rewind-openclaw patch
277
+
278
+ # Verify / remove
279
+ rewind-openclaw patch --verify
280
+ rewind-openclaw patch --restore
281
+ ```
282
+
283
+ The pre-turn gate fires on every message, queries Rewind's HybridRAG proxy,
284
+ and prepends top results directly into the message. Zero extra tool calls needed.
285
+
286
+ > **Note:** Re-run `rewind-openclaw patch` after OpenClaw npm updates.
287
+
288
+ ---
289
+
290
+ ## API Reference (CLI)
291
+
292
+ ```
293
+ rewind init Initialise data directory
294
+ rewind health Check layer status
295
+ rewind ingest <path> Index files into memory
296
+ rewind search <query> Search across all layers
297
+ rewind recall <query> Alias for search
298
+ rewind remember <text> Store a manual note
299
+ rewind config get <key> Read a config value
300
+ rewind config set <key> <val> Write a config value
301
+ rewind upgrade Open Pro checkout
302
+ rewind migrate --reindex Re-embed all chunks (768→4096 for Pro)
303
+ rewind export Export memory to JSON
304
+ ```
305
+
306
+ ---
307
+
308
+ ## Self-Hosted (Docker)
309
+
310
+ ```bash
311
+ git clone https://github.com/saraidefence/rewind-memory.git
312
+ cd rewind-memory
313
+ docker compose -f docker/docker-compose.yml up -d
314
+ ```
315
+
316
+ The API server starts on `http://localhost:8080`.
317
+
318
+ Environment variables for the Stripe integration:
319
+
320
+ ```env
321
+ STRIPE_SECRET_KEY=sk_live_...
322
+ STRIPE_WEBHOOK_SECRET=whsec_...
323
+ STRIPE_PRO_PRICE_ID=price_...
324
+ REWIND_BASE_URL=https://your-domain.com
325
+ REWIND_DATA_DIR=/data
326
+ ```
327
+
328
+ Register the webhook endpoint in your Stripe dashboard:
329
+
330
+ ```
331
+ POST https://your-domain.com/stripe/webhook
332
+ ```
333
+
334
+ Events to enable:
335
+ - `checkout.session.completed`
336
+ - `customer.subscription.deleted`
337
+ - `invoice.payment_succeeded`
338
+
339
+ ---
340
+
341
+ ## Development
342
+
343
+ ```bash
344
+ git clone https://github.com/saraidefence/rewind-memory.git
345
+ cd rewind-memory
346
+ pip install -e ".[all]"
347
+ pip install stripe
348
+ pytest
349
+ ```
350
+
351
+ ---
352
+
353
+ ## Licence
354
+
355
+ MIT — see [LICENSE](LICENSE).
356
+
357
+ ---
358
+
359
+ *Built by [SARAI Defence](https://github.com/saraidefence). Not affiliated with Anthropic.*