Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(prompt): post a form for a channel as one live poll card (#9311)
Wolf Mermelstein775a1b8cb610
diff --git a/crates/prompt/AGENTS.md b/crates/prompt/AGENTS.mdindex 9a9437c281..5e8b0eb445 100644--- a/crates/prompt/AGENTS.md+++ b/crates/prompt/AGENTS.md@@ -44,6 +44,9 @@ The agent-session prompt distinguishes typed `<m-notifications>` system factsfrom user requests and defines the notification-only `<noop/>` contract.In-app replies use `m-document-mention` with `blockName: "routine"` for routines;external MCP replies use `/app/routines/<id>` URLs.+A form for a channel is a poll (one required select question, tally visible),+posted once as `<m-document-card>` with `blockName: "form"`; the card's message+reference grants the channel View, so no second message or link is needed.## Checksdiff --git a/crates/prompt/src/lib.rs b/crates/prompt/src/lib.rsindex 9b75f874eb..c2f2861540 100644--- a/crates/prompt/src/lib.rs+++ b/crates/prompt/src/lib.rs@@ -313,6 +313,29 @@ mod tests {));}+ #[test]+ fn every_in_app_agent_prompt_posts_a_channel_form_as_one_live_poll_card() {+ for prompt in [+ &DIRECT_TOOL_USE_PROMPT,+ &TOOL_USE_PROMPT,+ &SESSION_TOOL_USE_PROMPT,+ &CODE_MODE_SESSION_TOOL_USE_PROMPT,+ ] {+ let text = prompt.to_string();+ for guidance in [+ "A form for a channel is a poll:",+ "one required single- or multi-select question",+ "`tallyVisible: true`",+ "`widget: \"choice\"`",+ "`channelGrants: []`",+ r#"<m-document-card>{"documentId":"{form_id}","documentName":"{question}","blockName":"form","previewData":{"poll":{"optionCount":2}}}</m-document-card>"#,+ "or a second copy.",+ ] {+ assert!(text.contains(guidance), "missing poll guidance: {guidance}");+ }+ }+ }+#[test]fn mentions_and_document_content_links_share_an_identical_document_mention_tag() {// document_content_links deliberately repeats this tag literal (ratherdiff --git a/crates/prompt/src/mentions.rs b/crates/prompt/src/mentions.rsindex 29793e1fcb..58d81db35d 100644--- a/crates/prompt/src/mentions.rs+++ b/crates/prompt/src/mentions.rs@@ -53,6 +53,14 @@ Exact `blockName`s, since any other value renders a broken or deleted chip:- An email thread is `email`, never `thread` or `email_thread`. A calendar event is `calendar`, never `calendar_event`, with the `eventId` as `documentId`; add a recurring event's `recurrenceId` as `occurrenceKey` to target one occurrence. Channel members without the event see a read-only preview. Private and confidential events are never shared.- When a tool returns a channel message id, mention that message, not just its channel.+### Polls in channels++A form for a channel is a poll: one required single- or multi-select question (`widget: "choice"`, or `"checkboxes"` for several answers), `status: "open"`, `tallyVisible: true` unless asked to hide results, and `channelGrants: []`. Post it as one message with its live card on its own line:++`<m-document-card>{"documentId":"{form_id}","documentName":"{question}","blockName":"form","previewData":{"poll":{"optionCount":2}}}</m-document-card>`++That message is the poll, and the card shares it with the channel. Never add a form chip, `/respond` link, `form:` link, or a second copy.+Whenever you name a task — one you created, linked, searched, or were assigned — emit the task mention chip. Do not use a Markdown URL, MACRO- id, or bare title, and do not repeat the title beside the chip. Use the `mention` field a task tool returned when you have it.### People, groups, dates, agent sessions, pull requests, and booking links@@ -82,7 +90,8 @@ with the matching XML mention tag (m-document-mention with the right blockName/bm-user-mention, m-date-mention, m-agent-session-mention, m-pr-mention for GitHub pull \requests by URL, m-booking-link-mention for Macro booking links by URL, and the other \listed chip tags) across every Markdown surface (AI chat replies, agent session replies, channel messages, \-email bodies, and Markdown documents) — never inside non-Markdown documents, and never for \+email bodies, and Markdown documents); a poll for a channel is posted once, as its live \+m-document-card — never inside non-Markdown documents, and never for \ids outside the listed types (a calendar id from ListCalendars is not mentionable; \only individual events are).";diff --git a/docs/agent-guide/forms.md b/docs/agent-guide/forms.mdindex 7f028edec0..28058cc59c 100644--- a/docs/agent-guide/forms.md+++ b/docs/agent-guide/forms.md@@ -30,6 +30,9 @@ decides who may respond.card in the message and sends it. Closing the dialog while it posts sendsnothing and trashes the poll. With results hidden, respondents answerwithout counts and editors review votes in the Responses tab.+- Asked for a poll, or for a form for a channel, the Macro agent makes a poll+ and posts it as its card in one message (its channel reply), the same card+ `/poll` posts.## The form page