Agent skill
migrating-memory
Migrate memory blocks from an existing agent to the current agent. Use when the user wants to copy or share memory from another agent, or during /init when setting up a new agent that should inherit memory from an existing one.
Install this agent skill to your Project
npx add-skill https://github.com/letta-ai/letta-code/tree/main/src/skills/builtin/migrating-memory
SKILL.md
Migrating Memory
This skill helps migrate memory blocks from an existing agent to a new agent, similar to macOS Migration Assistant for AI agents.
Requires Memory Filesystem (memfs)
This workflow is memfs-first. If memfs is enabled, do not use the legacy block commands — they can conflict with file-based edits.
To check: Look for a
memory_filesystemblock in your system prompt. If it shows a tree structure starting with/memory/including asystem/directory, memfs is enabled.To enable: Ask the user to run
/memfs enable, then reload the CLI.
When to Use This Skill
- User is setting up a new agent that should inherit memory from an existing one
- User wants to share memory blocks across multiple agents
- User is replacing an old agent with a new one
- User mentions they have an existing agent with useful memory
Migration Method (memfs-first)
Export → Copy → Sync
This is the recommended flow:
-
Export the source agent's memfs to a temp directory
bashletta memfs export --agent <source-agent-id> --out /tmp/letta-memfs-<source-agent-id> -
Copy the files you want into your own memfs
system/= attached blocks (always loaded)- root = detached blocks
Example:
bashcp -r /tmp/letta-memfs-agent-abc123/system/project ~/.letta/agents/$LETTA_AGENT_ID/memory/system/ cp /tmp/letta-memfs-agent-abc123/notes.md ~/.letta/agents/$LETTA_AGENT_ID/memory/ -
Sync to API
bashletta memfs sync --agent $LETTA_AGENT_ID
This gives you full control over what you bring across and keeps everything consistent with memfs.
Legacy Fallback (only if memfs is disabled)
If memfs is not enabled, you can use block-level commands:
letta blocks listletta blocks copyletta blocks attach
⚠️ Do not use these if memfs is enabled — they can diverge from file-based edits.
Handling Duplicate Label Errors
You cannot have two blocks with the same label. If you try to copy/attach a block and you already have one with that label, you'll get a duplicate key value violates unique constraint error.
Solutions:
-
Use
--label(copy only): Rename the block when copying:bashletta blocks copy --block-id <id> --label project-imported -
Use
--override(copy or attach): Automatically detach your existing block first:bashletta blocks copy --block-id <id> --override letta blocks attach --block-id <id> --overrideIf the operation fails, the original block is automatically reattached.
-
Manual detach first: Use the
memorytool to detach your existing block:memory(agent_state, "delete", path="/memories/<label>")Then run the copy/attach script.
Note: letta blocks attach does NOT support --label because attached blocks keep their original label (they're shared, not copied).
Workflow
Step 1: Identify Source Agent
Ask the user for the source agent's ID (e.g., agent-abc123).
If they don't know the ID, invoke the finding-agents skill to search:
Skill({ skill: "finding-agents" })
Example: "What's the ID of the agent you want to migrate memory from?"
Example: Migrating Project Memory
Scenario: You're a new agent and want to inherit memory from an existing agent "ProjectX-v1".
-
Get source agent ID from user: User provides:
agent-abc123 -
Export their memfs:
bashletta memfs export --agent agent-abc123 --out /tmp/letta-memfs-agent-abc123 -
Copy the relevant files into your memfs:
bashcp -r /tmp/letta-memfs-agent-abc123/system/project ~/.letta/agents/$LETTA_AGENT_ID/memory/system/ -
Sync:
bashletta memfs sync --agent $LETTA_AGENT_ID
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
adding-models
Guide for adding new LLM models to Letta Code. Use when the user wants to add support for a new model, needs to know valid model handles, or wants to update the model configuration. Covers models.json configuration, CI test matrix, and handle validation.
searching-messages
Search past messages to recall context. Use when you need to remember previous discussions, find specific topics mentioned before, pull up context from earlier in the conversation history, or find which agent discussed a topic.
converting-mcps-to-skills
Connect to MCP (Model Context Protocol) servers and create skills for repeated use. Load when a user wants to use an MCP server, connect to external tools via MCP, or when they mention MCP, model context protocol, or specific MCP servers.
working-in-parallel
Guide for working in parallel with other agents. Use when another agent is already working in the same directory, or when you need to work on multiple features simultaneously. Covers git worktrees as the recommended approach.
Migrating from Codex and Claude Code
Find and search historical conversation data from Claude Code and OpenAI Codex CLIs. Use when you need to understand a user's coding patterns, learn about a project from past sessions, or bootstrap agent memory from historical context.
creating-skills
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Letta Code's capabilities with specialized knowledge, workflows, or tool integrations.
Didn't find tool you were looking for?