About pgnode

A local SQL agent for PostgreSQL teams

pgnode is a CLI-first agent that turns natural language into validated SQL, then runs it on your PostgreSQL database. It is designed for developers who want fast answers without shipping data to a hosted service.

Local-first LLM

pgnode talks to Ollama on your laptop, so prompts, schemas, and results never leave the machine.

PostgreSQL-native

It connects directly or through an SSH tunnel and uses your live schema to shape SQL.

Safety-gated writes

Every statement is validated before execution, with explicit confirmation for inserts and updates.

CLI workflow

Run one-shot queries, stay in a chat session, or use helpers like /tables and /history.

How pgnode works

Local by default

Step 1

Connect

Save your DATABASE_URL, Ollama host, and model name with pgnode connect.

Step 2

Verify

Run pgnode doctor to confirm the database, tunnel, and model are all reachable.

Step 3

Query

Ask for SQL in natural language and keep control of when writes execute.

What it does for teams