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[postgres,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.
from gistlattice import GistLattice
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
# This automatically buffers the interaction to eliminate per-turn LLM database mutations.
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("Memory buffered!")
# 3. Retrieve formatted context to inject into your next LLM prompt
context = memory.hydrate_context("What should I do next?")
print("\n--- Hydrated Context ---")
print(context)
if __name__ == "__main__":
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 --> Buffer[MemoryBufferController]
Buffer --> LLM[LLM Reflection Analysis]
LLM --> Storage[(StorageProvider: Postgres / Neo4j)]
Hydrate --> Storage
📚 Documentation
We have completely stripped out the architectural jargon. Our documentation is heavily focused on getting you building instantly:
- How it Works (A Human Example): A plain-English story demonstrating the difference between short-term buffers and GistLattice.
- 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, PostgreSQL, and Neo4j 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,postgres,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.
Metadata
Release files for gistlattice 1.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gistlattice-1.2.4.tar.gz | 1.4 MB | Without provenance | Details for gistlattice-1.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gistlattice-1.2.4-py3-none-any.whl | Python 3 | none | any | Details for gistlattice-1.2.4-py3-none-any.whl |
Total release size: 1.5 MB
Release files / gistlattice-1.2.4.tar.gz
| Download URL | gistlattice-1.2.4.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d901d0da7c7994e221d5cb217a3ee760d165aa350556b4f91c6269f6fabe542a
|
|
BLAKE2b-256 checksum How to use checksums |
d3606a8433f9d30e0c2851fa6fec5a36b0b70ffbe7383d72b19a6056fec54e6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.4
|
Release files / gistlattice-1.2.4-py3-none-any.whl
| Download URL | gistlattice-1.2.4-py3-none-any.whl |
|---|---|
| Size | 31.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b879451354088fa4d391b7a879d842ef2add065ddcb293b3a3e2a2ee62642b5
|
|
BLAKE2b-256 checksum How to use checksums |
8fe4b255ba245ed52a031c821a0cc257ec4866606f273ab857d9b455e39e0af1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.4
|
Security for gistlattice 1.2.4
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.