AI-powered virtual executive team — a single coherent executive persona backed by 8 specialist agents (FastAPI + Next.js).
feat(onboarding): open the first hour on a question and the first week's brief (#476)
Rufus6a232ec1f4eb
diff --git a/packages/core/openexecutive/architecture/architecture-facts.yaml b/packages/core/openexecutive/architecture/architecture-facts.yamlindex a3769dd7..a8c982ff 100644--- a/packages/core/openexecutive/architecture/architecture-facts.yaml+++ b/packages/core/openexecutive/architecture/architecture-facts.yaml@@ -2773,7 +2773,9 @@ memory:their state enter the fingerprint.- The first week (briefing.first_week, seven days from the principal'sPeople row) gives the briefs a GETTING STARTED block so a new install- is never "quiet": onboarding goals, departments with no+ is never "quiet": goal rows or, while there are none (setup saves+ no goal rows), the profile's strategic_priorities and north star,+ departments with nohead_person_id and, only on PRINCIPAL_DELIVERY with Act as me and Draft replies to my inbox on (the watcher's consent) and gmail_status connected, upto five people who wrote to the owner's own mailbox in 48 hours assender and subject (no message text, bulk mail skipped). Countsdiff --git a/packages/core/openexecutive/architecture/prebuilt/today.json b/packages/core/openexecutive/architecture/prebuilt/today.jsonindex aa827d4e..d99d6e69 100644--- a/packages/core/openexecutive/architecture/prebuilt/today.json+++ b/packages/core/openexecutive/architecture/prebuilt/today.json@@ -1,7 +1,7 @@{"section_id": "today","title": "Today / Morning Brief",- "markdown": "`openexecutive.api.routes.today` serves the morning brief — a one-screen, read-only view of what is happening across the org. It is the default landing surface (the Next.js root renders `<Briefing>`). Every signed-in page shares one sidebar (`AppSidebar`). Its Recent list is capped at the 7 newest web chats. The full history, including Slack, Telegram and Discord conversations (recognised by their session-id prefix), lives on `/chats`. A chat opens from any page through `/?session=<id>`.\n\n`GET /today` returns `TodayResponse` assembled by `_build_today()`, which is synchronous and caller-agnostic:\n\n- **`departments`** — per-department goal health, rolling up each department's goal counts (`total`, `at_risk`, `off_track`) plus its awaiting-workflow count, and `attention_goals`: the actual off-track/at-risk goals (worst first, capped at 3) with `key_result`, `current`, `target`, and `status`, so the briefing's Department card shows *which* goal is off and how far without a click. Empty for healthy/inactive departments.\n- **Private cards.** An alert tagged `private:principal` (`alerts.models.PRIVATE_ALERT_TAG` — raised on a turn about mail from one of the principal's contacts or mail they forwarded, or a meeting proposal with a contact) is in `proposals` only when the caller is the principal. `_build_today` leaves it out by default, so the end-of-day digest, the reflection and Discord's `/today` never see it, and the morning brief reads it only on a run for the principal (the scheduler's, or the principal's own verified chat turn in a conversation only they can read — see Workflows). The narrative is written from one only in the principal's own `principal` scope, which nobody else is served; the shared `company` scope an unresolved caller gets, and a teammate's scope, never are. The activity rail skips it, and the chat digest includes it only on the principal's own verified turn.\n- **Roster-request cards.** When someone not on the People list writes in (see Org and Integrations), `people.roster_requests.surface_card` raises an alert of source `roster_request` (medium, tagged `roster_request:<id>` and `private:principal`, routed to the principal), so it follows every private-card rule above. `GET /today` attaches `roster_request` to that proposal (`_roster_request_card`: channel, address or account id, the sender's sanitised and unverified name, profile email, company-domain flag, suggested kind and person, message count, whether they were acknowledged, first seen, and the held messages' first lines) while the request is still pending. The Briefing renders it as its own card (`RosterRequestCard`: add as a new person with a name and an explicit team/contact choice — pre-filled as team on a company domain — or \"someone already on the list\", with a replace-account option for a chat id, or Ignore), which calls `/people/requests/{id}` directly and never hands off to chat, so what a stranger wrote never seeds a turn. The card is kept out of everything that could close it without answering it or put the stranger's words in front of a model: the narrative (`_action_proposals` drops it), the chat's open-alert digest (`<briefing>` — the principal's verified turn gets a separate `<roster_requests>` block instead; see Agents), `ack_alert`, a single ack (`POST /alerts/{id}/ack` is a 409), the \"Dismiss N older than 7 days\" count and the server's bulk ack, reopen, the TTL sweep and the alert review (`roster_request` is in `lifecycle.TTL_EXEMPT_SOURCES`). It ends when the request does: answered (`ack`, or `dismissed` on a decline) or expired after `ROSTER_REQUEST_TTL_DAYS`.\n- **`people`** — an attention-ranked roster of the **team** (the principal's contacts are never listed, and get no insight note). Each person carries `awaiting_action` count, soonest SLA, a `status` (`on_leave` / `needs_reply` / `awaiting` / `clear`), reachability, `overdue`, a server `priority` sort key, and a cached one-line `insight`. Sorted by `(-priority, full_name)`. Stale insight notes are regenerated in the background only when the roster has more than one person: the UI shows the People sidebar only for more than one, so a one-person install (solo, or a team before anyone else is added) does not pay a daily model and peer-memory call for a note nobody sees. Cached notes are still served.\n- **`proposals`** — the *live* unread alerts (workflow approvals, triage-classified inbound, Executive signals, flagged artifacts, and gated calendar bookings; an artifact is listed only to its owner (`alerts.models.visible_alert`; every other build of the board — the briefs, the reflection, the review, the chat digest on anyone else's turn, the activity rail — leaves drafted artifacts out) and carries `artifact_format` / `artifact_url` and a `body` already rendered to Markdown for its format, so the card badges it as a web page, Word doc, spreadsheet or link and offers *Open artifact*): unread, inside their category TTL, not snoozed — see *Alert lifecycle* below. Each carries `score`, `category` (`action` vs `monitoring`), `surfaced_reason` from `openexecutive.briefing.ranking`, the lifecycle fields (`occurrence_count`, `last_seen_at`, `last_reviewed_at`, `review_verdict`, `review_note`, `recommended_move`, `why_now`, `due_at`, `superseded_count`, `suggested_workflow`), and `decision_instance_id` (set only when the proposal is backed by a decision-ledger row — a calendar booking awaiting approval). `failed_run_id` is set only on a `workflow_failed` card (a scheduled run that ended in error, see Scheduler): its main button is **Run again** (`POST /workflows/runs/{id}/rerun`, which also closes the card) and its ⋯ opens the run; it has no Approve. The response also carries `held_back` for the principal alone: the lines grounding left out of the morning brief or end-of-day digest in the last day, which Home lists under **Left out of your brief** (the brief's note names it; Hide is remembered in that browser). The UI splits them into 'mine' vs 'across the team' using `caller_person_id`. Approve is carried out on the server for every card. For decision-backed proposals the card's Approve/Reject call the `/decisions` endpoints (which book or cancel the event server-side and clear the alert), so meeting bookings are reviewed in the briefing itself rather than on a separate page. Every other proposal is approved at `POST /alerts/{id}/approve` (`alerts.approvals`): it records who approved the card and when (an `alert_approvals` row plus `alert_approved`, then `alert_approval_done` / `alert_approval_failed`, audit rows), claims the card in one transaction so a double click or a second approver gets a 409 and the work runs once, then does the work. A card the scheduler filed for a department-gated action is bound to it server-side (`alert_held_actions`, written only as the card is filed, never read from the card's tags or text, which a model reading inbound mail can write), and approving it queues that exact action again with no department, the approval being the consent the gate waited for. Any other proposal runs one Executive turn as the approver in a new chat on the server (`chat.start_background_turn`, the machinery behind `POST /chat/background`), with the edited text verbatim for Edit & approve; it keeps going if the page closes. Only the card's routed person or the principal may approve a routed card, and only the principal an unrouted one (403 otherwise); the card's text reaches the turn as quoted data, not instructions. A row at the top of Needs you follows the approval (`GET /alerts/approvals/{id}`): working on it with a link to the chat, then done, or didn't work with Try again; a card whose last approval failed can be approved again, and one still running at a restart is marked failed on boot. The page no longer acks the card and seeds a chat turn with the proposal, which left no record of the approval and did nothing if the tab closed first.\n- **`narrative`** — a per-viewer Executive-voice header (\"What's going on\") synthesized by `synthesize_briefing_narrative`, cached per scope in `briefing_narrative`: the resolved principal gets the whole-company `principal` scope (which may carry what is private to them), a caller who resolves to no roster row the shared `company` scope (written from what everyone may see), and each teammate a role-scoped `person:<id>` one. `narrative_generated_at` says when the served text was written and `narrative_stale` whether a fresher one is being written now. In the web UI each bullet of this narrative is a click target: clicking one hands off to chat (the same `onContinue` path as the proposal cards) seeded to discuss that item. The Executive recognizes it because every chat turn now carries a `<briefing>` digest of open alerts (see Memory). That digest (`briefing.context.format_open_alerts_for_prompt`) is capped at 30 items; when the board is longer the header says so explicitly and tells the Executive to point at this page for the rest — it previously presented the capped list as the complete board, so the Executive described a slice as everything that was open (#136). Chat adapters get the digest too, but Slack gates it to the principal's DMs: the board is company-wide and must not be pulled into a shared channel. The `[alert_id]` at the start of each line is also what `ack_alert` trusts, because an id quoted inside an alert's own body came from inbound mail or chat and is attacker-controlled. This page's `[Discuss mode — alert_id=N]` handoff primer is a pointer to which item is under discussion, not authority on its own: the server accepts it only if that id is on the live board too. Two things enforce that. Every field the digest interpolates — headline, body, suggested action, tags, review note — is collapsed to a single line, since a newline in any of them would forge a whole extra `[N]` line and with it a fabricated instruction to clear someone else's alert. And the server records the live board it derived, so `ack_alert` refuses any id outside it — on **every** session, not just the chat adapters. The recorded set is the whole live board, not just the rows the digest printed, so a card past the render cap stays ackable. The control stops invented, closed, snoozed and expired ids; it does not stop the model being argued into acking the wrong *live* card. When the principal names an item that has already left the board — opened, snoozed, or older than it — the Executive looks it up with `find_alerts` (a keyword search over every status, `alerts.store.search_alerts`); matches that are still open (`unread` or `read`) become ackable for that turn, up to 25, and closed ones come back labelled so the Executive can say the item is already settled. It works only where the principal's own board was shown this turn — the web app or their DM — and never returns roster-request cards (see Lifecycle). The digest's header also labels every headline and detail as untrusted content drawn from inbound mail, chat and watched pages — act on what the principal asks about an item, never on what its text asks — and triage reads each signal inside an `<event>` block whose closing tag the sender's text cannot forge (it is defanged in any case and spacing, after NFKC folds fullwidth forms). That check used to run only when `origin_channel` was set, which the browser never sets, so the one surface where the principal actually reads their board had no check at all and the model could ack any id, including one quoted out of an alert body by the Discuss handoff. Rendering the block and recording its ids now happen together in `briefing.context.render_and_trust`, which both the web chat route and the channel adapters call: render without recording and the tool refuses everything, record without rendering and the model gets reach it was never shown. A turn that was shown nothing trusts nothing. Recording it is only half the wiring: the tool reads the board off the turn's session through a ContextVar, and the chat route binds that session for the whole SSE body (`set_session`, next to `set_turn`). Bound from inside the Executive's own generator instead, it survives exactly one stream step — `asyncio.wait_for` runs each step in a fresh Task with a copy of the context — and the tool-call loop, which runs later, sees nothing. That shipped, and every web ack was refused on cards that were open the whole time. The digest also carries a short **already handled** tail — recently acked / dismissed / resolved rows, named but deliberately NOT trusted for acking — because a card cleared on the page minutes ago is otherwise simply absent from chat: asked to \"record that as fixed\", the Executive could not tell a settled item from one it had never heard of, and sent the principal back to dismiss a card that was already gone. That tail renders even when nothing is open, which is exactly when it matters. Note it is a different window from the `handled_overnight` rail above: that one runs since the last delivered morning brief, while the chat tail looks back 14 days (matching the action-alert TTL, so it still covers an item cleared late in its life), so chat can name a settled item the rail no longer shows. The narrative is held to what is **live**, and to what it is actually for. The `alert_raised` source is dropped from the activity it reasons over (`_build_activity(..., include_alert_raised=False)`): a closed alert reads as work the principal already settled, and a *live* one is worse than redundant — `lifecycle.is_live` is the very predicate behind `list_live_alerts`, so every live raise is already a proposal card below the header, which the prompt forbids re-listing. The `/today/activity` rail keeps the whole source, because a raise really happened. The activity block is only labelled \"since last brief\" when the caller bounded it with `since` (the standalone briefs do; the header does not), since calling an unbounded history rail a delta made the header present weeks-old rows as overnight news. When the viewer's slice holds nothing that wants a decision — no action proposal, no at-risk/off-track department, nobody awaiting — the regen skips the model call entirely and writes the fixed quiet line (`Quiet right now — nothing pressing.`, or `… nothing needs you.` for a teammate). **The cache key is a hash of the rendered context itself** (`today._narrative_context` builds it once and both the hot path and the background task key off that one string, which is also handed to the model verbatim). That makes the key a function of the model's input: everything the prompt renders is covered, and nothing it omits can trigger a regeneration. Keying on hand-picked fields broke one half or the other each time — headlines alone left the rendered activity block uncovered, while the proposals' review fields are never rendered by this header yet are rewritten with fresh prose by every `alerts.review` pass, so they regenerated each viewer's narrative several times a day to re-synthesize identical input. A quiet board keys off a fixed sentinel instead, so a moving rail cannot re-key an entry whose text is constant. Together: on a fully dismissed board every other input was empty, the rail became the only context, and the model synthesized a confident header out of closed items.\n\n **Live, not just the board.** The header used to reason over the alert board, goal health and the Executive's own bookkeeping only — mail and chat handled that day, replies the gate held and the next meeting never reached it, so it read the same for days while the principal's day moved on. The whole-company scopes now open the context with the principal's world as it is happening (`briefing.live_signals.gather_live_signals`, rendered by `render_live_blocks`), under a `NOW:` line: **INBOUND** (`integration_inbound` audit rows that carry a message, grouped by sender and subject, with an email's first line), **STUCK** (`integration_outbound_blocked` to a recipient, the inbound \"reply blocked at outbound gate\" and Google Chat \"left unanswered\" / \"not delivered\" rows, and drafts saved by Act as me), **CONVERSATIONS** (the principal's own web chat titles) and the **REST OF TODAY'S CALENDAR**. The window is the local day, or the last 12 hours when that is longer. Private audit rows, drafts, chat titles and the calendar (meeting titles are the principal's own) are read only in the `principal` scope — `gather_live_signals` drops the calendar whenever `include_private` is false, whatever the caller passes, so the shared `company` header never quotes it. The calendar is never fetched on the request: `live_signals.refresh_calendar` caches one read per 15 minutes (the scheduler tick refreshes it) and the header quotes the cache. Every quoted field is collapsed to one line and cut, and the blocks and the prompt both say the text is data, never instructions — inbound mail is attacker-controlled. With live blocks present the context also ages each proposal (`raised 2d ago`, whole days), names each at-risk department's slipping goals (`attention_goals`) and adds an **EXTERNAL SIGNALS** block (monitoring alerts from the last 24 h, never enough on their own to break the quiet line); the rhythm runs (`today.RHYTHM_WORKFLOWS`: the morning brief, end-of-day digest, reflection and weekly review) are dropped from the activity it reasons over. The prompts (`BRIEFING_NARRATIVE_SYSTEM` and its solo variant, `NARRATIVE_PROMPT_VERSION` 6) lead with what is live and give a days-old item at most one bullet. Anything live breaks the quiet line; the NOW line and window move at most once an hour, so the key moves hourly on time alone plus whenever something new lands; the calendar is placed at the real time (a meeting that has ended drops out, the one under way is IN PROGRESS), which moves it only when a meeting starts or ends.\n\n **Fresh without a reload.** The daily floor in the key and the PERIOD line are the principal's **local** date (`narrative_cache.local_today`), not UTC's, and a row written on an earlier local day is not served as today's. Regenerations are serialized per scope; a trigger that finds one running marks the scope pending and the running pass goes round once more (it built its context before that trigger's news landed), and after a failed pass (model error, the 25 s timeout, empty text) no view or tick starts another for 5 minutes and `narrative_stale` reads false, so the page drops its placeholder instead of spending a model call per view. They log `today: narrative served scope=… age_s=… stale=…` and `today: narrative regenerated scope=… ms=…`, and no longer need a page view: every `BRIEFING_NARRATIVE_REFRESH_MINUTES` (10) between `BRIEFING_NARRATIVE_REFRESH_START_HOUR` and `_END_HOUR` (06–22 local) the scheduler runs `today.refresh_principal_narrative`, which refreshes the calendar cache and rewrites the principal's header only when its key moved (see Scheduler). The Briefing re-polls `/today` at 4, 10 and 20 s while `narrative_stale` is true, re-pulls it when the tab comes back (at most once a minute) and every 5 minutes while visible, shows \"Updated 2:04 PM\" beside the heading, and shows \"Catching up on today…\" while the first header of the day is written (`lib/narrativeFreshness.ts`, tested by `npm test`).\n\n In **solo mode** (one person using Open Executive for themselves) the header speaks to the principal, whatever their role: a solo prompt over a context that lists goals at risk by *area* and has no \"people waiting on you\" block, and the quiet check ignores who is awaiting. The cache key carries the mode for solo only, so solo and team never share a cached narrative while every team key stays exactly what it was — no team cache is invalidated. The response shape does not change. For the principal's own view the solo context also carries a **DUE THIS WEEK** block — the principal's open loops that are overdue or due within 7 days (`today._with_due_soon` → `open_loops.principal_due_soon`, labelled OVERDUE / due today / due <weekday>) — which counts as needing attention in the quiet check and moves the cache key when an item is added, closed or falls due; a teammate's scoped view and team mode never get it. The header never gets the morning brief's *top three today* block — that is the DM brief's (see Workflows); the page shows the same top three in a card of its own (see *Solo focus cards* below). It does get the rest of today's calendar through the live blocks above, from the cached read.\n- **`in_flight`** / **`awaiting`** — upcoming Executive commitments and people we are waiting on.\n- **`handled_overnight`** — the autonomous moves the Executive *completed* since the last delivered morning brief: the alert review's (routed, nudged, escalated, drafted, merged, closed) plus the research watch policy's (`watching` — a watch added on its own because it was grounded in company data; `stopped_watching` — a research watch auto-disabled as noisy or dead; no alert id, re-enable from `/watchlist`). A `changed` verdict (the review rewrote an open alert's headline / body / severity) is deliberately **not** here: the alert is still open in \"Needs you\" and its card carries the note, so the brief reports it under \"what changed\" (a REWRITTEN block) rather than as done. Each row is structured, not just a sentence: `kind`, the audit `summary` (nudge bookkeeping marker stripped), `at`, `alert_id`, `event_type` (for a pre-filtered `/audit` deep link), `headline` (the alert's headline at move time; a watch's slug), `target` (person name for routed / nudged, survivor headline for merged, new severity for escalated, draft title, workflow name), `detail` (the cited evidence or the watch policy's reason), `outcome` (`resolved` | `dismissed` for a close, `proposed` for a route that went through the authority gate), `evidence_ref` (S1 / R2 / A3), `superseded_by_alert_id`, and `status` — the alert's lifecycle state **now** (`open` = live in the queue per `lifecycle.is_live` | `resolved` | `dismissed` | `expired` | `merged` | `acked` | `inactive` for snoozed / past-TTL rows), looked up per row so a close the principal already undid renders as reopened instead of offering a second Undo, and a \"still open\" jump link only appears when there is a card to land on. Audit rows private to the principal (say, one naming their contact) are in this list only on the principal's own `/today`: `brief_state.handled_since` leaves them out unless asked, and the written briefs never ask, since a brief can be read by others. The Pulse heatmap's per-day counts (`GET /today/activity/daily`) likewise leave out a private decision or private alert, as the activity rail does. The morning brief also carries a one-line count of research watch suggestions waiting on `/watchlist`.\n\n**Standing facts.** `render_briefing_context` appends the standing facts (`memory.facts`: corrections kept from chat, a teammate's marked `(per <name>)`) as its last block, after the quiet-day check, so a fact never makes a quiet day look busy. The morning brief also carries **TEAMMATE CORRECTIONS SINCE LAST BRIEF** (`facts.render_teammate_changes(since)`: each teammate fact recorded in the window that is in use now, plus — only when the brief is the principal's own private one (`_private_ok`), which then keeps the run out of the shared history — those waiting for their approval, since other teammates may run the brief and never see a proposal that is not theirs) before the quiet check — it is news, the principal's only FYI of it — and in the brief's fingerprint (`build_brief_fingerprint(teammate_changes=)`), so a correction alone un-suppresses an otherwise unchanged brief. Every other caller passes none, so its context is unchanged. The /today header hashes that rendered string as its cache key, so a new or retired fact marks the header stale and it is rewritten with the correction. The morning brief (standalone) and the teammate-scoped header get the same block. On the scheduler's delivery to the owner alone, with their Always in the loop switch on, `render_briefing_context(owner_notes=)` also carries FROM YOUR NOTES — DUE SOON (their own notes of what they promised or asked, overdue to a week ahead; `memory.history_brief`), which counts against a quiet day, enters the fingerprint and marks the run private; both standalone prompts turn it into a **From your notes** section. The /today header never gets it. **The first week.** For seven days from the principal's People row (`briefing.first_week`), `render_briefing_context(getting_started=)` carries a GETTING STARTED block right after the live blocks: the goals saved at onboarding (department, key result, target, period), departments with no `head_person_id`, and, on the scheduler's delivery to the principal alone with Act as me and Draft replies to my inbox both on and the mailbox connected (the inbox watcher's consent), up to five people who wrote to their own mailbox in the last 48 hours as sender and subject only (`inbox_message_ids` + headers of `get_message`, bulk and automated mail skipped; the same \"where, never what\" rule as `delegation.mail_reads`) and, with Act as me and Read my calendar on, up to eight of today's events on their own calendar as time and title (declined ones left out). It counts against a quiet day, enters the fingerprint (`getting_started=` keys, no dates; a meeting's key is its event id) and, with the inbox or calendar part, marks the run private. Both standalone prompts open with a **Getting started** section and take the Top call from it (`GETTING_STARTED_RULE`); the whole-company /today header gets the block without the inbox (`getting_started_shared`, synchronous, no mailbox read) and the header prompts take the bottom line and move from it (`GETTING_STARTED_HEADER_RULE`), so a new install's header is not short-circuited to the quiet line. `GET /today` sets `first_week`, and the Briefing hides the \"Quiet day\" banner while it is true. A teammate's scoped header never gets it. The alert review's `render_batch` puts the same block ahead of the alerts (read once per pass), so a note, rewrite or routed DM never repeats a figure the principal already corrected.\n\n**When a brief isn't sent.** Above the Briefing, the owner sees a one-line notice when their latest morning brief, end-of-day digest or (in solo mode) weekly review wasn't sent — \"Your morning brief wasn't sent: nothing is set up to send it to you\" — with the day, what fixes it, a link to read the brief on the Artifacts page (left out when the brief couldn't be written at all) and one to Setup status. It comes from `GET /today/brief-delivery` (the scheduler records each run's outcome), shows nothing while briefs go out or while the scheduler is off, and clears once the cause is fixed. When the Executive's mail connection wasn't running (the MCP gateway failed to start and is retrying), the notice says that instead of blaming the owner's setup; a send that failed on every channel names what each channel answered, from the recorded `detail`, with addresses left out. Teammates never see it.\n\n**Replies waiting.** With Act as me's **Draft replies to my inbox** on, the top of the Briefing's left column lists the replies the Executive drafted in the owner's own Gmail for mail that needs them (`RepliesWaiting`, from `GET /delegation/replies` — see Act as Me). They belong to the owner alone: the route answers only the person who can have Act as me, the decisions behind the cards (`delegation_reply`) are principal-only and carry `private: true`, so `/today/activity` and the heatmap leave them out, and none is ever an alert, so nothing of them reaches `GET /today`, the header or the briefs. Each card shows who wrote and who they are to the owner, whether their address was verified, the subject, what they wrote (as plain text), the draft, **Decide before sending** (its open questions) and its warnings, with **Send**, **Edit in Gmail** (the thread in their Gmail) and **Dismiss** (which deletes the draft unless they edited it). **Send** asks first, naming who the reply goes to, then sends the draft exactly as it is in Gmail (`POST /decisions/{id}/approve`); when its recipients changed in Gmail or a newer message arrived, the backend's 409 `confirm` becomes a second question naming them. The card hides itself when nothing is waiting.\n\n**Solo focus cards.** `GET /today/top-three` and `GET /today/weekly-review` feed two solo-only cards, so a principal who only uses the web app — no chat app, no Google Workspace — sees today's top three and the weekly review instead of finding them only in the Workflows run history. Both answer only in solo mode (`effective_workspace_mode`) and only to the principal, by the stricter rule for starting a principal-only run (`workflows._caller_is_the_principal`: the caller's own email on a principal entry that is not archived, or no `x-caller-email` at all — never \"nobody is principal yet\"); a teammate, any other signed-in caller and team mode get null. `top-three` hands `open_loops.principal_due_soon()` to `briefing.top_three.build_top_three` — the morning brief's own inputs and code, so the items, their order and their free slots are the brief's — and returns `{items: [{key, kind, text, why, slot}]}`: `slot` is the free block (\"10:00–11:00\", the user's zone), \"\" when none is left, or null when no calendar was read (none connected, a failure or the 4 s timeout, a weekend); `items` is empty when there is nothing to pick. It is a route of its own, never part of `GET /today`, so the Briefing never waits on the calendar. `weekly-review` returns the latest `weekly_review` run with status `done` (`persistence.list_runs(..., status=\"done\", limit=1)`, newest `updated_at` first; failed and running runs never count) as `{run_id, completed_at, period, top_three, excerpt}`: `weekly_review.summarize_review` reads the artifact's title line and its last *Next week's top 3* section back as plain text, and `excerpt` stands in when that list is empty (the section's own note, else the review's first lines). Null when no review has completed or the run store cannot be read.\n\nThe route resolves the caller from `x-caller-email`, serves the viewer's cached narrative and, when its key moved, rewrites it in a `BackgroundTask` so the request never blocks on an LLM call (the page re-polls while `narrative_stale` is true). `GET /today/activity` returns the recent self-initiated action rail — merged from fired scheduled actions (DMs, follow-ups, nudges, cadences), logged decisions, saved advice, completed workflow runs (briefings/check-ins/research), kicked-off initiatives, resolved gated decisions, and raised alerts, so it reflects all of the Executive's activity rather than just dispatched messages. The Pulse page (`/memories`) polls it (limit 100) every ~20s so new events stream into the 'Recent activity' card, which scrolls internally at a fixed height instead of growing the page. The `morning_brief` workflow calls `_build_today()` directly to build the standalone DM (via a different, enumerated prompt; solo mode has its own, with goals at risk by area and no waiting-on section). `GET /morning-brief` is a deprecated alias.\n\n**Solo mode in the UI.** The response is the same in both modes; the briefing reads the workspace mode from the app-wide `WorkspaceProvider` (which reads team while loading or on error, so a team install never flashes solo) and, in solo, drops the team surfaces: the Departments card, the People card, the \"Across the team\" lane (every action proposal is the one user's, so all of them land in \"Needs you\"), the people-awaiting, people-overdue and departments-at-risk status pills, and the quiet-day \"Set up a check-in\" link. A \"N goals at risk\" pill (at-risk plus off-track goals, from `departments`) links to `/goals` instead, so the strip never reads \"All clear\" over a goal that is slipping. In the Departments card's place, **Your projects** lists the initiatives with status `active` (`GET /memories/initiatives`): **Done** marks one `completed` through `PATCH /memories/initiatives/{id}` (only `completed` takes an initiative out of the Executive's active context), and **Drop** deletes it through `DELETE /memories/initiatives/{id}` after a confirm. Under **Needs you**, a **Due soon** card lists the principal's open loops that are overdue or due within 7 days — their dated commitments and what others asked of them — read from `GET /people/{id}/open-loops` for the principal (the oldest principal in `people`, the backend's rule), labelled by `lib/dueSoon.ts` (tested by `npm test`: \"Overdue since Sep 23\" / \"Due today\" / \"Due Mon, Sep 28\", with a count of anything due later); **Done** closes one through `POST /open-loops/{id}/close`, which also stops the nudge engine chasing it. Above it, **Top three today** numbers the morning brief's three (`GET /today/top-three`) with each one's reason and, when a calendar was read, its free slot (or \"No free time left today\"); at the top of the right-hand column, **This week's review** (`GET /today/weekly-review`) shows the period, when it ran, next week's top three (or the excerpt) and a *Read the review* link to its run page (`/jobs/runs/{id}`). Each card fetches on its own once the Briefing has loaded, so a slow calendar never holds the page up, and renders nothing when the API returns null or an empty list. A commitment in the top three reads as the owner's own (\"Send the proposal\") through `lib/dueSoon.ts`'s `loopText`, as in Due soon; the cards' wording lives in `lib/rhythmCards.ts` (tested by `npm test`). The Pulse page hides its \"Department check-ins\" and \"Awaiting people\" blocks in solo, and its header shows active projects in place of the department check-in count. Team rendering is unchanged.\n\n**Your month (`GET /today/value`).** The owner's own tally of what the Executive did for them, `briefing.value_summary.summarize(period, offset)`: the calendar `month` or `week` (Monday first) in the user's zone, `offset` periods back (0–24), each line beside the period before. Every number is a `COUNT(*)` of rows that prove it happened, never a model's: messages sent for the owner (the DM handlers' own `kind=outbound` sent rows to anyone but the owner, plus Gmail / Outlook send-tool calls that didn't come back with an error, so mail sent from a chat turn counts), replies drafted and sent from the owner's inbox (their Act as me rows), meetings booked (calendar create calls), briefs delivered (the scheduler's `delivered` row), reports (finished team workflow runs, minus the daily rhythm runs and any run a teammate started for themselves, which stays theirs alone; the latest ten listed with links), follow-ups and nudges sent, tasks tracked and closed as done, proposals decided, alerts flagged and requests answered (`chat_turn` out rows). No \"hours saved\" and no cost line: nothing recorded supports the first, and cost next to what the owner got reads as a bill; it has `GET /audit/usage`. The owner's alone (403 for anyone else): it counts rows private to the owner, never a row private to another member. Pulse shows it as a **Your month** card on the overview (\"October 2026: 42 messages sent, 6 reports, 3 meetings booked.\") and a focused screen, `/memories?tab=value`, with a month / week switch and previous / next. On the first weekday of each month, in daytime (09:00–18:00 local), a scheduler tick hook sends the owner last month's lines and a link (`value_summary.maybe_send_monthly`, claimed once per month under `briefing_narrative` scope `value_summary:YYYY-MM`), in solo and team mode alike; nothing is sent for an empty month. Off with `VALUE_SUMMARY_MONTHLY_ENABLED=false`.\n\n## Alert lifecycle & the Executive review\n\nAlerts used to be write-once: raised, then never looked at again, so the \"Needs you\" queue grew without bound and the briefs re-listed it daily. Four things now keep it live and true:\n\n- **Time-to-live** (`openexecutive.alerts.lifecycle`). Action items expire after `ALERT_TTL_DAYS_ACTION` (14 d), unrouted low/medium monitoring signals after `ALERT_TTL_DAYS_MONITORING` (3 d). Every surface reads `list_live_alerts` (the same predicate the scheduler's 15-minute sweep persists as status `expired`), so `/today` is right even before the sweep runs. Artifacts and decision-backed alerts are exempt. `POST /alerts/{id}/reopen` is the Undo. **Snooze** (a card's ⋯: later today, tomorrow 9:00, Monday 9:00, in the viewer's clock; `POST /alerts/{id}/snooze`) hides a card until `snoozed_until`, with an Undo; the TTL anchor is the latest of `created_at`, `last_seen_at` and `snoozed_until`, so a snoozed card comes back rather than expiring unseen.\n- **Coalescing** (`alerts.pipeline` + `store.coalesce_alert`). A repeat of an open alert with the same `(source, dedup_key)` updates that row — `occurrence_count`, `last_seen_at`, severity max — instead of stacking a second card, and only re-pings when severity rose to high/urgent. Monitoring alerts carry a stable `watch:<slug>` key, so one watch means one card.\n- **Collection tags** (`alerts.pipeline`). A triaged alert never carries a `collection:<name>` tag: the pipeline strips them before inserting. Only an installed extension's own code files a document into its collection (`orchestrator.extensions`), so injected text can't make a card that the extension would treat as its own.\n- **The review** (`openexecutive.alerts.review`, heartbeat `alert_review_scan`, every 6 h and right before the morning brief). For each open alert the Executive sees what changed since it was raised — newer signals from the same watch, related alerts, activity since, the roster with SLAs (team members only — an alert routed to a contact never puts them in the slice, so they are never routed to, nudged or chased; a private card is never reviewed at all, nor used as evidence for another), department authority — and returns a verdict (relevant / changed / resolved / stale) plus a recommended move. Deterministic policy then acts: **route** (assign + DM the owner; `propose_via_alert` for propose-only departments), **nudge**, **escalate** (severity + `due_at` + DM the principal only), **draft** (`draft_artifact`), **suggest a workflow** (a link, never a run), **merge** (`superseded_by_alert_id`), or **resolve** — only on high confidence citing a server-minted evidence ref (a newer signal, a related alert, an activity item shown for that alert); free text never closes a card, and anything weaker is annotated `likely_stale`, demoted 30 ranking points, and left for one click. Everything that came from outside is rendered as inert data inside the review prompt, so an injected email body cannot steer the batch. Board / comp / legal matters only ever go to a scope-holder or the principal and keep their text. Route and escalate are idempotent across passes, every DM carries an \"[Alert review] Re: …\" header, outbound moves are capped per pass, passes are single-flight, `ALERT_REVIEW_ENABLED=false` stops every caller, every move is audited with its evidence and prior state, and a distinct `resolved` status keeps Executive closes separate from `ack` (user approved). A review DM is proactive outreach, so the recipient's notification settings apply: one held for their quiet hours or brief counts as a route made but not as a nudge toward the cap (and no second nudge is held while one waits), and one about an alert whose severity is (or becomes) `urgent` is marked urgent (`notifications.urgent_send`) and gets through when they let urgent things through.\n- **Grounded text** (`openexecutive.briefing.grounding`). Nobody reads an alert's text before it is dispatched, so what the model wrote onto it must be supported by what it read. After triage (`alerts.pipeline._ground_decision`, before coalescing or inserting), a headline naming a person or figure the event does not hold — sources are the event's subject, sender, title and body, the initiatives triage was shown and the company profile — is replaced by the event's own subject, such body sentences are dropped (all of them → the event body cut to 280 chars); both fallbacks are raw event text, so they are made inert first — links masked, Markdown and Slack `<…>` syntax and @-mentions stripped — because a broadcast posts them as written, and such a suggested action is dropped. A review `changed` rewrite is checked against the alert's own text and the evidence it was reviewed with (signals, related alerts, activity, the roster slice), plus the standing facts the batch was shown, so a rewrite that corrects a card to one of the principal's corrections is grounded; an ungrounded rewrite keeps the old text, still applies a severity change, and audits `text_ungrounded`. A name counts as grounded only when one source line holds all of it; a figure only when a source number matches it within the precision it is written with. Each finding writes a `grounding` audit row; `GROUNDING_CHECKS=report` records without changing anything.\n\nOn the page, cards read as decisions: the one-line \"what changed since you last looked\" (`review_note`) leads, the recommended move is the primary control (Nudge <owner> → chat; Run <workflow> → `/jobs/<name>`), with chips for age, seen ×N, why-now / due, folded-in and draft-ready, a \"Reviewed <ago>\" footer, and an amber Likely-stale treatment with one-click Dismiss. \"Needs you\" shows *Start here* + 8 cards + \"Show N more\", a \"Dismiss N older than 7 days\" footer (explicit ids to `POST /alerts/bulk-ack` — never a server-side age sweep, which would hit teammates' routed items), and \"Re-check relevance\" (`POST /alerts/review`). The handled rail (anchor of the \"Executive handled N overnight\" pill) is deliberately one sentence by default: a first-person heading built from counts only — \"Since your last brief: N off your plate (closes still standing, and merges whose survivor is not itself listed; a merge into a listed survivor counts on that survivor's row), N in others' hands (routed / nudged), N waiting on you (escalated)\", plus \"N drafts ready\", \"N workflows suggested\", \"N watch changes\", \"N other moves\" (a kind the UI does not know) and \"N back on your plate\" (a close that is open again) when present — with the rows behind a \"details\" disclosure, and nothing rendered at all when the grouped rows are empty. The pure logic (grouping, headline, links) lives in `packages/ui/src/lib/handled.ts` and is covered by `npm test`. Expanded, it shows one first-person row per alert (\"Resolved *X* — evidence\", \"Dismissed *X* as stale — evidence\", \"Handed *X* to Dana Kim\" / \"Proposed *X* to Dana Kim (awaiting their approval)\", \"Chased Dana Kim on *X*\", \"Raised *X* to high\", \"Drafted *T* from *X*\", \"Folded *X* into *Y*\", \"Started watching *slug*\"), escalations first; rows sharing an alert collapse to the newest move with the others as an \"also …\" trailer — a close always keeps the visible slot (it carries Undo), otherwise an escalation beats routed / nudged / drafted; a merge whose survivor is listed becomes \"N duplicates folded in\" on the survivor. Every row links its `evidence_ref` (or \"evidence\") to `/audit?event_type=…&q=…` (the audit page pre-fills those filters from the query string), a still-open row jumps to its card (`#alert-<id>`), drafted rows link `/artifacts`, watch rows `/watchlist`. Undo is offered only while the close still stands (`status` not `open`); a reverted close shows \"Reopened\". Dismissing a watch-sourced alert lowers that watch's `trust_score` (which discounts ranking and is shown to the review as evidence); the ack body may carry `mute_topic`. Acknowledging or resolving an alert — including the review closing it itself — marks the review's DMs about it `acted` in the Attunement outcome ledger, for the person it is routed to and the principal only; dismissing it, finding it stale or letting it expire voids them (counted neither way). Review DMs are tagged `alert_review` with `alert:<id>`.\n\n## Multi-client practice section\n\nIn multi-client practice mode (2+ client slots — see the Client Companies section), the response gains an additive `practice_clients` list: rollup cards for the **parked** clients (overdue follow-ups, awaiting replies, unread alerts, onboarding due soon, renewal countdowns), each stamped with the save point its data reflects. Single-company installs always receive an empty list and the UI renders nothing.",+ "markdown": "`openexecutive.api.routes.today` serves the morning brief — a one-screen, read-only view of what is happening across the org. It is the default landing surface (the Next.js root renders `<Briefing>`). Every signed-in page shares one sidebar (`AppSidebar`). Its Recent list is capped at the 7 newest web chats. The full history, including Slack, Telegram and Discord conversations (recognised by their session-id prefix), lives on `/chats`. A chat opens from any page through `/?session=<id>`.\n\n`GET /today` returns `TodayResponse` assembled by `_build_today()`, which is synchronous and caller-agnostic:\n\n- **`departments`** — per-department goal health, rolling up each department's goal counts (`total`, `at_risk`, `off_track`) plus its awaiting-workflow count, and `attention_goals`: the actual off-track/at-risk goals (worst first, capped at 3) with `key_result`, `current`, `target`, and `status`, so the briefing's Department card shows *which* goal is off and how far without a click. Empty for healthy/inactive departments.\n- **Private cards.** An alert tagged `private:principal` (`alerts.models.PRIVATE_ALERT_TAG` — raised on a turn about mail from one of the principal's contacts or mail they forwarded, or a meeting proposal with a contact) is in `proposals` only when the caller is the principal. `_build_today` leaves it out by default, so the end-of-day digest, the reflection and Discord's `/today` never see it, and the morning brief reads it only on a run for the principal (the scheduler's, or the principal's own verified chat turn in a conversation only they can read — see Workflows). The narrative is written from one only in the principal's own `principal` scope, which nobody else is served; the shared `company` scope an unresolved caller gets, and a teammate's scope, never are. The activity rail skips it, and the chat digest includes it only on the principal's own verified turn.\n- **Roster-request cards.** When someone not on the People list writes in (see Org and Integrations), `people.roster_requests.surface_card` raises an alert of source `roster_request` (medium, tagged `roster_request:<id>` and `private:principal`, routed to the principal), so it follows every private-card rule above. `GET /today` attaches `roster_request` to that proposal (`_roster_request_card`: channel, address or account id, the sender's sanitised and unverified name, profile email, company-domain flag, suggested kind and person, message count, whether they were acknowledged, first seen, and the held messages' first lines) while the request is still pending. The Briefing renders it as its own card (`RosterRequestCard`: add as a new person with a name and an explicit team/contact choice — pre-filled as team on a company domain — or \"someone already on the list\", with a replace-account option for a chat id, or Ignore), which calls `/people/requests/{id}` directly and never hands off to chat, so what a stranger wrote never seeds a turn. The card is kept out of everything that could close it without answering it or put the stranger's words in front of a model: the narrative (`_action_proposals` drops it), the chat's open-alert digest (`<briefing>` — the principal's verified turn gets a separate `<roster_requests>` block instead; see Agents), `ack_alert`, a single ack (`POST /alerts/{id}/ack` is a 409), the \"Dismiss N older than 7 days\" count and the server's bulk ack, reopen, the TTL sweep and the alert review (`roster_request` is in `lifecycle.TTL_EXEMPT_SOURCES`). It ends when the request does: answered (`ack`, or `dismissed` on a decline) or expired after `ROSTER_REQUEST_TTL_DAYS`.\n- **`people`** — an attention-ranked roster of the **team** (the principal's contacts are never listed, and get no insight note). Each person carries `awaiting_action` count, soonest SLA, a `status` (`on_leave` / `needs_reply` / `awaiting` / `clear`), reachability, `overdue`, a server `priority` sort key, and a cached one-line `insight`. Sorted by `(-priority, full_name)`. Stale insight notes are regenerated in the background only when the roster has more than one person: the UI shows the People sidebar only for more than one, so a one-person install (solo, or a team before anyone else is added) does not pay a daily model and peer-memory call for a note nobody sees. Cached notes are still served.\n- **`proposals`** — the *live* unread alerts (workflow approvals, triage-classified inbound, Executive signals, flagged artifacts, and gated calendar bookings; an artifact is listed only to its owner (`alerts.models.visible_alert`; every other build of the board — the briefs, the reflection, the review, the chat digest on anyone else's turn, the activity rail — leaves drafted artifacts out) and carries `artifact_format` / `artifact_url` and a `body` already rendered to Markdown for its format, so the card badges it as a web page, Word doc, spreadsheet or link and offers *Open artifact*): unread, inside their category TTL, not snoozed — see *Alert lifecycle* below. Each carries `score`, `category` (`action` vs `monitoring`), `surfaced_reason` from `openexecutive.briefing.ranking`, the lifecycle fields (`occurrence_count`, `last_seen_at`, `last_reviewed_at`, `review_verdict`, `review_note`, `recommended_move`, `why_now`, `due_at`, `superseded_count`, `suggested_workflow`), and `decision_instance_id` (set only when the proposal is backed by a decision-ledger row — a calendar booking awaiting approval). `failed_run_id` is set only on a `workflow_failed` card (a scheduled run that ended in error, see Scheduler): its main button is **Run again** (`POST /workflows/runs/{id}/rerun`, which also closes the card) and its ⋯ opens the run; it has no Approve. The response also carries `held_back` for the principal alone: the lines grounding left out of the morning brief or end-of-day digest in the last day, which Home lists under **Left out of your brief** (the brief's note names it; Hide is remembered in that browser). The UI splits them into 'mine' vs 'across the team' using `caller_person_id`. Approve is carried out on the server for every card. For decision-backed proposals the card's Approve/Reject call the `/decisions` endpoints (which book or cancel the event server-side and clear the alert), so meeting bookings are reviewed in the briefing itself rather than on a separate page. Every other proposal is approved at `POST /alerts/{id}/approve` (`alerts.approvals`): it records who approved the card and when (an `alert_approvals` row plus `alert_approved`, then `alert_approval_done` / `alert_approval_failed`, audit rows), claims the card in one transaction so a double click or a second approver gets a 409 and the work runs once, then does the work. A card the scheduler filed for a department-gated action is bound to it server-side (`alert_held_actions`, written only as the card is filed, never read from the card's tags or text, which a model reading inbound mail can write), and approving it queues that exact action again with no department, the approval being the consent the gate waited for. Any other proposal runs one Executive turn as the approver in a new chat on the server (`chat.start_background_turn`, the machinery behind `POST /chat/background`), with the edited text verbatim for Edit & approve; it keeps going if the page closes. Only the card's routed person or the principal may approve a routed card, and only the principal an unrouted one (403 otherwise); the card's text reaches the turn as quoted data, not instructions. A row at the top of Needs you follows the approval (`GET /alerts/approvals/{id}`): working on it with a link to the chat, then done, or didn't work with Try again; a card whose last approval failed can be approved again, and one still running at a restart is marked failed on boot. The page no longer acks the card and seeds a chat turn with the proposal, which left no record of the approval and did nothing if the tab closed first.\n- **`narrative`** — a per-viewer Executive-voice header (\"What's going on\") synthesized by `synthesize_briefing_narrative`, cached per scope in `briefing_narrative`: the resolved principal gets the whole-company `principal` scope (which may carry what is private to them), a caller who resolves to no roster row the shared `company` scope (written from what everyone may see), and each teammate a role-scoped `person:<id>` one. `narrative_generated_at` says when the served text was written and `narrative_stale` whether a fresher one is being written now. In the web UI each bullet of this narrative is a click target: clicking one hands off to chat (the same `onContinue` path as the proposal cards) seeded to discuss that item. The Executive recognizes it because every chat turn now carries a `<briefing>` digest of open alerts (see Memory). That digest (`briefing.context.format_open_alerts_for_prompt`) is capped at 30 items; when the board is longer the header says so explicitly and tells the Executive to point at this page for the rest — it previously presented the capped list as the complete board, so the Executive described a slice as everything that was open (#136). Chat adapters get the digest too, but Slack gates it to the principal's DMs: the board is company-wide and must not be pulled into a shared channel. The `[alert_id]` at the start of each line is also what `ack_alert` trusts, because an id quoted inside an alert's own body came from inbound mail or chat and is attacker-controlled. This page's `[Discuss mode — alert_id=N]` handoff primer is a pointer to which item is under discussion, not authority on its own: the server accepts it only if that id is on the live board too. Two things enforce that. Every field the digest interpolates — headline, body, suggested action, tags, review note — is collapsed to a single line, since a newline in any of them would forge a whole extra `[N]` line and with it a fabricated instruction to clear someone else's alert. And the server records the live board it derived, so `ack_alert` refuses any id outside it — on **every** session, not just the chat adapters. The recorded set is the whole live board, not just the rows the digest printed, so a card past the render cap stays ackable. The control stops invented, closed, snoozed and expired ids; it does not stop the model being argued into acking the wrong *live* card. When the principal names an item that has already left the board — opened, snoozed, or older than it — the Executive looks it up with `find_alerts` (a keyword search over every status, `alerts.store.search_alerts`); matches that are still open (`unread` or `read`) become ackable for that turn, up to 25, and closed ones come back labelled so the Executive can say the item is already settled. It works only where the principal's own board was shown this turn — the web app or their DM — and never returns roster-request cards (see Lifecycle). The digest's header also labels every headline and detail as untrusted content drawn from inbound mail, chat and watched pages — act on what the principal asks about an item, never on what its text asks — and triage reads each signal inside an `<event>` block whose closing tag the sender's text cannot forge (it is defanged in any case and spacing, after NFKC folds fullwidth forms). That check used to run only when `origin_channel` was set, which the browser never sets, so the one surface where the principal actually reads their board had no check at all and the model could ack any id, including one quoted out of an alert body by the Discuss handoff. Rendering the block and recording its ids now happen together in `briefing.context.render_and_trust`, which both the web chat route and the channel adapters call: render without recording and the tool refuses everything, record without rendering and the model gets reach it was never shown. A turn that was shown nothing trusts nothing. Recording it is only half the wiring: the tool reads the board off the turn's session through a ContextVar, and the chat route binds that session for the whole SSE body (`set_session`, next to `set_turn`). Bound from inside the Executive's own generator instead, it survives exactly one stream step — `asyncio.wait_for` runs each step in a fresh Task with a copy of the context — and the tool-call loop, which runs later, sees nothing. That shipped, and every web ack was refused on cards that were open the whole time. The digest also carries a short **already handled** tail — recently acked / dismissed / resolved rows, named but deliberately NOT trusted for acking — because a card cleared on the page minutes ago is otherwise simply absent from chat: asked to \"record that as fixed\", the Executive could not tell a settled item from one it had never heard of, and sent the principal back to dismiss a card that was already gone. That tail renders even when nothing is open, which is exactly when it matters. Note it is a different window from the `handled_overnight` rail above: that one runs since the last delivered morning brief, while the chat tail looks back 14 days (matching the action-alert TTL, so it still covers an item cleared late in its life), so chat can name a settled item the rail no longer shows. The narrative is held to what is **live**, and to what it is actually for. The `alert_raised` source is dropped from the activity it reasons over (`_build_activity(..., include_alert_raised=False)`): a closed alert reads as work the principal already settled, and a *live* one is worse than redundant — `lifecycle.is_live` is the very predicate behind `list_live_alerts`, so every live raise is already a proposal card below the header, which the prompt forbids re-listing. The `/today/activity` rail keeps the whole source, because a raise really happened. The activity block is only labelled \"since last brief\" when the caller bounded it with `since` (the standalone briefs do; the header does not), since calling an unbounded history rail a delta made the header present weeks-old rows as overnight news. When the viewer's slice holds nothing that wants a decision — no action proposal, no at-risk/off-track department, nobody awaiting — the regen skips the model call entirely and writes the fixed quiet line (`Quiet right now — nothing pressing.`, or `… nothing needs you.` for a teammate). **The cache key is a hash of the rendered context itself** (`today._narrative_context` builds it once and both the hot path and the background task key off that one string, which is also handed to the model verbatim). That makes the key a function of the model's input: everything the prompt renders is covered, and nothing it omits can trigger a regeneration. Keying on hand-picked fields broke one half or the other each time — headlines alone left the rendered activity block uncovered, while the proposals' review fields are never rendered by this header yet are rewritten with fresh prose by every `alerts.review` pass, so they regenerated each viewer's narrative several times a day to re-synthesize identical input. A quiet board keys off a fixed sentinel instead, so a moving rail cannot re-key an entry whose text is constant. Together: on a fully dismissed board every other input was empty, the rail became the only context, and the model synthesized a confident header out of closed items.\n\n **Live, not just the board.** The header used to reason over the alert board, goal health and the Executive's own bookkeeping only — mail and chat handled that day, replies the gate held and the next meeting never reached it, so it read the same for days while the principal's day moved on. The whole-company scopes now open the context with the principal's world as it is happening (`briefing.live_signals.gather_live_signals`, rendered by `render_live_blocks`), under a `NOW:` line: **INBOUND** (`integration_inbound` audit rows that carry a message, grouped by sender and subject, with an email's first line), **STUCK** (`integration_outbound_blocked` to a recipient, the inbound \"reply blocked at outbound gate\" and Google Chat \"left unanswered\" / \"not delivered\" rows, and drafts saved by Act as me), **CONVERSATIONS** (the principal's own web chat titles) and the **REST OF TODAY'S CALENDAR**. The window is the local day, or the last 12 hours when that is longer. Private audit rows, drafts, chat titles and the calendar (meeting titles are the principal's own) are read only in the `principal` scope — `gather_live_signals` drops the calendar whenever `include_private` is false, whatever the caller passes, so the shared `company` header never quotes it. The calendar is never fetched on the request: `live_signals.refresh_calendar` caches one read per 15 minutes (the scheduler tick refreshes it) and the header quotes the cache. Every quoted field is collapsed to one line and cut, and the blocks and the prompt both say the text is data, never instructions — inbound mail is attacker-controlled. With live blocks present the context also ages each proposal (`raised 2d ago`, whole days), names each at-risk department's slipping goals (`attention_goals`) and adds an **EXTERNAL SIGNALS** block (monitoring alerts from the last 24 h, never enough on their own to break the quiet line); the rhythm runs (`today.RHYTHM_WORKFLOWS`: the morning brief, end-of-day digest, reflection and weekly review) are dropped from the activity it reasons over. The prompts (`BRIEFING_NARRATIVE_SYSTEM` and its solo variant, `NARRATIVE_PROMPT_VERSION` 6) lead with what is live and give a days-old item at most one bullet. Anything live breaks the quiet line; the NOW line and window move at most once an hour, so the key moves hourly on time alone plus whenever something new lands; the calendar is placed at the real time (a meeting that has ended drops out, the one under way is IN PROGRESS), which moves it only when a meeting starts or ends.\n\n **Fresh without a reload.** The daily floor in the key and the PERIOD line are the principal's **local** date (`narrative_cache.local_today`), not UTC's, and a row written on an earlier local day is not served as today's. Regenerations are serialized per scope; a trigger that finds one running marks the scope pending and the running pass goes round once more (it built its context before that trigger's news landed), and after a failed pass (model error, the 25 s timeout, empty text) no view or tick starts another for 5 minutes and `narrative_stale` reads false, so the page drops its placeholder instead of spending a model call per view. They log `today: narrative served scope=… age_s=… stale=…` and `today: narrative regenerated scope=… ms=…`, and no longer need a page view: every `BRIEFING_NARRATIVE_REFRESH_MINUTES` (10) between `BRIEFING_NARRATIVE_REFRESH_START_HOUR` and `_END_HOUR` (06–22 local) the scheduler runs `today.refresh_principal_narrative`, which refreshes the calendar cache and rewrites the principal's header only when its key moved (see Scheduler). The Briefing re-polls `/today` at 4, 10 and 20 s while `narrative_stale` is true, re-pulls it when the tab comes back (at most once a minute) and every 5 minutes while visible, shows \"Updated 2:04 PM\" beside the heading, and shows \"Catching up on today…\" while the first header of the day is written (`lib/narrativeFreshness.ts`, tested by `npm test`).\n\n In **solo mode** (one person using Open Executive for themselves) the header speaks to the principal, whatever their role: a solo prompt over a context that lists goals at risk by *area* and has no \"people waiting on you\" block, and the quiet check ignores who is awaiting. The cache key carries the mode for solo only, so solo and team never share a cached narrative while every team key stays exactly what it was — no team cache is invalidated. The response shape does not change. For the principal's own view the solo context also carries a **DUE THIS WEEK** block — the principal's open loops that are overdue or due within 7 days (`today._with_due_soon` → `open_loops.principal_due_soon`, labelled OVERDUE / due today / due <weekday>) — which counts as needing attention in the quiet check and moves the cache key when an item is added, closed or falls due; a teammate's scoped view and team mode never get it. The header never gets the morning brief's *top three today* block — that is the DM brief's (see Workflows); the page shows the same top three in a card of its own (see *Solo focus cards* below). It does get the rest of today's calendar through the live blocks above, from the cached read.\n- **`in_flight`** / **`awaiting`** — upcoming Executive commitments and people we are waiting on.\n- **`handled_overnight`** — the autonomous moves the Executive *completed* since the last delivered morning brief: the alert review's (routed, nudged, escalated, drafted, merged, closed) plus the research watch policy's (`watching` — a watch added on its own because it was grounded in company data; `stopped_watching` — a research watch auto-disabled as noisy or dead; no alert id, re-enable from `/watchlist`). A `changed` verdict (the review rewrote an open alert's headline / body / severity) is deliberately **not** here: the alert is still open in \"Needs you\" and its card carries the note, so the brief reports it under \"what changed\" (a REWRITTEN block) rather than as done. Each row is structured, not just a sentence: `kind`, the audit `summary` (nudge bookkeeping marker stripped), `at`, `alert_id`, `event_type` (for a pre-filtered `/audit` deep link), `headline` (the alert's headline at move time; a watch's slug), `target` (person name for routed / nudged, survivor headline for merged, new severity for escalated, draft title, workflow name), `detail` (the cited evidence or the watch policy's reason), `outcome` (`resolved` | `dismissed` for a close, `proposed` for a route that went through the authority gate), `evidence_ref` (S1 / R2 / A3), `superseded_by_alert_id`, and `status` — the alert's lifecycle state **now** (`open` = live in the queue per `lifecycle.is_live` | `resolved` | `dismissed` | `expired` | `merged` | `acked` | `inactive` for snoozed / past-TTL rows), looked up per row so a close the principal already undid renders as reopened instead of offering a second Undo, and a \"still open\" jump link only appears when there is a card to land on. Audit rows private to the principal (say, one naming their contact) are in this list only on the principal's own `/today`: `brief_state.handled_since` leaves them out unless asked, and the written briefs never ask, since a brief can be read by others. The Pulse heatmap's per-day counts (`GET /today/activity/daily`) likewise leave out a private decision or private alert, as the activity rail does. The morning brief also carries a one-line count of research watch suggestions waiting on `/watchlist`.\n\n**Standing facts.** `render_briefing_context` appends the standing facts (`memory.facts`: corrections kept from chat, a teammate's marked `(per <name>)`) as its last block, after the quiet-day check, so a fact never makes a quiet day look busy. The morning brief also carries **TEAMMATE CORRECTIONS SINCE LAST BRIEF** (`facts.render_teammate_changes(since)`: each teammate fact recorded in the window that is in use now, plus — only when the brief is the principal's own private one (`_private_ok`), which then keeps the run out of the shared history — those waiting for their approval, since other teammates may run the brief and never see a proposal that is not theirs) before the quiet check — it is news, the principal's only FYI of it — and in the brief's fingerprint (`build_brief_fingerprint(teammate_changes=)`), so a correction alone un-suppresses an otherwise unchanged brief. Every other caller passes none, so its context is unchanged. The /today header hashes that rendered string as its cache key, so a new or retired fact marks the header stale and it is rewritten with the correction. The morning brief (standalone) and the teammate-scoped header get the same block. On the scheduler's delivery to the owner alone, with their Always in the loop switch on, `render_briefing_context(owner_notes=)` also carries FROM YOUR NOTES — DUE SOON (their own notes of what they promised or asked, overdue to a week ahead; `memory.history_brief`), which counts against a quiet day, enters the fingerprint and marks the run private; both standalone prompts turn it into a **From your notes** section. The /today header never gets it. **The first week.** For seven days from the principal's People row (`briefing.first_week`), `render_briefing_context(getting_started=)` carries a GETTING STARTED block right after the live blocks: the install's goal rows (department, key result, target, period) or, while there are none (setup saves no goal rows, so this is a fresh install's usual case), this year's priorities and north star from the saved profile (`strategic_priorities`, up to five, keys `priority:<text>`), departments with no `head_person_id`, and, on the scheduler's delivery to the principal alone with Act as me and Draft replies to my inbox both on and the mailbox connected (the inbox watcher's consent), up to five people who wrote to their own mailbox in the last 48 hours as sender and subject only (`inbox_message_ids` + headers of `get_message`, bulk and automated mail skipped; the same \"where, never what\" rule as `delegation.mail_reads`) and, with Act as me and Read my calendar on, up to eight of today's events on their own calendar as time and title (declined ones left out). It counts against a quiet day, enters the fingerprint (`getting_started=` keys, no dates; a meeting's key is its event id) and, with the inbox or calendar part, marks the run private. Both standalone prompts open with a **Getting started** section and take the Top call from it (`GETTING_STARTED_RULE`); the whole-company /today header gets the block without the inbox (`getting_started_shared`, synchronous, no mailbox read) and the header prompts take the bottom line and move from it (`GETTING_STARTED_HEADER_RULE`), so a new install's header is not short-circuited to the quiet line. `GET /today` sets `first_week`; while it is true the Briefing hides the \"Quiet day\" banner, renders the header narrative open in the page under **Getting started · your first week** (in place of the \"Read today's brief\" side panel), and, when the summary counts are all zero, shows the narrative's **Move today:** line in place of \"All clear\" (`firstWeekMove`). The last setup screen (`OnboardDone`) offers one first question built from the saved priorities (`firstQuestion`) and hands it to Home through session storage (`oe.onboard.firstQuestion`, never the URL), which asks it once. A teammate's scoped header never gets it. The alert review's `render_batch` puts the same block ahead of the alerts (read once per pass), so a note, rewrite or routed DM never repeats a figure the principal already corrected.\n\n**When a brief isn't sent.** Above the Briefing, the owner sees a one-line notice when their latest morning brief, end-of-day digest or (in solo mode) weekly review wasn't sent — \"Your morning brief wasn't sent: nothing is set up to send it to you\" — with the day, what fixes it, a link to read the brief on the Artifacts page (left out when the brief couldn't be written at all) and one to Setup status. It comes from `GET /today/brief-delivery` (the scheduler records each run's outcome), shows nothing while briefs go out or while the scheduler is off, and clears once the cause is fixed. When the Executive's mail connection wasn't running (the MCP gateway failed to start and is retrying), the notice says that instead of blaming the owner's setup; a send that failed on every channel names what each channel answered, from the recorded `detail`, with addresses left out. Teammates never see it.\n\n**Replies waiting.** With Act as me's **Draft replies to my inbox** on, the top of the Briefing's left column lists the replies the Executive drafted in the owner's own Gmail for mail that needs them (`RepliesWaiting`, from `GET /delegation/replies` — see Act as Me). They belong to the owner alone: the route answers only the person who can have Act as me, the decisions behind the cards (`delegation_reply`) are principal-only and carry `private: true`, so `/today/activity` and the heatmap leave them out, and none is ever an alert, so nothing of them reaches `GET /today`, the header or the briefs. Each card shows who wrote and who they are to the owner, whether their address was verified, the subject, what they wrote (as plain text), the draft, **Decide before sending** (its open questions) and its warnings, with **Send**, **Edit in Gmail** (the thread in their Gmail) and **Dismiss** (which deletes the draft unless they edited it). **Send** asks first, naming who the reply goes to, then sends the draft exactly as it is in Gmail (`POST /decisions/{id}/approve`); when its recipients changed in Gmail or a newer message arrived, the backend's 409 `confirm` becomes a second question naming them. The card hides itself when nothing is waiting.\n\n**Solo focus cards.** `GET /today/top-three` and `GET /today/weekly-review` feed two solo-only cards, so a principal who only uses the web app — no chat app, no Google Workspace — sees today's top three and the weekly review instead of finding them only in the Workflows run history. Both answer only in solo mode (`effective_workspace_mode`) and only to the principal, by the stricter rule for starting a principal-only run (`workflows._caller_is_the_principal`: the caller's own email on a principal entry that is not archived, or no `x-caller-email` at all — never \"nobody is principal yet\"); a teammate, any other signed-in caller and team mode get null. `top-three` hands `open_loops.principal_due_soon()` to `briefing.top_three.build_top_three` — the morning brief's own inputs and code, so the items, their order and their free slots are the brief's — and returns `{items: [{key, kind, text, why, slot}]}`: `slot` is the free block (\"10:00–11:00\", the user's zone), \"\" when none is left, or null when no calendar was read (none connected, a failure or the 4 s timeout, a weekend); `items` is empty when there is nothing to pick. It is a route of its own, never part of `GET /today`, so the Briefing never waits on the calendar. `weekly-review` returns the latest `weekly_review` run with status `done` (`persistence.list_runs(..., status=\"done\", limit=1)`, newest `updated_at` first; failed and running runs never count) as `{run_id, completed_at, period, top_three, excerpt}`: `weekly_review.summarize_review` reads the artifact's title line and its last *Next week's top 3* section back as plain text, and `excerpt` stands in when that list is empty (the section's own note, else the review's first lines). Null when no review has completed or the run store cannot be read.\n\nThe route resolves the caller from `x-caller-email`, serves the viewer's cached narrative and, when its key moved, rewrites it in a `BackgroundTask` so the request never blocks on an LLM call (the page re-polls while `narrative_stale` is true). `GET /today/activity` returns the recent self-initiated action rail — merged from fired scheduled actions (DMs, follow-ups, nudges, cadences), logged decisions, saved advice, completed workflow runs (briefings/check-ins/research), kicked-off initiatives, resolved gated decisions, and raised alerts, so it reflects all of the Executive's activity rather than just dispatched messages. The Pulse page (`/memories`) polls it (limit 100) every ~20s so new events stream into the 'Recent activity' card, which scrolls internally at a fixed height instead of growing the page. The `morning_brief` workflow calls `_build_today()` directly to build the standalone DM (via a different, enumerated prompt; solo mode has its own, with goals at risk by area and no waiting-on section). `GET /morning-brief` is a deprecated alias.\n\n**Solo mode in the UI.** The response is the same in both modes; the briefing reads the workspace mode from the app-wide `WorkspaceProvider` (which reads team while loading or on error, so a team install never flashes solo) and, in solo, drops the team surfaces: the Departments card, the People card, the \"Across the team\" lane (every action proposal is the one user's, so all of them land in \"Needs you\"), the people-awaiting, people-overdue and departments-at-risk status pills, and the quiet-day \"Set up a check-in\" link. A \"N goals at risk\" pill (at-risk plus off-track goals, from `departments`) links to `/goals` instead, so the strip never reads \"All clear\" over a goal that is slipping. In the Departments card's place, **Your projects** lists the initiatives with status `active` (`GET /memories/initiatives`): **Done** marks one `completed` through `PATCH /memories/initiatives/{id}` (only `completed` takes an initiative out of the Executive's active context), and **Drop** deletes it through `DELETE /memories/initiatives/{id}` after a confirm. Under **Needs you**, a **Due soon** card lists the principal's open loops that are overdue or due within 7 days — their dated commitments and what others asked of them — read from `GET /people/{id}/open-loops` for the principal (the oldest principal in `people`, the backend's rule), labelled by `lib/dueSoon.ts` (tested by `npm test`: \"Overdue since Sep 23\" / \"Due today\" / \"Due Mon, Sep 28\", with a count of anything due later); **Done** closes one through `POST /open-loops/{id}/close`, which also stops the nudge engine chasing it. Above it, **Top three today** numbers the morning brief's three (`GET /today/top-three`) with each one's reason and, when a calendar was read, its free slot (or \"No free time left today\"); at the top of the right-hand column, **This week's review** (`GET /today/weekly-review`) shows the period, when it ran, next week's top three (or the excerpt) and a *Read the review* link to its run page (`/jobs/runs/{id}`). Each card fetches on its own once the Briefing has loaded, so a slow calendar never holds the page up, and renders nothing when the API returns null or an empty list. A commitment in the top three reads as the owner's own (\"Send the proposal\") through `lib/dueSoon.ts`'s `loopText`, as in Due soon; the cards' wording lives in `lib/rhythmCards.ts` (tested by `npm test`). The Pulse page hides its \"Department check-ins\" and \"Awaiting people\" blocks in solo, and its header shows active projects in place of the department check-in count. Team rendering is unchanged.\n\n**Your month (`GET /today/value`).** The owner's own tally of what the Executive did for them, `briefing.value_summary.summarize(period, offset)`: the calendar `month` or `week` (Monday first) in the user's zone, `offset` periods back (0–24), each line beside the period before. Every number is a `COUNT(*)` of rows that prove it happened, never a model's: messages sent for the owner (the DM handlers' own `kind=outbound` sent rows to anyone but the owner, plus Gmail / Outlook send-tool calls that didn't come back with an error, so mail sent from a chat turn counts), replies drafted and sent from the owner's inbox (their Act as me rows), meetings booked (calendar create calls), briefs delivered (the scheduler's `delivered` row), reports (finished team workflow runs, minus the daily rhythm runs and any run a teammate started for themselves, which stays theirs alone; the latest ten listed with links), follow-ups and nudges sent, tasks tracked and closed as done, proposals decided, alerts flagged and requests answered (`chat_turn` out rows). No \"hours saved\" and no cost line: nothing recorded supports the first, and cost next to what the owner got reads as a bill; it has `GET /audit/usage`. The owner's alone (403 for anyone else): it counts rows private to the owner, never a row private to another member. Pulse shows it as a **Your month** card on the overview (\"October 2026: 42 messages sent, 6 reports, 3 meetings booked.\") and a focused screen, `/memories?tab=value`, with a month / week switch and previous / next. On the first weekday of each month, in daytime (09:00–18:00 local), a scheduler tick hook sends the owner last month's lines and a link (`value_summary.maybe_send_monthly`, claimed once per month under `briefing_narrative` scope `value_summary:YYYY-MM`), in solo and team mode alike; nothing is sent for an empty month. Off with `VALUE_SUMMARY_MONTHLY_ENABLED=false`.\n\n## Alert lifecycle & the Executive review\n\nAlerts used to be write-once: raised, then never looked at again, so the \"Needs you\" queue grew without bound and the briefs re-listed it daily. Four things now keep it live and true:\n\n- **Time-to-live** (`openexecutive.alerts.lifecycle`). Action items expire after `ALERT_TTL_DAYS_ACTION` (14 d), unrouted low/medium monitoring signals after `ALERT_TTL_DAYS_MONITORING` (3 d). Every surface reads `list_live_alerts` (the same predicate the scheduler's 15-minute sweep persists as status `expired`), so `/today` is right even before the sweep runs. Artifacts and decision-backed alerts are exempt. `POST /alerts/{id}/reopen` is the Undo. **Snooze** (a card's ⋯: later today, tomorrow 9:00, Monday 9:00, in the viewer's clock; `POST /alerts/{id}/snooze`) hides a card until `snoozed_until`, with an Undo; the TTL anchor is the latest of `created_at`, `last_seen_at` and `snoozed_until`, so a snoozed card comes back rather than expiring unseen.\n- **Coalescing** (`alerts.pipeline` + `store.coalesce_alert`). A repeat of an open alert with the same `(source, dedup_key)` updates that row — `occurrence_count`, `last_seen_at`, severity max — instead of stacking a second card, and only re-pings when severity rose to high/urgent. Monitoring alerts carry a stable `watch:<slug>` key, so one watch means one card.\n- **Collection tags** (`alerts.pipeline`). A triaged alert never carries a `collection:<name>` tag: the pipeline strips them before inserting. Only an installed extension's own code files a document into its collection (`orchestrator.extensions`), so injected text can't make a card that the extension would treat as its own.\n- **The review** (`openexecutive.alerts.review`, heartbeat `alert_review_scan`, every 6 h and right before the morning brief). For each open alert the Executive sees what changed since it was raised — newer signals from the same watch, related alerts, activity since, the roster with SLAs (team members only — an alert routed to a contact never puts them in the slice, so they are never routed to, nudged or chased; a private card is never reviewed at all, nor used as evidence for another), department authority — and returns a verdict (relevant / changed / resolved / stale) plus a recommended move. Deterministic policy then acts: **route** (assign + DM the owner; `propose_via_alert` for propose-only departments), **nudge**, **escalate** (severity + `due_at` + DM the principal only), **draft** (`draft_artifact`), **suggest a workflow** (a link, never a run), **merge** (`superseded_by_alert_id`), or **resolve** — only on high confidence citing a server-minted evidence ref (a newer signal, a related alert, an activity item shown for that alert); free text never closes a card, and anything weaker is annotated `likely_stale`, demoted 30 ranking points, and left for one click. Everything that came from outside is rendered as inert data inside the review prompt, so an injected email body cannot steer the batch. Board / comp / legal matters only ever go to a scope-holder or the principal and keep their text. Route and escalate are idempotent across passes, every DM carries an \"[Alert review] Re: …\" header, outbound moves are capped per pass, passes are single-flight, `ALERT_REVIEW_ENABLED=false` stops every caller, every move is audited with its evidence and prior state, and a distinct `resolved` status keeps Executive closes separate from `ack` (user approved). A review DM is proactive outreach, so the recipient's notification settings apply: one held for their quiet hours or brief counts as a route made but not as a nudge toward the cap (and no second nudge is held while one waits), and one about an alert whose severity is (or becomes) `urgent` is marked urgent (`notifications.urgent_send`) and gets through when they let urgent things through.\n- **Grounded text** (`openexecutive.briefing.grounding`). Nobody reads an alert's text before it is dispatched, so what the model wrote onto it must be supported by what it read. After triage (`alerts.pipeline._ground_decision`, before coalescing or inserting), a headline naming a person or figure the event does not hold — sources are the event's subject, sender, title and body, the initiatives triage was shown and the company profile — is replaced by the event's own subject, such body sentences are dropped (all of them → the event body cut to 280 chars); both fallbacks are raw event text, so they are made inert first — links masked, Markdown and Slack `<…>` syntax and @-mentions stripped — because a broadcast posts them as written, and such a suggested action is dropped. A review `changed` rewrite is checked against the alert's own text and the evidence it was reviewed with (signals, related alerts, activity, the roster slice), plus the standing facts the batch was shown, so a rewrite that corrects a card to one of the principal's corrections is grounded; an ungrounded rewrite keeps the old text, still applies a severity change, and audits `text_ungrounded`. A name counts as grounded only when one source line holds all of it; a figure only when a source number matches it within the precision it is written with. Each finding writes a `grounding` audit row; `GROUNDING_CHECKS=report` records without changing anything.\n\nOn the page, cards read as decisions: the one-line \"what changed since you last looked\" (`review_note`) leads, the recommended move is the primary control (Nudge <owner> → chat; Run <workflow> → `/jobs/<name>`), with chips for age, seen ×N, why-now / due, folded-in and draft-ready, a \"Reviewed <ago>\" footer, and an amber Likely-stale treatment with one-click Dismiss. \"Needs you\" shows *Start here* + 8 cards + \"Show N more\", a \"Dismiss N older than 7 days\" footer (explicit ids to `POST /alerts/bulk-ack` — never a server-side age sweep, which would hit teammates' routed items), and \"Re-check relevance\" (`POST /alerts/review`). The handled rail (anchor of the \"Executive handled N overnight\" pill) is deliberately one sentence by default: a first-person heading built from counts only — \"Since your last brief: N off your plate (closes still standing, and merges whose survivor is not itself listed; a merge into a listed survivor counts on that survivor's row), N in others' hands (routed / nudged), N waiting on you (escalated)\", plus \"N drafts ready\", \"N workflows suggested\", \"N watch changes\", \"N other moves\" (a kind the UI does not know) and \"N back on your plate\" (a close that is open again) when present — with the rows behind a \"details\" disclosure, and nothing rendered at all when the grouped rows are empty. The pure logic (grouping, headline, links) lives in `packages/ui/src/lib/handled.ts` and is covered by `npm test`. Expanded, it shows one first-person row per alert (\"Resolved *X* — evidence\", \"Dismissed *X* as stale — evidence\", \"Handed *X* to Dana Kim\" / \"Proposed *X* to Dana Kim (awaiting their approval)\", \"Chased Dana Kim on *X*\", \"Raised *X* to high\", \"Drafted *T* from *X*\", \"Folded *X* into *Y*\", \"Started watching *slug*\"), escalations first; rows sharing an alert collapse to the newest move with the others as an \"also …\" trailer — a close always keeps the visible slot (it carries Undo), otherwise an escalation beats routed / nudged / drafted; a merge whose survivor is listed becomes \"N duplicates folded in\" on the survivor. Every row links its `evidence_ref` (or \"evidence\") to `/audit?event_type=…&q=…` (the audit page pre-fills those filters from the query string), a still-open row jumps to its card (`#alert-<id>`), drafted rows link `/artifacts`, watch rows `/watchlist`. Undo is offered only while the close still stands (`status` not `open`); a reverted close shows \"Reopened\". Dismissing a watch-sourced alert lowers that watch's `trust_score` (which discounts ranking and is shown to the review as evidence); the ack body may carry `mute_topic`. Acknowledging or resolving an alert — including the review closing it itself — marks the review's DMs about it `acted` in the Attunement outcome ledger, for the person it is routed to and the principal only; dismissing it, finding it stale or letting it expire voids them (counted neither way). Review DMs are tagged `alert_review` with `alert:<id>`.\n\n## Multi-client practice section\n\nIn multi-client practice mode (2+ client slots — see the Client Companies section), the response gains an additive `practice_clients` list: rollup cards for the **parked** clients (overdue follow-ups, awaiting replies, unread alerts, onboarding due soon, renewal countdowns), each stamped with the save point its data reflects. Single-company installs always receive an empty list and the UI renders nothing.","mermaid": "flowchart TD\n REQ[\"GET /today\"]\n BUILD[\"_build_today()\"]\n DEPTS[\"departments<br/>(per-dept goal health)\"]\n ROSTER[\"people<br/>(attention-ranked roster)\"]\n PROPS[\"proposals<br/>(unread alerts, routed)\"]\n INFLIGHT[\"in_flight<br/>(pending follow-ups / nudges)\"]\n AWAIT[\"awaiting<br/>(replies we await)\"]\n NARR[\"viewer-scoped narrative (BackgroundTask)\"]\n MB[\"morning_brief workflow\"]\n TOP3[\"GET /today/top-three<br/>(solo, principal only)\"]\n PICK[\"build_top_three()<br/>(calendar read, 4 s cap)\"]\n WREV[\"GET /today/weekly-review<br/>(solo, principal only)\"]\n RUNS[\"workflow_runs<br/>(latest done weekly_review)\"]\n LIVE[\"live_signals<br/>(inbound / held replies / chats,<br/>cached calendar)\"]\n TICK[\"scheduler tick<br/>(every 10 min, 06–22 local)\"]\n CACHE[\"briefing_narrative<br/>(principal / company / person:id)\"]\n REQ --> BUILD\n BUILD --> DEPTS\n BUILD --> ROSTER\n BUILD --> PROPS\n BUILD --> INFLIGHT\n BUILD --> AWAIT\n REQ -->|\"resolve caller, attach\"| NARR\n LIVE --> NARR\n TICK -->|\"refresh_principal_narrative\"| NARR\n NARR --> CACHE\n MB -->|\"since last brief\"| LIVE\n MB -->|\"calls directly for standalone DM\"| BUILD\n MB -->|\"same pick for the DM\"| PICK\n TOP3 --> PICK\n WREV --> RUNS\n class REQ entry\n class BUILD compute\n class DEPTS storage\n class ROSTER storage\n class PROPS storage\n class INFLIGHT storage\n class AWAIT storage\n class NARR compute\n class MB compute\n class TOP3 entry\n class PICK compute\n class WREV entry\n class RUNS storage\n class LIVE compute\n class TICK entry\n class CACHE storage",- "generated_at": "2026-10-14T13:07:16Z"+ "generated_at": "2026-10-14T19:00:07Z"}diff --git a/packages/core/openexecutive/briefing/first_week.py b/packages/core/openexecutive/briefing/first_week.pyindex bf1f2131..44c703b6 100644--- a/packages/core/openexecutive/briefing/first_week.py+++ b/packages/core/openexecutive/briefing/first_week.py@@ -7,7 +7,11 @@ which is exactly when the principal is deciding whether the Executive isworth keeping. This block gives the first week's briefs something true tosay, from what the install already holds:- • YOUR GOALS — the goals saved at onboarding, with department and target.+ • YOUR GOALS — the goal rows on the install, with department and target.+ Setup saves no goal rows (a team's departments start empty, a solo+ workspace has none), so on a fresh install this is usually+ • YOUR PRIORITIES THIS YEAR instead — ``strategic_priorities`` from the+ profile setup just saved, read only while there are no goal rows.• DEPARTMENTS WITH NO LEADER — ``head_person_id`` unset, so its work andheld sends route to the principal.• WAITING ON YOU IN YOUR OWN INBOX — only on the scheduler's delivery to@@ -42,6 +46,7 @@ logger = logging.getLogger(__name__)FIRST_WEEK = timedelta(days=7)_GOALS_MAX = 8_LEADERLESS_MAX = 6+_PRIORITIES_MAX = 5_INBOX_WINDOW = timedelta(hours=48)# Messages read for their headers, and senders listed._INBOX_SCAN = 12@@ -116,6 +121,41 @@ def _goal_lines(solo: bool = False) -> tuple[list[str], list[str], list[str]]:return goals[:_GOALS_MAX], leaderless[:_LEADERLESS_MAX], keys+def _priority_lines() -> tuple[list[str], list[str]]:+ """(lines, keys) for this year's priorities from the saved profile: what+ the principal said they are working on, before any goal row exists."""+ from openexecutive.onboarding.profile_builder import load_or_create_profile++ priorities = load_or_create_profile().strategic_priorities+ lines: list[str] = []+ keys: list[str] = []+ for item in priorities.current_year:+ text = _one_line(item)+ if text and text not in keys:+ lines.append(f"- {text}")+ keys.append(text)+ north_star = _one_line(priorities.north_star_metric, 90)+ if north_star:+ lines.append(f"- North star: {north_star}")+ keys.append(f"north_star:{north_star}")+ lines = lines[:_PRIORITIES_MAX]+ return lines, [f"priority:{k}" for k in keys[: len(lines)]]+++def _goals_or_priorities(solo: bool) -> tuple[list[str], list[str], list[str], list[str]]:+ """(goals, priorities, leaderless, keys). Priorities only while there are+ no goal rows, so a goal the principal sets replaces them."""+ goals, leaderless, keys = _goal_lines(solo)+ priorities: list[str] = []+ if not goals:+ try:+ priorities, priority_keys = _priority_lines()+ keys += priority_keys+ except Exception:+ logger.warning("first_week: profile priorities unreadable", exc_info=True)+ return goals, priorities, leaderless, keys++async def _inbox_lines(now: datetime) -> tuple[list[str], list[str]]:"""(lines, keys) for who wrote to the principal's own mailbox lately.Empty unless they have Act as me and Draft replies to my inbox on (the@@ -200,10 +240,13 @@ async def _calendar_lines(now: datetime) -> tuple[list[str], list[str]]:def _assemble(goals: list[str], leaderless: list[str], inbox: list[str], keys: list[str], meetings: list[str] | None = None,+ priorities: list[str] | None = None,) -> GettingStarted:parts: list[str] = []if goals:- parts += ["YOUR GOALS (set at onboarding):", *goals]+ parts += ["YOUR GOALS:", *goals]+ if priorities:+ parts += ["YOUR PRIORITIES THIS YEAR (from setup; no goals are set yet):", *priorities]if leaderless:parts += ["DEPARTMENTS WITH NO LEADER (their work and held sends come to the principal "@@ -225,11 +268,11 @@ def getting_started_shared(now: datetime | None = None, *, solo: bool = False) -if first_week_started(now) is None:return GettingStarted()try:- goals, leaderless, keys = _goal_lines(solo)+ goals, priorities, leaderless, keys = _goals_or_priorities(solo)except Exception:logger.warning("first_week: departments unreadable", exc_info=True)return GettingStarted()- return _assemble(goals, leaderless, [], keys)+ return _assemble(goals, leaderless, [], keys, priorities=priorities)async def getting_started(@@ -241,10 +284,10 @@ async def getting_started(if await asyncio.to_thread(first_week_started, now) is None:return GettingStarted()try:- goals, leaderless, keys = await asyncio.to_thread(_goal_lines, solo)+ goals, priorities, leaderless, keys = await asyncio.to_thread(_goals_or_priorities, solo)except Exception:logger.warning("first_week: departments unreadable", exc_info=True)- goals, leaderless, keys = [], [], []+ goals, priorities, leaderless, keys = [], [], [], []inbox: list[str] = []if include_inbox:try:@@ -261,7 +304,7 @@ async def getting_started(except Exception:logger.warning("first_week: the principal's own calendar couldn't be read", exc_info=True)meetings = []- return _assemble(goals, leaderless, inbox, keys, meetings)+ return _assemble(goals, leaderless, inbox, keys, meetings, priorities=priorities)__all__ = [diff --git a/packages/core/tests/unit/test_briefing_first_week.py b/packages/core/tests/unit/test_briefing_first_week.pyindex b520f7cb..2477059e 100644--- a/packages/core/tests/unit/test_briefing_first_week.py+++ b/packages/core/tests/unit/test_briefing_first_week.py@@ -90,6 +90,65 @@ def test_goal_text_is_one_line(setup: SimpleNamespace) -> None:assert "\nNEEDS YOU" not in text+def _profile(priorities: list[str], north_star: str = "") -> Any:+ from openexecutive.memory.company_profile import CompanyProfile, StrategicPriorities++ return CompanyProfile(+ name="Acme", strategic_priorities=StrategicPriorities(current_year=priorities, north_star_metric=north_star),+ )+++def test_a_fresh_install_lists_the_priorities_from_setup(+ setup: SimpleNamespace, monkeypatch: pytest.MonkeyPatch+) -> None:+ # Setup saves no goal rows, so a new install's week has only the profile.+ setup.departments = [_dept("sales", "Sales", head=None)]+ monkeypatch.setattr(+ "openexecutive.onboarding.profile_builder.load_or_create_profile",+ lambda *a, **k: _profile(["Launch same-day delivery", "Launch same-day delivery", ""], "NRR above 110%"),+ )+ block = first_week.getting_started_shared(NOW)+ assert "YOUR PRIORITIES THIS YEAR" in block.text+ assert block.text.count("- Launch same-day delivery") == 1+ assert "- North star: NRR above 110%" in block.text+ assert "YOUR GOALS:" not in block.text+ assert "priority:Launch same-day delivery" in block.keys+ solo = first_week.getting_started_shared(NOW, solo=True)+ assert "YOUR PRIORITIES THIS YEAR" in solo.text and "NO LEADER" not in solo.text+++def test_goal_rows_replace_the_priorities(setup: SimpleNamespace, monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(+ "openexecutive.onboarding.profile_builder.load_or_create_profile",+ lambda *a, **k: _profile(["Launch same-day delivery"]),+ )+ block = first_week.getting_started_shared(NOW)+ assert "YOUR GOALS:" in block.text and "PRIORITIES" not in block.text+++def test_an_unreadable_profile_leaves_the_rest(setup: SimpleNamespace, monkeypatch: pytest.MonkeyPatch) -> None:+ setup.departments = [_dept("sales", "Sales", head=None)]++ def _boom(*a: Any, **k: Any) -> Any:+ raise OSError("gone")++ monkeypatch.setattr("openexecutive.onboarding.profile_builder.load_or_create_profile", _boom)+ block = first_week.getting_started_shared(NOW)+ assert "NO LEADER" in block.text and "PRIORITIES" not in block.text+++async def test_the_brief_block_carries_the_priorities_too(+ setup: SimpleNamespace, monkeypatch: pytest.MonkeyPatch+) -> None:+ setup.departments = []+ monkeypatch.setattr(+ "openexecutive.onboarding.profile_builder.load_or_create_profile",+ lambda *a, **k: _profile(["Land three retainer clients"]),+ )+ block = await first_week.getting_started(include_inbox=False, now=NOW, solo=True)+ assert "- Land three retainer clients" in block.text++class _Mailbox:def __init__(self, messages: list[Any]) -> None:self.messages = {m.id: m for m in messages}diff --git a/packages/ui/scripts/briefingSummary.test.mjs b/packages/ui/scripts/briefingSummary.test.mjsindex f518b333..46498efb 100644--- a/packages/ui/scripts/briefingSummary.test.mjs+++ b/packages/ui/scripts/briefingSummary.test.mjs@@ -89,3 +89,12 @@ test("a collapsed card keeps one status chip: deadline, then stale, then age", (assert.deepEqual(proposalStatusChip({ created_at: created }, now), { label: "2d old", tone: "neutral" });assert.equal(proposalStatusChip({ created_at: "" }, now), null);});++test("the first week's summary line is the brief's move", async () => {+ const { firstWeekMove } = await import("../src/lib/briefingSummary.ts");+ const brief = "**Your first week starts with two leaders to name.**\n\n- **Sales** — no leader yet.\n\n**Move today:** name a leader for **Sales** on People, then ask about [pricing](/x).";+ assert.equal(firstWeekMove(brief), "name a leader for Sales on People, then ask about pricing.");+ assert.equal(firstWeekMove("**Move today: pick the Q4 owner**"), "pick the Q4 owner");+ assert.equal(firstWeekMove("**Quiet right now.**"), null);+ assert.equal(firstWeekMove(null), null);+});diff --git a/packages/ui/scripts/firstRun.test.mjs b/packages/ui/scripts/firstRun.test.mjsindex e7296fbe..6176c7d1 100644--- a/packages/ui/scripts/firstRun.test.mjs+++ b/packages/ui/scripts/firstRun.test.mjs@@ -3,7 +3,10 @@ import test from "node:test";import {checklistComplete,checklistProgress,+ checklistVisible,+ firstQuestion,gettingStartedItems,+ OWN_MAILBOX_SENDS,shouldRedirectToOnboard,} from "../src/lib/firstRun.ts";@@ -73,3 +76,31 @@ test("a team adds the roster row, and the optional row never blocks completion",assert.equal(checklistComplete(items), true);assert.deepEqual(checklistProgress(items), { done: 4, total: 4 });});++test("the first question comes from what setup saved", () => {+ assert.equal(+ firstQuestion({ current_year: [" ", "Launch same-day delivery.", "Hire a CFO"], north_star_metric: "NRR" }, false),+ 'Where should I start this week on "Launch same-day delivery"?',+ );+ assert.equal(firstQuestion({ current_year: [], north_star_metric: "NRR above 110%" }, true),+ 'Where should I start this week on "NRR above 110%"?');+ assert.equal(firstQuestion(null, true), "What should I focus on this week?");+ assert.equal(firstQuestion({ current_year: [] }, false), "What should the team focus on this week?");+ assert.ok(firstQuestion({ current_year: ["x".repeat(500)] }, true).length < 220);+});++test("the mailbox row says when it sends", () => {+ const items = gettingStartedItems(base);+ const own = items.find((i) => i.id === "own_mailbox");+ assert.ok(own.detail.includes(OWN_MAILBOX_SENDS));+ assert.ok(!/never sends/i.test(own.detail));+});++test("the checklist waits for every answer, so it never flashes", () => {+ const open = gettingStartedItems(base);+ assert.equal(checklistVisible({ hidden: false, loaded: false, items: open }), false);+ assert.equal(checklistVisible({ hidden: false, loaded: true, items: open }), true);+ assert.equal(checklistVisible({ hidden: true, loaded: true, items: open }), false);+ const done = open.map((i) => ({ ...i, done: true }));+ assert.equal(checklistVisible({ hidden: false, loaded: true, items: done }), false);+});diff --git a/packages/ui/src/app/page.tsx b/packages/ui/src/app/page.tsxindex 9f486497..f136bbb7 100644--- a/packages/ui/src/app/page.tsx+++ b/packages/ui/src/app/page.tsx@@ -20,6 +20,7 @@ import PausedBanner from "@/components/executive/PausedBanner";import OverflowMenu from "@/components/ui/OverflowMenu";import { ChatMessage, DebugEvent, getSessionMessages, updateSession } from "@/lib/api";import { downloadChat } from "@/lib/downloadChat";+import { recall, remember, STORAGE_KEYS } from "@/lib/firstRun";import { sessionTitle } from "@/lib/sessionChannel";import Link from "next/link";import { useRouter } from "next/navigation";@@ -170,6 +171,16 @@ export default function HomePage() {const params = new URLSearchParams(window.location.search);const sessionParam = params.get("session");const draftParam = params.get("draft");+ // The last setup screen's first question: asked once, as if typed here.+ // It comes from session storage the setup screen wrote, never from the+ // URL, so it is the person's own and may send without a second tap.+ const firstQuestion = recall(STORAGE_KEYS.firstQuestion);+ if (firstQuestion) {+ remember(STORAGE_KEYS.firstQuestion, null);+ handleContinueFromBriefing(firstQuestion.slice(0, MAX_DRAFT_PARAM_CHARS));+ if (params.toString()) router.replace("/");+ return;+ }if (params.get("new") === "1") {handleNewChat();if (draftParam) {@@ -185,7 +196,7 @@ export default function HomePage() {};router.replace("/");}- }, [handleNewChat, router]);+ }, [handleNewChat, handleContinueFromBriefing, router]);useEffect(() => {const pending = deepLinkRef.current;diff --git a/packages/ui/src/components/Briefing.tsx b/packages/ui/src/components/Briefing.tsxindex 02b5742a..9a2134d4 100644--- a/packages/ui/src/components/Briefing.tsx+++ b/packages/ui/src/components/Briefing.tsx@@ -18,7 +18,8 @@ import {type Today,} from "@/lib/api";import type { AlertApproval } from "@/lib/approvals";-import { briefingSummary, greeting, type SummaryPart } from "@/lib/briefingSummary";+import { briefingSummary, firstWeekMove, greeting, type SummaryPart } from "@/lib/briefingSummary";+import { FIRST_RUN_LINKS } from "@/lib/firstRun";import { principalIdOf } from "@/lib/dueSoon";import { groupHandled } from "@/lib/handled";import {@@ -659,6 +660,13 @@ export default function Briefing({ onContinue, showHeader = false, firstName, baconst showNeedsYouMenu = staleNeedsYouIds.length > 0 || mineProposals.length > 0;const hasBrief = Boolean(today && (today.narrative || today.narrative_stale));+ // The first week (GETTING STARTED in the brief): the brief is the most+ // useful thing on the page, so it opens in the page rather than behind+ // "Read today's brief", and an empty summary line reads its move instead+ // of "All clear".+ const firstWeek = Boolean(today?.first_week);+ const firstWeekBrief = firstWeek && hasBrief;+ const move = firstWeek ? firstWeekMove(today?.narrative) : null;const briefFreshness = today? today.narrative_stale? "Refreshing…"@@ -707,7 +715,15 @@ export default function Briefing({ onContinue, showHeader = false, firstName, ba{today && (<p className="mt-2 text-base sm:text-lg text-fg-muted leading-snug">{summary.length === 0- ? "All clear — nothing needs you right now."+ ? move+ ? (+ <>+ <span className="font-semibold text-fg">Move today:</span> {move}+ </>+ )+ : firstWeek+ ? "Your first week. The brief below says where to start."+ : "All clear — nothing needs you right now.": summary.map((part, i) => (<span key={part.text}>{part.target.kind === "href" ? (@@ -764,6 +780,30 @@ export default function Briefing({ onContinue, showHeader = false, firstName, ba</div>)}+ {today && firstWeekBrief && (+ <section+ aria-labelledby="sec-getting-started-brief"+ className="mb-6 rounded-2xl border border-accent/25 bg-accent/5 px-4 py-3 sm:px-5"+ >+ <div className="mb-1 flex flex-wrap items-baseline justify-between gap-x-3">+ <h2+ id="sec-getting-started-brief"+ className="text-xs font-semibold uppercase tracking-wider text-accent"+ >+ Getting started · your first week+ </h2>+ {briefFreshness && <span className="text-xs text-fg-muted">{briefFreshness}</span>}+ </div>+ <NarrativeBody+ narrative={today.narrative}+ stale={today.narrative_stale ?? false}+ solo={solo}+ onContinue={onContinue}+ intro={false}+ />+ </section>+ )}+{bannerSlot && <div className="mb-6">{bannerSlot}</div>}{today && (@@ -779,7 +819,7 @@ export default function Briefing({ onContinue, showHeader = false, firstName, ba{replies.cards.length > 0 && <InfoTip align="left">{REPLIES_WAITING_TIP}</InfoTip>}{actionCards.cards.length > 0 && <InfoTip align="left">{ACTION_CARDS_TIP}</InfoTip>}<div className="ml-auto flex items-center gap-1">- {hasBrief && (+ {hasBrief && !firstWeekBrief && (<buttontype="button"onClick={() => setOpenPanel("brief")}@@ -847,9 +887,17 @@ export default function Briefing({ onContinue, showHeader = false, firstName, ba</div>)}</div>+ ) : firstWeek ? (+ <p className="rounded-2xl border border-dashed border-line px-4 py-5 text-[15px] text-fg-muted">+ Nothing waiting on you yet. Decisions and replies to send land here.{" "}+ <Link href={FIRST_RUN_LINKS.ownMailbox} className="font-medium text-accent hover:underline">+ Let it read your mailbox+ </Link>{" "}+ to get draft replies here.+ </p>) : !isQuiet ? (<p className="rounded-2xl border border-dashed border-line px-4 py-5 text-[15px] text-fg-muted">- Nothing waiting on you.+ Nothing waiting on you. Decisions and replies to send land here.</p>) : null}</section>@@ -947,7 +995,10 @@ export default function Briefing({ onContinue, showHeader = false, firstName, ba/>))}{otherProposals.length === 0 && (- <p className="text-[15px] text-fg-muted">Nothing waiting on anyone else.</p>+ <p className="text-[15px] text-fg-muted">+ Nothing waiting on anyone else.+ {today.people.length <= 1 && " Add your team on People to see their work here."}+ </p>)}</div></SidePanel>diff --git a/packages/ui/src/components/briefing/Narrative.tsx b/packages/ui/src/components/briefing/Narrative.tsxindex ca445685..19b0dccf 100644--- a/packages/ui/src/components/briefing/Narrative.tsx+++ b/packages/ui/src/components/briefing/Narrative.tsx@@ -27,26 +27,32 @@ export default function NarrativeBody({stale,solo,onContinue,+ intro = true,}: {narrative: string | null | undefined;stale: boolean;solo: boolean;onContinue?: ContinueHandler;+ /** The side panel's explanation of what the brief is; off where the brief+ * sits in the page under its own heading. */+ intro?: boolean;}) {if (!narrative) {return (<div aria-live="polite" className="rounded-xl bg-accent/5 px-4 py-3 text-[15px] text-fg-muted animate-pulse">- {stale ? "Catching up on today…" : "No brief yet today."}+ {stale ? "Writing today's brief…" : "No brief yet today. A new one is written every morning."}</div>);}return (<>+ {intro && (<PanelIntro>The Executive's read on {solo ? "your work" : "the company"} right now — what came in today, what'sstuck, what's next on your calendar, plus proposals and at-risk goals. Rewritten as the picture changes.{onContinue && " Tap a point to talk it through."}</PanelIntro>+ )}<div className="prose prose-invert max-w-none text-[15px] prose-p:my-2 prose-ul:my-2 prose-headings:text-fg prose-strong:text-fg"><ReactMarkdownremarkPlugins={[remarkGfm]}diff --git a/packages/ui/src/components/onboard/ExecEmailRow.tsx b/packages/ui/src/components/onboard/ExecEmailRow.tsxnew file mode 100644index 00000000..f9647833--- /dev/null+++ b/packages/ui/src/components/onboard/ExecEmailRow.tsx@@ -0,0 +1,24 @@+"use client";++import Link from "next/link";+import { FIRST_RUN_LINKS } from "@/lib/firstRun";++// The last setup screen's line about the Executive's own email: an account+// just for it, which it reads, sends and keeps a calendar as. Its own file so+// a deployment that gives every Executive an address can say that instead.+export default function ExecEmailRow() {+ return (+ <li className="flex items-baseline gap-3 border-b border-line py-3 last:border-0">+ <span aria-hidden className="w-5 flex-shrink-0 text-center">+ ✉+ </span>+ <p className="min-w-0 text-[15px] text-fg-muted leading-snug">+ <span className="font-semibold text-fg">Give it its own email.</span> A Google or Microsoft account just+ for it, so it can send, keep a calendar and email your morning brief.{" "}+ <Link href={FIRST_RUN_LINKS.execMailbox} className="font-semibold text-accent hover:underline">+ Connect its account+ </Link>+ </p>+ </li>+ );+}diff --git a/packages/ui/src/components/onboard/GettingStarted.tsx b/packages/ui/src/components/onboard/GettingStarted.tsxindex c7ac22c4..fba420fb 100644--- a/packages/ui/src/components/onboard/GettingStarted.tsx+++ b/packages/ui/src/components/onboard/GettingStarted.tsx@@ -7,7 +7,7 @@ import { buttonClass } from "@/components/ui/Button";import { useWorkspace } from "@/components/workspace/WorkspaceContext";import { getSetupStatus, listPeople } from "@/lib/api";import {- checklistComplete,+ checklistVisible,checklistProgress,gettingStartedItems,recall,@@ -36,6 +36,7 @@ export function useGettingStarted(const { mode } = useWorkspace();const [checks, setChecks] = useState<readonly SetupCheck[] | null>(null);const [teamSize, setTeamSize] = useState<number>(1);+ const [peopleLoaded, setPeopleLoaded] = useState(false);// Read once, on the client: the card only renders after /health answers.const [hidden, setHidden] = useState<boolean>(() => recall(STORAGE_KEYS.checklistHidden) === "1");@@ -47,7 +48,8 @@ export function useGettingStarted(.catch(() => setChecks([]));listPeople().then((ps) => setTeamSize(ps.length))- .catch(() => undefined);+ .catch(() => undefined)+ .finally(() => setPeopleLoaded(true));return () => ctrl.abort();}, [hidden, profileLoaded]);@@ -68,8 +70,11 @@ export function useGettingStarted(setHidden(true);}, []);- const visible =- !hidden && profileLoaded !== undefined && !(checks !== null && checklistComplete(items));+ const visible = checklistVisible({+ hidden,+ loaded: profileLoaded !== undefined && checks !== null && sessionsLoaded && peopleLoaded,+ items,+ });return { items, visible, hide };}diff --git a/packages/ui/src/components/onboard/OnboardDone.tsx b/packages/ui/src/components/onboard/OnboardDone.tsxindex a6dd874b..b82c483f 100644--- a/packages/ui/src/components/onboard/OnboardDone.tsx+++ b/packages/ui/src/components/onboard/OnboardDone.tsx@@ -1,69 +1,64 @@"use client";import Link from "next/link";-import { useEffect, useState } from "react";+import { useEffect, useRef, useState } from "react";+import ExecEmailRow from "@/components/onboard/ExecEmailRow";import { buttonClass } from "@/components/ui/Button";-import { listDepartments, listPeople, type Person } from "@/lib/api";-import { FIRST_RUN_LINKS } from "@/lib/firstRun";+import { getCompanyProfile, listPeople } from "@/lib/api";+import { FIRST_RUN_LINKS, OWN_MAILBOX_SENDS, STORAGE_KEYS, firstQuestion, remember } from "@/lib/firstRun";interface Props {- /** Personal (one person) or a team; sets which rows are shown. */+ /** Personal (one person) or a team; sets the wording. */solo: boolean;/** Opens Home. */onDone: () => void;}-// The last setup screen: what was saved, then the two connections that make-// the Executive useful, each explained as its own thing. The first is the-// Executive's own account (it reads, sends and keeps a calendar as that-// account, and the morning brief comes from it). The second is the owner's-// own mailbox for Act as me, which is optional. Both are also on the-// getting-started checklist on Home, so skipping here loses nothing.+// The last setup screen ends on a conversation: one question, built from the+// priorities setup just saved, which Home asks as soon as it opens (handed+// over in session storage, never the URL, so a link can't make someone ask+// something). Under it, what the Executive can already do, written as things+// to try: its own email, the brief, drafting replies as you. The connections+// are also rows on Home's getting-started checklist, so nothing is lost by+// asking first.export default function OnboardDone({ solo, onDone }: Props) {const [companyName, setCompanyName] = useState<string | null>(null);- const [owner, setOwner] = useState<Person | null>(null);const [peopleCount, setPeopleCount] = useState<number | null>(null);- const [departmentCount, setDepartmentCount] = useState<number | null>(null);+ const [question, setQuestion] = useState<string>(() => firstQuestion(null, solo));+ // Set once they type: a profile that loads late must not overwrite them.+ const edited = useRef(false);useEffect(() => {let cancelled = false;- fetch("/api/backend/health")- .then((r) => r.json())- .then((h: { company_name?: string }) => {- if (!cancelled) setCompanyName(h.company_name?.trim() || null);+ getCompanyProfile()+ .then((p) => {+ if (cancelled) return;+ setCompanyName(p.name?.trim() || null);+ if (!edited.current) setQuestion(firstQuestion(p.strategic_priorities, solo));}).catch(() => undefined);listPeople().then((ps) => {- if (cancelled) return;- setOwner(ps.find((p) => p.is_principal) ?? null);- setPeopleCount(ps.length);+ if (!cancelled) setPeopleCount(ps.length);}).catch(() => undefined);- if (!solo) {- listDepartments()- .then((ds) => {- if (!cancelled) setDepartmentCount(ds.length);- })- .catch(() => undefined);- }return () => {cancelled = true;};}, [solo]);- const rows: [string, string][] = [];- if (companyName) rows.push([solo ? "Your work" : "Company", companyName]);- if (owner) {- rows.push(["You", [owner.full_name, owner.role].filter(Boolean).join(", ")]);- if (owner.email) rows.push(["Sign-in", owner.email]);- }- if (!solo && peopleCount !== null) {- const parts = [`${peopleCount} ${peopleCount === 1 ? "person" : "people"}`];- if (departmentCount !== null) {- parts.push(`${departmentCount} ${departmentCount === 1 ? "department" : "departments"}`);- }- rows.push(["Team", parts.join(", ")]);+ const knows = [+ companyName,+ !solo && peopleCount !== null && peopleCount > 1 ? `your ${peopleCount} people` : null,+ "this year's priorities",+ ].filter(Boolean) as string[];+ const knowsLine = `It knows ${knows.length > 1 ? `${knows.slice(0, -1).join(", ")} and ${knows[knows.length - 1]}` : knows[0]}.`;++ function ask() {+ const text = question.trim();+ if (!text) return;+ remember(STORAGE_KEYS.firstQuestion, text);+ onDone();}return (@@ -72,82 +67,76 @@ export default function OnboardDone({ solo, onDone }: Props) {✓</div><h1 className="mt-3 text-2xl font-bold tracking-tight text-fg">Your Executive is ready</h1>- <p className="text-sm text-fg-muted mt-1">- Here is what was saved. Everything stays editable in Settings.- </p>-- {rows.length > 0 && (- <dl className="mt-6 rounded-2xl border border-line bg-surface-elevated px-4 py-1">- {rows.map(([k, v]) => (- <div- key={k}- className="flex justify-between gap-4 py-3 text-[15px] border-b border-line last:border-0"- >- <dt className="text-fg-muted">{k}</dt>- <dd className="text-fg text-right">{v}</dd>- </div>- ))}- </dl>- )}-- <h2 className="mt-8 text-xs font-semibold uppercase tracking-wider text-fg-subtle">- Two accounts, two jobs- </h2>+ <p className="text-sm text-fg-muted mt-1">{knowsLine} Everything stays editable in Settings.</p>- <section className="mt-3 rounded-2xl border border-line bg-surface-overlay p-4">- <div className="flex items-start gap-3">- <span className="flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg bg-fg text-fg-inverse text-sm font-bold">- 1- </span>- <div className="min-w-0">- <h3 className="text-[15px] font-semibold text-fg">Give your Executive its own email</h3>- <p className="mt-1 text-sm text-fg-muted leading-snug">- A Google or Microsoft account just for it, like [email protected]. Free Gmail or- Outlook.com works. It reads, sends and keeps a calendar as that account, and your- morning brief comes from it.- </p>- </div>- </div>- <div className="mt-3">- <Link href={FIRST_RUN_LINKS.execMailbox} className={buttonClass("primary", "md")}>- Connect its account- </Link>+ <form+ onSubmit={(e) => {+ e.preventDefault();+ ask();+ }}+ className="mt-6 rounded-2xl border border-accent/30 bg-accent/5 p-4"+ >+ <label htmlFor="first-question" className="text-xs font-semibold uppercase tracking-wider text-accent">+ Start here+ </label>+ <textarea+ id="first-question"+ value={question}+ onChange={(e) => {+ edited.current = true;+ setQuestion(e.target.value);+ }}+ onKeyDown={(e) => {+ if (e.key === "Enter" && !e.shiftKey) {+ e.preventDefault();+ ask();+ }+ }}+ rows={2}+ className="mt-2 w-full resize-none rounded-xl border border-line-strong bg-surface-elevated px-3 py-2 text-[15px] text-fg focus:outline-none focus:ring-2 focus:ring-accent/40"+ />+ <p className="mt-1 text-xs text-fg-muted">+ Built from what you just saved. Change it, or ask anything else.+ </p>+ <div className="mt-3 flex flex-wrap items-center gap-x-4 gap-y-2">+ <button type="submit" disabled={!question.trim()} className={buttonClass("primary", "md")}>+ Ask your first question+ </button>+ <button+ type="button"+ onClick={onDone}+ className="text-sm font-semibold text-accent hover:underline cursor-pointer"+ >+ Open Home instead+ </button></div>- </section>+ </form>- <section className="mt-3 rounded-2xl border border-line bg-surface-overlay p-4">- <div className="flex items-start gap-3">- <span className="flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg bg-fg text-fg-inverse text-sm font-bold">- 2+ <h2 className="mt-8 text-xs font-semibold uppercase tracking-wider text-fg-subtle">It can already</h2>+ <ul className="mt-2 rounded-2xl border border-line bg-surface-elevated px-4">+ <ExecEmailRow />+ <li className="flex items-baseline gap-3 border-b border-line py-3 last:border-0">+ <span aria-hidden className="w-5 flex-shrink-0 text-center">+ ☀</span>- <div className="min-w-0">- <h3 className="text-[15px] font-semibold text-fg">- Let it read your own mailbox{" "}- <span className="ml-1 rounded-full border border-accent/30 bg-accent/10 px-2 py-0.5 text-xs font-semibold text-accent">- Optional- </span>- </h3>- <p className="mt-1 text-sm text-fg-muted leading-snug">- Your Gmail or Outlook, read only. It drafts replies as you and never sends them.- </p>- </div>- </div>- <div className="mt-3">- <Link href={FIRST_RUN_LINKS.ownMailbox} className={buttonClass("secondary", "md")}>- Connect my mailbox- </Link>- </div>- </section>-- <p className="mt-8">- <button- type="button"- onClick={onDone}- className="text-sm font-semibold text-accent hover:underline cursor-pointer"- >- Skip for now, open Home →- </button>- </p>+ <p className="min-w-0 text-[15px] text-fg-muted leading-snug">+ <span className="font-semibold text-fg">Brief you.</span> Your first brief is on Home now, and a new one+ is written every morning.+ </p>+ </li>+ <li className="flex items-baseline gap-3 border-b border-line py-3 last:border-0">+ <span aria-hidden className="w-5 flex-shrink-0 text-center">+ ✎+ </span>+ <p className="min-w-0 text-[15px] text-fg-muted leading-snug">+ <span className="font-semibold text-fg">Draft replies as you.</span>{" "}+ <Link href={FIRST_RUN_LINKS.ownMailbox} className="font-semibold text-accent hover:underline">+ Let it read your own mailbox+ </Link>+ . {OWN_MAILBOX_SENDS}+ </p>+ </li>+ </ul></div>);}diff --git a/packages/ui/src/lib/briefingSummary.ts b/packages/ui/src/lib/briefingSummary.tsindex 210d45af..2bcdf57b 100644--- a/packages/ui/src/lib/briefingSummary.ts+++ b/packages/ui/src/lib/briefingSummary.ts@@ -121,3 +121,19 @@ export function proposalStatusChip(const age = ageLabel(p.created_at, now);return age ? { label: `${age} old`, tone: "neutral" } : null;}++/** The line the summary under the greeting shows in the first week: the+ * brief's "**Move today:**" line (the header prompt always ends on one), as+ * plain text, so day one opens on a move rather than "All clear". Null when+ * the brief has no such line or none has been written yet. */+export function firstWeekMove(narrative: string | null | undefined): string | null {+ if (!narrative) return null;+ for (const raw of narrative.split("\n")) {+ const line = raw.replace(/^[\s>*-]*(?=\*\*)/, "").trim();+ const m = /^\*\*\s*Move today:?\s*\*\*:?\s*(.+)$/i.exec(line) ?? /^\*\*\s*Move today:\s*(.+?)\*\*\s*$/i.exec(line);+ if (!m) continue;+ const text = m[1].replace(/\*\*|__|`/g, "").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\s+/g, " ").trim();+ if (text) return text;+ }+ return null;+}diff --git a/packages/ui/src/lib/firstRun.ts b/packages/ui/src/lib/firstRun.tsindex 691ee6b7..d4830921 100644--- a/packages/ui/src/lib/firstRun.ts+++ b/packages/ui/src/lib/firstRun.ts@@ -14,6 +14,8 @@ export const STORAGE_KEYS = {description: "oe.onboard.description",later: "oe.onboard.later",checklistHidden: "oe.gettingStarted.hidden",+ // The question the last setup screen hands to Home, which asks it once.+ firstQuestion: "oe.onboard.firstQuestion",} as const;type Where = "local" | "session";@@ -21,7 +23,11 @@ type Where = "local" | "session";// The description is the one thing here that is the person's own words// (it becomes the first interview turn, financials and all), so it lives in// sessionStorage: gone with the tab, never synced.-const WHERE: Record<string, Where> = { [STORAGE_KEYS.description]: "session" };+const WHERE: Record<string, Where> = {+ [STORAGE_KEYS.description]: "session",+ // Built from their own priorities, and asked on the next page load only.+ [STORAGE_KEYS.firstQuestion]: "session",+};function storage(key: string): Storage | null {try {@@ -60,6 +66,29 @@ export function clearSetupMemory(): void {remember(STORAGE_KEYS.later, null);}+/** What reading your own mailbox does, in the one wording every screen uses:+ * Handle it for me can send, so "never sends" would be untrue. */+export const OWN_MAILBOX_SENDS = "Drafts replies as you. Sends only if you turn on Handle it for me.";++const FIRST_QUESTION_MAX = 160;++/**+ * The first question the last setup screen offers, built from what setup+ * just saved: the first of this year's priorities, else the north star,+ * else a general opener. The person can edit it before it is asked.+ */+export function firstQuestion(+ priorities: { current_year?: readonly string[] | null; north_star_metric?: string | null } | null | undefined,+ solo: boolean,+): string {+ const tidy = (v: string | null | undefined) => (v ?? "").replace(/\s+/g, " ").trim().replace(/[.!?]+$/, "");+ const first = (priorities?.current_year ?? []).map(tidy).find(Boolean);+ const star = tidy(priorities?.north_star_metric);+ const pick = (first || star).slice(0, FIRST_QUESTION_MAX).trim();+ if (pick) return `Where should I start this week on "${pick}"?`;+ return solo ? "What should I focus on this week?" : "What should the team focus on this week?";+}+export interface RedirectInput {/** `company_profile_loaded` from /health; undefined while unknown. */profileLoaded: boolean | undefined;@@ -155,7 +184,7 @@ export function gettingStartedItems(input: ChecklistInput): ChecklistItem[] {{id: "own_mailbox",title: "Let it read your own mailbox",- detail: "Optional. Drafts replies as you, never sends.",+ detail: `Optional. ${OWN_MAILBOX_SENDS}`,done: ownMail === "ok",optional: true,href: FIRST_RUN_LINKS.ownMailbox,@@ -189,3 +218,17 @@ export function checklistProgress(items: readonly ChecklistItem[]): { done: numbexport function checklistComplete(items: readonly ChecklistItem[]): boolean {return items.every((i) => i.optional || i.done);}++/**+ * Whether Home shows the checklist: only once every answer it depends on is+ * in. Drawn while they load, the rows read as not done and the card flashes+ * up for someone whose setup is finished, then vanishes.+ */+export function checklistVisible(input: {+ hidden: boolean;+ /** /health, /setup/status, the sessions and the roster have all answered. */+ loaded: boolean;+ items: readonly ChecklistItem[];+}): boolean {+ return !input.hidden && input.loaded && !checklistComplete(input.items);+}