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 remember "Itachi 4K wallpaper" -f ./itachi-4k.mp4 --extract
lmem recall "redis port" -l 5
lmem recall "itachi" -m video -l 1 --path
lmem inspect <ID> --paths
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.9

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.9
File Size Uploaded Provenance
lmem-0.2.9.tar.gz 9.4 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for lmem 0.2.9
File Interpreter ABI Platform
lmem-0.2.9-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
lmem-0.2.9-py3-none-manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
lmem-0.2.9-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 38.1 MB

Release files / lmem-0.2.9.tar.gz

Download URL lmem-0.2.9.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e27783af67471966ad09ed6fdc886820d3f9667c9a6a6cb2ad40c41eebd1e74a
BLAKE2b-256 checksum
How to use checksums
7aef1b8f24d965e2486a323f7d8a814b3b22c0d83b8f30b8138d0e78be2e0311
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 12, 2026.

Transparency log

Release files / lmem-0.2.9-py3-none-win_amd64.whl

Download URL lmem-0.2.9-py3-none-win_amd64.whl
Size 12.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
4da860e583b5c9269eeed0aeffa17e480757154c745a5497d8b20f2bfd7d92e9
BLAKE2b-256 checksum
How to use checksums
20dc2185ca8b63f3b265d634a5e2e101cc5d6025483009c915ab48818192c72c
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 12, 2026.

Transparency log

Release files / lmem-0.2.9-py3-none-manylinux2014_x86_64.whl

Download URL lmem-0.2.9-py3-none-manylinux2014_x86_64.whl
Size 14.3 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
08c8f98388baf16e22c80d73cc5c9f98d7ab602a6c969f59c53623fbbd7e00c4
BLAKE2b-256 checksum
How to use checksums
ec397d82d35af70d874016feefc9ab3e00ef8edb586b13021c47e71d06daf020
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 12, 2026.

Transparency log

Release files / lmem-0.2.9-py3-none-macosx_11_0_arm64.whl

Download URL lmem-0.2.9-py3-none-macosx_11_0_arm64.whl
Size 11.8 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3f9b4c73cb16a158108e3a2f1551703cad525650810fafc17ca3f00f7a394e76
BLAKE2b-256 checksum
How to use checksums
c5dc4298d1c68dd5725d7ab27ac8919c099fd74cc73cbfcf9b72f7ad15682c82
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 12, 2026.

Transparency log

Security for lmem 0.2.9

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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for lmem-0.2.9.tar.gz

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 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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