# Analysis Studio

Tags, keyword rules, conversation windows, backfills, and reports. Role-gated: each tool states its own bar.

## Tags

`bi_list_tags` lists tags. `bi_create_tag` and `bi_update_tag` change them. Tag names are tenant data — pass them through unchanged.

## Keyword rules

`bi_list_keyword_rules` reads the rules. Before `bi_add_keyword_rule`, call `bi_preview_keyword_rule`. Then `bi_update_keyword_rule` or `bi_delete_keyword_rule`.

## Windows

Windows are `tag_assignments` cut by sessionizers. See `bi_help("windows")` for the SQL shape. `bi_list_sessionizers`, `bi_create_sessionizer`, and `bi_activate_sessionizer` manage the cutters.

## Backfills

`bi_run_tagging_backfill` retags existing conversations. `bi_run_tagging_backfill(rule_id=…)` drops and rewrites that rule's rows in the window. `bi_run_ai_backfill` reruns the AI pass. Both are writes; confirm the window with the operator before starting one.

## Reports

`bi_tag_report` and `bi_reason_report` are the readouts. `bi_analysis_status` says whether a backfill is still running. AI provider settings are `bi_upsert_*` tools, separate from the copilot model.

## Roles

Tags, keyword rules, sessionizers and `bi_run_tagging_backfill` need editor; `bi_upsert_*` needs partner_admin or above; `bi_run_ai_backfill` is frepi_admin only. A `ROLE_DENIED` or `SCOPE_DENIED` is not fixed by retrying — see `bi_help("errors")`.
