twilio-conversation-memory
Store and retrieve customer context using Twilio's Conversation Memory service.
Identity proven by GitHub's verified organisation badge (twilio)
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- MIT (permissive)
- Pin
- 8aba46fpinned Oct 9, 2026
- Context cost
- about 2,800 tokenswhen the skill loads
- GitHub stars
- 37on twilio/ai
- Scripts
- None found
What it does
“Store and retrieve conversation context using Twilio Conversation Memory. Covers Memory Store provisioning, profile management, traits, observations, conversation summaries, and semantic Recall. Use this skill to give AI agents or human agents persistent memory of conversations across sessions and channels.”
Generated summary from the skill's own text
Store and retrieve customer context using Twilio's Conversation Memory service. The skill handles memory store provisioning, profile management with identity resolution, traits, observations, and semantic recall. Agents can use this to maintain persistent conversation context across sessions and channels, either by connecting to Conversation Orchestrator for automatic extraction or by posting data directly via API.
When to use it
- Building voice or chat agents that need customer history across conversations
- Storing customer preferences, observations, or traits for identity-resolved profiles
- Retrieving relevant context quickly using hybrid semantic and lexical search
- Optimizing latency in voice interactions by fetching observations directly
When not to
- Handling PCI or HIPAA-regulated data, not yet compliant
- Applications requiring synchronous writes, all memory operations are asynchronous
- Needing more than 15 memory stores per account without sub-accounts
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add twilio/ai --skill twilio-conversation-memoryInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install twilio/ai twilio-conversation-memory@8aba46fb65dc8d9a20f4b301a68352064b4159a5Installs the commit we checked (8aba46f).
Copy by hand
Download the folder at 8aba46f and put it in .claude/skills/twilio-conversation-memory for Claude Code and in .agents/skills/twilio-conversation-memory for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Claude Code plugin
/plugin install twilio-developer-kit@claude-plugins-officialThe publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "twilio-conversation-memory" by Twilio. Source, pinned to commit 8aba46fb65dc8d9a20f4b301a68352064b4159a5: https://github.com/twilio/ai/tree/8aba46fb65dc8d9a20f4b301a68352064b4159a5/skills/twilio/twilio-conversation-memory 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/twilio-conversation-memory/ for Claude Code and .agents/skills/twilio-conversation-memory/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/twilio/twilio-conversation-memory
SKILL.md at the pin
---
name: twilio-conversation-memory
description: >
Store and retrieve conversation context using Twilio Conversation Memory.
Covers Memory Store provisioning, profile management, traits, observations,
conversation summaries, and semantic Recall. Use this skill to give AI agents
or human agents persistent memory of conversations across sessions
and channels.
---
## Overview
Conversation Memory gives agents persistent, cross-session context about customers. A **Memory Store** holds profiles, observations, summaries, and traits. Data enters two ways:
1. **Automatic:** Link a Conversation Orchestrator config to a store. Profiles are auto-created per caller. At conversation close, observations and summaries are extracted from the transcript and saved. Conflicting data is automatically reconciled.
2. **Direct API:** POST observations, summaries, or traits yourself for any use case.
Data comes out via **Recall** — hybrid semantic + lexical search that surfaces the most relevant profile data. For voice agents where latency is critical, use `GET /Observations` directly instead.
**Base URL:** `https://memory.twilio.com`
**Authentication:** HTTP Basic — `Authorization: Basic {base64(accountSid:authToken)}`
**Rules for agents:**
- Always poll `statusUrl` after any 202 response — all writes are async
- Always create a trait group before writing traits of that group
- Always use E.164 format for phone numbers (`+15558675310`)
- Always verify store status is `ACTIVE` before operating on it
- Never use `/v1/Services/` paths — correct paths are `/v1/ControlPlane/Stores` (config) and `/v1/Stores/{storeId}/...` (data)
- Never exceed 10 observations per batch or 4096 characters per observation
- Never assume writes are immediately readable — indexing is async
- Never send PCI or HIPAA data — not yet compliant
---
## Prerequisites
- Twilio account with Account SID and Auth Token
— A credit card must be added to the account
— See `twilio-account-setup` for initial setup
— See `twilio-iam-auth-setup` for credential best practices
- Environment variables:
- `TWILIO_ACCOUNT_SID`
- `TWILIO_AUTH_TOKEN`
- SDK: `pip install twilio` / `npm install twilio`
- For automatic extraction: a Conversation Orchestrator configuration — see `twilio-conversation-orchestrator`
---
## Quickstart
**Step 1 — Create a Memory Store**
**Python**
```python
import os, requests
from requests.auth import HTTPBasicAuth
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
base_url = "https://memory.twilio.com"
auth = HTTPBasicAuth(account_sid, auth_token)
store = requests.post(
f"{base_url}/v1/ControlPlane/Stores",
auth=auth,
json={"displayName": "my-store", "description": "Customer memory"}
).json()
print(store["id"]) # mem_store_xxx — save this
# Poll store["statusUrl"] until status is ACTIVE
```
**Node.js**
```node
const axios = require("axios");
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const baseUrl = "https://memory.twilio.com";
const auth = { username: accountSid, password: authToken };
const { data: store } = await axios.post(
`${baseUrl}/v1/ControlPlane/Stores`,
{ displayName: "my-store", description: "Customer memory" },
{ auth }
);
console.log(store.id); // mem_store_xxx
// Poll store.statusUrl until status is ACTIVE
```
**Step 2 — Create a profile with identity resolution**
**Python**
```python
profile = requests.post(
f"{base_url}/v1/Stores/{store['id']}/Profiles",
auth=auth,
json={"traits": {"contact": {"phone": "+15558675310", "name": "Alex"}}}
).json()
profile_id = profile["id"] # mem_profile_xxx
```
**Node.js**
```node
const { data: profile } = await axios.post(
`${baseUrl}/v1/Stores/${store.id}/Profiles`,
{ traits: { contact: { phone: "+15558675310", name: "Alex" } } },
{ auth }
);
const profileId = profile.id; // mem_profile_xxx
```
**Step 3 — Post observations (quick test)**
Post an observation directly to quickly test Recall in step 4. In production, the preferred path is connecting your Memory Store to a Conversation Orchestrator configuration — observations are then automatically extracted from conversations without manual POSTs. See `twilio-conversation-orchestrator`.
**Python**
```python
requests.post(
f"{base_url}/v1/Stores/{store['id']}/Profiles/{profile_id}/Observations",
auth=auth,
json={"observations": [{
"content": "Customer prefers email communication over phone calls",
"source": "support-agent",
"occurredAt": "2025-01-15T10:30:00Z"
}]}
)
# 202 — poll statusUrl for completion
```
**Node.js**
```node
await axios.post(
`${baseUrl}/v1/Stores/${store.id}/Profiles/${profileId}/Observations`,
{ observations: [{
content: "Customer prefers email communication over phone calls",
source: "support-agent",
occurredAt: "2025-01-15T10:30:00Z",
}] },
{ auth }
);
// 202 — poll statusUrl for completion
```
**Step 4 — Recall relevant context**
**Python**
```python
recall = requests.post(
f"{base_url}/v1/Stores/{store['id']}/Profiles/{profile_id}/Recall",
auth=auth,
json={"query": "communication preferences"}
).json()
for obs in recall["observations"]:
print(f"[{obs['score']:.2f}] {obs['content']}")
```
**Node.js**
```node
const { data: recall } = await axios.post(
`${baseUrl}/v1/Stores/${store.id}/Profiles/${profileId}/Recall`,
{ query: "communication preferences" },
{ auth }
);
for (const obs of recall.observations) {
console.log(`[${obs.score.toFixed(2)}] ${obs.content}`);
}
```
---
## Key Patterns
### Recall Modes
| Mode | Request | When to use |
|------|---------|-------------|
| Explicit query | `{"query": "shipping preferences"}` | You control relevance |
| Conversation context | `{"conversationId": "conv_conversation_xxx"}` | Active Orchestrator conversation — auto-generates query from last 10 messages |
| Most recent | `{}` (omit both) | Chronological order, no relevance ranking |
Additional Recall parameters: `observationsLimit` (default 20, 0–100), `summariesLimit` (default 5), `communicationsLimit` (default 0, requires conversationId), `relevanceThreshold` (0–1), `beginDate`/`endDate`.
### Profile Resolution
| I have... | Use | Behavior |
|-----------|-----|----------|
| Profile ID | `PATCH /v1/Stores/{storeId}/Profiles/{profileId}` | Direct update |
| An identifier (phone, email) | `POST /v1/Stores/{storeId}/Profiles` | Identity resolution finds or creates |
| Bulk contact data | `PUT /v1/Stores/{storeId}/Profiles/Bulk` | Up to 1000, identity-resolved |
| CSV file | `POST /v1/Stores/{storeId}/Profiles/Imports` | Presigned URL upload |
Check for 308 redirects on profile endpoints — indicates a merged profile.
### Trait Groups
Every trait must belong to a trait group. You must create the group (or add the trait to an existing group) before writing trait values to a profile.
Each trait has a `dataType` (STRING, NUMBER, BOOLEAN, ARRAY). Set `idTypePromotion` on a trait (e.g., `"phone"`) to make it an identifier for Lookup and identity resolution.
**Add a new trait to an existing group:**
Use `PATCH /v1/ControlPlane/Stores/{storeId}/TraitGroups/{traitGroupName}` — pass the new trait definition in the request body. Only the new traits need to be included; existing traits are unchanged.
**Python**
```python
requests.patch(
f"{base_url}/v1/ControlPlane/Stores/{store['id']}/TraitGroups/contact",
auth=auth,
json={"traits": {
"preferred_channel": {"dataType": "STRING", "description": "Preferred contact method"}
}}
)
# 202 — adds "preferred_channel" to the existing "contact" group
```
**Node.js**
```node
await axios.patch(
`${baseUrl}/v1/ControlPlane/Stores/${store.id}/TraitGroups/contact`,
{ traits: {
preferred_channel: { dataType: "STRING", description: "Preferred contact method" },
} },
{ auth }
);
// 202 — adds "preferred_channel" to the existing "contact" group
```
To remove a trait from a group, PATCH with `"dataType": ""` for that trait name.
### Automatic Extraction (Orchestrator Integration)
1. Create a Memory Store
2. Create a Conversation Orchestrator Configuration with capture rules
3. Link the store to the config
Once linked: profiles are auto-created per caller, and extraction is tied to the conversation lifecycle configured in Orchestrator. By default, observations are extracted when a conversation goes inactive or ends. Conversation summaries are generated when a conversation ends. These lifecycle transitions are configurable in your Orchestrator configuration — how you define conversation status timeouts determines when memory extraction runs. Conflicting information is automatically reconciled. See `twilio-conversation-orchestrator`.
### Lookup by Identifier
**Python**
```python
result = requests.post(
f"{base_url}/v1/Stores/{store['id']}/Profiles/Lookup",
auth=auth,
json={"idType": "phone", "value": "+15558675310"}
).json()
profile_id = result["profiles"][0]["id"]
```
**Node.js**
```node
const { data: result } = await axios.post(
`${baseUrl}/v1/Stores/${store.id}/Profiles/Lookup`,
{ idType: "phone", value: "+15558675310" },
{ auth }
);
const profileId = result.profiles[0].id;
```
### Voice Agent Latency Optimization
For voice agents where latency matters, skip semantic search and fetch observations directly:
**Python**
```python
observations = requests.get(
f"{base_url}/v1/Stores/{store['id']}/Profiles/{profile_id}/Observations",
auth=auth,
params={"source": "support-agent", "createdAfter": "2025-01-01T00:00:00Z"}
).json()
```
**Node.js**
```node
const { data: observations } = await axios.get(
`${baseUrl}/v1/Stores/${store.id}/Profiles/${profileId}/Observations`,
{ auth, params: { source: "support-agent", createdAfter: "2025-01-01T00:00:00Z" } }
);
```
### Async Polling Pattern
All 202 responses include a `statusUrl`. Poll until `status` is `COMPLETED` or `FAILED`:
**Python**
```python
import time
status_url = store["statusUrl"]
while True:
op = requests.get(status_url, auth=auth).json()
if op["status"] in ("COMPLETED", "FAILED", "CANCELLED"):
break
time.sleep(2)
```
**Node.js**
```node
let op;
do {
await new Promise(r => setTimeout(r, 2000));
op = (await axios.get(store.statusUrl, { auth })).data;
} while (!["COMPLETED", "FAILED", "CANCELLED"].includes(op.status));
```
---
## CANNOT
- Cannot exceed 15 Memory Stores per account — use sub-accounts beyond this
- Cannot batch more than 10 observations per request
- Cannot exceed 4096 characters per observation
- Cannot write traits to a group that doesn't exist — create the trait group first
- Cannot recover deleted profiles or observations — deletion is irreversible
- Cannot read data immediately after write — indexing is async
- Cannot auto-extract observations without a linked Orchestrator config
- Cannot exceed 1000 profiles per bulk upsert
- Cannot include auth headers when uploading to presigned import URLs — they're pre-signed
- Cannot use spaces or underscores in store displayName — pattern is `^[a-zA-Z0-9-]+$`
---
## Next Steps
- **Automatic conversation capture:** `twilio-conversation-orchestrator`
- **Background transcript intelligence (script adherence, NBR, scoring):** `twilio-conversation-intelligence`
- **Enterprise knowledge retrieval (RAG):** `twilio-enterprise-knowledge`
- **Voice agent with ConversationRelay:** `twilio-voice-conversation-relay`
- **TAC SDK middleware:** `twilio-agent-connect`
- **Debug issues:** `twilio-debugging-observability`
From twilio/ai at 8aba46f, shown as plain text under its license: MIT (permissive). The license text is in LICENSE.
View SKILL.md on GitHub at 8aba46fFiles
- SKILL.md12 KB · 1b35849b61ca
- agents/
- openai.yaml468 B · e22186458cc1
- assets/
- icon-large.png9.6 KB · 0ba822e01172
- icon-small.png5.6 KB · 400e3f49b6c1
4 files, 27 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at 8aba46fMore from Twilio
twilio-account-setup
Sets up a Twilio account from scratch, including free trial signup, credential retrieval, phone number purchase, and enabling specific products like AI…
Claude Code, Codex, Cursor +4 · about 2.5K tokens · pinned 7 days ago
twilio-agent-augmentation-architect
This skill helps developers design AI-augmented contact center systems that enhance human agents with real-time intelligence.
Claude Code, Codex, Cursor +3 · about 3.6K tokens · pinned 7 days ago
twilio-agent-connect
Twilio Agent Connect is middleware that integrates LLM agents with Twilio communication channels (voice, SMS, RCS, WhatsApp, chat).
Claude Code, Codex, Cursor +4 · about 4.1K tokens · pinned 7 days ago
twilio-ai-agent-architect
Planning skill that helps developers design AI-powered conversational agents by assessing their use case across outcome sophistication, channels, and customer…
Claude Code, Codex, Cursor +3 · about 4.9K tokens · pinned 7 days ago
twilio-call-recordings
This skill teaches agents to record Twilio voice calls correctly using the appropriate method for the use case.
Claude Code, Codex, Cursor +4 · about 2.6K tokens · pinned 7 days ago
twilio-cli-reference
The Twilio CLI reference enables agents to manage Twilio resources directly from the terminal, including phone number provisioning, sending SMS and email…
Claude Code, Codex, Cursor +4 · about 1.8K tokens · pinned 7 days ago
Related in AI and agents
twilio-conversation-intelligence
This skill guides developers in implementing Twilio's Conversation Intelligence v3 API for real-time and post-conversation analysis of SMS, Voice, RCS…
by TwilioOfficial publisher
Claude Code, Codex, Cursor +4 · about 8.8K tokens · pinned 7 days ago
twilio-enterprise-knowledge
This skill adds retrieval-augmented generation (RAG) to AI agents using Twilio Enterprise Knowledge, enabling semantic search across your organization's…
by TwilioOfficial publisher
Claude Code, Codex, Cursor +4 · about 3.2K tokens · pinned 7 days ago
agent-builder
Agent Builder orchestrates the creation, modification, testing, and publishing of n8n Agents.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 2.3K tokens · pinned 7 days ago
intent-recognition
Classifies automation requests by determining which primitive owns the top-level control flow (workflow, agent, needs clarification, or out-of-scope) and…
by n8nOfficial publisher
Claude Code, Codex, Cursor +4 · about 6.9K tokens · pinned 7 days ago
planned-task-runtime
This skill manages follow-up interactions with a background task execution system, handling task completion synthesis, failure replanning, workflow building…
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 2.2K tokens · pinned 7 days ago
skill-creator
This skill guides agents through creating new skills that extend Gemini CLI with specialized knowledge, workflows, and tool integrations.
by GoogleOfficial publisher
Contains scripts
Gemini CLI · about 5K tokens · pinned 7 days ago