Skip to content
DiscordForumGitHubSign up
Features

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.

When you run letta in a project directory, Letta Code automatically manages agent persistence:

Start Letta Code
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.

Force a new agent (reuses your global preferences)
letta --new
New agent with completely fresh memory
letta --fresh-blocks
Connect to a specific agent by ID
letta --agent <agent-id>

When starting with a new project, run /init to help your agent understand the codebase:

Terminal window
> /init

The agent will:

  1. Analyze your project structure (README, package.json, etc.)
  2. Identify key patterns and conventions
  3. 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.

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.

Use /remember to explicitly tell the agent to remember something:

Remember something specific
> /remember Always use pnpm instead of npm in this project

Without arguments, the agent reflects on recent interactions and updates memory as appropriate:

Suggest a memory update without specifics
> /remember

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.

Local files track which agent and blocks to use:

FilePurposeGit
~/.letta/settings.jsonGlobal block IDs, API keysN/A
.letta/settings.local.jsonYour agent ID for this projectIgnored
.letta/settings.jsonShared project settingsCommit
  1. Run /init on new projects - Helps the agent understand your codebase
  2. Use /remember for important context - Explicitly save information you want persisted
  3. Commit .letta/settings.json - Share project context with your team
  4. Keep .letta/settings.local.json gitignored - Personal settings stay personal