sql2json AGENTS.md

Repository instructions for sql2json, a tool that runs database queries and prints the results as JSON or CSV. They also describe how coding agents should orient themselves before querying.

In plain words
What is it for?
Installing sql2json, querying databases through its command line or Python package, and preparing agents to work safely in the repository.
Why use it?
They help an agent choose the right command, install database drivers, and follow the project's workflow before accessing data.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/fsistemas/sql2json/agents-md
Clone the repo
git clone --depth 1 https://github.com/fsistemas/sql2json

Made for: Codex, OpenCode.

Per session 3,721 This file is loaded in full into every session.
When invoked 3,721 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.03721 $0.03721
Opus 5 $0.01861 $0.01861
Sonnet 5 $0.00744 $0.00744
Haiku 4.5 $0.00372 $0.00372

Measured yesterday against content hash 760d3eacd059, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sql2json AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 349 lines

How it starts

The opening of the file, as written. The whole thing — 349 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Using sql2json with AI Agents and LLMs

Working on this repository? Coding agents and maintainers should read WORKFLOW.md and WORKFLOW.local.md first. They define the public-safe branch/PR lifecycle, francisco-boards usage, validation gates, and release discipline for this repo (S2J, base branch master). The rest of this file explains how agents should use sql2json as a CLI/library.

sql2json runs SQL queries via SQLAlchemy and outputs JSON or CSV to stdout. It is invoked as a CLI tool or imported as a Python package — no framework coupling, no MCP server required.

Invocation: examples below use the sql2json command, available since v0.2.1. On 0.2.0 and earlier — or when the package's scripts directory is not on PATH — substitute the equivalent python -m sql2json ... form (on Windows, py -m sql2json ...).


Install & upgrade (for agents)

Install sql2json as an isolated tool, with the database drivers bundled so queries against PostgreSQL/MySQL work without a follow-up step:

uv tool install "sql2json[postgres,mysql]"
# or
pipx install "sql2json[postgres,mysql]"

Why these methods matter in a sandbox:

  • They work on externally-managed environments (Manjaro/Arch, Debian 12+, Ubuntu 23.04+, Homebrew Python), where a plain pip install is refused with error: externally-managed-environment (PEP 668).
  • They expose sql2json on PATH (in ~/.local/bin; run pipx ensurepath if it is missing) without mutating any project environment.

Quote the extras. In bash/zsh the brackets are glob characters, so the spec must be quoted — "sql2json[postgres,mysql]" — or the shell expands it and the install fails before the installer runs. In PowerShell use single quotes: 'sql2json[postgres,mysql]'.

Selecting drivers: [postgres] (psycopg2) or [mysql] (pymysql) for a single database; bare sql2json is SQLite only — connecting to Postgres/MySQL without the extras raises ModuleNotFoundError: psycopg2 / pymysql. For other databases (e.g. MS SQL Server's pyodbc), install the driver alongside: uv tool install "sql2json" --with pyodbc.

Read the full file on GitHub · 349 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 349 lines · 3,721 tokens per session scan A 760d3eacd059

Subscribe to this mod's changes

sql2json AGENTS.md is an instructions file published in the GitHub repository fsistemas/sql2json (55 stars, last pushed 2mo ago), licensed MIT. It adds 3,721 tokens to every session, about $0.0186 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.