Brain-inspired, model-agnostic persistent memory architecture for LLMs
Project description
CLS++ — Continuous Learning System++
Switch AI models. Never lose context.
Quick Start • Architecture • Documentation • Deployment • Contributing
What is CLS++?
Every LLM in production today operates with amnesia. Sessions end, context windows clear, and the model forgets everything—preferences, corrections, facts established over months.
CLS++ is an external memory substrate that solves this at its root. Drawing from neuroscientific Complementary Learning Systems (CLS) theory, it implements:
| Feature | Description |
|---|---|
| Four-store hierarchy | L0 (Working Buffer) → L1 (Indexing) → L2 (Schema Graph) → L3 (Deep Recess) |
| Biological consolidation | Salience, Usage, Authority, Conflict, Surprise signals |
| Sleep cycle | Nightly maintenance: rank, decay, deduplicate, consolidate |
| Reconsolidation gate | Belief revision only with evidence quorum |
| Model-agnostic | Any LLM plugs in via REST API—Claude, GPT-4, Gemini, Llama |
Memory is external to the model. Switch models anytime. No reset.
Quick Start
Option A: SDK Client Only (talk to a running CLS++ server)
pip install clsplusplus # lightweight: only httpx + pydantic
from clsplusplus import CLS
client = CLS(base_url="http://localhost:8080", api_key="your_api_key")
client.write("User prefers dark mode", namespace="user-123")
results = client.read("user preferences", namespace="user-123")
for item in results.items:
print(item.text, item.confidence)
Option B: Run the Full Server Locally
# Clone and install with server dependencies
git clone https://github.com/rajamohan1950/CLSplusplus.git
cd CLSplusplus
pip install -e ".[server]"
# Start infrastructure (Redis + PostgreSQL)
docker compose up -d redis postgres
# Start the API server
uvicorn clsplusplus.api:app --host 0.0.0.0 --port 8080
Create an API key
# Register an integration and get your API key
curl -X POST http://localhost:8080/v1/integrations \
-H "Content-Type: application/json" \
-d '{"name": "my-app", "namespace": "default"}'
# Response includes your API key (shown only once):
# {"id": "...", "keys": [{"key": "cls_live_xxxxxxxx", ...}], ...}
Write and read memories
# Write a memory
curl -X POST http://localhost:8080/v1/memory/write \
-H "Content-Type: application/json" \
-H "Authorization: Bearer cls_live_xxxxxxxx" \
-d '{"text": "User prefers dark mode", "namespace": "user-123"}'
# Read memories
curl -X POST http://localhost:8080/v1/memory/read \
-H "Content-Type: application/json" \
-H "Authorization: Bearer cls_live_xxxxxxxx" \
-d '{"query": "user preferences", "namespace": "user-123"}'
Python SDK (3-line integration)
from clsplusplus import CLS
client = CLS(base_url="http://localhost:8080", api_key="cls_live_xxxxxxxx")
client.memories.encode(content="User prefers dark mode", agent_id="a1")
results = client.memories.retrieve(query="user preferences", agent_id="a1")
Try It Live
Try the demo — Tell Claude something, ask OpenAI. Same memory. No sign-up.
Architecture
Client (any LLM) → POST /v1/memory/read (before inference)
↓
┌─────────────────────────┐
│ CLS++ Core Service │
│ L0: Working Buffer │ ← Prefrontal Cortex
│ L1: Indexing Store │ ← Hippocampus
│ L2: Schema Graph │ ← Neocortex
│ L3: Deep Recess │ ← Thalamus
│ Plasticity Engine │
│ Sleep Orchestrator │
└─────────────────────────┘
↓
POST /v1/memory/write (after inference)
SaaS Mode (Memory-as-a-Service)
Enable API key auth and rate limiting for production:
export CLS_API_KEYS=cls_live_xxxxxxxxxxxxxxxxxxxxxxxx
export CLS_REQUIRE_API_KEY=true
export CLS_RATE_LIMIT_REQUESTS=100
export CLS_RATE_LIMIT_WINDOW_SECONDS=60
Product endpoints: POST /v1/memories/encode, POST /v1/memories/retrieve, DELETE /v1/memories/forget, GET /v1/health/score. See SaaS docs.
Deployment
| Platform | Guide |
|---|---|
| Render (free tier) | Deploy in 1 click • Setup guide |
| AWS Free Tier | CloudFormation • Step-by-step |
| AWS | CloudFormation |
| Azure | ARM template |
Documentation
| Document | Description |
|---|---|
| API Reference | Endpoints, auth, examples |
| API Blueprint | SaaS API playbook (DX, security, billing) |
| SaaS Strategy | Memory-as-a-Service, pricing |
| Marketplace Integration | AWS, Azure, GCP, OCI |
| Productionization | Deployment, security, compliance |
| Commercialization | Go-to-market, licensing |
Status
Phase 1 (Foundation) — Complete
- Four stores (L0–L3) + Plasticity Engine
- Write/Read API + Python SDK
- Docker Compose + Render deploy
- Sleep cycle orchestrator
- Reconsolidation gate
- API key auth + rate limiting
- SaaS product endpoints
Contributing
We welcome contributions. See CONTRIBUTING.md and the Wiki for details.
License
Provisional patent filed October 2025. Apache 2.0 (see LICENSE).
AlphaForge AI Labs • Rajamohan Jabbala • 2026
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clsplusplus-4.0.0.tar.gz.
File metadata
- Download URL: clsplusplus-4.0.0.tar.gz
- Upload date:
- Size: 369.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31cf545409b08a24114837a1350e052a14027283ee066ce6b5fd754473ad1c32
|
|
| MD5 |
46aa9f191f3119316e2a6aeac61aad3d
|
|
| BLAKE2b-256 |
a2de6b3187ab725e1a94c177cc467de25301d1ed5b4f6430056b7e7d692f8fae
|
Provenance
The following attestation bundles were made for clsplusplus-4.0.0.tar.gz:
Publisher:
publish-pypi.yml on rajamohan1950/CLSplusplus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clsplusplus-4.0.0.tar.gz -
Subject digest:
31cf545409b08a24114837a1350e052a14027283ee066ce6b5fd754473ad1c32 - Sigstore transparency entry: 1243732608
- Sigstore integration time:
-
Permalink:
rajamohan1950/CLSplusplus@51a946205b55765e531cb6bb241670e75cc85e5e -
Branch / Tag:
refs/tags/v4.0.0 - Owner: https://github.com/rajamohan1950
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@51a946205b55765e531cb6bb241670e75cc85e5e -
Trigger Event:
push
-
Statement type:
File details
Details for the file clsplusplus-4.0.0-py3-none-any.whl.
File metadata
- Download URL: clsplusplus-4.0.0-py3-none-any.whl
- Upload date:
- Size: 202.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10f926fbd47d95bf9e32ebd62665e767f98ebba9ba4b2494de10148d8de9e1eb
|
|
| MD5 |
2892f3c07053500767820f3ec2d5338b
|
|
| BLAKE2b-256 |
67b875b5b8d031d0641166138c299dda9c5237b51a546996b7816818a5d13ccd
|
Provenance
The following attestation bundles were made for clsplusplus-4.0.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on rajamohan1950/CLSplusplus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clsplusplus-4.0.0-py3-none-any.whl -
Subject digest:
10f926fbd47d95bf9e32ebd62665e767f98ebba9ba4b2494de10148d8de9e1eb - Sigstore transparency entry: 1243732613
- Sigstore integration time:
-
Permalink:
rajamohan1950/CLSplusplus@51a946205b55765e531cb6bb241670e75cc85e5e -
Branch / Tag:
refs/tags/v4.0.0 - Owner: https://github.com/rajamohan1950
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@51a946205b55765e531cb6bb241670e75cc85e5e -
Trigger Event:
push
-
Statement type: