@letta-ai/letta-code 0.30.32 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/agent-presets-agent-presets.js +11 -0
  2. package/dist/agent-presets-agent-presets.js.map +9 -0
  3. package/dist/agent-presets-personality-asset-content.js +42 -0
  4. package/dist/agent-presets-personality-asset-content.js.map +10 -0
  5. package/dist/agent-presets.js +17 -2
  6. package/dist/agent-presets.js.map +3 -3
  7. package/dist/channels-public.js +16 -1
  8. package/dist/channels-public.js.map +5 -4
  9. package/dist/gateway-core.js +5 -4
  10. package/dist/gateway-core.js.map +3 -3
  11. package/dist/mcp-client.js +2 -2
  12. package/dist/mcp-client.js.map +1 -1
  13. package/dist/types/agent/create-agent-request.d.ts +3 -0
  14. package/dist/types/agent/create-agent-request.d.ts.map +1 -1
  15. package/dist/types/agent/model.d.ts.map +1 -1
  16. package/dist/types/agent/personality-asset-content.d.ts +3 -0
  17. package/dist/types/agent/personality-asset-content.d.ts.map +1 -0
  18. package/dist/types/agent/skills.d.ts.map +1 -1
  19. package/dist/types/channels/gateway-core.d.ts.map +1 -1
  20. package/dist/types/channels/route-thread-key.d.ts +20 -0
  21. package/dist/types/channels/route-thread-key.d.ts.map +1 -0
  22. package/dist/types/channels-public.d.ts +1 -0
  23. package/dist/types/channels-public.d.ts.map +1 -1
  24. package/dist/types/tools/impl/skill.d.ts.map +1 -1
  25. package/dist/types/types/protocol_v2.d.ts +3 -144
  26. package/dist/types/types/protocol_v2.d.ts.map +1 -1
  27. package/dist/types/types/schedule-protocol.d.ts +151 -1
  28. package/dist/types/types/schedule-protocol.d.ts.map +1 -1
  29. package/dist/types/utils/frontmatter.d.ts.map +1 -1
  30. package/dist/types/websocket/listener/cwd-change.d.ts.map +1 -1
  31. package/letta.js +238 -86
  32. package/package.json +4 -2
  33. package/scripts/builtin-skills-watch/agent-watch.test.ts +104 -0
  34. package/scripts/builtin-skills-watch/agent-watch.ts +337 -0
  35. package/scripts/builtin-skills-watch/aggregate-results.test.ts +79 -0
  36. package/scripts/builtin-skills-watch/aggregate-results.ts +326 -0
  37. package/scripts/builtin-skills-watch/analysis.test.ts +70 -0
  38. package/scripts/builtin-skills-watch/analysis.ts +228 -0
  39. package/scripts/builtin-skills-watch/evidence.test.ts +114 -0
  40. package/scripts/builtin-skills-watch/evidence.ts +145 -0
  41. package/scripts/builtin-skills-watch/github.ts +161 -0
  42. package/scripts/builtin-skills-watch/tracker.test.ts +249 -0
  43. package/scripts/builtin-skills-watch/tracker.ts +506 -0
  44. package/scripts/builtin-skills-watch/update-tracker.test.ts +234 -0
  45. package/scripts/builtin-skills-watch/update-tracker.ts +508 -0
  46. package/scripts/claude-watch/release-source.test.ts +16 -4
  47. package/scripts/claude-watch/release-source.ts +41 -2
  48. package/scripts/codex-watch/agent-watch.ts +8 -5
  49. package/scripts/codex-watch/release-analysis.test.ts +18 -16
  50. package/scripts/codex-watch/release-analysis.ts +31 -9
  51. package/scripts/codex-watch/tracker.test.ts +5 -5
  52. package/scripts/codex-watch/tracker.ts +7 -8
  53. package/scripts/pi-ai-watch/agent-watch.ts +9 -14
  54. package/scripts/pi-ai-watch/release-analysis.test.ts +24 -18
  55. package/scripts/pi-ai-watch/release-analysis.ts +85 -45
  56. package/scripts/pi-ai-watch/tracker.test.ts +25 -18
  57. package/scripts/pi-ai-watch/tracker.ts +7 -19
  58. package/scripts/pi-ai-watch/update-tracker.ts +2 -2
  59. package/scripts/source-file-size-baseline.json +2 -2
  60. package/skills/dispatching-coding-agents/SKILL.md +16 -7
  61. package/skills/syncing-memory-filesystem/SKILL.md +118 -226
@@ -1,277 +1,169 @@
1
1
  ---
2
2
  name: syncing-memory-filesystem
3
- description: 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.
3
+ description: Diagnose and repair MemFS repository setup, remote sync, authentication failures, optional backup remotes, or merge/rebase conflicts. Do not load for routine memory reads or edits.
4
4
  ---
5
5
 
6
- # Git-Backed Memory Repos
6
+ # MemFS Repository Repair
7
7
 
8
- Agents with the `git-memory-enabled` tag have their memory blocks stored in git repositories accessible via the Letta API. This enables version control, collaboration, and external editing of agent memory.
8
+ Use this skill only when the Git repository behind an agent's memory is not
9
+ setting up or syncing correctly. For ordinary memory reads and edits, use the
10
+ memory files or the memory tools without loading this skill.
9
11
 
10
- **Features:**
11
- - Stored in cloud (GCS)
12
- - Accessible via `$LETTA_BASE_URL/v1/git/<agent-id>/state.git`
13
- - Bidirectional sync: API <-> Git (webhook-triggered, ~2-3s delay)
14
- - Structure: `memory/system/*.md` for system blocks
12
+ ## Current Model
15
13
 
16
- ## What the CLI Harness Does Automatically
14
+ MemFS is a Git repository projected onto the computer where the agent is
15
+ running. `$MEMORY_DIR` is the repository root. There is no second `memory/`
16
+ directory inside it.
17
17
 
18
- When memfs is enabled, the Letta Code CLI automatically:
19
-
20
- 1. Adds the `git-memory-enabled` tag to the agent (triggers backend to create the git repo)
21
- 2. Clones the repo into `~/.letta/agents/<agent-id>/memory/` (git root is the memory directory)
22
- 3. Configures a **local** credential helper in `memory/.git/config` (so `git push`/`git pull` work without auth ceremony)
23
- 4. Installs a **pre-commit hook** that validates frontmatter before each commit (see below)
24
- 5. Installs a **post-commit hook** that pushes commits to an optional additional remote (see "Additional memory-repository remote" below)
25
- 6. Sets canonical local git identity (`letta.agentId`, `user.name`, `user.email`) so direct `git commit` from the agent's shell attributes correctly to the agent — not the operator's global git identity
26
- 7. On subsequent startups: pulls latest changes, reconfigures credentials, hooks, and identity (self-healing)
27
- 8. During sessions: periodically checks `git status` and reminds you (the agent) to commit/push if dirty
28
-
29
- If any of these steps fail, you can replicate them manually using the sections below.
30
-
31
- ## Authentication (Preferred: Repo-Local)
32
-
33
- The harness configures a **per-repo** credential helper during clone and refreshes it on pull/startup.
34
- This local setup is the default and recommended approach.
35
-
36
- Why this matters: host-level **global** credential helpers (e.g. installed by other tooling) can conflict with memfs auth and cause confusing failures.
37
-
38
- **Important:** Always use **single-line** format for credential helpers. Multi-line helpers can break tools that parse `git config --list` line-by-line.
39
-
40
- ```bash
41
- cd ~/.letta/agents/<agent-id>/memory
42
-
43
- # Check local helper(s)
44
- git config --local --get-regexp '^credential\..*\.helper$'
45
-
46
- # Reconfigure local helper (e.g. after API key rotation) - SINGLE LINE
47
- git config --local credential.$LETTA_BASE_URL.helper '!f() { echo "username=letta"; echo "password=$LETTA_API_KEY"; }; f'
18
+ ```text
19
+ $MEMORY_DIR/
20
+ ├── .git/
21
+ ├── system/ # loaded into the system prompt
22
+ ├── reference/ # loaded only when read
23
+ └── skills/ # agent-owned skills
48
24
  ```
49
25
 
50
- If you suspect global helper conflicts, inspect and clear host-specific global entries:
26
+ Cloud-backed agents have a hosted MemFS remote. Local-backend agents keep a
27
+ local-only Git repository and do not need a remote or cloud credentials.
51
28
 
52
- ```bash
53
- # Inspect Letta-related global helpers
54
- git config --global --get-regexp '^credential\..*letta\.com.*\.helper$'
29
+ The memory tools commit their changes. After each turn, the harness pushes
30
+ clean committed changes for cloud-backed agents. Local-backend commits remain
31
+ on the current machine. Do not run `git push` for normal MemFS sync; let the
32
+ harness push after the turn.
55
33
 
56
- # Example: clear a conflicting host-specific helper
57
- git config --global --unset-all credential.https://api.letta.com.helper
58
- ```
34
+ Committed memory changes do not alter the current compiled prompt immediately.
35
+ Use `/recompile` when the current conversation must see new `system/` content
36
+ right away. Otherwise, the next prompt compilation or conversation will use
37
+ the committed revision.
59
38
 
60
- For cloning a *different* agent's repo, prefer a one-off auth header over global credential changes:
39
+ ## Start With the Harness
61
40
 
62
- ```bash
63
- AUTH_HEADER="Authorization: Basic $(printf 'letta:%s' "$LETTA_API_KEY" | base64 | tr -d '\n')"
64
- git -c "http.extraHeader=$AUTH_HEADER" clone "$LETTA_BASE_URL/v1/git/<agent-id>/state.git" ~/my-agent-memory
65
- ```
41
+ Prefer the harness commands over manual API calls, remote construction, or
42
+ credential-helper edits:
66
43
 
67
- ## Pre-Commit Hook (Frontmatter Validation)
68
-
69
- The harness installs a git pre-commit hook that validates `.md` files under `memory/` before each commit. This prevents pushes that the server would reject.
70
-
71
- **Rules:**
72
- - Every `.md` file must have YAML frontmatter (`---` header and closing `---`)
73
- - Required fields: `description` (non-empty string)
74
- - `read_only` is a **protected field**: you (the agent) cannot add, remove, or change it. Files with `read_only: true` cannot be modified at all. Only the server/user sets this field.
75
- - Unknown frontmatter keys are rejected
76
-
77
- **Valid file format:**
78
- ```markdown
79
- ---
80
- description: What this block contains
81
- ---
82
-
83
- Block content goes here.
44
+ ```text
45
+ /memfs status # show whether MemFS is enabled and its path
46
+ /memfs enable # initialize or repair MemFS setup
47
+ /memfs sync # pull the hosted repository
84
48
  ```
85
49
 
86
- If the hook rejects a commit, read the error message — it tells you exactly which file and which rule was violated. Fix the file and retry.
50
+ From a shell, the standalone status and pull commands are:
87
51
 
88
- ## Additional Memory-Repository Remote
89
-
90
- In addition to pushing to the Letta server, you can push every commit to a second git remote — e.g. a private GitHub repo — so you have a backup or a copy you can browse with regular tools.
91
-
92
- **Via the slash command (recommended):**
93
- ```
94
- /memory-repository set git@github.com:you/my-memory.git
95
- /memory-repository status
96
- /memory-repository push # force a push now, e.g. after a network failure
97
- /memory-repository unset # stop pushing
98
- ```
99
-
100
- **How it works:**
101
- - `/memory-repository set <url>` writes the URL to `letta.memoryRepository.url` in the memfs repo's local `.git/config` and installs a `post-commit` hook.
102
- - After every commit, the hook reads `letta.memoryRepository.url` and asynchronously pushes to it in the background. Commits are never blocked by push failures.
103
- - Push output and exit codes are appended to `.git/memory-repository-push.log` — visible via `/memory-repository status`.
104
- - The setting is **per-repo**, so each agent on a machine has its own independent configuration.
105
-
106
- **Auth:** uses your existing git credentials — SSH keys, credential helpers, or tokens in the URL. Letta does not store tokens for this feature. If you're pushing to GitHub, SSH is easiest.
107
-
108
- **Manual equivalent (without the slash command):**
109
52
  ```bash
110
- cd ~/.letta/agents/<agent-id>/memory
111
- git config --local letta.memoryRepository.url git@github.com:you/my-memory.git
112
- # Hook is installed automatically by the CLI on startup; no manual install needed.
53
+ letta memory status --agent "$AGENT_ID"
54
+ letta memory pull --agent "$AGENT_ID"
113
55
  ```
114
56
 
115
- ## Clone Agent Memory
57
+ `letta memory pull` is a no-op for a local-backend agent because there is no
58
+ hosted remote.
116
59
 
117
- ```bash
118
- # Clone agent's memory repo
119
- git clone "$LETTA_BASE_URL/v1/git/<agent-id>/state.git" ~/my-agent-memory
60
+ Do not reproduce `/memfs enable` by PATCHing agent tags or constructing a Git
61
+ remote by hand. The enable flow also updates the system prompt mode, recompiles
62
+ the agent, persists local settings, detaches legacy memory tools, preserves and
63
+ adds tags, initializes the checkout, installs hooks, configures identity, and
64
+ seeds default memory files.
120
65
 
121
- # View memory blocks
122
- ls ~/my-agent-memory/memory/system/
123
- cat ~/my-agent-memory/memory/system/human.md
124
- ```
125
-
126
- ## Enabling Git Memory (Manual)
66
+ ## Inspect a Broken Checkout
127
67
 
128
- If the harness `/memfs enable` failed, you can replicate it:
68
+ Use `$MEMORY_DIR` instead of a hard-coded `~/.letta/agents/...` path. Local and
69
+ cloud-backed agents use different parent directories.
129
70
 
130
71
  ```bash
131
- AGENT_ID="<your-agent-id>"
132
- AGENT_DIR=~/.letta/agents/$AGENT_ID
133
- MEMORY_REPO_DIR="$AGENT_DIR/memory"
134
-
135
- # 1. Add git-memory-enabled tag (IMPORTANT: preserve existing tags!)
136
- # First GET the agent to read current tags, then PATCH with the new tag appended.
137
- # The harness code does: tags = [...existingTags, "git-memory-enabled"]
138
- curl -X PATCH "$LETTA_BASE_URL/v1/agents/$AGENT_ID" \
139
- -H "Authorization: Bearer $LETTA_API_KEY" \
140
- -H "Content-Type: application/json" \
141
- -d '{"tags": ["origin:letta-code", "git-memory-enabled"]}'
142
-
143
- # 2. Clone the repo into memory/
144
- mkdir -p "$MEMORY_REPO_DIR"
145
- git clone "$LETTA_BASE_URL/v1/git/$AGENT_ID/state.git" "$MEMORY_REPO_DIR"
146
-
147
- # 3. Configure local credential helper (single-line format required)
148
- cd "$MEMORY_REPO_DIR"
149
- git config --local credential.$LETTA_BASE_URL.helper '!f() { echo "username=letta"; echo "password=$LETTA_API_KEY"; }; f'
72
+ git -C "$MEMORY_DIR" status --short --branch
73
+ git -C "$MEMORY_DIR" remote get-url origin | sed -E 's#(https?://)[^/@]+@#\1<redacted>@#'
74
+ git -C "$MEMORY_DIR" log -5 --oneline
150
75
  ```
151
76
 
152
- ## Bidirectional Sync
77
+ Do not print credential-helper values or tokens. Do not change global Git
78
+ configuration. The harness installs or refreshes repository-local auth during
79
+ clone and pull when the active transport supports a persistent helper. Desktop
80
+ may instead use a temporary Git transport proxy and intentionally omit the
81
+ persistent helper.
153
82
 
154
- ### API Edit -> Git Pull
83
+ If the checkout is missing `.git/`, use `/memfs enable`. If it exists but is
84
+ behind, use `/memfs sync` or `letta memory pull --agent "$AGENT_ID"`. Pull also
85
+ repairs recognized stale MemFS origin URLs and refreshes repository-local hooks,
86
+ auth, branch tracking, and agent identity.
155
87
 
156
- ```bash
157
- # 1. Edit block via API (or use memory tools)
158
- # 2. Pull to get changes (webhook creates commit automatically)
159
- cd ~/.letta/agents/<agent-id>/memory
160
- git pull
161
- ```
162
-
163
- Changes made via the API are automatically committed to git within 2-3 seconds.
164
-
165
- ### Git Push -> API Update
88
+ ## Uncommitted Changes
166
89
 
167
- ```bash
168
- cd ~/.letta/agents/<agent-id>/memory
169
-
170
- # 1. Edit files locally
171
- echo "Updated info" > system/human.md
90
+ Raw file edits must preserve required frontmatter. Markdown files under
91
+ `system/` and `reference/` need a non-empty `description`. `read_only` is
92
+ protected and cannot be added, removed, or changed by the agent.
172
93
 
173
- # 2. Commit and push
174
- git add system/human.md
175
- git commit -m "fix: update human block"
176
- git push
94
+ ```markdown
95
+ ---
96
+ description: What this memory file contains
97
+ ---
177
98
 
178
- # 3. API automatically reflects changes (webhook-triggered, ~2-3s delay)
99
+ Memory content goes here.
179
100
  ```
180
101
 
181
- ## Conflict Resolution
102
+ Review the complete diff before committing. Stage named memory files only and
103
+ create a new commit. Once the repository is clean, the harness will push a
104
+ cloud-backed agent's pending commits after the turn.
182
105
 
183
- When both API and git have diverged:
106
+ ## Merge or Rebase Conflicts
184
107
 
185
- ```bash
186
- cd ~/.letta/agents/<agent-id>/memory
187
-
188
- # 1. Try to push (will be rejected)
189
- git push # -> "fetch first"
190
-
191
- # 2. Pull to create merge conflict
192
- git pull --no-rebase
193
- # -> CONFLICT in system/human.md
194
-
195
- # 3. View conflict markers
196
- cat system/human.md
197
- # <<<<<<< HEAD
198
- # your local changes
199
- # =======
200
- # server changes
201
- # >>>>>>> <commit>
202
-
203
- # 4. Resolve
204
- echo "final resolved content" > system/human.md
205
- git add system/human.md
206
- git commit -m "fix: resolved conflict in human block"
207
-
208
- # 5. Push resolution
209
- git push
210
- # -> API automatically updates with resolved content
211
- ```
108
+ The harness first tries a fast-forward pull. When a remote push is rejected
109
+ because the remote moved, post-turn sync tries `git pull --rebase` and retries
110
+ the push. If that rebase conflicts, the harness leaves the repository for
111
+ manual resolution and reports the affected files.
212
112
 
213
- ## Block Management
214
-
215
- ### Create New Block
113
+ Start by reading the current Git operation and every conflicted file:
216
114
 
217
115
  ```bash
218
- # Create file in system/ directory (automatically attached to agent)
219
- echo "My new block content" > system/new-block.md
220
- git add system/new-block.md
221
- git commit -m "feat: add new block"
222
- git push
223
- # -> Block automatically created and attached to agent
116
+ git -C "$MEMORY_DIR" status
117
+ git -C "$MEMORY_DIR" diff --name-only --diff-filter=U
224
118
  ```
225
119
 
226
- ### Delete/Detach Block
120
+ Resolve the conflict markers without deleting required frontmatter, then stage
121
+ the resolved files by name. Finish the operation Git reports:
227
122
 
228
123
  ```bash
229
- # Remove file from system/ directory
230
- git rm system/persona.md
231
- git commit -m "chore: remove persona block"
232
- git push
233
- # -> Block automatically detached from agent
234
- ```
124
+ git -C "$MEMORY_DIR" add system/example.md
235
125
 
236
- ## Directory Structure
126
+ # If git status says a rebase is in progress:
127
+ GIT_EDITOR=true git -C "$MEMORY_DIR" rebase --continue
237
128
 
238
- ```
239
- ~/.letta/agents/<agent-id>/
240
- ├── .letta/
241
- │ └── config.json # Agent metadata
242
- └── memory/ # Git repo root
243
- ├── .git/ # Git repo data
244
- └── system/ # System blocks (attached to agent)
245
- ├── human.md
246
- └── persona.md
129
+ # If git status says a merge is in progress:
130
+ git -C "$MEMORY_DIR" commit
247
131
  ```
248
132
 
249
- **System blocks** (`memory/system/`) are attached to the agent and appear in the agent's system prompt.
133
+ Do not start a new merge when a rebase is already in progress. Do not reset,
134
+ abort, or discard either side without the user's approval. When the repository
135
+ is clean and the merge or rebase is complete, the harness retries the hosted
136
+ push after a future turn.
250
137
 
251
- ## Requirements
138
+ ## Optional Backup Remote
252
139
 
253
- - Agent must have `git-memory-enabled` tag
254
- - Valid API key with agent access
255
- - Git installed locally
140
+ `/memory-repository` mirrors the agent's `main` branch to an additional Git
141
+ URL. This is separate from the hosted MemFS origin.
256
142
 
257
- ## Troubleshooting
258
-
259
- **Clone fails with "Authentication failed":**
260
- - Check local helper(s): `git -C ~/.letta/agents/<agent-id>/memory config --local --get-regexp '^credential\..*\.helper$'`
261
- - Check for conflicting global helper(s): `git config --global --get-regexp '^credential\..*letta\.com.*\.helper$'`
262
- - Reconfigure local helper: see Authentication section above
263
- - Verify the endpoint is reachable: `curl -u letta:$LETTA_API_KEY $LETTA_BASE_URL/v1/git/<agent-id>/state.git/info/refs?service=git-upload-pack`
264
-
265
- **Push/pull doesn't update API:**
266
- - Wait 2-3 seconds for webhook processing
267
- - Verify agent has `git-memory-enabled` tag
268
- - Check if you have write access to the agent
269
-
270
- **Harness setup failed (no .git/ after /memfs enable):**
271
- - Check debug logs (`LETTA_DEBUG=1`)
272
- - Follow "Enabling Git Memory (Manual)" steps above
273
-
274
- **Can't see changes immediately:**
275
- - Bidirectional sync has a 2-3 second delay for webhook processing
276
- - Use `git pull` to get latest API changes
277
- - Use `git fetch` to check remote without merging
143
+ ```text
144
+ /memory-repository set git@github.com:you/my-memory.git
145
+ /memory-repository status
146
+ /memory-repository push
147
+ /memory-repository unset
148
+ ```
149
+
150
+ `set` stores `letta.memoryRepository.url` in the MemFS repository's local Git
151
+ config, installs the post-commit hook, and attempts an initial push. Later
152
+ commits on `main` start a background mirror push. Mirror failures do not block
153
+ the commit; `/memory-repository status` shows the recent push log.
154
+
155
+ Use normal SSH or Git credential handling for the backup URL. Avoid embedding a
156
+ token in the URL because the URL is stored in `.git/config`. Use
157
+ `/memory-repository push` only for this optional backup remote, not for normal
158
+ MemFS synchronization.
159
+
160
+ ## Failure Checklist
161
+
162
+ 1. Confirm `$MEMORY_DIR` points to the active agent's repository.
163
+ 2. Check whether the backend is cloud-backed or local-only.
164
+ 3. Inspect `git status`, the origin URL, and the current Git operation.
165
+ 4. Use `/memfs enable` for a missing checkout and `/memfs sync` for a pull.
166
+ 5. Preserve frontmatter and finish any existing merge or rebase.
167
+ 6. Leave hosted pushes to post-turn sync once the repository is clean.
168
+ 7. If the command still fails, rerun it with `LETTA_DEBUG=1` and report the
169
+ redacted error. Never print or copy credential-helper values.