Resolving a recipient
Use find-contact before asking the user for someone's email address, and
before guessing a pattern like firstinitiallastname@company.com.
find-contact --query="<name or partial email>" --limit=5matches case-insensitively against name and email, splitting the query into whitespace-separated terms that must ALL match ("jacqueline lamb"requires both terms present).- Results are sorted by
count, an interaction-frequency score. Google People API "connections" (explicitly saved contacts) start atcount: 5; "other contacts" (people the user has emailed but not saved) start lower. Sending or receiving mail increments a realsendCount/receiveCountin thecontact_frequencySQL table, so the top match is usually the person the user actually means. - If
find-contactreturns zero matches, tell the user — do not invent an email address. A wrong guess either bounces or, worse, silently reaches the wrong inbox. - Results are cached per-owner for a few minutes (
contactCacheinserver/handlers/emails.ts). A contact added in Google Contacts moments ago may not appear immediately; that's expected, not a bug to route around.
CRM enrichment
get-hubspot-contact --email=<address>is the only first-class CRM action. It returns contact fields (name, phone, company, title, lifecycle stage, lead status) plus up to 5 associated deals and up to 5 associated tickets, reading the user's own HubSpot API key configured in Settings. If no key is configured it returns{ error: "HubSpot API key not configured" }— surface that plainly rather than treating it as "no CRM data exists."- Gong, Pylon, and Apollo are UI-only in Mail. They have server route
handlers (
server/handlers/gong.ts,pylon.ts,apollo.ts) that power the CRM sidebar panel in the email view, each reading its own per-session API key fromappStateGet. None of the three is registered in Mail'sMAIL_PROVIDER_API_IDS(seelistProviderApiIdsForTemplateUse("mail")inserver/lib/provider-api.ts, which currently resolves togmail,google_calendar, andhubspotonly). This means:- There is no agent action for Gong calls, Pylon tickets, or Apollo person lookups in Mail.
provider-api-requestwill refuseprovider: "gong","pylon", or"apollo"in this app even though those provider ids exist in the shared catalog — they're enabled for other templates (e.g. Analytics), not Mail.- If the user asks the agent to pull a Gong call or Pylon ticket from Mail,
say plainly that integration is visible in the UI sidebar only today; do
not fabricate a result or imply
provider-api-requestcan reach it.
- For HubSpot data outside contact lookup (deals search, ticket creation,
property metadata), use
provider-api-catalog/provider-api-docswithprovider: "hubspot", thenprovider-api-request—get-hubspot-contactonly covers the single "lookup by email" shape.
Related Skills
email-drafts— use resolved contacts and CRM context when composing.draft-queue— resolving the rightownerEmailteammate useslist-org-members, a separate lookup fromfind-contact.actions— the shared provider API pattern forprovider-api-request.