@letta-ai/letta-code 0.16.9 → 0.16.11
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/letta.js +7689 -17024
- package/package.json +1 -1
- package/skills/defragmenting-memory/SKILL.md +35 -18
package/package.json
CHANGED
|
@@ -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.
|
|
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
|
|
33
|
+
### Step 1: Commit Current State (Safety Net)
|
|
36
34
|
|
|
37
|
-
|
|
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
|
|
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
|
|
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:
|
|
171
|
+
// Step 1: Commit current state (MANDATORY)
|
|
161
172
|
Bash({
|
|
162
|
-
command: "letta
|
|
163
|
-
description: "
|
|
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
|
-
//
|
|
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,
|
|
191
|
+
If something goes wrong, use git to revert:
|
|
181
192
|
|
|
182
193
|
```bash
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
#
|
|
187
|
-
|
|
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
|
|
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
|
|