{"success":true,"name":"brimind-director-paid-alert","description":"The one number this seat is judged on is money received, so it is read from the payment gateway every pass and the owner is woken the moment it moves. Use in every director pass, before writing the verdict table, whenever a prospect says yes or an invoice is approved, and whenever a report is about to claim a result. A reply is not a sale, an approved devis is not a sale, and a `paid` figure nobod","category":"unitary","path":"unitary/brimind-director-paid-alert/SKILL.md","file":"SKILL.md","content":"---\nname: brimind-director-paid-alert\ndescription: The one number this seat is judged on is money received, so it is read from the payment gateway every pass and the owner is woken the moment it moves. Use in every director pass, before writing the verdict table, whenever a prospect says yes or an invoice is approved, and whenever a report is about to claim a result. A reply is not a sale, an approved devis is not a sale, and a `paid` figure nobody is alerted by is not a measurement.\n---\n> Imported from [PRIVATE_HOST] `~/unitary/agents/s3a/skills/brimind-director-paid-alert`. 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# Did any money arrive — and who paid it?\n\n**The owner's order, 2026-09-12 (#8):** « When any did paid alert me when you\ndid notice that. »\n**The owner's order, 2026-09-12 (#13):** « your target is to bring money to the\ncompany. »\n\n## Why this exists\n\nOrder #8 sat at « À CONSTRUIRE » in `agents/director/OWNER-ORDERS.md` for three\ndays. On 2026-09-15 the pass note recorded `paid 0` against 342 clients, 134\nsends and 9 invoices — and nothing in the machine would have behaved any\ndifferently on the day that zero became a one. The seat whose permanent target\nis money had no wake-up for money arriving.\n\nA figure the director reads once every five hours and nobody is alerted by is\nnot a measurement, it is a diary entry.\n\n## Run it\n\n```bash\nnode .claude/skills/brimind-director-paid-alert/paid.mjs              # the table + the diff\nnode .claude/skills/brimind-director-paid-alert/paid.mjs --recheck    # re-ask the gateway harder\nnode .claude/skills/brimind-director-paid-alert/paid.mjs --notify     # post the alert in his room\nnode .claude/skills/brimind-director-paid-alert/paid.mjs --all --json # every held invoice, machine-readable\nnode .claude/skills/brimind-director-paid-alert/paid.mjs --dry        # read, remember nothing\n```\n\n**Exit codes are the verdict.** `0` = nothing new since the last pass.\n**`10` = NEW MONEY** — a distinct code so a tick can branch on it and so it can\nnever be misread as an error. `1` = read, but at least one invoice could not be\nrefreshed. `2` = no source answered: unknown is never reported as unpaid.\n\n## Where the number comes from\n\n| Source | What it is | Rank |\n|---|---|---|\n| `POST :3010/api/invoices/<id>/status` | re-asks the gateway about every attempt still `PENDING`, then answers the invoice's own `status` and `paid_tnd` | **the receipt** |\n| `dealflow/data/clients.json` → `state`, `history[].event` | what our own tools believe happened | a claim, printed as 🔴 *suspicion* when it disagrees |\n\n**What a pass costs the gateway:** the route re-asks ClicToPay once per payment\nattempt still `PENDING` — so an invoice nobody ever tried to pay costs nothing,\nand only the started-but-unfinished ones are looked up. That is why the default\nis the 40 most recently contacted invoices (`--max`, `--all` for every one):\nthe sweep is cheap because it is aimed at the invoices where money could\nactually be in flight.\n\nThe book can raise a suspicion. It can never close one — that is the house rule\n(no claim without a number) applied to the only number that matters. Every row\nprints which source spoke.\n\n## The diff, and why the state file matters\n\n`agents/director/paid-state.json` holds the last seen `status` and `paid` per\ninvoice, so a pass reports the **change**, not the standing total. Two rules are\nencoded in it:\n\n- An invoice that could **not** be refreshed keeps its old line. A silent state\n  update would swallow the first payment on it and the alert would never fire.\n- `firstPaidAt` is stamped once and never moved, so \"when did the first money\n  land\" survives a session ending.\n\n## In the pass\n\n1. Run it at the **start** of the pass with `--notify`: if money arrived while\n   nobody was looking, the owner hears it before he hears anything else.\n2. Put the printed line in the note **verbatim**, as with the queues and the\n   live markets. A verdict no script printed does not go in the note.\n3. `paid` is the only cell in the verdict table that may be called a result.\n   Sends, replies, approvals and page views are the road, not the arrival.\n4. Exit `10` outranks the rest of the pass. A payment changes the direction\n   call — the market, niche and channel that produced it are the ones to\n   double, and that belongs in the note the same hour.\n\n## Limits of this seat\n\nThe alert is a post in the director's own Telegram room through\n`agents/director/notify.mjs` — the owner is not a prospect. Nothing here writes\nto a client, thanks a payer, or touches an invoice's amount: money stays the\nowner's, and the send stays SoloBro's.\n","linked_files":["paid.mjs"],"origin":"brimind","owner_id":null,"source":"router"}