luminary-memory
A lightweight, self-hosted memory layer for AI agents.
luminary-memory gives AI agents durable, cross-session memory without shipping data to a third party. It runs entirely on your infrastructure, embeds and retrieves memories locally, and exposes a clean Python API and CLI that drop into any agent workflow. No external services required — SQLite out of the box, optional pgvector when you need scale.
Why luminary-memory
Agents are only as good as what they remember. Stateless agents re-learn the same context every session; luminary-memory closes that gap with a local memory store that persists between runs, retrieves the right context on demand, and keeps itself tidy over time.
Value proposition
- Self-hosted and private — all data stays on your machine. No cloud dependency, no API keys to leak, no per-token memory cost.
- Four retrieval strategies in one recall — semantic (embeddings), keyword (FTS5), temporal (recency/access), and graph (entity co-occurrence) run in parallel and fuse into a single ranked result.
- Zero hard dependencies — the default backend is SQLite + FTS5 (standard library). Embeddings run locally on CPU via ONNX. You can be ingesting and recalling memories in minutes.
- Budget-aware by design — results are deduplicated and truncated to a configurable token budget, so memory injection never blows up your agent's context window.
- Self-maintaining — a built-in lifecycle handles TTL expiry, near-duplicate consolidation, and low-value pruning, so the store stays lean without manual cleanup.
- Scales when you do — a pluggable backend lets you move from SQLite to pgvector without changing your code.
Quickstart
Install
pip install luminary-memory # or, for development:
git clone <repo> && cd luminary-memory && pip install -e ".[dev]"
Python API
from luminary_memory import MemoryClient
client = MemoryClient(db_path="memory.db")
# store
mid = client.ingest("The deploy target is the staging cluster", tags=["deploy"])
# recall (four strategies, fused)
result = client.recall("where do we deploy?")
for memory, score in zip(result.memories, result.scores):
print(f"{score:.3f} {memory.content}")
# maintenance
client.run_lifecycle() # cleanup + consolidate + prune
client.close()
CLI
luminary-memory add "The deploy target is the staging cluster" --tags deploy
luminary-memory recall "where do we deploy?" --limit 5 --json
luminary-memory search "postgresql"
luminary-memory list
luminary-memory lifecycle
luminary-memory stats
Architecture
┌──────────────────────────────────────────┐
│ ingest() │
│ whitelist → (LLM enrich) → embed → store │
└──────────────┬───────────────────────────┘
▼
┌──────────────────────────────────────────┐
│ backend (pluggable) │
│ SQLite + FTS5 | pgvector │
└──────────────┬───────────────────────────┘
▼
┌──────────────────────────────────────────┐
│ recall() │
│ semantic + keyword + temporal + graph │
│ → RRF fusion → dedup → budget │
└──────────────┬───────────────────────────┘
▼
┌──────────────────────────────────────────┐
│ lifecycle() │
│ TTL cleanup · consolidate · prune │
└──────────────────────────────────────────┘
Configuration
Every setting can be set via a LUMINARY_* environment variable or through Settings directly.
| Setting | Env var | Default |
|---|---|---|
backend |
LUMINARY_BACKEND |
sqlite |
db_path |
LUMINARY_DB_PATH |
luminary_memory.db |
pg_dsn |
LUMINARY_PG_DSN |
postgresql://localhost/luminary_memory |
embedding_model |
LUMINARY_EMBEDDING_MODEL |
BAAI/bge-small-en-v1.5 |
embedding_dim |
LUMINARY_EMBEDDING_DIM |
384 |
rrf_k |
LUMINARY_RRF_K |
60 |
dedup_jaccard_threshold |
LUMINARY_DEDUP_JACCARD_THRESHOLD |
0.85 |
token_budget |
LUMINARY_TOKEN_BUDGET |
4096 |
Backends
| SQLite (default) | pgvector | |
|---|---|---|
| Dependencies | stdlib + FTS5 | PostgreSQL + pgvector |
| Vector search | in-process cosine | HNSW index |
| Best for | single-user, edge, <100k memories | scale, concurrent access |
| Setup | zero-config | needs a running Postgres |
See docs/backends.md for a migration guide.
Documentation
- Quickstart — install and first use
- Architecture — pipelines and data flow
- Python API —
MemoryClientreference - CLI — all subcommands and flags
- Recall — how the four strategies + fusion work
- Lifecycle — cleanup, consolidation, pruning
- Backends — SQLite vs pgvector
- Hermes integration — use with Hermes Agent
License
Apache-2.0 © 2026 Dwiky Candra
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 luminary_memory-0.1.1.tar.gz.
File metadata
- Download URL: luminary_memory-0.1.1.tar.gz
- Upload date:
- Size: 72.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f8402d148cda8da0a58625df347aa4055c06d45d1061f5d434e8aabf3422889
|
|
| MD5 |
829e85371ee62dc3e8df4b439d3802d6
|
|
| BLAKE2b-256 |
33c849b63863fe2714258e645d04db5201df6cb204f684b8e9e8cfcee7351017
|
File details
Details for the file luminary_memory-0.1.1-py3-none-any.whl.
File metadata
- Download URL: luminary_memory-0.1.1-py3-none-any.whl
- Upload date:
- Size: 30.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb1c1a07c92d37f1cc026e81252aa69c3e5ade2c5dcf86c7813ba92a1b353a2d
|
|
| MD5 |
d7cb5ce8fc9f0a016b5709cd1e579c0a
|
|
| BLAKE2b-256 |
f7a7967c22325efcf082b1d53242bb5cd4e4062ae6ca42d52008c0edc8741d77
|