{"success":true,"name":"brimind-sms-rail","description":"BRIMIND can send SMS — to one number or many at once — and receive them, from the SIM in the 3G USB stick (`sms send \"<num>;<num>\" \"<text>\"`, `sms unread`, triggers on every new SMS). Use whenever a message must reach a phone by SMS: a prospect or client with no WhatsApp/Telegram/email, a relance on a fourth channel, an alert or code to the owner, or any \"send an SMS / texto / message to this numb","category":"unitary","path":"unitary/brimind-sms-rail/SKILL.md","file":"SKILL.md","content":"---\nname: brimind-sms-rail\ndescription: BRIMIND can send SMS — to one number or many at once — and receive them, from the SIM in the 3G USB stick (`sms send \"<num>;<num>\" \"<text>\"`, `sms unread`, triggers on every new SMS). Use whenever a message must reach a phone by SMS: a prospect or client with no WhatsApp/Telegram/email, a relance on a fourth channel, an alert or code to the owner, or any \"send an SMS / texto / message to this number\". Also use before writing any SMS text (cost per part) when checking for SMS replies or unread SMS, when an arriving SMS must start something (trigger), and when the stick or SIM seems down.\n---\n> Imported from [PRIVATE_HOST] `~/unitary/agents/skills/brimind-sms-rail`. 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# The SMS rail — `sms send`\n\nSMS is a real channel here, next to WhatsApp, Telegram and email. It leaves from\nthe owner's Ooredoo SIM in the Huawei 3G stick. It works **without a data plan**.\n\n## Send\n\n```bash\nsms cost \"Bonjour Karim, votre site est en ligne : https://…\"   # 1. check the parts\nsms send [PHONE] \"Bonjour Karim, …\"                             # 2. one number\nsms send \"[PHONE];[PHONE];[PHONE]\" \"…\"                        #    or several (; or ,)\n```\n\n- Nothing to start first. The command brings up the service (:4914) when it is down.\n- 8 digits = Tunisian. Other countries in international form (`+33…`).\n- Read the exit code, not the wording. **0** = the modem confirmed every number ·\n  **3** = queued (pacing or `--at`), **never re-send** · **1** = failed/bad input ·\n  **2** = stick/SIM/service down, run `sms status` and read `why`.\n- `--at 2026-09-24T09:00` sends inside the recipient's working hours. Use it\n  instead of sending at night.\n- From code: `POST http://[PRIVATE_HOST]/send {\"to\": \"a;b\", \"text\": \"…\"}`. See `sms/README.md`.\n\n## Write it so it costs one SMS\n\nEach recipient is billed **per part**. Plain text holds 160 characters per part.\n**One** character outside GSM-7 (`ê ô î â û ï`, emoji, Arabic, curly quotes `’ “`)\ndrops that to **70**. `é è à ù ì ò` are free; `ç` is NOT (write `c`). So:\n\n1. Aim for one part: ≤ 160 plain characters. Write `pret`, not `prêt`, and `'`, not `’`.\n2. Run `sms cost` and read `parts` and `offending`. Fix what it lists.\n3. A link counts in full. Use the client's own short link (pay.brimind.pro/…).\n\n## What a client SMS must carry\n\nThe owner's standing rules apply as on every channel (`brimind-owner-standing-rules`):\n- the client's own link,\n- two facts true of that client,\n- fast to read,\n- sent from the rail and never improvised.\n\nAn SMS also has to say who is writing (\"BRIMIND\"), because the number is unknown to them.\n\n## Limits you must not work around\n\n- 60 recipients per rolling hour, 200 per day, 15–20 s between modem requests.\n  A queued answer (exit 3) means the pace is doing its job.\n- Never loop `--direct` for a batch. `--direct` skips the pace and the queue, and\n  it is for a single test.\n- Tests go to the owner's number **[PHONE]** and nowhere else.\n\n## Receive: read replies, react to new SMS\n\n```bash\nsms unread          # SMS not read yet, newest first (#index, date, sender, text)\nsms read 20404      # mark read (or: sms read all)\nsms jobs            # job files left by triggers — handle each, then move it to done/\n```\n\nThe service checks the stick every 10 s. Each new SMS goes to\n`sms/data/inbox/messages.jsonl` and fires the rules in `sms/data/triggers.json`:\n`job` (a file in `triggers/pending/`), `webhook`, `reply` (at most 1 per sender\nper 24 h) or `command` (a shell command that gets `$SMS_FROM` and `$SMS_TEXT`).\nThe stick holds 500 SMS. The service archives the oldest to\n`sms/data/archive.jsonl` and deletes them from the stick at 450, so never clear\nit by hand. A deleted SMS can still be found in the archive.\nRules are matched by `person`, `from`, `contains` and `regex`, and edits apply\nwithout a restart. See `sms/README.md` → Receiving. A prospect's SMS reply is a\nreply like any other. Record it in followup and answer on the channel they used.\n\n**No \"STOP\" line in our SMS** (owner, 2026-09-23: « if he needs that he will write\nit in any language and we will understand »). So a refusal can come in any language.\n`sms/src/suppression.js` catches the usual ones by itself: stop, arrêtez,\ndésabonner, unsubscribe, توقف, ما تبعثش, yezzi, barra and similar. When you handle a job\nand the SMS says \"leave me alone\" in words the list missed, add the number yourself:\n`node sms/bin/suppress.mjs add <number> \"<their words>\"`. That number never gets another SMS.\n\n## Check what happened\n\n```bash\nsms outbox 5     # what the stick sent, with time\nsms inbox 5      # everything received, read or not\nsms queue        # what waits, and what blocks it (interval / hour-cap / day-cap)\n```\n\n**Price: 10 millimes (0.010 TND) per billed part per recipient** (owner, 2026-09-23).\nThe daily cap of 200 recipients costs 2 TND. The balance cannot be read from the\nstick (no USSD on this firmware); the owner checks it on the phone.\n\n## Field notes (from session handoffs)\n- 2026-10-19: Si `sms send --direct \"<num>\" \"<text>\"` affiche uniquement l’usage et sort avec code 1, remettre les arguments positionnels en premier : `sms send \"<num>\" \"<text>\" --direct --as the client`. Cette forme est celle de l’usage affiché. Un appel lancé sans résultat visible ne prouve aucun envoi : contrôler le journal et la file avant de retenter. (when: Quand sms send --direct affiche usage: sms send et sort avec code 1.) (links: S:brimind-send-verification (exige une preuve après la commande); M:shokxr «Director's rule 13/10: an inbound human-reply letter is marked done only when o…» (distingue tentative et réponse confirmée))\n","linked_files":[],"origin":"brimind","owner_id":null,"source":"router"}