agentleFS
MicrosoftKnown publishermicrosoft/sqlsimtools/sqlsim/AGENTS.md

sqlsimtools / sqlsim

AGENTS.md42 starsChanged 32 days agoMITView on GitHub

This file tells coding agents (GitHub Copilot, Claude Code, Cursor, Aider, Codex CLI, etc.) how to invoke sqlsim when a user asks them to run SQL workloads. It is shipped at the root of the sqlsim release package so any agent operating in the user's project picks it up automatically. A companion VS Code skill descriptor lives at ../.github/skills/sqlsim/SKILL.md and is discovered automatically by skill-aware agents. sqlsim is a single-binary SQL workload simulator for SQL Server, Azure SQL Database, Azure…

The file

We split this AGENTS.md into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    USE: when the user wants to:

    line 21
  2. Very specific:

    Run T-SQL ad-hoc or from a .sql file against SQL Server / Azure SQL

    line 22
  3. Distinctive:

    After extracting the release archive into your project root:

    line 35
  4. Very specific:

    Scale concurrency safely: Start with a small -n value, increase it gradually, and monitor client and server CPU, memory, network, and …

    line 183

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md — sqlsim

This file tells coding agents (GitHub Copilot, Claude Code, Cursor, Aider, Codex CLI, etc.) how to invoke sqlsim when a user asks them to run SQL workloads. It is shipped at the root of the sqlsim release package so any agent operating in the user's project picks it up automatically.

A companion VS Code skill descriptor lives at ../.github/skills/sqlsim/SKILL.md and is discovered automatically by skill-aware agents.

What sqlsim is

sqlsim is a single-binary SQL workload simulator for SQL Server, Azure SQL Database, Azure SQL Managed Instance, and SQL database in Microsoft Fabric. It supports Windows x64/ARM64 and Ubuntu x64, multi-threaded execution, and JSON output for automation.

When to invoke sqlsim

USE when the user wants to:

  • Run T-SQL ad-hoc or from a .sql file against SQL Server / Azure SQL
  • Stress / load test with N threads × R iterations
  • Measure connection, login, query, and fetch timings
  • Produce JSON metrics for an automation pipeline
  • Capture per-query statistics (-querystats)

DO NOT use for:

  • Non-SQL Server engines (MySQL, PostgreSQL, Oracle, etc.)
  • Schema generation or data loading (sqlsim runs queries; it does not generate schemas)

Binary location

After extracting the release archive into your project root:

your-project/
├── .github/skills/sqlsim/SKILL.md
└── sqlsim/
   ├── x64/sqlsim.exe   # Windows x64, or x64/sqlsim on Ubuntu
   ├── ARM64/sqlsim.exe # Windows ARM64
   ├── AGENTS.md        # this file
   ├── LICENSE          # MIT license
   ├── sqlsim.md        # full user manual
   └── examples/        # sample .sql, .ps1, workload JSON

From the project root, default to .\sqlsim\x64\sqlsim.exe on Windows unless the user specifies ARM64. On Ubuntu, use ./sqlsim/x64/sqlsim.

Command shape

sqlsim.exe -S <server> <auth> [-d <database>] [-Q <query> | -i <file>] `
           [-n <threads>] [-r <iterations>] [-q|-v] `
           [-stream-json] [-json [-o <file>]]
./sqlsim/x64/sqlsim -S <server> <auth> [-d <database>] [-Q <query> | -i <file>] \
             [-n <threads>] [-r <iterations>] [-q|-v] \
             [-stream-json] [-json [-o <file>]]

Authentication — one is REQUIRED, every time

FlagUse case
-EWindows SSPI or Linux Kerberos integrated authentication
-AMicrosoft Entra interactive (Windows only)
-A ActiveDirectoryIntegratedEntra integrated (Kerberos ticket required on Linux)
-A ActiveDirectoryMsiManaged Identity (Azure VM / App Service)
-A ActiveDirectoryServicePrincipal -U <client_id> -P <secret>Service principal
-T <token>Access token — preferred for repeated Azure runs
-U <user> -P <pwd>SQL Authentication

For applications and automation, use -T - or -P - with redirected stdin so the secret does not appear in the process command line.

On Linux, never use bare -A: Driver 18 interactive authentication is Windows-only. Prefer token auth (-T) for interactive Azure SQL work. -E requires a valid Kerberos ticket on Linux and does not fall back to NTLM.

For Azure SQL, ask the user once whether to use token auth (-T) to avoid interactive popups on repeated Windows runs and to support Linux. If yes:

$token = az account get-access-token --resource https://database.windows.net --query accessToken -o tsv
$token | .\sqlsim\x64\sqlsim.exe -S myserver.database.windows.net -d mydb -T - -Q "SELECT 1"

Certificate validation

sqlsim follows the sqlcmd (Go) rule: with neither -N nor -C the server certificate is not validated, -N without -C requires validation, and -C bypasses it. This applies to every authentication mode including -T.

For Azure SQL, prefer -N m (or -N s on SQL Server 2022 and later), since Azure presents a certificate from a trusted authority and the connection crosses the internet. Reach for -C only against a server with a self-signed certificate, and prefer -F <hostname> when the name you connect to differs from the name on the certificate.

Common parameters

ParameterDescription
-S <server>Server (localhost, FQDN, server\instance)
-d <database>Database name (REQUIRED for Azure SQL)
-Q <query>Inline query (supports GO batch separator)
-i <file>Path to a .sql file
-n <threads>Concurrent threads (default 1)
-r <iterations>Iterations per thread (default 1)
-qQuiet — suppress result sets (use for load tests)
-vVerbose — detailed timing
-jsonFinal JSON document output
-stream-jsonLive NDJSON started/progress/completed events
-o <file>Write output to file
-querystatsPer-query stats (CPU, logical reads, etc.)
-querystats-interval <sec>Snapshot query stats to a file while running (implies -querystats)
-querystats-file <file>Snapshot path (default querystats-live.json)
-workload <file>Mixed-workload JSON config
-stoponerrorStop all threads on first error
-reconnectNew connection per iteration
-t <sec>Query timeout (default 30)
-l <sec>Login timeout (default 15)

Canonical patterns

# 1. Smoke — local SQL Server, Windows Auth
.\sqlsim\x64\sqlsim.exe -S localhost -E -Q "SELECT @@VERSION"

# 2. Run a SQL file
.\sqlsim\x64\sqlsim.exe -S localhost -d AdventureWorks -E -i .\queries.sql

# 3. Load test — 10 threads × 100 iterations, suppress rows
.\sqlsim\x64\sqlsim.exe -S localhost -d testdb -E -i .\workload.sql -n 10 -r 100 -q

# 4. Azure SQL with token (no interactive popup)
$token = az account get-access-token --resource https://database.windows.net --query accessToken -o tsv
$token | .\sqlsim\x64\sqlsim.exe -S myserver.database.windows.net -d mydb -T - -Q "SELECT 1"

# 5. JSON output for automation
.\sqlsim\x64\sqlsim.exe -S localhost -E -i .\workload.sql -n 4 -r 50 -json -o results.json
$r = Get-Content results.json | ConvertFrom-Json

# 6. Per-query statistics
.\sqlsim\x64\sqlsim.exe -S localhost -d testdb -E -i .\queries.sql -querystats -json -o stats.json

# 7. Live NDJSON progress
.\sqlsim\x64\sqlsim.exe -S localhost -E -i .\workload.sql -n 4 -r 50 -stream-json

# 8. Live progress plus canonical final JSON
.\sqlsim\x64\sqlsim.exe -S localhost -E -i .\workload.sql -n 4 -r 50 `
  -stream-json -json -o final-results.json

Output contract

  • Text output (default): per-batch timing + summary.
  • -json: structured JSON — always parse with ConvertFrom-Json (PowerShell) or json.loads() (Python), never by hand. Top-level keys include summary, batches, and (when -querystats) querystats.
  • -stream-json: one JSON object per line for live monitoring. Parse each line independently; it is not a single JSON document. Combine it with -json -o <file> to keep NDJSON on stdout and write the canonical final JSON document to the file. Combined mode requires -o.
  • -querystats-interval: a snapshot file replaced atomically on each tick, so it is always safe to read while the run is in progress. A write failure never fails the run and is reported once on stderr, but that message is suppressed in -json and -stream-json modes; check that the file exists rather than relying on a message or the exit code.
  • Exit code is non-zero on any failure; honor it in scripts.

Authoring rules for agents

  1. Always include an auth flag. sqlsim has no default auth mode.
  2. For Azure SQL, always include -d <database>. Required by the service.
  3. Do not add -v unless the user asked for detail. It generates a lot of output that's rarely needed.
  4. Use -q for load tests. Result sets in stress tests just consume I/O.
  5. Scale concurrency safely. Start with a small -n value, increase it gradually, and monitor client and server CPU, memory, network, and connection usage. High thread counts can exhaust client resources and invalidate results; use a dedicated client for significant load tests.
  6. Prefer -i <file> for anything multi-statement. Inline -Q is fine for one-liners; use a file when there are multiple GO batches.
  7. Do not invent flags. sqlsim uses short flags. There is no --server / --query / --threads. The only long flag is --help.
  8. Do not pipe through 2>&1 or Select-String. Capture into a variable if you need to parse: $out = & .\sqlsim\x64\sqlsim.exe ....

Help

.\sqlsim\x64\sqlsim.exe --help

Full manual: sqlsim.md (also rendered as sqlsim.html). Examples: examples/.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.