Skip to main content

๐ŸŒ™ luminary-memory

A lightweight, self-hosted memory layer for AI agents.

PyPI version Python License CI Tests Coverage Stars

Self-hosted ยท Private ยท Budget-aware ยท Self-maintaining


What your agent remembers is what it becomes.

Agents are only as good as what they remember. A stateless agent re-learns the same context every session, paying the same tokens, making the same mistakes. 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.

Four retrieval strategies. One fused answer. Zero cloud.

  • Semantic, ONNX embeddings (384-dim, CPU, no GPU needed)
  • Keyword, FTS5 BM25 (SQLite, zero config)
  • Temporal, recency decay ร— access count
  • Graph, entity co-occurrence with automatic curation

Strategies run in parallel and fuse via weighted RRF (semantic 0.4, keyword 0.3, graph 0.2, temporal 0.1) โ†’ adaptive cutoff (cliff detection) โ†’ Jaccard deduplication (0.85) โ†’ token budget (4096). Short queries are expanded with graph entities before embedding, so "deploy?" still finds "production cluster".


Quickstart

pip install luminary-memory
from luminary_memory import MemoryClient

client = MemoryClient(db_path="memory.db")

# store a durable fact
client.ingest("The deploy target is the staging cluster", tags=["deploy", "infra"])

# recall, four strategies fused into one ranked answer
result = client.recall("where do we deploy?")
for memory, score in zip(result.memories, result.scores):
    print(f"{score:.3f}  {memory.content}")
# โ†’ 0.942  The deploy target is the staging cluster
# CLI
luminary-memory add "deploy target is staging" --tags deploy
luminary-memory recall "where do we deploy?" --json
luminary-memory list
luminary-memory lifecycle
luminary-memory stats

Hermes Agent, first-class memory provider

Drop-in. Install the provider with pip install "luminary-memory[hermes]", then add memory.provider: luminary to your Hermes config. That's it.

From the next session: auto-recall injects relevant memories every turn, auto-save persists completed turns, and the model can call luminary_recall / luminary_ingest / luminary_list on demand.

Two optional LLM-powered features keep the store sharp:

  • ingest_llm, evaluates every turn before saving: drops chit-chat, stores factual summaries instead of raw transcripts.
  • auto_maintain, reviews the store at session end: keeps current facts, updates changed ones, deletes stale or duplicate ones.

22 settings are exposed in the Hermes dashboard for zero-hassle tuning. See hermes/README.md for the one-shot installer and full configuration.


Configuration

Every setting has a LUMINARY_* env var or a Settings object.

Setting Env var Default
backend LUMINARY_BACKEND sqlite
db_path LUMINARY_DB_PATH luminary_memory.db
pg_dsn LUMINARY_PG_DSN , (pgvector only)
embedding_model LUMINARY_EMBEDDING_MODEL BAAI/bge-small-en-v1.5
embedding_dim LUMINARY_EMBEDDING_DIM 384
ingest_llm LUMINARY_INGEST_LLM false
rrf_k LUMINARY_RRF_K 60
strategy_weights LUMINARY_WEIGHT_{SEMANTIC,KEYWORD,GRAPH,TEMPORAL} 0.4 / 0.3 / 0.2 / 0.1
recall_cliff_threshold LUMINARY_RECALL_CLIFF_THRESHOLD 0.45
dedup_jaccard_threshold LUMINARY_DEDUP_JACCARD_THRESHOLD 0.85
token_budget LUMINARY_TOKEN_BUDGET 4096
max_memories LUMINARY_MAX_MEMORIES 1000
ttl_default_seconds LUMINARY_TTL_DEFAULT_SECONDS null
prune_min_importance LUMINARY_PRUNE_MIN_IMPORTANCE 0.2
consolidate_jaccard_threshold LUMINARY_CONSOLIDATE_JACCARD_THRESHOLD 0.9
consolidate_semantic LUMINARY_CONSOLIDATE_SEMANTIC true
importance_auto LUMINARY_IMPORTANCE_AUTO true

See hermes/SKILL.md for the full provider config table (22 settings).


Architecture

Memory is a loop, not a pipeline you run once. Every turn, luminary recalls what is relevant before the agent answers, then ingests what mattered after, and a background lifecycle keeps the store lean.

        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ LOOP โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚                                                               โ”‚
   recall(query) โ”€โ”€โ–บ 4 strategies in parallel โ”€โ”€โ–บ weighted RRF โ”€โ”€โ–บ adaptive cutoff โ”€โ”€โ–บ ranked results
        โ–ฒ            semantic โ”‚ keyword โ”‚ temporal โ”‚ graph   (per-strategy weights)   (cliff detection)
        โ”‚                                                               โ”‚
        โ””โ”€โ”€ inject into agent context โ—„โ”€โ”€ token budget (4096) โ—„โ”€โ”€ dedup (Jaccard 0.85)
                                                                        โ”‚
   ingest(text) โ”€โ”€โ–บ whitelist โ”€โ”€โ–บ (LLM curation) โ”€โ”€โ–บ embed (ONNX 384-d) โ”€โ”˜
                                                                        โ”‚
   lifecycle() โ”€โ”€โ–บ cleanup (TTL) โ”€โ”€โ–บ consolidate (semantic + Jaccard) โ”€โ”€โ–บ prune (importance)
   maintenance() โ”€โ”€โ–บ LLM reviews store โ”€โ”€โ–บ keep โ”‚ update โ”‚ delete stale facts

Why it is accurate:

Stage Mechanism
4 strategies Semantic (ONNX cosine) + keyword (FTS5 BM25) + temporal (recency ร— access) + graph (entity co-occurrence), all in parallel
Weighted fusion Each strategy carries a tunable weight (semantic 0.4, keyword 0.3, graph 0.2, temporal 0.1), so high-signal strategies dominate the ranking
Query expansion Short queries are expanded with co-occurring graph entities before embedding, so a bare "deploy?" still finds "production cluster"
Adaptive cutoff Cliff detection keeps only the relevant cluster: a sparse store returns 3 strong matches instead of padding to 20, while a dense relevant store keeps everything (no over-filtering)
Token budget Hard cap so memory injection never blows up the context window

Why it stays clean:

Stage Mechanism
Lifecycle TTL cleanup, semantic consolidation (embedding cosine, fallback Jaccard), importance-based pruning
Auto importance Every memory is scored by recency + access + graph centrality; prune and health use live values
Max memories cap max_memories (default 1000) prunes the oldest/lowest-importance when the store exceeds it
LLM maintenance Optional auto_maintain reviews the store at session end: keep, update, or delete stale facts
Health score health_score() gives a 0-100 checkup with actionable recommendations

health_score() gives you a 0-100 checkup with actionable recommendations.


Documentation

Section
Quickstart Install and first use
Architecture Pipelines and data flow
Python API MemoryClient reference
CLI All subcommands
Recall Four strategies + fusion
Lifecycle Cleanup, consolidation, pruning, LLM maintenance
Backends SQLite vs pgvector
Hermes integration Provider, config, installer
Roadmap v0.2.11 โ†’ v1.0.0
Benchmarks 230 ms recall @ 5k, 0 LLM tokens

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.2.11.tar.gz (143.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.2.11-py3-none-any.whl (67.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: luminary_memory-0.2.11.tar.gz
  • Upload date:
  • Size: 143.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for luminary_memory-0.2.11.tar.gz
Algorithm Hash digest
SHA256 f13a919b829151315f98451faf48c97a83069f4a07a38759defdd55a40b2753c
MD5 dcf4d886a8ad4dfe96471b858103ee6c
BLAKE2b-256 8a74fd751d1c5ef12085a26dd866f7ee7f081417e6599da3274966f4d723064c

See more details on using hashes here.

Provenance

The following attestation bundles were made for luminary_memory-0.2.11.tar.gz:

Publisher: publish.yml on alertxsto/luminary-memory

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

File details

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

File metadata

File hashes

Hashes for luminary_memory-0.2.11-py3-none-any.whl
Algorithm Hash digest
SHA256 f479deb842844cee165e2307886e8d7a6fdc8b5b8788d454f909c526aa7003fa
MD5 9e6f4f107c7da5f73911554ece23d431
BLAKE2b-256 113480a6851977592d746b137574e9a952e136c4a622da2d4dfb9626e1f381a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for luminary_memory-0.2.11-py3-none-any.whl:

Publisher: publish.yml on alertxsto/luminary-memory

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 Sentry Error logging StatusPage Status page