Skip to content
Maxwell CollinsContact

A sales lead engine built on public evidence

An AI-run engine that finds companies hiring for the jobs his AI products replace and ranks them as sales leads.

What it achieved

An AI runs his sales prospecting every week, with every lead's reasons linked to public proof.

The short version

An AI runs his sales prospecting every week, with every lead's reasons linked to public proof. Maxwell built it to find companies advertising for the jobs his AI products replace, such as the estimators his bid analyzer serves. A scheduled AI session runs it every week. It searches public job postings, stores every signal with its source link, scores each company and checks contact mailboxes. A fixed formula scores each company and shows its working. Staffing agencies posting for someone else are caught three different ways and set aside. Personal data expires after 90 days, and a daily health check reports on every source. A new industry can be added in about an hour.

The problem

The lead tools on the market are fixed databases, so the same search returns the same records everyone else has already worked. Finding buyers is a research problem, and research is what AI does best. So AI is the engine here, and code is used only where AI can't be trusted, such as scoring and counting.

In use

  1. On Monday morning the scheduled session searches public job postings and company pages in the chosen industry.
  2. Every signal it finds is stored with its source link. A signal with no link cannot be stored.
  3. A fixed formula scores each company, and staffing agencies are spotted and set aside.
  4. It checks buyer mailboxes such as estimating and bids against each company's mail server, and keeps only those the server proves exist.
  5. Maxwell opens the week's file: ranked companies, each score broken into its parts, with links he can click to check every reason.

What it achieved

  • His sales prospecting runs without him doing it: a scheduled AI session runs every Monday and delivers a batch of ranked leads.
  • Each batch is companies hiring right now for the job his product replaces, not records from a database every competitor has already worked.
  • Recruiters no longer pose as buyers: three independent tests set staffing firms aside, and the name test matched 39 company names, all 39 genuine staffing firms.
  • He can check every reason before contacting a company: 1,796 signals across 389 companies, each stored with its source link, and 5,319 scoring records that show the working.
  • Pointing it at a new industry takes about an hour.

The full record

On this page
In one sentence

Maxwell built a lead engine of 2,635 lines of application code, scripts and database schema in 25 files, plus 2,340 lines of tests, 170 test cases, a 9-table evidence database and 15,191 lines of Markdown and YAML design, research and operating documents (179,244 words) that finds companies advertising for the jobs his AI products replace, scores them with a deterministic, explainable formula, and hands over a dated file of ranked leads where every lead carries the public links that justify it; he builds by directing AI agents, and a scheduled AI session runs it every week.

lines of code
2,635
test cases
170
table evidence database
9

What it does

The size of the whole

124 tracked files and 75 commits on all branches (64 on the main line). Application code and schema together: 2,635 lines in 25 files, made of 17 Python files with 2,185 lines (the pipeline, the primitives and the source normalizers), plus 7 shell scripts with 345 lines (three of them with no file ending, bin/init-db, bin/install-cron and bin/uninstall-cron; database setup, scheduler install and uninstall, three scheduled-job wrappers, a measurement query). Tests: 14 files, 2,340 lines, 170 test cases. Configuration: 278 lines of schema, rubric, source and name-list files. Documents: 70 Markdown files with 15,005 lines (179,244 words) plus 172 lines of YAML, 15,191 lines of Markdown and YAML in all. Counted from the commit history, the project is 26,846 lines added.

The evidence database (data/schema.sql, 105 lines, 9 tables, one SQLite file per tenant).

  • entities: the things being sold to (here, companies), with a uniqueness rule so the same company is never stored twice.
  • signals: each observed buying signal, with a required evidence_url, the HTTP status the link returned when captured, and the time observed. A signal with no link cannot be stored. A uniqueness rule on source, link and time makes re-running any stage safe.
  • scores: every scoring run, with the rubric version, the score, the full breakdown as stored data and a qualified flag, so any lead's score can be traced to its parts.
  • contacts: emails and names with the method that verified each one and the evidence behind it.
  • feedback: the buyer's verdict on delivered leads, kept as the corpus for tuning the rubric.
  • deliveries: each batch delivered, its size and its file.
  • budget_log: every call against each source's monthly allowance.
  • fetch_log: every outside request, its status, its error class and how many attempts it took.
  • verification_log: every email check, its method, confidence, mail host and server response code.

Nine small tools (the charter's seven primitives plus the purge and the health check), the only route to the outside world and the database (primitives/, 1,180 lines in 9 modules; each runs from the command line and as code).

  • fetch: HTTP with retries, exponential backoff by class of failure (a fixed set of retryable statuses: 408, 429, 500, 502, 503, 504 and 529), a --budget check made before the call, and a record in fetch_log of every call.
  • browse: a headless browser for pages that need JavaScript, limited to an allowlist of three address schemes (http, https, data) with a timeout; its tests are marked as integration tests.
  • verify_email: asks a mail server over SMTP whether a mailbox exists, and classifies the answer into proven (0.95 confidence), accepts-everything (0.5), or domain-only (0.0 to 0.1). It runs asynchronously, records greylisting (a server asking the sender to retry later) as its own low class, and, where the host blocks outgoing port 25, the --no-enrich option lets the run degrade honestly.
  • dns_lookup: mail servers for a domain, and its subdomains from public certificate logs, with retries on temporary server errors (429, 500, 502, 503, 504), stripping the wildcard from certificate-log names.
  • store: the database layer, with safe repeat writes that update rather than duplicate, and the purge routine. Its upsert (ON CONFLICT... DO UPDATE... RETURNING) needs SQLite 3.35 or newer.
  • pattern_email: generates candidate addresses from a name and a domain, with accent stripping (Unicode NFKD) and the tokens {first}, {last}, {f}, {l} and {domain}.
  • cdx_query: asks the Common Crawl public web archive for every page matching a pattern, retries up to 3 times, parses each line strictly and tags every record with the crawl snapshot it came from.
  • purge_old: deletes personal data older than the retention window.
  • health_check: computes the four daily health measures (below).

The seven tools of the charter (fetch, browse, verify_email, dns_lookup, store, pattern_email, cdx_query), the scoring engine below and the five-stage runner are the core of the code.

The scoring engine (pipeline/scoring.py, 255 lines, 25 test cases). A pure function: the postings of one company and the rubric go in, a score, a breakdown and a qualified flag come out. It reads no clock and does no input or output, so the same inputs always give the same ranking.

  • role_match (weight 40): a posting title contains a trigger role; the longest, most specific role wins.
  • repost_pain (25): the same role posted at least twice in 90 days.
  • multiple_open (10): the same role open at least twice within the 60-day freshness window.
  • staleness_pain (15): the oldest matching posting is over 30 days old.
  • anti_signal (minus 30): a matching posting needs AI or machine-learning expertise, or describes collision and auto-body estimating.
  • staffing_anti (minus 35): the company hires on someone else's behalf.
  • Every component decays with a 30-day half-life by the age of the posting. The stored score is the sum of the rounded displayed components, so the number always equals its breakdown. The qualified line is 50.

Three-witness staffing detection (inside the scoring engine, with a 105-line dated name list in staffing_denylist.yaml). Any one of three independent witnesses marks a staffing firm. (1) An exact match, after stripping legal suffixes, against the named list: never a substring, so "One" cannot swallow "System One". (2) A self-declaring word in the company's own name (staffing, recruiting, recruiter, recruitment, headhunter, talent, personnel, workforce, placement, manpower, executive search and others: 14 tokens in all), which needs no list and so catches firms never seen: measured against all 342 distinct company names it matched 39 names, all 39 genuine staffing firms. (3) Third-party-recruiter phrases in the posting text ("teamed up with", "contract to permanent", "direct hire", "on behalf of", "confidential client", "recruiting for", eight markers in all, plus "our... client" with up to three words between, matched on word boundaries so the ordinary plural "our clients" cannot fire). The code records candidate markers that were measured and rejected, with the companies each would have wrongly suppressed, so they are not proposed again.

The five-stage weekly runner (pipeline/run_week.py, 598 lines, 27 test cases): discover, ingest, score, enrich, deliver, in one reproducible pass.

  • Discover pulls the universe of companies from a job-listing source, refuses to call a source above 90% of its monthly allowance, merges new facts into existing records without overwriting, and keeps going past a bad page or a bad record.
  • Ingest pulls postings from the two public applicant-tracking APIs, honours each source's cadence, and reports its coverage as well as its errors, warning when fewer than 10% of companies have a resolvable source.
  • Score runs the scoring engine over every company and reports how many were scored, qualified and suppressed as staffing.
  • Enrich resolves the mail host for each top lead, probes six buyer-relevant role mailboxes (estimating, estimator, preconstruction, bids, proposals, info) over SMTP, stops at five contacts per lead, and treats a domain that accepts everything as such.
  • Deliver writes outputs/<date>-<domain>.csv and a deliveries row. A contact reaches the file only if the mailbox is proven by an actual server answer (a domain-only check is not proof) and is not a recruiting or HR inbox (careers, jobs, hr, talent, recruiting, hiring, people and others), and buyer relevance outranks verification method. An empty contact cell is an accepted outcome.
  • Each stage prints its report and timing, and a summary closes the run. The runner takes --stages, --discover-pages (default 5), --enrich-top (default 20) and --no-enrich; scoring takes the current time as an input rather than reading a clock.

The first vertical (domains/jobs-ai-tools/): companies advertising for the roles that his AI products replace, aimed first at the AI Bid Analyzer (buyers: estimators, proposal managers, preconstruction teams at general contractors and large subcontractors). Trigger roles: bid estimator, estimator, proposal manager, preconstruction manager, chief estimator. It holds a brief, a three-source config (two applicant-tracking APIs and a job-listing aggregator with a 250-calls-a-month allowance), a versioned rubric, a seed list of 25 construction firms, three source normalizers (Greenhouse, Lever, Adzuna), and a measurement script, ops/queries/auto-body-anti-signal-coverage.sh, that re-checks the auto-body filter against the database (it matches 4 of the 309 companies carrying an estimator title and leaves 305 untouched). The script is 84 lines with labelled blocks for what it measures, what it cannot see, its preconditions, a negative test and its exit codes (2 for a missing database, 3 for an empty one). It is a script and not a test because the database is not in the repository and a test would pass on empty data; its control compares 1,564 estimator hits with 0 hits for a term that is absent. The seed file's columns are company_name, ats_platform, ats_slug and country.

Domain packs and one-hour vertical onboarding (domains/_template/, domains/REGISTRY.md, domains/_constraints.md, the add-domain skill). An industry is a folder of data: a brief, a source list and a scoring rubric. The add-domain skill walks the operator through creating one and writes the active-domain marker; a new vertical needs code only for a brand-new kind of source.

Ten skills (.claude/skills/, mirrored for other agents in .agents/skills/, 20 files): run-week, discover-universe, ingest-signals, score-leads, enrich-contacts, deliver-batch, intake-feedback (turns the buyer's bad-lead verdicts into a proposed rubric change and a version bump), add-domain, purge-old and health-check. Each states when to use it, its steps and how it fails.

Three scheduled jobs (bin/install-cron, bin/uninstall-cron, bin/cron/, ops/launchd/):

  • The weekly run, Monday 06:00, starts the whole pipeline through a headless Claude session.
  • The nightly purge, 02:00, deletes contacts and verification records older than 90 days, leaves company-level facts, signals, scores and operational logs, and rolls back whole on an error.
  • The daily health check, 07:00, computes four measures and sends a notification: source success rate over the last 24 hours (alert below 90%), mail bounce rate by domain (alert above 15%), monthly budget use per source (warn at 75%, halt at 90%), and signal staleness per company (alert after 14 days). A failure still notifies, because silence would hide it. Install is repeatable.

The Twenty deployment kit (twenty-deployment/): templates for standing up a self-hosted Twenty customer-record system for the engine to deliver into (a port override, an environment template with a placeholder for every secret, and instructions that include a rotation reserve for the encryption key held off the repository), and an integration plan of 3,593 lines with phases 0 to 7 (8 phases) and a verifier after each phase, under a Phase Verification Protocol.

The design record. One vision, ten designs, five reviews, twelve research notes and three master plans: one product vision (lead-engine-vision.md, 156 lines), a universal design (709 lines), a first design (361), a critique (289) and a second design (589); ten competing architectures in designs/ (2,022 lines, from 107 to 305 each); five hostile reviews in reviews/ (926 lines); a product vision and concept; twelve research notes in plans/research/ (1,740 lines); three master plans in plans/ (1,686 lines), including a 1,004-line plan for a named-decision-maker engine; the charter; and three phase handoffs. Further, the build plan (3,593 lines) and the decision-maker plan, whose audit findings each became a tracked issue and whose three spikes on general contractors all proved out (a named preconstruction head from the team page, an SMTP-confirmed personal email at 0.95 with fake-address controls rejected, nickname variants and the canonical domain resolved first); it ranks contact coverage in tiers (verified personal email, named person plus pattern guess, role mailbox, owner fallback, company only). The auditable-funnel plan answered three hostile reviews and was re-reviewed against each reviewer's own blockers; it rests on two laws, evidence before construction and every guarantee a mechanism rather than prose, and it ports the failure ledger of his QA harness. The three handoffs (771, 432 and 427 lines) carry a master verifier's 47-of-47 pass, named behavioural failure patterns, a do-not-trust checklist and session-marker commits. The vision allows both internal and external clients.

The delivered batches (outputs/ and the deliveries table): each a CSV of company, domain, top signal, score, product matched, contact email, contact name and title, and the evidence link.

Evidence database as measured (data/leads.db): 389 companies, 1,796 signals and 5,319 scores.

What it achieved

  • A scheduled AI session runs the whole pipeline every Monday and delivers ranked leads, with the nightly purge and the daily health check running beside it.
  • 389 companies and 1,796 evidence-backed signals held, with 5,319 scoring records.
  • 75 commits, 26,846 lines added and 170 test cases.
  • With no person present, its review agents classified every delivered company independently, audited the evidence, ran a craft review whose findings were fixed before the pull request, and caught 11 of 11 mutations.
  • A 1.5-day build run of 89 dispatches, 570 gate runs and 19 builder agents.
  • An integration plan of 8 phases (0 to 7) and 3 handoffs written; the weekly run, nightly purge and daily health check were each installed as scheduled jobs.

The problem it solves

  • The lead tools on the market are fixed databases. The same query returns the same records the rest of the market has already worked through. Finding buyers is a research problem, and research is what AI is best at, so AI should be the engine and code should exist only where AI cannot reach.
  • A product vision should not choose its own architecture. He wrote the vision with no technology named, so that several competing designs could be drawn from it and compared on their merits.
  • An agent that reads only a slice of the documents makes confident false statements about what the project covers. He answered that with a charter every agent must read first and a rule that every statement about the project is cited or marked as unverified.
  • A plan written for one part gets read as the limit of the whole product. The charter names each such document and what it does not cover, and the decision-maker plan's own boundary is stated as a module boundary, not the product's ceiling.
  • A phase that passes its verifier can still hide debt, so a finding accepted as "approved with notes" is never set aside. His handoff told the next agent to distrust the previous agent's framing, audit every deferred finding on its own, and fix each one in its own cycle before the next phase, with Phase 2 (zero reviewer overrides, 37 of 37 checks) as the standard.
  • Scores have to be comparable from one run to the next, which stages run by hand cannot give. So a fixed runner and a pure scoring function give the same ranking for the same inputs.
  • Staffing agencies post for the same roles as real buyers. He had the pattern measured and turned it into a three-witness detection method, seeded the name list from real runs, and extended it as later batches showed more.
  • A text marker that looks right can be wrong at scale. "We are seeking" fired on two genuine employers; the plural "our clients" fired on two real contractors; an "anonymous employer" marker matched 24 companies including a genuine buyer. Each was measured against all 1,377 job-posting signals before adoption or rejection, and the rejections are recorded in the code.
  • A source that cuts descriptions off at 500 characters blinds every text-based check (199 of 200 sampled postings ended in an ellipsis). Detection that must be reliable was moved into a complete field, the company name.
  • A stage reporting "no errors" can still be seeing nothing. The stage reports its coverage and warns when it is low.
  • A verified mailbox is not a useful one: a recruiting inbox passes every mailbox check. The delivery step excludes recruiting and HR inboxes outright and ranks buyer relevance above verification method.
  • A filter must be measured, and so must the document that describes it. The collision-estimating filter was measured against all 1,796 signals, and the measurement is a re-runnable script that the paragraph explaining the filter must agree with.

How he built it

He builds by directing AI agents; the engine, its design record and its rules were all produced that way, and the rules below are what made it trustworthy.

  • The charter is canon. CHARTER.md (178 lines) is read before any other document and before any answer about what the project is. Where another document disagrees, the charter wins. It is updated in the same change as any decision about scope, and it carries an index naming each document's role.
  • Cite or qualify. Any statement about what the project is, does or plans carries a file-and-line citation or the prefix UNVERIFIED:. A bare confident claim is defined as a defect.
  • RESEARCHED ≠ DESIGNED ≠ BUILT. Three different things an agent may never blur: analysed in a research note, written up as a design, and present as code. The charter tags each capability with which it is.
  • Search before you answer. An agent may not infer what the project does from a file name, a skill name, a commit log or a plan title.
  • UNCONFIRMED, and ask. An agent may not invent his business intent. What he has not decided is listed as such, and his decisions are logged with their dates.
  • Do not generalize a scoped document. Documents that cover one slice are named as such.
  • The universal constitution. Six rules for every vertical. Every signal has a link that returned successfully at capture time. No paid vendors, not even their free tiers. No pages behind a login. Personal data expires after 90 days. Every outside call checks its budget first and halts at 90% of the month's allowance. Every stage can be run again safely. domains/_constraints.md adds the allowed and disallowed sources (no LinkedIn, no paid vendor, no source needing a login, cookie or captcha), the rule that every email is verified by SMTP before delivery, a lawful-basis record and immediate honouring of opt-outs.
  • Fail closed. A source that is down or a signal that cannot be verified is reported as a gap. It is never filled in, dropped quietly or papered over. The domain-role parser stops with an error if it finds no trigger roles, because scoring everything zero silently would be worse.
  • AI-native, not AI-bolted-on. AI does discovery strategy, source selection, scoring and contact reasoning. Code is kept to mechanical work.
  • Primitives: use these, do not reinvent. The tools above are the only route to the outside world or the database, and they are invoked in one module form so the import rules cannot drift.
  • Repo idioms and traps. The operating file records the traps with the reason for each: why a missing identifier is stored as an empty string (a database treats two nulls as different), why attributes are stored as text-encoded JSON, why there are no delete-cascade clauses in an append-only store, and why an empty database path is refused.
  • The ten-design bake-off. Before any code, ten fully different architectures were written from the one vision in a single day, from a skills-first tool to an event-sourced core, a pipeline graph, a durable workflow engine, a single binary, a cloud service, a conversational system and a command-line composition.
  • Five hostile reviews. Each design was attacked from five angles: a sceptical engineer, fidelity to the vision, the buyer, operations, and security and compliance. Each returned a verdict and required changes.
  • Two rounds of evidence research, six angles each (investor, incumbent, compliance, data operator, customer, competitor), before the design was fixed.
  • Phase verifiers, inside subagent-driven development. Each build phase was split into tasks, each given to a fresh agent and checked by a two-stage review (spec, then code quality) with a fix agent and a re-review; each phase then ended with a fresh verifier that ran the acceptance evidence itself and had not written the work. Phase 2 shipped 7 primitives with zero reviewer overrides and 37 of 37 checks.
  • Phase handoffs. Three dated handoffs with a chain, a list of stale references and the carried findings, so each new agent started from the record.
  • Three-witness detection and refusal as arithmetic. A company that does not fit is not argued about. It carries a negative weight in the score, visible for each lead.
  • A bounded headless session. .claude/settings.json holds an allowlist of 17 entries limiting what the unattended weekly session may do, and AGENTS.md (101 lines) mirrors the operating file for a second agent tool.
  • Measurement with a control as a working rule: a count is trusted only beside a case that must come out zero.
  • Measured before adopted. Every detection rule is checked against the whole corpus first, and the rules that failed are written down so they are not re-proposed.
  • The handoff contract. He left the boundary with the field-service platform to engineering, with one standard: a qualified lead must cross it with everything needed and nobody re-keying anything. The charter's integration section specifies what is pushed (identity, tank assets, decision-makers, evidence, why it qualified, outreach history) and a disposition webhook coming back (converted, bad-lead, wrong-contact, do-not-contact) that writes feedback and suppression. A repeated push updates the record and never duplicates it.
  • How it reaches a buyer. A dated file of ranked leads, each with its score broken into parts and links a person can click to check every reason, and a daily notification of the engine's health.

Named concepts

The named concepts, defined

The charter · Cite or qualify · UNVERIFIED · RESEARCHED ≠ DESIGNED ≠ BUILT · The universal constitution · evidence_url · Primitives · Domain pack · One-hour vertical onboarding · AI-native, not AI-bolted-on · The ten-design bake-off · Phase verifier · Three-witness detection · Anti-signal · run-week · staffing_anti · Fail closed · Repo idioms and traps

What it shows

He can turn open-ended research into a scheduled AI operation whose every output can be checked by the person receiving it, and choose its architecture by competition before any code is written.