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:
@@ -37,6 +37,9 @@ type Signal struct {
|
||||
Status string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
|
||||
DiscoverEveryDays int // find companies on a schedule; 0: only by hand
|
||||
ExpleeDefinition string // what the companies do, for explee.com's search
|
||||
}
|
||||
|
||||
// SpotLines are the non-empty lines of Spot.
|
||||
@@ -84,6 +87,10 @@ func Save(d *db.DB, s *Signal) error {
|
||||
s.Hypothesis = strings.TrimSpace(s.Hypothesis)
|
||||
s.Spot = strings.TrimSpace(s.Spot)
|
||||
s.Angle = strings.TrimSpace(s.Angle)
|
||||
s.ExpleeDefinition = strings.TrimSpace(s.ExpleeDefinition)
|
||||
if s.DiscoverEveryDays < 0 {
|
||||
s.DiscoverEveryDays = 0
|
||||
}
|
||||
if s.Name == "" {
|
||||
return errors.New("a signal needs a name")
|
||||
}
|
||||
@@ -114,16 +121,18 @@ func Save(d *db.DB, s *Signal) error {
|
||||
}
|
||||
now := formatTime(time.Now())
|
||||
if s.ID == 0 {
|
||||
res, err := d.Exec(`INSERT INTO signals (slug, name, hypothesis, spot, angle, status, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, s.Slug, s.Name, s.Hypothesis, s.Spot, s.Angle, s.Status, now, now)
|
||||
res, err := d.Exec(`INSERT INTO signals (slug, name, hypothesis, spot, angle, status, created_at, updated_at,
|
||||
discover_every_days, explee_definition) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
s.Slug, s.Name, s.Hypothesis, s.Spot, s.Angle, s.Status, now, now, s.DiscoverEveryDays, s.ExpleeDefinition)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.ID, err = res.LastInsertId()
|
||||
return err
|
||||
}
|
||||
res, err := d.Exec(`UPDATE signals SET slug = ?, name = ?, hypothesis = ?, spot = ?, angle = ?, status = ?, updated_at = ?
|
||||
WHERE id = ?`, s.Slug, s.Name, s.Hypothesis, s.Spot, s.Angle, s.Status, now, s.ID)
|
||||
res, err := d.Exec(`UPDATE signals SET slug = ?, name = ?, hypothesis = ?, spot = ?, angle = ?, status = ?, updated_at = ?,
|
||||
discover_every_days = ?, explee_definition = ? WHERE id = ?`,
|
||||
s.Slug, s.Name, s.Hypothesis, s.Spot, s.Angle, s.Status, now, s.DiscoverEveryDays, s.ExpleeDefinition, s.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -140,7 +149,7 @@ func Delete(d *db.DB, id int64) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const columns = `id, slug, name, hypothesis, spot, angle, status, created_at, updated_at`
|
||||
const columns = `id, slug, name, hypothesis, spot, angle, status, created_at, updated_at, discover_every_days, explee_definition`
|
||||
|
||||
func scan(rows *sql.Rows) ([]Signal, error) {
|
||||
defer rows.Close()
|
||||
@@ -148,7 +157,8 @@ func scan(rows *sql.Rows) ([]Signal, error) {
|
||||
for rows.Next() {
|
||||
var s Signal
|
||||
var created, updated string
|
||||
if err := rows.Scan(&s.ID, &s.Slug, &s.Name, &s.Hypothesis, &s.Spot, &s.Angle, &s.Status, &created, &updated); err != nil {
|
||||
if err := rows.Scan(&s.ID, &s.Slug, &s.Name, &s.Hypothesis, &s.Spot, &s.Angle, &s.Status, &created, &updated,
|
||||
&s.DiscoverEveryDays, &s.ExpleeDefinition); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.CreatedAt, _ = time.Parse(timeFormat, created)
|
||||
|
||||
Reference in New Issue
Block a user