Quickstart
AI memory system — episodic, semantic, and working memory with pluggable backends and consolidation.
Install
Section titled “Install”uv add lexigram-ai-memoryMinimal Usage
Section titled “Minimal Usage”import asynciofrom datetime import UTC, datetime
from lexigram import Applicationfrom lexigram.ai.memory import MemoryModule, MemoryConfigfrom lexigram.contracts.ai.memory import MemoryEntry, MemoryQuery
async def main(): config = MemoryConfig() async with Application.boot( name="memory-demo", modules=[MemoryModule.configure(config)], ) as app: store = await app.container.resolve(MemoryStoreProtocol)
entry = MemoryEntry( id="1", content="The capital of France is Paris.", role="assistant", timestamp=datetime.now(UTC), importance=0.9, ) await store.store(entry)
results = await store.retrieve( MemoryQuery(query="france capital", top_k=5) ) for r in results: print(f"[{r.score:.2f}] {r.entry.content}")
asyncio.run(main())What Just Happened
Section titled “What Just Happened”MemoryModule.configure(config)wiredMemoryProviderinto the container.MemoryStoreProtocolresolved the defaultInMemoryMemoryBackend.store.store()saved an entry with importance metadata.store.retrieve()searched entries by query and returned scored results.
Next Steps
Section titled “Next Steps”- Guide — three memory tiers, consolidation, end-to-end usage
- How-Tos — common memory patterns
- Configuration — all config keys