Borrowing it
Nothing to install: this file belongs to mr-mihu/dsh-dbhub-live. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/mr-mihu/dsh-dbhub-live/main/AGENTS.mdgit clone --depth 1 https://github.com/mr-mihu/dsh-dbhub-liveWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/mr-mihu/dsh-dbhub-live/agents-md)<a href="https://agentmods.dev/instructions/mr-mihu/dsh-dbhub-live/agents-md"><img src="https://agentmods.dev/badge/instructions/mr-mihu/dsh-dbhub-live/agents-md.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.04626 | $0.04626 |
| Opus 5 | $0.02313 | $0.02313 |
| Sonnet 5 | $0.00925 | $0.00925 |
| Haiku 4.5 | $0.00463 | $0.00463 |
Grade A, and why
dsh-dbhub-live 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 2d ago.
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.
How it starts
The opening of the file, as written. The whole thing — 115 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md — dsh-dbhub-live 开发与调试说明
本文件面向在本仓库上继续开发/调试本插件的 AI 与人。业务需求见 doc/REQUIREMENTS.md,用户安装使用见 README.md。
一句话定位
DSH host 插件(Node ESM)+ Web client 插件(浏览器半):把 dbhub(Bytebase 的数据库 MCP 服务器)接入 DSH。零知识凭据管理 + 一次性进程执行——DSN/密码只存在于宿主侧,模型只见 source 句柄与元数据(类型/主机/端口/库);每次工具调用 spawn 一条独立 dbhub --dsn 进程跑完即杀,无常驻服务。附设置在「设置 → 插件」里的实时状态卡片与启用/禁用开关。
目录结构
lib/
index.mjs 入口:name/inject/apply、状态命名空间(schemastery)接线、后台启动(仅登记+更新检查)、配置变更应用
config.mjs 路径/原子持久化(store,runtime)/DSN 解析/工作区发现/零知识助手(describeConn,connLabel,scrubSecrets)/小工具
state.mjs 运行时状态机:enabled/phase/toolCount/lastError/mode + 订阅发布(无服务器生命周期)
options.mjs 可配置参数:updateIntervalDays(设置UI > 环境默认;dbhubPackage 仅内部环境knob)
runtime.mjs dbhub 可执行文件发现、按需自动安装、定期自动更新(已删除孤儿进程清理)
mcp.mjs MCP JSON-RPC 客户端 + 工具注册表 + 工作区×环境来源发现(collectSources/resolveSource)+ 摘要缓存
adhoc.mjs 唯一执行引擎:每次调用一条一次性 dbhub 进程(零知识标签 + stderr 清洗)
collect.mjs 授权扫描项目配置文件并提取 DSN 候选(含 askUser 桥接)
tools.mjs host 自有工具定义与注册:恒定 4 个(configure/list_sources/execute_sql/search_objects)
client.js Web 半(手写 lazy-CJS bundle):折叠分区卡片(状态/配置/工作区连接)
test/ node:test 单元测试(纯逻辑 + client bundle 格式契约 + 零知识泄漏门)
doc/ 需求文档
cordis.patch.yml bundle patch:`name: dsh-dbhub-live` 挂载本包
关键架构事实
- 模块依赖只进不出(防环):
config ← state ← mcp;config ← runtime ← adhoc;mcp ← tools ← index;adhoc ← tools;collect ← tools。禁止反向或循环 import(HMR/装载顺序依赖它)。零知识助手(describeConn/connLabel/scrubSecrets)在config.mjs,任何模块不得把裸 DSN 直接拼进用户可见文本。 - 无常驻 dbhub 服务器:
dbhub_execute_sql/dbhub_search_objects在调用时把source经resolveSource解成真实 DSN(宿主侧),然后走runAdhoc(dbhub --transport stdio --dsn <dsn>一次性进程,跑完 terminate)。没有 toml/指纹/mtime 监听/空闲回收/respawn/孤儿清理/配置变更重启。执行天然并发(进程级隔离)、故障隔离(一条进程挂只坏它自己)、多实例安全(无共享端口/无共享 toml/无跨实例误杀)。不要把常驻服务器那套装回来。 - 零知识模型契约(红线):
- 工具参数:
source/sql/object_type等 + configure 的非密预填(type/host/port/database/user)。任何工具都不得声明dsn参数(模型传 DSN 会把密码带进上下文);configure 收到args.dsn直接拒绝(result.noDsnViaModel)。dbhub_query/dbhub_query_objects已删除,勿恢复。 - 工具输出:结果/列表/标签一律
connLabel(dsn)(type://host:port/db)或 i18n 模板,密码与用户名永不出现;dbhub返回的文本(含 stderr)进模型前必须过scrubSecrets(text, dsn)。 - 密码只在界面输入:configure 的密码/完整 DSN 一律经
askUser(用户敲键盘,不经模型上下文);设置卡片 add/edit 的 DSN 走configOp通道(浏览器→Host),同样不进模型上下文。 - 鉴权/连接失败闭环:
likelyAuthOrConnError命中时在错误文本后附result.authHint(引导dbhub_configure或设置卡片修改,密码由用户输入)。 - 零密码泄漏门:
test/zero-knowledge.test.mjs断言 summarizeRows 无 dsn 字段、无工具声明dsn参数、描述/i18n 文案不含真实形态 DSN;util.test断言 scrubSecrets/connLabel 行为。改模型可见文案时这些测试必须保持绿。
- 工具参数:
- 状态命名空间:Host 注册
dsh-dbhub-live命名空间(ctx.inject(['settings'], …)+ schema);Web 端 Plugins 选项卡按命名空间分发settings.plugin.item卡片。命名空间值 = 状态{enabled, phase(running|disabled), toolCount(恒定4), lastError, mode('oneshot')}+ 配置{updateIntervalDays}+{workspaces(JSON 元数据摘要:title/path/env/conn(主机端口库)/source/persisted/srcId)}+{configOp}(主机消费后自动清空)+{testResult}(连接测试的一次性回执,仅内存态、不落任何持久化)。注入回调是独立作用域:内部需要的服务(如subprocess)必须用ctx.get('subprocess')就地获取,绝不能引用apply()的局部变量——否则 ReferenceError 会静默杀死整条发布/配置链路(卡片只剩静态值、工作区连接不刷新)。回调整体套wrap()防护,异常必须打日志。 - 可配置参数:
options.mjs只此一处持有部署开关:updateIntervalDays(设置 UI > 环境变量种子 > 内置默认;dbhubPackage仅环境变量/内部,不进设置)。已删除idleMinutes(无常驻进程可回收)。不要绕过applyPatch直接改options内部值。 - 工作区连接管理(configOp 通道):store v2 =
{ [wsPath]: { environments: { [env]: {dsn, source, updatedAt} } } }(v1 单 dsn 条目自动迁移进environments.default)。卡片只读元数据摘要(collectSources→latestSummaries,密码/用户名永不出 Host);增/改/删通过命名空间configOp单向命令下发,index.mjs用setWorkspaceEnv/removeWorkspaceEnv落盘后重扫摘要并发布(configOp 随发布清空,天然防环)。自动发现(mise/.env)只提供未覆盖的default,不持久化。连接测试({op:'test', workspace, env, nonce}):handleTestOp用摘要背后的真实 DSN 调adhoc.probeConnection(一次性 dbhub +SELECT 1,Host 侧 30s 超时兜底),结果经testResult镜像字段回推{nonce, ok, message};测试失败只是行内一次性提示,不得写入 store/lastError/phase。卡片只认自己派发过的 nonce,展示 ~10s 自动消退,刷新即失,天然不保留状态。 - 工具声明数量恒定(上下文预算红线):恒定 4 个(configure / list_sources / execute_sql / search_objects),绝不为每个工作区 × 环境注册独有工具;
dbhub_execute_sql(source,…)/dbhub_search_objects(source,…)调用时resolveSource按 source 值(标题_hash[_环境])解析到真实连接。曾实现过的 per-source 注册与dbhub_query临时连接工具已移除,勿回恢复。 - schema 弹性依赖:优先用真实
@deepseek-ai/schemasteryschema(await import);解析失败时降级为lib/index.mjs内建的最小 callable schema(schema(v)合默认值 +toJSON()),保证链路安装(dsh plugin add <本地目录>,Node ESM 按源码真实路径解析裸导入)下插件照样启动、卡片照常工作。tarball/npm 安装(真实目录在 profile node_modules 下)走真实 schemastery 路径。不要把这个 import 改回静态顶层 import——会重新引入链路安装时启动失败。 - 执行时机:
apply()只注册核心工具 + 后台 bookkeeping(startBackgroundBoot:置 phase running、刷新工具数、非阻塞检查 dbhub 自动更新);真正的 dbhub 解析(persisted → mise → PATH → 自动安装)发生在每次调用(resolveDbhubExe有 runtime.json 缓存,首次或缺二进制时才安装)。无工作区数据源时一切照常——工具正常注册,list_sources 返回空、execute 返回 noSource,不会拉起任何进程。 - 启用/禁用:
state.setEnabled持久化到credentials.json(权威值);禁用时所有工具 execute 首行返回「插件已禁用」(无进程可停,无需清理);重新启用即恢复。
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.
- 2d ago Changed · +17 lines · +992 tokens per session 7a1b08d71c0c
- 7d ago First seen · 98 lines · 3,634 tokens per session scan A cb6d961ac83b
dsh-dbhub-live AGENTS.md is an instructions file published in the GitHub repository mr-mihu/dsh-dbhub-live (1 stars, last pushed 3d ago), licensed MIT. It adds 4,626 tokens to every session, about $0.0231 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-31.
Other instructions, from other repositories
plan-forge caching.instructions.md
Caching patterns for .NET — IDistributedCache, Redis, in-memory, cache-aside, TTL strategies.
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.