Memory vs Context vs Application State
These terms are often mixed together.
- Context: information visible to the current model call.
- Memory: information retained across calls and selectively reintroduced.
- Application state: authoritative product data such as order status, permissions or workflow state.
type MemoryRecord = {
tenantId: string;
subjectId: string;
text: string;
source: 'user' | 'tool' | 'derived';
createdAt: string;
};
Never make model memory authoritative for security, payments or other critical state.
Practice
- Why is database state not the same as model memory?
- What should happen before a model-generated memory is persisted?
- Why must memory retrieval be tenant-scoped?
- Give an example of a fact that belongs in application state rather than memory.