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 --name 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

# 6. Browse + edit the docs (SKILL.md, interaction-skills/, your zone skills)
uv run sql-harness web

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.5

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.5
File Size Uploaded
sql_harness-0.3.5.tar.gz 182.7 kB Details

Built distribution (wheel)

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

Total release size: 321.1 kB

Release files / sql_harness-0.3.5.tar.gz

Download URL sql_harness-0.3.5.tar.gz
Size 182.7 kB
Tags Source
SHA-256 checksum
How to use checksums
531e4d8765fc5f46f37575a0da573a93226bac17be01021b7413e08db3369ae9
BLAKE2b-256 checksum
How to use checksums
4731d418ef1ff101393c79352afaa72b651b09821c57e0b63541774eb3099c08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","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.5-py3-none-any.whl

Download URL sql_harness-0.3.5-py3-none-any.whl
Size 138.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
475d34968051f05ba5e80f280d97de53c1c0297c305e40da9bf6c17d193a53c1
BLAKE2b-256 checksum
How to use checksums
e8fdfc360bcab041015c85bacc1e0aa06361aa506faeea1fecb7bf6e2ccd7750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","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

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

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