@letta-ai/letta-code 0.19.5 → 0.19.7
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 +758 -794
- package/package.json +2 -2
- package/scripts/latency-benchmark.ts +0 -2
- package/skills/initializing-memory/SKILL.md +48 -54
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letta-ai/letta-code",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.7",
|
|
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": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@letta-ai/letta-client": "
|
|
36
|
+
"@letta-ai/letta-client": "1.8.0",
|
|
37
37
|
"glob": "^13.0.0",
|
|
38
38
|
"highlight.js": "^11.11.1",
|
|
39
39
|
"ink-link": "^5.0.0",
|
|
@@ -61,7 +61,6 @@ const SCENARIOS: ScenarioConfig[] = [
|
|
|
61
61
|
args: [
|
|
62
62
|
"-p",
|
|
63
63
|
"What is 3+3? Reply with just the number.",
|
|
64
|
-
"--continue",
|
|
65
64
|
"--yolo",
|
|
66
65
|
"--output-format",
|
|
67
66
|
"json",
|
|
@@ -73,7 +72,6 @@ const SCENARIOS: ScenarioConfig[] = [
|
|
|
73
72
|
args: [
|
|
74
73
|
"-p",
|
|
75
74
|
"What is 5+5? Reply with just the number.",
|
|
76
|
-
"--continue",
|
|
77
75
|
"--yolo",
|
|
78
76
|
"--output-format",
|
|
79
77
|
"json",
|
|
@@ -16,23 +16,23 @@ If you are running as a background subagent (you cannot use AskUserQuestion):
|
|
|
16
16
|
- Use reasonable defaults for all preferences
|
|
17
17
|
- Any specific overrides will be provided in your initial prompt
|
|
18
18
|
|
|
19
|
-
## Your Goal:
|
|
19
|
+
## Your Goal: Organize Into a Hierarchical Memory Structure
|
|
20
20
|
|
|
21
|
-
Your goal is to **
|
|
21
|
+
Your goal is to **organize** memory into a **deeply hierarchical structure of small, focused files**.
|
|
22
22
|
|
|
23
23
|
### Target Output
|
|
24
24
|
|
|
25
25
|
| Metric | Target |
|
|
26
26
|
|--------|--------|
|
|
27
|
-
| **Total files** |
|
|
28
|
-
| **
|
|
29
|
-
| **Hierarchy depth** |
|
|
27
|
+
| **Total files** | Enough focused files to cover distinct concepts without bloating any single file |
|
|
28
|
+
| **File size** | Keep files concise and split when they become unwieldy |
|
|
29
|
+
| **Hierarchy depth** | Use nested `/` paths whenever they improve clarity (e.g., `project/tooling/bun.md`) |
|
|
30
30
|
| **Nesting requirement** | Every new file MUST be nested under a parent using `/` |
|
|
31
31
|
|
|
32
32
|
**Anti-patterns to avoid:**
|
|
33
|
-
- ❌ Ending with only
|
|
33
|
+
- ❌ Ending with only a few large files
|
|
34
34
|
- ❌ Flat naming (all files at top level)
|
|
35
|
-
- ❌ Mega-files with
|
|
35
|
+
- ❌ Mega-files with many unrelated sections
|
|
36
36
|
|
|
37
37
|
## Memory Filesystem Integration
|
|
38
38
|
|
|
@@ -45,27 +45,27 @@ Your memory is a git-backed filesystem at `~/.letta/agents/<agent-id>/`. The act
|
|
|
45
45
|
- The filesystem tree (all file paths + metadata) is always visible regardless of location
|
|
46
46
|
- You can use bash commands (`ls`, `mkdir`, `mv`, `git`) to organize files
|
|
47
47
|
- You MUST create a **deeply hierarchical file structure** — flat naming is NOT acceptable
|
|
48
|
-
-
|
|
48
|
+
- Create as many files as needed for clarity in `system/`, with additional reference files outside as needed
|
|
49
49
|
|
|
50
50
|
**MANDATORY principles for hierarchical organization:**
|
|
51
51
|
|
|
52
52
|
| Requirement | Target |
|
|
53
53
|
|-------------|--------|
|
|
54
|
-
| **Total files** |
|
|
55
|
-
| **
|
|
56
|
-
| **Hierarchy depth** |
|
|
54
|
+
| **Total files** | Enough focused files to avoid monoliths while staying maintainable |
|
|
55
|
+
| **File size** | Keep files concise and split when they become unwieldy |
|
|
56
|
+
| **Hierarchy depth** | Use meaningful nesting with `/` naming where it helps organization |
|
|
57
57
|
| **Nesting requirement** | EVERY new file MUST use `/` naming (no flat files) |
|
|
58
58
|
|
|
59
59
|
**Anti-patterns to avoid:**
|
|
60
|
-
- ❌ Creating only
|
|
60
|
+
- ❌ Creating only a few large files
|
|
61
61
|
- ❌ Flat naming (all files at top level like `project-commands.md`)
|
|
62
|
-
- ❌ Mega-files with
|
|
62
|
+
- ❌ Mega-files with many unrelated sections
|
|
63
63
|
|
|
64
64
|
**Rules:**
|
|
65
|
-
- Use
|
|
66
|
-
- Keep files **focused and
|
|
65
|
+
- Use clear nested paths for files whenever hierarchy improves discoverability (e.g., `project/tooling/bun.md`)
|
|
66
|
+
- Keep files **focused and concise**
|
|
67
67
|
- Use **descriptive paths** that make sense when you see just the filename
|
|
68
|
-
- Split when a file
|
|
68
|
+
- Split when a file starts mixing multiple concepts (be aggressive)
|
|
69
69
|
|
|
70
70
|
**Example target structure (what success looks like):**
|
|
71
71
|
|
|
@@ -93,7 +93,7 @@ system/
|
|
|
93
93
|
└── behavior.md # How to behave
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
This example
|
|
96
|
+
This example is illustrative. Your output should match the project’s actual complexity and the user’s needs.
|
|
97
97
|
|
|
98
98
|
This approach makes memory more **scannable**, **maintainable**, and **shareable** with other agents.
|
|
99
99
|
|
|
@@ -319,7 +319,7 @@ You should ask these questions at the start (bundle them together in one AskUser
|
|
|
319
319
|
2. **Identity**: "Which contributor are you?" (You can often infer this from git logs - e.g., if git shows "cpacker" as a top contributor, ask "Are you cpacker?")
|
|
320
320
|
3. **Related repos**: "Are there other repositories I should know about and consider in my research?" (e.g., backend monorepo, shared libraries)
|
|
321
321
|
4. **Historical sessions** (include this question if history data was found in step 2): "I found Claude Code / Codex history on your machine. Should I analyze it to learn your preferences, coding patterns, and project context? This significantly improves how I work with you but uses additional time and tokens." Options: "Yes, analyze history" / "Skip for now". Use "History" as the header.
|
|
322
|
-
5. **Memory updates**: "How often should I check
|
|
322
|
+
5. **Memory updates**: "How often should I check whether to update memory?" with options "Frequent" and "Occasional". This should be a binary question with "Memory" as the header.
|
|
323
323
|
6. **Communication style**: "Terse or detailed responses?"
|
|
324
324
|
7. **Any specific rules**: "Rules I should always follow?"
|
|
325
325
|
|
|
@@ -364,11 +364,11 @@ mkdir -p ~/.letta/agents/<agent-id>/memory/system/human/prefs
|
|
|
364
364
|
- **Every new file MUST use `/` naming** - no flat files allowed
|
|
365
365
|
- Use `/` for hierarchy: `project/tooling/testing` (not `project-tooling-testing`)
|
|
366
366
|
- File path determines the memory label: `system/project/overview.md` → label `project/overview`
|
|
367
|
-
- Keep files small and focused
|
|
367
|
+
- Keep files small and focused
|
|
368
368
|
- Use **descriptive frontmatter** — the `description` field helps your future self understand each file's purpose
|
|
369
369
|
|
|
370
370
|
**Checkpoint before proceeding:**
|
|
371
|
-
|
|
371
|
+
Review your proposed files and split further if the structure still feels too flat or monolithic.
|
|
372
372
|
|
|
373
373
|
**Benefits:**
|
|
374
374
|
- More scannable and maintainable
|
|
@@ -376,17 +376,17 @@ Count your proposed files. **If you have fewer than 15 files, go back and split
|
|
|
376
376
|
- Natural progressive disclosure (load parent, then drill into children)
|
|
377
377
|
- Works like a file system you're familiar with
|
|
378
378
|
|
|
379
|
-
### Split Aggressively
|
|
379
|
+
### Split Aggressively
|
|
380
380
|
|
|
381
|
-
**Don't create monolithic files.**
|
|
381
|
+
**Don't create monolithic files.** Be aggressive about splitting when it improves clarity:
|
|
382
382
|
|
|
383
383
|
**Split when:**
|
|
384
|
-
- A file
|
|
385
|
-
- A file
|
|
384
|
+
- A file becomes long enough that scanning it slows you down
|
|
385
|
+
- A file mixes distinct concepts that would be clearer if separated
|
|
386
386
|
- A section could stand alone as its own file
|
|
387
387
|
- You can name the extracted content with a clear `/` path
|
|
388
388
|
|
|
389
|
-
If a file is getting long
|
|
389
|
+
If a file is getting long or conceptually mixed, split it:
|
|
390
390
|
|
|
391
391
|
**Without memory filesystem** (flat naming - acceptable but not ideal):
|
|
392
392
|
- `project-overview`: High-level description, tech stack, repo links
|
|
@@ -402,7 +402,7 @@ If a file is getting long (>40 lines), split it:
|
|
|
402
402
|
- `project/architecture`: Directory structure, key modules
|
|
403
403
|
- `project/gotchas`: Footguns, things to watch out for
|
|
404
404
|
- **Must further nest**: `project/tooling/testing`, `project/tooling/linting`, `project/tooling/bun`
|
|
405
|
-
-
|
|
405
|
+
- If commands are broad, split into focused files like `project/commands/dev`, `project/commands/build`, etc.
|
|
406
406
|
|
|
407
407
|
This makes memory more scannable and easier to update and share with other agents.
|
|
408
408
|
|
|
@@ -456,9 +456,9 @@ And add memory files that you think make sense to add (e.g., `project/architectu
|
|
|
456
456
|
|
|
457
457
|
9. **Create/update memory structure** (can happen incrementally alongside steps 7-8):
|
|
458
458
|
- **With memfs enabled**: Create a deeply hierarchical file structure using bash commands
|
|
459
|
-
- Use `mkdir -p` to create subdirectories
|
|
459
|
+
- Use `mkdir -p` to create subdirectories as needed
|
|
460
460
|
- Create `.md` files for memory files using `/` naming
|
|
461
|
-
-
|
|
461
|
+
- Be aggressive about splitting when it improves clarity
|
|
462
462
|
- Use nested paths like `project/tooling/testing.md` (never flat like `project-testing.md`)
|
|
463
463
|
- **Every new file MUST be nested** under a parent using `/`
|
|
464
464
|
- **Every new file MUST be nested** under a parent using `/`
|
|
@@ -466,10 +466,9 @@ And add memory files that you think make sense to add (e.g., `project/architectu
|
|
|
466
466
|
- **Don't wait until the end** - write findings as you go
|
|
467
467
|
|
|
468
468
|
**Checkpoint verification:**
|
|
469
|
-
-
|
|
470
|
-
-
|
|
471
|
-
-
|
|
472
|
-
- **Should be 2-3 levels deep** minimum
|
|
469
|
+
- Review file count and shape: `find ~/.letta/agents/<agent-id>/memory/system/ -type f | wc -l`
|
|
470
|
+
- Review hierarchy depth: `find ~/.letta/agents/<agent-id>/memory/system/ -type f | awk -F/ '{print NF}' | sort -n | tail -1`
|
|
471
|
+
- Verify the structure feels appropriately granular and discoverable for this project
|
|
473
472
|
|
|
474
473
|
10. **Organize incrementally**:
|
|
475
474
|
- Start with a basic structure
|
|
@@ -487,14 +486,13 @@ And add memory files that you think make sense to add (e.g., `project/architectu
|
|
|
487
486
|
|
|
488
487
|
Before finishing, you MUST do a reflection step. **Your memory files are visible to you in your system prompt right now.** Look at them carefully and ask yourself:
|
|
489
488
|
|
|
490
|
-
1. **File
|
|
491
|
-
-
|
|
492
|
-
-
|
|
493
|
-
- Too few files means they're too large - split more aggressively
|
|
489
|
+
1. **File granularity check**:
|
|
490
|
+
- Review your memory file set: `find ~/.letta/agents/<agent-id>/memory/system/ -type f | wc -l`
|
|
491
|
+
- Ask whether any files are still too broad and should be split
|
|
494
492
|
|
|
495
493
|
2. **Hierarchy check**:
|
|
496
494
|
- Are ALL new files using `/` naming? (e.g., `project/tooling/bun.md`)
|
|
497
|
-
-
|
|
495
|
+
- Is the nesting meaningful for this project?
|
|
498
496
|
- Are there any flat files like `project-commands.md`? **These should be nested**
|
|
499
497
|
|
|
500
498
|
3. **Redundancy check**: Are there files with overlapping content? Either literally overlapping (due to errors while editing), or semantically/conceptually overlapping?
|
|
@@ -545,7 +543,7 @@ cat ~/.letta/agents/<agent-id>/memory/system/persona.md
|
|
|
545
543
|
❌ `project_testing.md` (underscore instead of `/`)
|
|
546
544
|
|
|
547
545
|
```bash
|
|
548
|
-
# Create
|
|
546
|
+
# Create a nested directory structure suited to the content
|
|
549
547
|
mkdir -p ~/.letta/agents/<agent-id>/memory/system/project/{tooling,architecture,conventions}
|
|
550
548
|
mkdir -p ~/.letta/agents/<agent-id>/memory/system/human/prefs
|
|
551
549
|
mkdir -p ~/.letta/agents/<agent-id>/memory/system/persona/behavior
|
|
@@ -584,22 +582,22 @@ mv ~/.letta/agents/<agent-id>/memory/system/project/tooling.md \
|
|
|
584
582
|
|
|
585
583
|
Before you tell the user you're done, confirm:
|
|
586
584
|
|
|
587
|
-
- [ ] **File
|
|
585
|
+
- [ ] **File granularity is appropriate** — verify no files are overly broad and split where useful.
|
|
588
586
|
- [ ] **All new files use `/` naming** — No flat files like `my_notes.md` or `project-commands.md`
|
|
589
|
-
- [ ] **Hierarchy is
|
|
590
|
-
- [ ] **No file
|
|
591
|
-
- [ ] **Each file
|
|
587
|
+
- [ ] **Hierarchy is meaningful** — nested paths should improve discoverability and organization.
|
|
588
|
+
- [ ] **No file is bloated** — split files that are hard to scan quickly.
|
|
589
|
+
- [ ] **Each file stays concept-focused** — split files that combine unrelated topics.
|
|
592
590
|
- [ ] **Every file has real content** — No empty or pointer-only files
|
|
593
591
|
- [ ] **Verify sync**: After creating files, check they appear in your memory files
|
|
594
592
|
|
|
595
|
-
**If
|
|
593
|
+
**If the structure still feels flat or monolithic, split further until it is clear and maintainable.**
|
|
596
594
|
|
|
597
595
|
### Best Practices
|
|
598
596
|
|
|
599
597
|
1. **Check memfs status first**: Look for `memory_filesystem` section in your system prompt
|
|
600
598
|
2. **Start with directories**: Create the directory structure before populating files
|
|
601
|
-
3. **Use
|
|
602
|
-
4. **Keep files focused**:
|
|
599
|
+
3. **Use practical paths**: prefer clear, readable nesting (e.g., `project/tooling/testing`) over unnecessarily deep paths.
|
|
600
|
+
4. **Keep files focused**: each file should cover a coherent concept and remain easy to scan.
|
|
603
601
|
5. **Every file should have real content** — no empty or pointer-only files
|
|
604
602
|
6. **Be aggressive about splitting**: If in doubt, split. Too many small files is better than too few large ones.
|
|
605
603
|
|
|
@@ -636,15 +634,11 @@ LINES=$(wc -l < ~/.claude/history.jsonl)
|
|
|
636
634
|
CHUNK_SIZE=$(( LINES / NUM_WORKERS + 1 ))
|
|
637
635
|
split -l $CHUNK_SIZE ~/.claude/history.jsonl "$SPLIT_DIR/claude-"
|
|
638
636
|
|
|
639
|
-
# Split Codex history
|
|
637
|
+
# Split Codex history if it exists
|
|
640
638
|
if [ -f ~/.codex/history.jsonl ]; then
|
|
641
639
|
LINES=$(wc -l < ~/.codex/history.jsonl)
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
split -l $CHUNK_SIZE ~/.codex/history.jsonl "$SPLIT_DIR/codex-"
|
|
645
|
-
else
|
|
646
|
-
cp ~/.codex/history.jsonl "$SPLIT_DIR/codex-aa"
|
|
647
|
-
fi
|
|
640
|
+
CHUNK_SIZE=$(( LINES / NUM_WORKERS + 1 ))
|
|
641
|
+
split -l $CHUNK_SIZE ~/.codex/history.jsonl "$SPLIT_DIR/codex-"
|
|
648
642
|
fi
|
|
649
643
|
|
|
650
644
|
# Rename to .jsonl for clarity
|
|
@@ -702,12 +696,12 @@ After merging, **read every file in `system/`** and apply editorial judgment:
|
|
|
702
696
|
|
|
703
697
|
Workers may have created files that don't fit the ideal hierarchy, or put too much into `system/`. Fix this:
|
|
704
698
|
|
|
705
|
-
- Split oversized
|
|
699
|
+
- Split oversized or conceptually mixed files into focused sub-files
|
|
706
700
|
- Move reference-quality content (detailed history, background context, evidence trails) to `reference/`
|
|
707
701
|
- Ensure `system/` contains only what you genuinely need in-context: identity, active preferences, current project context, behavioral rules, gotchas
|
|
708
702
|
- Merge near-duplicate files that cover the same topic
|
|
709
703
|
|
|
710
|
-
**Rule of thumb**: If removing a file from `system/` wouldn't
|
|
704
|
+
**Rule of thumb**: If removing a file from `system/` wouldn't materially affect near-term responses, it belongs in `reference/`.
|
|
711
705
|
|
|
712
706
|
**3d. Clean up worktrees and branches:**
|
|
713
707
|
|