Textguard docs
v1.0.0
Get help
● Use

Rule packs
how a text is scored, and how to edit the rules.

The verdict comes from written rules, never from a model. The thresholds and every rule are settings you control.

keywordregexsenderlinkno AI

01The four rule types

TypeWhat it matches
keywordA word or phrase, compared without capitals or accents and at word boundaries.
regexA pattern, case-insensitive, on the normalised text. It must pass the safety check below.
senderThe sender, with * as a wildcard (only when the user gave a sender, or on iOS, the filter's sender).
linkA link whose host is a domain (example.com, also its subdomains) or ends with a suffix (*.top).

Each rule has a category, a weight from 1 to 5, a language label, a title and the plain-language explanation the user reads. The language label is for the operator: a rule runs on every text.

02Scoring and verdicts

Each matching rule counts once and adds its weight. A category adds at most 6. A total below Suspicious from (default 3) is No red flags found; from 3 it is Suspicious; from Looks like a scam from (default 6) it is Looks like a scam. The app never says "Safe": a clean result carries the sentence that this does not prove the message is safe. The iOS filter moves a text from an unknown sender to Junk when the score of scam categories reaches iOS filter moves to Junk from (default 5); otherwise a promotion match files it under Promotions, a transaction match under Transactions, and anything else is left alone. The exact steps are in contract/CONTRACT.md.

03The regex safety check

A bad pattern could freeze a phone, so patterns are accepted only if they pass a static check: at most 160 characters, no back-references, no look-ahead or look-behind, no nested open-ended repeats such as (a+)+, no alternation under * or +, counts at most 40, at most 8 open-ended repeats and 2 uses of .*. The same check runs in the console when you save, in Dart and in Swift against contract/regex-vectors.json. A rule that fails is dropped, so a bad pack cannot hang the phone.

04Edit the rules in the console

  1. Open Rule packs in the console and add, edit, disable or delete rules. Disabled rules are not sent to the app.
  2. Phones pick up the change within about five minutes. If you disable or delete every rule the app falls back to the pack bundled in the app.
  3. iPhone users get the new pack in the filter after they open the app (Message filter).
  4. To change what ships inside the app, edit server/seed/rules.json and copy it to app/assets/defaults/rules.json and app/ios/TextguardFilter/default-rules.json (Rename).
The starter pack is a starting point

It has 46 rules, mostly English and Slovak with a few Czech and German. Expect false positives and misses. Run it on your own real messages and tune the weights before you describe its accuracy anywhere. The wording of the lessons and the report offices is general; have someone who knows each country read them.

05Tests

The engine is specified once and tested three times: flutter test runs the shared vectors in contract/engine-vectors.json and contract/regex-vectors.json against the Dart engine, app/tool/check_swift_engine.sh compiles the Swift engine on its own and runs the same vectors, and the server tests run them against the console's regex check (npm test).