# us.off-the-clock.automod.rule

> One automod rule of a pair, in its management half (D95). The feed generator runs a pair's rules over each new or changed record version in its content half, highest priority first and oldest first on a tie, and applies the labels of each rule that matches.

- Kind: record
- Record key: tid
- Authority: automod.off-the-clock.us
- Lexicon: 1
- Published by [off-the-clock.us](https://lexicon.garden/identity/did:plc:tevv7zpavtjtsvqrrwwipobt), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:tevv7zpavtjtsvqrrwwipobt/us.off-the-clock.automod.rule)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:tevv7zpavtjtsvqrrwwipobt/us.off-the-clock.automod.rule/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:tevv7zpavtjtsvqrrwwipobt/us.off-the-clock.automod.rule/analytics)

## Record (`us.off-the-clock.automod.rule`)

Type: record · key tid

### Properties

- `createdAt` (string · datetime, required)
- `description` (string)
  - Constraints: maxLength: 3000, maxGraphemes: 300
- `enabled` (boolean): False turns the rule off; absent is on.
- `engine` (string, required)
  - Constraints: maxLength: 64, knownValues: datalogic | jev
- `labels` (array, required): The labels a match applies.
  - Constraints: minLength: 1, maxLength: 8
  - `items` (string)
    - Constraints: maxLength: 128, knownValues: nsfw-suggestive | nsfw-explicit | spoiler | content-warning
- `name` (string, required)
  - Constraints: maxLength: 640, maxGraphemes: 64
- `precondition` (ref)
  - Reference: `#precondition`
- `priority` (integer, required): Rules run from the highest priority to the lowest.
- `rule` (unknown, required): The engine's fields: a JSON Logic object for datalogic; for jev, {kind: noul|choice, instructions, criteria?, options?, matches?, threshold} with threshold a whole percent from 1 to 100.
- `stackKey` (string): Once a rule with this key matches, later rules with the same key are skipped for that record.
  - Constraints: maxLength: 64
- `warning` (ref)
  - Reference: `#warning`

## #precondition (`us.off-the-clock.automod.rule#precondition`)

Type: object

Checked before the rule runs (AUT-9): when `when` holds over the rule's document, `rule` skips this rule alone and `stack` skips it and every later rule sharing its stackKey.

### Properties

- `stop` (string, required)
  - Constraints: maxLength: 64, knownValues: rule | stack
- `when` (unknown, required): A JSON Logic object over the record's document, its labels included.

## #warning (`us.off-the-clock.automod.rule#warning`)

Type: object

The types of the content warning a rule applying content-warning writes beside its label (AUT-2, D101). A rule naming a type outside the twelve is ignored.

### Properties

- `types` (array, required)
  - Constraints: minLength: 1, maxLength: 12
  - `items` (string)
    - Constraints: maxLength: 64, knownValues: violence | gore | death | self-harm | abuse | substances | eating | mental-health | medical | bigotry | distressing-news | flashing

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "One automod rule of a pair, in its management half (D95). The feed generator runs a pair's rules over each new or changed record version in its content half, highest priority first and oldest first on a tie, and applies the labels of each rule that matches.",
      "key": "tid",
      "record": {
        "properties": {
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "description": {
            "maxGraphemes": 300,
            "maxLength": 3000,
            "type": "string"
          },
          "enabled": {
            "description": "False turns the rule off; absent is on.",
            "type": "boolean"
          },
          "engine": {
            "knownValues": [
              "datalogic",
              "jev"
            ],
            "maxLength": 64,
            "type": "string"
          },
          "labels": {
            "description": "The labels a match applies.",
            "items": {
              "knownValues": [
                "nsfw-suggestive",
                "nsfw-explicit",
                "spoiler",
                "content-warning"
              ],
              "maxLength": 128,
              "type": "string"
            },
            "maxLength": 8,
            "minLength": 1,
            "type": "array"
          },
          "name": {
            "maxGraphemes": 64,
            "maxLength": 640,
            "type": "string"
          },
          "precondition": {
            "ref": "#precondition",
            "type": "ref"
          },
          "priority": {
            "description": "Rules run from the highest priority to the lowest.",
            "type": "integer"
          },
          "rule": {
            "description": "The engine's fields: a JSON Logic object for datalogic; for jev, {kind: noul|choice, instructions, criteria?, options?, matches?, threshold} with threshold a whole percent from 1 to 100.",
            "type": "unknown"
          },
          "stackKey": {
            "description": "Once a rule with this key matches, later rules with the same key are skipped for that record.",
            "maxLength": 64,
            "type": "string"
          },
          "warning": {
            "ref": "#warning",
            "type": "ref"
          }
        },
        "required": [
          "name",
          "priority",
          "engine",
          "rule",
          "labels",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "precondition": {
      "description": "Checked before the rule runs (AUT-9): when `when` holds over the rule's document, `rule` skips this rule alone and `stack` skips it and every later rule sharing its stackKey.",
      "properties": {
        "stop": {
          "knownValues": [
            "rule",
            "stack"
          ],
          "maxLength": 64,
          "type": "string"
        },
        "when": {
          "description": "A JSON Logic object over the record's document, its labels included.",
          "type": "unknown"
        }
      },
      "required": [
        "stop",
        "when"
      ],
      "type": "object"
    },
    "warning": {
      "description": "The types of the content warning a rule applying content-warning writes beside its label (AUT-2, D101). A rule naming a type outside the twelve is ignored.",
      "properties": {
        "types": {
          "items": {
            "knownValues": [
              "violence",
              "gore",
              "death",
              "self-harm",
              "abuse",
              "substances",
              "eating",
              "mental-health",
              "medical",
              "bigotry",
              "distressing-news",
              "flashing"
            ],
            "maxLength": 64,
            "type": "string"
          },
          "maxLength": 12,
          "minLength": 1,
          "type": "array"
        }
      },
      "required": [
        "types"
      ],
      "type": "object"
    }
  },
  "id": "us.off-the-clock.automod.rule",
  "lexicon": 1
}
```
