Appearance
Memory System
FreshSource: Letta Code Memory
Overview
Letta Code enables persistent agent improvement across sessions through a sophisticated memory system. Memory is not just session state -- it is durable, structured, and version-controlled.
Core Concepts
| Entity | Description |
|---|---|
| Agent | Named entity with memories, model config, and state that persists indefinitely |
| Conversation | Message thread; multiple parallel conversations can exist per agent |
| MemFS | Git-backed memory filesystem (v0.15+) |
MemFS Architecture
Letta Code v0.15+ uses MemFS (Memory Filesystem), a git-backed context repository organizing memories as markdown files with frontmatter.
File Format
markdown
---
description: "Who I am, what I value, and how I approach working with people"
limit: 50000
---
My name is Letta Code. I'm a stateful coding assistant...Memory Hierarchy
system/files: Pinned to the context window for critical information (personality, name, working style)- Other files: Appear in the memory tree with omitted full contents; suitable for reflections and observations
Git Synchronization
Memory is stored in git and cloned locally to:
~/.letta/agents/<agent-id>/memoryImportant
Agents must commit and push changes to save edits and update system prompts. Memory changes are not persisted until they are committed.
Memory Commands
/init - Initialize Memory
Performs guided initialization using context constitution principles for durable identity, preferences, and project structure.
/initThe agent can analyze prior Claude Code and OpenAI Codex sessions to understand your working patterns.
/remember - Store Information
Manually direct the agent to store specific information in memory.
/remember Always use TypeScript strict mode in this project/doctor - Audit Memory
Audit and refine memory structure for efficiency. Helps consolidate and organize accumulated memories.
/doctor/sleeptime - Configure Reflection
Configure dream/reflection settings for proactive memory consolidation.
/sleeptimeDream/Reflection System
Periodic background subagents reflect on conversations for proactive memory consolidation.
Trigger Options
| Trigger | Description |
|---|---|
| Step count | Reflect after N interaction steps |
| Compaction event | Reflect when context is compacted (recommended for MemFS) |
Recommended
Use compaction-based triggers with MemFS for the most natural reflection cycles.
SOP: Setting Up Agent Memory
Step 1: Create Agent
bash
lettaStep 2: Initialize Memory
/initStep 3: Configure Persona
Describe who you are and your preferences. The agent stores this in system/ files.
Step 4: Train Through Use
- Ask questions and provide corrections
- Use
/rememberfor explicit memory updates - Periodically run
/doctorto optimize
Step 5: Verify Persistence
Close and reopen the session. Verify the agent remembers prior context.
Verification Checklist
- [ ]
/initcompleted successfully - [ ] Memory files visible at
~/.letta/agents/<id>/memory - [ ]
system/files contain core identity information - [ ]
/remembercommands persist across sessions - [ ]
/doctorruns without errors - [ ] Dream/reflection triggers configured
See Also
- Agents - Agent lifecycle and configuration
- Skills - Extend agent capabilities
- Headless Mode - Automated memory management