Understanding Memory
Memory is what makes PJais personas truly intelligent. They remember your conversations, learn your preferences, and build context over time. Learn how the memory system works and how to manage it effectively.
Why Memory Matters
Without memory, every conversation would start from scratch. With memory, your personas become true assistants that understand your context, preferences, and history.
Pick up where you left off. Your persona remembers previous discussions, so you don't have to repeat yourself or provide context every time.
Personas learn your preferences, communication style, and needs. Responses become more tailored and relevant over time.
Build a knowledge base over time. Personas remember facts, decisions, and information you've shared, creating a growing repository of context.
Semantic search finds relevant memories even if you don't use exact words. The system understands meaning, not just keywords.
How Memory Works
PJais uses a sophisticated multi-layered memory system inspired by how human memory works. Here's the process:
When you have a conversation, every message (yours and the persona's) is stored in the local database with metadata like timestamp, token count, and conversation ID.
What gets stored:
- • Full message text
- • Timestamp and conversation ID
- • Token count and model used
- • Persona ID and configuration
Each message is converted into a semantic embedding - a mathematical representation of its meaning. This allows the system to find related memories based on concepts, not just keywords.
Example:
If you previously discussed "machine learning models," the system can retrieve that memory when you ask about "AI algorithms" - even though the words are different, the concepts are related.
The system analyzes conversations to extract key facts, preferences, and decisions. These are stored separately for quick retrieval.
Examples of extracted facts:
- • "User prefers Python over JavaScript"
- • "User's project deadline is March 15"
- • "User works in healthcare industry"
- • "User prefers concise explanations"
When you send a new message, the system searches for relevant memories using semantic similarity. The most relevant memories are included in the context sent to the AI.
Retrieval process:
- Convert your message to semantic embedding
- Search for similar embeddings in memory
- Rank results by relevance and recency
- Include top results in AI context
Types of Memory
PJais uses three types of memory, each serving a different purpose:
Short-term memory holds the current conversation. It's what the persona uses to maintain context within a single session.
Characteristics:
- • Limited by context window size
- • Cleared when conversation ends
- • Fast access and retrieval
- • Includes recent messages only
Best for:
- • Following conversation flow
- • Maintaining immediate context
- • Quick back-and-forth exchanges
- • Temporary information
Long-term memory stores important facts, preferences, and information across all conversations. This is what makes personas truly remember you.
Characteristics:
- • Persists across conversations
- • Searchable and retrievable
- • Organized by importance
- • Can be manually edited
Best for:
- • User preferences and habits
- • Important facts and decisions
- • Project information
- • Personal details
Semantic memory uses AI embeddings to understand the meaning and relationships between concepts. It finds relevant information even when exact words don't match.
Characteristics:
- • Concept-based, not keyword-based
- • Finds related information
- • Understands context and meaning
- • Improves over time
Best for:
- • Finding related discussions
- • Connecting ideas across conversations
- • Discovering patterns
- • Contextual understanding
Example:
You said before: "I'm building a web app with React"
You ask now: "What's the best state management solution?"
Semantic memory retrieves: The React conversation, even though you didn't mention React in your question, because it understands the context.
Memory Settings & Configuration
Fine-tune how memory works for each persona:
Controls how many past conversations are considered when retrieving memories.
Shallow (1-5 conversations)
Only recent conversations. Fast and efficient. Good for task-focused personas.
Medium (10-20 conversations)
Balanced approach. Remembers recent context plus important older information. Recommended for most use cases.
Deep (50+ conversations)
Extensive history. Best for long-term projects, tutors, or personas that need to track progress over time.
The number of tokens (roughly words) to include in the AI's context. Larger windows provide more context but are slower and more expensive.
Small (2K-4K)
Fast, cheap. Good for simple Q&A.
Medium (4K-8K)
Balanced. Recommended for most uses.
Large (8K-32K)
Maximum context. For complex tasks.
Configure what types of information should be retained:
- FactsImportant information and preferences (always retained)
- ConversationsFull conversation history (configurable retention period)
- TemporarySession-only information (cleared after conversation)
Managing Memory
You have full control over what your personas remember:
See what your persona has learned and stored:
- Open Persona Settings
- Go to Memory tab
- Click "View Memories"
- Browse facts, conversations, and embeddings
Teach your persona specific facts:
- Go to Persona Settings → Memory
- Click "Add Memory"
- Enter the fact or information
- Set importance level (optional)
Remove specific memories or clear all:
- Individual: View memories and delete specific ones
- Conversation: Delete entire conversation history
- All: Clear all memories for a fresh start
Save your memories for safekeeping:
- Export as JSON for backup
- Import memories from backup
- Transfer between devices
- Share with other personas (advanced)
Privacy & Storage
All memories are stored locally on your device by default. They never leave your computer unless you enable cloud sync.
Windows
%APPDATA%/pjais/memory/macOS
~/Library/Application Support/pjais/memory/Linux
~/.config/pjais/memory/Memories are encrypted at rest using industry-standard encryption:
- AES-256 encryption for local storage
- End-to-end encryption for cloud sync
- Encryption keys derived from your password
- No one can read your memories without your password
Each persona has completely isolated memory. Memories from one persona never leak into another. This ensures each persona maintains its unique context and role.
Memory Best Practices
Task-focused personas (code reviewer, translator) need less memory depth. Long-term assistants (tutor, coach, project manager) benefit from deeper memory to track progress over time.
Check what your persona has learned every few weeks. Remove outdated information and add important facts manually to ensure accuracy.
When you don't want a conversation saved to memory (testing, one-off questions, sensitive topics), use incognito mode. The conversation won't be stored.
If you switch to a completely different project or topic, consider starting a new conversation or clearing old memories. This prevents confusion from mixed contexts.
Export memories for personas with valuable accumulated knowledge. This protects against data loss and allows you to transfer knowledge to new personas if needed.
Common Questions
Memories are very efficient. A typical persona with hundreds of conversations uses only 10-50MB of storage. Embeddings are compressed, and only important information is retained long-term.
Not directly, as memories are isolated by design. However, you can export memories from one persona and manually import selected facts into another. This is an advanced feature for specific use cases.
All memories associated with that persona are deleted. Make sure to export any important information before deleting a persona. Deleted memories cannot be recovered.
Yes, if you enable cloud sync. Memories are encrypted before syncing, so they remain private. You can choose to sync all memories or only specific personas.
Yes. If memory depth is set low, older conversations may not be retrieved. You can also manually delete memories. Additionally, if context window is full, some older context may be truncated.
Next Steps
Learn how personas combine memory with system prompts and configuration.
Learn About PersonasExplore advanced memory visualization, search, and management features.
Advanced FeaturesUnderstand how PJais keeps your memories private and secure.
Privacy GuideLearn how to backup, export, and manage your conversation data.
Export Guide