Skip to main content

Brain-inspired, model-agnostic persistent memory for LLMs. Learn, recall, forget — like a brain. Works with OpenAI, Claude, Gemini, Llama.

Project description

CLS++

CLS++ — Continuous Learning System++

Switch AI models. Never lose context.

Quick StartArchitectureDocumentationDeploymentContributing

PyPI npm Python API License Patent


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

Install

pip install clsplusplus          # Python (lightweight: only httpx + pydantic)
npm install clsplusplus          # JavaScript / TypeScript (zero dependencies)

Python SDK

from clsplusplus import Brain

brain = Brain("alice")

# Teach it anything in natural language
brain.learn("I work at Google as a senior engineer")
brain.learn("I prefer Python over JavaScript")

# Ask it anything — semantic recall, not keyword matching
brain.ask("What's my job?")           # ["I work at Google as a senior engineer"]

# Get LLM-ready context for any prompt
brain.context("coding help")
# "Known facts about this user:\n- I work at Google..."

# Forget (GDPR right to be forgotten)
brain.forget("I work at Google as a senior engineer")

JavaScript / TypeScript SDK

import { Brain } from "clsplusplus";

const brain = new Brain("alice");

await brain.learn("I work at Google as a senior engineer");
const facts = await brain.ask("What's my job?");
const context = await brain.context("coding help");
await brain.forget("I work at Google as a senior engineer");

Use with OpenAI

from clsplusplus import Brain

brain = Brain("alice")

# Wrap any LLM function — auto-injects memory, auto-learns
@brain.wrap
def chat(system_prompt, user_message):
    return openai.chat(system=system_prompt, user=user_message)

response = chat("You are a helpful assistant", "Help me with Python")
# Brain auto-recalls relevant memory, injects into prompt,
# calls your LLM, learns from the exchange, returns response.

Full API

Method Description
brain.learn(fact) Teach a fact. Returns memory ID.
brain.ask(question) Query for relevant facts. Returns list.
brain.context(topic) Get LLM-ready context string.
brain.forget(fact) Forget by text or ID.
brain.absorb(text) Bulk-learn from document or conversation.
brain.who() Auto-generated user profile.
brain.correct(old, new) Update a belief.
brain.chat(message, llm) Full conversation handler with memory.
brain.teach(dict) Learn from structured data.
brain.watch(messages) Learn from chat message history.
brain.wrap(fn) Wrap any LLM function with auto-memory.

Run the Full Server Locally

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:create_app --factory --host 0.0.0.0 --port 8080

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 clickSetup guide
AWS Free Tier CloudFormationStep-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 LabsRajamohan 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

clsplusplus-7.0.0.tar.gz (413.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clsplusplus-7.0.0-py3-none-any.whl (228.2 kB view details)

Uploaded Python 3

File details

Details for the file clsplusplus-7.0.0.tar.gz.

File metadata

  • Download URL: clsplusplus-7.0.0.tar.gz
  • Upload date:
  • Size: 413.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for clsplusplus-7.0.0.tar.gz
Algorithm Hash digest
SHA256 3d3e25a964b3ee1a34362aaf6605100bbb74c1b7fd724402303e0e38b351d510
MD5 c689e57ce511c473923d91b28db93b39
BLAKE2b-256 b3d07b2b52d6ae36aa3eb81331521c12f49d98b3f88b8a661076eacfe449826e

See more details on using hashes here.

Provenance

The following attestation bundles were made for clsplusplus-7.0.0.tar.gz:

Publisher: publish-pypi.yml on rajamohan1950/CLSplusplus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clsplusplus-7.0.0-py3-none-any.whl.

File metadata

  • Download URL: clsplusplus-7.0.0-py3-none-any.whl
  • Upload date:
  • Size: 228.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for clsplusplus-7.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cfefa633a512a002ba07424f32dfac56a5bc1345af09ffd8f033a3fa3e7cc8ee
MD5 f336adf9c19e45b63e4ed3b71248dcaf
BLAKE2b-256 63507ff5cd989a334a2529fa7c7e31e6c0da3f4f2290f425b16b1a6cb3d54d5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for clsplusplus-7.0.0-py3-none-any.whl:

Publisher: publish-pypi.yml on rajamohan1950/CLSplusplus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page