AI assistant
An opt-in, grounded chat sidebar over the database you're connected to.
RED has an AI assistant in a sidebar - toggle it with ⌘LCtrl+L. It's
grounded in the database you're connected to: rather than guessing, it reads
your schema (and, when you allow it, runs read-only queries) to answer
questions, explain an error, or draft a query. It works in all three shells -
SQL, Redis and MongoDB - with a tool catalog shaped for each.
Opt-in and off by default
The assistant makes no network calls until you turn it on and configure an agent. RED itself has no telemetry - the assistant only talks to the provider you choose.
Agents
An agent is a named profile you set up in Settings → AI. Two kinds:
- API - the Claude Messages API, billed to an API key you paste. The key
lives in your OS keychain, never in
settings.toml. A custombase_urland model can be set per agent. - ACP - an external agent process spoken to over the Agent Client Protocol:
Claude Code on your existing Pro / Max subscription (a browser-based,
paste-the-code sign-in),
codex acp, or any local agent, launched by a command you configure.
Two built-ins ship configured: Claude (API) and Claude (subscription).
Add more with [[ai.agents]].
Pick which agent runs a chat from the panel header; the + button opens a "New chat with <agent>" menu, and the command palette has the same entries. A new chat starts on whichever agent you last used. Settings → AI is purely account management - sign in, or add API keys, per agent.
Access tiers
The assistant works through a set of database tools gated by an access tier you control - globally in Settings, or per connection:
| Tier | What the assistant can do |
|---|---|
off | Chat only - no database access at all. |
schema | Structure: tables, columns, types, keys, the FK graph, object DDL, and your own query history. Never a row of data. |
read | The full read catalog: schema plus SELECT and EXPLAIN. The shipped default. |
write | Read plus a single gated INSERT / UPDATE / DELETE per approval. Opt-in only, never a default. |
A connection's read-only posture is honored at every tier, and queries run under
resource guards (row caps, timeouts). [ai] enabled = false is a true kill
switch - no panel, no MCP server, no agent process - and a connection can
override both the switch and the tier, so a production database can be pinned to
off or schema.
Writes
At the write tier, every statement needs explicit, per-statement approval.
Destructive shapes (DDL, an unqualified UPDATE / DELETE) are refused
outright rather than offered.
Approvals count rows first - "Affects 4,213 of 812,004 rows in public.orders", with three of them shown - and warn when a statement matches none. The count runs on a short budget and never delays the prompt.
Review mode runs a turn's writes inside one open transaction that you commit or roll back at the end, on PostgreSQL, MySQL / MariaDB and SQLite. An unanswered review rolls itself back after two minutes.
Grounding it further
- Point at things - drag a table, column, schema, query tab or selected rows onto the panel, or use "Ask AI about this" in the schema tree. References resolve on send, not on drop.
- Attach files - text, images and PDFs, dropped anywhere on the panel or added with the + beside the composer. They are read off the UI thread at send time, and always treated as data, never as instructions.
- Your own SQL - the agent reads the queries you have run and your saved query library for this connection, so it uses the join paths, filters and metric definitions you actually use. Same on Redis, for commands run and keys opened.
- A knowledge file - plain markdown, per connection, that rides in every chat's prompt on that connection. "Learn this database" drafts one for you to review.
Working with it
- Ask in plain language - "why is this query slow?", "what references
orders?", "give me the last 10 signups". - Explain an error or optimize a query with one click from the relevant chip.
- Answers show their sources: a numbered line above the prose, one chip per query, each linked to the exact call in the activity trace.
- Queries are checked for join fan-out before the agent believes a number. Suspicious shapes get an extra pair of counts, and the agent is told the real numbers before it writes its answer. Nothing is blocked.
- The agent pages through a large result with a cursor over the same streaming machinery the grid uses, so windows tile the result with no rows repeated or skipped, and without re-running the query.
- It can hand you a file - a query result, a set of Redis keys, or a collection, as CSV or JSON, offered as a card in the chat.
- A context ring shows usage, amber past three quarters and red past nine tenths; the full breakdown and session cost are on its tooltip.
- Conversations are saved - reopen, rename, or delete past chats, and keep several going at once, each bound to its own agent.
Reply length is a setting (Settings → AI, 16K by default, up to 64K), and a reply that still hits it is continued rather than failed. Conversations are compacted as they fill, with local trimming noted in the activity trace.
A second opinion on your own statements
Independently of the chat, RED can ask your configured agent for an opinion on a statement a confirmation has stopped - the mistakes a keyword check cannot see: an inverted filter, a value that reads wrong against the schema, a join that fans out.
It is off by default, since enabling it sends the statement and a schema summary to the provider. It is advice and nothing more: it runs nothing, reads no rows, and can never unlock or shorten a confirmation. Settings → Query → Safety.
Outside the app
red mcp <connection> serves RED's read-only database tools to any MCP client
(Claude Code among them) over stdio - no GUI, no ports, writes withheld. See
Command-line mode.