···11+# Example Rules Configuration
22+33+This directory contains example rule configurations for the moderation system.
44+55+## Setup
66+77+1. Copy this entire directory to create your production rules:
88+ ```bash
99+ cp -r rules.example rules
1010+ ```
1111+1212+2. Edit the files in `rules/` to configure your moderation rules:
1313+ - `accountAge.ts` - Rules for flagging accounts based on age
1414+ - `accountThreshold.ts` - Rules for flagging accounts that exceed thresholds
1515+ - `handles.ts` - Pattern matching rules for handles/usernames
1616+ - `posts.ts` - Pattern matching rules for post content
1717+ - `profiles.ts` - Pattern matching rules for profile descriptions
1818+ - `constants.ts` - Global allow lists and shared constants
1919+2020+3. The `rules/` directory is ignored by git to keep your moderation rules confidential.
2121+2222+## Rule Structure
2323+2424+Each rule type has a specific structure. See the example files for details on required fields and options.
2525+2626+### Common Fields
2727+2828+- `label` - The label to apply when the rule matches
2929+- `comment` - Internal comment/reason for the action
3030+- `reportAcct/reportPost` - Whether to create a report
3131+- `commentAcct/commentPost` - Whether to add a comment
3232+- `toLabel` - Whether to apply a label
3333+- `check` - The pattern/condition to match against
3434+3535+### Optional Fields
3636+3737+- `whitelist` - Patterns that should override the main check (false positives)
3838+- `ignoredDIDs` - DIDs exempt from this specific rule
3939+4040+## Security
4141+4242+Never commit the `rules/` directory to version control. Keep your moderation rules confidential.
-4
src/constants.example.ts
···11-/**
22- * Global allowlist of DIDs that should never be moderated
33- */
44-export const GLOBAL_ALLOW: string[] = [];
-25
src/developing_checks.md
···11-# How to build checks for skywatch-automod
22-33-## Introduction
44-55-Constants.ts defines three types of types of checks: `HANDLE_CHECKS`, `POST_CHECKS`, and `PROFILE_CHECKS`.
66-77-For each check, users need to define a set of regular expressions that will be used to match against the content of the post, handle, or profile. A maximal example of a check is as follows:
88-99-```typescript
1010-export const HANDLE_CHECKS: Checks[] = [
1111- {
1212- label: "example",
1313- comment: "Example found in handle",
1414- description: true, // Optional, only used in handle checks
1515- displayName: true, // Optional, only used in handle checks
1616- reportOnly: false, // it true, the check will only report the content against the account, not label.
1717- commentOnly: false, // Poorly named, if true, will generate an account level comment from flagged posts, rather than a report. Intended for use when reportOnly is false, and on posts only where the flag may generate a high volume of reports..
1818- check: new RegExp("example", "i"), // Regular expression to match against the content
1919- whitelist: new RegExp("example.com", "i"), // Optional, regular expression to whitelist content
2020- ignoredDIDs: ["did:plc:example"], // Optional, array of DIDs to ignore if they match the check. Useful for folks who reclaim words.
2121- },
2222-];
2323-```
2424-2525-In the above example, any handle that contains the word "example" will be labeled with the label "example" unless the handle is `example.com` or the handle belongs to the user with the DID `did:plc:example`.