# AI Watch settings

**Preferences, AI Watch** sets up [AI Watch](Monitoring-AI-Watch.md): the checks, the AI tasks, the channels, the spend caps and prices, and the outside watchers. Its settings are those of the Administration access area: changing them, approving a task and making a watcher need the Administrator ([Roles](Security-Roles.md)).

The Checks and Spend tabs are saved with **Save** at the top. Tasks, channels and watchers have their own buttons.

## Checks

![The Checks tab](Prefs-AI-Watch/checks.png)

| Setting | Key | What it does | New server |
|---|---|---|---|
| **Watch this server** | `ai_watch_enabled` | AI Watch's switch. The checks start at the next minute. | off |
| **An AI note on each new incident** | `ai_watch_ai_notes` | asks the AI for a note when an incident opens and when it becomes bad | on |
| **Model for notes** | `ai_watch_notes_model` | a cheaper model for notes, if you like. Empty: the AI Assistant's model. | empty |
| the checks | `ai_watch_checks` | which checks run, see [The checks](Monitoring-AI-Watch.md#the-checks) | all |
| **Sensitivity** | `ai_watch_sensitivity` | Low: 6 spreads from normal and twice the counts below; Normal: 4; High: 3 and half the counts | Normal |
| **Learn for** | `ai_watch_learn_days` | days of history before the "far from normal" check speaks | 14 |
| **Keep findings** | `ai_watch_keep_days` | how long resolved findings and task runs are kept | 30 |
| **Addresses on one account** | `ai_watch_spray_count` | failed sign-ins to one account from this many addresses in 10 minutes | 10 |
| **Accounts from one address** | `ai_watch_stuffing_count` | failed sign-ins from one address with this many account names in 10 minutes | 10 |
| **Downloads above usual**, **and at least** | `ai_watch_exfil_factor`, `ai_watch_exfil_min_mb` | a user's downloads in one hour above this many times their usual hour, and above this size | 20, 1024 MB |
| **Deletes or renames in 5 minutes** | `ai_watch_mass_change` | by one session | 200 |
| **Administrators' working hours** | `ai_watch_admin_hours` | like `07:00-19:00`; an administrator signing in outside them is a finding. Empty: not checked. | empty |
| **A watcher is quiet after** | `ai_watch_watcher_silent_minutes` | an outside watcher that has not checked in for this long is a finding | 10 |

**Learning** shows how long AI Watch has been learning, and how many weeks of history each value has for the current hour of the week.

## AI tasks

![A task with its schedule, material and instructions](Prefs-AI-Watch/tasks.png)

An AI task collects material from the server on a schedule, sends it to the AI with your instructions, and turns the answer into a verdict: **ok**, **warn** or **bad**, a title, a summary and items. A warn or bad verdict is a finding, so it joins incidents and goes to your channels.

Five tasks come with the server, all off: **Morning summary**, **Login attack review**, **Capacity forecast**, **Weekly settings review** and **Job health**. **Add a task** makes your own.

| Field | What it does |
|---|---|
| **Name** | for the lists and the notices |
| **Runs on its schedule** | the task's switch |
| **When** | at times of the day (`07:00`, or `07:00,19:00`), or every so many minutes (at least 15) |
| **Days** | the weekdays it runs on; none picked: every day |
| **What it sends** | minute or hourly values, findings, events counted (sign-ins, transfers and others, with the accounts and addresses that failed most), error lines of the log, what administrators changed, job runs, a thread dump taken at run time, the server's status |
| **Hours back** | how far back the material reaches |
| **Instructions** | what to look for, in your words |
| **Model**, **Effort** | empty: the AI Assistant's |
| **Ask again with** | a stronger model that gets the same material when the first answer is a warning or worse; its answer is the one kept |
| **At most per run** | a run whose estimate is higher is skipped |
| **Notify** | only when bad, when a warning or worse, every run as a report, or never (the AI Watch section only) |
| **Channels** | where its notices go; none picked: every channel |

### Preview and approve

![The preview: what goes to the AI service, cleaned, and what it costs](Prefs-AI-Watch/preview.png)

A task runs on its own only after an Administrator has seen what it sends. **Preview and approve** collects the material now, cleans it as the AI Assistant cleans what it sends, and shows it exactly as it would go, with its size and its cost a run and a month at each model that has a price. **Approve** lets it run.

The approval covers what the task sends, how far back, the instructions, the model and the AI service's address. Changing any of them takes the approval away until the task is previewed and approved again; changing its schedule, days or channels does not. When **Show the cleaned log, thread dump or text before it is sent** is off in [AI Assistant](Prefs-AI-Assistant.md#rules), tasks run once saved.

**Run now** runs an approved task at once. **Last runs** shows the last answers, their model and their cost.

## Channels

![The Channels tab with a Slack channel](Prefs-AI-Watch/channels.png)

A channel is a place notices go. Each incident sends one notice when it opens (after the AI's note, or a minute), one when it gets worse, and one when it is resolved. At most 20 notices an hour go to one channel; the next one says how many were held back.

| Type | What you enter | What it sends |
|---|---|---|
| **E-mail** | the addresses | a mail through the server's [mail settings](Prefs-General-SMTP.md) |
| **The server's alert actions** | nothing here | the alert type **AI Watch Finding** of [Alerts](Prefs-Alerts.md): its mail template, SNMP trap, job or plugin |
| **Slack** | an incoming webhook URL | a message with the findings and the note |
| **Microsoft Teams** | a Workflows webhook URL | an Adaptive Card |
| **PagerDuty** | the service's integration key (Events API v2) | an incident that resolves in PagerDuty when it resolves here |
| **Opsgenie** | an API integration's key, and the region | an alert, closed when the incident resolves |
| **Discord**, **Google Chat** | the webhook URL | a message |
| **ntfy** | the topic URL, an access token if the server needs one | a push notification with a title and priority |
| **Webhook** | a URL and a signing secret | the incident as JSON, signed in `X-CrushMFT-Signature` as the [API's webhooks](API-Events-and-Webhooks.md) are |

| Setting | What it does |
|---|---|
| **Send** | info and worse, warnings and worse, or bad only |
| **Quiet hours** | like `22:00-07:00`; only bad ones go then |
| **Only these checks** | the checks whose notices go here; empty: all |

Keys, tokens and webhook addresses are stored sealed and shown masked. An address on a private network or on the server itself is refused, unless the Administrator saves it. **Send a test** sends a test notice at once.

## Spend

![The Spend tab](Prefs-AI-Watch/spend.png)

Every call to the AI service is priced and counted by day: the AI Assistant's questions, AI Watch's notes and crash reports, and the AI tasks. The tab shows this month, the forecast for the month at the last 7 days' pace, and each of the last 30 days.

| Setting | Key | What it does | New server |
|---|---|---|---|
| **All AI use** | `ai_month_cap` | dollars a calendar month for all AI use. When reached, the AI Assistant refuses new questions and AI Watch makes no AI calls; the checks and notices go on. 0: no cap. | 0 |
| **AI Watch's share** | `ai_watch_month_cap` | AI Watch's own cap | 0 |
| **Kept for incident notes** | `ai_watch_reserve_pct` | the part of AI Watch's share tasks may not use | 20 % |
| **Warn at** | `ai_spend_warn_pct` | a finding when this much of a cap is spent, and when the forecast is above a cap | 80 % |
| **Prices** | `ai_watch_prices` | one model a line: its name, then dollars per million tokens for input, cache writes, cache reads and output | the Claude models |

The Claude prices are Anthropic's published ones. Claude Haiku 5.5 costs more for prompts above 100,000 tokens, which the count applies. Type a line for any other model you use; a model without a price is counted in tokens and no cap applies to it.

## Outside watchers

![Making a watcher file](Prefs-AI-Watch/watchers.png)

The list shows each watcher, when it last checked in and from where, and what it saw. **Revoke** stops its token at once.

**Make a watcher file** makes the file a watcher runs with, `watch.XML`, and a token for it that holds only what a watcher needs: checking in, reading AI Watch's findings, and the server's event stream. Running it is [The outside watcher](Monitoring-AI-Watch-Watcher.md).

| Field | What it is |
|---|---|
| **Name** | the watcher's name, in the list and its notices |
| **The server's address** | as the watcher will reach it, such as `https://files.example.com/` |
| **The watcher's address** | the token then works only from it |
| **Checks** | health every 30 seconds, the event stream held open, a heartbeat every minute, a test transfer every 5 minutes, TLS every 6 hours, DNS every 10 minutes, ports every minute |
| **Its channels** | copied into the file with their secrets |
| **Test transfer address**, **user**, **password** | `https://`, `sftp://`, `ftps://` or `ftp://`: a plain user limited to one folder |
| **TLS addresses**, **Ports**, **Name to resolve**, **Its addresses** | what to check from outside |
| **On the server's own machine** | its folder, its log file, a restart command, after how many minutes down, and at most how many times an hour |

The file holds the token and the channels' secrets: it is shown once, so keep it like a password. The watcher seals them with a key of its own at its first start.
