Skip to main content

sql-harness

A thin, single-process SQL + Redis + SSH CLI for LLM agents. Mirrors browser-harness's structure but targets relational databases (Postgres, MySQL, SQLite) plus Redis (keyspace ops + Lua) and SSH (remote shell + SFTP).

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/{shared/sql, <driver>}/*.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.7

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.7
File Size Uploaded
sql_harness-0.3.7.tar.gz 213.7 kB Details

Built distribution (wheel)

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

Total release size: 382.5 kB

Release files / sql_harness-0.3.7.tar.gz

Download URL sql_harness-0.3.7.tar.gz
Size 213.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c0fa98fd3cd8731992e621dd445284850a25b9e4e91d6fb54618947b696a1faf
BLAKE2b-256 checksum
How to use checksums
02e9a118469d094a2f93d95049d42b56d615629fbdf7d38c5184fc3fd274445a
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.7-py3-none-any.whl

Download URL sql_harness-0.3.7-py3-none-any.whl
Size 168.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e5683ff957a02778e65ce505c2830a75b2c73ae8ece3de0b8acdcca75234b75
BLAKE2b-256 checksum
How to use checksums
3a8488d4419f38711806662c59db36aff8f0ad51cd5c0203ed304212d955141d
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

This release

0.3.7 This release

2 release files

0.3.5

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