🌙 luminary-memory
A lightweight, self-hosted memory layer for AI agents.
Self-hosted · Private · Budget-aware · Self-maintaining
Why luminary-memory
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.
What your agent remembers is what it becomes.
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 via Reciprocal Rank Fusion.
- Zero hard dependencies — the default backend is SQLite + FTS5 (standard library). Embeddings run locally on CPU via ONNX. Ingesting and recalling memories in minutes.
- Budget-aware by design — results are deduplicated (Jaccard) 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
Python API
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
# maintain the store (TTL cleanup + consolidation + pruning)
client.run_lifecycle()
client.close()
CLI
luminary-memory add "The deploy target is the staging cluster" --tags deploy
luminary-memory recall "where do we deploy?" --json
luminary-memory search "postgresql"
luminary-memory list
luminary-memory lifecycle
luminary-memory stats
How recall works
Four retrieval strategies run in parallel, then fuse into one ranked result:
| Strategy | What it finds | Backend |
|---|---|---|
| Semantic | Meaning, paraphrase, synonyms | ONNX embeddings (384-dim, CPU) |
| Keyword | Exact names, APIs, identifiers | FTS5 BM25 (SQLite) / ILIKE (pgvector) |
| Temporal | Recent, frequently-accessed facts | Decay curve × access count |
| Graph | Entity co-occurrence, indirect links | entities / relations tables |
Fusion pipeline: 4 strategies → RRF fusion (k=60) → Jaccard dedup (0.85) → token budget (4096)
Backends
| SQLite + FTS5 (default) | PostgreSQL + pgvector | |
|---|---|---|
| Dependencies | stdlib + FTS5 | PostgreSQL + pgvector extension |
| Vector search | In-process cosine | HNSW-ready (<=> operator) |
| Best for | Single-user, edge, <100k memories | Scale, concurrent access |
| Setup | Zero-config | Running Postgres + LUMINARY_PG_DSN |
Switch backends with one setting:
from luminary_memory import MemoryClient
from luminary_memory.config import Settings
client = MemoryClient(settings=Settings(
backend="pgvector",
pg_dsn="postgresql://user:pass@localhost/memdb",
))
Configuration
Every setting can be set via a LUMINARY_* environment variable or passed as a Settings object.
| 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 |
ingest_whitelist |
LUMINARY_INGEST_WHITELIST |
[] (regex patterns) |
ingest_llm |
LUMINARY_INGEST_LLM |
false |
rrf_k |
LUMINARY_RRF_K |
60 |
dedup_jaccard_threshold |
LUMINARY_DEDUP_JACCARD_THRESHOLD |
0.85 |
token_budget |
LUMINARY_TOKEN_BUDGET |
4096 |
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 |
Use cases
- AI coding agents — retain architecture decisions, API choices, and error fixes across sessions.
- Chatbots & assistants — remember user preferences, history, and conversation context.
- Automation pipelines — persist execution state, task outcomes, and learned parameters.
- Personal knowledge & local RAG — a private second brain with zero cloud involvement.
Architecture
ingest(text) ──► whitelist filter ──► (LLM enrich, optional) ──► embed ──► backend
│
recall(query) ──► 4 strategies (semantic·keyword·temporal·graph)
──► RRF fusion ──► Jaccard dedup ──► token budget ──► ranked results
│
lifecycle() ──► cleanup (TTL) ──► consolidate (near-dupes) ──► prune (low-value)
Hermes integration
A ready-to-use skill lives in hermes/SKILL.md: install it, then the agent can ingest durable facts on tool calls, recall context into its system prompt, and schedule lifecycle maintenance via cron. See docs/hermes-integration.md.
Development
git clone https://github.com/alertxsto/luminary-memory.git
cd luminary-memory
pip install -e ".[dev]"
python -m pytest # run tests
python -m ruff check src tests # lint
Contributions welcome — see CONTRIBUTING.md.
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
Roadmap
See ROADMAP.md for the full product roadmap — v0.2.1 (Hermes memory provider), v0.3.0 (intelligence), and v1.0.0 (stable).
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.2.1.tar.gz.
File metadata
- Download URL: luminary_memory-0.2.1.tar.gz
- Upload date:
- Size: 131.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5d3ffe5a57211476350b91e5d954d9ed6353328f4ea5fabb77f2004ffd8a148
|
|
| MD5 |
1a399a64cfa548c8babbe587deb72b0e
|
|
| BLAKE2b-256 |
9de038c37c5f82d955cab124aeec8a19ec6f5b075f422c50505f1b6964d8173b
|
Provenance
The following attestation bundles were made for luminary_memory-0.2.1.tar.gz:
Publisher:
publish.yml on alertxsto/luminary-memory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
luminary_memory-0.2.1.tar.gz -
Subject digest:
b5d3ffe5a57211476350b91e5d954d9ed6353328f4ea5fabb77f2004ffd8a148 - Sigstore transparency entry: 2499232007
- Sigstore integration time:
-
Permalink:
alertxsto/luminary-memory@e7d2ee62c8fbd8df8170ffe26e707f41daf63358 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alertxsto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e7d2ee62c8fbd8df8170ffe26e707f41daf63358 -
Trigger Event:
push
-
Statement type:
File details
Details for the file luminary_memory-0.2.1-py3-none-any.whl.
File metadata
- Download URL: luminary_memory-0.2.1-py3-none-any.whl
- Upload date:
- Size: 51.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d099829770be1991f4924a642765061aedc9a3389a3aa87c0b1907b2339de613
|
|
| MD5 |
8eb2ad9a3107bbb4077d6ce091d6a81e
|
|
| BLAKE2b-256 |
25efe5fb81413b48fc48c299ebcd55c14e829365e1aafc596e4eeaa06ccea1b6
|
Provenance
The following attestation bundles were made for luminary_memory-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on alertxsto/luminary-memory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
luminary_memory-0.2.1-py3-none-any.whl -
Subject digest:
d099829770be1991f4924a642765061aedc9a3389a3aa87c0b1907b2339de613 - Sigstore transparency entry: 2499232033
- Sigstore integration time:
-
Permalink:
alertxsto/luminary-memory@e7d2ee62c8fbd8df8170ffe26e707f41daf63358 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alertxsto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e7d2ee62c8fbd8df8170ffe26e707f41daf63358 -
Trigger Event:
push
-
Statement type: