Document the AI automations feature for users
release gate / check (push) Failing after 6m42s

README gains feature bullets for notifications and the 'hey superbrain'
automations (what they do, the propose-then-confirm model, the honest
cannot-do list, AI_* configuration, pointer to the usage guide).

RUNNING.md gains a dedicated 'AI automations' section: setup (AI_API_KEY/
AI_MODEL/AI_BASE_URL, OpenRouter default, any OpenAI-compatible gateway,
graceful degradation without a key), step-by-step usage with example
phrasings, the one-condition-one-action capability boundary (no logins,
no bookings, no chaining, no destructive actions), safety and limits
(validated specs, untrusted page content, netguard fetches, email caps,
what data reaches the provider), and a symptom/fix troubleshooting table
covering the 503/422/502 paths and run-outcome meanings.
This commit is contained in:
Andrew S Erwin
2026-10-27 23:17:47 -05:00
parent 2037a04817
commit 19531cf8b9
2 changed files with 112 additions and 10 deletions
+18
View File
@@ -168,6 +168,24 @@ install it); the index-backed page search depends on it.
including watches enabled with the original mailbox-watch switch. The including watches enabled with the original mailbox-watch switch. The
scheduler runs users with bounded concurrency, per-user failure backoff, scheduler runs users with bounded concurrency, per-user failure backoff,
and a database-backed lease so extra instances never double-poll a mailbox. and a database-backed lease so extra instances never double-poll a mailbox.
- Notifications: delivery channels (email via the server's SMTP relay,
Slack webhooks, Matrix rooms, Telegram bots) and rules that fire when a
new mailbox signal arrives or a bookmark comes due. Channel secrets are
encrypted at rest and never echoed back; availability follows your plan.
Configure in Settings → Notifications.
- **AI automations ("hey superbrain")**: describe an automation in plain
language — *"when the round trip on https://… drops below $400, email
david@example.com"* — and Superbrain compiles it into a task you review
and confirm before anything is saved. Tasks watch a public web page on a
schedule (one extracted fact per check, e.g. a price threshold) or react
to new mailbox signals, then notify a channel, email a recipient, or save
a bookmark. The AI only ever *proposes* validated specs; actions are a
fixed, bounded set (no logins, no bookings, no deletes, no multi-step
chains yet), every fetch goes through the same private-range network
guard as previews, and email actions are hard-capped. Requires
`AI_API_KEY` (OpenRouter by default; any OpenAI-compatible gateway via
`AI_BASE_URL`/`AI_MODEL`); without it, signal-based tasks still run.
Usage guide: RUNNING.md → "AI automations". Settings → Automations.
### Connecting Authelia (OIDC) ### Connecting Authelia (OIDC)
+94 -10
View File
@@ -252,16 +252,9 @@ The core app works without any external services.
synced contact with a bookmark. synced contact with a bookmark.
- **Browser alerts:** Allow notifications when prompted. Alert checks run - **Browser alerts:** Allow notifications when prompted. Alert checks run
while the app is open in your browser. while the app is open in your browser.
- **AI automations ("hey superbrain"):** in **Settings → Automations**, - **AI automations ("hey superbrain"):** plain-language automations in
describe an automation in plain language; Superbrain compiles it into a **Settings → Automations** — see the dedicated
task you review before it is saved. Tasks can watch a public web page on [AI automations](#ai-automations-hey-superbrain) section below.
a schedule (one extracted fact per check, e.g. a price threshold) or
react to new mailbox signals, then notify a channel, email a recipient,
or save a bookmark. Set `AI_API_KEY` (OpenRouter by default; any
OpenAI-compatible gateway via `AI_BASE_URL`/`AI_MODEL`) — without it,
compilation and page extraction are unavailable but signal tasks still
run. The model only ever proposes validated specs; actions are fixed
primitives with fire caps, and every fetch goes through netguard.
- **Notifications:** In **Settings → Notifications**, add a delivery channel - **Notifications:** In **Settings → Notifications**, add a delivery channel
(email, Slack webhook, Matrix room, Telegram bot) and rules that fire on (email, Slack webhook, Matrix room, Telegram bot) and rules that fire on
new mailbox signals or due bookmarks. Channel availability follows the new mailbox signals or due bookmarks. Channel availability follows the
@@ -293,6 +286,97 @@ The core app works without any external services.
that account. OIDC-only (password-less) accounts never receive reset mail that account. OIDC-only (password-less) accounts never receive reset mail
by design — use Authelia's own recovery for those. by design — use Authelia's own recovery for those.
## AI automations ("hey superbrain")
Superbrain can watch things for you and act when they change. You describe
an automation in plain language; the AI **compiles it into a task proposal
that you review and confirm** — nothing is saved, and nothing can run,
without that confirmation.
### Setup
Add to `.env` (the Compose stack passes these to the Go container):
```env
AI_API_KEY=... # required for AI features
AI_MODEL=recursive/flint-v1.0:free # any model your provider serves
AI_BASE_URL=https://openrouter.ai/api/v1 # any OpenAI-compatible endpoint
```
OpenRouter is the default provider; point `AI_BASE_URL` at any
OpenAI-compatible gateway (a house LLM proxy, Ollama, ...). **Without
`AI_API_KEY` the AI parts answer "not configured" and everything else
keeps working** — including signal-condition automations, which need no AI
at run time at all. The key lives in `.env` only; never commit it.
### Using it
Open **Settings → Automations**:
1. Type the automation into the *Hey Superbrain* box, e.g.
- *"when the round trip price on https://flights.example/q/123 drops
below 400, email david@example.com"*
- *"tell me when a new invoice lands in my mailbox"* (needs an IMAP
watcher in Settings → IMAP first)
- *"check https://blog.example/feed every hour and notify me when it
mentions 'release'"*
2. Press **Compile**. Superbrain shows the proposal in plain language
(what it watches, what it does, how often, one-shot or ongoing) plus
the raw spec under **Review details**. Edit the recipient or pick the
notification channel if needed.
3. Press **Create automation**. The engine now checks it on schedule
(15-minute floor, default hourly).
The task list shows status (`active` / `done` for completed one-shots /
`paused`), fire count, and an enable switch; **Run now** evaluates a task
immediately, and **Recent runs** shows every check with its outcome
(`checked`, `fired`, `failed`, `skipped`) and a short reason.
### What it can and cannot do
Each task is **one condition → one action**:
- Conditions: *watch a public web page* (answer one question about it — a
price, availability, a phrase — with optional `<`/`≤`/`>`/`≥`/equals/
contains comparison) or *a new mailbox signal* (optionally filtered by
keyword).
- Actions: *notify* one of your notification channels, *email* one
recipient, or *save a bookmark*.
It deliberately cannot: log in to websites, book or buy anything, watch
pages behind authentication, chain steps ("watch flights *then* search
hotels *then* bundle") — the compiler says so plainly instead of faking it
— delete or modify your data, touch other users' data, or send bulk mail.
### Safety and limits
- The AI only ever **proposes**. Every task — compiled or hand-built — is
validated server-side on save *and* on each engine load; a task that
stops validating is paused, never run.
- Watched pages are **untrusted input**: page content is quarantined in
the extraction prompt and the model's reply is schema-checked, so a page
cannot steer your automations (prompt-injection resistant by design).
- Every page fetch goes through the same private-range network guard as
previews — an automation can never point the server at your LAN.
- Hard caps: checks no faster than every 15 minutes; one-shot tasks
complete after firing; **max 5 emails per task and 20 per user per day**;
stored-task limits follow your plan.
- What is sent to the AI provider: your request text when compiling, and a
snapshot of the watched page's text when extracting. Never your stored
credentials, and page snapshots only for pages *you* configured.
### Troubleshooting
| Symptom | Fix |
|---|---|
| "AI is not configured on this server" | `AI_API_KEY` missing in `.env`, or containers not recreated after adding it (`docker compose up -d --force-recreate app`) |
| Compile refuses with an explanation | Working as intended — one condition + one action per task; rephrase, or split into two tasks |
| Compile returns a provider error | Check `AI_MODEL` exists on your provider and the key has credit; free models can be slow or rate-limited |
| Run outcome `failed: fetch …` | The watched URL blocked the fetch, moved, or is not public HTML/JSON |
| Run outcome `failed: extract …` | The model could not answer the question from the page; rephrase the watch question more concretely |
| Run outcome `skipped` | A cap was reached (emails/day, budget) or the channel was disabled — the detail column says which |
| Task `paused` by itself | Its stored spec no longer validates (usually after an upgrade tightened rules); recreate it |
## Troubleshooting ## Troubleshooting
### Docker cannot connect to its daemon ### Docker cannot connect to its daemon