@letta-ai/letta-code 0.14.4 → 0.14.6

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.14.4",
3
+ "version": "0.14.6",
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": {
@@ -64,10 +64,11 @@ Browse these repositories to discover available skills. Check the README for ski
64
64
 
65
65
  | Location | Path | When to Use |
66
66
  |----------|------|-------------|
67
+ | **Agent-scoped** | `~/.letta/agents/<agent-id>/skills/<skill>/` | Skills for a single agent (default for agent-specific capabilities) |
67
68
  | **Global** | `~/.letta/skills/<skill>/` | General-purpose skills useful across projects |
68
69
  | **Project** | `.skills/<skill>/` | Project-specific skills |
69
70
 
70
- **Rule**: If useful across multiple projects, install globally. If project-specific, install in `.skills/`.
71
+ **Rule**: Default to **agent-scoped** for changes that should apply only to the current agent. Use **project** for repo-specific skills. Use **global** only if all agents should inherit the skill.
71
72
 
72
73
  ## How to Download Skills
73
74
 
@@ -80,10 +81,12 @@ Skills are directories containing SKILL.md and optionally scripts/, references/,
80
81
  git clone --depth 1 https://github.com/anthropics/skills /tmp/skills-temp
81
82
 
82
83
  # 2. Copy the skill to your skills directory
84
+ # For agent-scoped (recommended default):
85
+ cp -r /tmp/skills-temp/skills/webapp-testing ~/.letta/agents/<agent-id>/skills/
83
86
  # For global:
84
- cp -r /tmp/skills-temp/skills/webapp-testing ~/.letta/skills/
87
+ # cp -r /tmp/skills-temp/skills/webapp-testing ~/.letta/skills/
85
88
  # For project:
86
- cp -r /tmp/skills-temp/skills/webapp-testing .skills/
89
+ # cp -r /tmp/skills-temp/skills/webapp-testing .skills/
87
90
 
88
91
  # 3. Cleanup
89
92
  rm -rf /tmp/skills-temp
@@ -93,7 +96,7 @@ rm -rf /tmp/skills-temp
93
96
 
94
97
  ```bash
95
98
  git clone --depth 1 https://github.com/anthropics/skills /tmp/skills-temp
96
- rsync -av /tmp/skills-temp/skills/webapp-testing/ ~/.letta/skills/webapp-testing/
99
+ rsync -av /tmp/skills-temp/skills/webapp-testing/ ~/.letta/agents/<agent-id>/skills/webapp-testing/
97
100
  rm -rf /tmp/skills-temp
98
101
  ```
99
102
 
@@ -106,6 +109,7 @@ Skill(command: "refresh")
106
109
  ```
107
110
 
108
111
  This scans `~/.letta/skills/` and `.skills/` and updates your `skills` memory block.
112
+ Agent-scoped skills under `~/.letta/agents/<agent-id>/skills/` are included in the scan as well.
109
113
 
110
114
  ## Complete Example
111
115
 
@@ -117,7 +121,7 @@ User asks: "Can you help me test my React app's UI?"
117
121
  4. **Download** (trusted source):
118
122
  ```bash
119
123
  git clone --depth 1 https://github.com/anthropics/skills /tmp/skills-temp
120
- cp -r /tmp/skills-temp/skills/webapp-testing ~/.letta/skills/
124
+ cp -r /tmp/skills-temp/skills/webapp-testing ~/.letta/agents/<agent-id>/skills/
121
125
  rm -rf /tmp/skills-temp
122
126
  ```
123
127
  5. **Refresh**: `Skill(command: "refresh")`
@@ -37,7 +37,7 @@ Memory files live at `~/.letta/agents/$LETTA_AGENT_ID/memory/` and are synced to
37
37
  Before the subagent edits files, create a timestamped backup of the memfs directory:
38
38
 
39
39
  ```bash
40
- cp -r ~/.letta/agents/$LETTA_AGENT_ID/memory/ ~/.letta/agents/$LETTA_AGENT_ID/memory-backup-$(date +%Y%m%d-%H%M%S)/
40
+ letta memfs backup --agent $LETTA_AGENT_ID
41
41
  ```
42
42
 
43
43
  ⚠️ **CRITICAL**: You MUST complete the backup before proceeding to Step 2. The backup is your safety net.
@@ -160,7 +160,7 @@ After the subagent finishes, **memfs sync will automatically propagate changes**
160
160
  ```typescript
161
161
  // Step 1: Safety backup (MANDATORY)
162
162
  Bash({
163
- command: "cp -r ~/.letta/agents/$LETTA_AGENT_ID/memory/ ~/.letta/agents/$LETTA_AGENT_ID/memory-backup-$(date +%Y%m%d-%H%M%S)/",
163
+ command: "letta memfs backup --agent $LETTA_AGENT_ID",
164
164
  description: "Backup memfs directory before defrag"
165
165
  })
166
166
 
@@ -180,11 +180,10 @@ If something goes wrong, restore from the safety backup:
180
180
 
181
181
  ```bash
182
182
  # Find backups
183
- ls -la ~/.letta/agents/$LETTA_AGENT_ID/memory-backup-*/
183
+ letta memfs backups --agent $LETTA_AGENT_ID
184
184
 
185
185
  # Restore from a specific backup (replace the current memory dir)
186
- rm -rf ~/.letta/agents/$LETTA_AGENT_ID/memory/
187
- cp -r ~/.letta/agents/$LETTA_AGENT_ID/memory-backup-<TIMESTAMP>/ ~/.letta/agents/$LETTA_AGENT_ID/memory/
186
+ letta memfs restore --agent $LETTA_AGENT_ID --from memory-backup-<TIMESTAMP> --force
188
187
  ```
189
188
 
190
189
  On next CLI startup, memfs sync will detect the changes and update API blocks accordingly.
@@ -15,10 +15,10 @@ This skill helps you find other agents on the same Letta server.
15
15
  - You need to find an agent ID for memory migration
16
16
  - You found an agent_id via message search and need details about that agent
17
17
 
18
- ## Script Usage
18
+ ## CLI Usage
19
19
 
20
20
  ```bash
21
- npx tsx <SKILL_DIR>/scripts/find-agents.ts [options]
21
+ letta agents list [options]
22
22
  ```
23
23
 
24
24
  ### Options
@@ -39,7 +39,7 @@ npx tsx <SKILL_DIR>/scripts/find-agents.ts [options]
39
39
  Agents created by Letta Code are tagged with `origin:letta-code`. To find only Letta Code agents:
40
40
 
41
41
  ```bash
42
- npx tsx <SKILL_DIR>/scripts/find-agents.ts --tags "origin:letta-code"
42
+ letta agents list --tags "origin:letta-code"
43
43
  ```
44
44
 
45
45
  This is useful when the user is looking for agents they've worked with in Letta Code CLI sessions.
@@ -49,39 +49,39 @@ This is useful when the user is looking for agents they've worked with in Letta
49
49
  If the user has agents created outside Letta Code (via ADE, SDK, etc.), search without the tag filter:
50
50
 
51
51
  ```bash
52
- npx tsx <SKILL_DIR>/scripts/find-agents.ts
52
+ letta agents list
53
53
  ```
54
54
 
55
55
  ## Examples
56
56
 
57
57
  **List all agents (up to 20):**
58
58
  ```bash
59
- npx tsx <SKILL_DIR>/scripts/find-agents.ts
59
+ letta agents list
60
60
  ```
61
61
 
62
62
  **Find agent by exact name:**
63
63
  ```bash
64
- npx tsx <SKILL_DIR>/scripts/find-agents.ts --name "ProjectX-v1"
64
+ letta agents list --name "ProjectX-v1"
65
65
  ```
66
66
 
67
67
  **Search agents by name (fuzzy):**
68
68
  ```bash
69
- npx tsx <SKILL_DIR>/scripts/find-agents.ts --query "project"
69
+ letta agents list --query "project"
70
70
  ```
71
71
 
72
72
  **Find only Letta Code agents:**
73
73
  ```bash
74
- npx tsx <SKILL_DIR>/scripts/find-agents.ts --tags "origin:letta-code"
74
+ letta agents list --tags "origin:letta-code"
75
75
  ```
76
76
 
77
77
  **Find agents with multiple tags:**
78
78
  ```bash
79
- npx tsx <SKILL_DIR>/scripts/find-agents.ts --tags "frontend,production" --match-all-tags
79
+ letta agents list --tags "frontend,production" --match-all-tags
80
80
  ```
81
81
 
82
82
  **Include memory blocks in results:**
83
83
  ```bash
84
- npx tsx <SKILL_DIR>/scripts/find-agents.ts --query "project" --include-blocks
84
+ letta agents list --query "project" --include-blocks
85
85
  ```
86
86
 
87
87
  ## Output
@@ -105,11 +105,11 @@ If you need to find which agent worked on a specific topic:
105
105
  1. Load both skills: `searching-messages` and `finding-agents`
106
106
  2. Search messages across all agents:
107
107
  ```bash
108
- search-messages.ts --query "topic" --all-agents --limit 10
108
+ letta messages search --query "topic" --all-agents --limit 10
109
109
  ```
110
110
  3. Note the `agent_id` values from matching messages
111
111
  4. Get agent details:
112
112
  ```bash
113
- find-agents.ts --query "partial-name"
113
+ letta agents list --query "partial-name"
114
114
  ```
115
115
  Or use the agent_id directly in the Letta API
@@ -47,37 +47,37 @@ If you don't have a specific agent ID, use these skills to find one:
47
47
  ### By Name or Tags
48
48
  Load the `finding-agents` skill to search for agents:
49
49
  ```bash
50
- npx tsx <FINDING_AGENTS_SKILL_DIR>/scripts/find-agents.ts --query "agent-name"
51
- npx tsx <FINDING_AGENTS_SKILL_DIR>/scripts/find-agents.ts --tags "origin:letta-code"
50
+ letta agents list --query "agent-name"
51
+ letta agents list --tags "origin:letta-code"
52
52
  ```
53
53
 
54
54
  ### By Topic They Discussed
55
55
  Load the `searching-messages` skill to find which agent worked on something:
56
56
  ```bash
57
- npx tsx <SEARCHING_MESSAGES_SKILL_DIR>/scripts/search-messages.ts --query "topic" --all-agents
57
+ letta messages search --query "topic" --all-agents
58
58
  ```
59
59
  Results include `agent_id` for each matching message.
60
60
 
61
- ## Script Usage
61
+ ## CLI Usage (agent-to-agent)
62
62
 
63
63
  ### Starting a New Conversation
64
64
 
65
65
  ```bash
66
- npx tsx <SKILL_DIR>/scripts/start-conversation.ts --agent-id <id> --message "<text>"
66
+ letta -p --from-agent $LETTA_AGENT_ID --agent <id> "message text"
67
67
  ```
68
68
 
69
69
  **Arguments:**
70
70
  | Arg | Required | Description |
71
71
  |-----|----------|-------------|
72
- | `--agent-id <id>` | Yes | Target agent ID to message |
73
- | `--message <text>` | Yes | Message to send |
74
- | `--timeout <ms>` | No | Max wait time in ms (default: 120000) |
72
+ | `--agent <id>` | Yes | Target agent ID to message |
73
+ | `--from-agent <id>` | Yes | Sender agent ID (injects agent-to-agent system reminder) |
74
+ | `"message text"` | Yes | Message body (positional after flags) |
75
75
 
76
76
  **Example:**
77
77
  ```bash
78
- npx tsx <SKILL_DIR>/scripts/start-conversation.ts \
79
- --agent-id agent-abc123 \
80
- --message "What do you know about the authentication system?"
78
+ letta -p --from-agent $LETTA_AGENT_ID \
79
+ --agent agent-abc123 \
80
+ "What do you know about the authentication system?"
81
81
  ```
82
82
 
83
83
  **Response:**
@@ -93,28 +93,28 @@ npx tsx <SKILL_DIR>/scripts/start-conversation.ts \
93
93
  ### Continuing a Conversation
94
94
 
95
95
  ```bash
96
- npx tsx <SKILL_DIR>/scripts/continue-conversation.ts --conversation-id <id> --message "<text>"
96
+ letta -p --from-agent $LETTA_AGENT_ID --conversation <id> "message text"
97
97
  ```
98
98
 
99
99
  **Arguments:**
100
100
  | Arg | Required | Description |
101
101
  |-----|----------|-------------|
102
- | `--conversation-id <id>` | Yes | Existing conversation ID |
103
- | `--message <text>` | Yes | Follow-up message to send |
104
- | `--timeout <ms>` | No | Max wait time in ms (default: 120000) |
102
+ | `--conversation <id>` | Yes | Existing conversation ID |
103
+ | `--from-agent <id>` | Yes | Sender agent ID (injects agent-to-agent system reminder) |
104
+ | `"message text"` | Yes | Follow-up message (positional after flags) |
105
105
 
106
106
  **Example:**
107
107
  ```bash
108
- npx tsx <SKILL_DIR>/scripts/continue-conversation.ts \
109
- --conversation-id conversation-xyz789 \
110
- --message "Can you explain more about the token refresh flow?"
108
+ letta -p --from-agent $LETTA_AGENT_ID \
109
+ --conversation conversation-xyz789 \
110
+ "Can you explain more about the token refresh flow?"
111
111
  ```
112
112
 
113
113
  ## Understanding the Response
114
114
 
115
115
  - Scripts return only the **final assistant message** (not tool calls or reasoning)
116
116
  - The target agent may use tools, think, and reason - but you only see their final response
117
- - To see the full conversation transcript (including tool calls), use the `searching-messages` skill with `--agent-id` targeting the other agent
117
+ - To see the full conversation transcript (including tool calls), use the `searching-messages` skill with `letta messages list --agent <id>` targeting the other agent
118
118
 
119
119
  ## How It Works
120
120
 
@@ -7,6 +7,14 @@ description: Migrate memory blocks from an existing agent to the current agent.
7
7
 
8
8
  This skill helps migrate memory blocks from an existing agent to a new agent, similar to macOS Migration Assistant for AI agents.
9
9
 
10
+ > **Requires Memory Filesystem (memfs)**
11
+ >
12
+ > This workflow is memfs-first. If memfs is enabled, do **not** use the legacy block commands — they can conflict with file-based edits.
13
+ >
14
+ > **To check:** Look for a `memory_filesystem` block in your system prompt. If it shows a tree structure starting with `/memory/` including a `system/` directory, memfs is enabled.
15
+ >
16
+ > **To enable:** Ask the user to run `/memfs enable`, then reload the CLI.
17
+
10
18
  ## When to Use This Skill
11
19
 
12
20
  - User is setting up a new agent that should inherit memory from an existing one
@@ -14,30 +22,42 @@ This skill helps migrate memory blocks from an existing agent to a new agent, si
14
22
  - User is replacing an old agent with a new one
15
23
  - User mentions they have an existing agent with useful memory
16
24
 
17
- ## Migration Methods
25
+ ## Migration Method (memfs-first)
26
+
27
+ ### Export → Copy → Sync
18
28
 
19
- ### 1. Manual Copy (Recommended for partial content)
29
+ This is the recommended flow:
20
30
 
21
- If you only need **part** of a source block, or the source is messy and needs cleanup:
22
- 1. Use `get-agent-blocks.ts` to view the source block's content
23
- 2. Use the `memory` tool to create a new block with just the content you want
24
- 3. No scripts needed - you have full control over what gets copied
31
+ 1. **Export the source agent's memfs to a temp directory**
32
+ ```bash
33
+ letta memfs export --agent <source-agent-id> --out /tmp/letta-memfs-<source-agent-id>
34
+ ```
25
35
 
26
- Best for: Extracting sections, cleaning up messy content, selective migration.
36
+ 2. **Copy the files you want into your own memfs**
37
+ - `system/` = attached blocks (always loaded)
38
+ - root = detached blocks
27
39
 
28
- ### 2. Script Copy (Full block duplication)
40
+ Example:
41
+ ```bash
42
+ cp -r /tmp/letta-memfs-agent-abc123/system/project ~/.letta/agents/$LETTA_AGENT_ID/memory/system/
43
+ cp /tmp/letta-memfs-agent-abc123/notes.md ~/.letta/agents/$LETTA_AGENT_ID/memory/
44
+ ```
29
45
 
30
- Creates new blocks with the same content using `copy-block.ts`. After copying:
31
- - You own the copy - changes don't sync
32
- - Best for: One-time migration, forking an agent
46
+ 3. **Sync to API**
47
+ ```bash
48
+ letta memfs sync --agent $LETTA_AGENT_ID
49
+ ```
33
50
 
34
- ### 3. Share (Linked Blocks)
51
+ This gives you full control over what you bring across and keeps everything consistent with memfs.
35
52
 
36
- Attaches the same block to multiple agents using `attach-block.ts`. After sharing:
37
- - All agents see the same block content
38
- - Changes by any agent are visible to all others
39
- - Can be read-only (target can read but not modify)
40
- - Best for: Shared knowledge bases, synchronized state
53
+ ## Legacy Fallback (only if memfs is disabled)
54
+
55
+ If memfs is **not enabled**, you can use block-level commands:
56
+ - `letta blocks list`
57
+ - `letta blocks copy`
58
+ - `letta blocks attach`
59
+
60
+ ⚠️ **Do not use these if memfs is enabled** — they can diverge from file-based edits.
41
61
 
42
62
  ## Handling Duplicate Label Errors
43
63
 
@@ -47,13 +67,13 @@ Attaches the same block to multiple agents using `attach-block.ts`. After sharin
47
67
 
48
68
  1. **Use `--label` (copy only):** Rename the block when copying:
49
69
  ```bash
50
- npx tsx <SKILL_DIR>/scripts/copy-block.ts --block-id <id> --label project-imported
70
+ letta blocks copy --block-id <id> --label project-imported
51
71
  ```
52
72
 
53
73
  2. **Use `--override` (copy or attach):** Automatically detach your existing block first:
54
74
  ```bash
55
- npx tsx <SKILL_DIR>/scripts/copy-block.ts --block-id <id> --override
56
- npx tsx <SKILL_DIR>/scripts/attach-block.ts --block-id <id> --override
75
+ letta blocks copy --block-id <id> --override
76
+ letta blocks attach --block-id <id> --override
57
77
  ```
58
78
  If the operation fails, the original block is automatically reattached.
59
79
 
@@ -63,7 +83,7 @@ Attaches the same block to multiple agents using `attach-block.ts`. After sharin
63
83
  ```
64
84
  Then run the copy/attach script.
65
85
 
66
- **Note:** `attach-block.ts` does NOT support `--label` because attached blocks keep their original label (they're shared, not copied).
86
+ **Note:** `letta blocks attach` does NOT support `--label` because attached blocks keep their original label (they're shared, not copied).
67
87
 
68
88
  ## Workflow
69
89
 
@@ -78,55 +98,6 @@ Skill({ command: "load", skills: ["finding-agents"] })
78
98
 
79
99
  Example: "What's the ID of the agent you want to migrate memory from?"
80
100
 
81
- ### Step 2: View Source Agent's Blocks
82
-
83
- Inspect what memory blocks the source agent has:
84
-
85
- ```bash
86
- npx tsx <SKILL_DIR>/scripts/get-agent-blocks.ts --agent-id <source-agent-id>
87
- ```
88
-
89
- This shows each block's ID, label, description, and value.
90
-
91
- ### Step 3: Migrate Blocks
92
-
93
- For each block you want to migrate, choose copy or share:
94
-
95
- **To Copy (create independent block):**
96
- ```bash
97
- npx tsx <SKILL_DIR>/scripts/copy-block.ts --block-id <block-id> [--label <new-label>]
98
- ```
99
-
100
- Use `--label` if you already have a block with that label (e.g., `--label project-imported`).
101
-
102
- **To Share (attach existing block):**
103
- ```bash
104
- npx tsx <SKILL_DIR>/scripts/attach-block.ts --block-id <block-id>
105
- ```
106
-
107
- Add `--read-only` flag to share to make this agent unable to modify the block.
108
-
109
- Note: These scripts automatically target the current agent (you) for safety.
110
-
111
- ## Script Reference
112
-
113
- All scripts are located in the `scripts/` directory and output raw API responses (JSON).
114
-
115
- | Script | Purpose | Args |
116
- |--------|---------|------|
117
- | `get-agent-blocks.ts` | Get blocks from an agent | `--agent-id` |
118
- | `copy-block.ts` | Copy block to current agent | `--block-id`, optional `--label`, `--override` |
119
- | `attach-block.ts` | Attach existing block to current agent | `--block-id`, optional `--read-only`, `--override` |
120
-
121
- ## Authentication
122
-
123
- The bundled scripts automatically use the same authentication as Letta Code:
124
- - Keychain/secrets storage
125
- - `~/.config/letta/settings.json` fallback
126
- - `LETTA_API_KEY` environment variable
127
-
128
- You can also make direct API calls using the Letta SDK if you have the API key available.
129
-
130
101
  ## Example: Migrating Project Memory
131
102
 
132
103
  Scenario: You're a new agent and want to inherit memory from an existing agent "ProjectX-v1".
@@ -134,22 +105,17 @@ Scenario: You're a new agent and want to inherit memory from an existing agent "
134
105
  1. **Get source agent ID from user:**
135
106
  User provides: `agent-abc123`
136
107
 
137
- 2. **List its blocks:**
108
+ 2. **Export their memfs:**
138
109
  ```bash
139
- npx tsx <SKILL_DIR>/scripts/get-agent-blocks.ts --agent-id agent-abc123
140
- # Shows: project (block-def456), human (block-ghi789), persona (block-jkl012)
110
+ letta memfs export --agent agent-abc123 --out /tmp/letta-memfs-agent-abc123
141
111
  ```
142
112
 
143
- 3. **Copy project knowledge to yourself:**
113
+ 3. **Copy the relevant files into your memfs:**
144
114
  ```bash
145
- # If you don't have a 'project' block yet:
146
- npx tsx <SKILL_DIR>/scripts/copy-block.ts --block-id block-def456
147
-
148
- # If you already have 'project', use --label to rename:
149
- npx tsx <SKILL_DIR>/scripts/copy-block.ts --block-id block-def456 --label project-v1
115
+ cp -r /tmp/letta-memfs-agent-abc123/system/project ~/.letta/agents/$LETTA_AGENT_ID/memory/system/
150
116
  ```
151
117
 
152
- 4. **Optionally share human preferences (read-only):**
118
+ 4. **Sync:**
153
119
  ```bash
154
- npx tsx <SKILL_DIR>/scripts/attach-block.ts --block-id block-ghi789 --read-only
120
+ letta memfs sync --agent $LETTA_AGENT_ID
155
121
  ```
@@ -15,16 +15,12 @@ This skill helps you search through past conversations to recall context that ma
15
15
  - You want to verify what was said before about a topic
16
16
  - You need to find which agent discussed a specific topic (use with `finding-agents` skill)
17
17
 
18
- ## Script Usage
19
-
20
- The scripts are located in the `scripts/` subdirectory of this skill. Use the **Skill Directory** path shown above when loading this skill.
18
+ ## CLI Usage
21
19
 
22
20
  ```bash
23
- npx tsx <SKILL_DIR>/scripts/search-messages.ts --query <text> [options]
21
+ letta messages search --query <text> [options]
24
22
  ```
25
23
 
26
- Replace `<SKILL_DIR>` with the actual path from the `# Skill Directory:` line at the top of this loaded skill.
27
-
28
24
  ### Options
29
25
 
30
26
  | Option | Description |
@@ -35,7 +31,8 @@ Replace `<SKILL_DIR>` with the actual path from the `# Skill Directory:` line at
35
31
  | `--end-date <date>` | Filter messages before this date (ISO format) |
36
32
  | `--limit <n>` | Max results (default: 10) |
37
33
  | `--all-agents` | Search all agents, not just current agent |
38
- | `--agent-id <id>` | Explicit agent ID (for manual testing) |
34
+ | `--agent <id>` | Explicit agent ID (overrides LETTA_AGENT_ID) |
35
+ | `--agent-id <id>` | Alias for `--agent` |
39
36
 
40
37
  ### Search Modes
41
38
 
@@ -43,12 +40,12 @@ Replace `<SKILL_DIR>` with the actual path from the `# Skill Directory:` line at
43
40
  - **vector**: Semantic similarity search (good for conceptual matches)
44
41
  - **fts**: Full-text search (good for exact phrases)
45
42
 
46
- ## Companion Script: get-messages.ts
43
+ ## Companion Command: messages list
47
44
 
48
45
  Use this to expand around a found needle by message ID cursor:
49
46
 
50
47
  ```bash
51
- npx tsx <SKILL_DIR>/scripts/get-messages.ts [options]
48
+ letta messages list [options]
52
49
  ```
53
50
 
54
51
  | Option | Description |
@@ -57,7 +54,8 @@ npx tsx <SKILL_DIR>/scripts/get-messages.ts [options]
57
54
  | `--before <message-id>` | Get messages before this ID (cursor) |
58
55
  | `--order <asc\|desc>` | Sort order (default: desc = newest first) |
59
56
  | `--limit <n>` | Max results (default: 20) |
60
- | `--agent-id <id>` | Explicit agent ID |
57
+ | `--agent <id>` | Explicit agent ID (overrides LETTA_AGENT_ID) |
58
+ | `--agent-id <id>` | Alias for `--agent` |
61
59
 
62
60
  ## Search Strategies
63
61
 
@@ -67,19 +65,19 @@ Use when you need full conversation context around a specific topic:
67
65
 
68
66
  1. **Find the needle** - Search with keywords to discover relevant messages:
69
67
  ```bash
70
- npx tsx <SKILL_DIR>/scripts/search-messages.ts --query "flicker inline approval" --limit 5
68
+ letta messages search --query "flicker inline approval" --limit 5
71
69
  ```
72
70
 
73
71
  2. **Note the message_id** - Find the most relevant result and copy its `message_id`
74
72
 
75
73
  3. **Expand before** - Get messages leading up to the needle:
76
74
  ```bash
77
- npx tsx <SKILL_DIR>/scripts/get-messages.ts --before "message-xyz" --limit 10
75
+ letta messages list --before "message-xyz" --limit 10
78
76
  ```
79
77
 
80
78
  4. **Expand after** - Get messages following the needle (use `--order asc` for chronological):
81
79
  ```bash
82
- npx tsx <SKILL_DIR>/scripts/get-messages.ts --after "message-xyz" --order asc --limit 10
80
+ letta messages list --after "message-xyz" --order asc --limit 10
83
81
  ```
84
82
 
85
83
  ### Strategy 2: Date-Bounded Search
@@ -87,7 +85,7 @@ Use when you need full conversation context around a specific topic:
87
85
  Use when you know approximately when something was discussed:
88
86
 
89
87
  ```bash
90
- npx tsx <SKILL_DIR>/scripts/search-messages.ts --query "topic" --start-date "2025-12-31T00:00:00Z" --end-date "2025-12-31T23:59:59Z" --limit 15
88
+ letta messages search --query "topic" --start-date "2025-12-31T00:00:00Z" --end-date "2025-12-31T23:59:59Z" --limit 15
91
89
  ```
92
90
 
93
91
  Results are sorted by relevance within the date window.
@@ -97,7 +95,7 @@ Results are sorted by relevance within the date window.
97
95
  Use when you're not sure what you're looking for:
98
96
 
99
97
  ```bash
100
- npx tsx <SKILL_DIR>/scripts/search-messages.ts --query "vague topic" --mode vector --limit 10
98
+ letta messages search --query "vague topic" --mode vector --limit 10
101
99
  ```
102
100
 
103
101
  Vector mode finds semantically similar messages even without exact keyword matches.
@@ -107,7 +105,7 @@ Vector mode finds semantically similar messages even without exact keyword match
107
105
  Use with `--all-agents` to search across all agents and identify which one discussed a topic:
108
106
 
109
107
  ```bash
110
- npx tsx <SKILL_DIR>/scripts/search-messages.ts --query "authentication refactor" --all-agents --limit 10
108
+ letta messages search --query "authentication refactor" --all-agents --limit 10
111
109
  ```
112
110
 
113
111
  Results include `agent_id` for each message. Use this to: