@letta-ai/letta-code 0.29.9 → 0.29.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 +3981 -2871
- package/package.json +1 -1
- package/scripts/source-file-size-baseline.json +4 -4
- package/skills/managing-shared-memory/SKILL.md +127 -0
package/package.json
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
"src/backend/local/local-backend.ts": 1014,
|
|
6
6
|
"src/backend/local/local-store.ts": 3594,
|
|
7
7
|
"src/backend/pi-stream-adapter.test.ts": 1304,
|
|
8
|
-
"src/cli/app/AppCoordinator.tsx":
|
|
8
|
+
"src/cli/app/AppCoordinator.tsx": 5203,
|
|
9
9
|
"src/cli/app/AppView.tsx": 1753,
|
|
10
10
|
"src/cli/app/use-approval-flow.ts": 1163,
|
|
11
11
|
"src/cli/app/use-configuration-handlers.ts": 1433,
|
|
12
12
|
"src/cli/app/use-conversation-loop.ts": 2936,
|
|
13
13
|
"src/cli/app/use-submit-handler.ts": 4077,
|
|
14
|
-
"src/cli/components/AgentSelector.tsx":
|
|
14
|
+
"src/cli/components/AgentSelector.tsx": 1104,
|
|
15
15
|
"src/cli/components/InputRich.tsx": 2225,
|
|
16
16
|
"src/cli/components/ModelSelector.tsx": 1262,
|
|
17
17
|
"src/cli/components/ProviderSelector.tsx": 1692,
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"src/cli/subcommands/skills.ts": 1264,
|
|
25
25
|
"src/headless.ts": 5244,
|
|
26
26
|
"src/hooks/integration.test.ts": 1147,
|
|
27
|
-
"src/index.ts":
|
|
27
|
+
"src/index.ts": 2801,
|
|
28
28
|
"src/mods/learning-harness.ts": 2434,
|
|
29
29
|
"src/mods/mod-engine.test.ts": 2153,
|
|
30
30
|
"src/mods/mod-engine.ts": 1847,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"src/websocket/listener/commands/channels.ts": 1315,
|
|
48
48
|
"src/websocket/listener/commands/memory.ts": 1114,
|
|
49
49
|
"src/websocket/listener/file-commands.ts": 1030,
|
|
50
|
-
"src/websocket/listener/lifecycle.ts":
|
|
50
|
+
"src/websocket/listener/lifecycle.ts": 1656,
|
|
51
51
|
"src/websocket/listener/protocol-inbound.ts": 2293,
|
|
52
52
|
"src/websocket/listener/protocol-outbound.ts": 1100
|
|
53
53
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: managing-shared-memory
|
|
3
|
+
description: Create and manage shared memory — git-tracked repositories hosted on Letta Cloud that are attached to one or more agents and projected into their filesystems. Use when the user wants to share memory or files across agents, store context outside your own MemFS, attach or detach shared memory, or inspect its file history.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Managing Shared Memory
|
|
7
|
+
|
|
8
|
+
Shared memory is memory created independently of any single agent, designed to be dynamically attached to or detached from multiple agents. Each unit of shared memory is a **shared memory repository**: a git-tracked filesystem hosted on Letta Cloud, owned by your organization rather than by one agent, reachable from any environment (sandboxes, remote machines, sessions).
|
|
9
|
+
|
|
10
|
+
Like the rest of your external memory, shared memory lives outside your system prompt — it is not in-context. Unlike the rest of your external memory, it is not scoped to *you* specifically, so each attached repository has its own local projection root and its own remote git origin, separate from your MemFS.
|
|
11
|
+
|
|
12
|
+
Create a shared memory repository when:
|
|
13
|
+
- You have context an agent should be able to access that doesn't belong in its own MemFS (input files, datasets, docs, working artifacts)
|
|
14
|
+
- Multiple agents need to read or write the same context
|
|
15
|
+
- You want a versioned file store that survives across environments and sessions
|
|
16
|
+
|
|
17
|
+
Every file change is a git commit, so history is always available.
|
|
18
|
+
|
|
19
|
+
## Accessing Attached Shared Memory
|
|
20
|
+
|
|
21
|
+
When shared memory is attached to you and you're running in a cloud sandbox/environment, it is projected on disk next to your memory directory — each repository at its own projection root:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ls "$MEMORY_DIR/../" # attached shared memory appears here by name
|
|
25
|
+
cat "$MEMORY_DIR/../<repo-name>/<path>"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If you don't see an expected repository on disk, fall back to the API (below) — it always works regardless of environment.
|
|
29
|
+
|
|
30
|
+
## API Operations
|
|
31
|
+
|
|
32
|
+
Shared memory repositories are the `repositories` resource in the Letta API. All operations go through the API using `$LETTA_API_KEY` via the Bash tool. Use `https://api.letta.com` (or `$LETTA_BASE_URL` if set — e.g. when running under Letta Desktop, which proxies auth). Responses are JSON.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
BASE="${LETTA_BASE_URL:-https://api.letta.com}"
|
|
36
|
+
AUTH="Authorization: Bearer $LETTA_API_KEY"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Repositories
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Create
|
|
43
|
+
curl -sS -X POST "$BASE/v1/repositories" -H "$AUTH" -H "Content-Type: application/json" \
|
|
44
|
+
-d '{"name": "shared-inputs"}'
|
|
45
|
+
# → {"id": "repo-...", "name": "shared-inputs", "created_at": ..., "updated_at": ...}
|
|
46
|
+
|
|
47
|
+
# List (paginated)
|
|
48
|
+
curl -sS "$BASE/v1/repositories?limit=50&offset=0" -H "$AUTH"
|
|
49
|
+
# → {"repositories": [...], "has_next_page": false}
|
|
50
|
+
|
|
51
|
+
# Get one
|
|
52
|
+
curl -sS "$BASE/v1/repositories/{repository_id}" -H "$AUTH"
|
|
53
|
+
|
|
54
|
+
# Delete (soft-delete)
|
|
55
|
+
curl -sS -X DELETE "$BASE/v1/repositories/{repository_id}" -H "$AUTH"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Files
|
|
59
|
+
|
|
60
|
+
Files are text content addressed by path. Every mutation returns a `commit_sha` and the file's `content_sha256`.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# List files (optional: path_prefix, depth, ref)
|
|
64
|
+
curl -sS "$BASE/v1/repositories/{repository_id}/files?path_prefix=docs/&depth=2" -H "$AUTH"
|
|
65
|
+
# → {"files": [{"path": "docs/a.md", "type": "file"}, ...], "ref": "<sha>"}
|
|
66
|
+
|
|
67
|
+
# Create
|
|
68
|
+
curl -sS -X POST "$BASE/v1/repositories/{repository_id}/files" -H "$AUTH" \
|
|
69
|
+
-H "Content-Type: application/json" \
|
|
70
|
+
-d '{"path": "docs/a.md", "content": "hello"}'
|
|
71
|
+
|
|
72
|
+
# Read (optional: ref for a historical version)
|
|
73
|
+
curl -sS "$BASE/v1/repositories/{repository_id}/files/content?path=docs/a.md" -H "$AUTH"
|
|
74
|
+
# → {"path": "docs/a.md", "content": "hello", "content_sha256": "...", "ref": "..."}
|
|
75
|
+
|
|
76
|
+
# Update content and/or rename. The optional precondition fails the write
|
|
77
|
+
# if the file changed since you last read it (use when multiple agents write).
|
|
78
|
+
curl -sS -X POST "$BASE/v1/repositories/{repository_id}/files/content" -H "$AUTH" \
|
|
79
|
+
-H "Content-Type: application/json" \
|
|
80
|
+
-d '{
|
|
81
|
+
"path": "docs/a.md",
|
|
82
|
+
"content": "updated",
|
|
83
|
+
"new_path": "docs/b.md",
|
|
84
|
+
"precondition": {"type": "content_sha256", "content_sha256": "<sha from last read>"}
|
|
85
|
+
}'
|
|
86
|
+
|
|
87
|
+
# Delete
|
|
88
|
+
curl -sS -X DELETE "$BASE/v1/repositories/{repository_id}/files/content" -H "$AUTH" \
|
|
89
|
+
-H "Content-Type: application/json" -d '{"path": "docs/b.md"}'
|
|
90
|
+
# → {"success": true, "commit_sha": "..."}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Version History
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# List commits (optionally scoped to one path)
|
|
97
|
+
curl -sS "$BASE/v1/repositories/{repository_id}/versions?path=docs/a.md&limit=20" -H "$AUTH"
|
|
98
|
+
# → {"commits": [{"sha": "...", "message": "...", "timestamp": "...", "author_name": ...}]}
|
|
99
|
+
|
|
100
|
+
# Read a file as of a specific commit
|
|
101
|
+
curl -sS "$BASE/v1/repositories/{repository_id}/versions/{sha}?path=docs/a.md" -H "$AUTH"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Attaching Shared Memory to Agents
|
|
105
|
+
|
|
106
|
+
Attaching projects the repository into the agent's environments; detaching removes it. Neither changes the agent's own MemFS.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# List shared memory attached to an agent
|
|
110
|
+
curl -sS "$BASE/v1/agents/{agent_id}/repositories" -H "$AUTH"
|
|
111
|
+
|
|
112
|
+
# Attach
|
|
113
|
+
curl -sS -X POST "$BASE/v1/agents/{agent_id}/repositories" -H "$AUTH" \
|
|
114
|
+
-H "Content-Type: application/json" -d '{"repository_id": "repo-..."}'
|
|
115
|
+
|
|
116
|
+
# Detach
|
|
117
|
+
curl -sS -X DELETE "$BASE/v1/agents/{agent_id}/repositories/{repository_id}" -H "$AUTH"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Attaching is asynchronous — after a POST, poll the list endpoint until the repository appears before relying on it. You can attach shared memory to yourself (`$AGENT_ID`) or to another agent to share context with it.
|
|
121
|
+
|
|
122
|
+
## Notes and Limits
|
|
123
|
+
|
|
124
|
+
- Shared memory files are **text** content; binary files are not supported via the files API.
|
|
125
|
+
- Attached shared memory is not scoped to you — another agent may edit the same files at any time. Use the `content_sha256` precondition on updates when multiple agents may write the same file; on failure, re-read and retry.
|
|
126
|
+
- Shared memory is not part of your system prompt. Writing to it does not change your in-context memory — for that, edit your memory blocks or MemFS files.
|
|
127
|
+
- SDK equivalent: `@letta-ai/letta-agent-sdk` exposes these operations as `client.repositories` (with `files` and `versions` helpers) and supports attaching shared memory for a session's lifetime via `resources: [{ type: "repository", repositoryId }]` on cloud sessions.
|