From fd45e76f70f45b481f5ffdc8b9af5ec337a8028b Mon Sep 17 00:00:00 2001 From: "DESKTOP-RTLN3BA\\$punk" Date: Sun, 5 Jul 2026 04:37:24 -0700 Subject: [PATCH] feat(agents): sharpen lead-list quality and Maps/Search routing boundary Learned from lead-generation e2e runs (medical EMR, AI study app): - routing.md: requested-N lists must be distinct entities that fit the asked segment - branches/locations of one parent count once, parent website domain is an ownership signal, fill shortfalls by widening discovery instead of padding; place-shaped discovery routes to the Maps specialist, open-web/enrichment to Search. - google_maps prompt: exclusion criteria are strict (a satellite of an excluded chain is still that chain); shared parent domains mean one organization judged against the parent. - google_search prompt: pure place-discovery tasks return blocked with a next_step pointing to the Maps specialist. Co-authored-by: Cursor --- .../system_prompt/prompts/routing.md | 25 +++++++++++++++++++ .../builtins/google_maps/system_prompt.md | 2 ++ .../builtins/google_search/system_prompt.md | 1 + 3 files changed, 28 insertions(+) diff --git a/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/routing.md b/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/routing.md index 2dd079be5..2d69d9b0e 100644 --- a/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/routing.md +++ b/surfsense_backend/app/agents/chat/multi_agent_chat/main_agent/system_prompt/prompts/routing.md @@ -27,6 +27,31 @@ can retrieve — retrieve them, then answer with the facts and cite the page. Large results are fine: extract and return them, don't ask permission for bounded fan-out (≤20 sites) the user already requested. +**Places go to Maps, the open web goes to Search.** Discovering physical +businesses or venues of a type in a geography ("clinics in X", "tutoring +centers near Y", lead lists of local businesses) is the Maps specialist's +job — it returns structured name/address/phone/website per place, where +web search returns only snippets that need a second pass. Use the Search +specialist for entities without a storefront (online-only companies, +software vendors, publications), for facts and current events, and to +enrich places Maps already found. When a lead list needs both, run Maps +discovery first, then scrape or search the found websites for contacts. + +**Requested-N lists count distinct entities that fit the ask.** When the +user asks for N leads/items/results, every entry must be a distinct +*entity* — multiple branches, locations, sub-programs, or pages of the +same brand or parent organization are ONE entry, not several. A website +domain is an ownership signal: entries whose pages live on the same parent +domain (a government portal, a chain's site, a franchise system) share +that parent and count as one, judged against the parent. Entries must +also fit the user's stated segment: an item that belongs to an excluded +category (e.g. a local branch of a large chain when the user asked for +independents) does not qualify even if a specialist returned it — drop it, +don't relay it. If qualifying results fall short of N, widen the discovery +(another specialist call, adjacent geography or segment) to fill the gap +honestly; if it still falls short, deliver the smaller list with a +one-line note. An honest 10 beats a padded 15. + **Full datasets become files, not chat.** When the user wants a complete large dataset (an entire roster, portfolio, or directory — or asks for a CSV/file), do not paste or summarize hundreds of rows: instruct the diff --git a/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/google_maps/system_prompt.md b/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/google_maps/system_prompt.md index e7e8e05ab..5684859ff 100644 --- a/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/google_maps/system_prompt.md +++ b/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/google_maps/system_prompt.md @@ -17,6 +17,8 @@ Answer the delegated question from live Google Maps data gathered with your verb - Need richer detail (opening hours, popular times, extra contact info): set `include_details=true`. - Reviews / sentiment on specific places: call `google_maps_reviews` with the place `urls` or `place_ids`. - Batch multiple queries, URLs, or place IDs into one call rather than many single-item calls. +- Exclusion criteria are strict: when the task excludes a category or brand, drop every place whose name, website domain, or category matches it — a local branch or satellite location of an excluded chain/system is still that chain, never reinterpret it as acceptable. Fill the gap with more or wider queries instead. +- The website domain is an ownership signal: a place whose site lives on a parent organization's domain (a government portal, a chain's site, a health-system or franchise domain) rather than its own belongs to that parent — judge include/exclude criteria against the parent, and treat multiple locations sharing one parent domain as one organization. - Comparison requests: pull the current values, compare against prior values already in this conversation's earlier tool results, and report concrete deltas (added, removed, old -> new). diff --git a/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/google_search/system_prompt.md b/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/google_search/system_prompt.md index 8626322a3..1df72cc83 100644 --- a/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/google_search/system_prompt.md +++ b/surfsense_backend/app/agents/chat/multi_agent_chat/subagents/builtins/google_search/system_prompt.md @@ -30,6 +30,7 @@ Answer the delegated question from live Google Search data gathered with your ve - Do not read or extract a specific page's content — return the URLs for the web crawling specialist. - Do not generate deliverables or perform connector mutations; return findings for the supervisor to act on. - Google Maps places belong to the Google Maps specialist; YouTube belongs to the YouTube specialist. +- Discovering physical businesses or venues of a type in a geography ("find X businesses in Y") is the Google Maps specialist's job — if that is the whole task, return `status=blocked` with a `next_step` pointing the supervisor to the Maps specialist instead of approximating it from search snippets.