{"success":true,"name":"brimind-whatsapp-pre-filter","description":"Reachability pre-filter — two tiers, before scoring and before dossiers","category":"unitary","path":"unitary/brimind-whatsapp-pre-filter/SKILL.md","file":"SKILL.md","content":"---\nname: brimind-whatsapp-pre-filter\ndescription: Reachability pre-filter — two tiers, before scoring and before dossiers\n---\n> Imported from [PRIVATE_HOST] `~/unitary/agents/skills/brimind-whatsapp-pre-filter`. Paths are relative to `[PRIVATE_HOST]:[PATH]`; run commands there via `ssh [PRIVATE_HOST] 'cd ~/unitary && ...'`. Owner send rules from skill i7-remote-ops still apply.\n\n\n# Reachability pre-filter — two tiers, before scoring and before dossiers\n\n**Status: VALIDATED IN PRACTICE 2026-08-31** — run against all 40 leads in the\ndatabase: 26 on WhatsApp, 12 not, 2 undetermined. Result on disk at\n`client-finder/results/db/whatsapp-reachability-2026-08-31.json`. Adopted by\nSinda as permanent and mandatory: scrape the listing set → check reachability →\ndossier only what is reachable. Unreachable ones are kept as rows with their\nreason, so we never lose the denominator.\n\n**Two-tier procedure ruled by Sinda 2026-09-01** (letter:\n`agents/mailbox/opportunity-searcher/done/2026-09-01T03-00-00-bizdev-manager.json`).\n\n## Classify the line type in Tier 1 — it predicts Tier 2 for free\n\n> **The rule, before the tables below:** a line-type guess **predicts, it never\n> decides** — Tier 2 still confirms, and a deferred lookup comes back `unknown`\n> with the reason, never `unreachable`. It **fails OPEN**: no rule for a country,\n> or a number that will not parse, means **spend the lookup**. And it may only\n> ration a lookup where the derivation is near-certain — derived from our own\n> checks, with the sample size beside the rate.\n\nThe country tables that follow are the *evidence* for those rules. They are the\ninteresting part, which is exactly why they are underneath: the finding is what\ngets remembered, the rule is what keeps someone out of trouble (Dali's framing,\n2026-09-01, applied back to my own file).\n\n\n**Rules are per country and must name the country they were derived from**\n(Sinda, 2026-09-01). A dialling plan is not transferable, and a rule applied to\nthe wrong one would deprioritise real accounts.\n\n**Ireland — derived from 13 checks, 13 of 13 correct.** `+353 8x` is a mobile and\nwas on WhatsApp every time; every other prefix was a landline and was not. The\nlandline half is 0 of 9, which still allows a true account rate up to **28%**\n(Dali, 2026-09-01, one-sided 95% bound for zero events in n trials). That is\nstrong enough to DEFER a lookup and nowhere near strong enough to conclude one.\nAbout 30 clean negatives would get that bound to 10%, 60 to 5% — a number worth\ncollecting toward.\n\n**Tunisia — derived from 46 checks in our own store, and it is WEAKER. Do not\ncarry the Irish confidence across.**\n\n| `+216` prefix | on WhatsApp | not | rate |\n|---|---|---|---|\n| 2x | 12 | 2 | 86% |\n| 5x | 14 | 5 | 74% |\n| 9x | 8 | 2 | 80% |\n| 7x | 0 | 3 | anecdote — NOT a rule |\n\n**There is no Tunisian rule, and that is the finding.** The mobile prefixes run\n74-86%, not 100%, so a Tunisian mobile is a good bet and never a verdict. And\n`7x` at 0 of 3 is **not** written into the rule table: three observations cannot\ntell \"never\" apart from \"sometimes\" — zero in three still allows a true rate as\nhigh as **63%** (Dali, 2026-09-01, recomputing my own 46 checks; arithmetic sums\nto 46 and the rates hold). So Tunisia has no rule, and by the fail-open rule\nbelow, Tunisia spends the lookup. Ireland's 13-of-13 was the exception, not the\npattern. On the West Cork batch this predicted Tier 2 perfectly,\n13 of 13 — every mobile returned `exists:true`, every landline `exists:false`.\nSo Tier 1 can mark a row `channel_unverified` (mobile, a messaging candidate) or\n`channel_voice_only` (landline, a real channel we do not message on) before any\nservice call, and Tier 2 only confirms it.\n\n**It fails OPEN** (Sinda, 2026-09-01). No rule for a country, or a number that\nwill not parse, means **spend the lookup**. A missing rule must never behave like\na negative prediction — that is an empty file reading as an empty market, wearing\nthe costume of a budget optimiser.\n\n**It predicts, it never decides** (Sinda, 2026-09-01). A line-type guess may\n**never demote a row on its own** — Tier 2 still confirms. Predicting off a\ndialling prefix and then treating the prediction as the verdict is the same error\nas scoring reachability off a prefix, which cost us a whole ranking once already.\nUse it to order the work and to stop building dossiers for landlines; use the\ncheck to decide.\n\n**A prediction may only ration a lookup where it is NEAR-CERTAIN, and\nnear-certain has a definition** (Sinda, 2026-09-01). Near-certain means *derived\nfrom our own checks, with the sample size written next to the rate*. `7x` at 0 of\n3 is not near-certain even though it is 3 for 3 — the sample is 3. Ireland's 13\nof 13 was not a pattern either; it was a small sample that happened to be clean,\nand it got into a rule on that basis. Tunisian mobiles at 75-85% would have\ndeprioritised about one real account in five, in the market where all 36 of our\nsendable leads actually are. Quote the sample beside every rate in this file, and\nargue with the sample before you argue with the rate.\n\n**Positives go stale in 7 days, negatives in 30 — and the asymmetry is the\npoint** (Sinda, 2026-09-01). Write both numbers with both reasons, because the\nnumbers look arbitrary alone and someone will unify them for tidiness.\n\n- A **positive gates a SEND**. Wrong, we message a dead number and find out the\n  hard way. Cheap to detect, so expire it fast: **7 days**.\n- A **negative gates EFFORT** — it stops a dossier being built. Wrong, we skip a\n  real prospect silently and never learn. More dangerous, but slower moving: a\n  business with no WhatsApp last month usually still has none. **30 days**.\n\nTwo conditions on negatives, both absolute. They are **re-asked free at send\ntime regardless of age** — the check costs nothing, so nothing is ever sent on a\ncached verdict. And a negative may **never be the reason a lead is deleted or\nwritten off**; it demotes, it does not remove. Eamonn is the argument: Google\nsaid no channel, we nearly stopped, and he was reachable.\n\nAn absent check gets **no date at all**. It does not inherit one, and it is not a\nnegative — an absent that borrows a date it never earned is our ignorance wearing\na timestamp.\n\n`channel_voice_only` matters for planning: a QR re-scan does **not** unblock those\nrows. Only a mobile, an email, or the owner accepting voice outreach would.\n\n**Line type may govern what we SPEND, never what we conclude** (Dali,\n2026-09-01). dealflow's Telegram ladder has a rolling budget of 20 lookups a day\n(`TELEGRAM_PROBE_DAILY_MAX`, `telegram/lib/reach.js`) with no line-type\nawareness: on the West Cork cohort that burned 9 of 13 lookups on landlines.\nDeferring landline lookups buys the budget back for mobiles. But a deferred\nlookup must come back **`unknown`, with the reason stated** — never\n`unreachable`. A prefix that decides is a prediction wearing a verdict's clothes.\n\n## Telegram: a @handle is confirmed for free, before any probe (Omar, 2026-09-07; ruled standing by Sinda, letter 6a9f1aa5)\n\nThe public page `https://t.me/<handle>` serves Open Graph tags — `og:title`,\n`og:description`, `og:image` — to a plain `curl` with a Chrome UA. **If\n`og:title` is present, the account exists.** On the Tashkent lots this resolved\n**30 handles out of 30, and again 17 out of 17**, without spending a single\nlookup from the 20-a-day budget.\n\nSo the order is: read the handle off the business's own site → confirm it on the\npublic t.me page → only then, if a probe is still needed, spend one. The\ndescription and profile image come back in the same request, which is often the\nonly address and phone the business publishes.\n\nTwo limits, both binding:\n\n- **No `og:title` is `unchecked`, never `no`.** t.me answers 200 with an empty\n  shell for a handle it will not preview; that is our limit, not a fact about\n  the account. Write `telegramHandleVerified: null` with the reason.\n- **A handle harvested from a third-party directory is not the business's.**\n  `goldenpages.uz` served `@gpuzbot` — the directory's own bot — as the \"site\"\n  of two Tashkent vet clinics. Same trap as the annuaire email address. Keep only\n  a handle found on the business's own page, and reject `*bot` accounts: nobody\n  reads them.\n\n**voice_only is NOT reachable** while we have no calling operation. Nobody here\nmakes cold calls in English to Cork, so counting those rows would inflate the\nfunnel with effort that does not exist. If the owner decides to start calling,\nthey become reachable that day and not before. Report the honest number: West\nCork is **4 sendable across 7 towns**, not 20.\n\n## whatsappNumber — one field, plus how we know (Sinda, 2026-09-01)\n\n`whatsappNumber` means **the number a message can be sent to on WhatsApp**. Both\na published wa.me/wa.link target and a verified registration qualify. Never open\na second field for the same kind of value — two fields holding one value is\nexactly how a sender picks the wrong one, which is the Mathlouthi bug (listing\nphone vs wa.me number) under a new name.\n\n`whatsappNumberSource` is **required** alongside it:\n\n    {\"type\": \"published_link\", \"url\": \"https://wa.me/...\"}\n    {\"type\": \"verified_registration\",\n     \"check\": {\"result\": true, \"checkedNumber\": \"+216...\", \"endpoint\": \"...\"}}\n\nA `false` check sets `whatsappNumber` to null and still records the source — \"we\nchecked and it is not on WhatsApp\" is a fact worth keeping, and stops anyone\nre-checking it. A verified registration is the *stronger* evidence: it is the\nthing we need to be true, where a published link is only a claim that it is.\n\nApplied 2026-09-01 across all 50 leads and 47 dossiers: 34 verified_registration,\n2 published_link, 12 negative, 2 unknown — 36 leads carry a sendable number.\n\n## A negative from a search engine is not a negative from a source\n\n**If a source is named as checked, it must have been fetched.** Ruled by Sinda\n2026-09-01 after I wrote `notFoundOn: irish-pages.ie` for a business that\nirish-pages.ie was in fact listing, with a phone number, on a page I never\nopened. The search engine had not indexed it; the page had the answer.\n\nSits next to **null never demotes** because it is the same failure: our ignorance\nrecorded as a fact about the business. An empty search result is a fact about the\nindex, not about the world.\n\n- Fetch the source's own listing page before writing it into `notFoundOn`.\n- Quote what the page says, verbatim, next to the URL.\n- \"Searched and found nothing\" and \"fetched the page and it is not there\" are\n  different sentences. Only the second is evidence.\n\n## Second-source before dropping a zero-channel lead\n\nA Tier-1 zero is \"publishes no channel\", not \"has no channel\". Check one outside\nsource for that business only — a Golden Pages-style directory, Facebook, the\ntown listing. Bounded to the business, never a new town.\n\nWorked 2026-09-01: Pat Joe O'Donovan (Clonakilty) published no phone and no site\non Google Maps and had a phone on goldenpages.ie, confirmed by a SIMI membership\nlisting. Eamonn Mc Carthy Auto Services had only a Facebook page — a real\nchannel, but not sendable today. Evidence and every source URL:\n`client-finder/results/dossiers/west-cork-garages/second-source-2026-09-01.json`.\n\nRecord the value **and the URL it was read from**. A second-sourced number is\nstill a read, never an inference.\n\n## The rule\n\nA lead we cannot message is not a lead. The pre-filter runs **BEFORE scoring and\nranking**, and the Tier-2 service check runs **before** any dossier is built —\nnever after. An unreachable lead must never top a ranking; dossiers cost time and\ndisk and unreachable prospects should never consume either.\n\n## HARD RULE (verbatim, Sinda)\n\n> Only an explicit `false` or a Tier-1 zero-channel may demote — **`null` never\n> demotes.**\n\nA `null` is our ignorance, never a fact about the business. Collapsing `null`\ninto `false` would have emptied an entire ranking on the night the WhatsApp\nsession died: a failure of ours wearing the costume of a fact about them.\n\n## Tier 1 — channel existence, read off the listing\n\nNo service call. No network. **Can never return `null`** — the listing either\npublishes a channel or it does not, and both are facts we own.\n\nCount the published channels on the scraped listing row:\n\n- `phone`\n- `email`\n- `website` / `site`\n- a `wa.me` / `wa.link` WhatsApp link\n\n**Zero published channels** → the lead is **still scored** (the score is about\nfit, and the denominator stays intact), but it is **barred from the ranking**\nand the reason is recorded on the row. It is not deleted, not merged away, and\nnot silently dropped.\n\n```json\n\"channelExistence\": {\n  \"tier\": 1,\n  \"publishedChannels\": [],\n  \"count\": 0,\n  \"rankable\": false,\n  \"reason\": \"no_channel_published\",\n  \"source\": \"listing row — client-finder/results/dossiers/<batch>/raw/<town>.json\",\n  \"at\": \"2026-09-01T03:20:00Z\"\n}\n```\n\nOne or more channels → `rankable: true`, and the lead proceeds to Tier 2.\n\nTier 1 is cheap and always available. Run it on every harvest, including when\nthe WhatsApp service is down — it is the tier that keeps the pre-filter useful\non a night when Tier 2 cannot answer at all.\n\n**Second-sourcing before a zero stands.** A Tier-1 zero on a lead that otherwise\nfits the offer is worth a bounded second-source pass (goldenpages.ie, Facebook,\nthe local directory listing) before it is written off — a few searches per\nbusiness, no rabbit holes. A channel that surfaces makes it a top lead; nothing\nsurfacing makes `no_channel_published` a verified fact instead of an assumption.\n\n## Tier 2 — the :4913 `/check`, before dossiers\n\nStays exactly where it was: after Tier 1, before any dossier is built.\n\nThe endpoint is `GET /check` on the **whatsapp** service at **port 4913** — not\ndealflow, which is where it is easy to look first.\n\n```bash\n# 1. ALWAYS check the session is live FIRST. Skip this and you get 12 nulls\n#    and blame the market.\ncurl -s \"http://<lan-ip>:4913/status\"\n# -> {\"ok\":true,\"mode\":\"qr\",\"live\":true,\"status\":\"connected\",\"me\":\"216...\"}\n\n# 2. only then check numbers\ncurl \"http://<lan-ip>:4913/check?to=+[PHONE]\"\n# -> { \"to\": \"...\", \"exists\": true | false | null }\n```\n\n**Identify a process by its working directory, never its command line.**\n`pgrep -f \"src/server.js\"` also matches brimind-tunnel's wildcard dispatcher,\nwhich serves the live demo sites. Killing it would take them offline. Always:\n\n    lsof -a -p <pid> -d cwd\n\n**Two traps, both cost me a run on 2026-08-31.**\n\n*Use the LAN IP, not localhost.* An ssh tunnel from brimind-tunnel binds\n`[PRIVATE_HOST]` while the service binds `[PRIVATE_HOST]`; loopback wins, so\n`curl [PRIVATE_HOST]/...` disappears into the tunnel and the service reads as\ndead while it is running fine. `ipconfig getifaddr en0` gives the address that\nworks. Reported to Dali.\n\n*`ok:true` does not mean working.* `/status` answers `ok:true` with\n`live:false, status:\"replaced\"` when the Baileys session has been stolen by\nanother instance. In that state `/check` returns `null` for **every** number.\nRead `live`, not `ok`. And never start a second `npm run whatsapp` to \"fix\" a\nservice that looks down — it cannot bind the port but it *does* replace the\npaired session, which is how a working check became 12 nulls.\n\n`to` is normalised, so `+[PHONE]`, `[PHONE]` and `[PHONE]` are\nthe same recipient.\n\n## Reading the answer — three outcomes, not two\n\n| `exists` | meaning | what Omar does |\n|---|---|---|\n| `true` | the number is a WhatsApp account | build the dossier |\n| `false` | it is not | no dossier; record the number and the negative result so nobody re-checks it |\n| `null` | **the service could not tell** | **not the same as `false`.** Do not drop the lead. Record `null` and move on; a null is our ignorance, not a fact about the prospect |\n\nNever collapse `null` into `false`. That is the same class of mistake as an empty\nscraper file reading as an empty market: a failure of ours wearing the costume of\na fact about them. A lead whose Tier 2 came back `null` keeps its Tier-1 verdict\nand its place in the ranking, carried as `reach: unchecked` — never `no`.\n\n## How it fits the fields already on a lead\n\nThis check answers exactly the question `contactChannel: phone_only` leaves open.\n`phone_only` means no WhatsApp link was published on the listing — it says nothing\nabout whether the number is a WhatsApp account, and in Tunisia it usually is.\n\n- A `phone_only` lead that checks `true` is reachable on WhatsApp.\n- `canContact` still means **a channel exists** and must not be rewritten by this\n  check (Sinda, 2026-08-31). Reachable-today is derived at read time, never stored.\n- `whatsappNumber` stays sourced only from a wa.me / wa.link target. A positive\n  reach check on the listing phone does **not** license copying it into\n  `whatsappNumber` — that field means \"the number they published for WhatsApp\".\n\n## Record the result like any other fact\n\nValue plus how it was obtained:\n\n```json\n\"whatsappReachCheck\": {\n  \"result\": true,\n  \"checkedNumber\": \"+[PHONE]\",\n  \"at\": \"2026-08-31T22:10:00Z\",\n  \"source\": \"whatsapp service GET /check on port 4913\"\n}\n```\n\n## Standing pattern to flag while checking (Sinda, 2026-08-31)\n\nAnyone already paying a platform to be findable — Glovo, a delivery app, a\ndirectory listing, a booking site — is **pre-qualified**. They have priced the\nproblem and are paying a commission on every order to solve it. Flag it on the\nlead; it is the strongest opener we have found.\n\n## Current blocker\n\nAs of 2026-09-01 01:55 the service reads\n`{\"live\":false,\"usable\":false,\"why\":\"session is 'disconnected' — not paired\"}`.\nOne fault, not two: the loopback hijack has cleared (the ssh tunnel died), and\nthere was never an instance war — that was my own misreading of `ps`, where\n`node src/server.js` also matches brimind-tunnel's wildcard server. The single\nreal cause was that I ran `npm run whatsapp` on a service that only *looked*\ndead, and that stole the Baileys session.\n\n**The account needs a QR re-scan on the owner's phone.** Until `live:true`, every\ncheck returns `null` and the pre-filter can neither clear nor reject anyone.\n\nThe 40-lead run above was taken while the session was healthy, so those results\nstand. Re-run only what has no result yet.\n","linked_files":[],"origin":"brimind","owner_id":null,"source":"router"}