{"success":true,"name":"brimind-director-frequency-budget","description":"The scarce resource is sending frequency, not effort — so every pass measures how much of today's per-channel capacity is still unspent and for how many hours it can still be spent. Use at the start and end of every director pass, before deciding a shift has done enough, before asking for more prospects, and whenever one channel carried the whole day. A queue that is full while the quota goes unsp","category":"unitary","path":"unitary/brimind-director-frequency-budget/SKILL.md","file":"SKILL.md","content":"---\nname: brimind-director-frequency-budget\ndescription: The scarce resource is sending frequency, not effort — so every pass measures how much of today's per-channel capacity is still unspent and for how many hours it can still be spent. Use at the start and end of every director pass, before deciding a shift has done enough, before asking for more prospects, and whenever one channel carried the whole day. A queue that is full while the quota goes unspent is a day being left on the table, and a quota never carries over to tomorrow.\n---\n> Imported from [PRIVATE_HOST] `~/unitary/.claude/skills/brimind-director-frequency-budget`. 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# What is left of today's frequency\n\n**The owner's order, 2026-09-12 (#28):** « whatsapp 22✔ · telegram 0✖ ·\nemail 0✖ — do send them all in parallel, cause the ressource is the frequency,\nnot our energy, so we can send in same min 1 whatsapp 1 email 1 telegram in\nparallel, thats why all queue of them 3 should be filled to make the send\nprocess have what to send and prepared. »\n\n## Why this exists\n\n`brimind-refill-thin-queues` answers *is there work to send*. Nothing answered\nthe other half — *how much of the day's frequency did we actually spend*.\n\nThe numbers that prove the owner's point: WhatsApp 100/day, Telegram 30/day,\nemail with no hard regulator — **130+ across three lanes, and on 2026-09-12 we\nspent 11**, all of them on WhatsApp. The pass notes of 12/09 and 15/09 both\ncarry the queue depth and neither carries that figure. An unspent hour is not\nsaved; quotas do not carry over.\n\n## Run it\n\n```bash\nnode .claude/skills/brimind-director-frequency-budget/budget.mjs\nnode .claude/skills/brimind-director-frequency-budget/budget.mjs --json\nnode .claude/skills/brimind-director-frequency-budget/budget.mjs --min-spend 30\n```\n\n**Exit codes are the verdict.** `0` = the capacity is being spent. `1` = it is\nbeing left on the table — a usable channel still at zero, or the whole day\nunder `--min-spend` % (default 20) with three or more hours of window open.\n`2` = a counter could not be read, and an unreadable counter is never reported\nas a spent one.\n\n## Where each number comes from\n\n| Number | Source | If it cannot be read |\n|---|---|---|\n| WhatsApp used | `GET :4913/queue` → `used.day`, the regulator's own rolling 24 h | `replies.jsonl` `ok:true`, marked *plancher, pas vérité* |\n| Telegram used | `telegram/data/pace.json` → `history`, epoch ms per cold send | same fallback, marked degraded |\n| Email used | `agents/data/replies.jsonl` → `ok:true` | — (there is no regulator to ask) |\n| Caps | each service's own `.env`: `WHATSAPP_MAX_PER_DAY`, `TELEGRAM_PACE_MAX_PER_DAY`, `…_PER_HOUR`, `…_MIN_INTERVAL_MS` | the code's defaults, 100 / 30 |\n| Window left | `.run/duty.json` → `shiftStart`/`shiftEnd`, read in `Africa/Tunis`; `shiftStart == shiftEnd` is the nonstop window | defaults, said out loud |\n\n**Email's cap is `null` on purpose.** This repo has no hard per-day email\nregulator; its real ceiling is the sending domain's reputation, which is not a\ncounter. So no figure is invented — the row prints *sans plafond dur*, and the\ntotal is reported as `130+`.\n\n## What the numbers are read against\n\n- `ok:true` only. An attempt is not a send, so a queue error never counts\n  against the quota and never counts as work done.\n- **Reachable, not merely remaining.** A channel with 30 left on the day but\n  6/h and two hours of window has 12 reachable, not 30. The clock caps the\n  quota, and the table prints the smaller of the two.\n- **Frozen still means lost.** A channel the gatekeeper calls unusable prints\n  `⚠` with its reason: the capacity is gone either way, but the instruction is\n  *unfreeze*, never *scout more prospects* — the same distinction the queue\n  skill makes about a full-but-frozen line.\n- **The ceiling is the owner's dial, asked of the regulator.** The caps are\n  read live from `whatsapp:4913/control` and `telegram:3020/api/send-control`,\n  which is where the dashboard (:3999 → **Control**) writes them. Those files\n  **beat the `.env`**, so never retype a `WHATSAPP_MAX_*` / `TELEGRAM_PACE_MAX_*`\n  figure into a note or a plan: it may be four times what the service is really\n  applying. If a row prints *« plafond pris dans le .env, le service n'a pas\n  répondu »*, treat that number as a floor, not the instruction.\n- **`⏸` is a closed door, not a fault.** The owner can switch a channel off\n  from the Control tab. Its reachable capacity is `0`, it is **not** counted as\n  capacity left on the table, and it must not be reported as idle. Do not\n  refill its queue, do not restart its service, do not route around it into the\n  same account by another path — send on an open channel, and ask him to reopen\n  it. A send attempted anyway comes back `423`, which is him, not a bug.\n\n## In the pass\n\n1. Run it with the queues at **both ends** of the pass. Queue depth and\n   frequency spend are two different failures: a full queue and an unspent\n   quota is the 2026-09-12 shape, and only this script sees it.\n2. The headline line goes in the note verbatim, next to the queues line.\n3. Exit `1` is a direction call, not a note: name the channel at zero, and give\n   the order to the agent who sends on it — three lanes in parallel, never one\n   after another. This seat never sends.\n4. At the end of the pass, the figure is the day's cost in writing: capacity\n   spent, capacity lost, and which wall took it. « even fails are steps » —\n   but only if the step is a number somebody can read tomorrow.\n","linked_files":["budget.mjs"],"origin":"brimind","owner_id":null,"source":"router"}