People and Contact Cards

A reusable data pattern: one person, many contact cards, one per role or context, so every email, title and link resolves to the same human.

Path
specs/People-and-Contact-Cards.md
Authors
Michael Staton
Augmented with
Claude Code on Claude Opus 5.5
Tags
Data-Modeling · Identity-Model · Contact-Cards · People · CRM · SQLite · Turso

People and Contact Cards

A pattern for any Lossless project that keeps records of people: event attendees, registrants, fund teams, portfolio founders, CRM contacts. It answers one recurring question: how do we know two records are the same person when they came in with different emails, titles or companies?

First implementation: astro-knots/sites/fullstack-vc, for Dojo session registrations. See its spec, [[People-and-Contact-Cards-for-Session-Registrations]].

1. The idea

A person isn’t an email address. People change jobs, register for things with whichever address is at hand, and sign in with a third. So the person is one record, and everything that depends on context lives on a contact card: one card per role at an organization, plus a personal card and a socials card. Cards come and go; the person stays.

Use this pattern whenever a project:

  • takes in people from more than one source (a registration list, a login, a CRM export, a scraped team page);
  • needs to count or follow the same person over time;
  • has to keep a person’s history across job changes.

2. Tables

People

Column Notes
id A generated id (for example prs_ + random). Never an email.
name Display name
called JSON list of other names they go by: nicknames, short forms, pseudonyms, the name on an old record. Whole names (“Gopi Sundaramurthy”), so matching can compare them like name. When a curated name replaces an imported one, the old one moves here rather than being lost; a merge keeps both people’s names.
email, org, title Redundant, copied from the primary card (§4), so most queries never read JSON
project links Nullable links to the project’s own records: a login account, a public profile, a CRM id
created_at, updated_at ISO 8601

PersonContactCards

Column Notes
id A generated id (for example pcc_ + random)
person_id → People.id
card_type role, personal, socials. Projects may add types; document them in the project’s spec.
active Boolean. A role the person has left is inactive, not deleted.
timeframe JSON { "start", "end", "estimated"? }. Omit end while current.
card JSON with flexible fields, standardized below
source Where the card came from: zoom-registration, login, linkedin, crm-import, manual, …
created_at, updated_at ISO 8601

PersonInteractions

Column Notes
id
person_id → People.id
email The address they used, when there was one
kind registration, attendance, login, reply, crm-touch, …
at When it happened, ISO 8601
ref The source row, e.g. Session:<slug>, AuthEvent:<id>; unique with kind and email, so re-recording updates

An append-only log of every time we hear from someone, at which address. It decides which address to send to (§4), and answers “when did we last hear from this person?” on its own.

Rule of thumb: what you filter or join on is a column; what describes the card is JSON.

Project tables then point at person_id, not at an email: registrations, attendance, deal participation, introductions. When the email someone actually used matters, keep it alongside as a plain column (for example registered_email).

3. The card JSON

Flexible, so new fields need no migration; standardized, so the same thing is always written the same way. Keep a typed schema (Zod or similar) with the standard fields named and documented and unknown fields passed through, and route every write through it.

role: one role at one organization.

{ "org": "…", "org_domain": "example.vc", "title": "…", "email": "…", "email_aliases": ["…"], "email_pinned": false, "site_link": "https://…", "bio": "…", "primary": true }

personal: not tied to a role.

{ "email": "…@gmail.com", "phone": "…", "location": "…" }

socials: the usual links; one active socials card per person.

{ "linkedin": "https://…", "github": "https://…", "x": "https://…", "bluesky": "…", "site": "https://…" }

Conventions

  • snake_case field names.

  • Emails lowercased and trimmed.

  • Full https:// URLs.

  • primary: true only to override the default primary card.

  • One role, several addresses (two domains of one firm, an address from before a rebrand) is one card:

    • email is the address to send to;
    • email_aliases holds the rest, recognized on the way in and never sent to;
    • email_pinned: true fixes email by hand.

    A personal address beside a firm one is a separate personal card, not an alias.

  • Dates: ISO 8601 at whatever precision is known: YYYY, YYYY-MM, YYYY-MM-DD. They sort correctly as text. Accept YYYYMM and YYYYMMDD on input and normalize on write, since YYYYMM alone isn’t valid ISO 8601.

  • "estimated": true in timeframe when a date was inferred, for example from LinkedIn.

4. Redundancy, done safely

Two copies keep queries and sending simple:

  • each card’s email is its most recently used address (from PersonInteractions), unless pinned;
  • the primary card’s email, organization and title are copied onto People.

They stay correct only if:

  1. One module does every write (cards, aliases, interactions, merges), and each write ends by recomputing the person in the same transaction:

    • re-pick each card’s sending address;
    • then rewrite the copied columns.

    Nothing else writes them.

  2. The primary card is the one marked primary: true; else the active role card with the latest timeframe.start; else the active personal card. Recency picks the address within a card, never between cards, so professional mail stays on the role.

  3. An audit command recomputes everyone from their cards and lists disagreements. A non-empty list means something wrote around the module in (1).

Sending is built from People: one person, one recipient, at People.email. Never mail from registrations or cards, or a person with two addresses hears from you twice.

5. Lookups and uniqueness

In SQLite or libSQL, an index on a JSON expression makes card emails fast to find and unique across people:

CREATE UNIQUE INDEX person_contact_cards_email
  ON PersonContactCards (json_extract(card, '$.email'))
  WHERE json_extract(card, '$.email') IS NOT NULL;

In Postgres, the same idea is an index on (card->>'email'). Aliases sit in a JSON array that SQLite can’t index, so search them with json_each and check them for clashes in the write module. (Postgres can index the array with GIN.)

6. Flows every implementation needs

  • Import: sort each incoming record into one of three paths.

    • Definite match: the email is on a card, or on a linked account. Attach the record to that person.
    • No match: create a person and a card (role for an organization domain, personal for a personal one).
    • Fuzzy match: a similar name, or the same email username at another domain. Write nothing; list it with its candidates and their cards for a human to decide, and apply the decisions on the next run. A decision says one of:
      • the same role, so the address becomes an alias on that card;
      • the same person in another context, so it gets a new card;
      • a different person.

    Never merge on a fuzzy match automatically: two people can share a name.

  • Merge: move one person’s cards and links to the other, recompute the copied columns, delete the empty person, report what moved.

  • Sign-in or enrichment: a new email for a known person becomes a new card (or an alias) with its source, never a new person.

  • Every touch is an interaction: registrations, attendance, logins, replies. Record each through the write module, so the sending address follows the person.

7. Privacy

Cards hold personal contact details. Keep them in the database, never in a public repo’s files. Public pages render a curated profile or aggregates (counts, organization names), not cards.

8. Adopting it in a project

  1. Write a short project spec that points here and names any extra card types, project links and project tables.
  2. Put the schema in a migration file, not in code that creates tables when first used.
  3. Build the typed card schema and the single write function first, then the import, the audit and the merge.

Implementations

Project Spec Status
astro-knots/sites/fullstack-vc context-v/specs/People-and-Contact-Cards-for-Session-Registrations.md Draft