How we keep friends' names out of our AI prompts
Circles uses an LLM to read plans people type. Your friends never agreed to be in its prompt, so they aren't.
In Circles you can type a plan the way you'd text it, like “coffee tmrw 2pm with Sarah”, and get a filled-in draft: Coffee, tomorrow at 2 PM, with your friend Sarah invited. Or you can describe your week (“free weeknights after 7, only my trivia crew should see this”) and get free and busy times. An LLM does the reading.
To invite the right Sarah, something has to connect the word “Sarah” to one of your friends. The obvious way is to put your friend list in the prompt and let the model pick. That's how we started, and it meant every typed plan sent up to a hundred friends' names and usernames, plus your circle names, to the model provider. Your friends shared those details with you, not with an AI company. So we changed it.
Step 1: the model returns words, our code finds the people
The prompt no longer contains any list. The model's only job for people is to copy out the names as typed: people: ["Sarah K"], groups: ["trivia crew"]. Our own code then matches those words against your friends and circles, which it already has:
- a full name or an @username first,
- then whole words (“Kim”, “Sarah Kim”),
- then the start of a name, three letters or more (“Sam” for Samantha).
If a name fits two friends, it matches neither, and you pick in the draft. Inviting the wrong Sarah is worse than asking.
Step 2: names you type are swapped for placeholders
Step 1 removed the lists, but a name you type is still a friend's name. So before the text goes to the model, we replace the names of your friends and circles with placeholders, and put them back in the answer:
You type: coffee tmrw 2pm with Sarah
The model reads: coffee tmrw 2pm with Friend A
It answers: { title: "Coffee", people: ["Friend A"], … }
We put back: { title: "Coffee", people: ["Sarah"], … }Then step 1 matches “Sarah” to your friend. A placeholder stands for the words you typed, not for a person, so that matching still decides who “Sarah” is. A few details made this work in practice:
- Common words are only swapped where a name goes. A friend called May shouldn't turn “lunch in May” into “lunch in Friend A”. Months, weekdays and words like “will” or “coffee” are swapped only where a name goes: after words like “with” and “and”, or a comma. An @username is always swapped.
- Longest names first, so “Sarah Kim” becomes one placeholder, not “Friend A Kim”.
- No user text in regular expressions. Building a regex from a display name invites ReDoS, and our security scanner rightly flagged it. Matching is plain case-insensitive substring search with the word edges checked in code.
- Fail closed. The friend and circle lists are loaded on the server with your own sign-in, so every friend counts and older app versions get the same protection. If they can't be loaded, we don't parse rather than send names unswapped.
How we know it holds
Unit tests check that the prompt carries no friend or circle lists, that typed names come out as placeholders, and that a retry re-sends the swapped text, never the original. A small live evaluation runs real plan texts through the model with a fake friend list and checks that the right friends come back and no placeholder is left in any answer.
What still goes to the model
The words you type, with your friends' and circles' names swapped out, plus what it needs to read dates and times: today's date, your time zone, the current time and how your phone writes dates. A name of someone who isn't your friend on Circles goes as typed, because we have nothing to match it against. Nothing about your friends does: not their names, free time, statuses or plans.
The trade-off is real: the model can't use your friend list to resolve a nickname it would otherwise have guessed. We think that's the right side to err on. How Circles uses AI covers the rest for non-technical readers.