neuron-explorer
Qwen3.5‑4B 전용 조향형 뉴런 탐색기, 모든 MLP 뉴런을 밀어 결과를 보관·탐색
경량 자바 프레임워크로 효율적·확장 가능한 애플리케이션 구축, CLI와 API 모두 지원해 손쉽게 견고한 솔루션 구현
A lightweight java framework designed for building efficient and scalable applications. Supports both command-line tools and APIs, enabling developers to create robust solutions with ease.
개발 도구Java · ShellGitHub @tinystruct온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기An AI database agent for the terminal, built on the tinystruct Java framework. You ask questions in plain English, such as "show me the ten newest orders" or "how many users signed up this week?". The agent works out the SQL, runs it against your database, and shows the results.
저장소 README에서 가져옴
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
SmartDBA is an AI database agent built on the tinystruct framework (1.7.35). Ask questions in plain English ("show me the ten newest orders"); the agent works out the SQL, runs it through a set of MCP database tools, and shows the results as formatted tables in your terminal.README 전문 보기 ↗SmartDBA is an AI database agent built on the tinystruct framework (1.7.36). Ask questions in plain English ("show me the ten newest orders"); the agent works out the SQL, runs it through a set of MCP database tools, and shows the results as formatted tables in your terminal.
gemini-3.5-flash-lite).chat action is available over HTTP, with token-by-token updates pushed over Server-Sent Events..agent_history.json; an optional skill file adds extra guidance for the model.The model's output is treated as untrusted input.
db/insert, db/update and db/delete (the typesafe.routing.confirm-actions list), file writes and shell commands all ask [y/N] in the terminal.db/execute runs without a prompt only when the statement is provably read-only (no stacked statements, comments, or write keywords, so WITH ... DELETE is caught). Anything else needs approval. If a TypeSafe key is configured, the JEV model gives an extra opinion on read-only SQL.chat action) there is nobody to approve, so writes, shell commands and modifying tool calls are refused.read and write actions only touch files inside the workspace (agent.workspace, default: the working directory). application.properties and .agent_history.json are blocked, as are paths that escape via .. or symlinks.db/update and db/delete require a WHERE clause, which must be a plain predicate: no subqueries, UNION, DML/DDL, comments, stacked statements or always-true conditions. The clause is still spliced into the SQL text, so treat approval as the real safeguard.Use a database account with only the privileges you are comfortable giving the agent.
mvnw)An embedded H2 database is configured by default, so you only need an API key.
git clone https://github.com/tinystruct/tinystruct-smart-dba.git
cd tinystruct-smart-dba
./mvnw package -DskipTests # builds and copies dependencies into lib/
Set your Gemini key (the sample config reads it from the GEMINI_API_KEY environment variable, so nothing needs editing):
export GEMINI_API_KEY=your-key # Linux / macOS
$env:GEMINI_API_KEY = "your-key" # Windows PowerShell
Run it from the project root:
bin/dispatcher chat # Linux / macOS
bin\dispatcher.cmd chat # Windows
Then try: create a table of books with title and author, add three rows, and show them. Writes will ask for your approval.
Chinese and other non-ASCII text work out of the box: the launch scripts switch the console and the JVM to UTF-8 (chcp 65001 on Windows, -Dfile.encoding=UTF-8). If you start the app another way, for example from an IDE, add -Dfile.encoding=UTF-8 to the JVM options. For a legible console font on Windows, use Windows Terminal.
Everything lives in src/main/resources/application.properties. A value written as $_NAME is read from the environment variable NAME.
# LLM
agent.api_key=$_GEMINI_API_KEY # or paste the key directly
agent.model=gemini-3.5-flash-lite
# agent.api_url=... # OpenAI-compatible endpoint; defaults to Gemini
# agent.workspace=. # root for the agent's file access
# agent.skill_file=path/to/SKILL.md # extra guidance for the model (empty by default)
# Database (sample default: embedded H2 in your home directory)
driver=org.h2.Driver
database.url=jdbc:h2:~/test
database.user=
database.password=
# Internal MCP server. Change the token from the sample value.
mcp.server.url=http://localhost:8080/
mcp.auth.token=123456
Using your own database: put its JDBC driver in pom.xml (H2 and PostgreSQL are already there; sqlite-jdbc, MySQL and others work the same way), run ./mvnw package -DskipTests again, and update driver, database.url, database.user and database.password. For example, MySQL:
driver=com.mysql.cj.jdbc.Driver
database.url=jdbc:mysql://localhost:3306/your_db
database.user=root
database.password=secret
PostgreSQL (the driver is bundled, so no pom.xml change is needed):
driver=org.postgresql.Driver
database.url=jdbc:postgresql://localhost:5432/your_db
database.user=postgres
database.password=secret
SmartDBA works in the connection's current schema (public by default; add ?currentSchema=myschema to the URL to change it). Table names are matched case-insensitively, and the agent is told PostgreSQL's rules for lower-case folding, reserved words and SERIAL keys.
To use an OpenAI-compatible API, set agent.api_url (for example https://api.openai.com/v1/chat/completions), agent.model and agent.api_key.
typesafe.routing.confirm-actions=db/insert,db/update,db/delete
typesafe.api-key=$_TYPESAFE_API_KEY
typesafe.routing.confirm-actions is the list of tools that always ask for approval. Add db/execute or any other tool to be stricter; removing entries is not recommended.typesafe.api-key (environment variable TYPESAFE_API_KEY) is optional. With it, a TypeSafe JEV model also reviews read-only db/execute SQL as a second opinion. Without it, SmartDBA relies on its built-in read-only check, so everything works either way.typesafe.* keys in the sample file (endpoint, model, confidence thresholds, cache, workflow) belong to the TypeSafe integration and can be left at their defaults.logging.enabled=FALSE is the default, which hides framework warnings and errors. Set it to TRUE when something misbehaves and the terminal shows nothing useful.
The embedded HTTP/MCP server starts on tinystruct's default port, 8080, and mcp.server.url must point at it. The agent starts it itself, so you do not run a separate server.
bin/dispatcher chat
Type a request such as "Show me the top 5 users created this month". Other commands: clear resets the history, exit or quit leaves.
bin/dispatcher chat --message "List all tables"
Prints the answer and exits. Single messages cannot ask for approval, so they are limited to read-only actions. Use the interactive session for anything that modifies data.
With the app running, the same chat action is reachable through tinystruct's HTTP server on port 8080, and streamed tokens are pushed over SSE. HTTP requests are read-only for the same reason.
| Symptom | Fix |
|---|---|
API key not configured | Set GEMINI_API_KEY (or agent.api_key) in the same shell you run the dispatcher from. |
API returned status 400 ... API key not valid | The key is wrong or for a different API; check agent.model and agent.api_url too. |
ClassNotFoundException: org.tinystruct.system.Dispatcher | Run ./mvnw package -DskipTests first so lib/ is populated, and run the dispatcher from the project root. On Windows use bin\dispatcher.cmd, not the bash script. |
Driver or database.url errors | Make sure the JDBC driver is in pom.xml and lib/. |
| Port 8080 already in use | Set server.port in application.properties and update mcp.server.url to match. |
| Tool | Purpose |
|---|---|
db/list-tables | List tables and views |
db/describe | Columns, types, keys of a table |
db/query | Select rows with optional WHERE and LIMIT (max 1000) |
db/insert | Insert a row (parameterized) |
db/update | Update rows (WHERE required) |
db/delete | Delete rows (WHERE required) |
db/execute | Raw SQL for JOINs, CTEs, DDL |
SmartDBA.java: chat loop, LLM streaming, Markdown renderer, approval logic.SmartDBAServer.java: MCP server that registers the database tools.tools/DatabaseTool.java: the MCP database tools, SQL classifier and WHERE validation../mvnw test
Apache License 2.0. See LICENSE.