neuron-explorer
Qwen3.5‑4B 전용 조향형 뉴런 탐색기, 모든 MLP 뉴런을 밀어 결과를 보관·탐색
AskDB는 오픈소스 NL‑to‑SQL 도구로, LLM이 검증된 스키마 기반 SQL을 생성하고 앱이 검토·실행합니다
AskDB is an open-source NL-to-SQL toolkit for developers. Your LLM generates checked, schema-grounded SQL; your app reviews and runs it.
개발 도구TypeScript · MDXGitHub @Ygilany온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기Open-source NL-to-SQL toolkit for developers. Your LLM generates schema-grounded SQL; your app runs it.
저장소 README에서 가져옴
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
AskDB is an open-source NL-to-SQL toolkit for developers: it uses your LLM to generate checked, schema-grounded SQL, then hands it back to your app to review and run. BYO model, BYO database, BYO vector store.
AskDB grounds generation in a human-enriched schema artifact, and it keeps database execution, permissions, tenant policy, and audit logging inside the host application. Library, CLI, Studio, and HTTP surfaces share the same core pipeline.
Ask your data. Keep control of the query.README 전문 보기 ↗AskDB is an open-source NL-to-SQL toolkit for developers: it uses your LLM to generate checked, schema-grounded SQL, then hands it back to your app to review and run. BYO model, BYO database, BYO vector store.
AskDB grounds generation in a human-enriched schema artifact, and it keeps database execution, permissions, tenant policy, and audit logging inside the host application. Library, CLI, Studio, and HTTP surfaces share the same core pipeline.
Ask your data. Keep control of the query.
Status: pre-release beta. Every published package ships
-beta.Nprerelease versions on npm: theaskdbCLI,@askdb/core,@askdb/config,@askdb/client,@askdb/http-api, and the@askdb/ai-*adapters are on the1.0.0-betaline, and the other packages are0.xbetas. The core API (ask()), schema artifact, and config are documented, but public APIs may still change before 1.0 — Studio and RAG are the most likely to move.AskDB returns SQL for review; the library, CLI, and HTTP API never execute it (Studio's optional Playground Execute is a local development tool). AskDB's SQL checks are heuristic defense in depth, not a security boundary. Run generated SQL under a read-only, least-privilege database role. See Run generated SQL safely.
NL-to-SQL isn't a new problem — academic research goes back to LUNAR in 1972, and LLM-based generation has been studied since Codex in 2021. The hard part in production isn't the LLM call. It's everything around it: capturing the business context behind your schema, getting the right enrichment into the prompt, wiring up RAG when the schema is too big to fit, and repeating that work for every new project. AskDB is the toolkit for that part.
For a new project, use Node 22.14+, a database or schema source, and an API key from your model provider.
npx askdb@latest init
# create .env with the model/database keys referenced by askdb.config.ts
npx askdb@latest introspect --url "$DATABASE_URL" --out my-app.schema --schema-id my-app
npx askdb@latest ask --schema my-app.schema --question "Which tables look active?"
Use npx askdb@latest studio --schema my-app.schema when you want the local browser UI for schema enrichment and sample NL-to-SQL checks.
AskDB uses a schema artifact: either a directory such as my-app.schema/, a bundled JSON file, or a direct schema.json. To create that artifact from a real database, use introspection:
npx askdb@latest introspect --url "$DATABASE_URL" --out my-app.schema --schema-id my-app
npx askdb@latest ask --schema my-app.schema --question "Which tables look active?"
The detailed first-run paths live in the docs-site quickstart, packages/introspect/README.md, and docs/integration/installable-package.md.
# `ai` (Vercel AI SDK 6 or 7) is a required peer dependency — your app owns its version
pnpm add @askdb/core ai
pnpm add @askdb/postgres
# Example provider for the code below
pnpm add @ai-sdk/openai
pg is optional and only needed for live Postgres introspection through @askdb/postgres.
import { ask, loadSchema } from "@askdb/core";
import { postgresDialect } from "@askdb/postgres";
import { createOpenAI } from "@ai-sdk/openai";
const schema = loadSchema("./my-app.schema");
const openai = createOpenAI({ apiKey: process.env.OPENAI_API_KEY });
const { sql } = await ask({
question: "How many users signed up last week?",
schema,
model: openai("gpt-4o-mini"),
dialect: postgresDialect,
});
Per-provider model recipes (OpenAI, Azure OpenAI / Foundry, Google Gemini, and Anthropic) and introspection recipes live in docs/integration/installable-package.md.
Product direction and technical baseline live in docs/:
docs/mission.md — north star, principles, non-goalsdocs/architecture.md — package boundaries, diagrams, install profiles, connectors vs. optional peersdocs/platform.md — languages, monorepo shape, Postgres-firstdocs/roadmap.md — phased implementation orderdocs/specs/ — per-feature specs with status (core pipeline, schema format, modes and observability, introspection, RAG, Studio, HTTP API, multi-tenancy, distribution)docs/contracts/modes-v1.md — operating modes (schema_only, bounded_results)docs/contracts/sensitive-fields-and-modes.md — sensitive schema markers vs. models, bounded summariesdocs/integration/reuse-core-phase-3.md — stable @askdb/core entrypoints for wrappers (MCP/HTTP)docs/integration/installable-package.md — install + BYO model + introspection workflow recipesdocs/specs/introspection.md — schema introspection specStack: pnpm workspace + Turborepo, TypeScript, and focused packages/apps:
packages/core (@askdb/core) — dialect-agnostic NL→SQL pipeline (ask()) and schema artifact loader.packages/ai (@askdb/ai) — AI provider registry and shared config helpers for AI SDK language and embedding models.packages/ai-openai (@askdb/ai-openai) — OpenAI provider adapter for @askdb/ai.packages/ai-azure (@askdb/ai-azure) — Azure OpenAI / Foundry provider adapter for @askdb/ai.packages/ai-google (@askdb/ai-google) — Google Gemini provider adapter for @askdb/ai.packages/ai-anthropic (@askdb/ai-anthropic) — Anthropic Claude provider adapter for @askdb/ai.packages/client (@askdb/client) — config-aware facade (createAskDb) that resolves schema, model, and dialect from config.packages/config (@askdb/config) — defineConfig, env(), and askdb.config.* discovery/bootstrap.packages/connectors (@askdb/connectors) — deprecated re-export of the connector registry (now in ).pnpm install
pnpm build # turbo run build — builds the `askdb` binary used below
# The repo root already ships askdb.config.ts. Optionally create .env with the keys it references
# (e.g. OPENAI_API_KEY), or set ASKDB_MOCK_SQL to skip live model calls.
pnpm exec askdb ask \
--schema fixtures/schemas/orders-users.schema \
--question "How many orders are there?"
pnpm test # turbo run test (integration runs when DATABASE_URL is set)
pnpm lint # turbo run lint (TypeScript noEmit)
Before opening or updating a PR, run the release-style checks:
pnpm smoke:install
pnpm preflight
Public release steps are tracked in docs/release.md.
Multi-engine dev fixture — the same logical schema and data in PostgreSQL, MySQL, MariaDB, SQL Server and SQLite (fixtures/multi-engine/README.md):
pnpm fixture:up # start the containers, wait for health, seed (idempotent)
pnpm fixture:down # stop the containers (keeps volumes)
pnpm fixture:reset # delete volumes and the SQLite file, then fixture:up
Then point AskDB at one of them, for example:
npx askdb introspect --engine postgres --schemas org,people,billing,ref \
--url "postgres://fixture_reader:[email protected]:15432/askdb_fixture"
Schema artifacts — see docs/contracts/schema-v2.md, fixtures/schemas/README.md, and the sample fixtures/schemas/orders-users.schema/. A schema artifact can be hand-authored, bundled as JSON, or produced from Postgres with @askdb/introspect. Optional sensitive markers tag columns/tables in NL→SQL DDL by default ((sensitive)); use --omit-sensitive-from-prompt or ASKDB_OMIT_SENSITIVE_FROM_PROMPT to withhold names instead. Policy for modes and summaries is in docs/contracts/sensitive-fields-and-modes.md.
Environment variables
See .env.example for a copy/paste template. Keep real secrets in a local .env (gitignored); the CLI loads .env automatically and then reads process.env.
| Variable | Purpose |
|---|---|
OPENAI_API_KEY | Required for NL→SQL (BYO; OpenAI-compatible). |
OPENAI_BASE_URL | Optional custom base URL for OpenAI-compatible APIs. |
ASKDB_MODEL or OPENAI_MODEL | Optional model id (default gpt-4o-mini). |
DATABASE_URL | Optional; commonly passed to askdb introspect --url for live Postgres introspection. |
ASKDB_LOG_LEVEL | Optional structured log level: trace | debug | info | warn | error | fatal | silent (default: silent unless --verbose, --log-file, or --log-stdout implies info). |
ASKDB_CORRELATION_ID | Optional; override the correlation id emitted on every JSON log line for the run. |
ASKDB_MODE | Optional operating mode (schema_only | bounded_results); default schema_only. Formal contract: docs/contracts/modes-v1.md. |
ASKDB_OMIT_SENSITIVE_FROM_PROMPT | When true/1/yes, omit sensitive column/table names from NL→SQL DDL (default is to include names, tagged (sensitive)). See docs/contracts/sensitive-fields-and-modes.md. |
Structured logging (Phase 2) — JSON lines via Pino; diagnostics go to stderr by default so stdout stays free for SQL. Flags:
| Flag | Purpose |
|---|---|
-v / --verbose | Sets log level to info (stderr). |
--log-level <level> | Explicit level (overrides ASKDB_LOG_LEVEL). |
--log-file <path> | Append the same JSON logs to a file (sync writes; parent dirs created). Implies info if level was silent. |
--log-stdout | Mirror structured logs to stdout. Implies info if level was silent. |
--correlation-id <id> | Override correlation id (else random UUID per run). |
--explain | After -- sql --, print -- explain -- plus JSON describing heuristic guardrails satisfied (statementKind, checksVerified, remediationNote). |
--omit-sensitive-from-prompt | Omit sensitive identifiers from NL→SQL DDL (default: include names with (sensitive) tag). Overrides default when combined with ASKDB_OMIT_SENSITIVE_FROM_PROMPT. |
--mode <id> | Operating mode: schema_only (default) or bounded_results. Current AskDB surfaces return SQL only. |
Modes + structured logs (Phase 2) — same ask subcommand; pass --mode or set ASKDB_MODE. Use -v / --log-file so JSON events, including askdb.pipeline.mode, appear on stderr or in a file — see docs/contracts/modes-v1.md.
pnpm build
# Generate only — logs on stderr include askdb.pipeline.mode (default schema_only unless you pass --mode)
pnpm exec askdb ask \
--schema fixtures/schemas/orders-users.schema \
--question "How many orders?" \
--mode schema_only \
-v
CLI example (generate SQL only):
pnpm build
pnpm exec askdb ask \
--schema fixtures/schemas/orders-users.schema \
--question "How many orders are there?"
AskDB returns SQL for review; it does not execute generated SQL. Treat generated SQL as untrusted: approve it and run it under your own least-privilege, read-only database roles, database-enforced tenant isolation (for example Postgres row-level security), statement timeouts, and audit logging. See Run generated SQL safely and SECURITY.md.
Engines: PostgreSQL, MySQL, SQLite, and SQL Server are all first-class — install the matching @askdb/postgres, @askdb/mysql, @askdb/sqlite, or @askdb/sqlserver adapter and pass the dialect to ask(). Postgres is the reference dialect; the others ship dialect and introspection with parity tracked on the roadmap.
Current limitations (pre-1.0 / dev): AskDB returns SQL only (execution stays in your app); SQL guardrails are heuristic (not a full SQL parser); a first-party MCP server, richer report generation, and a hosted dashboard are roadmap work. Per-feature scope and status: docs/specs/.
CI: .github/workflows/ci.yml runs pnpm install --frozen-lockfile, pnpm build, starts the multi-engine fixture, runs pnpm test, runs the installable smoke test, and validates publish with a dry run.
SELECT statements, stacked statements, write keywords, missing tenant columns, sensitive columns).ask(); AskDB prompts the model to filter by tenant, binds your tenant IDs into the SQL, and runs a heuristic check that each scoped table has a tenant predicate that filters (its tenant column compared with the tenant placeholder, ANDed into the filter). Enforce tenant isolation in the database as the primary boundary.docs/contracts/sensitive-fields-and-modes.md); RAG paths remain policy-controlled by mode/host.How much of the schema context the model sees depends on the chosen mode:
Engine v1 (CLI @askdb/core): selectable modes schema_only and bounded_results are documented in docs/contracts/modes-v1.md. Current AskDB surfaces still return SQL only.
Phases 1–10 are implemented on this branch: core, CLI, HTTP API, installable package seams, schema artifact format, Postgres introspection, schema enrichment, RAG indexing and retrieval, Studio (React browser UI), and multi-tenancy proof. Later phases are in docs/roadmap.md.
Apache-2.0 © Yahya Gilany. See LICENSE and NOTICE.
docs/specs/core-pipeline.mddocs/adrs/0001-structured-logging-pino.mdaskdb.config bootstrap: docs/adrs/0005-askdb-config-and-env-bootstrap.md@askdb/introspectpackages/introspect (@askdb/introspect) — connector contract, connector registry, @askdb/introspect/kit engine helpers, Schema v2 renderer.packages/postgres (@askdb/postgres) — Postgres dialect, introspection connector, catalog templates, and pg-backed runner.packages/mysql (@askdb/mysql) — MySQL introspection connector and mysql2-backed catalog runner.packages/sqlite (@askdb/sqlite) — SQLite introspection connector and better-sqlite3-backed catalog runner.packages/sqlserver (@askdb/sqlserver) — SQL Server introspection connector and mssql-backed catalog runner.packages/prisma (@askdb/prisma) — schema-file introspection connector for Prisma schemas.packages/rag (@askdb/rag) — schema artifact chunking, BYO embedder + vector store, and retrieval for ask().packages/enrich (@askdb/enrich) — schema artifact enrichment workspace helpers used by Studio.apps/cli (askdb) — binary askdb: init, introspect, ask, studio, bundle.apps/http-api — HTTP wrapper over core.apps/studio — local browser UI for enrichment and sample NL-to-SQL checks.