{"success":true,"name":"brimind-refill-thin-queues","description":"A director runs channels, not a to-do list — every communication channel (WhatsApp, Telegram, email) has a queue, and a queue under 10 is an idle channel that must be refilled NOW by scouting a market that is awake at this hour AND where that channel is how businesses are actually reached. Use at the start and end of every director pass, in the 5-hourly results check, whenever an agent asks what t","category":"unitary","path":"unitary/brimind-refill-thin-queues/SKILL.md","file":"SKILL.md","content":"---\nname: brimind-refill-thin-queues\ndescription: A director runs channels, not a to-do list — every communication channel (WhatsApp, Telegram, email) has a queue, and a queue under 10 is an idle channel that must be refilled NOW by scouting a market that is awake at this hour AND where that channel is how businesses are actually reached. Use at the start and end of every director pass, in the 5-hourly results check, whenever an agent asks what to do next, whenever a channel \"looks fine\" because nothing is failing, and before deciding a shift has nothing to do. An empty Telegram queue means scout the russophone markets, not that Telegram is healthy.\n---\n> Imported from [PRIVATE_HOST] `~/unitary/.claude/skills/brimind-refill-thin-queues`. 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# Refill the thin queue, on the channel that is thin\n\n**The owner's order, 2026-09-12:** « You are a director, you have for each\ncommunication canal a queue. If a queue has less than 10, start searching for\nclients based on strategy — search in the places that are awake now, and have\nthat communication canal as more probable. For example telegram is empty queue,\nsearch in russia or iran. »\n\n## Why this exists\n\nOn 2026-09-12 the owner asked why nothing was sending. The answer was two\nseparate things, and only one of them looked like a problem:\n\n- **WhatsApp**: 22 messages queued, `attempts=0`, `lastError=none` — all held by\n  the send window. Visible, explainable, self-correcting.\n- **Telegram**: 0 queued, pacer free since 01:32, account authorised. Nothing\n  failed, nothing was logged, nothing alerted. **It had simply been given no\n  work for five days** — and it read as healthy the entire time.\n\nA failing channel shouts. An idle one is silent, and silence is what costs the\nmonth. This skill makes the queue depth a number somebody has to look at.\n\n## Run it\n\n```bash\nnode .claude/skills/brimind-refill-thin-queues/queues.mjs           # the table\nnode .claude/skills/brimind-refill-thin-queues/queues.mjs --json\nnode .claude/skills/brimind-refill-thin-queues/queues.mjs --floor 15\n```\n\n**Exit codes are the verdict.** `0` = every channel at or above the floor.\n`1` = at least one is thin, and the table names the markets to scout for it.\n`2` = a queue could not be read — and an unreadable queue is never a full one.\n\nWhere each depth comes from, so a number can always be chased:\n\n| Channel | Source | Fallback |\n|---|---|---|\n| WhatsApp | `GET :4913/queue` → `pending`, minus those still `heldUntil` | `whatsapp/data/outbox.json` if the service is down |\n| Telegram | `telegram/data/pace.json` → `pending` | — |\n| Email | `GET :3051/api/stats` → `stats.totalPending` | — |\n\n## The floor counts *sendable*, never merely queued\n\nNader caught this the hour the skill shipped: WhatsApp read **✔ 22 en attente**\nwhile 21 of those 22 were frozen by the send window until Monday. The queue was\nfull and the channel was stopped, and the table called it green.\n\nSo the floor is measured on what the channel **can actually send now** —\n`pending` minus anything whose `heldUntil` is still in the future. A frozen\nqueue is reported apart, with its own instruction, and **the script refuses to\nsuggest scouting for it**: more prospects is the wrong answer to a queue that is\nalready full.\n\nThat freeze had a cause worth remembering: `whatsapp/src/queue.js:231` imports\nthe window rules **once per process and memoises them forever**. Change\n`agents/method/rules.mjs` and a fresh `node agents/method/window.mjs` will\nreport the new rule while the running service keeps enforcing the old one — the\ntwo disagree and only the daemon's opinion reaches a prospect. After any window\nchange, **restart that service** (Dashboard → Services → the channel; never the\ndashboard itself, which takes its supervised services down with it).\n\n## Les trois canaux tournent EN PARALLÈLE (propriétaire, 2026-09-12)\n\n« do send them all in parallel, cause the ressource is the frequency, not our\nenergy, so we can send in same min 1 whatsapp 1 email 1 telegram in parallel,\nthats why all queue of them 3 should be filled to make the send process have\nwhat to send and prepared. »\n\nChaque canal a **son propre régulateur** : un envoi sur l'un ne coûte rien sur\nles deux autres.\n\n| Canal | Cadence | /heure | /jour | Source |\n|---|---|---|---|---|\n| WhatsApp | 1 / 2 min | 20 | **100** | `GET :4913/queue → limits` |\n| Telegram | 1 / 5 min | 6 | **30** | `telegram/lib/pace.js:59` |\n| E-mail | pas de régulateur dur | — | limité par la délivrabilité | mailflow (DKIM d'abord) |\n\n**Plafond du jour : 130+ envois sur trois voies.** Le 12/09 nous en avons dépensé\n**11**, tous sur WhatsApp, laissant les 30 de Telegram et toute la voie e-mail\nintacts — parce que le travail n'était préparé que sur un canal. Les quotas ne se\nreportent pas : une heure sans rien dans une file est perdue pour toujours sur\ncette voie. C'est la raison d'être du plancher ci-dessous — une file vide n'est\npas un canal calme, c'est une voie dont on jette la journée en silence.\n\nNe jamais travailler un canal après l'autre : une passe alimente les trois et\nlaisse chaque régulateur s'écouler à son rythme.\n\n## The rule\n\n**Floor is 10 sendable per channel.** Under it, the channel is thin and the pass does not\nend until it is fed — or until the note says why it could not be.\n\nRefilling means **scouting a market that is both awake and channel-probable**.\nBoth halves are required:\n\n1. **Awake now** — the clock from [[brimind-live-market-now]], 10:00–18:00 local\n   every day, at least 1.5 h left at the desk. Never fill a queue with a\n   sleeping country: the reply lands inside our night and the 24 h age gate in\n   `agents/reply.mjs` closes on a prospect who actually answered.\n   **When every market of a channel sleeps, prepare it now, dated for its\n   opening** (owner, 2026-10-09: « Telegram is blocked since Russophone markets\n   are closed » — Telegram had sent nothing since 07/10). `queues.mjs` names the\n   next opening (`REMPLIR POUR L'OUVERTURE : KG … 04:00Z`); scout it, and send each\n   message with `node agents/reply.mjs --channel telegram … --at <that iso>`. The\n   queue holds it and it lands as they sit down, so the reply comes in their day,\n   not our night. Up to the floor (10), not beyond: that is what kept the old\n   113-row queue from coming back.\n2. **Channel-probable** — where that channel is how a business is really\n   reached. A Belgian shop lists a mobile; a Tashkent workshop lists an\n   `@handle`. Scouting Belgium to fill the Telegram queue produces contacts that\n   will never be reachable on it.\n\n`queues.mjs` intersects the two and prints the ready command:\n\n```bash\nnode agents/method/scout.mjs \"<métier>\" \"<ville>\" --channel telegram\n```\n\n`scout.mjs` already checks reachability per channel and ranks `+3` for a\nconfirmed hit, so a scout run aimed at the right channel returns a queue that\ncan actually be sent.\n\n## Where each channel lives\n\n| Channel | Markets | Why |\n|---|---|---|\n| **Telegram** | UZ · KZ · KG · GE · AM · MD | Telegram is the business line of the russophone world. Uzbekistan first — it is the only one we have already written to (SOFIA-MEBEL, YUSA_Mebel, Tashkent). |\n| **WhatsApp** | BE · CH · FR · LU · ES · PT · IT · NL · DE · PL · ZA · BR · MX · IN · MY | The number on the shopfront *is* the WhatsApp account. |\n| **Email** | UK · US · CA · AU · NZ · SE · DK · DE · NL · JP · SG | Where B2B still opens a mailbox before an app. |\n\n### Russia and Iran — named, never auto-proposed\n\nThe owner named them, and on Telegram density he is right. `queues.mjs` shows\nthem awake and stops there, because two things are true that a script must not\ndecide alone:\n\n- **We cannot get paid.** BRIMIND Pay settles TND through ClicToPay. Neither\n  country is collectable that way, so a yes turns into an invoice nobody can\n  pay — the worst outcome in the pipeline, worse than a no.\n- **Sanctions exposure is the owner's to carry**, not a scout's.\n\nSo: they are listed with a `⚠`, and an agent may write to them only on the\nowner's explicit go-ahead, recorded in the pass note. **Uzbekistan, Kazakhstan,\nKyrgyzstan, Georgia, Armenia and Moldova are the same Telegram-first market with\nnone of that problem** — that is where an unattended refill goes.\n\n## What a thin queue is NOT\n\n- **Not a broken channel.** Check the queue before you debug the service. On\n  2026-09-12 Telegram was accused of being down while it was authorised, paced\n  and idle.\n- **Not a reason to lower the bar.** The floor is a minimum of *quality*\n  prospects. Ten real dossiers beat forty scraped rows, and a queue padded with\n  unreachable contacts is emptier than the one it replaced.\n- **Not an excuse to scout a sleeping market** \"to send later\" without a date.\n  A dossier gathered for a sleeping market with no `--at` is how the last queue\n  reached 113. Dated for its opening and capped at the floor, it is the refill.\n- **Not a channel the owner has switched OFF.** He can close WhatsApp or\n  Telegram from the dashboard (:3999 → **Control**), and the script prints that\n  channel as `⏸` instead of `✖`. A closed channel is a consigne, not a\n  shortfall: it is never \"thin\", it never triggers a scout, and it never fails\n  the pass. **Do not refill it, do not restart its service, do not reach the\n  same account by another path.** Note it, send on an open channel, and ask him\n  to reopen it. Every send attempted anyway comes back `423` with nothing\n  queued — that refusal is him, and it is not something Dali repairs.\n\n## Write it down\n\nThe pass note (`agents/<id>/notes/<date>.md`) carries the line the script\nprinted, and what was done about it. « Telegram was low » is not a record.\nThis is:\n\n    queues 2026-09-12T11:50Z → whatsapp 22 ✔ · telegram 0 ✖ · email 0 ✖\n    telegram thin → scouted MD (3.2 h left), 12 dossiers, --channel telegram\n    RU/IR awake and denser, NOT used — no owner go-ahead, and no way to invoice\n\nRelated: [[brimind-live-market-now]] picks the hour · [[brimind-director-board]]\nholds the card that says who fills it · [[brimind-sales-specificity-check]]\nstill gates every draft that comes out of the refill.\n","linked_files":["queues.mjs","sms-lane.mjs","test/scheduled-not-frozen.test.mjs","test/sms-lane.test.mjs","test/telegram-fill-for-opening.test.mjs"],"origin":"brimind","owner_id":null,"source":"router"}