# AI assistance

Tailcove can turn a question into a search, brief an incident with its likely
cause, and draft a post-mortem. It is **off** until the owner of a team turns it
on, and it never does anything by itself: every answer is text for a person to
read.

## Turn it on

Open **Settings → Teams → your team → AI assistance** (owners only), tick
**Allow AI assistance for this team** and save. If you run your own Tailcove,
the operator must also set `TAILCOVE_AI_ENABLED=true` and `TAILCOVE_AI_API_KEY`
first; until they do, the switch says it is not available. Turning it on or off
is recorded in the [audit log](https://tailcove.dev/docs/team-security).

## What it does

- **Ask AI** (on a source's Logs page) turns a question such as _errors from
  checkout that mention a timeout_ into a query in the
  [query language](https://tailcove.dev/docs/query-language). The query is shown for you to read; it
  runs only when you press **Run this query**. A query the language cannot read
  is refused, never run.
- **AI briefing** (on an incident) writes what happened, the likely cause and
  what to check next, from the incident's timeline and a sample of the error
  lines and failed traces of the source that raised it, from fifteen minutes
  before it started until an hour after. It says how sure it is and what it could
  not see. It is shown, not saved.
- **Draft with AI** (on a resolved incident's post-mortem) fills the summary,
  impact and root cause for you to edit. Nothing is saved until you save.

None of these acknowledges, resolves, publishes, changes a rule or runs a
command. The assistant has no tools.

## What is sent, and what is not

Only when someone presses a button, the text that feature needs goes to the AI
provider: for **Ask AI**, your question and nothing else (no log lines, no field
names); for a briefing or a draft, the incident's title, times and timeline, a
sample of at most 30 error lines and 15 failed traces.

Before anything is sent, Tailcove removes email addresses, card numbers, bearer
and basic credentials and IP addresses (the same presets as
[transform rules](https://tailcove.dev/docs/transform-rules)), the value of any key that names a
secret (`password`, `token`, `api_key`, `authorization`, `cookie` and similar),
JSON web tokens, and any other unbroken run of 32 or more letters and digits
(keys, hashes, session ids). They are replaced by markers such as `[email]` or
`[secret]`. It removes too much rather than too little, so a briefing may be a
little less specific.

Tailcove stores **no prompt and no answer**. It keeps a count of tokens per team
per month, and an audit row for each call with the feature and the number of
tokens, nothing of the content. Log text is treated as untrusted: it is given to
the model as data, and instructions inside a log line are not followed.

## Plans, allowance and overage

AI assistance is part of the **Pro** and **Business** plans. The free plan does
not include it.

Each paid plan includes an allowance of AI use every calendar month (UTC): about
$1.50 on Pro and $6 on Business, measured in what the model costs to run, so a
short question uses a tiny part of it and a post-mortem draft a little more
(roughly a few cents). The **AI assistance usage and overage** card on the
**Billing** page shows what has been used. At 80% and at 100% of the allowance the
owners, admins and billing people get an email. When it is used up, the buttons
say so and nothing is sent until the first of the month.

### Overage

If your team needs more, an **owner, admin or billing person** can allow overage
in the same card. It is **off by default** and needs a monthly **cap** (from $5 up to
$50). What is used beyond the allowance is charged at three times what it costs
us, and AI assistance stops for the month when the cap is reached (the cap is
checked before each call). Overage is only for a team that has paid us before
and is in good standing: a card on file, a successful payment and no
cancellation.

How it is charged:

- When the overage waiting to be charged reaches $5, it is charged on your card
  straight away.
- Smaller amounts are added to your next subscription invoice at the end of the
  month (under 10 cents is not charged).
- If you cancel, anything not yet charged is charged then.
- If the card is declined, the amount goes on your next invoice, overage is
  switched off and the owners, admins and billing people are emailed. A failed payment
  on the subscription switches it off too, and AI assistance stays paused until
  the invoice is paid. Turn overage on again when the payment method is fixed.

## Limits

Besides the money, three limits apply: a monthly token budget per team (input and
output; the platform sets the ceiling and the owner may set a lower number under
**AI assistance** in the team settings); an hourly limit on how much one team may spend (a stolen token or
a script gone wrong cannot use a month's cap in minutes); and a limit of a few
calls a minute per person. A call that fails at the provider is not charged.
