# Devii for administrators Devii is the in-platform AI assistant, but for an administrator it is also an operator. When you sign in and chat with Devii, it acts as **your own account** over the platform REST API, and because your admin status is resolved server-side, the full set of admin tools appears only for you. This page is a practical playbook: for each admin capability it gives the exact phrasing to say to Devii, when to reach for it, and which guard rails apply. > Audience: administrators only. This is the operational companion to the technical reference under [Tools and scopes](/docs/devii-tools.html) and [Security and limits](/docs/devii-security.html). Read those for how the catalog and confirmation machinery are built; read this for what to actually say. ## How Devii operates as an admin - Devii authenticates every action with **your own API key**, so all of its work rolls up under your uid and is attributable to you. - Admin-only tools (analytics, settings, user management, backups, gateway routing) are withheld from non-admin sessions and exposed only because the server confirmed you are an administrator. You never have to ask for elevated access. - The read-only **database API** tools are stricter still: they are added to your tool list only when you are the **primary administrator** (the oldest Admin account, the same identity that may download backups). Every other administrator's Devii does not see them and is not aware the database API exists. - **Every action Devii takes is audited** with `origin=devii`, so you can always reconstruct what it did and when. - **Financial figures are admin-only.** Members and guests see only a percentage of their daily AI quota; you see token counts, dollar cost, and projected spend. - Devii never invents routes. When unsure it searches the docs first, then calls a real, audited endpoint - the same one the web UI uses. A useful first move in any session: ask Devii to confirm its footing. ``` Confirm you are operating my admin account, and list the admin capabilities you have. ``` ## Moderation and batch spam removal This is the headline admin power. As an administrator you may delete **any** user's content, not just your own: `delete_post`, `delete_comment`, `delete_gist`, `delete_project`, `delete_media`, and `delete_attachment`. Every delete is a **soft delete** (stamped `deleted_at` / `deleted_by`), so nothing is destroyed - removed items are restorable from the admin **Trash**. Every delete tool is **confirmation-gated**. The first call is always refused; Devii must show you the exact target, and only after you agree does it re-issue the call with `confirm=true`. This is deliberate: it makes a blind or accidental mass-delete impossible. When to use it: clearing spam, abuse, or policy-violating content across one or many authors. ``` Find every post by spammer123 that mentions casino or crypto giveaways. Show me each one first, then delete them once I confirm. ``` Devii will list the matches, wait for your go-ahead, then delete each post and report back. Because the deletes are soft, if it catches a false positive you can restore it from Trash. See [Soft delete and data retention](/docs/soft-delete.html). ## Finding the items to act on (read-only database) Before you can act in bulk you usually need to find the rows. If you are the **primary administrator**, Devii has a **strictly read-only** database surface over every table: `db_list_tables`, `db_list_rows`, `db_query` (SELECT-only - inserts, updates, deletes, and DDL are rejected), and `db_design_query` (natural language to a validated SELECT, which automatically adds `deleted_at IS NULL` for soft-delete tables). These tools are absent for every other administrator. When to use it: scoping a moderation sweep, investigating a user, or answering a data question. The database API can never modify data, so this step is always safe. ``` Show me all comments from guest accounts created in the last 24 hours whose content looks like spam, newest first. ``` ``` How many posts has each of the ten most recent signups made? ``` Devii designs the SELECT, runs it read-only, and shows you both the SQL and the rows. You then decide what to delete - the find and the act are separate steps, by design. ## Repeatable macros and scheduled cleanups Two features turn one-off moderation into standing operations. **Virtual tools** are admin macros you define in plain language once and reuse. Devii stores them per-owner and adds them to its own tool list. ``` Create a tool called purge_spam that takes a username and deletes all of that user's posts and comments after showing me the list. ``` Later you simply say `purge_spam bob_test` and Devii runs the stored procedure (still honouring the per-delete confirmation). **Scheduled tasks** run an autonomous prompt on a schedule (once, on an interval, or by cron). Use them for unattended hygiene. ``` Every night at 3am, find zero-engagement spam posts older than 30 days and delete them. Log what you removed. ``` Devii creates a cron task; the scheduler fires it on the lock-owner worker and records each run. ## User and access management Manage members and roles conversationally: `admin_list_users`, `admin_set_user_role`, `admin_set_user_password`, and `admin_toggle_user` (enable or disable an account). ``` List the newest 20 users and show me anyone who is currently disabled. ``` ``` Make alice_test an admin. ``` Guard rail - the **admin seniority guard**: a junior administrator cannot manage a more senior administrator (the earlier-registered admin wins). This is enforced server-side, so it applies to Devii exactly as it does to the admin web UI - Devii cannot talk its way around it. ## AI usage, cost, and quotas Watch and control AI spend: `ai_usage` (gateway-wide metrics - volume, tokens, latency, cost, projected monthly burn, cache savings), `admin_user_ai_usage` (one user's spend), `cost_stats` (this Devii session's own cost), and the quota resets `admin_reset_user_ai_quota`, `admin_reset_guest_ai_quota`, and `admin_reset_all_ai_quota` (all three confirmation-gated). ``` Which users burned the most tokens this week? Then reset the daily quota for the one who hit their limit. ``` ``` What is our projected monthly AI cost at the current rate, and how much are we saving from prompt caching? ``` ## Audit and incident response The audit trail is your forensic record: `audit_log` filters every state-changing action by `event_key`, `category`, `actor_role`, `actor_uid`, `origin` (web / api / devii / cli / service / scheduler), `result` (success / failure / denied), free text, and date range; `audit_event` opens one event with its full related-object links. ``` Show me every content deletion in the last 7 days and who performed it. ``` ``` List every denied admin action this month, then open the most recent one in detail. ``` The audit log is read-only through Devii - it can be queried but never altered. ## Site settings and services Read and change operational configuration with `admin_get_settings` and `admin_save_settings` (maintenance mode and message, registration open/closed, rate limits, session lengths, and more), and run the background services with `admin_list_services`, `admin_services_data` (live status, metrics, log tail), `admin_start_service`, `admin_stop_service`, `admin_run_service`, `admin_clear_service_logs`, and `admin_config_service`. ``` Put the site in maintenance mode with the message "Back in 15 minutes", then tell me when you have done it. ``` ``` How is the news service doing? Show its last log lines and run it once now. ``` Admins are never locked out by maintenance mode, so you can always reverse it: ``` Take the site back out of maintenance mode. ``` ## News moderation Curate the developer news feed: `admin_list_news`, `admin_toggle_news` (show or hide), `admin_publish_news`, `admin_landing_news` (feature on the landing page), and `admin_delete_news` (confirmation-gated). ``` Show me the latest news drafts and publish the two best ones, then feature the top one on the landing page. ``` ## Backups Manage backups end to end: `backups_overview` (storage usage, disk space, every archive, configured schedules), `backup_run` (kick off a `database`, `uploads`, `keys`, or `full` backup), `backup_status` (poll a running job), `backup_delete` (confirmation-gated, irreversible), and the recurring schedules `backup_schedule_create` and `backup_schedule_delete`. ``` Run a full backup now and tell me when it finishes, with the checksum and size. ``` ``` Create a daily backup schedule of the database that keeps the last 7 archives. ``` Guard rail: **downloading a backup archive is restricted to the primary administrator** (the earliest-created admin). Any other admin is blocked from the download, by design - the rest of the backup tools are available to all admins. See [Backups](/docs/backups.html). ## Containers Operate per-project container instances: `container_list_instances`, `container_create_instance`, `container_instance_action` (start, stop, restart, pause, resume, delete, sync), `container_configure_instance`, `container_logs`, `container_exec` (run a one-shot command in the workspace), `container_stats`, and `container_schedule` (start or stop on a once / interval / cron schedule). You can also pop a live floating terminal with `open_terminal`. ``` List the containers on the api project and restart any that have been running longer than four hours. ``` ``` Attach a terminal to the web container. ``` Guard rail: `container_exec` runs inside the container workspace only, and a command matching the **destructive pattern** (`rm`, `dd`, `mkfs`, `drop table`, `delete from`, `git clean`, redirect over a file, and similar) is confirmation-gated just like the delete tools. Instance delete is confirmation-gated too. ## Gateway model routing Inspect and shape AI provider routing: `gateway_providers` and `gateway_models` (read the configured upstreams and source-to-target model routes with their pricing), and the editors `gateway_provider_set`, `gateway_provider_delete`, `gateway_model_set`, and `gateway_model_delete` (the two deletes are confirmation-gated). ``` Show me the current model routes and their per-million-token pricing. ``` ``` Route the molodetz model to the openrouter provider with the model and prices I give you. ``` ## Guard rails recap Devii is powerful for admins but it is fenced: - **Everything destructive is confirmation-gated.** Deletes, quota resets, backup and schedule deletes, gateway deletes, instance delete, and destructive container commands are all refused on the first call; Devii must show you the target and re-issue with `confirm=true`. - **Deletes are soft and restorable** from the admin Trash - only garbage collection is permanent. - **The database API is strictly read-only.** Devii can find anything but can never write through it. - **Seniority and primary-admin limits hold through Devii** exactly as in the web UI: no managing a more senior admin, and only the primary administrator downloads backups. - **Every action is audited** with `origin=devii`. For the underlying machinery see [Tools and scopes](/docs/devii-tools.html), [Security and limits](/docs/devii-security.html), the read-only [Database API service](/docs/services-dbapi.html), the [Audit Log](/docs/audit-log.html), [Backups](/docs/backups.html), and [Soft delete and data retention](/docs/soft-delete.html).