Phase 2 part 4: discovery per signal (Claude web search, explee.com)

Each signal's page can search for organizations that show it, by hand or
every 7, 14 or 30 days. Claude with the web_search_20260209 server tool
(pause_turn resumed) works from the signal's "How to spot it" lines and
the profile's targets; a company is kept only if its evidence URL was
among the pages searched. explee.com's company search runs the signal's
description in the target sizes, scored against the hypothesis, keeping
strong matches. Our sites, the inventory, existing prospects, CRM
Accounts and suppressed domains are left out. New companies go to Review
tagged with the signal. Schema 8 adds discovery_runs (counts, searches,
why companies were left out) and the signal's schedule and explee.com
description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 18:27:35 -07:00
co-authored by Claude Opus 5.5
parent b025a97e4a
commit 157902f7e2
15 changed files with 1234 additions and 15 deletions
+37 -2
View File
@@ -26,14 +26,16 @@ const DefaultAnthropicModel = "claude-opus-5-5"
// Tasks the app asks a model to do. Each can use its own model.
const (
TaskProfile = "profile" // drafting the company profile, or an inventory entry, from a website
TaskContent = "content" // writing posts
TaskProfile = "profile" // drafting the company profile, or an inventory entry, from a website
TaskContent = "content" // writing posts
TaskProspects = "prospects" // finding companies that show a buying signal (with web search)
)
// Tasks lists the tasks with a description, for the settings page.
var Tasks = []struct{ ID, Label string }{
{TaskProfile, "Drafting the profile and filling in inventory entries"},
{TaskContent, "Writing posts"},
{TaskProspects, "Finding prospects for a buying signal (needs Claude, for web search)"},
}
// Config is the AI setting.
@@ -133,6 +135,39 @@ type Client interface {
Generate(ctx context.Context, req Request) (string, error)
}
// ResearchRequest is a prompt answered with web search.
type ResearchRequest struct {
Task string
System string
Prompt string
MaxTokens int
MaxSearches int // web searches allowed (each is billed)
BlockedDomains []string // never search these
}
// Source is a web page the model saw.
type Source struct{ URL, Title string }
// ResearchResult is the reply, the pages behind it, and how many searches
// it took.
type ResearchResult struct {
Text string
Sources []Source
Searches int
SearchErrors []string
}
// Researcher is a client that can search the web. Only Claude can.
type Researcher interface {
Research(ctx context.Context, req ResearchRequest) (*ResearchResult, error)
}
// ErrNoResearch means the AI provider can't search the web.
var ErrNoResearch = errors.New("web research needs Claude (Anthropic) as the AI provider; other servers can't search the web")
// DecodeJSON reads the outermost JSON object in a reply.
func DecodeJSON(text string, out any) error { return decodeJSON(text, out) }
// ErrNotConfigured means the provider can't be used yet (no key, no server).
var ErrNotConfigured = errors.New("AI provider not configured")