Skip to main content

LightMem (lmem) Python SDK

Ultra-Fast Local AI Agent Persistent Memory Engine with Neural Extractive QA & Knowledge Graph.

PyPI version License: MIT


⚡ Quickstart

Installation

pip install lmem

Python SDK Usage

from lmem import LightMem

# Initialize vault (defaults to ~/.lightmem/memories.db or custom path)
lm = LightMem()

# 1. Store a memory (auto-infers 14 categories)
memory = lm.remember(
    "PostgreSQL primary runs on port 5432 with WAL archiving enabled",
    category="fact",
    title="PostgreSQL Primary Config",
    tags=["postgres", "database", "production"],
    confidence=0.95,
)
print("Stored memory:", memory.id)

# 2. Hybrid Search (FTS5 BM25 + Vector Cosine RRF)
results = lm.recall("postgres port", limit=5)
for r in results:
    print(f"[{r.score:.2f}] {r.memory.title}: {r.memory.content}")

# 3. Neural Extractive QA (exact fact extraction in ~6ms via ONNX SQuAD2)
answer = lm.answer("what port does postgresql use?")
print("Extracted answer:", answer.answer)      # "5432"
print("Confidence:", answer.confidence)
print("Reranker:", answer.reranker_used)

# 4. Knowledge Graph Autolink (title mentions, shared tags, vector similarity)
link_stats = lm.autolink(min_similarity=0.75)
print("Connections created:", link_stats)

# 5. Multi-Hop Graph Traversal
related = lm.related(memory.id, hops=2)
for rel in related:
    print(f"Hop {rel.distance}: {rel.memory.title} via {' -> '.join(rel.relation_path)}")

# 6. Deploy Skill to AI Agents (Antigravity, Codex, Hermes, Cursor, Claude)
lm.connect("antigravity")

💻 CLI Commands (Included)

The pip install lmem package also installs the standalone CLI:

lmem remember "Redis cache runs on port 6379" -t fact
lmem recall "redis port" -l 5
lmem answer "what is my pan card no"
lmem autolink
lmem graph
lmem connect all

📄 License

MIT License. Created by Pathi Krishna Kanth.

Metadata

Release files for lmem 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lmem 0.2.1
File Size Uploaded
lmem-0.2.1.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lmem 0.2.1
File Interpreter ABI Platform
lmem-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.8 kB

Release files / lmem-0.2.1.tar.gz

Download URL lmem-0.2.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
74138fbcb594aaf90a0a3546d7ad42b94b0bd6a902238ef2309c2fe9cb8dd46b
BLAKE2b-256 checksum
How to use checksums
bbadf9e62684adb71978fb930a21fda2ff1d18a2b18bb7274ab0ca6ab0e87772
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / lmem-0.2.1-py3-none-any.whl

Download URL lmem-0.2.1-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b038db490f8d9eae46eea93f51a92d7d22dd96ad555ec6452350cf86c87af622
BLAKE2b-256 checksum
How to use checksums
e9038fdd2a8e3ae2dae29ec388add73f22c66f0a7f2a2e40b3cd88ec34122c79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page