Lite Mode
Lite mode runs the full SmartMemory pipeline without Docker, FalkorDB, or Redis. It uses local SQLite for the graph, an embedded vector index, and an in-memory cache. The same 11-stage pipeline runs — only the storage providers and a few network-bound stages change.
Use it for:
- Local development without spinning up Docker
- CI / unit tests that need a real backend but no infrastructure
- No-LLM environments where neither
OPENAI_API_KEYnorGROQ_API_KEYis set - Notebook prototyping and quickstarts
What Lite Mode Changes
PipelineConfig.lite() (in smartmemory/pipeline/config.py) flips a small set of stage flags. Everything else — classification, simplification, EntityRuler NER, sentiment, temporal, topic enrichment, store, link, evolution — runs at full quality.
| Stage | Default | Lite |
|---|---|---|
coreference (fastcoref) | enabled | disabled (avoids first-run model download) |
llm_extract | enabled | auto-detected from env (see below) |
enrich.wikidata.sparql_enabled | True (HTTP to Wikidata) | False (local SQLite alias lookup only) |
enrich.enricher_names | all enrichers | ["basic_enricher", "sentiment_enricher", "temporal_enricher", "topic_enricher"] |
evolve.run_clustering | True | False (requires full graph scan) |
evolve.run_evolution | True | True (still runs — incremental via daemon thread) |
Storage providers (set by create_lite_memory() in smartmemory/tools/factory.py):
- Graph:
SQLiteBackend(db_path=<data_dir>/memory.db) - Vector:
UsearchVectorBackend(persist_directory=<data_dir>) - Cache:
NoOpCache - Ontology:
SQLiteOntologyStoreon the samememory.db - Observability: disabled
Default data_dir is ~/.smartmemory.
LLM Auto-Detection (DEGRADE-1d)
PipelineConfig.lite() accepts llm_enabled: bool | None:
@classmethod
def lite(cls, workspace_id=None, llm_enabled: Optional[bool] = None):
if llm_enabled is None:
llm_enabled = bool(os.getenv("OPENAI_API_KEY") or os.getenv("GROQ_API_KEY"))
...None(default) — auto-enables LLM extraction if eitherOPENAI_API_KEYorGROQ_API_KEYis set; otherwise disables it.True— force on (will fail at extraction time without a key).False— force off; rely on EntityRuler + spaCy NER only.
When LLM extraction is off, the pipeline still extracts entities through EntityRuler (pattern-matched, ~4 ms) and spaCy NER, just without LLM-driven relation extraction.
Three Usage Patterns
1. lite_context() — recommended
Context manager that builds a SmartMemory and tears down deterministically. Closes the SQLite connection and stops the evolution worker on exit.
from smartmemory.tools.factory import lite_context
with lite_context() as memory:
item_id = memory.ingest("Paris is the capital of France.")
results = memory.search("capital of France", top_k=3)
for r in results:
print(r.content)2. Constructor injection
For long-lived processes (servers, agents) where you manage the lifecycle directly:
from smartmemory.tools.factory import create_lite_memory
from smartmemory.pipeline.config import PipelineConfig
memory = create_lite_memory(
data_dir="/var/lib/myapp/memory",
pipeline_profile=PipelineConfig.lite(llm_enabled=False), # force no-LLM
)
memory.ingest("Some content")
# ... later ...
memory.close()You can also inject the lite profile into a regular SmartMemory() constructor if you want lite stages but server-mode storage:
from smartmemory import SmartMemory
from smartmemory.pipeline.config import PipelineConfig
memory = SmartMemory(pipeline_profile=PipelineConfig.lite())3. Auto-fallback (zero config)
If you never set pipeline_profile, default SmartMemory() will still degrade gracefully when LLM keys aren't present — the LLM extractor checks GROQ_API_KEY / OPENAI_API_KEY at call time and skips when neither is set. For predictable behaviour in CI, prefer pattern 1 or 2 with llm_enabled=False.
Hermetic Variant
PipelineConfig.lite_hermetic() is identical to lite() but refuses to auto-download the spaCy en_core_web_sm model. If the model isn't installed, it raises RuntimeError immediately instead of fetching it mid-test.
Use this in CI parity tests where you need:
- No network access during the test
- No mid-test downloads that mask flaky network issues
- Deterministic ordering between SQLite and FalkorDB branches of a parity matrix
from smartmemory.pipeline.config import PipelineConfig
from smartmemory.tools.factory import lite_context
# Install the model in your CI step BEFORE running tests:
# python -m spacy download en_core_web_sm
with lite_context(pipeline_profile=PipelineConfig.lite_hermetic()) as memory:
memory.ingest("test content")Limitations
| Capability | Lite | Notes |
|---|---|---|
| Entity extraction quality | Reduced when no LLM | EntityRuler + spaCy NER only |
| Relation extraction | Off when no LLM | Requires LLM stage |
| Coreference resolution | Off | fastcoref disabled to avoid model download |
| Wikidata SPARQL grounding | Off | Local SQLite alias lookup only; no HTTP |
| Wikipedia / link enrichers | Off | Network-dependent |
| Graph clustering evolver | Off | Full graph scan, expensive |
| Concurrent writes | Limited | SQLite is single-writer |
| Multi-tenant scoping | Same as server | ScopeProvider works identically |
End-to-End Example
"""Quick lite-mode demo: ingest → search → cleanup."""
import os
from smartmemory.tools.factory import lite_context
from smartmemory.pipeline.config import PipelineConfig
# Force no-LLM for a fully offline run
profile = PipelineConfig.lite(llm_enabled=False)
with lite_context(data_dir="./demo-memory", pipeline_profile=profile) as memory:
# Ingest
facts = [
"Ada Lovelace wrote the first algorithm intended for a machine.",
"She collaborated with Charles Babbage on the Analytical Engine.",
"The first algorithm computed Bernoulli numbers.",
]
for f in facts:
item_id = memory.ingest(f)
print(f"stored {item_id}")
# Search
print("\nSearch: 'Ada Lovelace'")
for hit in memory.search("Ada Lovelace", top_k=3):
print(f" - {hit.content[:80]}")
# Stats
print(f"\nLast trajectory stages: "
f"{len(memory.last_trajectory.stages) if memory.last_trajectory else 0}")Output (on a machine without OPENAI_API_KEY):
stored 1a2b...
stored 3c4d...
stored 5e6f...
Search: 'Ada Lovelace'
- Ada Lovelace wrote the first algorithm intended for a machine.
- She collaborated with Charles Babbage on the Analytical Engine.
- The first algorithm computed Bernoulli numbers.
Last trajectory stages: 11Related
- Basic Usage
- Performance Tuning
- Source:
smart-memory-core/smartmemory/tools/factory.py,smart-memory-core/smartmemory/pipeline/config.py