Skip to main content

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

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

luminary_memory-0.1.0.tar.gz (45.9 kB view details)

Uploaded Source

Built Distribution

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

luminary_memory-0.1.0-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file luminary_memory-0.1.0.tar.gz.

File metadata

  • Download URL: luminary_memory-0.1.0.tar.gz
  • Upload date:
  • Size: 45.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for luminary_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b2a7ce7c972c4ed138815a68696843c5e80ba8749ba19c36801ab4f8fd20273c
MD5 c29fb699d0b99485cff1cb45f9600872
BLAKE2b-256 8cda53d4da3c368d6d958129af2df686d568d8a55fe52a63acd3c948b4ebde05

See more details on using hashes here.

File details

Details for the file luminary_memory-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for luminary_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fc37c6f77c9da7cb720dec9256bebdfa0f60c323dd7403cd0b5ea5d927220cb
MD5 e14fc6984b351adba4cd8c2e1ea64645
BLAKE2b-256 fcca4acb697ef0f248ec7717372b39e9d7d33b99f765dba0235314a7ebb17b5b

See more details on using hashes here.

Supported by

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