Memory System

Prisma Setup
Liz uses Prisma as its ORM, supporting both SQLite and PostgreSQL databases. The schema defines the structure for storing memories and tweets.
Loading Memories
The loadMemories middleware retrieves relevant conversation history for each request:
Creating Memories
The createMemoryFromInput middleware stores new interactions in the database:
Memory Context
The wrapContext middleware formats memories into a structured context for LLM interactions:
Performance Considerations
Memory Limits
Default limit of 100 recent memories
Configurable through middleware options
Consider token limits of your LLM
Use indexes for faster queries
Database Tips
SQLite for development/small apps
PostgreSQL for production/scale
Regular database maintenance
Monitor memory table growth
Last updated