⚡ OptiSQL — VS Code ExtensionSQL performance-tuning AI agent, directly in your editor. Paste a slow SQL query, and OptiSQL diagnoses the bottleneck, applies a fix on a copy of the database, and proves the speed-up with real before/after timings — then explains it in plain English.
Features
Repository & language metadata
Requirements
InstallOption A — from the VS Code Marketplace (Microsoft)
Option B — from the Open VSX marketplace
Option C — from a
|
| Setting | Default | Description |
|---|---|---|
optisql.backend |
direct |
Agent backend: direct (Anthropic API) or langchain. |
optisql.defaultQuery |
SELECT * FROM orders WHERE customer_id = 12345; |
Query the panel pre-fills. |
optisql.rows |
100000 |
Orders to generate for the demo DB. |
Safety & integrity
- The agent is read-only: it can never
DROP/DELETE/UPDATE/INSERT/ALTERon your real data. - The single write action (
create_index) operates on a copy of the database. - The agent loop has a hard iteration cap.
- Signed build integrity. Every build ships an Ed25519-signed manifest
(
agent/integrity.json) covering the bundled Python agent files. On activation the extension re-hashes those files and verifies the signature against the publisher's pinned public key. If any file was changed, or the whole build was re-signed by someone other than the publisher (an impersonated or repackaged copy), the extension refuses to run the agent and explains exactly why. This makes tampering or a spoofed extension detectable and provable — not blocked by the marketplace alone.
Build from source
cd vscode-extension
npm install
npm run compile # tsc -p ./
# Sign the bundled agent runtime with your Ed25519 private key, then package.
# Set OPTISQL_SIGNING_KEY (or pass --key path/to/private.pem) to sign.
npm run package # sign + vsce package -> optisql-tuner-0.1.4.vsix
The signing key is yours to keep. Run
node scripts/sign-agent.mjs --key your-private.pem(or setOPTISQL_SIGNING_KEY) before packaging. The private key is never committed or shipped — only the public key is pinned insrc/integrity.ts. If you don't sign, the extension still builds but will report "unsigned" on activation and refuse to run the agent.
Repository layout
vscode-extension/
├── package.json # manifest: commands, panel, Copilot participant + tool
├── tsconfig.json
├── src/ # TypeScript extension source
│ ├── extension.ts # activate() wiring + commands
│ ├── pythonEnv.ts # first-run venv bootstrap
│ ├── agent.ts # spawns the Python agent, streams output
│ ├── panel.ts # webview UI
│ ├── copilot.ts # /optisql slash command + language model tool
│ └── secrets.ts # API key storage
└── agent/ # bundled Python runtime (the OptiSQL agent)
├── agent.py
├── tools.py
├── db.py
├── make_data.py
└── requirements.txt
License
MIT