@letta-ai/letta-code 0.32.2 → 0.32.4

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 (92) hide show
  1. package/README.md +1 -1
  2. package/dist/channels-public.js +32 -2
  3. package/dist/channels-public.js.map +3 -3
  4. package/dist/channels-slack.js +52 -2
  5. package/dist/channels-slack.js.map +4 -4
  6. package/dist/gateway-core.js +89 -31
  7. package/dist/gateway-core.js.map +6 -5
  8. package/dist/mcp-client.js +2 -2
  9. package/dist/mcp-client.js.map +1 -1
  10. package/dist/types/agent/skills.d.ts.map +1 -1
  11. package/dist/types/agent/subagents/context-budget.d.ts +2 -0
  12. package/dist/types/agent/subagents/context-budget.d.ts.map +1 -1
  13. package/dist/types/agent/subagents/manager.d.ts +2 -2
  14. package/dist/types/agent/subagents/manager.d.ts.map +1 -1
  15. package/dist/types/agent/subagents/subagent-launcher.d.ts +8 -0
  16. package/dist/types/agent/subagents/subagent-launcher.d.ts.map +1 -1
  17. package/dist/types/backend/api/agent-message.d.ts +22 -0
  18. package/dist/types/backend/api/agent-message.d.ts.map +1 -0
  19. package/dist/types/backend/api/conversation-enqueue.d.ts +60 -0
  20. package/dist/types/backend/api/conversation-enqueue.d.ts.map +1 -0
  21. package/dist/types/channels/gateway-core.d.ts +2 -0
  22. package/dist/types/channels/gateway-core.d.ts.map +1 -1
  23. package/dist/types/channels/gateway-sources.d.ts +6 -0
  24. package/dist/types/channels/gateway-sources.d.ts.map +1 -0
  25. package/dist/types/channels/progress-builder.d.ts +1 -1
  26. package/dist/types/channels/progress-builder.d.ts.map +1 -1
  27. package/dist/types/channels/progress-types.d.ts +28 -0
  28. package/dist/types/channels/progress-types.d.ts.map +1 -0
  29. package/dist/types/channels/slack/progress.d.ts.map +1 -1
  30. package/dist/types/channels/slack/status-controller.d.ts +2 -1
  31. package/dist/types/channels/slack/status-controller.d.ts.map +1 -1
  32. package/dist/types/channels/types.d.ts +6 -23
  33. package/dist/types/channels/types.d.ts.map +1 -1
  34. package/dist/types/permissions/agent-memory-prefixes.d.ts +3 -0
  35. package/dist/types/permissions/agent-memory-prefixes.d.ts.map +1 -0
  36. package/dist/types/permissions/cli.d.ts.map +1 -1
  37. package/dist/types/permissions/cross-agent-guard.d.ts.map +1 -1
  38. package/dist/types/permissions/read-only-letta.d.ts +2 -0
  39. package/dist/types/permissions/read-only-letta.d.ts.map +1 -0
  40. package/dist/types/permissions/read-only-shell.d.ts.map +1 -1
  41. package/dist/types/runtime-context.d.ts +2 -0
  42. package/dist/types/runtime-context.d.ts.map +1 -1
  43. package/dist/types/runtime-execution-settings.d.ts +16 -0
  44. package/dist/types/runtime-execution-settings.d.ts.map +1 -0
  45. package/dist/types/telemetry/channel.d.ts +7 -0
  46. package/dist/types/telemetry/channel.d.ts.map +1 -0
  47. package/dist/types/telemetry/index.d.ts +4 -1
  48. package/dist/types/telemetry/index.d.ts.map +1 -1
  49. package/dist/types/tools/impl/bash.d.ts.map +1 -1
  50. package/dist/types/tools/impl/exec-command.d.ts.map +1 -1
  51. package/dist/types/tools/impl/kill-bash.d.ts +1 -0
  52. package/dist/types/tools/impl/kill-bash.d.ts.map +1 -1
  53. package/dist/types/tools/impl/monitor.d.ts +1 -0
  54. package/dist/types/tools/impl/monitor.d.ts.map +1 -1
  55. package/dist/types/tools/impl/send-agent-message.d.ts +19 -0
  56. package/dist/types/tools/impl/send-agent-message.d.ts.map +1 -0
  57. package/dist/types/tools/impl/shell-env.d.ts.map +1 -1
  58. package/dist/types/tools/impl/skill.d.ts.map +1 -1
  59. package/dist/types/tools/letta-toolset.d.ts.map +1 -1
  60. package/dist/types/tools/manager.d.ts +0 -5
  61. package/dist/types/tools/manager.d.ts.map +1 -1
  62. package/dist/types/tools/tool-definitions.d.ts +1 -0
  63. package/dist/types/tools/tool-definitions.d.ts.map +1 -1
  64. package/dist/types/tools/tool-permissions.d.ts.map +1 -1
  65. package/dist/types/tools/toolset-defaults.d.ts +9 -0
  66. package/dist/types/tools/toolset-defaults.d.ts.map +1 -0
  67. package/dist/types/tools/toolset.d.ts +1 -0
  68. package/dist/types/tools/toolset.d.ts.map +1 -1
  69. package/dist/types/types/protocol_v2.d.ts +4 -51
  70. package/dist/types/types/protocol_v2.d.ts.map +1 -1
  71. package/dist/types/types/runtime-start-protocol.d.ts +58 -2
  72. package/dist/types/types/runtime-start-protocol.d.ts.map +1 -1
  73. package/dist/types/utils/subagent-launch-marker.d.ts +6 -0
  74. package/dist/types/utils/subagent-launch-marker.d.ts.map +1 -0
  75. package/dist/types/utils/task-notifications.d.ts +3 -1
  76. package/dist/types/utils/task-notifications.d.ts.map +1 -1
  77. package/dist/types/websocket/listener/runtime.d.ts.map +1 -1
  78. package/dist/types/websocket/listener/types.d.ts +2 -0
  79. package/dist/types/websocket/listener/types.d.ts.map +1 -1
  80. package/letta.js +2723 -1729
  81. package/package.json +1 -1
  82. package/scripts/source-file-size-baseline.json +8 -8
  83. package/skills/context-doctor/SKILL.md +72 -129
  84. package/skills/context-doctor/references/auditing-memory.md +72 -0
  85. package/skills/context-doctor/references/investigating-behavior.md +161 -0
  86. package/skills/image-generation/SKILL.md +5 -4
  87. package/skills/messaging-agents/SKILL.md +184 -159
  88. package/skills/working-across-computers/SKILL.md +90 -0
  89. package/skills/working-across-computers/assets/allow-remote-access-from-desktop.png +0 -0
  90. package/skills/working-across-computers/references/connect-a-computer-for-remote-access.md +59 -0
  91. package/skills/context-doctor/ROOT_MEMORY.md +0 -137
  92. package/skills/teleporting-between-environments/SKILL.md +0 -114
@@ -1,137 +0,0 @@
1
- ---
2
- name: Context Doctor
3
- id: context-doctor
4
- description: Identify and repair degradation in system prompt, external memory, and skills preventing you from following instructions or remembering information as well as you should.
5
- ---
6
-
7
- # Context Doctor
8
- Your context is what makes you *you* across sessions. You are responsible for managing it (along with memory subagents). It includes:
9
- - Your system prompt and core memory (root Markdown files)
10
- - Your external memory (contained in the memory filesystem)
11
- - Your skills (procedural memory)
12
-
13
- Over time, context can degrade — bloat and poor prompt quality erode your ability to remember the right things and follow instructions properly. This skill helps you identify issues with your context and repair them collaboratively with the user.
14
-
15
- **IMPORTANT**: Your edits of your system instructions should be **conservative**. Do NOT make assuptions about what parts of the system prompt are critical. The system prompt defines who you are, so significant modifications to its structure can have unintended consequences. Focus on making minimal changes to meet the token budget, and to effectively link out to external memory.
16
-
17
- ## Operating Procedure
18
-
19
- ### Step 1: Identify and resolve context issues
20
- Explore your memory files to identify issues. Consider what is confusing about your own prompts and context, and resolve the issues.
21
-
22
- Below are additional common issues with context and how they can be resolved:
23
-
24
- #### System prompt bloat
25
- Root Markdown files compiled into the system prompt should take up about 10% of the total context size (usually ~15-20K tokens). This is a soft target, not a hard requirement.
26
-
27
- Use the built-in CLI to evaluate token usage of the system prompt:
28
- ```bash
29
- letta memory tokens --format json --quiet
30
- ```
31
-
32
- The command reports `total_tokens` and per-file estimates for core memory. It is only a measurement tool; decide whether to intervene based on the actual context and the guidance below.
33
-
34
- **Why detail is load-bearing (read this before cutting anything)**: In-context detail does more than carry information. It does at least four things, and byte-counting sweeps only see the first:
35
- 1. **Information** — the literal facts stated
36
- 2. **Attention anchoring** — makes certain topics feel important to the model when it's reasoning
37
- 3. **Semantic priming** — raises the prior on codebase-specific patterns ("this codebase has weird X, don't assume defaults")
38
- 4. **Reasoning templates** — past examples become heuristics for new bugs; rationale in "why" prose becomes scaffolding
39
-
40
- Compression preserves (1). It destroys (2), (3), (4). That's why a compressed prompt can make an agent measurably worse at codebase-specific reasoning even though the explicit facts are all "still there" in reference files.
41
-
42
-
43
- **Relative Markdown links from `MEMORY.md` files are NOT equivalent to in-context presence.** They're latent until the agent actively fetches them. An agent only fetches when it already knows it doesn't know. The priming cues that tell it *when* it doesn't know are in the system prompt itself — they can't be replaced by links.
44
-
45
- **When to intervene**: Only if the system prompt is *meaningfully* over target. At or near the target, leave it alone. Every edit risks removing content that was doing work you can't see. A prompt that feels "a bit long" is almost always better than one that's been aggressively trimmed.
46
-
47
- **Modifying the system prompt**: Make **MINIMAL** changes required to cut the token count of the system prompt if needed. The goal preserve the existing behavior while cutting down the token count. Focus on reducing redundancy or compressing - rather than offloading entire sections to external memory.
48
- - Preserve persona-defining content (who you are, how you communicate)
49
- - Preserve user identity or preferences (e.g. the human's name, their stated goals)
50
- - Maintain the existing distribution of detail: compression should be applied evenly across all topics. If the original prompt was 50% about a specific issue, the new prompt should also be 50% about that issue.
51
- - Only reduce noise and improve structure - if compression must result in information loss, preserve lost details into external memory
52
-
53
- #### Context redundancy and unclear organization
54
- The context in the memory filesystem should have a clear structure, with a well-defined purpose for each file. Memory file descriptions should be precise and non-overlapping. Their contents should be consistent with the description, and have non-overlapping content to other files.
55
-
56
- **Questions to ask**:
57
- - Do the descriptions make clear what file is for what?
58
- - Do the contents of the file match the descriptions? (you can ask subagents to check)
59
-
60
- **Solution**: Read all memory files (use subagents for efficiency), then:
61
- - Consolidate redundant files
62
- - Reorganize files and rewrite descriptions to have clear separation of concerns
63
- - Avoid duplication by referencing common files from multiple places (e.g. `[reference API](reference/api.md)`)
64
- - Rewrite unclear or low-quality content
65
-
66
- #### Invalid context format
67
- Files in the memory filesystem must follow certain structural requirements:
68
- - Must have root `MEMORY.md` and root `persona.md`
69
- - Root and child `MEMORY.md` files have no frontmatter; every other memory Markdown file has exactly `name` and `description` frontmatter
70
- - Must NOT have overlapping file and folder names (e.g. `human.md` and `human/identity.md`)
71
- - Must follow specification for skills (e.g. `skills/{skill_name}/`) with the format:
72
- ```
73
- skill-name/
74
- ├── SKILL.md # Required: metadata + instructions
75
- ├── scripts/ # Optional: executable code
76
- ├── references/ # Optional: documentation
77
- ├── assets/ # Optional: templates, resources
78
- └── ... # Any additional files or directories
79
- ```
80
-
81
- **Solution**: Reorganize files to follow the required structure
82
-
83
- ### Poor use of progressive disclosure
84
- Only critical information should be in the system prompt, since it's passed on every turn. Use progressive disclosure so that context only *sometimes* needed can be dynamically retrieved.
85
-
86
- Files in indexed child directories are not part of the system prompt, and must be dynamically loaded. Every child directory must contain a frontmatter-free `MEMORY.md`, and you must index your files to ensure your future self can discover them: for example, make sure that files have informative names and descriptions, or are referenced from `MEMORY.md` with ordinary relative Markdown links to create discovery paths. Otherwise, you will never discover the external context or make use of it.
87
-
88
- **Solution**:
89
- - Reference external skills from the relevant parts of in-context memory:
90
- ```
91
- When running a migration, always use the [db-migrations skill](skills/db-migrations/SKILL.md)
92
- ```
93
- or external memory files:
94
- ```
95
- Sarah's active projects are: [Letta Code](projects/letta_code.md) and [Letta Cloud](projects/letta_cloud.md)
96
- ```
97
- - Ensure that contents of files match the file name and descriptions
98
- - Make sure your future self will be able to find and load external files when needed.
99
-
100
- ### Step 2: Implement context fixes
101
- Create a plan for what fixes you want to make, then implement them. Favor the smallest possible change that resolves the issue — if the system prompt is 1.5× the target, don't cut it to half the target "for headroom." Cut until you're near the target, then stop.
102
-
103
- Before moving on, verify:
104
- - [ ] System prompt token budget reviewed (target ~10% of context, usually 15-20k tokens)
105
- - [ ] Changes are proportional to the problem — only offloaded what's needed to meet the target
106
- - [ ] Preserved detailed rationale, examples, and cross-references in sections that stayed in root core memory
107
- - [ ] Preferred moving whole files or deleting stale sections over compressing detailed sections into summaries
108
- - [ ] No overlapping or redundant files remain
109
- - [ ] All file descriptions are unique, accurate, and match their contents
110
- - [ ] Moved-out knowledge has ordinary relative Markdown links from `MEMORY.md` so it can be discovered
111
- - [ ] No semantic changes to persona, user identity, or behavioral instructions
112
-
113
- ### Step 3: Commit and push
114
- Review changes, then commit with a descriptive message:
115
-
116
- ```bash
117
- cd $MEMORY_DIR
118
- git status # Review what changed before staging
119
- git add <specific files> # Stage targeted paths — avoid blind `git add -A`
120
- author_name="${AGENT_NAME:-$AGENT_ID}"
121
- git commit --author="$author_name <$AGENT_ID@letta.com>" -m "fix(doctor): <summary> 🏥
122
-
123
- <identified issues and implemented solutions>"
124
-
125
- git push
126
- ```
127
-
128
- ### Step 4: Final checklist and message
129
- Tell the user what issues you identified, the fixes you made, the commit you made, and also recommend that they run `/recompile` to apply these changes to the current system prompt.
130
-
131
- Before finishing make sure you:
132
- - [ ] Resolved all the identified context issues
133
- - [ ] Pushed your changes successfully
134
- - [ ] Told the user to run `/recompile` to refresh the system prompt and apply changes
135
-
136
- ## Critical information
137
- - **Ask the user about their goals for you, not the implementation**: You understand your own context best, and should follow the guidelines in this document. Do NOT ask the user about their structural preferences — the context is for YOU, not them. Ask them how they want YOU to behave or know instead.
@@ -1,114 +0,0 @@
1
- ---
2
- name: teleporting-between-environments
3
- description: Moves the current agent conversation to Cloud, Desktop Local, or another connected computer while coordinating machine-local files and setup. Use when the user says "let's continue this task on cloud", asks to continue or move work on another connected computer, wants to teleport between computers, or needs to upload or download artifacts before a handoff.
4
- ---
5
-
6
- # Teleporting Between Computers
7
-
8
- Teleport the current agent and conversation without losing conversational memory. Prepare machine-local state first, then let the destination continue the same task.
9
-
10
- ## Mental model
11
-
12
- - **Memory follows the agent; filesystem access does not.** Files, working directories, credentials, running processes, and local services belong to the computer currently executing the conversation.
13
- - Upload and download paths are relative to the current computer. Cloud cannot read a laptop path until the conversation teleports to that laptop.
14
- - The conversation’s managed Cloud sandbox remains alive while the conversation runs elsewhere.
15
- - Filesystem paths and cwd do not transfer between computers. Re-establish the destination’s repository, working directory, dependencies, credentials, and services after arrival.
16
-
17
- ## Commands
18
-
19
- ```bash
20
- letta teleport list
21
- letta teleport cloud
22
- letta teleport local
23
- letta teleport <computer>
24
- ```
25
-
26
- - `list`: show accessible online Cloud-registered targets.
27
- - `cloud`: create or resume this conversation’s managed Cloud sandbox.
28
- - `local`: target the one online Letta Desktop computer. Desktop Remote Access must be enabled. If several Desktop computers are online, use `list` and target one explicitly.
29
- - `<computer>`: target a listed remote computer by its friendly selector.
30
-
31
- Do not run or recommend `letta teleport back`; return to Desktop with `local`.
32
-
33
- Transfer files with the existing sandbox commands:
34
-
35
- ```bash
36
- letta sandbox upload <local-path>
37
- letta sandbox download <sandbox-path> [--to <local-path>]
38
- ```
39
-
40
- Do not invent `letta teleport push`, `pull`, or remote file-listing commands. No sandbox ID or wake command is needed.
41
-
42
- ## Prepare the handoff
43
-
44
- Before teleporting:
45
-
46
- 1. Identify the target and every file, repository state, credential, service, or setup step the task needs there.
47
- 2. Finish work that requires the current computer. Verify relevant files exist before transferring them.
48
- 3. Upload current-computer artifacts needed in Cloud and retain the returned `/root/downloads/...` paths in context.
49
- 4. Retain enough context to recreate destination-local setup, including the repository, branch or revision, working directory, dependency commands, and next action.
50
- 5. Run teleport only after all source-side preparation is complete.
51
-
52
- ## Teleport is the final action
53
-
54
- Run the teleport command as the only command in the final Bash tool call. Do not chain later commands, poll the teleport operation, or invoke another source-side tool after it.
55
-
56
- The CLI intentionally returns after the server accepts the handoff. Once the Bash result is persisted, the source yields at a clean turn or tool boundary and the destination resumes with no synthetic user message.
57
-
58
- If the command reports an offline, stale, unsupported, same-source, or startup error, the conversation remains on the source. Surface the concrete error, correct it if possible, and retry only after the target is available.
59
-
60
- ## Common workflows
61
-
62
- ### Continue local work in Cloud
63
-
64
- 1. Inspect the local task state and identify local-only artifacts or setup.
65
- 2. Upload each artifact Cloud needs:
66
-
67
- ```bash
68
- letta sandbox upload <local-path>
69
- ```
70
-
71
- 3. Retain each returned sandbox path.
72
- 4. As the final action, run:
73
-
74
- ```bash
75
- letta teleport cloud
76
- ```
77
-
78
- 5. After continuation in Cloud, establish the Cloud-local cwd and repository setup before using the uploaded paths.
79
-
80
- ### Return to Desktop Local
81
-
82
- 1. Retain the next local action and any setup the Desktop computer needs.
83
- 2. Confirm Desktop is open with Remote Access enabled. If more than one Desktop computer is online, use `letta teleport list` and choose one explicitly.
84
- 3. As the final action, run:
85
-
86
- ```bash
87
- letta teleport local
88
- ```
89
-
90
- ### Run a separate headless turn on a computer
91
-
92
- Use `--computer` when a separate headless invocation, rather than the current conversation handoff, should execute on Cloud or another online computer:
93
-
94
- ```bash
95
- letta -p --conversation <id> --computer cloud "<prompt>"
96
- letta -p --conversation <id> --computer <name|device-id|connection-id> "<prompt>"
97
- ```
98
-
99
- This routes that headless message only. Use `letta teleport ...` to move the currently executing conversation.
100
-
101
- ### Continue on another connected computer
102
-
103
- 1. Discover available targets if needed:
104
-
105
- ```bash
106
- letta teleport list
107
- ```
108
-
109
- 2. Prepare or upload everything the current computer owns.
110
- 3. As the final action, run:
111
-
112
- ```bash
113
- letta teleport <computer>
114
- ```