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(ai): resolve email via name search before searching emails (macro-1915) (#4193)
Eric Hayesa2331b82fdde
diff --git a/rust/cloud-storage/prompt/src/tool_usage.rs b/rust/cloud-storage/prompt/src/tool_usage.rsindex 9340f88171..5d3661dd89 100644--- a/rust/cloud-storage/prompt/src/tool_usage.rs+++ b/rust/cloud-storage/prompt/src/tool_usage.rs@@ -46,6 +46,16 @@ users workspace. If the user asks you to create a document, write a code file, oasking for something specifi like "someone mentioned ..." prefer searchif they are asking for summaries of messages or emails prefer listing.After collecting information read the appropriate resource using the read tool.++2. Finding a person's emails — resolve the email address first:+ When the user asks about emails to/from a person by NAME (e.g. "find emails+ from Jane Smith", "what did Bob say"), DO NOT search emails by the person's+ name. Name matching only catches addresses where that exact display name+ happens to appear, so it misses most of the thread. Instead, first run a+ NameSearch (or NameSearch on contacts) to resolve the person's email address,+ then run a ContentSearch for that email address (wrap it in double quotes,+ e.g. `"[email protected]"`) to get comprehensive hits across sender/recipient/+ cc/bcc. Only fall back to searching by name if you cannot resolve an address."##;static INTENT: &str = "The model proactively uses tools with precise filters instead of \diff --git a/rust/cloud-storage/prompt/tests/compose.rs b/rust/cloud-storage/prompt/tests/compose.rsindex 705fccca08..b2fa29cefd 100644--- a/rust/cloud-storage/prompt/tests/compose.rs+++ b/rust/cloud-storage/prompt/tests/compose.rs@@ -46,7 +46,8 @@ fn tool_use_prompt_appends_tool_section_to_base() {assert!(rendered.trim_end()- .ends_with("read the appropriate resource using the read tool.")+ .ends_with("Only fall back to searching by name if you cannot resolve an address."));assert!(rendered.contains("# Tool Use"));+ assert!(rendered.contains("read the appropriate resource using the read tool."));}