clsplusplus 4.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. clsplusplus-4.0.0/LICENSE +201 -0
  2. clsplusplus-4.0.0/PKG-INFO +262 -0
  3. clsplusplus-4.0.0/README.md +211 -0
  4. clsplusplus-4.0.0/pyproject.toml +83 -0
  5. clsplusplus-4.0.0/setup.cfg +4 -0
  6. clsplusplus-4.0.0/src/clsplusplus/__init__.py +31 -0
  7. clsplusplus-4.0.0/src/clsplusplus/api.py +1596 -0
  8. clsplusplus-4.0.0/src/clsplusplus/auth.py +74 -0
  9. clsplusplus-4.0.0/src/clsplusplus/cli.py +715 -0
  10. clsplusplus-4.0.0/src/clsplusplus/client.py +462 -0
  11. clsplusplus-4.0.0/src/clsplusplus/config.py +116 -0
  12. clsplusplus-4.0.0/src/clsplusplus/cost_model.py +51 -0
  13. clsplusplus-4.0.0/src/clsplusplus/demo_llm.py +133 -0
  14. clsplusplus-4.0.0/src/clsplusplus/demo_llm_calls.py +100 -0
  15. clsplusplus-4.0.0/src/clsplusplus/demo_local.py +515 -0
  16. clsplusplus-4.0.0/src/clsplusplus/embeddings.py +52 -0
  17. clsplusplus-4.0.0/src/clsplusplus/idempotency.py +66 -0
  18. clsplusplus-4.0.0/src/clsplusplus/integration_service.py +256 -0
  19. clsplusplus-4.0.0/src/clsplusplus/jwt_utils.py +39 -0
  20. clsplusplus-4.0.0/src/clsplusplus/local_routes.py +781 -0
  21. clsplusplus-4.0.0/src/clsplusplus/main.py +21 -0
  22. clsplusplus-4.0.0/src/clsplusplus/memory_cycle.py +216 -0
  23. clsplusplus-4.0.0/src/clsplusplus/memory_phase.py +3541 -0
  24. clsplusplus-4.0.0/src/clsplusplus/memory_service.py +1323 -0
  25. clsplusplus-4.0.0/src/clsplusplus/metrics.py +184 -0
  26. clsplusplus-4.0.0/src/clsplusplus/middleware.py +325 -0
  27. clsplusplus-4.0.0/src/clsplusplus/models.py +430 -0
  28. clsplusplus-4.0.0/src/clsplusplus/permissions.py +54 -0
  29. clsplusplus-4.0.0/src/clsplusplus/plasticity.py +148 -0
  30. clsplusplus-4.0.0/src/clsplusplus/rate_limit.py +53 -0
  31. clsplusplus-4.0.0/src/clsplusplus/rbac_service.py +86 -0
  32. clsplusplus-4.0.0/src/clsplusplus/reconsolidation.py +71 -0
  33. clsplusplus-4.0.0/src/clsplusplus/sleep_cycle.py +109 -0
  34. clsplusplus-4.0.0/src/clsplusplus/stores/__init__.py +13 -0
  35. clsplusplus-4.0.0/src/clsplusplus/stores/base.py +43 -0
  36. clsplusplus-4.0.0/src/clsplusplus/stores/integration_store.py +648 -0
  37. clsplusplus-4.0.0/src/clsplusplus/stores/l0_working_buffer.py +103 -0
  38. clsplusplus-4.0.0/src/clsplusplus/stores/l1_indexing_store.py +427 -0
  39. clsplusplus-4.0.0/src/clsplusplus/stores/l2_schema_graph.py +231 -0
  40. clsplusplus-4.0.0/src/clsplusplus/stores/l3_deep_recess.py +182 -0
  41. clsplusplus-4.0.0/src/clsplusplus/stores/l3_postgres.py +183 -0
  42. clsplusplus-4.0.0/src/clsplusplus/stores/rbac_store.py +327 -0
  43. clsplusplus-4.0.0/src/clsplusplus/stores/user_store.py +255 -0
  44. clsplusplus-4.0.0/src/clsplusplus/stripe_service.py +136 -0
  45. clsplusplus-4.0.0/src/clsplusplus/temporal.py +613 -0
  46. clsplusplus-4.0.0/src/clsplusplus/test_suite.py +587 -0
  47. clsplusplus-4.0.0/src/clsplusplus/tiers.py +109 -0
  48. clsplusplus-4.0.0/src/clsplusplus/tracer.py +226 -0
  49. clsplusplus-4.0.0/src/clsplusplus/usage.py +130 -0
  50. clsplusplus-4.0.0/src/clsplusplus/user_embeddings.py +1636 -0
  51. clsplusplus-4.0.0/src/clsplusplus/user_service.py +256 -0
  52. clsplusplus-4.0.0/src/clsplusplus/webhook_dispatcher.py +229 -0
  53. clsplusplus-4.0.0/src/clsplusplus.egg-info/PKG-INFO +262 -0
  54. clsplusplus-4.0.0/src/clsplusplus.egg-info/SOURCES.txt +86 -0
  55. clsplusplus-4.0.0/src/clsplusplus.egg-info/dependency_links.txt +1 -0
  56. clsplusplus-4.0.0/src/clsplusplus.egg-info/entry_points.txt +2 -0
  57. clsplusplus-4.0.0/src/clsplusplus.egg-info/requires.txt +27 -0
  58. clsplusplus-4.0.0/src/clsplusplus.egg-info/top_level.txt +1 -0
  59. clsplusplus-4.0.0/tests/test_admin.py +171 -0
  60. clsplusplus-4.0.0/tests/test_api.py +47 -0
  61. clsplusplus-4.0.0/tests/test_api_comprehensive.py +361 -0
  62. clsplusplus-4.0.0/tests/test_api_endpoints.py +713 -0
  63. clsplusplus-4.0.0/tests/test_auth.py +294 -0
  64. clsplusplus-4.0.0/tests/test_client_sdk.py +224 -0
  65. clsplusplus-4.0.0/tests/test_config.py +148 -0
  66. clsplusplus-4.0.0/tests/test_demo_llm.py +165 -0
  67. clsplusplus-4.0.0/tests/test_embeddings.py +273 -0
  68. clsplusplus-4.0.0/tests/test_idempotency.py +188 -0
  69. clsplusplus-4.0.0/tests/test_integration_service.py +742 -0
  70. clsplusplus-4.0.0/tests/test_memory_cycle.py +261 -0
  71. clsplusplus-4.0.0/tests/test_memory_phase.py +16530 -0
  72. clsplusplus-4.0.0/tests/test_memory_service.py +255 -0
  73. clsplusplus-4.0.0/tests/test_middleware.py +207 -0
  74. clsplusplus-4.0.0/tests/test_models.py +429 -0
  75. clsplusplus-4.0.0/tests/test_performance.py +267 -0
  76. clsplusplus-4.0.0/tests/test_plasticity.py +294 -0
  77. clsplusplus-4.0.0/tests/test_prototype_e2e.py +150 -0
  78. clsplusplus-4.0.0/tests/test_rate_limit.py +105 -0
  79. clsplusplus-4.0.0/tests/test_reconsolidation.py +208 -0
  80. clsplusplus-4.0.0/tests/test_regression.py +352 -0
  81. clsplusplus-4.0.0/tests/test_security.py +317 -0
  82. clsplusplus-4.0.0/tests/test_sleep_cycle.py +251 -0
  83. clsplusplus-4.0.0/tests/test_stores.py +187 -0
  84. clsplusplus-4.0.0/tests/test_tiers.py +211 -0
  85. clsplusplus-4.0.0/tests/test_usage.py +146 -0
  86. clsplusplus-4.0.0/tests/test_user_auth.py +292 -0
  87. clsplusplus-4.0.0/tests/test_user_embeddings.py +1131 -0
  88. clsplusplus-4.0.0/tests/test_webhook_dispatcher.py +319 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to, the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 AlphaForge AI Labs
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,262 @@
1
+ Metadata-Version: 2.4
2
+ Name: clsplusplus
3
+ Version: 4.0.0
4
+ Summary: Brain-inspired, model-agnostic persistent memory architecture for LLMs
5
+ Author-email: AlphaForge AI Labs <contact@alphaforge.ai>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/rajamohan1950/CLSplusplus
8
+ Project-URL: Documentation, https://github.com/rajamohan1950/CLSplusplus/wiki
9
+ Project-URL: Repository, https://github.com/rajamohan1950/CLSplusplus
10
+ Project-URL: Bug Tracker, https://github.com/rajamohan1950/CLSplusplus/issues
11
+ Project-URL: Changelog, https://github.com/rajamohan1950/CLSplusplus/releases
12
+ Keywords: llm,memory,ai,cls,continuous-learning,langchain,persistent-memory,model-agnostic
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.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: httpx>=0.26.0
26
+ Requires-Dist: pydantic>=2.5.0
27
+ Provides-Extra: server
28
+ Requires-Dist: fastapi>=0.109.0; extra == "server"
29
+ Requires-Dist: uvicorn[standard]>=0.27.0; extra == "server"
30
+ Requires-Dist: redis>=5.0.0; extra == "server"
31
+ Requires-Dist: asyncpg>=0.29.0; extra == "server"
32
+ Requires-Dist: pgvector>=0.2.4; extra == "server"
33
+ Requires-Dist: sentence-transformers>=2.2.0; extra == "server"
34
+ Requires-Dist: numpy>=1.24.0; extra == "server"
35
+ Requires-Dist: pydantic-settings>=2.1.0; extra == "server"
36
+ Requires-Dist: python-multipart>=0.0.6; extra == "server"
37
+ Requires-Dist: structlog>=24.1.0; extra == "server"
38
+ Requires-Dist: apscheduler>=3.10.0; extra == "server"
39
+ Requires-Dist: PyJWT>=2.8.0; extra == "server"
40
+ Requires-Dist: bcrypt>=4.1.0; extra == "server"
41
+ Requires-Dist: stripe>=7.0.0; extra == "server"
42
+ Requires-Dist: minio>=7.2.0; extra == "server"
43
+ Requires-Dist: pyarrow>=14.0.0; extra == "server"
44
+ Provides-Extra: dev
45
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
46
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
47
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
48
+ Requires-Dist: pytest-timeout>=2.2.0; extra == "dev"
49
+ Requires-Dist: httpx>=0.26.0; extra == "dev"
50
+ Dynamic: license-file
51
+
52
+ <p align="center">
53
+ <img src="https://img.shields.io/badge/CLS%2B%2B-Memory%20for%20LLMs-6366f1?style=for-the-badge&logo=github" alt="CLS++" />
54
+ </p>
55
+
56
+ <h1 align="center">CLS++ — Continuous Learning System++</h1>
57
+ <p align="center">
58
+ <strong>Switch AI models. Never lose context.</strong>
59
+ </p>
60
+
61
+ <p align="center">
62
+ <a href="#-quick-start">Quick Start</a> •
63
+ <a href="#-architecture">Architecture</a> •
64
+ <a href="#-documentation">Documentation</a> •
65
+ <a href="#-deployment">Deployment</a> •
66
+ <a href="#-contributing">Contributing</a>
67
+ </p>
68
+
69
+ <p align="center">
70
+ <a href="https://render.com/deploy?repo=https://github.com/rajamohan1950/CLSplusplus"><img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render" height="32" /></a>
71
+ <a href="https://www.clsplusplus.com/docs"><img src="https://img.shields.io/badge/API-Live-22c55e?style=flat-square" alt="API" /></a>
72
+ <a href="https://github.com/rajamohan1950/CLSplusplus/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue?style=flat-square" alt="License" /></a>
73
+ <a href="https://github.com/rajamohan1950/CLSplusplus"><img src="https://img.shields.io/badge/Patent-Oct%202025-blue?style=flat-square" alt="Patent" /></a>
74
+ </p>
75
+
76
+ ---
77
+
78
+ ## What is CLS++?
79
+
80
+ Every LLM in production today operates with **amnesia**. Sessions end, context windows clear, and the model forgets everything—preferences, corrections, facts established over months.
81
+
82
+ **CLS++** is an external memory substrate that solves this at its root. Drawing from neuroscientific [Complementary Learning Systems (CLS)](https://en.wikipedia.org/wiki/Complementary_learning_systems) theory, it implements:
83
+
84
+ | Feature | Description |
85
+ |---------|-------------|
86
+ | **Four-store hierarchy** | L0 (Working Buffer) → L1 (Indexing) → L2 (Schema Graph) → L3 (Deep Recess) |
87
+ | **Biological consolidation** | Salience, Usage, Authority, Conflict, Surprise signals |
88
+ | **Sleep cycle** | Nightly maintenance: rank, decay, deduplicate, consolidate |
89
+ | **Reconsolidation gate** | Belief revision only with evidence quorum |
90
+ | **Model-agnostic** | Any LLM plugs in via REST API—Claude, GPT-4, Gemini, Llama |
91
+
92
+ Memory is **external** to the model. **Switch models anytime.** No reset.
93
+
94
+ ---
95
+
96
+ ## Quick Start
97
+
98
+ ### Option A: SDK Client Only (talk to a running CLS++ server)
99
+
100
+ ```bash
101
+ pip install clsplusplus # lightweight: only httpx + pydantic
102
+ ```
103
+
104
+ ```python
105
+ from clsplusplus import CLS
106
+
107
+ client = CLS(base_url="http://localhost:8080", api_key="your_api_key")
108
+ client.write("User prefers dark mode", namespace="user-123")
109
+ results = client.read("user preferences", namespace="user-123")
110
+ for item in results.items:
111
+ print(item.text, item.confidence)
112
+ ```
113
+
114
+ ### Option B: Run the Full Server Locally
115
+
116
+ ```bash
117
+ # Clone and install with server dependencies
118
+ git clone https://github.com/rajamohan1950/CLSplusplus.git
119
+ cd CLSplusplus
120
+ pip install -e ".[server]"
121
+
122
+ # Start infrastructure (Redis + PostgreSQL)
123
+ docker compose up -d redis postgres
124
+
125
+ # Start the API server
126
+ uvicorn clsplusplus.api:app --host 0.0.0.0 --port 8080
127
+ ```
128
+
129
+ #### Create an API key
130
+
131
+ ```bash
132
+ # Register an integration and get your API key
133
+ curl -X POST http://localhost:8080/v1/integrations \
134
+ -H "Content-Type: application/json" \
135
+ -d '{"name": "my-app", "namespace": "default"}'
136
+
137
+ # Response includes your API key (shown only once):
138
+ # {"id": "...", "keys": [{"key": "cls_live_xxxxxxxx", ...}], ...}
139
+ ```
140
+
141
+ #### Write and read memories
142
+
143
+ ```bash
144
+ # Write a memory
145
+ curl -X POST http://localhost:8080/v1/memory/write \
146
+ -H "Content-Type: application/json" \
147
+ -H "Authorization: Bearer cls_live_xxxxxxxx" \
148
+ -d '{"text": "User prefers dark mode", "namespace": "user-123"}'
149
+
150
+ # Read memories
151
+ curl -X POST http://localhost:8080/v1/memory/read \
152
+ -H "Content-Type: application/json" \
153
+ -H "Authorization: Bearer cls_live_xxxxxxxx" \
154
+ -d '{"query": "user preferences", "namespace": "user-123"}'
155
+ ```
156
+
157
+ #### Python SDK (3-line integration)
158
+
159
+ ```python
160
+ from clsplusplus import CLS
161
+
162
+ client = CLS(base_url="http://localhost:8080", api_key="cls_live_xxxxxxxx")
163
+ client.memories.encode(content="User prefers dark mode", agent_id="a1")
164
+ results = client.memories.retrieve(query="user preferences", agent_id="a1")
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Try It Live
170
+
171
+ **[Try the demo](https://clsplusplus.onrender.com)** — Tell Claude something, ask OpenAI. Same memory. No sign-up.
172
+
173
+ ---
174
+
175
+ ## Architecture
176
+
177
+ ```
178
+ Client (any LLM) → POST /v1/memory/read (before inference)
179
+
180
+ ┌─────────────────────────┐
181
+ │ CLS++ Core Service │
182
+ │ L0: Working Buffer │ ← Prefrontal Cortex
183
+ │ L1: Indexing Store │ ← Hippocampus
184
+ │ L2: Schema Graph │ ← Neocortex
185
+ │ L3: Deep Recess │ ← Thalamus
186
+ │ Plasticity Engine │
187
+ │ Sleep Orchestrator │
188
+ └─────────────────────────┘
189
+
190
+ POST /v1/memory/write (after inference)
191
+ ```
192
+
193
+ ---
194
+
195
+ ## SaaS Mode (Memory-as-a-Service)
196
+
197
+ Enable API key auth and rate limiting for production:
198
+
199
+ ```bash
200
+ export CLS_API_KEYS=cls_live_xxxxxxxxxxxxxxxxxxxxxxxx
201
+ export CLS_REQUIRE_API_KEY=true
202
+ export CLS_RATE_LIMIT_REQUESTS=100
203
+ export CLS_RATE_LIMIT_WINDOW_SECONDS=60
204
+ ```
205
+
206
+ Product endpoints: `POST /v1/memories/encode`, `POST /v1/memories/retrieve`, `DELETE /v1/memories/forget`, `GET /v1/health/score`. See [SaaS docs](docs/SAAS_MEMORY_AS_SERVICE.md).
207
+
208
+ ---
209
+
210
+ ## Deployment
211
+
212
+ | Platform | Guide |
213
+ |----------|-------|
214
+ | **Render** (free tier) | [Deploy in 1 click](https://render.com/deploy?repo=https://github.com/rajamohan1950/CLSplusplus) • [Setup guide](docs/DEPLOY_RENDER.md) |
215
+ | **AWS Free Tier** | [CloudFormation](infrastructure/aws/cloudformation-free-tier.yaml) • [Step-by-step](infrastructure/aws/FREE_TIER_GUIDE.md) |
216
+ | **AWS** | [CloudFormation](infrastructure/aws/cloudformation.yaml) |
217
+ | **Azure** | [ARM template](infrastructure/azure/arm-template.json) |
218
+
219
+ ---
220
+
221
+ ## Documentation
222
+
223
+ | Document | Description |
224
+ |----------|-------------|
225
+ | [API Reference](docs/API_DOCUMENTATION.md) | Endpoints, auth, examples |
226
+ | [API Blueprint](docs/API_BLUEPRINT.md) | SaaS API playbook (DX, security, billing) |
227
+ | [SaaS Strategy](docs/SAAS_MEMORY_AS_SERVICE.md) | Memory-as-a-Service, pricing |
228
+ | [Marketplace Integration](docs/MARKETPLACE_INTEGRATION.md) | AWS, Azure, GCP, OCI |
229
+ | [Productionization](docs/PRODUCTIONIZATION_ROADMAP.md) | Deployment, security, compliance |
230
+ | [Commercialization](docs/COMMERCIALIZATION_STRATEGY.md) | Go-to-market, licensing |
231
+
232
+ ---
233
+
234
+ ## Status
235
+
236
+ **Phase 1 (Foundation)** — Complete
237
+
238
+ - [x] Four stores (L0–L3) + Plasticity Engine
239
+ - [x] Write/Read API + Python SDK
240
+ - [x] Docker Compose + Render deploy
241
+ - [x] Sleep cycle orchestrator
242
+ - [x] Reconsolidation gate
243
+ - [x] API key auth + rate limiting
244
+ - [x] SaaS product endpoints
245
+
246
+ ---
247
+
248
+ ## Contributing
249
+
250
+ We welcome contributions. See [CONTRIBUTING.md](.github/CONTRIBUTING.md) and the [Wiki](https://github.com/rajamohan1950/CLSplusplus/wiki) for details.
251
+
252
+ ---
253
+
254
+ ## License
255
+
256
+ Provisional patent filed October 2025. Apache 2.0 (see [LICENSE](LICENSE)).
257
+
258
+ ---
259
+
260
+ <p align="center">
261
+ <strong>AlphaForge AI Labs</strong> • <a href="https://github.com/rajamohan1950">Rajamohan Jabbala</a> • 2026
262
+ </p>
@@ -0,0 +1,211 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/CLS%2B%2B-Memory%20for%20LLMs-6366f1?style=for-the-badge&logo=github" alt="CLS++" />
3
+ </p>
4
+
5
+ <h1 align="center">CLS++ — Continuous Learning System++</h1>
6
+ <p align="center">
7
+ <strong>Switch AI models. Never lose context.</strong>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="#-quick-start">Quick Start</a> •
12
+ <a href="#-architecture">Architecture</a> •
13
+ <a href="#-documentation">Documentation</a> •
14
+ <a href="#-deployment">Deployment</a> •
15
+ <a href="#-contributing">Contributing</a>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://render.com/deploy?repo=https://github.com/rajamohan1950/CLSplusplus"><img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render" height="32" /></a>
20
+ <a href="https://www.clsplusplus.com/docs"><img src="https://img.shields.io/badge/API-Live-22c55e?style=flat-square" alt="API" /></a>
21
+ <a href="https://github.com/rajamohan1950/CLSplusplus/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue?style=flat-square" alt="License" /></a>
22
+ <a href="https://github.com/rajamohan1950/CLSplusplus"><img src="https://img.shields.io/badge/Patent-Oct%202025-blue?style=flat-square" alt="Patent" /></a>
23
+ </p>
24
+
25
+ ---
26
+
27
+ ## What is CLS++?
28
+
29
+ Every LLM in production today operates with **amnesia**. Sessions end, context windows clear, and the model forgets everything—preferences, corrections, facts established over months.
30
+
31
+ **CLS++** is an external memory substrate that solves this at its root. Drawing from neuroscientific [Complementary Learning Systems (CLS)](https://en.wikipedia.org/wiki/Complementary_learning_systems) theory, it implements:
32
+
33
+ | Feature | Description |
34
+ |---------|-------------|
35
+ | **Four-store hierarchy** | L0 (Working Buffer) → L1 (Indexing) → L2 (Schema Graph) → L3 (Deep Recess) |
36
+ | **Biological consolidation** | Salience, Usage, Authority, Conflict, Surprise signals |
37
+ | **Sleep cycle** | Nightly maintenance: rank, decay, deduplicate, consolidate |
38
+ | **Reconsolidation gate** | Belief revision only with evidence quorum |
39
+ | **Model-agnostic** | Any LLM plugs in via REST API—Claude, GPT-4, Gemini, Llama |
40
+
41
+ Memory is **external** to the model. **Switch models anytime.** No reset.
42
+
43
+ ---
44
+
45
+ ## Quick Start
46
+
47
+ ### Option A: SDK Client Only (talk to a running CLS++ server)
48
+
49
+ ```bash
50
+ pip install clsplusplus # lightweight: only httpx + pydantic
51
+ ```
52
+
53
+ ```python
54
+ from clsplusplus import CLS
55
+
56
+ client = CLS(base_url="http://localhost:8080", api_key="your_api_key")
57
+ client.write("User prefers dark mode", namespace="user-123")
58
+ results = client.read("user preferences", namespace="user-123")
59
+ for item in results.items:
60
+ print(item.text, item.confidence)
61
+ ```
62
+
63
+ ### Option B: Run the Full Server Locally
64
+
65
+ ```bash
66
+ # Clone and install with server dependencies
67
+ git clone https://github.com/rajamohan1950/CLSplusplus.git
68
+ cd CLSplusplus
69
+ pip install -e ".[server]"
70
+
71
+ # Start infrastructure (Redis + PostgreSQL)
72
+ docker compose up -d redis postgres
73
+
74
+ # Start the API server
75
+ uvicorn clsplusplus.api:app --host 0.0.0.0 --port 8080
76
+ ```
77
+
78
+ #### Create an API key
79
+
80
+ ```bash
81
+ # Register an integration and get your API key
82
+ curl -X POST http://localhost:8080/v1/integrations \
83
+ -H "Content-Type: application/json" \
84
+ -d '{"name": "my-app", "namespace": "default"}'
85
+
86
+ # Response includes your API key (shown only once):
87
+ # {"id": "...", "keys": [{"key": "cls_live_xxxxxxxx", ...}], ...}
88
+ ```
89
+
90
+ #### Write and read memories
91
+
92
+ ```bash
93
+ # Write a memory
94
+ curl -X POST http://localhost:8080/v1/memory/write \
95
+ -H "Content-Type: application/json" \
96
+ -H "Authorization: Bearer cls_live_xxxxxxxx" \
97
+ -d '{"text": "User prefers dark mode", "namespace": "user-123"}'
98
+
99
+ # Read memories
100
+ curl -X POST http://localhost:8080/v1/memory/read \
101
+ -H "Content-Type: application/json" \
102
+ -H "Authorization: Bearer cls_live_xxxxxxxx" \
103
+ -d '{"query": "user preferences", "namespace": "user-123"}'
104
+ ```
105
+
106
+ #### Python SDK (3-line integration)
107
+
108
+ ```python
109
+ from clsplusplus import CLS
110
+
111
+ client = CLS(base_url="http://localhost:8080", api_key="cls_live_xxxxxxxx")
112
+ client.memories.encode(content="User prefers dark mode", agent_id="a1")
113
+ results = client.memories.retrieve(query="user preferences", agent_id="a1")
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Try It Live
119
+
120
+ **[Try the demo](https://clsplusplus.onrender.com)** — Tell Claude something, ask OpenAI. Same memory. No sign-up.
121
+
122
+ ---
123
+
124
+ ## Architecture
125
+
126
+ ```
127
+ Client (any LLM) → POST /v1/memory/read (before inference)
128
+
129
+ ┌─────────────────────────┐
130
+ │ CLS++ Core Service │
131
+ │ L0: Working Buffer │ ← Prefrontal Cortex
132
+ │ L1: Indexing Store │ ← Hippocampus
133
+ │ L2: Schema Graph │ ← Neocortex
134
+ │ L3: Deep Recess │ ← Thalamus
135
+ │ Plasticity Engine │
136
+ │ Sleep Orchestrator │
137
+ └─────────────────────────┘
138
+
139
+ POST /v1/memory/write (after inference)
140
+ ```
141
+
142
+ ---
143
+
144
+ ## SaaS Mode (Memory-as-a-Service)
145
+
146
+ Enable API key auth and rate limiting for production:
147
+
148
+ ```bash
149
+ export CLS_API_KEYS=cls_live_xxxxxxxxxxxxxxxxxxxxxxxx
150
+ export CLS_REQUIRE_API_KEY=true
151
+ export CLS_RATE_LIMIT_REQUESTS=100
152
+ export CLS_RATE_LIMIT_WINDOW_SECONDS=60
153
+ ```
154
+
155
+ Product endpoints: `POST /v1/memories/encode`, `POST /v1/memories/retrieve`, `DELETE /v1/memories/forget`, `GET /v1/health/score`. See [SaaS docs](docs/SAAS_MEMORY_AS_SERVICE.md).
156
+
157
+ ---
158
+
159
+ ## Deployment
160
+
161
+ | Platform | Guide |
162
+ |----------|-------|
163
+ | **Render** (free tier) | [Deploy in 1 click](https://render.com/deploy?repo=https://github.com/rajamohan1950/CLSplusplus) • [Setup guide](docs/DEPLOY_RENDER.md) |
164
+ | **AWS Free Tier** | [CloudFormation](infrastructure/aws/cloudformation-free-tier.yaml) • [Step-by-step](infrastructure/aws/FREE_TIER_GUIDE.md) |
165
+ | **AWS** | [CloudFormation](infrastructure/aws/cloudformation.yaml) |
166
+ | **Azure** | [ARM template](infrastructure/azure/arm-template.json) |
167
+
168
+ ---
169
+
170
+ ## Documentation
171
+
172
+ | Document | Description |
173
+ |----------|-------------|
174
+ | [API Reference](docs/API_DOCUMENTATION.md) | Endpoints, auth, examples |
175
+ | [API Blueprint](docs/API_BLUEPRINT.md) | SaaS API playbook (DX, security, billing) |
176
+ | [SaaS Strategy](docs/SAAS_MEMORY_AS_SERVICE.md) | Memory-as-a-Service, pricing |
177
+ | [Marketplace Integration](docs/MARKETPLACE_INTEGRATION.md) | AWS, Azure, GCP, OCI |
178
+ | [Productionization](docs/PRODUCTIONIZATION_ROADMAP.md) | Deployment, security, compliance |
179
+ | [Commercialization](docs/COMMERCIALIZATION_STRATEGY.md) | Go-to-market, licensing |
180
+
181
+ ---
182
+
183
+ ## Status
184
+
185
+ **Phase 1 (Foundation)** — Complete
186
+
187
+ - [x] Four stores (L0–L3) + Plasticity Engine
188
+ - [x] Write/Read API + Python SDK
189
+ - [x] Docker Compose + Render deploy
190
+ - [x] Sleep cycle orchestrator
191
+ - [x] Reconsolidation gate
192
+ - [x] API key auth + rate limiting
193
+ - [x] SaaS product endpoints
194
+
195
+ ---
196
+
197
+ ## Contributing
198
+
199
+ We welcome contributions. See [CONTRIBUTING.md](.github/CONTRIBUTING.md) and the [Wiki](https://github.com/rajamohan1950/CLSplusplus/wiki) for details.
200
+
201
+ ---
202
+
203
+ ## License
204
+
205
+ Provisional patent filed October 2025. Apache 2.0 (see [LICENSE](LICENSE)).
206
+
207
+ ---
208
+
209
+ <p align="center">
210
+ <strong>AlphaForge AI Labs</strong> • <a href="https://github.com/rajamohan1950">Rajamohan Jabbala</a> • 2026
211
+ </p>