Loading...
Loading...
Manage git-backed memory repos. Load this skill when working with git-backed agent memory, setting up remote memory repos, resolving sync conflicts, or managing memory via git workflows.
npx skill4agent add letta-ai/letta-code syncing-memory-filesystemgit-memory-enabled$LETTA_BASE_URL/v1/git/<agent-id>/state.gitmemory/system/*.mdgit-memory-enabled~/.letta/agents/<agent-id>/memory/memory/.git/configgit pushgit pullgit statuscd ~/.letta/agents/<agent-id>/memory
# Check if configured
git config --get credential.$LETTA_BASE_URL.helper
# Reconfigure (e.g. after API key rotation)
git config credential.$LETTA_BASE_URL.helper \
'!f() { echo "username=letta"; echo "password=$LETTA_API_KEY"; }; f'git config --global credential.$LETTA_BASE_URL.helper \
'!f() { echo "username=letta"; echo "password=$LETTA_API_KEY"; }; f'.mdmemory/.md------descriptionlimitread_onlyread_only: true---
description: What this block contains
limit: 20000
---
Block content goes here.# Clone agent's memory repo
git clone "$LETTA_BASE_URL/v1/git/<agent-id>/state.git" ~/my-agent-memory
# View memory blocks
ls ~/my-agent-memory/memory/system/
cat ~/my-agent-memory/memory/system/human.md/memfs enableAGENT_ID="<your-agent-id>"
AGENT_DIR=~/.letta/agents/$AGENT_ID
MEMORY_REPO_DIR="$AGENT_DIR/memory"
# 1. Add git-memory-enabled tag (IMPORTANT: preserve existing tags!)
# First GET the agent to read current tags, then PATCH with the new tag appended.
# The harness code does: tags = [...existingTags, "git-memory-enabled"]
curl -X PATCH "$LETTA_BASE_URL/v1/agents/$AGENT_ID" \
-H "Authorization: Bearer $LETTA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"tags": ["origin:letta-code", "git-memory-enabled"]}'
# 2. Clone the repo into memory/
mkdir -p "$MEMORY_REPO_DIR"
git clone "$LETTA_BASE_URL/v1/git/$AGENT_ID/state.git" "$MEMORY_REPO_DIR"
# 3. Configure local credential helper
cd "$MEMORY_REPO_DIR"
git config credential.$LETTA_BASE_URL.helper \
'!f() { echo "username=letta"; echo "password=$LETTA_API_KEY"; }; f'# 1. Edit block via API (or use memory tools)
# 2. Pull to get changes (webhook creates commit automatically)
cd ~/.letta/agents/<agent-id>/memory
git pullcd ~/.letta/agents/<agent-id>/memory
# 1. Edit files locally
echo "Updated info" > system/human.md
# 2. Commit and push
git add system/human.md
git commit -m "fix: update human block"
git push
# 3. API automatically reflects changes (webhook-triggered, ~2-3s delay)cd ~/.letta/agents/<agent-id>/memory
# 1. Try to push (will be rejected)
git push # -> "fetch first"
# 2. Pull to create merge conflict
git pull --no-rebase
# -> CONFLICT in system/human.md
# 3. View conflict markers
cat system/human.md
# <<<<<<< HEAD
# your local changes
# =======
# server changes
# >>>>>>> <commit>
# 4. Resolve
echo "final resolved content" > system/human.md
git add system/human.md
git commit -m "fix: resolved conflict in human block"
# 5. Push resolution
git push
# -> API automatically updates with resolved content# Create file in system/ directory (automatically attached to agent)
echo "My new block content" > system/new-block.md
git add system/new-block.md
git commit -m "feat: add new block"
git push
# -> Block automatically created and attached to agent# Remove file from system/ directory
git rm system/persona.md
git commit -m "chore: remove persona block"
git push
# -> Block automatically detached from agent~/.letta/agents/<agent-id>/
├── .letta/
│ └── config.json # Agent metadata
└── memory/ # Git repo root
├── .git/ # Git repo data
└── system/ # System blocks (attached to agent)
├── human.md
└── persona.mdmemory/system/git-memory-enabledgit config --get credential.$LETTA_BASE_URL.helpercurl -u letta:$LETTA_API_KEY $LETTA_BASE_URL/v1/git/<agent-id>/state.git/info/refs?service=git-upload-packgit-memory-enabledLETTA_DEBUG=1git pullgit fetch