Skip to main content

sql-harness

A thin, single-process SQL CLI for LLM agents. Mirrors browser-harness's structure but targets relational databases (Postgres, MySQL, Redis-soon).

Connection file format, env vars, and driver list: see docs/install.md.

Quickstart

# 1. Install deps (one-time)
uv sync

# 2. Scaffold a starter connections.toml
uv run sql-harness init

# 3. Add a connection
uv run sql-harness add local_pg --driver postgres --url 'postgresql://postgres:postgres@localhost:5432/postgres'

# 4. Test it
uv run sql-harness test local_pg

# 5. Use it
uv run sql-harness <<'PY'
use_workspace("local_pg")
print(query("SELECT version()"))
print(list_tables())
print(describe("pg_class"))
PY

Architecture (~1k lines across 8 core files)

  • docs/install.md — first-time install + first connection
  • SKILL.md — day-to-day usage
  • lab/sql_harness/src/sql_harness/ — protected core package
  • ${XDG_CONFIG_HOME:-~/.config}/sql-harness/connections.toml — plaintext credentials in ONE place
  • ${XDG_CONFIG_HOME:-~/.config}/sql-harness/agent-workspace/agent_helpers.py — task-specific helpers
  • ${XDG_CONFIG_HOME:-~/.config}/sql-harness/agent-workspace/zones/<conn>/skills/ — per-DSN skills (one zone per connection)
  • ${XDG_CONFIG_HOME:-~/.config}/sql-harness/agent-workspace/zones/meta/skills/ — cross-DSN strategy skills (passive fallback for apply_skill)

Why mirror browser-harness?

  • Same operational ergonomics for agents: heredoc CLI with auto-imported helpers.
  • Same agent-workspace pattern (helpers + skills stay editable per-project).
  • Same path/state layout (XDG-style state directory).
  • Same doc layering: SKILL.md body + interaction-skills/*.md for stuck points.

What this is NOT

  • Not a database migration framework.
  • Not an ORM.
  • Not a connection-string parser (pgcli/mycli already exist for interactive REPL use; this is for agents).
  • Not a long-running daemon. SQL connections don't need one.

Contributing

PRs and improvements welcome. See docs/AGENTS.md for code priorities.

  • Skills are written by the harness, not by you. When you figure out a non-obvious SQL flow (a weird schema, a slow query, a JSON column trick), file a skill in agent-workspace/zones/<conn>/skills/<name>.md for that DSN, or agent-workspace/zones/meta/skills/<name>.md if it generalizes. Future sessions will read it before re-discovering it.
  • Bug fixes, new drivers, helper additions all welcome.

License

MIT.

Metadata

Release files for sql-harness 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sql-harness 0.3.3
File Size Uploaded
sql_harness-0.3.3.tar.gz 147.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sql-harness 0.3.3
File Interpreter ABI Platform
sql_harness-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 252.1 kB

Release files / sql_harness-0.3.3.tar.gz

Download URL sql_harness-0.3.3.tar.gz
Size 147.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6bab21a7aa3599add59b7015cf197c774a2fcbdf303410c82878c454981fba18
BLAKE2b-256 checksum
How to use checksums
8615dcda281229e1c8744358f4d508ca1abf53a34b3f1178d1b27a7d0e59b7dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.12 {"installer":{"name":"uv","version":"0.12.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / sql_harness-0.3.3-py3-none-any.whl

Download URL sql_harness-0.3.3-py3-none-any.whl
Size 105.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f61a81d6e0fafb4d37d66d7d01e51ce0f1ea2ca7dec780f83a643a1529fa771
BLAKE2b-256 checksum
How to use checksums
07e5ac0a64eb951eb6a730280ee7b411b3f57b77f6f7edf09c7e4cba2e896331
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.12 {"installer":{"name":"uv","version":"0.12.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.5

2 release files

0.3.4

2 release files

This release

0.3.3 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page