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(channels): make @macro always offer to share items it links (#8379)
Wolf Mermelsteinee9a02d8bf4d
diff --git a/crates/channel_bots/src/outbound/agent_loop_responder.rs b/crates/channel_bots/src/outbound/agent_loop_responder.rsindex 5130ee27dd..a9b810ec4b 100644--- a/crates/channel_bots/src/outbound/agent_loop_responder.rs+++ b/crates/channel_bots/src/outbound/agent_loop_responder.rs@@ -25,7 +25,9 @@ impl AgentLoopResponder {agent_loop: AgentLoop::new(tool_context.recorder.clone()),tool_context: Arc::new(tool_context),toolset: tools.toolset,- system_prompt: format!("{}{}", prompt::channel_mention::PROMPT, tools.prompt),+ // The channel rules go last so they are the freshest instructions the+ // model reads; ahead of the tool prompt they were often ignored.+ system_prompt: format!("{}\n{}", tools.prompt, prompt::channel_mention::PROMPT),}}}diff --git a/crates/prompt/src/channel_mention.rs b/crates/prompt/src/channel_mention.rsindex f42c7c3df3..e7771431e7 100644--- a/crates/prompt/src/channel_mention.rs+++ b/crates/prompt/src/channel_mention.rs@@ -32,12 +32,27 @@ have not made the call the action has not happened. Only take actions (creating,deleting things) that the mentioning user explicitly asked for, and because calendar invitationsgo out the moment an event is created, ask in the thread before creating an event with attendees.-When your reply links something the other people in this channel may not already be able to-open — a calendar event, document, chat, database, form, project, call, email thread, or agent-session — end that reply with this question and nothing after it: "Do you want me to share this with the members of the channel?" Do not share it in that same turn. Name the thing only when-"this" would be ambiguous. Skip the question when they already asked you to share it: call-`ShareWithChannel` then, instead of asking. Do not offer to share the channel itself, a message-already in this channel, or something you only mentioned in passing without a chip.+Sending email is not available from a channel: there is no SendEmail tool here. If asked to+draft or send an email, say you cannot do that from a channel and suggest asking Macro in an AI+chat or using the email composer.++## Sharing what you create or link++Linking an item in a channel does not give the channel access to it; only sharing does. So+whenever your reply links an item you created, edited, or found this turn (a document,+calendar event, chat, database, form, project, call, email thread, or agent session), the+last line of your reply must be exactly:++Do you want me to share this with the members of the channel?++Ask even when you just created the item at the user's request, and even when you think the+channel might already see it; you cannot tell, so ask. Do not share it in the same turn.+Name the item only when "this" would be ambiguous. The only exceptions:+- The user already asked you to share it: call `ShareWithChannel` instead of asking.+- The item is this channel or a message already in it.++Before you send any reply, check: does it link an item? If so, is that question the last+line? If not, add it.A later message in this thread that agrees ("yes", "yeah", "please", "go ahead", "share it")answers that question. Call `ShareWithChannel` for that item and this channel — `channelId` is@@ -45,10 +60,6 @@ the `id` on the conversation parent above; a calendar chip is entity type `calenits `documentId` is the event id — then reply with only "Okay." Do not repeat the earlier answer. Agreement to adifferent question is not agreement to share. If they decline, acknowledge in a few words anddo not share. If the tool says you cannot share it, say that plainly instead of "Okay."--Sending email is not available from a channel: there is no SendEmail tool here. If asked to-draft or send an email, say you cannot do that from a channel and suggest asking Macro in an AI-chat or using the email composer."##;static INTENT: &str = "The model replies to the marked mention, treats the <thread> block as \@@ -58,8 +69,9 @@ user's time zone when the block names one — asking rather than silently assumidoes not — treats tool calls as executing immediately (no composer or pending \confirmation to point the user at), only takes explicitly requested actions, checks before \creating events with attendees, declines email drafting/sending with a pointer to AI chat \-or the email composer, and when a reply links an item the channel may not already see ends \-by asking \"Do you want me to share this with the members of the channel?\" — then, on a yes \+or the email composer, and when a reply links an item ends \+by asking \"Do you want me to share this with the members of the channel?\" — always, \+including for items it just created, since linking does not grant access — then, on a yes \in the thread, calls ShareWithChannel and replies only \"Okay.\"";/// The channel-mention prompt for the Macro channel bot.@@ -76,6 +88,7 @@ mod test {instructions.contains("Do you want me to share this with the members of the channel?"));assert!(instructions.contains("`ShareWithChannel`"));+ assert!(instructions.contains("Ask even when you just created the item"));assert!(instructions.contains("reply with only \"Okay.\""));assert!(instructions.contains("calendar_event"));assert!(instructions.contains("`channelId` is\nthe `id` on the conversation parent"));