SQLite CLI
$ sqlite3 Official Low RiskThe official sqlite3 shell reads and queries local .db/.sqlite files directly with zero server setup. Modern SQLite (>=3.33) includes native -json output, -readonly mode to prevent accidental DB creation or writes, and -bail to stop on errors.
brew install sqlite sqlite3 -readonly -json app.db "SELECT ..." runs in single-digit milliseconds locally with zero MCP server setup.
Agent-Readiness Checklist
Local Probe EvidenceFCRS-1.0 6-Dimension Breakdown
Supports -json, -csv, -readonly, -bail, and positional one-shot SQL arguments with zero ANSI clutter.
- Native
-json,-readonly,-bail, and positional SQL argument
-readonly guarantees no writes and avoids silently creating empty files on typos; local-only blast radius.
-readonlyprevents writes and accidental file creation
Pre-installed on macOS and almost all Linux distros; single tiny C binary everywhere else.
- Pre-installed on macOS/Linux; official static binaries
Fastest way to inspect local SQLite databases, though duckdb is stronger for multi-format analytics.
- Instant local
.sqliteinspection without external drivers
Official SQLite Consortium tool maintained with legendary reliability.
- Official SQLite CLI (
sqlite.org)
Exhaustive official documentation at sqlite.org/cli.html.
- Official CLI documentation at sqlite.org/cli.html
Security, Auth & Guardrails
None; operates directly on local filesystem database files.
100% free and Public Domain.
# sqlite3 Agent Rules - Always pass `-readonly` and `-json` for inspection queries so missing paths don't create empty DB files. - Always pass the SQL command string as an argument (never launch bare `sqlite3 app.db` REPL). - Use `-bail` when running scripts so errors halt immediately.
Agent-Ready Command Recipes
Safe Read-Only Queries
sqlite3 -readonly -json app.db "SELECT name, sql FROM sqlite_master WHERE type='table';"
Opens the database read-only and emits table definitions as clean JSON.
sqlite3 -readonly -json -bail app.db "SELECT * FROM events ORDER BY id DESC LIMIT 20;"
Returns recent records as JSON and fails fast on SQL errors.
Controlled Writes & Previews
sqlite3 app.db ".backup 'app.backup.db'"
Safely copies a live SQLite database using SQLite's online backup API.
Strengths for Agents
- +
-readonly -jsonis fast, safe, and universally available. - + Pre-installed on nearly every developer machine and container.
- + Online
.backupdot-command creates safe snapshots even under WAL concurrency.
Caveats & Pitfalls
- ! Older system
sqlite3builds (<3.33) may lack the-jsonoutput mode. - ! Without
-readonly, runningsqlite3 typo.dbsilently creates an empty file.