Memory
Understand Letta Code's hierarchical memory system
With Letta Code, you can use the same agent indefinitely - across sessions, days, or months - and have it get better over time. Your agent remembers past interactions, learns your preferences, and self-edits its own memory as it works.
Starting a session
Section titled “Starting a session”When you run letta in a project directory, Letta Code automatically manages agent persistence:
letta- First time in a directory → creates a new agent
- Every time after → resumes the same agent with full memory intact
You can close your terminal, come back days later, and pick up right where you left off with the same agent.
Agent options
Section titled “Agent options”letta --newletta --fresh-blocksletta --agent <agent-id>Initializing memory
Section titled “Initializing memory”When starting with a new project, run /init to help your agent understand the codebase:
> /initThe agent will:
- Analyze your project structure (README, package.json, etc.)
- Identify key patterns and conventions
- Store this context in its memory for future sessions
Run /init again whenever you want the agent to re-analyze the project, such as after major changes or adding documentation that you want the agent to ingest.
Updating memory
Section titled “Updating memory”Automatic updates
Section titled “Automatic updates”As the agent works, it automatically updates its memory with important information. For example, after discovering your project uses pnpm instead of npm, it may decide to remember that for future sessions.
Manual updates
Section titled “Manual updates”Use /remember to explicitly tell the agent to remember something:
> /remember Always use pnpm instead of npm in this projectWithout arguments, the agent reflects on recent interactions and updates memory as appropriate:
> /rememberHow memory works
Section titled “How memory works”Memory is stored as blocks on the Letta server. Each block has a label, description, content, and size limit. Agents can read and write to their own blocks. To learn more about memory blocks, check the main documentation page.
Configuration files
Section titled “Configuration files”Local files track which agent and blocks to use:
| File | Purpose | Git |
|---|---|---|
~/.letta/settings.json | Global block IDs, API keys | N/A |
.letta/settings.local.json | Your agent ID for this project | Ignored |
.letta/settings.json | Shared project settings | Commit |
Best practices
Section titled “Best practices”- Run
/initon new projects - Helps the agent understand your codebase - Use
/rememberfor important context - Explicitly save information you want persisted - Commit
.letta/settings.json- Share project context with your team - Keep
.letta/settings.local.jsongitignored - Personal settings stay personal