ADR-030: AI Contact Concierge
Context
The contact page offered LinkedIn and an optional CV form. A plain contact form was the obvious next step, but this site exists to show what applied AI can do, and a form shows nothing. The page should let visitors experience an agent doing useful work (answering from real data, working out what they want, preparing a message) without the usual chatbot failures: invented facts, promises it cannot keep, or a channel for spam and prompt injection.
Decision
A tool-calling Gemini agent behind a floating chat bubble on Home, Experience and Contact (not on AI Demos, which has its own chat boxes, or Architecture), gated by the `contactChat` flag. The conversation survives closing the chat and moving between pages.
1. Two server-side tools only: `lookup_profile` (facts from the same data file the pages render, plus live flags) and `draft_message` (a message card). Tool calls stream to the page as visible steps.
2. The agent drafts; a person sends. The visitor edits the card, gives consent and presses Send. The send endpoint re-validates everything (fields, consent, email, MX, Turnstile, honeypot) and never consults the model.
3. A bounded, fast loop: low thinking (default thinking took about 18 seconds for a three-round turn), at most four model rounds per turn (the last without tools), four tool calls per round, 16 turns / 12k characters of history. It shares the AI rate limit, daily budget and App Check with the demos.
4. Prompt-injection posture: fixed scope and persona; visitor messages and the draft are data; model tool arguments are coerced and clipped; the email is plain text with the visitor as Reply-To.
5. Delivery: each message is stored in Firestore (90-day TTL) and emailed through Resend with an idempotency key. If email fails, the stored copy plus an ERROR alert still reach Charlie.
Amended 2026-10-17: the concierge answers in any language the visitor writes. For messages in neither English nor Spanish, the draft also carries an English translation for Charlie, which is dropped if the visitor edits the message.
Amended 2026-10-22: a read-only lookup_adr tool lets the concierge explain how and why the site is built from the ADRs themselves, citing each record as a link to its own page. Links in its answers are limited to the site, LinkedIn and GitHub.
Amended 2026-11-07: the concierge floating bubble is enabled across every page of the site.
Consequences
Benefits:
* The contact page is itself a demo of grounded, tool-using AI with a human in the loop.
* Visitors arrive with a well-formed message: intent, context and a reply address.
* The bot cannot drift from the site: both read one data file.
Trade-offs:
* Each chat turn makes one to four model calls and counts once against the shared daily AI budget.
* Resend's shared sender only delivers to the account owner; sending from charlieroffe.com needs domain verification.
* The chat replays the visible conversation each turn instead of keeping server-side state.
Alternatives considered
1. Plain contact form: Rejected — works, but demonstrates nothing.
2. Let the agent send the email itself: Rejected — a model should not send mail on a visitor's behalf; a person confirms every message.
3. Email through the existing Google Apps Script gateway: Rejected in favour of a mail API that needs no script changes.
4. LangGraph with a checkpointer (ADR-024): Rejected — a contact chat needs no pause/resume state; a bounded manual loop streams tokens and steps directly.