GistLattice is a memory-augmented Python library with episodic recall, semantic state, and durable consolidation.
Project description
Cognitive Memory for AI Agents.
A beautiful, three-method Python library for giving your LLMs durable, long-term memory.
🧠 Why GistLattice?
Most "Agent Memory" systems simply dump raw chat transcripts into a vector database. GistLattice is different. It uses an LLM to actively reflect on a conversation before saving it.
When you ask GistLattice to remember an interaction, it extracts:
- Gist: A concise summary of the factual information.
- Valence: The emotional tone (-1.0 to 1.0). Did the user get angry? Were they excited? Your agent will remember their mood!
- Importance: A score (0.0 to 1.0) dictating how crucial this memory is. Passing comments decay quickly; major life events are cemented permanently.
📦 Installation
Install the base library (defaults to fast, in-memory databases):
pip install gistlattice
Install production backends (optional):
pip install gistlattice[qdrant,neo4j,redis]
Install specific LLM providers:
pip install gistlattice[openai]
pip install gistlattice[gemini]
pip install gistlattice[anthropic]
pip install gistlattice[ollama]
🚀 Quick Start
The entire surface area of the library is encapsulated in a single, elegant class: GistLattice.
import asyncio
from gistlattice import GistLattice
async def main() -> None:
# 1. Initialize the client (defaults to in-memory storage)
memory = GistLattice(provider="openai", tenant_id="tenant-a", user_id="user-123")
# 2. Store an interaction synchronously
analysis = await memory.remember(
prompt="I'm feeling really stressed about the product launch tomorrow.",
response="I understand. Let's review the final checklist to make sure we are ready."
)
print(f"Saved Memory Gist: {analysis.gist}")
print(f"Emotional Valence: {analysis.valence}") # e.g., -0.8 (Highly stressed)
# 3. Retrieve formatted context to inject into your next LLM prompt
context = await memory.hydrate_context("What should I do next?")
print("\n--- Hydrated Context ---")
print(context)
asyncio.run(main())
📐 Architecture Flow
GistLattice intercepts conversations and routes them through a robust processing pipeline:
graph LR
App[Your AI App] --> Remember(memory.remember)
App --> Hydrate(memory.hydrate_context)
Remember --> LLM[LLM Reflection Analysis]
LLM --> Episodic[(Episodic: Qdrant)]
LLM --> Semantic[(Semantic: Neo4j)]
Hydrate --> Episodic
Hydrate --> Semantic
📚 Documentation
We have completely stripped out the architectural jargon. Our documentation is heavily focused on getting you building instantly:
- User Guide & API Reference: Everything you need to know about
remember(),hydrate_context(), andretrieve(). - Supported Providers: How to switch between OpenAI, Gemini, Anthropic, and Ollama.
- Production Backends: How to connect to Redis, Neo4j, and Qdrant for durable, at-scale memory.
🛠 Examples
Want to see runnable code? Check out the examples/ directory:
01_basic_openai_sync.py02_hybrid_gemini_async.pyproduction/01_programmatic.pyproduction/02_environment_variables.py
🤝 Contributing
We would love your help making GistLattice the standard for agent memory! To contribute:
- Fork the repository.
- Install dependencies:
pip install -e ".[dev,openai,qdrant,neo4j,redis]" - Run the test suite:
python3 -m unittest discover -s tests -v
- Submit a Pull Request!
📜 License
This project is licensed under the Apache License 2.0.
Project details
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 gistlattice-0.1.0.tar.gz.
File metadata
- Download URL: gistlattice-0.1.0.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
626ea780213e41ccacf8747b519e549760cc1a2409ed4f5892a1bf54bade06df
|
|
| MD5 |
cf8e2daa02dbc7d949d7b5022c74aaaf
|
|
| BLAKE2b-256 |
d28620a1a112a2105bacae17e778e73ff28bf0123234a6f2931fbab07e77d43d
|
File details
Details for the file gistlattice-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gistlattice-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7b1e9f516b118582dc5e1609c8ac22756b3efdae86005e4948e96aaeb0b2804
|
|
| MD5 |
0d9a18d34adecaba5b6378c6223f9393
|
|
| BLAKE2b-256 |
f9d91df98bddff8246824cbf2fc78c9bdce458287096a3043715c00c526903ec
|