Shared Memories
Shared memories allow agents to selectively share memory entries with other agents. Unlike cross-workspace memory, shared memories operate within a single workspace and support expiration and revocation.
Sharing a memory
Specify the source agent, target agent, memory type, and the memory entry ID. Optionally set an expiration date.
bash
# Share a memory from one agent to another
curl -X POST http://localhost:3000/shared-memories \
-H "Authorization: Bearer ${JWT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"sourceAgentId": "research-agent",
"targetAgentId": "code-agent",
"memoryType": "daily_note",
"memoryId": "mem_abc123",
"expiresAt": "2026-04-01T00:00:00.000Z"
}'
# Response (201 Created)
{ "id": "share_def456", "shared": true }Listing shared memories
Use the direction parameter to see memories received by or shared from an agent.
bash
# List memories shared with an agent
curl "http://localhost:3000/shared-memories?agentId=code-agent&direction=received" \
-H "Authorization: Bearer ${JWT_TOKEN}"
# List memories shared by an agent
curl "http://localhost:3000/shared-memories?agentId=research-agent&direction=shared" \
-H "Authorization: Bearer ${JWT_TOKEN}"Revoking access
The sharing user can revoke access at any time. Returns 404 if the share doesn't exist or the user isn't authorized.
bash
# Revoke a shared memory
curl -X DELETE http://localhost:3000/shared-memories/share_def456 \
-H "Authorization: Bearer ${JWT_TOKEN}"
# Response
{ "revoked": true }Endpoint reference
| Method | Endpoint | Description |
|---|---|---|
POST | /shared-memories | Share a memory |
GET | /shared-memories | List shared memories (agentId required, direction optional) |
DELETE | /shared-memories/:id | Revoke a shared memory |