Always-On Memory Service with Progressive Disclosure (L0/L1/L2) and Weighted Retrieval
Project description
cortex-mem
Always-On Memory Service with Progressive Disclosure (L0/L1/L2) and Weighted Retrieval.
Installation
pip install cortex-mem
Or from source:
git clone https://github.com/dhawalc/cortex-mem.git
cd cortex-mem
pip install -e .
Quick Start (30 seconds)
# Start service
cortex-mem start --daemon
# Check status
cortex-mem status
# Search memory
cortex-mem search "deployment"
# Stop service
cortex-mem stop
OpenClaw Integration
cortex-mem auto-configures OpenClaw on install. No manual setup needed.
from cortex_mem.openclaw_provider import CortexMemProvider
async with CortexMemProvider() as mem:
await mem.log("achievement", "Task completed", "Successfully shipped v1")
results = await mem.search("deployment strategies")
Features
- Weighted Memory — Important memories surface automatically via reinforcement learning
- Progressive Disclosure — 98% token reduction with L0/L1/L2 tiered retrieval
- 4-Tier Architecture — Episodic, Semantic, Procedural, and Working memory
- Cortex Engine — Smart query with auto-escalation across disclosure levels
- HTTP API — Simple REST endpoints for any language / agent framework
API
| Endpoint | Method | Description |
|---|---|---|
/memory/{tier} |
POST | Write a memory entry |
/memory/search |
POST | Keyword search with weighted scoring |
/memory/browse/{path} |
GET | Browse module tree |
/memory/weight |
POST | Adjust entry weight (reinforcement) |
/cortex/query |
POST | Smart query with L0/L1/L2 escalation |
/cortex/documents |
GET | List indexed documents |
/health |
GET | Service health check |
CLI
cortex-mem start [--port 9100] [--daemon] Start service
cortex-mem stop Stop service
cortex-mem status Health check
cortex-mem search QUERY [--limit 5] Search memory
cortex-mem migrate SOURCE Import workspace data
Architecture
cortex-mem/
├── cortex_mem/ # Python package + CLI
│ ├── cli.py # Click CLI entry point
│ ├── openclaw_plugin.py
│ └── openclaw_provider.py
├── service/ # FastAPI application
│ ├── api.py # Endpoints
│ ├── storage.py # JSONL engine + weighted scoring
│ ├── models.py # Pydantic schemas
│ └── client.py # Async HTTP client
├── cortex/ # Progressive disclosure engine
│ ├── tiered_retrieval.py # L0/L1/L2 query
│ ├── tier_generator.py # Document ingestion
│ └── db.py # SQLite metadata
├── modules/ # Module tree (JSONL data)
│ ├── memory/
│ │ ├── episodic/ # experiences, decisions, failures
│ │ ├── semantic/ # facts, relations
│ │ └── procedural/ # skills, patterns
│ ├── identity/ # Persona, values
│ ├── operations/ # Workflows
│ └── research/ # Papers, notes
├── schemas/ # JSONL schema definitions
├── setup.py
├── pyproject.toml
├── Dockerfile
└── run.py # Direct entry point
Docker
docker build -t cortex-mem .
docker run -p 9100:9100 cortex-mem
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cortex_mem-1.0.0.tar.gz
(24.4 kB
view details)
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 cortex_mem-1.0.0.tar.gz.
File metadata
- Download URL: cortex_mem-1.0.0.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbdcc220ce92bf7e8617d0aa0c07b33333272baed209d4d019661a53de63780f
|
|
| MD5 |
38c9b0b4dfe4ee8930bd352632b1d45b
|
|
| BLAKE2b-256 |
d219dd55af75b506310c4bb37c34b046997a3063a28f127056177aaa45937b5a
|
File details
Details for the file cortex_mem-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cortex_mem-1.0.0-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4804c561798099e52a95e3f8df08a48ce70d04f279ea5dc16e8e1174d5e6942e
|
|
| MD5 |
801341560bfb4676fc073bd3fa1948a6
|
|
| BLAKE2b-256 |
d9e31ef2d9176fdd90059db89221ba015df48226a48442114793f88b1413b5cc
|