agentleFS
wittyreferencewittyreference/twilio-claude-plugin/skills/customer-memory/SKILL.md

customer-memory

Skill2 starsChanged 8 months agoMITView on GitHub

Twilio development skill: customer-memory

  • Reads credentials
  • Sends data out

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create memory stores as profile containers (max 15/account, 10K profiles/store) <!-- verified: T1 -->

    line 26
  2. Distinctive:

    Delete profiles (async, HTTP 202) <!-- verified: T3 -->

    line 35
  3. Distinctive:

    Store deletion: Check current API documentation for store deletion support.

    line 61
  4. Distinctive:

    After creating a Store and Conversation Configuration with phone numbers, SMS conversations are automatically ingested.

    line 158
  5. Very specific:

    occurredAt is required for manual observations: Not listed as required in docs, but API rejects without it.

    line 230
  6. Distinctive:

    Reconciliation latency is 30-60 seconds: Not instantaneous. The AI model processes contradictions asynchronously.

    line 233
  7. Distinctive:

    Not PCI or HIPAA compliant: Do not store payment card data, health records, or other regulated data.

    line 262
  8. Very specific:

    Profile deletion: Delete a customer profile via DELETE /v1/Services/{serviceSid}/Profiles/{profileSid} to remove all associated data …

    line 268
  9. Distinctive:

    Data persistence: Check current documentation for data retention and migration guarantees.

    line 274

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

name: customer-memory description: Twilio Customer Memory development guide. Use when building customer context persistence, personalized AI agents, omnichannel profile management, or integrating memory into ConversationRelay or messaging flows. allowed-tools: mcp__twilio__*, Read, Grep, Glob

<!-- verified: memory.twilio.com/v1 API, conversations.twilio.com/v2 API + live testing 2026-03-26 -->

Twilio Customer Memory

AI-powered contextual data layer for customer profiles. Stores traits (structured facts), observations (unstructured insights auto-extracted from conversations), summaries, identifiers, and events. Provides semantic + lexical hybrid Recall search. Integrates with Twilio Conversations (SMS, WhatsApp, Voice) for automatic profile hydration.

Generally available — Not PCI or HIPAA compliant. AI models: OpenAI GPT-5-mini + text-embedding-3-large.

Evidence date: 2026-03-26.

Scope

CAN

  • Create memory stores as profile containers (max 15/account, 10K profiles/store) <!-- verified: T1 -->
  • Auto-extract observations from closed/inactive conversations (after conversation config set up) <!-- verified: docs -->
  • Auto-hydrate SMS profiles from configured phone numbers via Conversation Configuration <!-- verified: T12 -->
  • Recall with semantic + lexical hybrid search across observations, summaries, and communications <!-- verified: T9 -->
  • Recall without explicit query — returns recent observations (fast: ~37ms vs 800-10000ms with semantic query) <!-- verified: T9 -->
  • Structured traits via trait groups with validation rules (STRING, BOOLEAN, INTEGER, arrays) <!-- verified: T2 -->
  • Auto-promote traits to identifiers via idTypePromotion (phone, email, chat, whatsapp) <!-- verified: T5 -->
  • Identity resolution across channels with EXACT matching and profile merging <!-- verified: T4 -->
  • Observation reconciliation: contradictions update in-place, enrichments merge, unsupported discard <!-- verified: T8 -->
  • Delete profiles (async, HTTP 202) <!-- verified: T3 -->
  • Date-range filtering and relevance threshold on Recall <!-- verified: T9 -->
  • Lookup profiles by identifier via GET /Profiles?idType=X&value=Y <!-- verified: T6 -->
  • Bulk upsert up to 1000 profiles per request (async) <!-- verified: T13 -->
  • CSV import up to 1M rows with automatic trait mapping (Console only)
  • Profile events for tracking actions (up to 1000/batch, 10 properties each)
  • Custom trait groups with custom trait definitions <!-- verified: T2 -->

CANNOT

  1. Cannot delete memory stores — Private beta limitation. Once created, a store is permanent. Plan names carefully. <!-- verified: docs + no delete endpoint found -->
  2. Cannot move traits between groups — Trait-to-group assignment is permanent. Design taxonomy before creating. <!-- verified: docs -->
  3. Cannot reconcile profiles across stores — Multi-store = isolation, not federation. Same customer gets separate profiles. <!-- verified: docs -->
  4. Cannot use for PCI/HIPAA data — Uses OpenAI models. Data stored for 3 years. <!-- verified: nutrition-facts.md -->
  5. Cannot use fuzzy identity matching — matchingAlgo only supports exact. No phonetic or partial matching. <!-- verified: T4 -->
  6. Cannot create profiles without traits — Error 400: "Traits are required to create a profile." Must provide at least one registered trait. <!-- verified: T3 -->
  7. Cannot use unregistered trait names — Error 400: "Trait not registered for this service." Traits must be defined in a trait group first. <!-- verified: T3 -->
  8. Cannot Recall without both storeId and profileId — No cross-profile search exists. Use Lookup first to resolve identifier → profileId. <!-- verified: T9 -->
  9. Cannot request communications without conversationId — Recall fails with 400 if communicationsLimit > 0 without conversationId. <!-- verified: T9 -->
  10. Cannot create conversation summaries without conversationId — Manual summary injection requires a real conversation reference. <!-- verified: T10 -->
  11. 17 MCP tools available — Stores, Trait Groups, Profiles, Observations, Recall, and Identity Resolution via mcp__twilio__* tools. Use ToolSearch("select:mcp__twilio__create_memory_store") to hydrate before calling. <!-- verified: MCP REFERENCE.md search -->
  12. Cannot get real-time observations — Extraction happens post-conversation (when closed/inactive), not during. <!-- verified: docs -->
  13. CI v3 webhook profileId: null for participants without Memory profiles — When Intelligence v3 sends operator results via webhook, participants[].profileId is null (not absent) for callers without a Memory profile. TAC SDK's Zod schema must use .nullable().optional() to accept this. The "No memory store ID in event" error is a downstream symptom — the SDK rejects the payload before reaching Memory logic. <!-- verified: 2026-05-18 live testing -->

Data Lifecycle & Compliance Notes

  • Store deletion: Check current API documentation for store deletion support.
  • Profile deletion: Async (HTTP 202). No completion confirmation callback. Unclear whether deletion reaches OpenAI embeddings or overrides the 3-year retention window.
  • GDPR Article 17 (Right to Erasure): Profile deletion is the closest available mechanism, but completeness of erasure across the OpenAI processing chain is undocumented. Consult Twilio for GDPR compliance guarantees before storing EU personal data.
  • Data retention: 3 years per AI Nutrition Facts. No configurable retention period in beta.
  • Data processing: Observations processed by OpenAI GPT-5-mini; embeddings by text-embedding-3-large. Data residency and sub-processor DPA details not documented for beta.

Quick Decision

NeedUseWhy
Customer context across voice/messaging sessionsCustomer MemoryPurpose-built cross-session, cross-channel profiles
Application state across webhook callsSync DocumentsStructured JSON, real-time, TTL support
Structured CRM-like fields (name, tier)Customer Memory TraitsKey-value in trait groups, bulk importable
Unstructured conversation insightsCustomer Memory ObservationsAuto-extracted, AI-reconciled, searchable via Recall
Real-time call state during single callSync Document per CallSidCustomer Memory is post-conversation
Organizational knowledge (FAQs, docs)Enterprise KnowledgeShared/org-level, not per-customer
Agent handoff contextCustomer Memory Recall + SummariesPrior conversation summaries for handoff agent
Session-scoped temp stateURL params or Sync with TTLCustomer Memory is persistent, no TTL

Decision Frameworks

Traits vs Observations vs Events

CriterionTraitsObservationsEvents
Data shapeKey-value (structured)Free-text phrase (unstructured)Named action + properties
SourceAPI/CSV/Bulk, manualAuto-extracted from conversations, or manual via APIAPI ingestion
MutabilityOverwritable per keyAI-reconciled (contradictions update in-place)Append-only
Searchable via RecallNo (fetch via profile GET)Yes (semantic + lexical)Not confirmed
Pre-registrationRequired (trait group + trait definition)No schema neededNo schema needed
Max per profile50 groups × 95 traits500Unknown
Use caseIdentity, segmentation, routing rulesPreferences, behaviors, contextTracking actions, analytics
ExampleContact.firstName: "Jane""Prefers email over phone"page_viewed { page: "pricing" }

Store Topology

StrategyWhenTradeoff
Single storeMost cases. One business, unified profilesSimplest. No cross-store reconciliation issues.
Production + sandboxNeed isolated testingProfiles duplicated. Cannot delete stores when done.
Per business unitRegulatory isolation, separate data governanceNo reconciliation. Same customer calling both units gets two profiles.

Identity Resolution Strategy

  1. Default config ships with 4 identifier types: phone, email, chat, whatsapp — all with enforceUnique=true, limit=100, FIFO overflow
  2. Traits with idTypePromotion auto-create identifiers — Setting Contact.phone on a profile automatically creates a phone identifier. No separate API call needed.
  3. Matching rules determine merge behavior: if a new profile's identifier matches one existing profile, it updates; if it matches multiple, they merge; if no match, a new profile is created.
  4. Add custom identifier types by updating ID Resolution Settings with additional identifierConfigs entries.
  5. Normalization options: phone (E.164), email (lowercase), trim (whitespace). Chat and whatsapp default to trim.

Recall Optimization

ScenarioStrategyExpected latency
Need relevant memories for current conversationProvide query + conversationId800-10000ms (semantic search)
Need all recent context (no specific query)Omit query, omit conversationId~37ms (returns recent observations)
Need conversation-specific communicationsProvide conversationId + communicationsLimit > 0Varies
Filter low-relevance noiseSet relevanceThreshold (0-1). 0.8 is aggressive — filters most results.—
Default limitsobservationsLimit: 20, summariesLimit: 5, communicationsLimit: 0—

Integration Patterns

ConversationRelay + Customer Memory

Flow: Inbound call → TwiML webhook → ConversationRelay WebSocket → setup event → Lookup profile by phone → Recall observations/summaries → Inject into LLM system prompt → Conversation proceeds → Call ends → Observations auto-extracted.

// In WebSocket setup handler — lookup + recall
const storeId = 'mem_store_...';
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const auth = Buffer.from(`${accountSid}:${authToken}`).toString('base64');

// Step 1: Lookup profile by caller phone number
const lookupResp = await fetch(
  `https://memory.twilio.com/v1/Stores/${storeId}/Profiles?idType=phone&value=${encodeURIComponent(callerPhone)}`,
  { headers: { Authorization: `Basic ${auth}` } }
);
const { profiles } = await lookupResp.json();

if (profiles && profiles.length > 0) {
  // Step 2: Recall memories for the profile
  const recallResp = await fetch(
    `https://memory.twilio.com/v1/Stores/${storeId}/Profiles/${profiles[0]}/Recall`,
    {
      method: 'POST',
      headers: { Authorization: `Basic ${auth}`, 'Content-Type': 'application/json' },
      body: JSON.stringify({ observationsLimit: 20, summariesLimit: 5 })
    }
  );
  const memories = await recallResp.json();
  // Inject memories.observations and memories.summaries into system prompt
}

Messaging + Auto-Hydration

After creating a Store and Conversation Configuration with phone numbers, SMS conversations are automatically ingested. Observations are extracted when conversations close (default: 15 min timeout for messaging).

# 1. Create store (one-time)
POST https://memory.twilio.com/v1/ControlPlane/Stores
{"displayName": "my-store", "description": "Production memory store"}

# 2. Create conversation configuration (one-time)
POST https://conversations.twilio.com/v2/ControlPlane/Configurations
{
  "displayName": "sms-config",
  "description": "SMS auto-hydration",
  "conversationGroupingType": "GROUP_BY_PARTICIPANT_ADDRESSES",
  "memoryStoreId": "mem_store_..."
}
# Then assign phone numbers via Console

Programmatic Profile Management

# Register a custom trait group
POST https://memory.twilio.com/v1/ControlPlane/Stores/{storeId}/TraitGroups
{
  "displayName": "Loyalty",
  "description": "Customer loyalty program data",
  "traits": {
    "tier": {"dataType": "STRING", "description": "Gold/Silver/Bronze"},
    "points": {"dataType": "INTEGER", "description": "Accumulated points"},
    "memberSince": {"dataType": "STRING", "description": "ISO date of enrollment"}
  }
}

# Create profile with traits (async)
POST https://memory.twilio.com/v1/Stores/{storeId}/Profiles
{
  "traits": {
    "Contact": {"firstName": "Jane", "lastName": "Doe", "email": "jane@example.com"},
    "Loyalty": {"tier": "Gold", "points": 1500, "memberSince": "2024-01-15"}
  }
}

# Add manual observations (async)
POST https://memory.twilio.com/v1/Stores/{storeId}/Profiles/{profileId}/Observations
{
  "observations": [
    {"content": "Prefers email over phone calls", "source": "crm-import", "occurredAt": "2026-03-25T10:00:00Z"}
  ]
}

Gotchas

Setup & Stores

  1. Stores cannot be deleted: Private beta limitation. Creating a store is irreversible. Use descriptive, intentional names. <!-- verified: T1, docs -->
  2. displayName is 32 chars, alphanumeric + hyphens/underscores only: Not the friendly name — it's the URL-safe unique identifier. <!-- verified: docs -->
  3. Duplicate displayName returns error 20001: "a memory store with displayName 'X' already exists for account 'AC...'" <!-- verified: T1 -->
  4. Store creation is async: Returns status: "QUEUED", becomes ACTIVE within seconds. Fetch to verify. <!-- verified: T1 -->
  5. IDs use mem_* prefix, not Twilio SID format: Stores are mem_store_*, profiles mem_profile_*, observations mem_observation_*. Not AC/IS/ET format. <!-- verified: T1, T3, T7 -->

Traits & Trait Groups

  1. Traits must be pre-registered in a trait group: Cannot create profiles with ad-hoc trait names. Error: "Trait not registered for this service." Register the trait group first via ControlPlane API. <!-- verified: T3 -->
  2. Trait names are camelCase: firstName not first_name. The default Contact group uses camelCase for all 11 traits. <!-- verified: T2 -->
  3. Default Contact group ships with 11 traits: firstName, lastName, email, phone, chat, whatsapp, city, state, country, postalCode, street. Docs understate this as "first name, last name, phone, address." <!-- verified: T2 -->
  4. Traits cannot be moved between groups: Assignment is permanent. Design your trait group taxonomy carefully before creating traits. <!-- verified: docs -->
  5. Trait group API path is ControlPlane: GET /v1/ControlPlane/Stores/{id}/TraitGroups works. /v1/Stores/{id}/TraitGroups returns 404. <!-- verified: T2 -->
  6. idTypePromotion auto-creates identifiers: Setting Contact.email automatically creates an email identifier on the profile. No separate identifier API call needed. <!-- verified: T5 -->

Observations & Reconciliation

  1. occurredAt is required for manual observations: Not listed as required in docs, but API rejects without it. Error: "observations[N].occurredAt: must not be null." <!-- verified: T7 --> 12b. occurredAt clock skew breaks Recall ordering: Customer Memory observations sort by occurredAt. Clock skew >30s between your WebSocket/server and Twilio causes out-of-order Recall results. Use server-side timestamps from Twilio events (call setup start_time, message dateSent, CRelay setup message) for occurredAt, NOT local clock. NTP-sync your servers — required when clocks may drift (containers, multi-region, ephemeral compute). <!-- verified: super-uber-validation 2026-05-19 chaos scenario 6 -->
  2. Observation reconciliation updates in-place: Same observation ID retained. Content merged by AI model. updatedAt reflects the reconciliation time. Original context is preserved in the rewritten content. <!-- verified: T8 -->
  3. Reconciliation latency is 30-60 seconds: Not instantaneous. The AI model processes contradictions asynchronously. <!-- verified: T8 -->
  4. Conversation summaries require a conversationId: Cannot manually inject summaries without a real conversation reference. <!-- verified: T10 -->

Identity Resolution

  1. Default ID resolution includes 4 types: phone, email, chat, whatsapp. All with enforceUnique: true, limit: 100. Pre-configured on store creation. <!-- verified: T4 -->
  2. Enum values are lowercase in API responses: "exact" not "EXACT", "fifo" not "FIFO". Docs show uppercase. <!-- verified: T4 -->
  3. matchingThreshold: 75 exists but is undocumented: Present in ID resolution settings response. Purpose unclear. <!-- verified: T4 -->
  4. trim normalization exists: Used for chat and whatsapp identifiers. Not in docs (only "email" and "phone" documented). <!-- verified: T4 -->

Recall

  1. Recall without query is 20-270x faster: ~37ms vs 800-10000ms depending on data volume. Use query-less Recall when you want recent context without semantic search overhead. <!-- verified: T9 -->
  2. relevanceThreshold=0.8 filters aggressively: May return 0 results even with clearly related observations. Start with 0.3-0.5 for practical filtering. <!-- verified: T9 -->
  3. communicationsLimit > 0 requires conversationId: Error 400 if you request communications without specifying a conversation. <!-- verified: T9 --> 22b. Recall latency scales with observation volume: Profiles with 400+ observations and long content can push Recall to 10s+ response times. For voice AI (where latency matters), set observationsLimit: 10-20 and relevanceThreshold: 0.3-0.5 to filter noise. Implement application-level observation pruning for high-volume profiles before they degrade. No 413 has been observed; HTTP client timeout is the practical ceiling. <!-- verified: super-uber-validation 2026-05-19 chaos scenario 7 --> 22c. Cross-product timing: When using Customer Memory with ConversationRelay, see /conversationrelay Security section for prompt-injection defense and clock-sync requirements. <!-- cross-reference --> 22d. Prompt injection defense for observations: Observations stored in Customer Memory may be recalled into LLM contexts. See Twilio prompt-injection defense guidance for the three-layer defense pattern (write-time sanitizer, read-time wrapping, system prompt instruction). <!-- verified: super-uber-validation 2026-05-19 UC12/UC13 -->

Bulk & CSV

  1. Bulk upsert requires pre-registered traits: Same constraint as single profile creation. Trait groups must exist first. The bulk response says "Events accepted for processing" (confusing wording) regardless. <!-- verified: T13 -->
  2. CSV requires phone or email identifier: Other identifier types not supported for CSV import. <!-- verified: docs -->
  3. "Completed" CSV status includes partial failures: Files with fewer than 100 failed rows still show "Completed." Always check row-level details. <!-- verified: docs -->

Compliance & AI

  1. Not PCI or HIPAA compliant: Do not store payment card data, health records, or other regulated data. <!-- verified: docs -->
  2. AI models are OpenAI (GPT-5-mini, text-embedding-3-large): Customer data is processed by OpenAI models for observation extraction, reconciliation, and Recall embeddings. <!-- verified: nutrition-facts.md -->
  3. 3-year data retention: Per AI Nutrition Facts. <!-- verified: nutrition-facts.md -->

GDPR & Data Erasure

Profile deletion. Delete a customer profile via DELETE /v1/Services/{serviceSid}/Profiles/{profileSid} to remove all associated data (traits, observations, identifiers, summaries). Check docs for Memory Store deletion support.

No automated TTL. Customer Memory has no built-in data retention limits. Developers must implement cleanup logic for time-bound data or respond to GDPR erasure requests manually.

OpenAI sub-processing. Customer data is processed by OpenAI models (gotcha #27). Document this in your DPA. The 3-year retention policy (gotcha #28) may conflict with GDPR minimization requirements — plan erasure workflows accordingly.

Data persistence. Check current documentation for data retention and migration guarantees.

Related Resources

  • Sync skill (/sync) — For application state; complements Customer Memory for customer knowledge
  • ConversationRelay CLAUDE.md (/conversationrelay skill) — Primary integration surface for voice AI
  • Memory Systems skill (/memory-systems) — Broader state tracking patterns
  • Voice Use Case Map (/voice-use-case-map) — Voice AI agent use cases
  • 17 MCP tools — mcp__twilio__create_memory_store, recall_memories, create_memory_profile, etc. Hydrate via ToolSearch before use.
  • Agent Connect (TAC) skill (/agent-connect) — SDK wrapper that automates Memory retrieval
  • Conversations (unified stack) (Twilio Conversations documentation) — End-to-end integration guide for Conversations v2 + Customer Memory + Intelligence v3 pipeline. Setup sequence, data flow, cross-product gotchas.

Reference Files

TopicFileWhen to read
Full API endpointsreferences/api-reference.mdMaking any Customer Memory API call
Data modeling decisionsreferences/data-modeling.mdDesigning profile schema, choosing traits vs observations, identity resolution
Resource limitsreferences/limits.mdValidating a design against product limits
Test evidencereferences/test-results.mdVerifying behavioral claims with SID evidence
Assertion auditreferences/assertion-audit.mdProvenance chain for all factual claims

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.