Skip to content

AI-powered virtual executive team — a single coherent executive persona backed by 8 specialist agents (FastAPI + Next.js).

fix(ui): harden the UI for phones, readability and plain wording (#357)

Rufusd46eee56d274
diff --git a/packages/core/openexecutive/architecture/prebuilt/delegation.json b/packages/core/openexecutive/architecture/prebuilt/delegation.json
index 03eba5a0..b7889772 100644
--- a/packages/core/openexecutive/architecture/prebuilt/delegation.json
+++ b/packages/core/openexecutive/architecture/prebuilt/delegation.json
@@ -1,7 +1,7 @@
{
"section_id": "delegation",
"title": "Act as Me (Delegation)",
- "markdown": "The **delegation** module (`openexecutive.delegation`) is **Act as me**: the one place the Executive writes *as* a person instead of as itself. Everywhere else it has its own Google account and bots and signs as itself. Here — when the person asks, or, with a second switch, for mail in their inbox that needs them — it writes an email in their voice and saves it as a **draft in their own mailbox** — Gmail or Outlook — for them to review and send. The one thing it ever sends is one of those inbox drafts, exactly as it is in their mailbox: when the person taps **Send** on its card, or, with a third switch, **Handle it for me**, on its own when plain-code rules allow it (below); chat never sends. The principal can turn it on for themselves, and so can each team member once the owner lets them. It is off by default, and off changes nothing: the prompts, tool lists and prompt caches are byte-identical to an install without it.\n\n## Who can have it, and when it is offered\n\n`delegation.settings.can_delegate(person)` is the single rule for who may turn it on: the principal (a non-archived team member flagged `is_principal`), and any other non-archived team member — never a contact — once team members may have it (`team_members_enabled`). That takes two things: the install allows it (`DELEGATION_TEAM_MEMBERS`, default off, which offers the owner the switch) and the owner turned on **Let team members use it** (`PUT /delegation/team`, principal only, one row in `delegation_team`). Turning the owner's switch off takes it away from every team member from their next message, and their inbox watchers stop at their next check; their own switches, drafts and cards are kept. Everything is keyed by `person_id`. A person turns it on for themselves (`PUT /delegation`); nobody turns it on for anyone else. The setting is one row per person in `delegation_settings`, and a missing, unreadable or zero row all mean off.\n\nAt the start of every chat turn (`Executive.stream_chat` and the committee path) `pin_turn_delegation(session, speaker_text)` runs next to the workspace-mode pin and records a `TurnDelegation` on the session. `ghostwrite_email` is **offered** only when all of these hold:\n\n- the speaker may have it and turned it on — read fresh every turn, so turning it off applies from the next message;\n- the speaker is on a surface that verified it is them — the principal through `people_tools.is_principal_on_verified_surface`, a team member through `teammate_on_verified_surface` (the web app signed in, their own Slack or Discord, never an email turn) — and a web turn also carried a signed-in caller (`Session.web_caller_signed_in`, set from `x-caller-email`) or runs under local login — a request with no caller header is not a sign-in and never gets it (whoever holds the shared secret is trusted as the UI proxy that stamps that header, as on every principal-only route);\n- the conversation is private to the speaker: the web chat, a Slack or Discord DM, or a verified private Telegram chat — never a shared channel or thread, where the draft's preview or the matching threads would be posted for everyone and other people's messages sit in the model's context;\n- the turn is neither unattended (the scheduler's proactive run) nor private to the principal (the email poller's turns), so inbound text can never reach it. The MCP server, workflows, reflection and research never carry it at all.\n\nThe mailbox connection is deliberately **not** part of the offer: the handler checks it on every call and says how to fix it, so the cached tool prefix never flips when a token lapses. The pin lives in a context variable for the turn's task as well as on the session, so two turns running at once on one session (a second browser tab) each read their own. It also carries the speaker's own words for the turn (a new email may go to an address they just typed — the turn's message joins the history only once the turn ends), a per-turn draft count, and `touched_mail` (see Privacy). `own_words` reads those words back for every own-words check (addresses here, facts and task assignments elsewhere): it first removes the hydrated `<outbound_reply_context>` backstory by its exact, anchored shape, so a look-alike closing tag quoted inside it cannot pass the rest off as the speaker's, then drops other adapter tag blocks, and returns nothing for a message carrying an attachment.\n\n## The tool: `ghostwrite_email`\n\nIt lives in its own registry (`orchestrator.delegation_tools.DELEGATION_TOOLS` / `DELEGATION_TOOL_HANDLERS`), **never** `_ALL_SKILL_TOOLS`, so no other toolkit can carry it. On a turn it is offered to, the agent loop adds it to the pool *before* the sort and builds that turn's handler map from both registries; on any other turn a call to it is an unknown tool. The handler re-checks the pin and the surface anyway, then:\n\n1. **Caps** — at most 5 drafts per turn, and `DELEGATION_MAX_DRAFTS_PER_DAY` (default 50, at most 1000) per person per UTC day, shared with the inbox watcher (`delegation.caps`). It is counted from `delegation_drafts`, one row of ids per draft saved from either place, with a count kept in the process as a floor in case a row was lost. Each slot is taken before the first await — a round's tool calls run concurrently, so otherwise every call in it would pass the caps before any counted — and handed back if nothing was drafted. If the rows can't be read it refuses rather than guess.\n2. **Marks the turn** — sets `TurnDelegation.touched_mail` *before* its first read of the mailbox.\n3. **Checks the mailbox** — `gmail_status` asks Google or Microsoft whose mailbox the credential opens and compares it with the person's People email, on every call: a roster email can change, and a client slot swaps the roster.\n4. **Finds the thread** — by `thread_id` (checked against the mailbox's own id shape), or a Gmail-style search (`find`; on Outlook, words, `from:`, `to:`, `cc:`, `subject:` and `newer_than:` are kept and other Gmail operators dropped). Several matches return `{status: \"choose\", candidates}` (subject, sender and date — no message text) and draft nothing; none returns `not_found`.\n5. **Sets the recipients in code**, never from the model. A reply goes to the last inbound message's `From` — never its `Reply-To` (a different one is flagged `reply_to_ignored`) — with the thread's other recipients only on `reply_all`. A new email goes only to someone on the roster (contacts only when `contacts_reachable_now()`), or to an address the speaker typed this turn. Mailing-list mail, a thread they replied to last and a reply-all trimmed to 10 recipients are flagged. An address inside a block an adapter added to their message (the backstory hydrated into a DM) is not one they typed, and when the message carries an attachment — a document's inlined text, or a note naming the file — none of its addresses count: neither has an end mark, and a filename is chosen by whoever sent the file. They give the address in a message of its own.\n6. **Writes it** (the ghostwriter, below) and saves it with the mailbox client's `create_draft` (Gmail: threaded with `In-Reply-To`, `References` (whole message ids: when the chain is too long for one header the oldest after the thread's first go, never the parent) and `threadId`, and stamped `X-OE-Ghostwritten`; Outlook: Graph's `createReply` on the message it answers, then the text and recipients, and a named property marking it).\n\nThe result is `{status: \"drafted\", draft_id, gmail_link, to, cc, subject, preview, flags, open_questions, note}`. The link (`gmail.mailbox_link`) is built server-side from a fixed prefix — the thread in Gmail, the draft itself in Outlook on the web — and the note tells the model the preview is the person's draft, to be treated as data. The chat shows an action chip — \"Drafted an email as you to … — in your Drafts\" — that opens it, and only a link under `MAILBOX_LINK_PREFIXES` is ever linked. A sincere \"are you an AI?\" in the thread comes back as an open question for the person to answer themselves.\n\n## The ghostwriter\n\n`delegation.ghostwriter.compose` writes the text. The Executive decides *what* to say (`intent`); this call decides *how* the person would say it, and it is deliberately small:\n\n- a constant `GHOSTWRITER_PROMPT` plus the person's voice block as the system prompt;\n- the thread (each message cut to its sender's own words, every line scrubbed, all labelled alike), then the writer's own earlier words in it (`<writer_said>`, from their sent mail only), the intent and the recipients' names in the user turn — no company profile, memory or roster;\n- with Always in the loop on, `<writer_noted>`: what the writer's own notes say they told these same people in earlier Act as me replies (`memory.history_drafts.notes_for_draft`: only notes from mail **every** recipient of the new draft was on, so nothing told to one person reaches another; chat notes name no recipient and never qualify; at most 8, newest first, the person's own words or their correction, with dates). The prompt's rule 6 makes it a consistency check, never content: a draft that contradicts it is still written as the intent says, and the conflict becomes an open question on the card, which only the writer sees. Both the chat tool and the inbox watcher pass it;\n- **no tools** but the forced `compose_reply` return, so text in the thread can ask for anything and there is nothing to do it with.\n\nIt is not a Council agent — the Council's edit routes have no principal check — and runs on `DELEGATION_COMPOSER_MODEL` (default: the default model), logged as `ghostwriter` usage. `lint` then runs in code on what comes back: a link or an email address survives only if it appears in the intent, the signature or the recipients, so a link planted in the thread is removed and flagged; the Executive's own name is flagged; and the body is capped, cut at a paragraph, line or word break in its last fifth. A draft with nothing left after that is refused. The signature from the person's Gmail settings (or the one already stored, for Outlook) is appended.\n\n## How I write\n\n`delegation.voice` learns how a person writes *their own* email (`attunement.style` learns how the Executive should write *to* someone). `POST /delegation/voice/learn` reads up to 40 recent sent messages, keeps only what they wrote (quoted replies stripped with the email poller's `sender_new_text`), skips automatic mail, every thread chat drafted into, and every sent message that began as a draft written for them (`delegation_drafts.sent_message_id`), and makes one forced-tool call (`record_voice_profile`). Code validates every field before it is stored:\n\n- greetings per audience (their team, their contacts, anyone else), a sign-off of at most two lines, and a usual length and tone (a backslash-n the model wrote instead of a line break is read as one, keeping the first lines that fit, which also repairs a profile stored before that rule);\n- up to 8 habits and 6 things to avoid, through the same deny-list as working-style rules — no actions, links, handles, amounts, tool names or names of people;\n- up to 3 short exemplars, each checked to be verbatim from a sample, with addresses and phone numbers masked — and none while a client slot is active, so one client's mail never lands in another's state.\n\nThe signature comes from Gmail's `sendAs` settings, not the model (Outlook gives apps no way to read one, so a learn keeps the stored signature and `POST /delegation/voice/signature` answers 409 `signature_unavailable` rather than clearing it), as plain text with its lines kept (`gmail.html_to_text`: a `<br>` always ends a line, and a block tag, opening or closing, ends one when it has text, so Gmail's layout of a first line followed by one `<div>` per line comes out line by line). `POST /delegation/voice/signature` reads it again without relearning: nothing else changes and a locked profile stays locked, so it picks up a changed Gmail signature and undoes **Don't add my signature**. The person can edit the profile, lock it (a locked profile is never relearned) and reset it, and every change is kept in `delegation_voice_history`. One learn runs at a time per person, and a lock or an edit made while it runs wins: the learned profile is dropped (`changed`).\n\n## Draft replies to my inbox\n\nA second switch under Act as me, **Draft replies to my inbox** (`delegation.inbox`), has the Executive watch the person's own inbox and write a first reply to mail that needs them. The reply goes into their Drafts and waits on a private card on Today; nothing is sent until they tap **Send** (below). The switch is one row per person in `delegation_inbox_watch`. Turning it on needs Act as me on and their mailbox connected, and sets `watch_since` to now every time, so it never drafts for mail that arrived before; turning Act as me off turns it off too. Off means no mailbox call and no row written, with one exception: a send the person started that the mailbox never confirmed is still followed through until it is settled.\n\n### When it looks\n\nA throttled hook in the scheduler tick (`_maybe_scan_inbox`, after the pause, company-profile and rotation gates) checks each person whose switch is on every `DELEGATION_INBOX_POLL_MINUTES` (default 5). It is not a scheduled action, because those are listed on `/scheduled` for everyone and anyone may cancel them. One scan task runs at a time, one scan per person, and none while a client slot is active. **Check now** on the Settings card runs the same scan. Every row a scan writes is private and the person's own (`audit.rows_for_person`: a team member's rows are hidden from the principal too, see Privacy), and the process log carries counts and codes, never an address or a line of mail. The scan never marks mail read or changes a label.\n\n### What it drafts for\n\nA scan first settles the open cards (below), and stops with `backlog_full` once 25 are waiting, counting the ones it makes. It then lists the inbox since `watch_since` (`inbox_message_ids`) — not chats, not mail from the person, and not the promotions, social, updates or forums tabs (on Outlook: the Focused inbox only) — up to 100 messages, and takes the newest message of each thread that still needs a look, at most 10: settled threads and threads with an open card are passed over first, so a burst of mail, or a pause for a limit or a back-off, never hides older threads for good. `delegation_inbox_messages` is its durable cursor: one row per message (`UNIQUE(person_id, message_id)`) with what happened to it, the reason, how many tries it took, and the draft and card ids. It stores a hash of the sender's address, never the address. A message is skipped, with the reason recorded, when:\n\n- it came before `watch_since`, or more than three days ago;\n- it is from the person or one of their send-as addresses, from the Executive, or one of this module's own drafts;\n- it is automatic — `Auto-Submitted`, a bulk or auto-reply `Precedence`, a bounce, a calendar invite or a no-reply sender — or from a mailing list, or in a Gmail tab, spam or trash;\n- the person is not in To or Cc, or it has more than 10 recipients;\n- the person replied last, or a draft already sits in the thread.\n\nThree kinds are left unrecorded, so a later scan looks again: mail under 10 minutes old (mail the person answers straight away never gets a card), mail in a thread whose card is still open, and mail a daily limit holds back.\n\n### Deciding, then writing\n\nTwo model calls, and code decides between them. The classifier (`delegation.inbox_classifier`) is one forced-tool call, `classify_email`, returning whether the email needs a personal reply, what kind it is and how sure it is. It sees a few one-lined header lines and the sender's own new words (at most 3000 characters, every line scrubbed) inside one `<email>` block marked as data, and it has no other tools, context or memory, so an email can ask for anything and there is nothing to do it with. A reply is drafted only for a question, a request, scheduling, an introduction or a follow-up, and only when the confidence clears a bar that rises the less the sender is known: 0.6 for their team or a contact (the principal's contacts count only for the principal: a team member's mail is weighed by the team and their own sent mail), 0.7 for someone they have written to before (`has_written_to`, a search of their sent mail), 0.85 for a stranger. Pitches, notes of thanks, FYIs, notifications, newsletters and phishing get nothing, and so does any failure. An email that also went to other people is drafted for only when the person is in To and it asks them themselves: the classifier is told their name, whether they are in To or Cc and how many others it went to, and answers `asked_of_them`, false when the email greets someone else by name (\"Brennan: ...\") or asks the group at large. One that only copies them is never drafted for. Either is recorded `not_needed` with the reason `asks_someone_else`. It runs on `DELEGATION_CLASSIFIER_MODEL`, else the routing model. A sender whose address Gmail couldn't authenticate is handled as a stranger whatever the roster says — anyone can put a colleague's or a client's address in From — so they get the stranger's bar, a holding reply and the stranger limits; the card still says who they claim to be, and that the address isn't verified.\n\nThe reply is written by the same ghostwriter, in the person's voice, but from a fixed intent the module builds rather than words the person typed. Because the intent lets it restate the person's own earlier words, which words are theirs is never written inside the thread, where a sender could imitate any marker with a look-alike: every message there is labelled alike, and the person's own words come in a separate `<writer_said>` block after the thread, taken only from mail their own mailbox sent. Nothing inside the thread can close the thread block or open another. The intent: acknowledge the sender; say again only what the person's *own* earlier messages in the thread already said; commit to nothing new — no yes or no, date, time, price, fact or promise — and say they will get back to them; and put every question it could not answer from their words in **open questions**. A stranger always gets a short holding reply. The lint still strips any link or address that isn't the person's own. The reply goes to the sender (never `Reply-To`) and, on a group email, to everyone else it went to as Cc (reply to all, never the person's own addresses or the Executive); a stranger's holding reply goes to the sender alone. The card says when others were on the email, and its `draft_to` lists everyone, which Send checks.\n\nThe order: record the message, classify, reserve a slot in the shared daily limit, write, save the draft in Gmail (from the alias the mail went to, when it went to one) and store its id, then create the card (idempotent on the message) and mark it drafted. Nothing that fails along the way loses the message. A failure that may pass — the classifier or the writer failing, Gmail refusing the draft, a card that couldn't be made (its draft is deleted first, so no draft is left without a card), any other error with that one message — leaves it for a later scan (`retry`), and it is given up on only after three tries; one message's trouble never holds up the rest. A daily limit reached while it was being read leaves it for later without counting as a try.\n\n### The reply cards\n\nA card is a `delegation_reply` decision whose class is **its approver's alone** (`DecisionClassSpec.approver_only`): only the person it was drafted for sees or resolves it on any decisions route — a team member's card answers 404 to the principal too — and it is never an alert: alerts feed chat turns, which would put other people's mail into memory. It carries the sender with who they are to the person and whether Gmail could verify the address (SPF/DKIM/DMARC, through `fact_confirmation.headers_authenticated`), the subject, what they wrote, the draft, the open questions and its warnings. `GET /delegation/replies` lists the open ones from the database alone, so Today never waits on Google.\n\n- **Send** approves the card, which sends its draft exactly as it is in their mailbox (see *Send on your tap*). **Edit in Gmail** (or **Edit in Outlook**) opens it there, to change the draft first or send it from there.\n- **Dismiss** rejects the card; the class's after-reject step then deletes the draft if nobody edited it — its message id is still the one it was saved with, since Gmail gives an edited draft a new one, and the Outlook client makes a draft's message id `<id>.<changeKey>` so an edit there changes it too — and keeps it otherwise. What happened is recorded even when Gmail fails.\n- Each scan first **settles** what Gmail already settled: a draft sent from Gmail, a draft deleted there, a reply the person wrote themselves, a thread that is gone, or a card left for 7 days (its draft stays in Gmail). Each is a compare-and-set close with the reason. A newer message from someone else flags the card instead. A card being sent at that moment is left alone.\n\n### Send on your tap\n\n`delegation.reply_send` is the only thing in Act as me that sends, and all it can send is the draft on a card, by its id: `DelegateGmail.send_draft` posts `{\"id\": …}` to Gmail's `drafts.send`, and `DelegateOutlook.send_draft` posts an empty body to that draft's Graph `send`, and nothing else, so no text, recipient or header is ever passed. It has two doors: `send_approved_reply`, reached only from `POST /decisions/{id}/approve` — a class only the card's own person may resolve — and `send_on_its_own`, reached only from the inbox watcher under Handle it for me (below). AST tests pin both call sites, so no model, chat turn, workflow, scheduled job or MCP call can. A tap is checked like this: At send time it checks everything again:\n\n1. **Who is asking.** The caller is the card's person and the API knows it: signed callers are on and the request carries that person's signed assertion (or the operator's, under local login), or the API runs for local login and answers this computer only. Anything else is a 409 `caller_signing_required` — with only the shared secret, whoever holds it could send as the owner — so on a server Send needs signed sign-ins.\n2. **The switches.** Act as me and Draft replies to my inbox are on, and no client slot is active.\n3. **The mailbox.** Their mailbox is connected.\n4. **The draft.** It still exists, in the same thread, and they haven't replied there themselves since; otherwise the card closes.\n5. **Who it goes to.** To, Cc and Bcc hold between 1 and 10 addresses, never the Executive's own, and it is from one of their own addresses.\n6. **What changed.** Recipients that differ from the card's, or a newer message from someone else, need a second yes: the first tap gets a 409 `confirm` naming the recipients and the reason, and the person approves again with what they were shown.\n\nThen it claims the card (`claim_for_execution`, proposed → executing, a compare-and-set, so a double tap sends once) and reads the draft once more: `drafts.send` sends whatever the draft is when Gmail gets the request, so if it was edited since the checks read it — in another tab, by a delegate — nothing is sent and the card comes back (`draft_changed`). Then it sends, and records the result: `approved_with_edit` when the draft was edited in Gmail, the sent message's id, the draft row's `sent_message_id`, and a private `delegation_reply_sent` row. A refusal that proves nothing went — a 4xx, a lapsed sign-in, a rate limit, a draft already gone — hands the card back. A failure that leaves it unclear — a timeout, a 5xx — leaves it `executing` and says to check the Sent folder, and the next scans ask Gmail: their message in the thread means it was sent; anything else is judged on the second scan that sees it: the draft still there and nothing sent means it was not (Gmail deletes a draft it sends), and the card comes back, flagged; the draft gone and nothing sent means it was deleted. Nothing is ever retried on its own. Sending is the person's own act, so it works while the Executive is paused.\n\n### Limits and failures\n\nAt most 5 drafts a scan; `DELEGATION_INBOX_MAX_DRAFTS_PER_DAY` (default 20) a day, inside the shared `DELEGATION_MAX_DRAFTS_PER_DAY` it shares with chat; 200 classifications, 2 drafts per sender (1 for a stranger) and 10 for strangers in all per day; and never more than 25 open cards. A lapsed Gmail sign-in sets the status and is looked at again every 30 minutes; a rate limit, an error reaching Gmail or a crash backs off from 5 minutes, doubling up to 2 hours. Neither turns the switch off: the Settings card shows the status in plain words.\n\n## Handle it for me\n\nA third switch under Act as me, **Handle it for me** (`delegation.handle_it`), lets the inbox watcher send some of its replies itself instead of leaving them on a card. It is one row per person in `delegation_handle_it` (`enabled`, `mode`); no row means off. One setting says how much goes without them, the way quality does on the Agent Council (`handle_it.RULES`): **Careful** sends only replies to people they know (someone on their team, a contact or someone they have written to) of at most 400 characters when the classifier is at least 0.9 sure; **Balanced**, where it starts, sends replies to people they know up to 1200 characters at 0.8; **Bold** also answers strangers, up to 2000 characters, and lets a link or an amount through when the classifier is at least 0.9 sure. Everything else waits on a card as before, so turning it on never drafts less. A table from before the setting gets the `mode` column on its next open (`schema._add_handle_it_mode`): someone who had strangers set to send keeps that as Bold, everyone else gets Balanced. Only the person turns it on (`PUT /delegation/handle-it`), from a session the API knows is theirs: the same rule Send uses (`delegation.verified.caller_refusal`), so with only the shared secret it answers 409 `caller_signing_required`. Turning it on needs Act as me and Draft replies to my inbox on, and turning the inbox watcher off (or Act as me, which turns it off) turns it off too.\n\n**No model decides whether a reply goes.** The watcher's two model calls are unchanged and tool-less, so text in an email can at most change the verdict and the draft. After the draft is written, `handle_it.refusal` — plain code — decides, and anything it refuses becomes the usual card with the reason kept on it (`handle_it_reason`). It refuses when:\n\n- it's off, or the sender is a stranger and the setting isn't Bold, or on a server signed sign-ins are off (`signing_ok`: signed callers, or local login);\n- Gmail couldn't authenticate the sender, whatever the roster says;\n- the email isn't a question, request, scheduling, introduction or follow-up, or the classifier was less sure than the setting needs (0.9 on Careful, 0.8 otherwise);\n- the reply goes to anyone the email didn't already go to (its From, To and Cc, less the person's own and the Executive's addresses), leaves out the sender, or goes to more than 10;\n- the email's subject, the sender's new words, or the reply touch money, contracts, legal, hiring, pay, layoffs, the board, investors, mergers, the press, health, or credentials and secrets (passwords, logins, tokens, API keys); or the reply carries an amount, a percentage or a link (a scheme, `www.`, a bare host with a path such as `bit.ly/…`, or a bare host on a common top-level domain) unless it's Bold and at least 0.9 sure, or runs over the setting's length (400, 1200 or 2000 characters);\n- the draft carries any flag but *others on the thread* or *Executive on the thread* (they asked if it's an AI, recipients were trimmed, …);\n- it already sent one in this thread in the last day, or the person's last message in the thread was itself sent on its own (no auto-reply ping-pong);\n- the day's limit is reached (`DELEGATION_HANDLE_IT_MAX_SENDS_PER_DAY`, default 20, within the watcher's drafts limit), or it can't be counted. Any error in the rules counts as a refusal.\n\nA reply the rules allow gets a card with `gate_mode` `auto_execute`, and the watcher sends it at once through `reply_send.send_on_its_own`, the second and last door into the send path (an AST test pins both callers: the approve route and the watcher). It runs the same send-time checks as a tap — switches, mailbox, draft, recipients, the claim and the last re-read — with no caller, and adds its own: the card must be `auto_execute`, Handle it for me still on with the setting still allowing that sender (or, for a follow-up, that recipient), signing still on, the once-a-thread-a-day rule and the daily limit counted again, and the draft untouched since it was saved (an edit in Gmail means the person has taken it over: `draft_changed`, the card waits for them). Every refusal hands the card back to the person (`decision_ledger.hand_back`, a compare-and-set to `propose`), with the reason kept on it when there are words for it, and a failure never stops the scan. Every card it left for the person says why on Today (`waited_because` on `GET /delegation/replies`). A reply sent on its own finishes as `executed` (not approved), is recorded in `delegation_handled` (for the per-thread and daily rules) and writes a private `delegation_reply_handled` row; an unconfirmed one is settled by the reconciler the same way. No History note is taken from it, since notes come only from the person's own words. It runs inside the watcher's scan, so it stops while the Executive is paused.\n\n**Follow-ups as you** (`delegation.follow_ups`). While Handle it for me is on, the watcher's scan also looks at the person's own sent mail, at most once an hour (`LOOK_EVERY`), for an email of theirs that asked something (a question mark in their own words), is 3 to 10 days old, went to at most 10 people other than the Executive, and is still the last message in its thread. Plain code picks it; each gets one follow-up ever (its `delegation_inbox_messages` row), at most two a look, within the drafts limit. The ghostwriter, tool-less as always, writes a short nudge in their voice from the thread, saved as a draft in that thread to exactly the people the email went to. `handle_it.follow_up_refusal` — plain code — decides whether it goes: by the setting it never goes on Careful, goes to their team and contacts on Balanced and to anyone they wrote to on Bold (`follow_up_refused` otherwise: `follow_up_level`); it also refuses on any change of recipients, a sensitive topic, an amount or a link, more than 600 characters, a flag, and the same per-thread and daily counts as replies. It goes through `send_on_its_own` on an ordinary `delegation_reply` card marked `source: follow_up`, which rechecks the setting for that recipient. A refused one waits on Today as **Follow-up waiting**, and closes by itself (its untouched draft deleted) when anyone answers in the thread first.\n\n**What it sent** is the person's alone: `GET /delegation/handled` lists the last 7 days (who, subject, the reply, the questions it left them and a link to the thread in their mailbox), and the Settings card shows it under the switch with how many went today.\n\n### Take the lead as you\n\nOn Settings → Act as me, Handle it for me is one dial: **Off**, **Careful**, **Balanced**, **Bold** and, for the owner, **Take the lead** (`PUT /delegation/take-the-lead`, one row `person:<id>` in `take_the_lead`; turning it on turns Handle it for me on). While it is on, `handle_it.refusal` drops the setting's limits: strangers, the classifier's confidence, amounts, and the length up to a 4000-character ceiling. A reply with a link still waits for a tap (refusal `link`). In their place it checks the company's and the person's own added rules (`take_the_lead.reply_hit`, refusal `lead_rule`). Everything Handle it always keeps still holds: signed sign-ins, an authenticated sender, a reply kind, exactly the thread's people, the topics that always wait, draft flags, never twice in a row, one a thread a day and the daily limit. Follow-ups under it may go to anyone the person wrote to, with the same sensitive, amount, link and length checks plus the added rules. `reply_send.send_on_its_own` accepts the card while both switches are on. Each person adds and removes their own rules (`/delegation/take-the-lead/rules`). Removing one needs a caller the API can tie to them.\n\n## The mailbox client\n\n`delegation.gmail.DelegateGmail` talks to the Gmail REST API directly and is **never registered with the MCP gateway**, so the model reaches the mailbox only through the typed handler. The credential is one file per person in `DELEGATION_GOOGLE_CREDENTIALS_DIR`, named from a hash of the address (0600 in a 0700 directory), minted by `scripts/connect-own-gmail.py` on the Executive's own OAuth client with the scopes `gmail.readonly` and `gmail.compose`. It never lives in `WORKSPACE_MCP_CREDENTIALS_DIR`, where workspace-mcp picks a credential by address. Besides reading threads and saving drafts it lists the inbox and checks whether they have written to an address, reads one message or draft, lists the person's send-as addresses and deletes a draft. Its **one send method**, `send_draft`, sends an existing draft by its id and nothing else — never `messages.send`, which sends any text it is given — and unit tests pin the method set, the endpoint, the request body and its single caller. A failed request says whether it may have been carried out anyway (a timeout after connecting, a 5xx), which is what the send path needs to know. A parsed message carries when it arrived, whether it is bulk, a bounce or a calendar invite, and whether Gmail's authentication results vouch for its sender.\n\n`gmail_status` answers `connected`, `not_configured`, `needs_reconnect` (Google refused the saved sign-in — an app in Testing mode has its tokens expire after 7 days; a rate limit, though Gmail may send it as a 403, is an `error` to retry, not a reconnect), `mismatch`, `no_email`, `shared_mailbox` or `error`. `shared_mailbox` means the person's address *is* the Executive's; it is refused before asking Google, because then everything the Executive writes would look like theirs. The gateway closes the other door: every `google_workspace__*` call must act as the Executive's own account, and a `user_google_email` naming anyone else is refused and audited (see Integrations).\n\n### Outlook\n\nA person may connect an Outlook mailbox instead (work, school or personal), with `scripts/connect-own-outlook.py`: a device-code sign-in on the Executive's own Entra app (`MS365_MCP_CLIENT_ID`, tenant `MS365_MCP_TENANT_ID` or `common`) asking for `User.Read`, `Mail.ReadWrite`, `Mail.Send` and `offline_access`. It writes the same per-person file with `\"provider\": \"microsoft\"`, so a person has one mailbox for Act as me, and `gmail_for` hands back `delegation.outlook.DelegateOutlook`, which keeps `DelegateGmail`'s methods, return types and errors, so every caller above runs unchanged. It talks to Microsoft Graph directly, never through the Microsoft 365 MCP server the Executive's own Outlook uses, and is never registered with the gateway. Microsoft rotates the refresh token on use; the new one is written back into the file (atomically, keeping every other key, and only if the file still holds the old one). Graph is asked for immutable ids, so a sent draft keeps its id; a thread is Outlook's `conversationId`. Gmail's labels are mapped onto what the callers read: `SENT` only for mail in their Sent Items folder (a From line set to their address by someone else never counts), `DRAFT`, `INBOX`, and Focused Inbox's Other read as a tab. A sender counts as authenticated only when the topmost `Authentication-Results` — the one Exchange wrote, above anything the sender added — holds exactly one DMARC verdict, a pass for From's own domain, and Exchange Online Protection's own `compauth=` verdict, so a header the sender wrote on mail EOP never stamped doesn't count. `delete_draft` refuses anything that isn't a draft, and deletes with the draft's etag (`If-Match`), so a draft sent in between — it keeps its id — is left alone. No client secret is ever written into a person's file, and Graph has no signature setting to read.\n\n## Privacy\n\nWhat a person's mailbox touches is theirs. For the principal that means private to the principal, as every private row is. For a team member it means theirs alone, the principal included: an audit row carries `private_to_person` (set by `audit.rows_for_person` around the inbox watcher, a card's Send and Dismiss and their settings changes, and by `people_tools.audit_row_owner` on a turn that read their mail) and is left out of every audit read — the log, a session's timeline, a row by id, the brief — with only the usage totals counting it; their reply cards are theirs alone (above); and the owner's view of their use is counts only (drafts and sends in 30 days, and whether their inbox watcher is on). The conversation itself becomes its owner's alone before the mailbox is first read: `ghostwrite_email` marks the session `mail_private` (`session_store.mark_mail_private`, creating a channel adapter's row early, with its owner) and refuses to read the mailbox if that can't be stored or the conversation already belongs to someone else (which it then leaves unmarked); from then on only its owner may open it (`chat._session_access`), and working-style learning skips it. Every later turn there starts as if it had read the mail (`settings.pin_turn_delegation` reads the flag and fails closed), so a follow-up answered from history alone is still private to its owner, teaches no memory and stays under the lockdown, and the web chat's rows before the turn (the inbound message and the knowledge lookup) are theirs too. A channel adapter's own pre-turn rows are written as before. Anyone else speaking in it is not offered Act as me.\n\nOnce `touched_mail` is set, every audit row the turn writes is private (`people_tools.audit_row_private_to_principal`), and a team member's is theirs alone: the tool row (its input and result redacted, since `ghostwrite` is a sensitive tool name), the reply's `chat_turn` row that carries the preview, the model-call rows, and the background passes, which run under `private_rows`. The Honcho peer and department syncs are skipped, because peer memory is read on other people's turns. No memory is learned from the turn at all: the episodic, open-loop and working-style passes are skipped too, since its reply quotes a draft built from other people's mail. The `delegation_*` audit events are always private and carry metadata only — ids, counts and flags, never the draft or the thread. The inbox watcher is private the same way: every row a scan or a card action writes is its person's alone, and it starts no chat turn, alert, scheduled action or workflow run and teaches no memory.\n\nThe turn also stops reaching anyone else (`delegation.lockdown`). From the round that calls `ghostwrite_email` — a round's tools run together — until the turn ends, the dispatch guard refuses every tool that sends, posts, invites, queues or starts work, fetches an outside address, or writes state that others or later turns read: the DMs and `message_person`, broadcasts, calendar bookings and cancellations, follow-ups, workflows and research, `read_document` and the watchlist, `load_mcp_server`, roster, goal, skill and alert changes, open loops, decisions and standing facts. Through MCP `call_tool`, only the six Google Workspace reads remain. Every tool is classified as allowed or withheld, a test fails on a new unclassified one, and an unknown name is withheld. A refused call gets a private `tool_invocation` row (`refused: mail_touched`) and tells the model to offer it in a new message. The offered tool list never changes mid-turn, so the cached prefix holds. The send paths check again on their own (`_guard_outbound`, the broadcast, calendar, workflow, research and follow-up handlers, the gateway's `call_tool` and `load_mcp_server`). The server-side web search stays, as on a turn private to the principal. The lockdown lasts for that turn only.\n\n## Always in the loop\n\nA sent reply can leave a note. Once the reply went, `reply_send` starts `memory.history_notes.note_sent_reply` for the person who sent it, in the background, when their \"Keep track of what happens\" switch is on and the conversation isn't one they asked not to remember. The note-taker sees only the words they sent, so other people's mail never becomes a note, and a failure never touches the send. Recall is `recall_history`, offered on the same verified, private surfaces as `ghostwrite_email` and also allowed under the mail lockdown, since it only reads the speaker's own notes. Calling it locks the turn like `ghostwrite_email` does, from its own round on. The same switch also covers notes from chat, which don't need Act as me. See **Memory** for the checks, retention and controls.\n\n## The system prompt\n\nA constant, name-free `DELEGATION_ADDENDUM` joins block 0 after the unchanged identity addendum while anyone on the install has it on (`block0_delegation_on`). It tells the model that `ghostwrite_email` is the single exception to *never impersonate*, and only for the person being spoken to; that everything else is written as itself; that when the tool isn't offered the asker can't have it; that a draft is never described as sent; and that it never denies being an AI. It is keyed on the install-level setting, never on the turn or the speaker, so switching it misses the 1h cache once (see Prompt Caching).\n\n## Surfaces\n\n- **Settings → Act as me** (`ActAsMeCard`, hidden unless `GET /delegation` answers, so a team member sees it once the owner lets them): the mailbox connection (`provider` says which) with both connect commands (Gmail and Outlook) and **Check again**, the **Write drafts as me** switch, the **Draft replies to my inbox** switch with its status in plain words, when it last checked and **Check now**, and **How I write**: length and tone, a greeting per audience (`{first}` is their first name), the sign-off, habits and never-rules in fields that grow to show every line, the signature with **Refresh from Gmail** and **Don't add my signature** (or **Add my Gmail signature** when none is added; on Outlook only **Don't add my signature**, with why), and each example quoted with **Remove examples**. The owner also gets **Let team members use it** where the install allows it, with each team member who has it on listed by name and counts only.\n- **Today → Replies waiting** (`RepliesWaiting`, the top of the left column; hidden unless `GET /delegation/replies` answers with cards): each card shows who wrote and who they are to you, whether their address was verified, the subject, **They wrote** as plain text, your draft, **Decide before sending** (the open questions) and its warnings, with **Send** (a confirm naming who it goes to, and a second one when that or the thread changed), **Edit in Gmail** or **Edit in Outlook**, and **Dismiss**.\n- **Setup status**: a **Your own mailbox (Act as me)** light (`your_gmail`), amber while the inbox watcher can't reach the mailbox, is being rate-limited or has 25 replies waiting.\n- **Settings → Your Executive** (`app/settings/executive`, where `/settings/on-its-own` lands): the pause, **Take the lead** and **Book meetings without asking** (as the Executive). **Handle it for me** (the Off / Careful / Balanced / Bold / Take the lead dial, what each sends, how many went today and what it sent this week, as you) sits under the mailbox card on **Settings → Act as me**.\n- **API**: `GET`/`PUT /delegation`, `GET`/`PUT`/`DELETE /delegation/voice`, `POST /delegation/voice/learn`, `POST /delegation/voice/signature`, `PUT /delegation/inbox`, `POST /delegation/inbox/check`, `GET /delegation/replies`, `PUT /delegation/handle-it` and `GET /delegation/handled` — the caller's own delegation only — and `PUT /delegation/team`, the owner's switch (see API Reference). Send is `POST /decisions/{id}/approve`; Dismiss is `POST /decisions/{id}/reject`.\n- **Evals**: a scenario's `delegation:` block runs the turn against an in-memory mailbox (`evals.mailbox.ScenarioMailbox`) and hands the saved drafts to the judge (`delegation_001`–`003`). A `type: inbox` scenario runs the watcher's two model calls on one thread: whether it drafts must match the scenario, and a draft is judged on saying nothing the person hadn't, copying no link or address, and listing every open question (`delegation_inbox_001`–`007`; the last checks a draft never claims anything was sent).\n\nActing within rules the person sets and standing in for them are later, separate changes, each behind its own switch, off by default.",
+ "markdown": "The **delegation** module (`openexecutive.delegation`) is **Act as me**: the one place the Executive writes *as* a person instead of as itself. Everywhere else it has its own Google account and bots and signs as itself. Here — when the person asks, or, with a second switch, for mail in their inbox that needs them — it writes an email in their voice and saves it as a **draft in their own mailbox** — Gmail or Outlook — for them to review and send. The one thing it ever sends is one of those inbox drafts, exactly as it is in their mailbox: when the person taps **Send** on its card, or, with a third switch, **Handle it for me**, on its own when plain-code rules allow it (below); chat never sends. The principal can turn it on for themselves, and so can each team member once the owner lets them. It is off by default, and off changes nothing: the prompts, tool lists and prompt caches are byte-identical to an install without it.\n\n## Who can have it, and when it is offered\n\n`delegation.settings.can_delegate(person)` is the single rule for who may turn it on: the principal (a non-archived team member flagged `is_principal`), and any other non-archived team member — never a contact — once team members may have it (`team_members_enabled`). That takes two things: the install allows it (`DELEGATION_TEAM_MEMBERS`, default off, which offers the owner the switch) and the owner turned on **Let team members use it** (`PUT /delegation/team`, principal only, one row in `delegation_team`). Turning the owner's switch off takes it away from every team member from their next message, and their inbox watchers stop at their next check; their own switches, drafts and cards are kept. Everything is keyed by `person_id`. A person turns it on for themselves (`PUT /delegation`); nobody turns it on for anyone else. The setting is one row per person in `delegation_settings`, and a missing, unreadable or zero row all mean off.\n\nAt the start of every chat turn (`Executive.stream_chat` and the committee path) `pin_turn_delegation(session, speaker_text)` runs next to the workspace-mode pin and records a `TurnDelegation` on the session. `ghostwrite_email` is **offered** only when all of these hold:\n\n- the speaker may have it and turned it on — read fresh every turn, so turning it off applies from the next message;\n- the speaker is on a surface that verified it is them — the principal through `people_tools.is_principal_on_verified_surface`, a team member through `teammate_on_verified_surface` (the web app signed in, their own Slack or Discord, never an email turn) — and a web turn also carried a signed-in caller (`Session.web_caller_signed_in`, set from `x-caller-email`) or runs under local login — a request with no caller header is not a sign-in and never gets it (whoever holds the shared secret is trusted as the UI proxy that stamps that header, as on every principal-only route);\n- the conversation is private to the speaker: the web chat, a Slack or Discord DM, or a verified private Telegram chat — never a shared channel or thread, where the draft's preview or the matching threads would be posted for everyone and other people's messages sit in the model's context;\n- the turn is neither unattended (the scheduler's proactive run) nor private to the principal (the email poller's turns), so inbound text can never reach it. The MCP server, workflows, reflection and research never carry it at all.\n\nThe mailbox connection is deliberately **not** part of the offer: the handler checks it on every call and says how to fix it, so the cached tool prefix never flips when a token lapses. The pin lives in a context variable for the turn's task as well as on the session, so two turns running at once on one session (a second browser tab) each read their own. It also carries the speaker's own words for the turn (a new email may go to an address they just typed — the turn's message joins the history only once the turn ends), a per-turn draft count, and `touched_mail` (see Privacy). `own_words` reads those words back for every own-words check (addresses here, facts and task assignments elsewhere): it first removes the hydrated `<outbound_reply_context>` backstory by its exact, anchored shape, so a look-alike closing tag quoted inside it cannot pass the rest off as the speaker's, then drops other adapter tag blocks, and returns nothing for a message carrying an attachment.\n\n## The tool: `ghostwrite_email`\n\nIt lives in its own registry (`orchestrator.delegation_tools.DELEGATION_TOOLS` / `DELEGATION_TOOL_HANDLERS`), **never** `_ALL_SKILL_TOOLS`, so no other toolkit can carry it. On a turn it is offered to, the agent loop adds it to the pool *before* the sort and builds that turn's handler map from both registries; on any other turn a call to it is an unknown tool. The handler re-checks the pin and the surface anyway, then:\n\n1. **Caps** — at most 5 drafts per turn, and `DELEGATION_MAX_DRAFTS_PER_DAY` (default 50, at most 1000) per person per UTC day, shared with the inbox watcher (`delegation.caps`). It is counted from `delegation_drafts`, one row of ids per draft saved from either place, with a count kept in the process as a floor in case a row was lost. Each slot is taken before the first await — a round's tool calls run concurrently, so otherwise every call in it would pass the caps before any counted — and handed back if nothing was drafted. If the rows can't be read it refuses rather than guess.\n2. **Marks the turn** — sets `TurnDelegation.touched_mail` *before* its first read of the mailbox.\n3. **Checks the mailbox** — `gmail_status` asks Google or Microsoft whose mailbox the credential opens and compares it with the person's People email, on every call: a roster email can change, and a client slot swaps the roster.\n4. **Finds the thread** — by `thread_id` (checked against the mailbox's own id shape), or a Gmail-style search (`find`; on Outlook, words, `from:`, `to:`, `cc:`, `subject:` and `newer_than:` are kept and other Gmail operators dropped). Several matches return `{status: \"choose\", candidates}` (subject, sender and date — no message text) and draft nothing; none returns `not_found`.\n5. **Sets the recipients in code**, never from the model. A reply goes to the last inbound message's `From` — never its `Reply-To` (a different one is flagged `reply_to_ignored`) — with the thread's other recipients only on `reply_all`. A new email goes only to someone on the roster (contacts only when `contacts_reachable_now()`), or to an address the speaker typed this turn. Mailing-list mail, a thread they replied to last and a reply-all trimmed to 10 recipients are flagged. An address inside a block an adapter added to their message (the backstory hydrated into a DM) is not one they typed, and when the message carries an attachment — a document's inlined text, or a note naming the file — none of its addresses count: neither has an end mark, and a filename is chosen by whoever sent the file. They give the address in a message of its own.\n6. **Writes it** (the ghostwriter, below) and saves it with the mailbox client's `create_draft` (Gmail: threaded with `In-Reply-To`, `References` (whole message ids: when the chain is too long for one header the oldest after the thread's first go, never the parent) and `threadId`, and stamped `X-OE-Ghostwritten`; Outlook: Graph's `createReply` on the message it answers, then the text and recipients, and a named property marking it).\n\nThe result is `{status: \"drafted\", draft_id, gmail_link, to, cc, subject, preview, flags, open_questions, note}`. The link (`gmail.mailbox_link`) is built server-side from a fixed prefix — the thread in Gmail, the draft itself in Outlook on the web — and the note tells the model the preview is the person's draft, to be treated as data. The chat shows an action chip — \"Drafted an email as you to … — in your Drafts\" — that opens it, and only a link under `MAILBOX_LINK_PREFIXES` is ever linked. A sincere \"are you an AI?\" in the thread comes back as an open question for the person to answer themselves.\n\n## The ghostwriter\n\n`delegation.ghostwriter.compose` writes the text. The Executive decides *what* to say (`intent`); this call decides *how* the person would say it, and it is deliberately small:\n\n- a constant `GHOSTWRITER_PROMPT` plus the person's voice block as the system prompt;\n- the thread (each message cut to its sender's own words, every line scrubbed, all labelled alike), then the writer's own earlier words in it (`<writer_said>`, from their sent mail only), the intent and the recipients' names in the user turn — no company profile, memory or roster;\n- with Always in the loop on, `<writer_noted>`: what the writer's own notes say they told these same people in earlier Act as me replies (`memory.history_drafts.notes_for_draft`: only notes from mail **every** recipient of the new draft was on, so nothing told to one person reaches another; chat notes name no recipient and never qualify; at most 8, newest first, the person's own words or their correction, with dates). The prompt's rule 6 makes it a consistency check, never content: a draft that contradicts it is still written as the intent says, and the conflict becomes an open question on the card, which only the writer sees. Both the chat tool and the inbox watcher pass it;\n- **no tools** but the forced `compose_reply` return, so text in the thread can ask for anything and there is nothing to do it with.\n\nIt is not a Council agent — the Council's edit routes have no principal check — and runs on `DELEGATION_COMPOSER_MODEL` (default: the default model), logged as `ghostwriter` usage. `lint` then runs in code on what comes back: a link or an email address survives only if it appears in the intent, the signature or the recipients, so a link planted in the thread is removed and flagged; the Executive's own name is flagged; and the body is capped, cut at a paragraph, line or word break in its last fifth. A draft with nothing left after that is refused. The signature from the person's Gmail settings (or the one already stored, for Outlook) is appended.\n\n## How I write\n\n`delegation.voice` learns how a person writes *their own* email (`attunement.style` learns how the Executive should write *to* someone). `POST /delegation/voice/learn` reads up to 40 recent sent messages, keeps only what they wrote (quoted replies stripped with the email poller's `sender_new_text`), skips automatic mail, every thread chat drafted into, and every sent message that began as a draft written for them (`delegation_drafts.sent_message_id`), and makes one forced-tool call (`record_voice_profile`). Code validates every field before it is stored:\n\n- greetings per audience (their team, their contacts, anyone else), a sign-off of at most two lines, and a usual length and tone (a backslash-n the model wrote instead of a line break is read as one, keeping the first lines that fit, which also repairs a profile stored before that rule);\n- up to 8 habits and 6 things to avoid, through the same deny-list as working-style rules — no actions, links, handles, amounts, tool names or names of people;\n- up to 3 short exemplars, each checked to be verbatim from a sample, with addresses and phone numbers masked — and none while a client slot is active, so one client's mail never lands in another's state.\n\nThe signature comes from Gmail's `sendAs` settings, not the model (Outlook gives apps no way to read one, so a learn keeps the stored signature and `POST /delegation/voice/signature` answers 409 `signature_unavailable` rather than clearing it), as plain text with its lines kept (`gmail.html_to_text`: a `<br>` always ends a line, and a block tag, opening or closing, ends one when it has text, so Gmail's layout of a first line followed by one `<div>` per line comes out line by line). `POST /delegation/voice/signature` reads it again without relearning: nothing else changes and a locked profile stays locked, so it picks up a changed Gmail signature and undoes **Don't add my signature**. The person can edit the profile, lock it (a locked profile is never relearned) and reset it, and every change is kept in `delegation_voice_history`. One learn runs at a time per person, and a lock or an edit made while it runs wins: the learned profile is dropped (`changed`).\n\n## Draft replies to my inbox\n\nA second switch under Act as me, **Draft replies to my inbox** (`delegation.inbox`), has the Executive watch the person's own inbox and write a first reply to mail that needs them. The reply goes into their Drafts and waits on a private card on Today; nothing is sent until they tap **Send** (below). The switch is one row per person in `delegation_inbox_watch`. Turning it on needs Act as me on and their mailbox connected, and sets `watch_since` to now every time, so it never drafts for mail that arrived before; turning Act as me off turns it off too. Off means no mailbox call and no row written, with one exception: a send the person started that the mailbox never confirmed is still followed through until it is settled.\n\n### When it looks\n\nA throttled hook in the scheduler tick (`_maybe_scan_inbox`, after the pause, company-profile and rotation gates) checks each person whose switch is on every `DELEGATION_INBOX_POLL_MINUTES` (default 5). It is not a scheduled action, because those are listed on `/scheduled` for everyone and anyone may cancel them. One scan task runs at a time, one scan per person, and none while a client slot is active. **Check now** on the Settings card runs the same scan. Every row a scan writes is private and the person's own (`audit.rows_for_person`: a team member's rows are hidden from the principal too, see Privacy), and the process log carries counts and codes, never an address or a line of mail. The scan never marks mail read or changes a label.\n\n### What it drafts for\n\nA scan first settles the open cards (below), and stops with `backlog_full` once 25 are waiting, counting the ones it makes. It then lists the inbox since `watch_since` (`inbox_message_ids`) — not chats, not mail from the person, and not the promotions, social, updates or forums tabs (on Outlook: the Focused inbox only) — up to 100 messages, and takes the newest message of each thread that still needs a look, at most 10: settled threads and threads with an open card are passed over first, so a burst of mail, or a pause for a limit or a back-off, never hides older threads for good. `delegation_inbox_messages` is its durable cursor: one row per message (`UNIQUE(person_id, message_id)`) with what happened to it, the reason, how many tries it took, and the draft and card ids. It stores a hash of the sender's address, never the address. A message is skipped, with the reason recorded, when:\n\n- it came before `watch_since`, or more than three days ago;\n- it is from the person or one of their send-as addresses, from the Executive, or one of this module's own drafts;\n- it is automatic — `Auto-Submitted`, a bulk or auto-reply `Precedence`, a bounce, a calendar invite or a no-reply sender — or from a mailing list, or in a Gmail tab, spam or trash;\n- the person is not in To or Cc, or it has more than 10 recipients;\n- the person replied last, or a draft already sits in the thread.\n\nThree kinds are left unrecorded, so a later scan looks again: mail under 10 minutes old (mail the person answers straight away never gets a card), mail in a thread whose card is still open, and mail a daily limit holds back.\n\n### Deciding, then writing\n\nTwo model calls, and code decides between them. The classifier (`delegation.inbox_classifier`) is one forced-tool call, `classify_email`, returning whether the email needs a personal reply, what kind it is and how sure it is. It sees a few one-lined header lines and the sender's own new words (at most 3000 characters, every line scrubbed) inside one `<email>` block marked as data, and it has no other tools, context or memory, so an email can ask for anything and there is nothing to do it with. A reply is drafted only for a question, a request, scheduling, an introduction or a follow-up, and only when the confidence clears a bar that rises the less the sender is known: 0.6 for their team or a contact (the principal's contacts count only for the principal: a team member's mail is weighed by the team and their own sent mail), 0.7 for someone they have written to before (`has_written_to`, a search of their sent mail), 0.85 for a stranger. Pitches, notes of thanks, FYIs, notifications, newsletters and phishing get nothing, and so does any failure. An email that also went to other people is drafted for only when the person is in To and it asks them themselves: the classifier is told their name, whether they are in To or Cc and how many others it went to, and answers `asked_of_them`, false when the email greets someone else by name (\"Brennan: ...\") or asks the group at large. One that only copies them is never drafted for. Either is recorded `not_needed` with the reason `asks_someone_else`. It runs on `DELEGATION_CLASSIFIER_MODEL`, else the routing model. A sender whose address Gmail couldn't authenticate is handled as a stranger whatever the roster says — anyone can put a colleague's or a client's address in From — so they get the stranger's bar, a holding reply and the stranger limits; the card still says who they claim to be, and that the address isn't verified.\n\nThe reply is written by the same ghostwriter, in the person's voice, but from a fixed intent the module builds rather than words the person typed. Because the intent lets it restate the person's own earlier words, which words are theirs is never written inside the thread, where a sender could imitate any marker with a look-alike: every message there is labelled alike, and the person's own words come in a separate `<writer_said>` block after the thread, taken only from mail their own mailbox sent. Nothing inside the thread can close the thread block or open another. The intent: acknowledge the sender; say again only what the person's *own* earlier messages in the thread already said; commit to nothing new — no yes or no, date, time, price, fact or promise — and say they will get back to them; and put every question it could not answer from their words in **open questions**. A stranger always gets a short holding reply. The lint still strips any link or address that isn't the person's own. The reply goes to the sender (never `Reply-To`) and, on a group email, to everyone else it went to as Cc (reply to all, never the person's own addresses or the Executive); a stranger's holding reply goes to the sender alone. The card says when others were on the email, and its `draft_to` lists everyone, which Send checks.\n\nThe order: record the message, classify, reserve a slot in the shared daily limit, write, save the draft in Gmail (from the alias the mail went to, when it went to one) and store its id, then create the card (idempotent on the message) and mark it drafted. Nothing that fails along the way loses the message. A failure that may pass — the classifier or the writer failing, Gmail refusing the draft, a card that couldn't be made (its draft is deleted first, so no draft is left without a card), any other error with that one message — leaves it for a later scan (`retry`), and it is given up on only after three tries; one message's trouble never holds up the rest. A daily limit reached while it was being read leaves it for later without counting as a try.\n\n### The reply cards\n\nA card is a `delegation_reply` decision whose class is **its approver's alone** (`DecisionClassSpec.approver_only`): only the person it was drafted for sees or resolves it on any decisions route — a team member's card answers 404 to the principal too — and it is never an alert: alerts feed chat turns, which would put other people's mail into memory. It carries the sender with who they are to the person and whether Gmail could verify the address (SPF/DKIM/DMARC, through `fact_confirmation.headers_authenticated`), the subject, what they wrote, the draft, the open questions and its warnings. `GET /delegation/replies` lists the open ones from the database alone, so Today never waits on Google.\n\n- **Send** approves the card, which sends its draft exactly as it is in their mailbox (see *Send on your tap*). **Edit in Gmail** (or **Edit in Outlook**) opens it there, to change the draft first or send it from there.\n- **Dismiss** rejects the card; the class's after-reject step then deletes the draft if nobody edited it — its message id is still the one it was saved with, since Gmail gives an edited draft a new one, and the Outlook client makes a draft's message id `<id>.<changeKey>` so an edit there changes it too — and keeps it otherwise. What happened is recorded even when Gmail fails.\n- Each scan first **settles** what Gmail already settled: a draft sent from Gmail, a draft deleted there, a reply the person wrote themselves, a thread that is gone, or a card left for 7 days (its draft stays in Gmail). Each is a compare-and-set close with the reason. A newer message from someone else flags the card instead. A card being sent at that moment is left alone.\n\n### Send on your tap\n\n`delegation.reply_send` is the only thing in Act as me that sends, and all it can send is the draft on a card, by its id: `DelegateGmail.send_draft` posts `{\"id\": …}` to Gmail's `drafts.send`, and `DelegateOutlook.send_draft` posts an empty body to that draft's Graph `send`, and nothing else, so no text, recipient or header is ever passed. It has two doors: `send_approved_reply`, reached only from `POST /decisions/{id}/approve` — a class only the card's own person may resolve — and `send_on_its_own`, reached only from the inbox watcher under Handle it for me (below). AST tests pin both call sites, so no model, chat turn, workflow, scheduled job or MCP call can. A tap is checked like this: At send time it checks everything again:\n\n1. **Who is asking.** The caller is the card's person and the API knows it: signed callers are on and the request carries that person's signed assertion (or the operator's, under local login), or the API runs for local login and answers this computer only. Anything else is a 409 `caller_signing_required` — with only the shared secret, whoever holds it could send as the owner — so on a server Send needs signed sign-ins.\n2. **The switches.** Act as me and Draft replies to my inbox are on, and no client slot is active.\n3. **The mailbox.** Their mailbox is connected.\n4. **The draft.** It still exists, in the same thread, and they haven't replied there themselves since; otherwise the card closes.\n5. **Who it goes to.** To, Cc and Bcc hold between 1 and 10 addresses, never the Executive's own, and it is from one of their own addresses.\n6. **What changed.** Recipients that differ from the card's, or a newer message from someone else, need a second yes: the first tap gets a 409 `confirm` naming the recipients and the reason, and the person approves again with what they were shown.\n\nThen it claims the card (`claim_for_execution`, proposed → executing, a compare-and-set, so a double tap sends once) and reads the draft once more: `drafts.send` sends whatever the draft is when Gmail gets the request, so if it was edited since the checks read it — in another tab, by a delegate — nothing is sent and the card comes back (`draft_changed`). Then it sends, and records the result: `approved_with_edit` when the draft was edited in Gmail, the sent message's id, the draft row's `sent_message_id`, and a private `delegation_reply_sent` row. A refusal that proves nothing went — a 4xx, a lapsed sign-in, a rate limit, a draft already gone — hands the card back. A failure that leaves it unclear — a timeout, a 5xx — leaves it `executing` and says to check the Sent folder, and the next scans ask Gmail: their message in the thread means it was sent; anything else is judged on the second scan that sees it: the draft still there and nothing sent means it was not (Gmail deletes a draft it sends), and the card comes back, flagged; the draft gone and nothing sent means it was deleted. Nothing is ever retried on its own. Sending is the person's own act, so it works while the Executive is paused.\n\n### Limits and failures\n\nAt most 5 drafts a scan; `DELEGATION_INBOX_MAX_DRAFTS_PER_DAY` (default 20) a day, inside the shared `DELEGATION_MAX_DRAFTS_PER_DAY` it shares with chat; 200 classifications, 2 drafts per sender (1 for a stranger) and 10 for strangers in all per day; and never more than 25 open cards. A lapsed Gmail sign-in sets the status and is looked at again every 30 minutes; a rate limit, an error reaching Gmail or a crash backs off from 5 minutes, doubling up to 2 hours. Neither turns the switch off: the Settings card shows the status in plain words.\n\n## Handle it for me\n\nA third switch under Act as me, **Handle it for me** (`delegation.handle_it`), lets the inbox watcher send some of its replies itself instead of leaving them on a card. It is one row per person in `delegation_handle_it` (`enabled`, `mode`); no row means off. One setting says how much goes without them, the way quality does on the Agent Council (`handle_it.RULES`): **Easy ones** (`careful`) sends only replies to people they know (someone on their team, a contact or someone they have written to) of at most 400 characters when the classifier is at least 0.9 sure; **People I know** (`balanced`), where it starts, sends replies to people they know up to 1200 characters at 0.8; **Most mail** (`bold`) also answers strangers, up to 2000 characters, and lets a link or an amount through when the classifier is at least 0.9 sure. Everything else waits on a card as before, so turning it on never drafts less. A table from before the setting gets the `mode` column on its next open (`schema._add_handle_it_mode`): someone who had strangers set to send keeps that as Bold, everyone else gets Balanced. Only the person turns it on (`PUT /delegation/handle-it`), from a session the API knows is theirs: the same rule Send uses (`delegation.verified.caller_refusal`), so with only the shared secret it answers 409 `caller_signing_required`. Turning it on needs Act as me and Draft replies to my inbox on, and turning the inbox watcher off (or Act as me, which turns it off) turns it off too.\n\n**No model decides whether a reply goes.** The watcher's two model calls are unchanged and tool-less, so text in an email can at most change the verdict and the draft. After the draft is written, `handle_it.refusal` — plain code — decides, and anything it refuses becomes the usual card with the reason kept on it (`handle_it_reason`). It refuses when:\n\n- it's off, or the sender is a stranger and the setting isn't Bold, or on a server signed sign-ins are off (`signing_ok`: signed callers, or local login);\n- Gmail couldn't authenticate the sender, whatever the roster says;\n- the email isn't a question, request, scheduling, introduction or follow-up, or the classifier was less sure than the setting needs (0.9 on Easy ones, 0.8 otherwise);\n- the reply goes to anyone the email didn't already go to (its From, To and Cc, less the person's own and the Executive's addresses), leaves out the sender, or goes to more than 10;\n- the email's subject, the sender's new words, or the reply touch money, contracts, legal, hiring, pay, layoffs, the board, investors, mergers, the press, health, or credentials and secrets (passwords, logins, tokens, API keys); or the reply carries an amount, a percentage or a link (a scheme, `www.`, a bare host with a path such as `bit.ly/…`, or a bare host on a common top-level domain) unless it's Bold and at least 0.9 sure, or runs over the setting's length (400, 1200 or 2000 characters);\n- the draft carries any flag but *others on the thread* or *Executive on the thread* (they asked if it's an AI, recipients were trimmed, …);\n- it already sent one in this thread in the last day, or the person's last message in the thread was itself sent on its own (no auto-reply ping-pong);\n- the day's limit is reached (`DELEGATION_HANDLE_IT_MAX_SENDS_PER_DAY`, default 20, within the watcher's drafts limit), or it can't be counted. Any error in the rules counts as a refusal.\n\nA reply the rules allow gets a card with `gate_mode` `auto_execute`, and the watcher sends it at once through `reply_send.send_on_its_own`, the second and last door into the send path (an AST test pins both callers: the approve route and the watcher). It runs the same send-time checks as a tap — switches, mailbox, draft, recipients, the claim and the last re-read — with no caller, and adds its own: the card must be `auto_execute`, Handle it for me still on with the setting still allowing that sender (or, for a follow-up, that recipient), signing still on, the once-a-thread-a-day rule and the daily limit counted again, and the draft untouched since it was saved (an edit in Gmail means the person has taken it over: `draft_changed`, the card waits for them). Every refusal hands the card back to the person (`decision_ledger.hand_back`, a compare-and-set to `propose`), with the reason kept on it when there are words for it, and a failure never stops the scan. Every card it left for the person says why on Today (`waited_because` on `GET /delegation/replies`). A reply sent on its own finishes as `executed` (not approved), is recorded in `delegation_handled` (for the per-thread and daily rules) and writes a private `delegation_reply_handled` row; an unconfirmed one is settled by the reconciler the same way. No History note is taken from it, since notes come only from the person's own words. It runs inside the watcher's scan, so it stops while the Executive is paused.\n\n**Follow-ups as you** (`delegation.follow_ups`). While Handle it for me is on, the watcher's scan also looks at the person's own sent mail, at most once an hour (`LOOK_EVERY`), for an email of theirs that asked something (a question mark in their own words), is 3 to 10 days old, went to at most 10 people other than the Executive, and is still the last message in its thread. Plain code picks it; each gets one follow-up ever (its `delegation_inbox_messages` row), at most two a look, within the drafts limit. The ghostwriter, tool-less as always, writes a short nudge in their voice from the thread, saved as a draft in that thread to exactly the people the email went to. `handle_it.follow_up_refusal` — plain code — decides whether it goes: by the setting it never goes on Easy ones, goes to their team and contacts on People I know and to anyone they wrote to on Most mail (`follow_up_refused` otherwise: `follow_up_level`); it also refuses on any change of recipients, a sensitive topic, an amount or a link, more than 600 characters, a flag, and the same per-thread and daily counts as replies. It goes through `send_on_its_own` on an ordinary `delegation_reply` card marked `source: follow_up`, which rechecks the setting for that recipient. A refused one waits on Today as **Follow-up waiting**, and closes by itself (its untouched draft deleted) when anyone answers in the thread first.\n\n**What it sent** is the person's alone: `GET /delegation/handled` lists the last 7 days (who, subject, the reply, the questions it left them and a link to the thread in their mailbox), and the Settings card shows it under the switch with how many went today.\n\n### Take the lead as you\n\nOn Settings → Act as me, Handle it for me is one dial: **Off**, **Easy ones**, **People I know**, **Most mail** and, for the owner, **Everything**, which uses **Take the lead** (`PUT /delegation/take-the-lead`, one row `person:<id>` in `take_the_lead`; turning it on turns Handle it for me on). While it is on, `handle_it.refusal` drops the setting's limits: strangers, the classifier's confidence, amounts, and the length up to a 4000-character ceiling. A reply with a link still waits for a tap (refusal `link`). In their place it checks the company's and the person's own added rules (`take_the_lead.reply_hit`, refusal `lead_rule`). Everything Handle it always keeps still holds: signed sign-ins, an authenticated sender, a reply kind, exactly the thread's people, the topics that always wait, draft flags, never twice in a row, one a thread a day and the daily limit. Follow-ups under it may go to anyone the person wrote to, with the same sensitive, amount, link and length checks plus the added rules. `reply_send.send_on_its_own` accepts the card while both switches are on. Each person adds and removes their own rules (`/delegation/take-the-lead/rules`). Removing one needs a caller the API can tie to them.\n\n## The mailbox client\n\n`delegation.gmail.DelegateGmail` talks to the Gmail REST API directly and is **never registered with the MCP gateway**, so the model reaches the mailbox only through the typed handler. The credential is one file per person in `DELEGATION_GOOGLE_CREDENTIALS_DIR`, named from a hash of the address (0600 in a 0700 directory), minted by `scripts/connect-own-gmail.py` on the Executive's own OAuth client with the scopes `gmail.readonly` and `gmail.compose`. It never lives in `WORKSPACE_MCP_CREDENTIALS_DIR`, where workspace-mcp picks a credential by address. Besides reading threads and saving drafts it lists the inbox and checks whether they have written to an address, reads one message or draft, lists the person's send-as addresses and deletes a draft. Its **one send method**, `send_draft`, sends an existing draft by its id and nothing else — never `messages.send`, which sends any text it is given — and unit tests pin the method set, the endpoint, the request body and its single caller. A failed request says whether it may have been carried out anyway (a timeout after connecting, a 5xx), which is what the send path needs to know. A parsed message carries when it arrived, whether it is bulk, a bounce or a calendar invite, and whether Gmail's authentication results vouch for its sender.\n\n`gmail_status` answers `connected`, `not_configured`, `needs_reconnect` (Google refused the saved sign-in — an app in Testing mode has its tokens expire after 7 days; a rate limit, though Gmail may send it as a 403, is an `error` to retry, not a reconnect), `mismatch`, `no_email`, `shared_mailbox` or `error`. `shared_mailbox` means the person's address *is* the Executive's; it is refused before asking Google, because then everything the Executive writes would look like theirs. The gateway closes the other door: every `google_workspace__*` call must act as the Executive's own account, and a `user_google_email` naming anyone else is refused and audited (see Integrations).\n\n### Outlook\n\nA person may connect an Outlook mailbox instead (work, school or personal), with `scripts/connect-own-outlook.py`: a device-code sign-in on the Executive's own Entra app (`MS365_MCP_CLIENT_ID`, tenant `MS365_MCP_TENANT_ID` or `common`) asking for `User.Read`, `Mail.ReadWrite`, `Mail.Send` and `offline_access`. It writes the same per-person file with `\"provider\": \"microsoft\"`, so a person has one mailbox for Act as me, and `gmail_for` hands back `delegation.outlook.DelegateOutlook`, which keeps `DelegateGmail`'s methods, return types and errors, so every caller above runs unchanged. It talks to Microsoft Graph directly, never through the Microsoft 365 MCP server the Executive's own Outlook uses, and is never registered with the gateway. Microsoft rotates the refresh token on use; the new one is written back into the file (atomically, keeping every other key, and only if the file still holds the old one). Graph is asked for immutable ids, so a sent draft keeps its id; a thread is Outlook's `conversationId`. Gmail's labels are mapped onto what the callers read: `SENT` only for mail in their Sent Items folder (a From line set to their address by someone else never counts), `DRAFT`, `INBOX`, and Focused Inbox's Other read as a tab. A sender counts as authenticated only when the topmost `Authentication-Results` — the one Exchange wrote, above anything the sender added — holds exactly one DMARC verdict, a pass for From's own domain, and Exchange Online Protection's own `compauth=` verdict, so a header the sender wrote on mail EOP never stamped doesn't count. `delete_draft` refuses anything that isn't a draft, and deletes with the draft's etag (`If-Match`), so a draft sent in between — it keeps its id — is left alone. No client secret is ever written into a person's file, and Graph has no signature setting to read.\n\n## Privacy\n\nWhat a person's mailbox touches is theirs. For the principal that means private to the principal, as every private row is. For a team member it means theirs alone, the principal included: an audit row carries `private_to_person` (set by `audit.rows_for_person` around the inbox watcher, a card's Send and Dismiss and their settings changes, and by `people_tools.audit_row_owner` on a turn that read their mail) and is left out of every audit read — the log, a session's timeline, a row by id, the brief — with only the usage totals counting it; their reply cards are theirs alone (above); and the owner's view of their use is counts only (drafts and sends in 30 days, and whether their inbox watcher is on). The conversation itself becomes its owner's alone before the mailbox is first read: `ghostwrite_email` marks the session `mail_private` (`session_store.mark_mail_private`, creating a channel adapter's row early, with its owner) and refuses to read the mailbox if that can't be stored or the conversation already belongs to someone else (which it then leaves unmarked); from then on only its owner may open it (`chat._session_access`), and working-style learning skips it. Every later turn there starts as if it had read the mail (`settings.pin_turn_delegation` reads the flag and fails closed), so a follow-up answered from history alone is still private to its owner, teaches no memory and stays under the lockdown, and the web chat's rows before the turn (the inbound message and the knowledge lookup) are theirs too. A channel adapter's own pre-turn rows are written as before. Anyone else speaking in it is not offered Act as me.\n\nOnce `touched_mail` is set, every audit row the turn writes is private (`people_tools.audit_row_private_to_principal`), and a team member's is theirs alone: the tool row (its input and result redacted, since `ghostwrite` is a sensitive tool name), the reply's `chat_turn` row that carries the preview, the model-call rows, and the background passes, which run under `private_rows`. The Honcho peer and department syncs are skipped, because peer memory is read on other people's turns. No memory is learned from the turn at all: the episodic, open-loop and working-style passes are skipped too, since its reply quotes a draft built from other people's mail. The `delegation_*` audit events are always private and carry metadata only — ids, counts and flags, never the draft or the thread. The inbox watcher is private the same way: every row a scan or a card action writes is its person's alone, and it starts no chat turn, alert, scheduled action or workflow run and teaches no memory.\n\nThe turn also stops reaching anyone else (`delegation.lockdown`). From the round that calls `ghostwrite_email` — a round's tools run together — until the turn ends, the dispatch guard refuses every tool that sends, posts, invites, queues or starts work, fetches an outside address, or writes state that others or later turns read: the DMs and `message_person`, broadcasts, calendar bookings and cancellations, follow-ups, workflows and research, `read_document` and the watchlist, `load_mcp_server`, roster, goal, skill and alert changes, open loops, decisions and standing facts. Through MCP `call_tool`, only the six Google Workspace reads remain. Every tool is classified as allowed or withheld, a test fails on a new unclassified one, and an unknown name is withheld. A refused call gets a private `tool_invocation` row (`refused: mail_touched`) and tells the model to offer it in a new message. The offered tool list never changes mid-turn, so the cached prefix holds. The send paths check again on their own (`_guard_outbound`, the broadcast, calendar, workflow, research and follow-up handlers, the gateway's `call_tool` and `load_mcp_server`). The server-side web search stays, as on a turn private to the principal. The lockdown lasts for that turn only.\n\n## Always in the loop\n\nA sent reply can leave a note. Once the reply went, `reply_send` starts `memory.history_notes.note_sent_reply` for the person who sent it, in the background, when their \"Keep track of what happens\" switch is on and the conversation isn't one they asked not to remember. The note-taker sees only the words they sent, so other people's mail never becomes a note, and a failure never touches the send. Recall is `recall_history`, offered on the same verified, private surfaces as `ghostwrite_email` and also allowed under the mail lockdown, since it only reads the speaker's own notes. Calling it locks the turn like `ghostwrite_email` does, from its own round on. The same switch also covers notes from chat, which don't need Act as me. See **Memory** for the checks, retention and controls.\n\n## The system prompt\n\nA constant, name-free `DELEGATION_ADDENDUM` joins block 0 after the unchanged identity addendum while anyone on the install has it on (`block0_delegation_on`). It tells the model that `ghostwrite_email` is the single exception to *never impersonate*, and only for the person being spoken to; that everything else is written as itself; that when the tool isn't offered the asker can't have it; that a draft is never described as sent; and that it never denies being an AI. It is keyed on the install-level setting, never on the turn or the speaker, so switching it misses the 1h cache once (see Prompt Caching).\n\n## Surfaces\n\n- **Settings → Act as me** (`ActAsMeCard`, hidden unless `GET /delegation` answers, so a team member sees it once the owner lets them): the mailbox connection (`provider` says which) with both connect commands (Gmail and Outlook) and **Check again**, the **Write drafts as me** switch, the **Draft replies to my inbox** switch with its status in plain words, when it last checked and **Check now**, and **How I write**: length and tone, a greeting per audience (`{first}` is their first name), the sign-off, habits and never-rules in fields that grow to show every line, the signature with **Refresh from Gmail** and **Don't add my signature** (or **Add my Gmail signature** when none is added; on Outlook only **Don't add my signature**, with why), and each example quoted with **Remove examples**. The owner also gets **Let team members use it** where the install allows it, with each team member who has it on listed by name and counts only.\n- **Today → Replies waiting** (`RepliesWaiting`, the top of the left column; hidden unless `GET /delegation/replies` answers with cards): each card shows who wrote and who they are to you, whether their address was verified, the subject, **They wrote** as plain text, your draft, **Decide before sending** (the open questions) and its warnings, with **Send** (a confirm naming who it goes to, and a second one when that or the thread changed), **Edit in Gmail** or **Edit in Outlook**, and **Dismiss**.\n- **Setup status**: a **Your own mailbox (Act as me)** light (`your_gmail`), amber while the inbox watcher can't reach the mailbox, is being rate-limited or has 25 replies waiting.\n- **Settings → Your Executive** (`app/settings/executive`, where `/settings/on-its-own` lands): the pause, **Take the lead** and **Book meetings without asking** (as the Executive). **Handle it for me** (the Off / Easy ones / People I know / Most mail / Everything dial, what each sends, how many went today and what it sent this week, as you) sits under the mailbox card on **Settings → Act as me**.\n- **API**: `GET`/`PUT /delegation`, `GET`/`PUT`/`DELETE /delegation/voice`, `POST /delegation/voice/learn`, `POST /delegation/voice/signature`, `PUT /delegation/inbox`, `POST /delegation/inbox/check`, `GET /delegation/replies`, `PUT /delegation/handle-it` and `GET /delegation/handled` — the caller's own delegation only — and `PUT /delegation/team`, the owner's switch (see API Reference). Send is `POST /decisions/{id}/approve`; Dismiss is `POST /decisions/{id}/reject`.\n- **Evals**: a scenario's `delegation:` block runs the turn against an in-memory mailbox (`evals.mailbox.ScenarioMailbox`) and hands the saved drafts to the judge (`delegation_001`–`003`). A `type: inbox` scenario runs the watcher's two model calls on one thread: whether it drafts must match the scenario, and a draft is judged on saying nothing the person hadn't, copying no link or address, and listing every open question (`delegation_inbox_001`–`007`; the last checks a draft never claims anything was sent).\n\nActing within rules the person sets and standing in for them are later, separate changes, each behind its own switch, off by default.",
"mermaid": "flowchart TD\n Ask[\"Principal or team member, verified<br/>'reply to Dana as me: yes'\"] --> Pin[\"pin_turn_delegation<br/>may have it? on? verified? private? attended?\"]\n Pin -->|\"offered\"| Loop[\"Executive tool loop<br/>with ghostwrite_email\"]\n Pin -->|\"not offered\"| Self[\"writes as itself<br/>(unknown tool this turn)\"]\n Loop --> Tool[\"ghostwrite_email handler<br/>caps, mailbox check, recipients in code\"]\n Tool -->|\"touched_mail\"| Private[\"turn's rows and conversation<br/>theirs alone, no memory\"]\n Tool --> Client[\"DelegateGmail or DelegateOutlook<br/>REST, outside the MCP gateway\"]\n Tick[\"Scheduler tick or Check now<br/>Draft replies to my inbox on\"] --> Scan[\"inbox scan, rows theirs alone<br/>skip rules, limits, ledger\"]\n Scan --> Client\n Client --> Box[(\"The person's own Gmail or Outlook\")]\n Scan --> Classify[\"classifier, no tools<br/>needs a reply? kind, confidence\"]\n Classify -->|\"worth a draft\"| Gw\n Voice[(\"delegation_voice<br/>How I write\")] --> Gw[\"ghostwriter<br/>no tools: voice + intent + thread\"]\n Tool --> Gw\n Gw --> Lint[\"lint: links and addresses<br/>only the person's own\"]\n Lint --> Draft[\"create_draft, threaded\"]\n Draft --> Box\n Draft --> Chip[\"chat chip: open the draft<br/>chat never sends\"]\n Draft --> Card[\"Today: Replies waiting<br/>their own card\"]\n Card -->|\"Send, confirmed\"| SendPath[\"reply_send: checks again,<br/>claim, send the draft by id\"]\n SendPath --> Box\n class Ask entry\n class Pin compute\n class Loop compute\n class Self compute\n class Tool compute\n class Private compute\n class Client compute\n class Tick entry\n class Scan compute\n class Classify compute\n class Box external\n class Voice storage\n class Gw compute\n class Lint compute\n class Draft hot\n class Chip entry\n class Card entry\n class SendPath hot",
"generated_at": "2026-10-04T11:29:40Z"
}
diff --git a/packages/core/openexecutive/delegation/handle_it.py b/packages/core/openexecutive/delegation/handle_it.py
index c689f94e..e9cca99b 100644
--- a/packages/core/openexecutive/delegation/handle_it.py
+++ b/packages/core/openexecutive/delegation/handle_it.py
@@ -146,7 +146,7 @@ _AMOUNT_RE = re.compile(
# What each refusal tells the person on the card.
REASONS: dict[str, str] = {
- "level": "Handle it for me asks you about email from people you don't know yet (Bold sends those).",
+ "level": "Handle it for me asks you about email from people you don't know yet (Most mail sends those).",
"signing_off": "Sending on its own needs signed sign-ins on this server.",
"sender_unverified": "Your mail service couldn't confirm who sent it.",
"unsure": "It wasn't sure enough this needs only a simple reply.",
diff --git a/packages/ui/scripts/briefingSummary.test.mjs b/packages/ui/scripts/briefingSummary.test.mjs
index 5fa08522..f518b333 100644
--- a/packages/ui/scripts/briefingSummary.test.mjs
+++ b/packages/ui/scripts/briefingSummary.test.mjs
@@ -37,7 +37,7 @@ test("the summary leads with what needs you, then what was handled", () => {
const parts = briefingSummary({ ...zero, needsYou: 3, handledOvernight: 12, inFlight: 7, deptAtRisk: 1 });
assert.deepEqual(
parts.map((p) => p.text),
- ["3 things need you", "The Executive handled 12 overnight", "1 department at risk", "7 in flight"],
+ ["3 things need you", "The Executive handled 12 overnight", "1 department at risk", "7 under way"],
);
assert.deepEqual(parts[0].target, { kind: "needsYou" });
assert.deepEqual(parts[1].target, { kind: "panel", panel: "handled" });
diff --git a/packages/ui/scripts/initials.test.mjs b/packages/ui/scripts/initials.test.mjs
new file mode 100644
index 00000000..75a20aca
--- /dev/null
+++ b/packages/ui/scripts/initials.test.mjs
@@ -0,0 +1,25 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import { initials } from "../src/lib/initials.ts";
+
+test("initials take the first and last name's first letters", () => {
+ assert.equal(initials("Jordan Avery"), "JA");
+ assert.equal(initials("Mary Ann van der Berg"), "MB");
+ assert.equal(initials(" dana park "), "DP");
+});
+
+test("a single name gives its first two letters", () => {
+ assert.equal(initials("Jordan"), "JO");
+ assert.equal(initials("Ö"), "Ö");
+});
+
+test("an email uses its local part, split on dots, dashes and underscores", () => {
+ assert.equal(initials("[email protected]"), "JA");
+ assert.equal(initials("[email protected]"), "JO");
+ assert.equal(initials("[email protected]"), "JA");
+});
+
+test("nothing usable gives a question mark", () => {
+ assert.equal(initials(""), "?");
+ assert.equal(initials(" "), "?");
+});
diff --git a/packages/ui/scripts/replyCards.test.mjs b/packages/ui/scripts/replyCards.test.mjs
index 8c97cf3c..ab0eda7f 100644
--- a/packages/ui/scripts/replyCards.test.mjs
+++ b/packages/ui/scripts/replyCards.test.mjs
@@ -9,6 +9,8 @@ import {
sendLeftNothing,
sendQuestion,
senderLine,
+ senderShort,
+ draftIsLong,
} from "../src/lib/replyCards.ts";
test("relationLabel names who the sender is, and nothing for an unknown relation", () => {
@@ -33,6 +35,20 @@ test("senderLine shows the name and address, or the address alone", () => {
assert.equal(senderLine({ from_name: " ", from_email: "[email protected]" }), "[email protected]");
});
+test("senderShort keeps the domain beside the name, and the full address unless confirmed", () => {
+ const card = { from_name: "Dana Park", from_email: "[email protected]" };
+ assert.equal(senderShort({ ...card, sender_verified: true }), "Dana Park · @d4na-park.example");
+ assert.equal(senderShort({ ...card, sender_verified: false }), "Dana Park <[email protected]>");
+ assert.equal(senderShort(card), "Dana Park <[email protected]>");
+ assert.equal(senderShort({ from_name: " ", from_email: "[email protected]", sender_verified: true }), "[email protected]");
+});
+
+test("draftIsLong clamps drafts past 280 characters or 5 lines", () => {
+ assert.equal(draftIsLong("Thanks, Thursday works."), false);
+ assert.equal(draftIsLong("x".repeat(281)), true);
+ assert.equal(draftIsLong("a\nb\nc\nd\ne\nf"), true);
+});
+
test("safeGmailLink keeps only a link into Gmail", () => {
const link = "https://mail.google.com/mail/u/?authuser=o%40x.example#all/18c2";
assert.equal(safeGmailLink(link), link);
diff --git a/packages/ui/src/app/audit/page.tsx b/packages/ui/src/app/audit/page.tsx
index b3e29d05..d7416a42 100644
--- a/packages/ui/src/app/audit/page.tsx
+++ b/packages/ui/src/app/audit/page.tsx
@@ -459,7 +459,7 @@ function AuditPageInner() {
<div className="min-w-0">
<h1 className="text-2xl sm:text-3xl font-bold tracking-tight text-fg">Audit log</h1>
<p className="mt-1 text-[15px] text-fg-muted">
- Every chat turn, specialist consult, tool call and scheduled action, newest first.
+ Each chat, each question passed to an expert, each tool used and each scheduled job, newest first.
</p>
</div>
<Link href="/audit/usage" className={buttonClass("secondary", "sm")}>
diff --git a/packages/ui/src/app/audit/usage/page.tsx b/packages/ui/src/app/audit/usage/page.tsx
index 044cf72a..e399b733 100644
--- a/packages/ui/src/app/audit/usage/page.tsx
+++ b/packages/ui/src/app/audit/usage/page.tsx
@@ -129,7 +129,7 @@ export default function TokenUsagePage() {
</Link>
</div>
<p className="mt-1 text-sm text-fg-muted">
- Aggregate token usage and cost across all sessions, summed from the
+ What the AI has cost across every conversation, added up from the
audit log. Days are UTC. Cost is the actual OpenRouter charge captured
per call — it accrues from when cost tracking went live, so calls
logged before then count tokens but $0.
diff --git a/packages/ui/src/app/council/page.tsx b/packages/ui/src/app/council/page.tsx
index 916509ee..2a32b1f6 100644
--- a/packages/ui/src/app/council/page.tsx
+++ b/packages/ui/src/app/council/page.tsx
@@ -1,6 +1,7 @@
"use client";
import Link from "next/link";
+import Icon from "@/components/Icon";
import { useCallback, useEffect, useId, useMemo, useState } from "react";
import {
@@ -565,6 +566,13 @@ export default function CouncilPage() {
<div className="flex-1 min-h-0 min-w-0 overflow-y-auto bg-surface text-fg">
<div className="max-w-5xl mx-auto px-4 py-6 sm:px-8 sm:py-10 space-y-6">
<div>
+ <Link
+ href="/settings/advanced"
+ className="-ml-2 mb-2 inline-flex min-h-touch items-center gap-1.5 rounded-lg px-2 text-[15px] text-fg-muted hover:text-fg hover:bg-surface-overlay transition-colors"
+ >
+ <Icon name="arrow-left" size="w-4 h-4" />
+ Advanced
+ </Link>
<h1 className="text-2xl sm:text-3xl font-bold tracking-tight text-fg">Agent Council</h1>
<p className="mt-2 text-[15px] text-fg-muted">
Pick how thorough answers should be and add instructions for any agent. Open an
@@ -585,7 +593,7 @@ export default function CouncilPage() {
<h2 className="text-lg font-semibold text-fg">Quality</h2>
{presets.active === null && (
<span
- className="text-[10px] uppercase tracking-widest px-2 py-1 rounded bg-amber-500/10 text-amber-500 border border-amber-500/20"
+ className="text-[10px] uppercase tracking-widest px-2 py-1 rounded bg-accent/10 text-accent border border-accent/20"
title={`${presets.custom_agents.length} agent(s) differ from ${basePresetLabel ?? "the preset"}`}
>
Custom
@@ -616,7 +624,7 @@ export default function CouncilPage() {
</span>
<span className="block text-sm text-fg-muted mt-1 leading-relaxed">{p.description}</span>
{p.model && (
- <span className="block text-[11px] text-fg-subtle mt-2 font-mono">{p.model}</span>
+ <span className="block text-[13px] text-fg-subtle mt-2">Uses {shortModelName(p.model)}</span>
)}
</button>
);
@@ -676,7 +684,7 @@ export default function CouncilPage() {
<span
aria-hidden="true"
className={`inline-block h-2 w-2 flex-shrink-0 rounded-full ${
- status === "default" ? "bg-emerald-500" : "bg-amber-500"
+ status === "default" ? "bg-emerald-500" : "bg-accent"
}`}
/>
{status === "instructions" ? (
@@ -768,7 +776,7 @@ export default function CouncilPage() {
: ` · domains: ${detail.domains.join(", ") || "—"}`}
</p>
{detail.has_override && (
- <span className="text-[11px] uppercase tracking-widest px-2 py-1 rounded-md bg-amber-500/10 text-amber-500 border border-amber-500/20">
+ <span className="text-[11px] uppercase tracking-widest px-2 py-1 rounded-md bg-accent/10 text-accent border border-accent/20">
Customized
</span>
)}
diff --git a/packages/ui/src/app/globals.css b/packages/ui/src/app/globals.css
index 4f2de7c2..1ed9ee85 100644
--- a/packages/ui/src/app/globals.css
+++ b/packages/ui/src/app/globals.css
@@ -54,6 +54,15 @@
}
@layer base {
+ /* Brand: page and section headings in the display face (Bricolage
+ * Grotesque, loaded in app/layout.tsx). Small card titles (an h3, or an h2
+ * set at text-base or smaller) keep the body face, where the display face
+ * looks heavy. Chat answers and other Markdown (.prose) keep it too. */
+ :where(h1, h2):not(:where(.prose *, [class*="text-xs"], [class*="text-sm"], [class*="text-base"])) {
+ font-family: var(--font-display), var(--font-sans), system-ui, sans-serif;
+ letter-spacing: -0.015em;
+ }
+
* {
box-sizing: border-box;
}
diff --git a/packages/ui/src/app/icon.svg b/packages/ui/src/app/icon.svg
new file mode 100644
index 00000000..baa9d435
--- /dev/null
+++ b/packages/ui/src/app/icon.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#6366f1"/><stop offset="1" stop-color="#7c3aed"/></linearGradient></defs><rect width="48" height="48" rx="11" fill="url(#g)"/><g fill="#fff" transform="translate(7.2 7.2) scale(.7)"><circle cx="24" cy="24" r="7.5"/><circle cx="24" cy="6.5" r="4"/><circle cx="40.6" cy="18.6" r="4"/><circle cx="34.3" cy="38.2" r="4"/><circle cx="13.7" cy="38.2" r="4"/><circle cx="7.4" cy="18.6" r="4"/></g></svg>
diff --git a/packages/ui/src/app/layout.tsx b/packages/ui/src/app/layout.tsx
index cd62ed28..a387b5bb 100644
--- a/packages/ui/src/app/layout.tsx
+++ b/packages/ui/src/app/layout.tsx
@@ -1,5 +1,5 @@
import type { Metadata, Viewport } from "next";
-import { Geist } from "next/font/google";
+import { Bricolage_Grotesque, Geist } from "next/font/google";
import AuthProvider from "@/components/AuthProvider";
import { ExecutiveStatusProvider } from "@/components/executive/ExecutiveStatusContext";
import { SessionsProvider } from "@/components/sessions/SessionsContext";
@@ -10,6 +10,13 @@ import "./globals.css";
// Geist, self-hosted by next/font at build time: no request to Google from
// the browser, and no layout shift while it loads.
const geist = Geist({ subsets: ["latin"], variable: "--font-sans", display: "swap" });
+// The brand face: the Open Executive name and feature names (FeatureName).
+const bricolage = Bricolage_Grotesque({
+ subsets: ["latin"],
+ weight: ["700", "800"],
+ variable: "--font-display",
+ display: "swap",
+});
export const metadata: Metadata = {
title: "Open Executive",
@@ -31,7 +38,7 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
- <html lang="en" className={`h-full ${geist.variable}`}>
+ <html lang="en" className={`h-full ${geist.variable} ${bricolage.variable}`}>
<body className="h-full antialiased bg-surface text-fg">
<AuthProvider>
<SessionsProvider>
diff --git a/packages/ui/src/app/settings/advanced/page.tsx b/packages/ui/src/app/settings/advanced/page.tsx
index c9e859d2..d7fff88a 100644
--- a/packages/ui/src/app/settings/advanced/page.tsx
+++ b/packages/ui/src/app/settings/advanced/page.tsx
@@ -33,7 +33,7 @@ export default function AdvancedSettingsPage() {
<Icon name={item.icon} size="w-5 h-5" />
</span>
<span className="min-w-0 flex-1">
- <span className="block text-base font-semibold text-fg">{item.label}</span>
+ <span className="block font-display text-base font-bold tracking-tight text-fg">{item.label}</span>
<span className="block text-sm text-fg-muted leading-relaxed">
{item.description}
</span>
diff --git a/packages/ui/src/app/settings/page.tsx b/packages/ui/src/app/settings/page.tsx
index f61a7c25..5deadb85 100644
--- a/packages/ui/src/app/settings/page.tsx
+++ b/packages/ui/src/app/settings/page.tsx
@@ -80,9 +80,11 @@ export default function SettingsPage() {
<p className="mt-2 text-[15px] text-fg-muted">
How the Executive runs, who it runs for, and the tools for looking under the hood.
</p>
- <ul className="mt-6 sm:mt-8 grid gap-3 sm:gap-4 sm:grid-cols-2 lg:grid-cols-3">
+ {/* Phones: one compact list (a card with a row per page) so every page
+ fits on one screen. Wider: a grid of tiles. */}
+ <ul className="mt-6 sm:mt-8 grid grid-cols-1 overflow-hidden rounded-2xl border border-line bg-surface-elevated divide-y divide-line sm:overflow-visible sm:rounded-none sm:border-0 sm:bg-transparent sm:divide-y-0 sm:gap-4 sm:grid-cols-2 lg:grid-cols-3">
{pages.map((page) => (
- <li key={page.id}>
+ <li key={page.id} className="min-w-0">
<SettingsTile page={page} status={statuses.byPage[page.id]} />
</li>
))}
@@ -96,17 +98,17 @@ function SettingsTile({ page, status }: { page: SettingsPageDef; status?: TileSt
return (
<Link
href={page.href}
- className="group flex h-full items-start gap-4 rounded-2xl border border-line bg-surface-elevated p-5 sm:flex-col sm:gap-0 sm:p-6 transition-colors hover:border-accent/50 hover:bg-surface-overlay/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent/60"
+ className="group flex h-full min-h-14 items-center gap-3 px-4 py-3 sm:items-start sm:flex-col sm:gap-0 sm:rounded-2xl sm:border sm:border-line sm:bg-surface-elevated sm:p-6 transition-colors hover:bg-surface-overlay/40 sm:hover:border-accent/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60"
>
- <span className="hidden sm:flex w-11 h-11 items-center justify-center rounded-xl bg-accent/10 text-accent">
+ <span className="flex w-9 h-9 sm:w-11 sm:h-11 flex-shrink-0 items-center justify-center rounded-xl bg-accent/10 text-accent">
<Icon name={page.icon} size="w-5 h-5" />
</span>
- <span className="min-w-0 flex-1 sm:mt-4">
- <span className="block text-lg font-semibold text-fg">{page.label}</span>
+ <span className="min-w-0 flex-1 sm:mt-4 sm:w-full">
+ <span className="block font-display text-base sm:text-lg font-bold tracking-tight text-fg">{page.label}</span>
<span className="hidden sm:block mt-1 text-[15px] text-fg-muted leading-relaxed">
{page.description}
</span>
- <span className="mt-1.5 sm:mt-3 flex min-h-[1.25rem] items-center gap-2 text-sm text-fg-muted">
+ <span className="mt-0.5 sm:mt-3 flex min-h-[1.25rem] items-center gap-2 text-[13px] sm:text-sm text-fg-muted">
{status && (
<>
{status.tone !== "none" && (
@@ -125,7 +127,7 @@ function SettingsTile({ page, status }: { page: SettingsPageDef; status?: TileSt
<Icon
name="chevron-right"
size="w-5 h-5"
- className="sm:hidden mt-1 text-fg-subtle group-hover:text-fg transition-colors"
+ className="sm:hidden text-fg-subtle group-hover:text-fg transition-colors"
/>
</Link>
);
@@ -202,7 +204,8 @@ function useTileStatuses(): {
const handleIt = delegation.handle_it;
if (handleIt?.enabled) {
const mode = HANDLE_IT_MODES.find((m) => m.mode === handleIt.mode)?.label ?? "On";
- byPage["act-as-me"] = { text: `${byPage["act-as-me"]?.text} · Handle it for me · ${mode}`, tone: "ok" };
+ // Short enough for one line on a phone: the dial step is what matters.
+ byPage["act-as-me"] = { text: `Handles: ${mode}`, tone: "ok" };
}
}
diff --git a/packages/ui/src/app/signin/page.tsx b/packages/ui/src/app/signin/page.tsx
index 34b3c273..cde119e8 100644
--- a/packages/ui/src/app/signin/page.tsx
+++ b/packages/ui/src/app/signin/page.tsx
@@ -4,6 +4,7 @@ import { redirect } from "next/navigation";
import { GOOGLE_SIGN_IN, LOCAL_LOGIN, OIDC, auth, sessionStillAllowed, signIn } from "@/auth";
import { LOCAL_LOGIN_PROVIDER_ID } from "@/lib/localLogin";
import { OIDC_PROVIDER_ID } from "@/lib/oidc";
+import BrandMark from "@/components/BrandMark";
type SearchParams = Promise<{ callbackUrl?: string; error?: string }>;
@@ -35,7 +36,10 @@ export default async function SignInPage({ searchParams }: { searchParams: Searc
return (
<main className="min-h-screen flex items-center justify-center px-6">
<div className="w-full max-w-sm rounded-2xl border border-line bg-surface/60 p-8 shadow-xl">
- <h1 className="text-xl font-semibold tracking-tight text-fg">Open Executive</h1>
+ <h1 className="flex items-center gap-2.5 font-display text-2xl font-extrabold tracking-tight text-fg">
+ <BrandMark size="sm" />
+ Open Executive
+ </h1>
<p className="mt-2 text-sm text-fg-muted">
{LOCAL_LOGIN
? "This copy runs on your computer, and only you can reach it — so there’s no sign-in."
@@ -93,7 +97,9 @@ export default async function SignInPage({ searchParams }: { searchParams: Searc
</button>
</form>
)}
- {GOOGLE_SIGN_IN && (
+ {/* Google's button only when Google sign-in is set up: without
+ AUTH_GOOGLE_ID it would lead to an error page. */}
+ {GOOGLE_SIGN_IN && googleConfigured && (
<form
action={async () => {
"use server";
@@ -107,10 +113,13 @@ export default async function SignInPage({ searchParams }: { searchParams: Searc
</form>
)}
{!googleConfigured && !OIDC && (
- <p className="mt-4 text-xs text-fg-subtle">
- Sign-in isn’t set up here yet: set up Google or SSO sign-in (see docs/auth.md). On your own computer,
- start Open Executive with <code>make dev</code> to use it without signing in.
- </p>
+ <div className="mt-6 rounded-xl border border-line bg-surface-elevated px-4 py-3">
+ <p className="text-sm font-medium text-fg">Sign-in isn’t set up here yet.</p>
+ <p className="mt-1 text-sm text-fg-muted">
+ Ask whoever runs Open Executive for you to turn on Google or SSO sign-in.
+ </p>
+ <p className="mt-2 text-xs text-fg-muted">If that’s you: see docs/auth.md.</p>
+ </div>
)}
</>
)}
diff --git a/packages/ui/src/components/BrandMark.tsx b/packages/ui/src/components/BrandMark.tsx
index 96327b26..78642734 100644
--- a/packages/ui/src/components/BrandMark.tsx
+++ b/packages/ui/src/components/BrandMark.tsx
@@ -6,12 +6,26 @@ const BOX_CLASSES: Record<BrandMarkSize, string> = {
lg: "w-12 h-12 rounded-2xl bg-gradient-to-br from-indigo-500 to-violet-600 flex items-center justify-center shadow-xl shadow-indigo-500/25",
};
-const TEXT_CLASSES: Record<BrandMarkSize, string> = {
- sm: "text-white text-[10px] tracking-tight font-bold",
- md: "text-white text-[10px] tracking-tight font-semibold",
- lg: "text-white text-base tracking-tight font-bold",
+const MARK_CLASSES: Record<BrandMarkSize, string> = {
+ sm: "w-[18px] h-[18px] text-white",
+ md: "w-4 h-4 text-white",
+ lg: "w-8 h-8 text-white",
};
+/** The Council mark alone: the Executive in the middle, five specialists around it. */
+export function CouncilMark({ className = "" }: { className?: string }) {
+ return (
+ <svg viewBox="0 0 48 48" fill="currentColor" className={className} aria-hidden>
+ <circle cx="24" cy="24" r="7.5" />
+ <circle cx="24" cy="6.5" r="4" />
+ <circle cx="40.6" cy="18.6" r="4" />
+ <circle cx="34.3" cy="38.2" r="4" />
+ <circle cx="13.7" cy="38.2" r="4" />
+ <circle cx="7.4" cy="18.6" r="4" />
+ </svg>
+ );
+}
+
interface BrandMarkProps {
size?: BrandMarkSize;
}
@@ -19,7 +33,7 @@ interface BrandMarkProps {
export default function BrandMark({ size = "sm" }: BrandMarkProps) {
return (
<div className={BOX_CLASSES[size]} aria-hidden>
- <span className={TEXT_CLASSES[size]}>OE</span>
+ <CouncilMark className={MARK_CLASSES[size]} />
</div>
);
}
diff --git a/packages/ui/src/components/Briefing.tsx b/packages/ui/src/components/Briefing.tsx
index 130a71f8..a4f8ebec 100644
--- a/packages/ui/src/components/Briefing.tsx
+++ b/packages/ui/src/components/Briefing.tsx
@@ -504,7 +504,7 @@ export default function Briefing({ onContinue, showHeader = false, firstName, ba
tiles.push({
key: "inFlight",
value: String(inFlight.length),
- label: "In flight",
+ label: "Under way",
sub: inFlightNext(inFlight),
subTone: inFlight.some((f) => f.overdue) ? "amber" : undefined,
});
@@ -829,7 +829,7 @@ export default function Briefing({ onContinue, showHeader = false, firstName, ba
)}
</div>
</SidePanel>
- <SidePanel open={openPanel === "inFlight"} onClose={() => setOpenPanel(null)} title="In flight">
+ <SidePanel open={openPanel === "inFlight"} onClose={() => setOpenPanel(null)} title="Under way">
<InFlightPanelBody inFlight={inFlight} />
</SidePanel>
<SidePanel open={openPanel === "handled"} onClose={() => setOpenPanel(null)} title="Handled overnight">
diff --git a/packages/ui/src/components/FeatureName.tsx b/packages/ui/src/components/FeatureName.tsx
new file mode 100644
index 00000000..b67ad377
--- /dev/null
+++ b/packages/ui/src/components/FeatureName.tsx
@@ -0,0 +1,78 @@
+// A named feature (Take the lead, Act as me, ...) set as a brand label: the
+// display face in a pill with the feature's own color and glyph, the same on
+// every screen. Use it where the name is a title or a tag; a name inside a
+// sentence stays plain text. Sizes in em, so it scales with the heading or
+// line it sits in.
+
+import type { ReactNode } from "react";
+
+export type Feature = "take_the_lead" | "act_as_me" | "handle_it" | "history" | "agent_council";
+
+const FEATURES: Record<Feature, { name: string; tone: string; glyph: ReactNode }> = {
+ take_the_lead: {
+ name: "Take the lead",
+ tone: "bg-orange-100 text-orange-700 dark:bg-orange-500/15 dark:text-orange-300",
+ glyph: <path d="M3 8h9M8.5 4l4 4-4 4" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" />,
+ },
+ act_as_me: {
+ name: "Act as me",
+ tone: "bg-indigo-100 text-indigo-700 dark:bg-indigo-500/15 dark:text-indigo-300",
+ glyph: (
+ <path
+ d="M2.5 11.5c1.5-4 3-6 4-5s-1.5 4.5 0 4.5 2-3 3.5-3 1 2.5 3.5 1.5"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="1.8"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ ),
+ },
+ handle_it: {
+ name: "Handle it for me",
+ tone: "bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",
+ glyph: (
+ <g fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
+ <circle cx="8" cy="8" r="6" />
+ <path d="M5.3 8.2l1.9 1.9 3.6-3.8" />
+ </g>
+ ),
+ },
+ history: {
+ name: "History",
+ tone: "bg-sky-100 text-sky-700 dark:bg-sky-500/15 dark:text-sky-300",
+ glyph: (
+ <g fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
+ <path d="M2.5 8a5.5 5.5 0 1 0 1.6-3.9" />
+ <path d="M2.5 2.5v2.5H5M8 5v3l2 1.5" />
+ </g>
+ ),
+ },
+ agent_council: {
+ name: "Agent Council",
+ tone: "bg-fuchsia-100 text-fuchsia-700 dark:bg-fuchsia-500/15 dark:text-fuchsia-300",
+ glyph: (
+ <g fill="currentColor">
+ <circle cx="8" cy="3.2" r="1.8" />
+ <circle cx="12.6" cy="6.6" r="1.8" />
+ <circle cx="10.9" cy="12" r="1.8" />
+ <circle cx="5.1" cy="12" r="1.8" />
+ <circle cx="3.4" cy="6.6" r="1.8" />
+ </g>
+ ),
+ },
+};
+
+export default function FeatureName({ feature, className = "" }: { feature: Feature; className?: string }) {
+ const f = FEATURES[feature];
+ return (
+ <span
+ className={`inline-flex items-center gap-[0.35em] whitespace-nowrap rounded-full py-[0.15em] pl-[0.5em] pr-[0.65em] align-middle font-display font-bold leading-tight tracking-tight ${f.tone} ${className}`}
+ >
+ <svg viewBox="0 0 16 16" className="h-[1em] w-[1em] flex-none" aria-hidden>
+ {f.glyph}
+ </svg>
+ {f.name}
+ </span>
+ );
+}
diff --git a/packages/ui/src/components/Icon.tsx b/packages/ui/src/components/Icon.tsx
index 1ed75e97..778e6be1 100644
--- a/packages/ui/src/components/Icon.tsx
+++ b/packages/ui/src/components/Icon.tsx
@@ -12,6 +12,7 @@ export const ICON_PATHS = {
close: "M6 18L18 6M6 6l12 12",
bell: "M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0",
bolt: "M13 10V3L4 14h7v7l9-11h-7z",
+ sparkles: "M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z",
book: "M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25",
building: "M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4",
"chevron-right": "m8.25 4.5 7.5 7.5-7.5 7.5",
diff --git a/packages/ui/src/components/Message.tsx b/packages/ui/src/components/Message.tsx
index 6990d7a0..a502f78f 100644
--- a/packages/ui/src/components/Message.tsx
+++ b/packages/ui/src/components/Message.tsx
@@ -9,6 +9,7 @@ import BrandMark from "@/components/BrandMark";
import type { AnswerSources } from "@/lib/answerSources";
import type { ActionTaken } from "@/lib/api";
import { isMailboxLink } from "@/lib/replyCards";
+import FeatureName from "@/components/FeatureName";
interface MessageProps {
role: "user" | "assistant";
@@ -93,8 +94,9 @@ function ActionChip({ action }: { action: ActionTaken }) {
href={action.link}
target="_blank"
rel="noopener noreferrer"
- className="hover:opacity-80 transition-opacity"
+ className="inline-flex items-center gap-1.5 hover:opacity-80 transition-opacity"
>
+ <FeatureName feature="act_as_me" className="text-[11px]" />
{inner}
</a>
);
diff --git a/packages/ui/src/components/RepliesWaiting.tsx b/packages/ui/src/components/RepliesWaiting.tsx
index 84267162..94310f87 100644
--- a/packages/ui/src/components/RepliesWaiting.tsx
+++ b/packages/ui/src/components/RepliesWaiting.tsx
@@ -20,7 +20,10 @@ import {
sendLeftNothing,
sendQuestion,
senderLine,
+ senderShort,
+ draftIsLong,
} from "@/lib/replyCards";
+import FeatureName from "@/components/FeatureName";
// Home: the replies the Executive drafted in your own Gmail for mail that
// needs you (Settings → Act as me → Draft replies to my inbox), shown as
@@ -103,6 +106,7 @@ export function ReplyCardItem({
}) {
const [step, setStep] = useState<Step>({ kind: "idle" });
const [error, setError] = useState<string | null>(null);
+ const [fullDraft, setFullDraft] = useState(false);
// Being settled: Gmail didn't confirm a send. The server says so, and the
// section reads the cards again until it's settled.
const unconfirmed = card.status === "executing";
@@ -155,6 +159,10 @@ export function ReplyCardItem({
};
const busy = step.kind === "busy";
+ // A long draft is clamped to keep the card short, but never while you are
+ // confirming Send: what goes out is shown in full.
+ const confirming = step.kind === "ask" || step.kind === "confirm";
+ const clampDraft = draftIsLong(card.draft_body) && !fullDraft && !confirming;
const label = "text-xs font-semibold uppercase tracking-wide text-fg-muted";
return (
<article
@@ -163,16 +171,17 @@ export function ReplyCardItem({
}`}
>
<div className="mb-2 flex items-center gap-2">
- <span className="inline-flex items-center rounded-lg bg-accent/10 px-2 py-0.5 text-[13px] font-medium text-accent">
+ <span className="inline-flex items-center rounded-lg bg-surface-overlay px-2 py-0.5 text-[13px] font-medium text-fg-muted">
{followUp ? "Follow-up waiting" : "Reply waiting"}
</span>
+ <FeatureName feature="act_as_me" className="text-[12px]" />
{received && <span className="text-sm text-fg-subtle tabular-nums">{received}</span>}
</div>
<div className="text-base sm:text-[17px] font-semibold leading-snug text-fg break-words">
{card.subject || "(no subject)"}
</div>
<div className="mt-1 text-sm text-fg-muted break-words">
- {followUp ? `Nobody answered your email to ${who}` : senderLine(card)}
+ {followUp ? `Nobody answered your email to ${who}` : senderShort(card)}
{[relation, card.sender_verified ? "" : "Address not verified"]
.filter(Boolean)
.map((part) => ` · ${part}`)
@@ -181,10 +190,13 @@ export function ReplyCardItem({
{card.they_wrote && (
<details className="mt-3 group">
- <summary className={`cursor-pointer list-none ${label}`}>
- <span className="inline-block transition-transform group-open:rotate-90">▸</span>{" "}
- {followUp ? "You wrote" : "They wrote"}
+ <summary className="flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-xl border border-line px-3 text-sm font-medium text-fg-muted hover:bg-surface-overlay/60">
+ <span aria-hidden="true" className="inline-block transition-transform group-open:rotate-90">▸</span>
+ {followUp ? "What you wrote" : "What they wrote"}
</summary>
+ {!followUp && (
+ <p className="mt-1.5 px-1 text-xs text-fg-subtle break-words">From: {senderLine(card)}</p>
+ )}
{/* Plain text: what a stranger wrote is never rendered as markup. */}
<p className="mt-1.5 max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-xl border border-line bg-surface px-3 py-2 text-sm text-fg-muted">
{card.they_wrote}
@@ -196,7 +208,23 @@ export function ReplyCardItem({
<div className={label}>Your draft</div>
<div className="mt-1.5 rounded-xl border border-line bg-surface px-3 py-2">
<div className="text-xs text-fg-subtle break-words">To: {card.draft_to.join(", ")}</div>
- <p className="mt-1 whitespace-pre-wrap break-words text-sm text-fg">{card.draft_body}</p>
+ <p
+ className={`mt-1 whitespace-pre-wrap break-words text-sm text-fg ${
+ clampDraft ? "line-clamp-4" : ""
+ }`}
+ >
+ {card.draft_body}
+ </p>
+ {draftIsLong(card.draft_body) && !confirming && (
+ <button
+ type="button"
+ onClick={() => setFullDraft((v) => !v)}
+ aria-expanded={fullDraft}
+ className="mt-1 min-h-10 text-sm font-medium text-accent cursor-pointer"
+ >
+ {fullDraft ? "Show less" : "Show full draft"}
+ </button>
+ )}
</div>
</div>
diff --git a/packages/ui/src/components/Switch.tsx b/packages/ui/src/components/Switch.tsx
index 3dfe8c6c..e587a409 100644
--- a/packages/ui/src/components/Switch.tsx
+++ b/packages/ui/src/components/Switch.tsx
@@ -2,6 +2,8 @@
// An on/off switch. The caller labels it with `labelledBy`, the id of the
// text that says what it switches, so a screen reader reads that text.
+// 44 by 24, with a taller invisible tap area (44px) and a solid gray track
+// when off, so Off reads as a choice rather than a missing control.
export default function Switch({
checked,
onChange,
@@ -21,14 +23,14 @@ export default function Switch({
aria-labelledby={labelledBy}
disabled={disabled}
onClick={() => onChange(!checked)}
- className={`relative mt-0.5 inline-flex h-5 w-9 flex-shrink-0 items-center rounded-full transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed ${
- checked ? "bg-indigo-500" : "bg-surface-overlay border border-line"
+ className={`relative inline-flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-colors cursor-pointer before:absolute before:inset-x-0 before:-inset-y-2.5 before:content-[''] disabled:opacity-50 disabled:cursor-not-allowed ${
+ checked ? "bg-indigo-500" : "bg-zinc-300 dark:bg-zinc-600"
}`}
>
<span
aria-hidden="true"
- className={`inline-block h-4 w-4 rounded-full bg-white shadow transition-transform ${
- checked ? "translate-x-4" : "translate-x-0.5"
+ className={`inline-block h-5 w-5 rounded-full bg-white shadow transition-transform ${
+ checked ? "translate-x-[22px]" : "translate-x-0.5"
}`}
/>
</button>
diff --git a/packages/ui/src/components/UserBadge.tsx b/packages/ui/src/components/UserBadge.tsx
index fc135bac..b053305d 100644
--- a/packages/ui/src/components/UserBadge.tsx
+++ b/packages/ui/src/components/UserBadge.tsx
@@ -4,6 +4,7 @@ import { signOut, useSession } from "next-auth/react";
import { GUIDE_NAV_ITEM } from "@/components/shell/navConfig";
import OverflowMenu, { type OverflowItem } from "@/components/ui/OverflowMenu";
+import { initials } from "@/lib/initials";
// The account menu at the foot of the sidebar: help, the Executive's
// pause switch (on Settings → Your Executive) and signing out, kept off
@@ -71,16 +72,12 @@ export default function UserBadge({ variant = "compact" }: UserBadgeProps) {
}
const name = user.name || user.email;
- const initials =
- (user.name || user.email)
- .split(/[\s@]/)[0]
- .slice(0, 2)
- .toUpperCase() || "?";
+ const letters = initials(user.name || user.email);
if (variant === "sidebar") {
return (
<div className="px-3 py-3 border-t border-line flex items-center gap-2.5 flex-shrink-0">
- <Avatar name={initials} image={user.image} size="w-8 h-8" />
+ <Avatar name={letters} image={user.image} size="w-8 h-8" />
<div className="flex-1 min-w-0">
<p className="text-sm font-medium text-fg truncate">{name}</p>
<p className="text-xs text-fg-muted truncate">{user.email}</p>
@@ -101,7 +98,7 @@ export default function UserBadge({ variant = "compact" }: UserBadgeProps) {
// compact (default) — for PageHeader right side
return (
<div className="flex items-center gap-2 text-xs text-fg-muted">
- <Avatar name={initials} image={user.image} size="w-6 h-6" />
+ <Avatar name={letters} image={user.image} size="w-6 h-6" />
<span className="hidden sm:inline truncate max-w-[160px]">{name}</span>
<button
type="button"
diff --git a/packages/ui/src/components/memories/CadenceSection.tsx b/packages/ui/src/components/memories/CadenceSection.tsx
index fa555ac7..bf79fcc4 100644
--- a/packages/ui/src/components/memories/CadenceSection.tsx
+++ b/packages/ui/src/components/memories/CadenceSection.tsx
@@ -23,6 +23,7 @@ import {
metaFor,
showsRhythm,
} from "./shared";
+import FeatureName from "@/components/FeatureName";
// The "how it runs" half of the Pulse page. The rhythm taxonomy (KIND_META /
// metaFor / groupByRhythm) now lives in ./shared so the header stat strip and
@@ -287,13 +288,13 @@ export function RecentActivity() {
<span className="text-xs text-fg-subtle tabular-nums">{relative}</span>
)}
{actingAs(it) && (
- <span
- className={`rounded-full px-2 py-0.5 text-xs font-semibold ${
- it.kind === "sent_as_you" ? "bg-accent/10 text-accent" : "bg-surface-overlay text-fg"
- }`}
- >
- {actingAs(it)}
- </span>
+ <>
+ <FeatureName
+ feature={it.kind === "sent_as_you" ? "handle_it" : "take_the_lead"}
+ className="text-xs"
+ />
+ <span className="text-xs font-semibold text-fg-muted">{actingAs(it)}</span>
+ </>
)}
<span className="text-sm text-fg-muted">{verb}</span>
{!subjectIsSummary && (
diff --git a/packages/ui/src/components/settings/HandleItCard.tsx b/packages/ui/src/components/settings/HandleItCard.tsx
index eafe5080..f5b70364 100644
--- a/packages/ui/src/components/settings/HandleItCard.tsx
+++ b/packages/ui/src/components/settings/HandleItCard.tsx
@@ -23,26 +23,27 @@ import { formatAgo } from "@/lib/setupStatus";
// Handle it for me (PUT /delegation/handle-it) on Settings → Act as me:
// replies the inbox watcher sends from your mailbox on its own. Plain code
// decides each one (delegation/handle_it.py). One dial says how much goes
-// without you: Off, Careful, Balanced, Bold, and for the owner Take the lead
+// without you: Off, Easy ones, People I know, Most mail, and for the owner
+// Everything, which uses Take the lead
// (PUT /delegation/take-the-lead), where links, the topics that always wait and
// the added rules hold a reply back. Anything it won't send waits on Today as
// before. Below the dial, what it sent in the last week (GET /delegation/handled).
export const HANDLE_IT_MODES: { mode: HandleItMode; label: string; replies: string; followUps: string }[] = [
{
mode: "careful",
- label: "Careful",
+ label: "Easy ones",
replies: "Only short replies to people you know, when it's very sure.",
followUps: "Written for you, and they wait on Today for you to send.",
},
{
mode: "balanced",
- label: "Balanced",
+ label: "People I know",
replies: "Replies to people you know. Strangers, links and amounts wait for you.",
followUps: "Sent to your team and contacts when they haven't answered a question of yours in a few days.",
},
{
mode: "bold",
- label: "Bold",
+ label: "Most mail",
replies: "Also strangers and longer replies, and links or amounts when it's very sure.",
followUps: "Sent to anyone you wrote to who hasn't answered a question of yours in a few days.",
},
@@ -90,8 +91,8 @@ type Step = "off" | HandleItMode | "lead";
const OFF_STEP = { label: "Off", text: "Every reply waits for you to tap Send." };
const LEAD_STEP = {
- label: "Take the lead",
- text: "It decides what to send as you. Replies with a link, the topics that always wait and your rules still hold it back.",
+ label: "Everything",
+ text: "Uses Take the lead. It decides what to send as you. Replies with a link, the topics that always wait and your rules still hold it back.",
};
export function HandleItSection({
diff --git a/packages/ui/src/components/settings/SettingsSubpage.tsx b/packages/ui/src/components/settings/SettingsSubpage.tsx
index febf250a..d61aa59a 100644
--- a/packages/ui/src/components/settings/SettingsSubpage.tsx
+++ b/packages/ui/src/components/settings/SettingsSubpage.tsx
@@ -10,7 +10,7 @@ export default function SettingsSubpage({
description,
children,
}: {
- title: string;
+ title: ReactNode;
description?: ReactNode;
children: ReactNode;
}) {
diff --git a/packages/ui/src/components/shell/AppShell.tsx b/packages/ui/src/components/shell/AppShell.tsx
index d677a683..7e9a236b 100644
--- a/packages/ui/src/components/shell/AppShell.tsx
+++ b/packages/ui/src/components/shell/AppShell.tsx
@@ -12,6 +12,7 @@ import AppSidebar from "@/components/shell/AppSidebar";
import {
buildMobilePrimary,
hubForPath,
+ isAdvancedPath,
isDestinationActive,
PROFILE_NAV,
profileWording,
@@ -148,7 +149,7 @@ function TopBar({
// navigable pages, so we render them as plain text to avoid linking
// to a 404. Dynamic segments (slugs/uuids) also render as-is — pages
// own their own H1 with the entity name.
- const crumbs = segments.map((segment, idx) => {
+ const pageCrumbs = segments.map((segment, idx) => {
const linkable = idx === 0;
const href = linkable ? "/" + segment : null;
return {
@@ -156,6 +157,11 @@ function TopBar({
label: idx === 0 && segment === "company-profile" ? profileLabel : labelFor(segment),
};
});
+ // The Advanced pages (Agent Council, Audit log, ...) live at their own
+ // paths but are opened from Settings → Advanced: show that way back.
+ const crumbs: { href: string | null; label: string }[] = isAdvancedPath("/" + segments.join("/"))
+ ? [{ href: "/settings", label: "Settings" }, { href: "/settings/advanced", label: "Advanced" }, ...pageCrumbs]
+ : pageCrumbs;
return (
<header className="h-14 border-b border-line flex items-center justify-between px-4 sm:px-6 flex-shrink-0 gap-3">
@@ -170,14 +176,24 @@ function TopBar({
</button>
<nav aria-label="Breadcrumb" className="flex items-center gap-1.5 min-w-0">
{crumbs.length === 0 ? (
- <span className="text-sm text-fg-muted">Open Executive</span>
+ <span className="font-display text-[15px] font-extrabold tracking-tight text-fg">Open Executive</span>
) : (
crumbs.map((c, i) => {
const isLast = i === crumbs.length - 1;
+ // Phones show only the last two crumbs, so they don't all
+ // truncate to a few letters each.
+ const fromEnd = crumbs.length - i;
return (
- <span key={`${i}-${c.label}`} className="flex items-center gap-1.5 min-w-0">
+ <span
+ key={`${i}-${c.label}`}
+ className={`${fromEnd > 2 ? "hidden sm:flex" : "flex"} items-center gap-1.5 min-w-0`}
+ >
{i > 0 && (
- <Icon name="chevron-right" size="w-3 h-3" className="text-fg-subtle flex-shrink-0" />
+ <Icon
+ name="chevron-right"
+ size="w-3 h-3"
+ className={`text-fg-subtle flex-shrink-0 ${fromEnd === 2 ? "hidden sm:block" : ""}`}
+ />
)}
{!isLast && c.href ? (
<Link
@@ -216,13 +232,12 @@ function AskOEButton() {
onClick={toggle}
title="Ask OE about this page (Ctrl/Cmd + .)"
aria-pressed={open}
- className={`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-colors cursor-pointer ${
- open
- ? "bg-indigo-500/15 text-indigo-200"
- : "text-indigo-300 hover:text-indigo-200 hover:bg-surface-overlay"
+ className={`flex min-h-10 items-center gap-1.5 px-3 rounded-lg text-sm font-semibold text-accent transition-colors cursor-pointer ${
+ open ? "bg-accent/20" : "bg-accent/10 hover:bg-accent/15"
}`}
>
- <Icon name="bolt" size="w-4 h-4" />
+ <Icon name="sparkles" size="w-4 h-4" />
+ <span className="sm:hidden">Ask</span>
<span className="hidden sm:inline">Ask OE</span>
</button>
);
diff --git a/packages/ui/src/components/shell/AppSidebar.tsx b/packages/ui/src/components/shell/AppSidebar.tsx
index 17402e83..2396d05a 100644
--- a/packages/ui/src/components/shell/AppSidebar.tsx
+++ b/packages/ui/src/components/shell/AppSidebar.tsx
@@ -10,6 +10,7 @@ import { useWorkspace } from "@/components/workspace/WorkspaceContext";
import {
buildDestinations,
isDestinationActive,
+ isAdvancedPath,
isNavActive,
NEW_CHAT_DESCRIPTION,
SETTINGS_NAV_ITEM,
@@ -92,7 +93,7 @@ export default function AppSidebar({
<BrandMark size="sm" />
</span>
<span className="min-w-0">
- <span className="block text-[15px] font-semibold truncate">Open Executive</span>
+ <span className="block font-display text-[17px] font-extrabold tracking-tight truncate">Open Executive</span>
{companyName && (
<span className="block text-xs text-fg-muted truncate">{companyName}</span>
)}
@@ -152,7 +153,7 @@ export default function AppSidebar({
label={SETTINGS_NAV_ITEM.label}
icon={SETTINGS_NAV_ITEM.icon}
description={SETTINGS_NAV_ITEM.description}
- active={isNavActive(SETTINGS_NAV_ITEM.href, pathname)}
+ active={isNavActive(SETTINGS_NAV_ITEM.href, pathname) || isAdvancedPath(pathname)}
/>
</div>
diff --git a/packages/ui/src/components/shell/navConfig.ts b/packages/ui/src/components/shell/navConfig.ts
index bb5bcae0..0f41061d 100644
--- a/packages/ui/src/components/shell/navConfig.ts
+++ b/packages/ui/src/components/shell/navConfig.ts
@@ -119,7 +119,7 @@ function companyTabs(isOnboarded: boolean): NavItem[] {
href: "/departments",
label: "Departments",
icon: "grid",
- description: "Org units with goals, an authority level, and a specialist behind each.",
+ description: "Your departments, their goals, how much each may decide on its own, and the expert behind each.",
},
profileItem("company", isOnboarded),
];
@@ -328,7 +328,7 @@ export const ADVANCED_ITEMS: AdvancedItem[] = [
icon: "users",
group: "configure",
description:
- "Configure the agents — models, system prompts, deep-reasoning, and the Executive voice persona.",
+ "Choose how thorough answers are, and change each agent's model, instructions and the Executive's voice.",
},
{
href: "/audit",
@@ -336,7 +336,7 @@ export const ADVANCED_ITEMS: AdvancedItem[] = [
icon: "doc-search",
group: "diagnose",
description:
- "Searchable event log of every chat turn, specialist consult, tool call, and scheduled action.",
+ "A searchable record of everything the Executive did: each chat, each question it passed to an expert, each tool it used and each scheduled job.",
},
{
href: "/audit/usage",
@@ -344,7 +344,7 @@ export const ADVANCED_ITEMS: AdvancedItem[] = [
icon: "activity",
group: "diagnose",
description:
- "Aggregate token usage and cost across all sessions — totals, by day, and by model.",
+ "What the AI has cost: the total, each day, and for each model.",
},
{
href: "/guide",
@@ -367,7 +367,7 @@ export const ADVANCED_ITEMS: AdvancedItem[] = [
icon: "cog",
group: "configure",
description:
- "Load prebuilt company fixtures, snapshot your current data, or generate a new scenario with AI.",
+ "Load a ready-made demo company, save a copy of your current data, or have AI make up a new one.",
},
{
href: "/clients",
@@ -375,7 +375,7 @@ export const ADVANCED_ITEMS: AdvancedItem[] = [
icon: "building",
group: "configure",
description:
- "Multi-client mode for fractional work — switch the live company between named client slots.",
+ "For fractional work: switch between the companies you work for.",
},
];
@@ -496,6 +496,13 @@ export function buildMobilePrimary(opts: BuildOpts = {}): Destination[] {
// Is `href` the active destination for `pathname`? Active on an exact match
// or anywhere below it (`/jobs` is active on `/jobs/runs/42`).
+/** Whether a page is one of the Advanced items (Agent Council, Audit log,
+ * ...): they live at their own top-level paths but are opened from Settings →
+ * Advanced, so the top bar and sidebar place them under Settings. */
+export function isAdvancedPath(pathname: string): boolean {
+ return ADVANCED_ITEMS.some((item) => isNavActive(item.href, pathname));
+}
+
export function isNavActive(href: string, pathname: string): boolean {
if (href === "/") return pathname === "/";
return pathname === href || pathname.startsWith(`${href}/`);
diff --git a/packages/ui/src/lib/briefingSummary.ts b/packages/ui/src/lib/briefingSummary.ts
index dbb9b091..210d45af 100644
--- a/packages/ui/src/lib/briefingSummary.ts
+++ b/packages/ui/src/lib/briefingSummary.ts
@@ -72,7 +72,7 @@ export function briefingSummary(c: SummaryCounts): SummaryPart[] {
target: { kind: "href", href: "/goals" },
});
if (c.inFlight > 0)
- parts.push({ text: `${c.inFlight} in flight`, target: { kind: "panel", panel: "inFlight" } });
+ parts.push({ text: `${c.inFlight} under way`, target: { kind: "panel", panel: "inFlight" } });
if (c.monitoring > 0)
parts.push({
text: `${c.monitoring} ${plural(c.monitoring, "signal", "signals")} monitored`,
diff --git a/packages/ui/src/lib/initials.ts b/packages/ui/src/lib/initials.ts
new file mode 100644
index 00000000..a77c6097
--- /dev/null
+++ b/packages/ui/src/lib/initials.ts
@@ -0,0 +1,14 @@
+// The letters on someone's avatar: first and last name's first letters
+// ("Jordan Avery" → "JA"); a single name's first two ("Jordan" → "JO"). With
+// only an email, its local part is split on dots, dashes and underscores the
+// same way ("jordan.avery@x" → "JA"). No imports, so `npm test` can load it.
+
+export function initials(nameOrEmail: string): string {
+ const raw = nameOrEmail.trim();
+ const base = raw.includes("@") && !/\s/.test(raw) ? raw.split("@")[0].replace(/[._-]+/g, " ") : raw;
+ const words = base.split(/\s+/).filter((w) => /\p{L}|\p{N}/u.test(w));
+ if (words.length === 0) return "?";
+ const first = (w: string) => Array.from(w.replace(/^[^\p{L}\p{N}]+/u, ""))[0] ?? "";
+ const out = words.length === 1 ? Array.from(words[0]).slice(0, 2).join("") : first(words[0]) + first(words[words.length - 1]);
+ return out.toUpperCase() || "?";
+}
diff --git a/packages/ui/src/lib/replyCards.ts b/packages/ui/src/lib/replyCards.ts
index f53ea907..52c1e6ed 100644
--- a/packages/ui/src/lib/replyCards.ts
+++ b/packages/ui/src/lib/replyCards.ts
@@ -48,6 +48,23 @@ export function senderLine(card: { from_name: string; from_email: string }): str
return name ? `${name} <${card.from_email}>` : card.from_email;
}
+/** The sender as the card's short line shows it: the name with the address's
+ * domain ("Dana Park · @x.example"), so the line fits a phone while the part a
+ * lookalike would change stays in sight. A display name is the sender's own
+ * text, so the domain is never dropped; without a confirmed sender (or a name)
+ * the full address shows. */
+export function senderShort(card: { from_name: string; from_email: string; sender_verified?: boolean }): string {
+ const name = card.from_name.trim();
+ const at = card.from_email.lastIndexOf("@");
+ if (!name || card.sender_verified !== true || at < 0) return senderLine(card);
+ return `${name} · @${card.from_email.slice(at + 1)}`;
+}
+
+/** Whether a draft is long enough to show clamped, with a Show full draft toggle. */
+export function draftIsLong(body: string): boolean {
+ return body.length > 280 || body.split("\n").length > 5;
+}
+
// Where a draft in someone's own mailbox opens: Gmail, or Outlook on the web
// (work or school, and personal). Must match delegation.gmail's link builders.
export const MAILBOX_LINK_PREFIXES = [
diff --git a/packages/ui/tailwind.config.ts b/packages/ui/tailwind.config.ts
index 85807aa0..43280d98 100644
--- a/packages/ui/tailwind.config.ts
+++ b/packages/ui/tailwind.config.ts
@@ -44,6 +44,7 @@ const config: Config = {
},
fontFamily: {
sans: ["var(--font-sans)", "system-ui", "-apple-system", "Segoe UI", "sans-serif"],
+ display: ["var(--font-display)", "var(--font-sans)", "system-ui", "sans-serif"],
},
minHeight: {
touch: "2.5rem",