@letta-ai/letta-code 0.16.9 → 0.16.10

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letta-ai/letta-code",
3
- "version": "0.16.9",
3
+ "version": "0.16.10",
4
4
  "description": "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,13 +13,11 @@ description: Decomposes and reorganizes agent memory blocks into focused, single
13
13
  >
14
14
  > **To enable:** Ask the user to run `/memfs enable`, then reload the CLI.
15
15
 
16
- This skill helps you maintain clean, well-organized memory blocks by:
17
- 1. Creating a safety backup of the memfs directory
18
- 2. Using a subagent to decompose and reorganize the memory files in-place
16
+ This skill helps you maintain clean, well-organized memory blocks by spawning a subagent to decompose and reorganize memory files in-place.
19
17
 
20
18
  The focus is on **decomposition**—splitting large, multi-purpose blocks into focused, single-purpose components—rather than consolidation.
21
19
 
22
- Memory files live at `~/.letta/agents/$LETTA_AGENT_ID/memory/` and are synced to API blocks automatically by **memfs sync** on CLI startup. There is no separate backup/restore step needed.
20
+ Memory files live at `~/.letta/agents/$LETTA_AGENT_ID/memory/` and are synced to API blocks automatically by **memfs sync** on CLI startup.
23
21
 
24
22
  ## When to Use
25
23
 
@@ -32,15 +30,17 @@ Memory files live at `~/.letta/agents/$LETTA_AGENT_ID/memory/` and are synced to
32
30
 
33
31
  ## Workflow
34
32
 
35
- ### Step 1: Safety Backup
33
+ ### Step 1: Commit Current State (Safety Net)
36
34
 
37
- Before the subagent edits files, create a timestamped backup of the memfs directory:
35
+ The memory directory is a git repo. Commit the current state so you can rollback if needed:
38
36
 
39
37
  ```bash
40
- letta memfs backup --agent $LETTA_AGENT_ID
38
+ cd ~/.letta/agents/$LETTA_AGENT_ID/memory
39
+ git add -A
40
+ git commit -m "chore: pre-defrag snapshot" || echo "No changes to commit"
41
41
  ```
42
42
 
43
- ⚠️ **CRITICAL**: You MUST complete the backup before proceeding to Step 2. The backup is your safety net.
43
+ ⚠️ **CRITICAL**: You MUST commit before proceeding. This is your rollback point.
44
44
 
45
45
  ### Step 2: Spawn Subagent to Edit Memory Files
46
46
 
@@ -154,13 +154,24 @@ The subagent will:
154
154
 
155
155
  After the subagent finishes, **memfs sync will automatically propagate changes** to API blocks on the next CLI startup. No manual restore step is needed.
156
156
 
157
+ ### Step 3: Commit Changes
158
+
159
+ After the subagent finishes, commit the changes:
160
+
161
+ ```bash
162
+ cd ~/.letta/agents/$LETTA_AGENT_ID/memory
163
+ git add -A
164
+ git commit -m "chore: defragment memory blocks"
165
+ git push
166
+ ```
167
+
157
168
  ## Example Complete Flow
158
169
 
159
170
  ```typescript
160
- // Step 1: Safety backup (MANDATORY)
171
+ // Step 1: Commit current state (MANDATORY)
161
172
  Bash({
162
- command: "letta memfs backup --agent $LETTA_AGENT_ID",
163
- description: "Backup memfs directory before defrag"
173
+ command: "cd ~/.letta/agents/$LETTA_AGENT_ID/memory && git add -A && git commit -m 'chore: pre-defrag snapshot' || echo 'No changes'",
174
+ description: "Commit current memory state as rollback point"
164
175
  })
165
176
 
166
177
  // Step 2: Spawn subagent to decompose and reorganize (runs async in background)
@@ -171,20 +182,26 @@ Task({
171
182
  prompt: "Decompose and reorganize memory files in ~/.letta/agents/$LETTA_AGENT_ID/memory/system/. These files sync directly to API blocks via memfs. Be aggressive about splitting large multi-section blocks into many smaller, single-purpose blocks using hierarchical / naming. Skip memory_filesystem.md and .sync-state.json. Structure with markdown headers and bullets. Remove redundancy and speculation. Resolve contradictions. Organize logically. Each block should have ONE clear purpose. Report files created, modified, deleted, before/after character counts, and rationale for changes."
172
183
  })
173
184
 
174
- // No Step 3 needed memfs sync handles propagation to API blocks
185
+ // Step 3: After subagent completes, commit and push
175
186
  // Check progress with /task <task_id>, restart CLI to sync when done
176
187
  ```
177
188
 
178
189
  ## Rollback
179
190
 
180
- If something goes wrong, restore from the safety backup:
191
+ If something goes wrong, use git to revert:
181
192
 
182
193
  ```bash
183
- # Find backups
184
- letta memfs backups --agent $LETTA_AGENT_ID
194
+ cd ~/.letta/agents/$LETTA_AGENT_ID/memory
195
+
196
+ # Option 1: Reset to last commit (discard all uncommitted changes)
197
+ git reset --hard HEAD~1
198
+
199
+ # Option 2: View history and reset to specific commit
200
+ git log --oneline -5
201
+ git reset --hard <commit-hash>
185
202
 
186
- # Restore from a specific backup (replace the current memory dir)
187
- letta memfs restore --agent $LETTA_AGENT_ID --from memory-backup-<TIMESTAMP> --force
203
+ # Push the rollback
204
+ git push --force
188
205
  ```
189
206
 
190
207
  On next CLI startup, memfs sync will detect the changes and update API blocks accordingly.
@@ -202,7 +219,7 @@ The subagent focuses on decomposing and cleaning up files. It has full tool acce
202
219
  - Resolves contradictions with clear, concrete guidance
203
220
  - Organizes content logically (general to specific, by importance)
204
221
  - Provides detailed before/after reports including decomposition rationale
205
- - Does NOT run any backup or restore scripts
222
+ - Does NOT run any git commands (parent agent handles that)
206
223
 
207
224
  The focus is on decomposition—breaking apart large monolithic blocks into focused, specialized components rather than consolidating them together.
208
225