letta-external-memfs is a pair of patches that retarget Letta's git-backed memory (MemFS) at an external git host — Gitea, GitHub, GitLab — instead of going through the server's internal /v1/git/ proxy. The Letta team endorses this repo as the recommended self-hosted memfs path.

What it does

By default, Letta's MemFS expects clients to push to the server's own /v1/git/ proxy, which writes to GCS in Cloud or a local bare repo when self-hosted. This project provides two patches:

  • Client patch (memoryGit.ts.patch) — points letta-code's git push/pull at LETTA_MEMFS_GIT_URL instead of the server proxy.
  • Server patch (server_memory_sync_endpoint.patch) — exposes POST /v1/agents/{agent_id}/memory/sync-from-git so the server can re-read files into its postgres block cache after an external pull. This replaces the files→blocks materialization that normally fires on /v1/git/ receive and isn't triggered by the client patch alone.

How it works

Without these patches:
  letta-code → Letta server (/v1/git/ proxy) → bare repo → postgres cache sync

With these patches:
  letta-code → external git host (Gitea/GitHub/GitLab)
                                 ↓
              sync mechanism pulls on server side
                                 ↓
              POST /v1/agents/{id}/memory/sync-from-git → postgres cache

Why it matters

Letta's own block_manager_git.py treats git as source of truth and postgres as a cache. The external git host plays the role the internal bare repo plays in stock: canonical, durable, the thing clients and servers both resolve against. The server's local memfs becomes a working checkout. Postgres blocks become a rebuildable cache.

The framing keeps the single-machine case simple — server and client share a filesystem, the external remote is just backup — and makes the multi-machine case coherent: any machine can rebuild from the external remote.

Requirements

  • Letta server 0.16.6+ (self-hosted, patched)
  • Letta Code 0.19.6+ (patched)
  • External git host (tested on Gitea, GitHub, GitLab)
  • Git token with repo read/write access
  • Docker + ability to rebuild your Letta server image

Status

Community-maintained. Not part of Letta support SLA. Endorsed as the recommended self-hosted memfs path by the Letta team.