PortfolioAll deep dives[///]deep_dive / orbitctl
2026·Personal / Systems Project· Role: Designer & Engineer

orbitctl — AI Database Control Plane

A single terminal interface where you connect to SQL and NoSQL databases, explore their schemas, run and benchmark queries under a safety layer, and drive it all with natural language through a local Ollama model — so your data never leaves the machine.

Rust Ratatui SQLx SQLite MCP Ollama Tokio crossterm
30-second version

orbitctl is a terminal control plane for databases I designed and built in Rust. It gives you one place to connect to SQL and NoSQL databases, browse their schemas, run and benchmark queries, and drive all of it with natural language through a local model in Ollama. Because the model runs on-device, no schema or query data ever leaves your machine. The interesting engineering is the adapter layer over SQLx, the safety layer that stops a model from running destructive SQL, and an immediate-mode TUI on Ratatui.

2-minute version

Most database work still lives in three disconnected tools: a client for queries, a separate tool for exploration, and a cloud chatbot if you want AI help. orbitctl collapses that into one terminal program. I wrote it in Rust so it is fast, safe, and runs anywhere — including over SSH. At the bottom is an adapter layer: a single trait that wraps SQLx, so SQLite, Postgres, and MongoDB all look the same to the rest of the app, and adding an engine means implementing one trait. Above that sits a safety-check layer that gates every SQL statement before execution — read-only mode, statement allow-listing, automatic LIMIT injection, and confirmation for destructive queries. On top is a Ratatui immediate-mode TUI for connections, navigation, query workflows, and a chat pane. The AI side is wired through MCP, an open protocol, and a local Ollama model — which means the whole thing works offline and keeps your data private. The part I am most proud of is that the same safety layer guards both the human path and the LLM path, so a hallucinated DROP TABLE from the model hits the exact same gate as a typo from me.

01 Overview #

orbitctl is a terminal-based control plane for databases. A control plane is the part of a system that decides what should happen and then directs the parts that actually do the work — the data plane. Here the data plane is the database itself, and orbitctl is the layer that connects to it, inspects its schema, issues queries, checks them for safety, and measures how fast they run.

What makes it "AI-native" is that every one of those operations is also exposed as a set of tools a language model can call. A user can type a question in the chat pane, and the model — running locally through Ollama — decides which database action to perform, while the same safety checks a human query would hit still apply. Nothing is trusted just because a model generated it.

The reason this matters is privacy and locality. AI-assisted database tooling usually means pasting your schema and rows into a hosted chatbot. orbitctl keeps the model on your own machine, so a developer can get AI help on a sensitive, internal database without sending its structure or data to a third party.

02 Problem & Context #

Working with databases day to day means juggling several tools. A REPL like psql for SQL, a schema browser to remember what a table is called, a benchmark harness to answer "is this index helping?", and — increasingly — an AI assistant to write the query. Those four rarely talk to each other, and the AI assistant almost always runs in the cloud.

That produces two concrete problems. First, friction: switching tools loses context, so exploration and querying never feel like one workflow. Second, trust: a developer who wants AI help on a real, internal database must either redact it or hand the schema to a hosted model. For a lot of production data, neither is acceptable.

The timing mattered too. Two things arrived recently that made this build practical where it would not have been a few years ago: local models became good enough (via Ollama) to write and reason about SQL on modest hardware, and the Model Context Protocol (MCP) standardized how AI applications expose tools to models, so I did not have to invent my own plugin protocol.

My self-imposed requirements were: run entirely in the terminal so it works over SSH; support more than one database engine through a single interface; make every query — human or model-generated — pass a safety gate; keep the AI path local and private; and keep the codebase small enough to understand end to end.

03 Foundations #

The concepts and tools orbitctl is built on, explained without assuming prior knowledge.

control plane

The control plane / data plane split

A control plane is the decision layer; a data plane is the doing layer. A router's control plane picks routes while its data plane forwards packets. Here, orbitctl is the control plane: it decides what query to run, checks it, and measures it, while the database (the data plane) executes. Separating them is what lets one UI govern many engines.

rust

Rust

A systems language with memory safety without a garbage collector, enforced by a borrow checker at compile time. It gives C-like speed with far fewer memory bugs, which matters for a tool that moves a lot of row data and runs for hours. Its strict type system is also a good fit for modeling queries and results precisely.

ratatui + crossterm

Ratatui and crossterm

Ratatui is a library for drawing terminal user interfaces (TUIs). It is immediate-mode: every frame you rebuild the whole screen from your current state, rather than keeping widgets alive. crossterm handles the low-level terminal I/O — reading keys, mouse, and resizes — and is Ratatui's standard backend.

sqlx

SQLx

An async Rust library for talking to databases. Its defining feature is compile-time-checked queries: macros like query! verify your SQL against a real schema at build time and generate typed result structs, so a wrong column name or a type mismatch becomes a compile error instead of a runtime panic.

sqlite

SQLite

An embedded database that stores everything in a single file and needs no server. It is the first engine orbitctl supports because it is zero-setup — perfect for a default local target. In WAL (write-ahead log) mode it supports concurrent readers and a single writer, which shapes the concurrency story.

mcp

MCP (Model Context Protocol)

An open protocol, released in late 2024, that standardizes how AI applications discover and call tools and data sources. A server exposes tools (callable functions), resources (readable data), and prompts over JSON-RPC. Using it means any MCP-capable client — not just my TUI — can drive orbitctl's database operations.

ollama

Ollama

A local runtime for large language models (LLMs). It downloads and serves models like Llama, Qwen, and Mistral on your own machine and exposes a simple REST API. Because inference happens locally, prompts and data stay on-device — the privacy core of the project.

tokio

Tokio (async runtime)

Rust's most popular async runtime. It schedules many concurrent tasks on a small number of threads, so the UI never blocks while a query runs. SQLx is built on top of it, which is the main reason the whole stack stays non-blocking.

04 Architecture #

orbitctl is a layered stack with two entry paths that converge on a single safety-checked adapter layer. The human path runs top-to-bottom through the TUI; the AI path runs TUI → Ollama → MCP server → the same safety layer. Nothing reaches the database without passing through the safety gate, no matter who (or what) issued the request.

MCP server exposes tools over JSON-RPC list_tables · run_query · bench Ollama (local LLM) Llama / Qwen / Mistral data never leaves the machine TUI — Ratatui + crossterm connect · browse schema · query · chat Safety-check layer read-only · allowlist · confirm · LIMIT Adapter layer trait DbAdapter — connect/query/explore SQLx async pool · compile-time-checked SQL SQLite file · WAL Postgres / MySQL adapter target Mongo / NoSQL adapter target manual queries natural-language prompt tool calls (JSON-RPC) validated tool call
Two paths, one gate: the human path (solid) and the AI path (dashed) both converge on the safety-check layer before touching SQLx and the drivers. Postgres/Mongo are drawn dashed as adapter targets, not yet shipped.
ComponentResponsibilityKey technology
TUI (immediate mode)Render panes, read input, dispatch intents to the rest of the appRatatui + crossterm
Intent parserClassify a user or model action — query, explore, benchmark, adminRust enum + match
Safety-check layerGate every SQL statement before executionPolicy rules (read-only, allowlist, confirm)
Adapter layerUniform connect / query / explore API over many enginesRust trait (DbAdapter)
SQLx coreAsync connection pools, typed rows, migrationsSQLx
DriversTalk to the actual database enginesSQLite (native); Postgres/Mongo via adapters
MCP serverExpose database operations as callable tools for any MCP clientMCP over stdio / SSE
Ollama bridgeHost a local model and route its tool calls back through safetyOllama REST API

05 Execution / Data Flow #

The full path from a natural-language question to rendered results. The same pipeline serves a human-typed SQL query — it just enters at the safety check instead of at intent parsing.

1 User prompt natural language typed in the chat pane 2 TUI captures input crossterm event loop reads keys and dispatches 3 Intent parsing classify: query · explore · benchmark · admin 4 SQL generation (Ollama) local LLM turns intent + schema context into SQL 5 Safety check read-only? allowlisted? destructive → confirm 6 SQLx execution async pool → driver → database 7 Render + benchmark format the result table, time the query context retained for follow-ups
A linear pipeline with one loop: after rendering, the schema and conversation context are retained so the next follow-up question starts from where the last one ended.
  1. Prompt. The user types a natural-language request in the chat pane, e.g. "which customers have more than ten open orders?".
  2. Capture. The crossterm event loop reads the keystrokes and hands a finished line to the app state; the Ratatui frame redraws immediately.
  3. Intent. A parser classifies the request. "Which customers…" maps to Query; other inputs map to Explore, Benchmark, or Admin. The intent decides which path the request takes and which tools the model is allowed to use.
  4. Generate. The request, the parsed intent, and the relevant schema (table names, columns, and a few sample rows) go to Ollama, which returns a SQL statement plus a short explanation.
  5. Safety check. The statement is parsed and checked: is it read-only, is it on the allowlist, does it need a LIMIT injected, is it destructive and therefore requiring explicit confirmation? A failing statement never reaches the database.
  6. Execute. The approved statement runs through the adapter layer and SQLx's async pool to the driver and the engine.
  7. Render + benchmark. Rows come back typed, are formatted into the results table, and the query's elapsed time is recorded for the benchmark view. The schema and conversation are kept so a follow-up question builds on this one.

06 Key Design Decisions & Trade-offs #

DecisionChosen approachAlternative rejectedWhy / trade-off
UI toolkit Ratatui (immediate-mode TUI) Tauri/egui desktop app, or a web UI Zero extra runtime, runs over SSH, no browser. Trade-off: layout is hand-coded per frame.
Data access SQLx — async, compile-time-checked queries diesel (sync, DSL) or rusqlite (sync) Async fits tokio; compile-time SQL catches typos and type drift. Trade-off: needs a live DB or offline metadata to compile.
DB abstraction Hand-rolled DbAdapter trait A full ORM, or calling SQLx directly everywhere Multiple engines plus an MCP surface need one contract; an ORM is too much, and scattering SQLx calls couples everything to one backend.
AI integration MCP (open protocol) A bespoke plugin / JSON-schema system Interop with existing MCP clients (Claude, Cursor, etc.) for free. Trade-off: JSON-RPC ceremony adds some overhead.
LLM hosting Local Ollama A hosted API (OpenAI / Anthropic) Privacy and offline operation. Trade-off: smaller models, weaker SQL generation than frontier models.
Safety model Allowlist + read-only + confirm Trust the model, or a full SQL sandbox Deterministic guardrails that also catch human error. Trade-off: a strict allowlist rejects some valid queries.
Compile-time SQL vs. fast iteration

The sharpest trade-off is SQLx's compile-time checking. It is a real safety win — a renamed column becomes a compile error, not a 3 a.m. production bug. But it means every dynamic query I want checked has to be a static string the macro can see, and the build needs either a live database or .sqlx offline metadata. Ad-hoc SQL from the LLM can't be compile-time-checked at all — which is exactly why the runtime safety-check layer has to exist. I paid for static safety at build time and dynamic safety at run time, and I accepted that the two mechanisms are fundamentally different.

07 Challenges & How I Solved Them #

The model wrote destructive SQL

Symptom: a local model, asked to "clean up old rows", confidently produced a DROP TABLE. Root cause: the model had no notion of what is safe on a given database — and I had initially trusted its output. Fix: every statement now passes through the safety layer regardless of origin. Destructive verbs are rejected unless the user confirms, and there is a default read-only mode that rejects any write outright.

Compile-time queries broke on every schema change

Symptom: the build failed any time a table changed, because query! could not verify SQL. Root cause: compile-time checking needs a schema to check against. Fix: captured .sqlx offline metadata and checked it in, so builds are reproducible without a live DB, and set SQLX_OFFLINE for CI.

The UI froze during long queries

Symptom: the whole TUI hung while a slow query ran. Root cause: an immediate-mode loop is single-threaded, and I had a blocking call inside it. Fix: moved every database call behind tokio tasks using the async pool; the UI loop only polls for results and keeps redrawing, so the app stays responsive during a query.

The LLM guessed the wrong schema

Symptom: generated SQL referenced columns or tables that did not exist. Root cause: the model was asked to write SQL with no context about the actual database. Fix: inject the relevant schema — table names, column names and types, plus a few sample rows — into the prompt, and constrain generation to the tables currently in scope.

08 Interview Q&A #

What does "control plane" actually mean here, and why is it the right word?

A control plane is the decision layer that tells a data plane what to do. The data plane here is the database: it stores data and executes queries. orbitctl is the control plane: it decides which query to run, checks it for safety, dispatches it, and measures the result. The word matters because it names the split honestly — orbitctl never stores data itself, it governs access to it. That split is what lets one UI and one safety policy sit in front of many engines (SQLite, Postgres, Mongo) without the control logic living inside any single database.

Why Rust for a database tool, instead of Go, Python, or Node?

Three reasons. First, memory safety without a garbage collector: a tool that streams large result sets for hours benefits from not having GC pauses, and the borrow checker catches the exact class of use-after-free and data-race bugs that are common in a multithreaded async app. Second, the type system: SQLx gives me typed rows, and Rust's enums let me model "intent" and "query result" precisely, so invalid states can't be represented. Third, single-binary deployment — I ship one static executable that runs over SSH with zero runtime dependencies, which is the whole point of a terminal tool. Go would be the closest alternative and is genuinely fine here; I chose Rust because the compile-time guarantees and the SQLx ecosystem specifically reward the extra ceremony.

How does the adapter layer work, and how would you add Postgres or Mongo?

The adapter layer is a single trait, DbAdapter, with the few methods every engine must provide: connect, list_tables, describe_table, run_query, and benchmark. The TUI, the safety layer, and the MCP server all program against this trait, never against SQLx or a specific engine directly. Adding Postgres means writing one struct that implements the trait — SQLx already supports Postgres as a backend, so most methods are thin wrappers. Adding Mongo is more work because it is not SQL: the "describe" and "query" shapes differ, so the trait would need to grow a way to express non-relational operations, and the safety layer's SQL-specific checks (like statement allow-listing) would need a Mongo equivalent. That is the real test of whether the abstraction is the right size, and it is why I kept the trait deliberately small.

Why SQLx over diesel or rusqlite?

It came down to async and compile-time checking. rusqlite is synchronous and binds me to one engine; diesel is a nice type-safe query builder but its sync model doesn't fit a non-blocking UI, and its DSL hides the SQL behind an abstraction I didn't want to learn for every engine. SQLx gives me two things I actually need: an async connection pool that plugs into tokio, and query!-style macros that check SQL against the real schema at compile time and hand back typed rows. The trade-off is that compile-time checking requires a live DB or offline metadata, and fully dynamic SQL (like what the LLM produces) can't be checked at compile time — which is why I added a runtime safety layer on top.

How do you enforce SQL safety, concretely?

It is defense in depth, all deterministic, nothing depends on the model being "careful." First, a read-only mode that rejects any statement containing a write verb — INSERT, UPDATE, DELETE, DROP, ALTER, TRUNCATE — by tokenizing the statement and rejecting write keywords outside of string literals. Second, a statement allow-list: for AI-generated SQL, the statement must be a single SELECT (optionally WITH) with no subquery escapes into writes. Third, transaction rollback: any statement that does run a write is wrapped in a transaction that is rolled back unless the user explicitly confirms. Fourth, LIMIT injection: if a query has no LIMIT, one is appended so a mistake can't pull a million rows. Fifth, destructive-query confirmation: a modal prompt that names the exact verb and table before anything irreversible executes. The key principle is that a human typo and a model hallucination hit the same gates.

How does MCP/plugin extensibility work, and why did you choose it over a homegrown plugin system?

MCP is an open protocol where a server exposes tools, resources, and prompts over JSON-RPC, and any MCP-capable client (a model or an app) can discover and call them. orbitctl runs an MCP server that exposes list_tables, describe_table, run_query, and benchmark as tools. The reason I chose it is that it makes the tool surface interoperable for free: the same operations my TUI drives are available to Claude Desktop, Cursor, or any other MCP client, without me designing, documenting, and maintaining a custom protocol. The honest trade-off is that JSON-RPC adds serialization overhead and some ceremony, and MCP is still young — the spec is evolving. But for the cost of one protocol, I get an ecosystem, and that beats a bespoke plugin system nobody else speaks.

How are local Ollama models used, and what's the privacy benefit?

Ollama runs a model locally and exposes a REST API on localhost. orbitctl sends three things to it: the user's request, the parsed intent, and the relevant schema (table names, columns, a few sample rows). The model returns SQL plus a plain-English explanation, which I show in the chat pane next to the results. The privacy benefit is that none of that context — schema, sample rows, or the query itself — ever leaves the machine. For a developer working on an internal production database, that is the difference between "AI help is allowed" and "AI help is banned by policy." The trade-off is capability: a local model is smaller than a frontier cloud model, so its SQL is good on common queries and weaker on exotic dialect features. I compensate by giving it tight schema context and by never trusting its output.

How do you prevent the LLM from emitting destructive SQL?

I don't try to prevent it from emitting it — a language model will occasionally emit anything. I prevent it from executing it. The model's SQL is untrusted input, exactly like a user's SQL, so it goes through the identical safety layer: tokenize, reject write verbs in read-only mode, require the statement to match the allow-list shape, inject a LIMIT, and demand explicit confirmation for anything destructive. On top of that I constrain the context: the prompt tells the model it may only produce read-only statements against the tables in scope, which biases output toward safe SQL. But the guarantee comes from the gate, not the prompt. The one-line answer I give in interviews: the model proposes, the safety layer disposes.

Explain the TUI rendering model — immediate mode, the event loop, crossterm.

Ratatui is immediate-mode: there are no persistent widget objects. Each frame, I reconstruct the entire screen from the current app state — which pane is focused, what the query text is, what the result table contains — and draw it. The loop is: poll crossterm for events (keys, mouse, resize), apply them to the app state, then draw one frame and flush to the terminal. Because rendering is a pure function of state, there is no UI state to keep in sync with app state, which eliminates a whole class of bugs. crossterm is the backend that abstracts terminal I/O across platforms and emits raw-mode key events. The main discipline is that the draw function must be cheap and pure, and any slow work (like a query) must happen off the loop in a tokio task, with the loop only reading the result.

How does benchmarking work, and what do you actually measure?

The benchmark path runs a query several times and records elapsed time per run. What matters is measuring the right thing: I measure wall-clock execution of the query on the engine, not the time to render rows in the TUI, and I run a warm-up iteration first so cold-cache effects don't dominate. Because orbitctl targets multiple engines, the benchmark just calls benchmark on the adapter trait, so the same harness compares "query X on SQLite" vs "query X on Postgres" once both adapters exist. I deliberately do not report absolute numbers as gospel — latency depends on the machine, the data, and cache state — so the UI shows per-run and median timings and treats them as relative guidance, not a benchmark suite with published results.

How do you handle concurrency and scaling with tokio?

The scaling story is about not blocking. orbitctl runs on a tokio multi-threaded runtime, and every database call goes through SQLx's async pool, so many queries can be in flight while the UI keeps rendering. The TUI's event loop is single-threaded by design (one terminal, one set of panes), so the rule is: never run blocking work inside it — spawn it, then poll. The real bottleneck is the database itself, not my code: SQLite in WAL mode supports concurrent readers but a single writer, so heavy write concurrency would need either batching or a move to Postgres. I would describe scaling honestly as "the control plane stays responsive under load, and the data plane's limits are the engine's, not mine." If I needed many concurrent users, the MCP server can already run headless, so the natural scaling path is many headless MCP servers behind one control plane, not one shared TUI.

How would you test a project like this?

In layers. The adapter layer gets integration tests against a real in-memory SQLite database — spin up the DB, run connect/describe/query, assert on typed results. The safety layer is the highest-value target, so it gets the most tests: a table of statements and expected verdicts — SELECT passes, DROP is rejected in read-only mode, DELETE demands confirmation, a missing LIMIT gets one injected. Those tests don't need a database at all, just the parser. The intent parser gets unit tests per classification. The LLM path I test with a mocked Ollama client so I can feed fixed SQL and assert the flow, keeping CI deterministic instead of depending on a real model. For the TUI, I test that the draw function produces the expected buffer for a given state, and I drive end-to-end flows manually. The one thing I can't unit-test cleanly is the model's actual SQL quality — that needs manual or property-based testing, which is exactly why the safety layer has to be bulletproof independent of the model.

What breaks when your schema is 10x bigger?

Three things, and I can name them because I've thought through where the scaling pain lives. First, schema listing: if list_tables and describe_table fetch everything eagerly, a 10x schema makes the navigation pane slow and bloats memory — the fix is lazy loading and pagination, fetching column detail only for the table in focus. Second, prompt context: I can no longer stuff the whole schema into the LLM's context window, so I'd need schema retrieval — select only the tables relevant to the query — which is where the naive approach silently degrades into worse SQL. Third, rendering: a results table with 10x the columns and rows will choke the immediate-mode draw if I format everything up front; the fix is virtualizing the table and streaming/limiting rows. Notice all three are O(n) issues that I've already kept behind an interface, so they're local fixes, not rewrites. The engine's own query speed is separate and depends on indexes, not my code.

Tricky one: is LLM-generated SQL an injection risk in the same way user input is?

Not in the same way, and the distinction matters in an interview. Classic SQL injection is about data: an untrusted string gets concatenated into a query and interpreted as code, like ' OR '1'='1. orbitctl is protected from that by SQLx's bound parameters — user values are always sent as parameters, never interpolated into the SQL string. LLM-generated SQL is a different threat: it is the statement itself that is untrusted, not a value inside it. A model can emit a syntactically valid DELETE or a cartesian join with no quoting tricks at all. So the defense is also different: parameterization stops injection, but only a policy layer (read-only mode, allow-list, confirmation) stops a malicious or hallucinated statement. The clean way I summarize it: parameterization protects the data path; the safety layer protects the control path. You need both because they guard different boundaries.

Where does SQLx's compile-time checking fall short?

Two places. First, it only works on static SQL strings that the macro can see at compile time — so any query I build dynamically, and every query the LLM generates at runtime, is invisible to it and must be handled by the runtime safety layer. Second, it needs a schema to check against: a live database connection, or checked-in .sqlx offline metadata. That metadata can drift from the real schema, which reintroduces a weaker guarantee than people assume. So I treat compile-time checking as a fast feedback loop for the queries I own, not as a security boundary — the security boundary is the runtime gate. That framing usually lands well because it shows I understand what a tool does and doesn't guarantee.

What's the difference between MCP and a plain Rust trait plugin, and why does it matter?

A Rust trait plugin is an in-process extension point: you compile new code against my crate, and it runs inside my binary. It is fast and type-safe, but it is also locked to Rust and to my process — a Python or TypeScript client can't use it. MCP is a process and language boundary: the server speaks JSON-RPC over stdio or SSE, so any client in any language can call the same tools without recompiling or even importing my code. The trade-off is that MCP costs serialization overhead and you lose compile-time type checking across the boundary — you validate the payload at runtime instead. I use the trait for the internal adapter layer (performance, type safety) and MCP for the external tool surface (interop, language-agnostic). Picking the right boundary for each is the actual design decision.

09 Limitations & If I Rebuilt It #

The honest list of what is weak today and what I would do differently with the benefit of hindsight.

  • Safety layer is heuristic, not a parser. It tokenizes SQL and applies keyword/allow-list rules rather than using a real SQL parser. That is fast and good enough for the common cases, but adversarial or exotic SQL can slip past. If I rebuilt it, I would add a proper parse step (for SQLite, the engine's own EXPLAIN/authorizer callback is a far stronger gate).
  • Local models are a capability ceiling. SQL generation on small local models is noticeably worse than frontier cloud models on complex queries. I would add an optional remote-model path with an explicit, user-controlled allowlist of what gets sent, so users trade privacy for capability deliberately rather than all-or-nothing.
  • Single-writer SQLite limits write concurrency. That is a database fact, not a bug, but a rebuild would target Postgres as a first-class adapter earlier to make the concurrency story real.
  • No multi-user story. It is a single-user TUI by design. The MCP server already runs headless, so the natural v2 is a headless control-plane daemon with many clients, which I did not build.
  • Benchmarking is basic. I measure wall-clock latency, not throughput, explain plans, or variance across cold/warm cache. A serious benchmark view needs query-plan capture and more rigorous methodology.

None of these are hidden. In an interview I volunteer them — naming your own ceiling accurately reads as stronger than pretending it isn't there.

10 Talking Points & Metrics #

0
queries that bypass the safety layer — human or AI
1
trait implementation to add a new database engine
local
LLM inference on-device via Ollama — no cloud API

If asked, these are the crisp points to make:

  • Lead with the problem: database work is split across three tools, and AI help means shipping your schema to a cloud chatbot. orbitctl fixes both with one local terminal program.
  • Make the "control plane" framing explicit — I govern access to the data plane, and that is why the safety layer is the heart of the design.
  • Whiteboard the adapter trait: one interface, many engines; adding Postgres is a trait impl, adding Mongo tests the abstraction.
  • Explain the two kinds of safety: compile-time checking (SQLx) for the queries I own, and a runtime gate for everything else, because the LLM's SQL can never be compile-time-checked.
  • Defend MCP over a homegrown plugin system: one protocol buys an entire ecosystem of clients.
  • Volunteer the limitations before being asked — local-model capability, heuristic SQL safety, single-writer SQLite. It reads as honest and senior.

11 Project Glossary #

Control plane
The decision layer that directs what the data plane should do; here, the layer that governs access to databases.
Data plane
The layer that does the actual work — the database engine that stores data and executes queries.
Immediate-mode TUI
A UI style where the whole screen is rebuilt from state every frame, with no persistent widgets.
Adapter layer
The DbAdapter trait giving every engine a uniform connect / query / explore interface.
SQLx
Async Rust database library with compile-time-checked queries and typed result rows.
Compile-time checking
Verifying SQL against a real schema at build time so errors surface before runtime.
Safety-check layer
The runtime gate that tokenizes and validates every statement before execution.
MCP (Model Context Protocol)
An open protocol for exposing tools and data to AI clients over JSON-RPC.
Ollama
A local runtime for running LLMs on your own hardware, exposing a REST API.
Tokio
Rust's async runtime, used to keep the UI non-blocking while queries run.
crossterm
The terminal I/O backend that reads keys, mouse, and resizes across platforms.
WAL (write-ahead log)
SQLite journaling mode allowing concurrent readers and a single writer.
Read-only mode
A mode that rejects any statement containing a write verb.
Statement allow-list
A policy restricting AI-generated SQL to a safe shape (single SELECT/WITH, no write subqueries).

12 References #

[\\]