Enum MemoryType
Specifies the category of information stored in an AgentMemory data source.
public enum MemoryType
Fields
Semantic = 0General knowledge and factual information.
Semantic memory stores facts, concepts, and general knowledge that is not tied to a specific personal experience or time. This is the most common type of memory and is used for building knowledge bases, storing product information, domain expertise, and reference material.
Examples:
- "The Earth orbits the Sun in approximately 365.25 days."
- "Our API rate limit is 1000 requests per minute."
- "C# supports both value types and reference types."
- Technical documentation and specifications
- FAQ content and knowledge base articles
This is the default memory type when none is specified.
Episodic = 1Personal experiences and specific events.
Episodic memory stores information about specific events, experiences, and contextual details that are tied to a particular time or situation. Use this type for conversation history, user-specific interactions, session context, and temporal information.
Examples:
- "On March 15, the user mentioned they prefer detailed explanations."
- "Last session, we discussed migrating from Python to C#."
- "User's birthday is in August; they mentioned it during onboarding."
- Meeting notes and conversation summaries
- User preference observations over time
Episodic memories often include temporal context (dates, times, "last week") and personal pronouns (the user, we, they).
Procedural = 2Process knowledge and how-to information.
Procedural memory stores information about how to do things: processes, workflows, step-by-step instructions, and methodologies. This type is ideal for runbooks, standard operating procedures, tutorials, and troubleshooting guides.
Examples:
- "To deploy: 1) Run tests, 2) Build release, 3) Push to production."
- "Troubleshooting connection errors: First check network, then verify credentials."
- "Recipe for authentication: Validate token, check permissions, log access."
- Installation guides and setup instructions
- Standard operating procedures (SOPs)
Procedural memories typically contain numbered steps, action verbs (do, run, click, verify), and sequential instructions.
Examples
Example: Organizing memory by type
using LMKit.Agents;
using LMKit.Model;
using var embeddingModel = new LM("path/to/embedding-model.gguf");
var memory = new AgentMemory(embeddingModel);
// Semantic: General knowledge
await memory.SaveInformationAsync(
dataSourceIdentifier: "product_knowledge",
text: "Our premium plan includes unlimited API calls and priority support.",
sectionIdentifier: "premium_features",
memoryType: MemoryType.Semantic);
// Episodic: User-specific experiences
await memory.SaveInformationAsync(
dataSourceIdentifier: "user_history",
text: "On January 15, the user asked about enterprise pricing options.",
sectionIdentifier: "inquiry_001",
memoryType: MemoryType.Episodic);
// Procedural: Process knowledge
await memory.SaveInformationAsync(
dataSourceIdentifier: "procedures",
text: "To reset a password: 1) Go to Settings, 2) Click Security, 3) Select Reset Password.",
sectionIdentifier: "password_reset",
memoryType: MemoryType.Procedural);
// Check memory types
foreach (var ds in memory.DataSources)
{
var memType = AgentMemory.GetMemoryType(ds);
Console.WriteLine($"{ds.Identifier}: {memType}");
}
Remarks
MemoryType is modeled after the human cognitive memory system and helps categorize stored information for better organization and potential retrieval optimization. Each data source in AgentMemory is associated with a single memory type.
Memory Type Categories
| Type | Purpose and Examples |
|---|---|
| Semantic | General facts and knowledge: "Paris is the capital of France", "C# is a statically-typed language", product specifications. |
| Episodic | Personal experiences and specific events: "User mentioned they prefer dark mode", "Meeting with client on March 15", conversation history highlights. |
| Procedural | How-to knowledge and processes: "Steps to deploy the application", "Recipe for authentication flow", troubleshooting guides. |
Usage Notes
A data source can only have one memory type. If you attempt to save information
with a different type than the data source was created with, an exception is thrown.
Use GetMemoryType(DataSource) to check a data source's type.