К основному содержанию
скилл CX Codex GP ChatGPT официальный · OpenAI

twilio-customer-memory — скилл для Codex: память клиентов

Сохраняет и возвращает контекст о клиентах через Twilio Conversation Memory. Нужен агентам, которым требуется помнить прошлые обращения между сессиями и каналами.

Установить в Codex · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add openai/plugins --skill twilio-customer-memory -a codex
Открыть на GitHub

Что делает twilio-customer-memory

Скилл помогает подключить постоянную память клиентов к приложению через Twilio Conversation Memory. Он описывает создание Memory Store, работу с профилями, traits, наблюдениями и сводками разговоров, а также поиск контекста через Recall перед ответом модели.

Профили могут создаваться автоматически при работе через Conversation Orchestrator или вручную. Наблюдения извлекаются после завершения или остановки разговора; при собственной схеме извлечения их можно отправлять напрямую. Recall использует лексический и семантический поиск. Для авторизации нужны TWILIO_ACCOUNT_SID и TWILIO_AUTH_TOKEN, а доступ к Conversation Memory требует включения.

Memory Store нужно создать до Conversations Service, иначе его SID нельзя будет добавить в конфигурацию разговора и автоматическое извлечение наблюдений со сводками не сработает.

Какие задачи решает

  • создать Memory Store для памяти клиентов
  • найти профиль по номеру телефона
  • добавить traits к профилю клиента
  • сохранить наблюдения из собственной схемы извлечения
  • получить релевантный контекст перед ответом агента

Примеры запросов агенту

  • Настрой для приложения Twilio Conversation Memory и создай Memory Store.
  • Покажи, как найти профиль клиента по номеру телефона и добавить ему traits.
  • Перед ответом агента получи через Recall релевантные наблюдения и сводки разговора.

Как установить twilio-customer-memory

1Через Skills CLI (Vercel)

npx skills add openai/plugins --skill twilio-customer-memory -a codex

2Вручную: положить файлы

.agents/skills/twilio-customer-memory/SKILL.md

Для всех проектов — ~/.agents/skills/

По шагам, с командами для каждой платформы: Скиллы Codex: как установить, где лежат и как вызвать

Вопросы о twilio-customer-memory

Как установить twilio-customer-memory в Codex?

Выполните npx skills add openai/plugins --skill twilio-customer-memory -a codex, затем проверьте файл .agents/skills/twilio-customer-memory/SKILL.md.

Что делает twilio-customer-memory?

Скилл описывает хранение клиентского контекста в Twilio Conversation Memory: профилей, traits, наблюдений и сводок. Recall возвращает подходящий контекст для промпта модели.

Что нужно подготовить для работы с twilio-customer-memory?

Нужны аккаунт Twilio с доступом к Conversation Memory, переменные TWILIO_ACCOUNT_SID и TWILIO_AUTH_TOKEN. Сначала создайте Memory Store, а затем используйте его SID в конфигурации Conversations Service.

Исходный текст

SKILL.md · MIT
---
name: twilio-customer-memory
description: >
  Store and retrieve customer 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 customer interactions across sessions
  and channels.
---

## Overview

Conversation Memory gives your application persistent customer memory. Observations (what happened) and traits (who the customer is) are written automatically from conversations flowing through Conversation Orchestrator/Orchestrator — or posted directly if you run your own extraction. Retrieve relevant context via Recall before responding.

```
Conversation Orchestrator/Orchestrator conversation → auto-extracted observations & summaries → Memory Store
Your App → Recall → relevant context injected into LLM prompt
```

**All Conversation Memory APIs are on `memory.twilio.com`.** Observations, traits, profiles, summaries — everything is on the same host.

**Auth: Basic Auth** — `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN`.

---

## Prerequisites

- Twilio account with Conversation Memory access (requires enablement)
  — New to Twilio? See `twilio-account-setup`
- `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN` — see `twilio-iam-auth-setup`
- **Memory Store must be created before creating a Conversations Service in Conversation Orchestrator/Orchestrator** — the store SID is required in the conversation config
- For conversation orchestration: `twilio-conversation-orchestrator`

---

## Quickstart

### Step 1 — Create a Memory Store

Do this before setting up Conversation Orchestrator/Orchestrator. The Memory Store SID goes into your conversation service config.

**Python**
```python
import os, requests

account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]

store = requests.post(
    "https://memory.twilio.com/v1/Services",
    auth=(account_sid, auth_token),
    json={
        "uniqueName": "my-app-memory",
        "friendlyName": "My App Memory Store"
    }
).json()

memory_store_sid = store["sid"]
print(memory_store_sid)
```

**Node.js**
```javascript
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;

const store = await fetch("https://memory.twilio.com/v1/Services", {
    method: "POST",
    headers: {
        "Authorization": "Basic " + btoa(`${accountSid}:${authToken}`),
        "Content-Type": "application/json",
    },
    body: JSON.stringify({
        uniqueName: "my-app-memory",
        friendlyName: "My App Memory Store",
    }),
}).then(r => r.json());

const memoryStoreSid = store.sid;
```

Use `memory_store_sid` when creating your Conversations Service in Conversation Orchestrator/Orchestrator. The two must be linked for automatic observation and summary extraction to work.

### Step 2 — Profiles

Profiles are **created automatically** when conversations flow through Conversation Orchestrator/Orchestrator — the conversation config determines how participants are resolved into profiles. You can also create or enrich profiles manually using traits.

**Create a profile manually with traits:**

**Python**
```python
profile = requests.post(
    f"https://memory.twilio.com/v1/Services/{memory_store_sid}/Profiles",
    auth=(account_sid, auth_token),
    json={
        "traits": {
            "Contact": {
                "phone": "+15558675310",
                "firstName": "Alyssa",
                "lastName": "Mock",
                "email": "[email protected]"
            }
        }
    }
).json()

profile_id = profile["id"]
```

**Node.js**
```javascript
const profile = await fetch(
    `https://memory.twilio.com/v1/Services/${memoryStoreSid}/Profiles`,
    {
        method: "POST",
        headers: {
            "Authorization": "Basic " + btoa(`${accountSid}:${authToken}`),
            "Content-Type": "application/json",
        },
        body: JSON.stringify({
            traits: {
                Contact: {
                    phone: "+15558675310",
                    firstName: "Alyssa",
                    lastName: "Mock",
                    email: "[email protected]",
                }
            }
        }),
    }
).then(r => r.json());

const profileId = profile.id;
```

**Look up a profile by phone number** (for inbound calls where you only have the caller's number):

**Python**
```python
lookup = requests.post(
    f"https://memory.twilio.com/v1/Services/{memory_store_sid}/Profiles/Lookup",
    auth=(account_sid, auth_token),
    json={"idType": "phone", "value": "+15558675310"}
).json()

profile_id = lookup["profiles"][0]["id"] if lookup.get("profiles") else None
```

### Step 3 — Observations

Observations are **extracted automatically** from conversations when a conversation becomes inactive or is closed, based on your conversation config. You don't need to write them manually for Conversation Orchestrator-managed conversations.

**If you run your own extraction** (custom pipeline outside Conversation Orchestrator), post results directly:

**Python**
```python
requests.post(
    f"https://memory.twilio.com/v1/Services/{memory_store_sid}/Profiles/{profile_id}/Observations",
    auth=(account_sid, auth_token),
    json={
        "observations": [
            {
                "content": "Customer asked about order #4521. Wants expedited shipping. Prefers SMS updates.",
                "source": "custom_extraction",
                "occurredAt": "2026-04-20T14:30:00Z",
                "conversationIds": [conversation_sid]
            }
        ]
    }
)
```

**Node.js**
```javascript
await fetch(
    `https://memory.twilio.com/v1/Services/${memoryStoreSid}/Profiles/${profileId}/Observations`,
    {
        method: "POST",
        headers: {
            "Authorization": "Basic " + btoa(`${accountSid}:${authToken}`),
            "Content-Type": "application/json",
        },
        body: JSON.stringify({
            observations: [{
                content: "Customer asked about order #4521. Wants expedited shipping. Prefers SMS updates.",
                source: "custom_extraction",
                occurredAt: new Date().toISOString(),
                conversationIds: [conversationSid],
            }]
        }),
    }
);
```

Batch up to 10 observations in one request.

### Step 4 — Recall Context Before Responding

Recall runs hybrid lexical + semantic search and returns the most relevant observations and summaries for an LLM prompt.

**Recommended: pass a `conversationId` from Conversation Orchestrator/Orchestrator.** Recall builds a contextually relevant query from the active conversation automatically — no need to craft one yourself.

**Python**
```python
recall = requests.post(
    f"https://memory.twilio.com/v1/Services/{memory_store_sid}/Profiles/{profile_id}/Recall",
    auth=(account_sid, auth_token),
    json={
        "conversationId": orchestrator_conversation_sid,
        "observationsLimit": 10,
        "summariesLimit": 3,
    }
).json()

observations = "\n".join(o["content"] for o in recall.get("observations", []))
summaries = "\n".join(s["content"] for s in recall.get("summaries", []))

system_prompt = f"""You are a helpful support agent.

Customer history:
{observations}

Recent summaries:
{summaries}"""
```

**Node.js**
```javascript
const recall = await fetch(
    `https://memory.twilio.com/v1/Services/${memoryStoreSid}/Profiles/${profileId}/Recall`,
    {
        method: "POST",
        headers: {
            "Authorization": "Basic " + btoa(`${accountSid}:${authToken}`),
            "Content-Type": "application/json",
        },
        body: JSON.stringify({
            conversationId: orchestratorConversationSid,
            observationsLimit: 10,
            summariesLimit: 3,
        }),
    }
).then(r => r.json());

const context = [
    ...recall.observations.map(o => o.content),
    ...recall.summaries.map(s => s.content),
].join("\n");
```

**Other Recall modes:**

| Mode | How | When to use |
|------|-----|-------------|
| Conversation ID (recommended) | `"conversationId": orchestrator_sid` | Active Conversation Orchestrator/Orchestrator conversation — query is generated from conversation context |
| Custom query | `"query": "your question"` | Custom pipelines outside Conversation Orchestrator, or when you need precise control over relevance |
| No query | Omit both `query` and `conversationId` | Returns most recent observations in chronological order — useful for loading history at session start |

---

## Key Patterns

### Trait Groups

Traits are organized into named groups. The `Contact` group is the standard identity anchor — its fields are promoted to profile identifiers for lookup.

| Group | Fields | Use |
|-------|--------|-----|
| `Contact` | phone, email, firstName, lastName | Identity anchor — always include |
| `Account` | accountNumber, tier, region | Business account data |
| `Support` | disposition, caseId, lastIssueType | Support history |

Define your own groups for domain-specific data.

### Summaries

Summaries are written automatically at conversation close or when a conversation goes inactive, based on your conversation config — the same trigger as observations. You can also write them manually:

**Python**
```python
requests.post(
    f"https://memory.twilio.com/v1/Services/{memory_store_sid}/Profiles/{profile_id}/ConversationSummaries",
    auth=(account_sid, auth_token),
    json={
        "conversationId": conversation_sid,
        "content": "Customer called about order #4521. Resolved: approved expedited upgrade.",
        "source": "manual"
    }
)
```

Summaries are returned in the `summaries` array of Recall results.

### Voice Agent Integration

Retrieve memory at call start, store observations at call end. For voice AI agents on ConversationRelay.

**Python (WebSocket handler)**
```python
async def handle_call(websocket):
    setup = json.loads(await websocket.recv())
    caller = setup.get("from", "unknown")

    # Look up profile by caller phone
    lookup = requests.post(
        f"https://memory.twilio.com/v1/Services/{MEMORY_STORE_SID}/Profiles/Lookup",
        auth=(ACCOUNT_SID, AUTH_TOKEN),
        json={"idType": "phone", "value": caller}
    ).json()
    profiles = lookup.get("profiles", [])
    profile_id = profiles[0]["id"] if profiles else None

    context = ""
    if profile_id:
        recall = requests.post(
            f"https://memory.twilio.com/v1/Services/{MEMORY_STORE_SID}/Profiles/{profile_id}/Recall",
            auth=(ACCOUNT_SID, AUTH_TOKEN),
            json={"observationsLimit": 5, "summariesLimit": 2}
        ).json()
        context = "\n".join(o["content"] for o in recall.get("observations", []))

    system_prompt = f"You are a helpful agent.\n\nCustomer history:\n{context}" if context else "You are a helpful agent."

    # ... handle conversation ...

    # Store observation at end if running custom extraction
    if profile_id:
        requests.post(
            f"https://memory.twilio.com/v1/Services/{MEMORY_STORE_SID}/Profiles/{profile_id}/Observations",
            auth=(ACCOUNT_SID, AUTH_TOKEN),
            json={"observations": [{"content": call_summary, "source": "voice_agent", "conversationIds": [orchestrator_conversation_sid]}]}
        )
```

### Multi-Tenant (ISV) Pattern

Use one Memory Store per client. The `uniqueName` doubles as a namespace.

```python
# At client onboarding
store = requests.post(
    "https://memory.twilio.com/v1/Services",
    auth=(account_sid, auth_token),
    json={"uniqueName": f"client-{client_id}", "friendlyName": client_name}
).json()
# Store store["sid"] in your tenant config — pass it to Conversation Orchestrator conversation service setup
```

---

## CANNOT

- **Cannot create Conversation Orchestrator before Memory Store** — Create Memory Store first. Its SID is required when creating the Conversations Service. Reversing this order breaks the linkage.
- **Cannot extract observations mid-conversation** — Automatic extraction happens on conversation close or inactive. For real-time writing, post directly to the Observations endpoint.
- **Cannot read observations immediately after write** — Eventual consistency. Allow ~2 seconds after write before querying Recall.
- **Cannot exceed 15 Memory Stores per account** — ISVs with more than 15 tenants should use sub-accounts
- **Cannot detect misconfigured linkages** — If Memory Store is not correctly linked in Conversation Orchestrator config, observations are silently not extracted. See `twilio-debugging-observability`.
- **Cannot recover deleted profiles** — Profile deletion is irreversible, permanent
- **Cannot exceed 20 observations per Recall query** — `observationsLimit` max 20, default 5. `summariesLimit` and `communicationsLimit` similar.
- **Cannot batch more than 10 observations per request** — Hard limit on batch writes

---

## Next Steps

- **Set up Conversation Orchestrator conversations:** `twilio-conversation-orchestrator`
- **Add real-time intelligence:** `twilio-conversation-intelligence`
- **Enterprise knowledge retrieval (scripts, offers, policies):** `twilio-enterprise-knowledge`
- **Voice agent setup:** `twilio-voice-conversation-relay`
- **Debug integration issues:** `twilio-debugging-observability`

© Twilio · MIT · openai/plugins

Похожие скиллы

Все скиллы по теме «Настройка агента: память, контекст, субагенты» →
setup-matt-pocock-skills Matt Pocock Скилл настраивает репозиторий для инженерных скиллов Matt Pocock: задаёт трекер задач, метки триажа и расположение доменной документации. Запустите его перед первым использованием остальных скиллов. 1 052 851установок ask-matt Matt Pocock Помогает выбрать подходящий скилл или рабочий поток из набора Matt Pocock. Пригодится, когда непонятно, с чего начать задачу: от идеи до разбора бага. 766 587установок to-tickets Matt Pocock Разбивает план, спецификацию или переписку на небольшие сквозные задачи и отмечает, какие из них блокируют остальные. Пригодится, когда нужно согласовать порядок работы до публикации задач в трекере. 711 230установок writing-plans Jesse Vincent Скилл превращает требования к многошаговой задаче в подробный план реализации до начала работы с кодом. Пригодится, когда исполнителю нужно зафиксировать файлы, интерфейсы и проверки. CX Codex 282 859установок caveman-review JuliusBrussee Пишет замечания к коду одной строкой: место, проблема, исправление. Пригодится, когда ревью диффа или PR надо пройти быстро и без воды. CX Codex +1 411 800установок caveman-compress JuliusBrussee Сжимает CLAUDE.md, списки задач и другие текстовые файлы в краткий формат, сохраняя читаемую резервную копию. CX Codex +1 411 500установок

Из того же набора528

Весь набор →
twilio-iam-auth-setup Скилл для Codex и ChatGPT, который помогает настроить доступы Twilio: Auth Token, API-ключи и Access Tokens для клиентских SDK. Пригодится до первого вызова Twilio API. CX Codex GP ChatGPT ★ 7 604звёзд репо twilio-enterprise-knowledge Скилл учит агента заводить Knowledge Base в Twilio и подключать к ней документы, сайты и текст, чтобы ответы опирались на ваши материалы. CX Codex GP ChatGPT ★ 7 604звёзд репо twilio-email-deliverability-advisor Скилл разбирает проблемы доставки через Twilio Email API и предлагает действия по диагностике. Он пригодится, если письма попадают в спам или растёт число отказов. CX Codex GP ChatGPT ★ 7 604звёзд репо twilio-debugging-observability Разбирает, почему не доходят SMS и падают звонки, и помогает настроить мониторинг Twilio в продакшене. CX Codex GP ChatGPT ★ 7 604звёзд репо twilio-conversations-classic-api Скилл для Codex и ChatGPT, который помогает собирать многоканальные переписки на Twilio Conversations (classic) API: SMS, WhatsApp и веб-чат в одном треде. CX Codex GP ChatGPT ★ 7 604звёзд репо conversation-intelligence Скилл помогает проектировать анализ разговоров Twilio в реальном времени и после звонка: от тональности до подсказок оператору и сводной аналитики. CX Codex GP ChatGPT ★ 7 604звёзд репо twilio-content-template-builder Создаёт и отправляет шаблоны сообщений через Twilio Content API: WhatsApp, SMS, RCS и MMS с переменными и одобрением Meta. CX Codex GP ChatGPT ★ 7 604звёзд репо twilio-compliance-traffic Скилл проверяет правила для сообщений и звонков через Twilio: согласия, часы тишины, удаление данных и требования TCPA, GDPR, PCI DSS и HIPAA. CX Codex GP ChatGPT ★ 7 604звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой