AI-powered virtual executive team — a single coherent executive persona backed by 8 specialist agents (FastAPI + Next.js).
fix(briefing): name waiting drafts and say what approved app cards did (#558)
Rufus80bfc740ca41
diff --git a/packages/core/openexecutive/api/routes/today.py b/packages/core/openexecutive/api/routes/today.pyindex e8970d52..0d5f69da 100644--- a/packages/core/openexecutive/api/routes/today.py+++ b/packages/core/openexecutive/api/routes/today.py@@ -1098,6 +1098,51 @@ def _payload_headline(payload_json: str | None) -> str | None:return None+def _app_action_summary(instance: Any) -> str | None:+ """What a card left from chat (``orchestrator.app_control``) did, in its+ own words ("Deleted the department “Finance”"), or what it would have+ done ("Turned down: Delete the department “Finance”"). "" for a card on+ something private to its person (left off the feed); None for any other+ decision class. Its payload's title is only the item's name, so the+ generic "Approved: Finance" read as the Executive approving a decision."""+ from openexecutive.orchestrator.app_control import DECISION_CLASS++ if instance.decision_class != DECISION_CLASS:+ return None+ final = _payload_dict(instance.final_payload_json)+ proposed = _payload_dict(instance.proposed_payload_json)+ if not _team_visible_app_action(str(proposed.get("action") or "")):+ return "" # names something private (a chat, a file, a memory): left out+ did = final.get("did")+ if isinstance(did, str) and did.strip() and instance.status in _APPROVED_STATUSES:+ return f"{did.strip()} (asked for in chat, approved on its card)"+ card = final.get("card") or proposed.get("card") or proposed.get("title") or "a change from chat"+ if instance.status in _APPROVED_STATUSES:+ verb = "Done"+ else:+ verb = {"rejected": "Turned down", "failed": "Didn't go through"}.get(instance.status, "Not done")+ return f"{verb}: {str(card).strip()}"+++_APPROVED_STATUSES = frozenset({"approved_unchanged", "approved_with_edit", "executed"})++# Cards whose item the whole team may see by name (``app_control_catalog``);+# the rest (a chat's title, a file, a memory) stay off this shared feed.+_TEAM_VISIBLE_APP_ACTIONS = frozenset({"add_department", "rename_department", "delete_department"})+++def _team_visible_app_action(action_name: str) -> bool:+ return action_name in _TEAM_VISIBLE_APP_ACTIONS+++def _payload_dict(payload_json: str | None) -> dict[str, Any]:+ try:+ data = json.loads(payload_json or "")+ except (json.JSONDecodeError, TypeError):+ return {}+ return data if isinstance(data, dict) else {}++# The Executive's own daily rhythm runs. Each lands as a dated# "workflow_done: Executive Reflection 2026-09-28" row every day: fine on the# rail, but noise to the header and the briefs (and the dated title moved the@@ -1279,6 +1324,19 @@ def _build_activity(if instance.decision_class == DEPARTMENT_ACTION_CLASS:continue # it quotes a teammate's conversation; the audit log keeps who approved itlabel = _DECISION_STATUS_LABEL.get(instance.status, "Resolved")+ app_action = _app_action_summary(instance)+ if app_action == "":+ continue+ if app_action is not None:+ items.append(ActivityItem(+ kind="decision_resolved",+ summary=app_action,+ actor="Executive",+ target=None,+ department=instance.department or None,+ at=instance.resolved_at or instance.created_at,+ ))+ continuedetail = (_payload_headline(instance.final_payload_json)or _payload_headline(instance.proposed_payload_json)diff --git a/packages/core/openexecutive/architecture/prebuilt/today.json b/packages/core/openexecutive/architecture/prebuilt/today.jsonindex 5eeefa13..facbc035 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. The chat's alert digest (`briefing.context.render_and_trust`) shows it, and the roster requests, only on the principal's own verified turn, never in a web chat they shared with others, where everyone reads the reply. `_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- **Raised by a team member.** An alert a team member raised from chat (`AlertEvent.raised_by`, source `team_member`) has its body led by \"Raised by <name>.\" and never goes out on `company_broadcast`: the pipeline drops that channel after `resolve_channels`, so it reaches a person or a department room only. One team member's alert never coalesces into another's (the dedup key is prefixed with who raised it). A team member's saved workflow raises alerts as its creator (`action_step` binds `dynamic_store.get_owner` around `oe__create_alert`). Alerts from email, watches and other sources are unchanged.\n- **Who clears a card.** `POST /alerts/{id}/ack` with `ack` or `dismissed` answers 403 to a team member unless the alert is routed to them (`read` is open to anyone who can see it); only the principal's dismiss applies `mute_topic`, since a mute silences the topic for everyone. `POST /alerts/bulk-ack` from a team member clears only the listed ids routed to them and refuses an `older_than_days` sweep. The principal, or anyone before a principal is set up, clears anything. `ack_alert` in chat follows the same rule.\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, one per message id, grouped by sender and subject, with an email's first line; the principal's own mail reads \"from the principal\", an email from the roster says \"the Executive replied\" only when a reply was logged in its thread after it (`unanswered_mail.record_reply`) and \"no reply went out\" while its `unanswered_mail` card is open (on the principal's own read only), and a time on another day carries its weekday and date), **STUCK** (`integration_outbound_blocked` to a recipient, the inbound \"reply blocked at outbound gate\" and Google Chat \"left unanswered\" / \"not delivered\" rows, and chat drafts Act as me saved in the principal's mailbox that are still there: `delegation_drafts` rows not yet marked sent or `gone_at`; before each scheduled header refresh and each morning brief, `live_signals.settle_principal_drafts` looks up the principal's open chat drafts from the last two days in their mailbox and marks the ones sent or deleted there, so a draft they sent from Gmail stops reading as waiting), **CONVERSATIONS** (the principal's own web chat titles), **OWN** (the principal's own mail and chat-app messages to the Executive, kept out of INBOUND and its count, principal scope only) and the **REST OF TODAY'S CALENDAR**. The principal's own messages and chats render as background blocks, and every brief prompt carries `OWN_MESSAGES_RULE`: they show what the reader already said and asked, are never reported back as news (no \"you messaged me\", no restated complaint or rating), and an open ask appears only as what the Executive is doing about it. 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 **Who reads it.** Every brief surface (this header, the morning brief, the end-of-day digest) is written for one person, fixed in code by `briefing.reader`: the principal on the principal scope, the teammate on a `person:<id>` scope, and the principal on `company` too (that scope has no signed-in caller and uses the principal's prompt, built from shared rows only). `render_briefing_context(reader=…)` masks that person's full name and email addresses everywhere in the context to \"the reader\" (their own chat and mail, the Executive's replies to them, chat titles, the activity rail) and heads it with a **THE READER** line naming them; every brief prompt carries `READER_NAME_RULE`: write \"you\", never the reader's name, \"the reader\" or \"the principal\" (anyone else by name), and \"I\" / \"me\" / \"my\" for the Executive. A draft that still slips (`reader.slips`) is sent back once to be rewritten, and what is left after that is fixed in code (`reader.fix_slips`: the reader → you/your, \"the principal\" → the owner's name on a teammate's brief, the Executive → I/me/my).\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 33 s timeout: 25 s for the draft and 8 s for a rewrite, 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**From your chats.** `briefing.brief_requests` holds what the principal asked of their brief in conversation: `leave_out` lines from `leave_out_of_brief` (\"take the Halcyon renewal out of my brief\", kept 14 days) and `raise` lines the conversation review could not fix itself (`raise_in_brief`, kept 2 days), at most 20 live. A line is at most 12 words (leave out) or 30 (raise), with no link, handle, markup, identifier or talk of instructions, and only lines written under the principal's own id render. `render_briefing_context(brief_requests=True)` adds the raise lines before the quiet-day check, so they are raised even on a quiet day, and the leave-out list as the very last block; both sit inside the rendered string the /today header hashes. A teammate's brief or header passes `False`: they are the principal's own words.\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. Every brief prompt (this header, the teammate header, the morning brief and the end-of-day digest) carries `narrative.STANDING_FACTS_RULE`: use the facts quietly, never mention one or that it was saved, and leave an item a fact settles out without saying it was dropped. A fact settles only what it plainly says. Without it, a fact saved in chat came back as the header's top point, stretched to an item it never named. 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 /today header does not get the block: in the first week it is the same header as any other day. Home's top slot is instead the **first-week card**, built in code with no model call (`first_week.first_week_card`): `needs_goal` while no goal row exists (fixed ask \"Give me one goal with a date, and I'll track it every day.\" and a **Set a goal** button to `/goals?add=1`, which opens the add form), up to two findings from the latest finished team `executive_research` run (the run history keeps only the artifact, so `executive_research.parse_artifact_findings` reads back its \"Findings reviewed\" lines; most severe and most certain first, headline plus the summary's first sentence) with a line linking `/watchlist`, and `brief_tomorrow` on the setup day until the first morning brief is delivered. No goal still to set and no findings means no card. `GET /today` sets `first_week_card` and `first_week` (whether there is a card) for the principal only; while there is one the Briefing hides the \"Quiet day\" banner and an all-zero summary line reads \"Your first week. Start below.\" 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. A brief or digest delivered to its reader (`scheduler.runner._deliver_to_principal`) records its send as kind `brief_delivery` (`schedule_tools.recorded_as`): the outbound guard still counts it, but the rail and the heatmap leave it out, because every later brief reads the rail and used to repeat its own last top call as work done. A completed run is named in plain words, never by its log title (`workflows/run_outcome.py`: \"Researched your market\", \"Checked in with Sales\", or the name it was started with, less any date or how-it-started note), and carries `detail`, one line on what came of it read from its stored artifact (research: updates looked at, messages sent, alerts raised, things now watched; a check-in: actions proposed; the weekly review: next week's top item; other runs: the first sentence; none for briefs and the reflection), and `artifact_id` (`run:<id>`) when it kept a write-up (never for the reflection, which reads the principal's live alerts), so Pulse's Done for you and All activity link **Read it** to `/artifacts/run:<id>`. 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 the top line of the overview's **Done for you** panel (\"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. The chat's alert digest (`briefing.context.render_and_trust`) shows it, and the roster requests, only on the principal's own verified turn, never in a web chat they shared with others, where everyone reads the reply. `_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- **Raised by a team member.** An alert a team member raised from chat (`AlertEvent.raised_by`, source `team_member`) has its body led by \"Raised by <name>.\" and never goes out on `company_broadcast`: the pipeline drops that channel after `resolve_channels`, so it reaches a person or a department room only. One team member's alert never coalesces into another's (the dedup key is prefixed with who raised it). A team member's saved workflow raises alerts as its creator (`action_step` binds `dynamic_store.get_owner` around `oe__create_alert`). Alerts from email, watches and other sources are unchanged.\n- **Who clears a card.** `POST /alerts/{id}/ack` with `ack` or `dismissed` answers 403 to a team member unless the alert is routed to them (`read` is open to anyone who can see it); only the principal's dismiss applies `mute_topic`, since a mute silences the topic for everyone. `POST /alerts/bulk-ack` from a team member clears only the listed ids routed to them and refuses an `older_than_days` sweep. The principal, or anyone before a principal is set up, clears anything. `ack_alert` in chat follows the same rule.\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. On the principal's own verified turn the digest also lists their chat drafts still waiting in their mailbox (when, to whom, subject), so a brief line about a draft can be discussed; `read_my_email` shows drafts in a thread marked not sent, so a thread that is only a draft does not read as empty. 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, one per message id, grouped by sender and subject, with an email's first line; the principal's own mail reads \"from the principal\", an email from the roster says \"the Executive replied\" only when a reply was logged in its thread after it (`unanswered_mail.record_reply`) and \"no reply went out\" while its `unanswered_mail` card is open (on the principal's own read only), and a time on another day carries its weekday and date), **STUCK** (`integration_outbound_blocked` to a recipient, the inbound \"reply blocked at outbound gate\" and Google Chat \"left unanswered\" / \"not delivered\" rows, and chat drafts Act as me saved in the principal's mailbox that are still there: `delegation_drafts` rows not yet marked sent or `gone_at`; before each scheduled header refresh and each morning brief, `live_signals.settle_principal_drafts` looks up the principal's open chat drafts from the last two days in their mailbox and marks the ones sent or deleted there, or answered by a message of their own sent in that thread after the draft, so a draft they sent (or replied around) from Gmail stops reading as waiting; the same read keeps, in memory only, who each waiting draft goes to and its subject, so STUCK names each draft instead of a bare count), **CONVERSATIONS** (the principal's own web chat titles), **OWN** (the principal's own mail and chat-app messages to the Executive, kept out of INBOUND and its count, principal scope only) and the **REST OF TODAY'S CALENDAR**. The principal's own messages and chats render as background blocks, and every brief prompt carries `OWN_MESSAGES_RULE`: they show what the reader already said and asked, are never reported back as news (no \"you messaged me\", no restated complaint or rating), and an open ask appears only as what the Executive is doing about it. 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 **Who reads it.** Every brief surface (this header, the morning brief, the end-of-day digest) is written for one person, fixed in code by `briefing.reader`: the principal on the principal scope, the teammate on a `person:<id>` scope, and the principal on `company` too (that scope has no signed-in caller and uses the principal's prompt, built from shared rows only). `render_briefing_context(reader=…)` masks that person's full name and email addresses everywhere in the context to \"the reader\" (their own chat and mail, the Executive's replies to them, chat titles, the activity rail) and heads it with a **THE READER** line naming them; every brief prompt carries `READER_NAME_RULE`: write \"you\", never the reader's name, \"the reader\" or \"the principal\" (anyone else by name), and \"I\" / \"me\" / \"my\" for the Executive. A draft that still slips (`reader.slips`) is sent back once to be rewritten, and what is left after that is fixed in code (`reader.fix_slips`: the reader → you/your, \"the principal\" → the owner's name on a teammate's brief, the Executive → I/me/my).\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 33 s timeout: 25 s for the draft and 8 s for a rewrite, 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**From your chats.** `briefing.brief_requests` holds what the principal asked of their brief in conversation: `leave_out` lines from `leave_out_of_brief` (\"take the Halcyon renewal out of my brief\", kept 14 days) and `raise` lines the conversation review could not fix itself (`raise_in_brief`, kept 2 days), at most 20 live. A line is at most 12 words (leave out) or 30 (raise), with no link, handle, markup, identifier or talk of instructions, and only lines written under the principal's own id render. `render_briefing_context(brief_requests=True)` adds the raise lines before the quiet-day check, so they are raised even on a quiet day, and the leave-out list as the very last block; both sit inside the rendered string the /today header hashes. A teammate's brief or header passes `False`: they are the principal's own words.\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. Every brief prompt (this header, the teammate header, the morning brief and the end-of-day digest) carries `narrative.STANDING_FACTS_RULE`: use the facts quietly, never mention one or that it was saved, and leave an item a fact settles out without saying it was dropped. A fact settles only what it plainly says. Without it, a fact saved in chat came back as the header's top point, stretched to an item it never named. 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 /today header does not get the block: in the first week it is the same header as any other day. Home's top slot is instead the **first-week card**, built in code with no model call (`first_week.first_week_card`): `needs_goal` while no goal row exists (fixed ask \"Give me one goal with a date, and I'll track it every day.\" and a **Set a goal** button to `/goals?add=1`, which opens the add form), up to two findings from the latest finished team `executive_research` run (the run history keeps only the artifact, so `executive_research.parse_artifact_findings` reads back its \"Findings reviewed\" lines; most severe and most certain first, headline plus the summary's first sentence) with a line linking `/watchlist`, and `brief_tomorrow` on the setup day until the first morning brief is delivered. No goal still to set and no findings means no card. `GET /today` sets `first_week_card` and `first_week` (whether there is a card) for the principal only; while there is one the Briefing hides the \"Quiet day\" banner and an all-zero summary line reads \"Your first week. Start below.\" 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. A brief or digest delivered to its reader (`scheduler.runner._deliver_to_principal`) records its send as kind `brief_delivery` (`schedule_tools.recorded_as`): the outbound guard still counts it, but the rail and the heatmap leave it out, because every later brief reads the rail and used to repeat its own last top call as work done. A completed run is named in plain words, never by its log title (`workflows/run_outcome.py`: \"Researched your market\", \"Checked in with Sales\", or the name it was started with, less any date or how-it-started note), and carries `detail`, one line on what came of it read from its stored artifact (research: updates looked at, messages sent, alerts raised, things now watched; a check-in: actions proposed; the weekly review: next week's top item; other runs: the first sentence; none for briefs and the reflection), and `artifact_id` (`run:<id>`) when it kept a write-up (never for the reflection, which reads the principal's live alerts), so Pulse's Done for you and All activity link **Read it** to `/artifacts/run:<id>`. 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 the top line of the overview's **Done for you** panel (\"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-18T22:00:00Z"}diff --git a/packages/core/openexecutive/briefing/context.py b/packages/core/openexecutive/briefing/context.pyindex 689c0e2f..0d00d306 100644--- a/packages/core/openexecutive/briefing/context.py+++ b/packages/core/openexecutive/briefing/context.py@@ -343,9 +343,53 @@ def render_and_trust(session: object, *, db_path: Path | None = None) -> str:logger.exception("briefing_context.trust_record_failed")if roster_block:block = f"{block}\n\n{roster_block}" if block else roster_block+ if verified:+ drafts_block = _waiting_drafts_block()+ if drafts_block:+ block = f"{block}\n\n{drafts_block}" if block else drafts_blockreturn block+def _waiting_drafts_block() -> str:+ """The principal's chat drafts still in their Drafts, as the brief names+ them, so a brief line about a draft can be discussed. Their own turn+ only. Never raises."""+ try:+ from openexecutive.briefing.live_signals import draft_line+ from openexecutive.delegation import drafts+ from openexecutive.memory import episodic+ from openexecutive.memory.workspace_settings import get_user_timezone+ from openexecutive.people.store import find_principal_person++ principal = find_principal_person()+ if principal is None or principal.id is None:+ return ""+ if not episodic._resolve_db_path(None).exists():+ return ""+ now = datetime.now(UTC)+ waiting = drafts.waiting_drafts(principal.id, now - drafts.SETTLE_WINDOW)+ if not waiting:+ return ""+ from openexecutive.orchestrator.content_trust import wrap_untrusted++ tz = get_user_timezone()+ # Only the ones a settle pass has read: a bare time names nothing.+ lines = [f"- {draft_line(d, tz, now)}" for d in waiting if d.to or d.subject]+ if not lines:+ return ""+ email = str(getattr(principal, "email", "") or "")+ except Exception:+ logger.exception("briefing_context.waiting_drafts_failed")+ return ""+ # A reply draft's subject is the sender's own ("Re: …"): quoted data.+ return (+ "Email drafts you saved in their own mailbox from chat, not sent yet "+ "(newest first). A brief line about a draft waiting for review means "+ "one of these; open it with search_my_email and read_my_email:\n"+ + wrap_untrusted("\n".join(lines), source="email", author=email)+ )++_MAX_ROSTER_REQUESTS = 10diff --git a/packages/core/openexecutive/briefing/live_signals.py b/packages/core/openexecutive/briefing/live_signals.pyindex 9087d74b..1536c93a 100644--- a/packages/core/openexecutive/briefing/live_signals.py+++ b/packages/core/openexecutive/briefing/live_signals.py@@ -179,6 +179,9 @@ class LiveSignals:inbound_shown: int = 0stuck: tuple[str, ...] = ()drafts: int = 0+ # One line per waiting draft: when, to whom, its subject (as far as the+ # last settle pass read them).+ draft_lines: tuple[str, ...] = ()conversations: tuple[str, ...] = ()# The reader's own messages to the Executive, newest first. Background,# so they never make the window non-empty on their own.@@ -392,22 +395,45 @@ def _outbound_blocked(return out-def _drafts(since: datetime, include_private: bool) -> int:+def _drafts(+ since: datetime, include_private: bool, tz: tzinfo, now: datetime | None = None,+) -> tuple[int, list[str]]:"""The reader's chat drafts from the window still in their Drafts, as- far as the last ``delegation.drafts.settle_waiting`` saw: one they sent- or deleted in Gmail stops counting once a settle pass finds it gone."""+ far as the last ``delegation.drafts.settle_waiting`` saw (one they sent+ or deleted in Gmail stops counting once a settle pass finds it gone),+ and a line naming each: when it was saved, who it goes to, its subject."""if not include_private:- return 0 # every delegation row is private to the principal+ return 0, [] # every delegation row is private to the principalfrom openexecutive.delegation import draftsfrom openexecutive.memory import episodicfrom openexecutive.people.store import find_principal_personprincipal = find_principal_person()if principal is None or principal.id is None:- return 0+ return 0, []if not episodic._resolve_db_path(None).exists():- return 0 # a read must not create the database- return drafts.count_waiting(principal.id, since)+ return 0, [] # a read must not create the database+ count = drafts.count_waiting(principal.id, since)+ if not count:+ return 0, []+ # Only the ones a settle pass has read: a bare time names nothing (the+ # count still covers them).+ return count, [+ draft_line(d, tz, now)+ for d in drafts.waiting_drafts(principal.id, since)+ if d.to or d.subject+ ]+++def draft_line(draft: Any, tz: tzinfo, now: datetime | None = None) -> str:+ """``[09:07] to [email protected] — "Q3 numbers"``; the parts not read+ yet are left out."""+ line = f"[{_local_hhmm(draft.created_at, tz, now)}]"+ if draft.to:+ line += f" to {_one_line(', '.join(draft.to), 160)}"+ if draft.subject:+ line += f' — "{_one_line(draft.subject, 120)}"'+ return linedef _conversations(@@ -587,8 +613,9 @@ def gather_live_signals(except Exception:logger.exception("live_signals: outbound-blocked read failed")drafts = 0+ draft_lines: list[str] = []try:- drafts = _drafts(since, include_private)+ drafts, draft_lines = _drafts(since, include_private, tz, now)except Exception:logger.exception("live_signals: drafts read failed")conversations: list[str] = []@@ -624,6 +651,7 @@ def gather_live_signals(inbound_shown=shown,stuck=tuple(stuck),drafts=drafts,+ draft_lines=tuple(draft_lines),conversations=tuple(conversations),own=tuple(own),calendar=calendar_lines,@@ -631,6 +659,7 @@ def gather_live_signals("inbound": sorted(inbound_keys),"stuck": sorted(s.split("] ", 1)[-1] for s in stuck),"drafts": drafts,+ "draft_lines": sorted(line.split("] ", 1)[-1] for line in draft_lines),"conversations": sorted(conversation_keys),"calendar": calendar_key,},@@ -664,7 +693,18 @@ def render_live_blocks(signals: LiveSignals, *, window: str) -> list[str]:parts.append(f"- {n} email draft{'s' if n != 1 else ''} saved in the reader's own ""Gmail (Act as me), waiting for them to review and send"+ + (+ "; name each by who it goes to and its subject:"+ if signals.draft_lines else ""+ ))+ if signals.draft_lines:+ from openexecutive.orchestrator.content_trust import wrap_untrusted++ # A reply draft's subject is the sender's own ("Re: …").+ parts.append(wrap_untrusted(+ "\n".join(f"- {line}" for line in signals.draft_lines), source="email",+ ))parts.append("")background = "background only: what the reader already said and asked, never news"if signals.own:diff --git a/packages/core/openexecutive/delegation/drafts.py b/packages/core/openexecutive/delegation/drafts.pyindex e6639716..9e4605ef 100644--- a/packages/core/openexecutive/delegation/drafts.py+++ b/packages/core/openexecutive/delegation/drafts.py@@ -10,12 +10,16 @@ leaves out when it learns from sent mail:person's own writing to learn from.Metadata only: ids and times, never an address, a subject or any text.+Who a waiting chat draft goes to and its subject are read from the mailbox+by ``settle_waiting`` and kept in memory only (``waiting_drafts``), so the+briefs can name the draft."""from __future__ import annotationsimport loggingimport sqlite3-from datetime import datetime, timedelta+from dataclasses import dataclass+from datetime import UTC, datetime, timedeltafrom pathlib import Pathfrom typing import Any@@ -35,6 +39,22 @@ SETTLE_WINDOW = timedelta(days=2)_SETTLE_MAX = 20+@dataclass(frozen=True)+class WaitingDraft:+ """A chat draft still in the person's Drafts, as the briefs name it."""++ created_at: str+ to: tuple[str, ...] = ()+ subject: str = ""+++# (person id, row id) -> (to, subject) as the last ``settle_waiting`` read them from the+# mailbox. In memory only: the table keeps no address or subject. The+# scheduler that settles runs in the API process that reads it; after a+# restart, drafts read without details until the next pass.+_seen: dict[tuple[int, int], tuple[tuple[str, ...], str]] = {}++def _db(db_path: Path | None) -> Path:if db_path is not None:return db_path@@ -197,16 +217,36 @@ def count_waiting(person_id: int, since: datetime, *, db_path: Path | None = Nondef _waiting(person_id: int, since: datetime, db_path: Path | None) -> list[tuple[int, str]]:+ return [(row[0], row[1]) for row in _waiting_rows(person_id, since, db_path)]+++def _waiting_rows(+ person_id: int, since: datetime, db_path: Path | None+) -> list[tuple[int, str, str, str]]:+ """``(row id, draft id, created_at, thread id or "")``, newest first."""where, params = _waiting_sql(person_id, since)conn = _connect(db_path)try:rows = conn.execute(- f"SELECT id, draft_id {where} ORDER BY id DESC LIMIT ?", # noqa: S608+ f"SELECT id, draft_id, created_at, thread_id {where} ORDER BY id DESC LIMIT ?", # noqa: S608(*params, _SETTLE_MAX),).fetchall()finally:conn.close()- return [(int(r[0]), str(r[1] or "")) for r in rows]+ return [(int(r[0]), str(r[1] or ""), str(r[2] or ""), str(r[3] or "")) for r in rows]+++def waiting_drafts(+ person_id: int, since: datetime, *, db_path: Path | None = None+) -> list[WaitingDraft]:+ """``person_id``'s chat drafts since ``since`` still counted as waiting,+ newest first, each with who it goes to and its subject when a settle+ pass has read them (empty until one has)."""+ out = []+ for row_id, _, created_at, _ in _waiting_rows(person_id, since, db_path):+ to, subject = _seen.get((person_id, row_id), ((), ""))+ out.append(WaitingDraft(created_at=created_at, to=to, subject=subject))+ return outdef latest_waiting(person_id: int, since: datetime, *, db_path: Path | None = None) -> int | None:@@ -236,28 +276,48 @@ async def settle_waiting(ones no longer there (sent or deleted in Gmail or Outlook), so the briefsstop calling them waiting. Nothing records a send made in the mailboxitself, and the chat drafts have no card for the inbox watcher to settle.+ A reply draft also stops waiting once they sent their own message in+ that thread after it was saved: they answered without it, so it is not+ theirs to review any more (the draft itself stays in their mailbox).Reads only; returns how many it marked. Never raises."""person_id = getattr(person, "id", None)email = str(getattr(person, "email", "") or "").strip().lower()if person_id is None or not email:return 0try:- waiting = _waiting(int(person_id), now - SETTLE_WINDOW, db_path)+ waiting = _waiting_rows(int(person_id), now - SETTLE_WINDOW, db_path)except Exception:logger.warning("delegation.drafts: couldn't read the waiting drafts", exc_info=True)return 0+ # Keep details only for the rows still waiting (one aged out, or closed+ # some other way, is dropped).+ pid = int(person_id)+ current = {(pid, row[0]) for row in waiting}+ for key in [k for k in _seen if k[0] == pid and k not in current]:+ _seen.pop(key, None)if not waiting:return 0 # no mailbox call on a day with no chat drafts- from openexecutive.delegation.gmail import GmailError, gmail_for, valid_id+ from openexecutive.delegation.gmail import GmailError, gmail_for+ from openexecutive.delegation.gmail import valid_id as gmail_idclient = gmail if gmail is not None else gmail_for(email)+ # Outlook ids are longer than Gmail's: ask the client which it takes.+ valid_id = getattr(client, "valid_id", gmail_id)gone = 0- for row_id, draft_id in waiting:+ for row_id, draft_id, created_at, thread_id in waiting:if not valid_id(draft_id):continue # nothing to look uptry:- if await client.get_draft(draft_id) is not None:+ found = await client.get_draft(draft_id)+ if found is not None and not (+ valid_id(thread_id) and await _answered_since(client, thread_id, email, created_at)+ ):+ message = getattr(found, "message", None)+ recipients = [*getattr(message, "to", []), *getattr(message, "cc", [])]+ to = tuple(str(a) for a in recipients[:5] if a)+ _seen[(pid, row_id)] = (to, str(getattr(message, "subject", "") or ""))continue+ _seen.pop((pid, row_id), None)mark_gone(row_id, now, db_path=db_path)gone += 1except GmailError as exc:@@ -269,3 +329,29 @@ async def settle_waiting(logger.warning("delegation.drafts: checking a draft failed", exc_info=True)breakreturn gone+++async def _answered_since(client: Any, thread_id: str, own: str, created_at: str) -> bool:+ """Whether ``own`` sent a message of their own in ``thread_id`` after+ ``created_at`` (a draft is never one)."""+ from openexecutive.delegation.threads import mine++ try:+ saved = datetime.fromisoformat(created_at)+ except ValueError:+ return False+ if saved.tzinfo is None:+ saved = saved.replace(tzinfo=UTC)+ thread = await client.get_thread(thread_id)+ for m in getattr(thread, "messages", None) or []:+ if "DRAFT" in m.labels or not mine(m, own):+ continue+ try:+ sent = datetime.fromisoformat(m.received_at)+ except ValueError:+ continue+ if sent.tzinfo is None:+ sent = sent.replace(tzinfo=UTC)+ if sent > saved:+ return True+ return Falsediff --git a/packages/core/openexecutive/orchestrator/mail_read_tools.py b/packages/core/openexecutive/orchestrator/mail_read_tools.pyindex 2e0e4c87..0c703269 100644--- a/packages/core/openexecutive/orchestrator/mail_read_tools.py+++ b/packages/core/openexecutive/orchestrator/mail_read_tools.py@@ -51,6 +51,8 @@ SEARCH_MY_EMAIL = "search_my_email"READ_MY_EMAIL = "read_my_email"MY_EMAIL_AWAITING_REPLY = "my_email_awaiting_reply"READ_MY_EMAIL_ATTACHMENT = "read_my_email_attachment"+# Their unsent drafts shown after a thread's messages, newest last.+_DRAFTS_SHOWN = 2MY_EMAIL_READ_BEFORE = "my_email_read_before"MY_CALENDAR = "my_calendar"SAVE_MY_EMAIL_ATTACHMENT = "save_my_email_attachment"@@ -131,7 +133,8 @@ READ_MY_EMAIL_TOOL: dict[str, Any] = {"Read one email thread in the mailbox of the person you are speaking ""with, by the thread_id search_my_email or my_email_awaiting_reply "f"returned: its last {READ_MESSAGES} messages, each sender's own words "- "(quoted history left out), and the files attached to them "+ "(quoted history left out), drafts saved there marked not sent, and "+ "the files attached to them ""(`attachments`: message_id and index; open one with ""read_my_email_attachment). Their own messages are marked yours. Use it ""to answer what a thread says or to summarise it. Read-only."@@ -442,6 +445,13 @@ def _render_thread(messages: list[Any], first: int, own: str) -> str:for i, m in enumerate(messages, first):text = plain(sender_new_text(m.text or ""))[:READ_MESSAGE_CHARS]date = one_line(m.date or m.received_at, 60)+ if "DRAFT" in m.labels:+ # Saved, never sent: whoever wrote it (them, Act as me, another+ # app), it went to no one, so its words stay quoted data.+ to = ", ".join([*m.to, *m.cc][:10])+ header = f"[{i}] Your draft, not sent — {date}\nTo: {one_line(to, 400)}"+ parts.append(f"[{i}]\n" + wrap_untrusted(f"{header}\n\n{text}", source="email", author=own))+ continueif mine(m, own):# Outside any block, so it can neither open nor close a tag, nor# start what looks like another message.@@ -494,17 +504,24 @@ async def handle_read_my_email(tool_input: dict[str, Any]) -> str:async def read(writer: Any) -> str:thread = await writer.mailbox.get_thread(thread_id)messages = [m for m in thread.messages if "DRAFT" not in m.labels]- if not messages:+ # Their drafts in it come after the last messages, marked not sent, so+ # a thread that is only a draft (a new email saved for them) does not+ # read as empty and a draft never pushes a real message out.+ drafts = [m for m in thread.messages if "DRAFT" in m.labels][-_DRAFTS_SHOWN:]+ if not messages and not drafts:return json.dumps({"status": "not_found", "detail": "That thread has no messages."})shown = messages[-READ_MESSAGES:]first = len(messages) - len(shown) + 1- _remember_read(writer, thread.id, messages[0])+ if messages: # a thread that is only their draft is not mail they read+ _remember_read(writer, thread.id, messages[0])_note_senders(writer, [_sender(m) for m in shown])+ shown = shown + draftsreturn json.dumps({"status": "ok","thread_id": thread.id,- "subject": one_line(messages[0].subject, 200),+ "subject": one_line((messages or drafts)[0].subject, 200),"messages_in_thread": len(messages),+ "drafts_shown": len(drafts),"shown_from": first,"thread": _render_thread(shown, first, writer.email),"attachments": await _attachment_list(writer.mailbox, shown, first),diff --git a/packages/core/tests/unit/test_briefing_context.py b/packages/core/tests/unit/test_briefing_context.pyindex bca7416e..19faaf39 100644--- a/packages/core/tests/unit/test_briefing_context.py+++ b/packages/core/tests/unit/test_briefing_context.py@@ -524,3 +524,36 @@ def test_limit_cannot_widen_what_is_printed_past_the_board(db: Path) -> None:assert len(printed) == BOARD_LIMITassert len(ids) == BOARD_LIMIT++[email protected]("verified", [True, False])+def test_waiting_drafts_reach_the_principals_own_turn_only(+ verified: bool, tmp_path: Path, monkeypatch: pytest.MonkeyPatch,+) -> None:+ """A brief line about a draft waiting for review can be discussed: the+ principal's own turn names each waiting draft; anyone else's never."""+ from datetime import UTC, datetime+ from types import SimpleNamespace++ from openexecutive.briefing import context as ctx+ from openexecutive.delegation import drafts+ from openexecutive.memory import episodic+ from openexecutive.orchestrator import people_tools+ from openexecutive.people import store as people_store++ path = tmp_path / "episodic.db"+ episodic.initialize_db(path)+ monkeypatch.setattr(episodic, "DB_PATH", path)+ monkeypatch.setattr(+ people_store, "find_principal_person",+ lambda *a, **k: SimpleNamespace(id=1, email="[email protected]"),+ )+ monkeypatch.setattr(people_tools, "is_principal_on_verified_surface", lambda _s: verified)+ monkeypatch.setattr(ctx, "format_open_alerts_for_prompt", lambda **_kw: "")+ row = drafts.record(1, source=drafts.SOURCE_CHAT, thread_id="t1", draft_id="d1",+ message_id="m1", now=datetime.now(UTC))+ monkeypatch.setattr(drafts, "_seen", {(1, row): (("[email protected]",), "Pilot pricing")})++ block = ctx.render_and_trust(_FakeSession())++ assert ('to [email protected] — "Pilot pricing"' in block) is verifieddiff --git a/packages/core/tests/unit/test_delegation_drafts.py b/packages/core/tests/unit/test_delegation_drafts.pyindex 5b68af05..ecc85fb2 100644--- a/packages/core/tests/unit/test_delegation_drafts.py+++ b/packages/core/tests/unit/test_delegation_drafts.py@@ -24,7 +24,9 @@ def db(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Iterator[Path]:episodic.initialize_db(path)caps._SAVED_TODAY.clear()caps._IN_FLIGHT.clear()+ drafts._seen.clear()yield path+ drafts._seen.clear()caps._SAVED_TODAY.clear()caps._IN_FLIGHT.clear()@@ -155,6 +157,75 @@ async def test_a_chat_draft_sent_in_gmail_stops_waiting() -> None:assert box.asked == ["d2"]+async def test_a_waiting_draft_is_named_by_who_it_goes_to_and_its_subject() -> None:+ _record(1, drafts.SOURCE_CHAT, "t1", "d1")+ _record(1, drafts.SOURCE_CHAT, None, "d2")+ day = NOW.replace(hour=0)+ # Before any settle pass: listed, but nothing read yet.+ assert [(d.to, d.subject) for d in drafts.waiting_drafts(1, day)] == [((), ""), ((), "")]++ class Box:+ async def get_draft(self, draft_id: str) -> Any:+ if draft_id == "d1":+ return None # sent+ message = SimpleNamespace(to=["[email protected]"], cc=[], subject="Wednesday meeting")+ return SimpleNamespace(draft_id=draft_id, message=message)++ assert await drafts.settle_waiting(PERSON, now=NOW, gmail=Box()) == 1+ waiting = drafts.waiting_drafts(1, day)+ assert [(d.to, d.subject) for d in waiting] == [(("[email protected]",), "Wednesday meeting")]+++async def test_a_reply_draft_stops_waiting_once_they_answered_in_the_thread() -> None:+ """They replied in Gmail themselves instead of sending the draft: the+ draft is still in Drafts, but it is no longer theirs to review."""+ answered = _record(1, drafts.SOURCE_CHAT, "t1", "d1", when=NOW - timedelta(hours=3))+ _record(1, drafts.SOURCE_CHAT, "t2", "d2", when=NOW - timedelta(hours=3))+ after = (NOW - timedelta(hours=1)).isoformat()+ before = (NOW - timedelta(hours=5)).isoformat()++ def msg(sender: str, labels: list[str], at: str) -> SimpleNamespace:+ return SimpleNamespace(from_addr=sender, labels=labels, received_at=at)++ threads = {+ "t1": [msg("[email protected]", ["INBOX"], before), msg("[email protected]", ["SENT"], after)],+ # Only an older send of theirs, a draft and someone else's mail since.+ "t2": [+ msg("[email protected]", ["SENT"], before),+ msg("[email protected]", ["DRAFT"], after),+ msg("[email protected]", ["INBOX"], after),+ ],+ }++ class Box:+ async def get_draft(self, draft_id: str) -> Any:+ return SimpleNamespace(draft_id=draft_id, message=None)++ async def get_thread(self, thread_id: str) -> Any:+ return SimpleNamespace(messages=threads[thread_id])++ assert await drafts.settle_waiting(PERSON, now=NOW, gmail=Box()) == 1+ left = drafts._waiting(1, NOW - timedelta(days=1), None)+ assert [draft_id for _, draft_id in left] == ["d2"]+ assert (1, answered) not in drafts._seen+++async def test_one_persons_pass_keeps_anothers_details() -> None:+ _record(1, drafts.SOURCE_CHAT, None, "d1")+ _record(2, drafts.SOURCE_CHAT, None, "d2")++ class Box:+ async def get_draft(self, draft_id: str) -> Any:+ message = SimpleNamespace(to=["[email protected]"], cc=[], subject=f"About {draft_id}")+ return SimpleNamespace(draft_id=draft_id, message=message)++ await drafts.settle_waiting(PERSON, now=NOW, gmail=Box())+ await drafts.settle_waiting(SimpleNamespace(id=2, email="[email protected]"), now=NOW, gmail=Box())+ day = NOW.replace(hour=0)+ assert [d.subject for d in drafts.waiting_drafts(1, day)] == ["About d1"]+ assert [d.subject for d in drafts.waiting_drafts(2, day)] == ["About d2"]++async def test_settling_reads_nothing_without_recent_chat_drafts() -> None:_record(1, drafts.SOURCE_CHAT, "t1", "old", when=NOW - timedelta(days=3))_record(2, drafts.SOURCE_CHAT, "t2", "theirs")diff --git a/packages/core/tests/unit/test_live_signals.py b/packages/core/tests/unit/test_live_signals.pyindex bb406eb8..462660bd 100644--- a/packages/core/tests/unit/test_live_signals.py+++ b/packages/core/tests/unit/test_live_signals.py@@ -147,6 +147,35 @@ async def test_a_draft_sent_in_gmail_leaves_stuck(monkeypatch: pytest.MonkeyPatcassert "draft" not in "\n".join(live_signals.render_live_blocks(signals, window="today so far"))+async def test_a_waiting_draft_is_named_in_stuck(monkeypatch: pytest.MonkeyPatch) -> None:+ """The brief names the draft (who it goes to, its subject), not just a+ count, so the reader knows which one it means."""+ from openexecutive.delegation import drafts, gmail+ from openexecutive.people import store as people_store++ principal = SimpleNamespace(id=1, email="[email protected]", email_aliases=[])+ monkeypatch.setattr(people_store, "find_principal_person", lambda *a, **k: principal)+ monkeypatch.setattr(drafts, "_seen", {})+ drafts.record(1, source=drafts.SOURCE_CHAT, thread_id=None, draft_id="d1",+ message_id="m1", now=datetime.now(UTC))++ class Waiting:+ def __init__(self, email: str) -> None:+ pass++ async def get_draft(self, draft_id: str) -> Any:+ message = SimpleNamespace(to=["[email protected]"], cc=[], subject="Pilot pricing")+ return SimpleNamespace(draft_id=draft_id, message=message)++ monkeypatch.setattr(gmail, "gmail_for", Waiting)+ assert await live_signals.settle_principal_drafts() == 0++ signals = live_signals.gather_live_signals(_since(), include_private=True)+ text = "\n".join(live_signals.render_live_blocks(signals, window="today so far"))+ assert signals.drafts == 1+ assert 'to [email protected] — "Pilot pricing"' in text++def test_window_excludes_older_rows(audit: AuditLogger) -> None:_email(audit, "[email protected]", "old news")later = datetime.now(UTC) + timedelta(seconds=1)diff --git a/packages/core/tests/unit/test_mail_read_tools.py b/packages/core/tests/unit/test_mail_read_tools.pyindex d0005a22..0bbf8bd2 100644--- a/packages/core/tests/unit/test_mail_read_tools.py+++ b/packages/core/tests/unit/test_mail_read_tools.py@@ -270,14 +270,31 @@ def test_the_process_log_never_carries_their_mail() -> None:assert "budget" in _log_value("list_people", {"query": "budget"})-def test_quoted_history_and_drafts_are_left_out_and_long_threads_trimmed(roster: SimpleNamespace) -> None:+def test_quoted_history_is_left_out_and_long_threads_trimmed(roster: SimpleNamespace) -> None:messages = [_msg(i, DANA, f"Message {i}\n\nOn Mon, Olivia wrote:\n> quoted {i}") for i in range(1, 13)]- messages.append(_msg(13, OWNER, "unsent", labels=["DRAFT"]))result = _read(_thread_session(*messages), {"thread_id": "t1"})assert result["messages_in_thread"] == 12assert result["shown_from"] == 12 - mr.READ_MESSAGES + 1assert "Message 12" in result["thread"] and "Message 2\n" not in result["thread"]- assert "quoted" not in result["thread"] and "unsent" not in result["thread"]+ assert "quoted" not in result["thread"]+++def test_a_draft_reads_as_their_draft_not_sent(roster: SimpleNamespace) -> None:+ """A thread that is only a draft saved for them must not read as empty."""+ draft = _msg(1, OWNER, "Does Wednesday at 10 work?", labels=["DRAFT"])+ result = _read(_thread_session(draft), {"thread_id": "t1"})+ assert result["status"] == "ok"+ assert "Your draft, not sent" in result["thread"]+ assert "Does Wednesday at 10 work?" in result["thread"]+ assert "Yours —" not in result["thread"]+++def test_a_draft_never_pushes_a_message_out_of_the_window(roster: SimpleNamespace) -> None:+ messages = [_msg(i, DANA, f"Message {i}") for i in range(1, mr.READ_MESSAGES + 1)]+ messages.append(_msg(99, OWNER, "My unsent reply", labels=["DRAFT"]))+ result = _read(_thread_session(*messages), {"thread_id": "t1"})+ assert result["messages_in_thread"] == mr.READ_MESSAGES and result["drafts_shown"] == 1+ assert "Message 1\n" in result["thread"] and "My unsent reply" in result["thread"]def test_a_bad_thread_id_is_refused(roster: SimpleNamespace) -> None:diff --git a/packages/core/tests/unit/test_today_route.py b/packages/core/tests/unit/test_today_route.pyindex 1d277d2f..040ad5b1 100644--- a/packages/core/tests/unit/test_today_route.py+++ b/packages/core/tests/unit/test_today_route.py@@ -858,6 +858,58 @@ def test_activity_includes_decisions_and_advice(assert "advice_given" in kinds+def test_a_card_left_from_chat_reads_as_what_it_did(+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ """A delete approved on its chat card reads as the delete, not as+ "Approved: Finance" (which the brief turned into "I approved the+ pending department decisions")."""+ db = tmp_path / "act_app.db"+ _setup_isolated_db(db, monkeypatch)++ def card(key: str, title: str) -> int:+ return decision_ledger.create_decision_instance(+ decision_class="app_action", department="",+ originating_session_id=None,+ proposed_payload={+ "action": "delete_department", "id": key, "value": "",+ "title": title, "card": f"Delete the department “{title}”",+ },+ idempotency_key=None, gate_mode="propose",+ approver_person_id=None, confidence=None, db_path=db,+ )++ done = card("finance", "Finance")+ decision_ledger.mark_resolved(+ done, decision_ledger.STATUS_APPROVED_UNCHANGED,+ final_payload={"did": "Deleted the department “Finance”"}, db_path=db,+ )+ turned_down = card("legal", "Legal")+ decision_ledger.mark_resolved(turned_down, decision_ledger.STATUS_REJECTED, db_path=db)+ # A card on something private to its person (a chat's title) stays off+ # the team's feed.+ chat = decision_ledger.create_decision_instance(+ decision_class="app_action", department="", originating_session_id=None,+ proposed_payload={+ "action": "delete_chat", "id": "s1", "value": "",+ "title": "Private plans", "card": "Delete the chat “Private plans”",+ },+ idempotency_key=None, gate_mode="propose",+ approver_person_id=None, confidence=None, db_path=db,+ )+ decision_ledger.mark_resolved(+ chat, decision_ledger.STATUS_APPROVED_UNCHANGED,+ final_payload={"did": "Deleted the chat “Private plans”"}, db_path=db,+ )++ items = _make_client().get("/today/activity?limit=100").json()["items"]+ summaries = sorted(i["summary"] for i in items if i["kind"] == "decision_resolved")+ assert summaries == [+ "Deleted the department “Finance” (asked for in chat, approved on its card)",+ "Turned down: Delete the department “Legal”",+ ]++def test_activity_includes_workflow_initiative_decision_alert(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: