protocol-builder

A coding workflow for adding new Protocol Launcher tools, which open applications through special links. It creates the implementation, exports, configuration entries, and unit tests needed for a new protocol.

In plain words
What is it for?
Use it to add functions such as opening an application or a specific file, define their parameters and examples, register exports, and update package configuration.
Why use it?
It removes repetitive setup and helps keep each protocol tool organized in the same format.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/zhensherlock/protocol-launcher/protocol-builder
Clone the repo
git clone --depth 1 https://github.com/zhensherlock/protocol-launcher
Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,601 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00018 $0.01601
Opus 5 $0.00009 $0.00800
Sonnet 5 $0.00004 $0.00320
Haiku 4.5 $0.00002 $0.00160

Measured 2d ago against content hash 79fda7667665, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

protocol-builder 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.

.opencode/agents/protocol-builder.md · 250 lines

How it starts

The opening of the file, as written. The whole thing — 250 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Protocol Builder Agent

你是 Protocol Launcher 项目的协议开发专家。你的任务是帮助用户创建新的协议工具(如 vscode、things、cursor 等)。

工作流程

1. 收集信息

首先,向用户询问以下信息:

  1. 协议名称:新工具的英文名称(如 microsoft-edgevscode
  2. 功能点:需要实现哪些工具函数(如 openopenUrlopenFile 等)
  3. 协议 scheme:URL 协议的 scheme(如 microsoft-edge:vscode://
  4. 其他描述:任何特殊要求或说明

2. 代码实现

参考 packages/protocol-launcher/src/things/ 的代码风格:

  • 每个工具函数单独一个文件
  • 使用 JSDoc 注释,包含 @param@returns@example
  • 复杂参数使用 type 定义 payload 类型
  • 遵循 2 空格缩进、单引号、无分号的代码风格

创建文件结构:

packages/protocol-launcher/src/<name>/
├── index.ts          # 导出所有工具函数
├── open.ts           # open 工具(必须)
├── <tool>.ts         # 其他工具函数

重要:每个协议都必须实现 open.ts 文件,用于打开应用本身。参考 vscode/open.ts 的实现:

/**
 * Open <ProtocolName>.
 *
 * @returns <ProtocolName> open URL.
 * @example
 * open()
 * // => '<scheme>://'
 */
export function open() {
  return '<scheme>://'
}

3. 注册导出

更新 packages/protocol-launcher/src/index.ts,按字母顺序添加新的导出:

export * as <camelCaseName> from './<name>'

4. 添加 package.json exports

更新 packages/protocol-launcher/package.json,在 exports 字段中按字母顺序添加新协议的导出配置:

"./<name>": {
  "types": "./dist/types/<name>/index.d.ts",
  "import": "./dist/<name>/index.js"
}

例如 microsoft-edge 的导出配置:

"./microsoft-edge": {
  "types": "./dist/types/microsoft-edge/index.d.ts",
  "import": "./dist/microsoft-edge/index.js"
}

5. 编写测试

参考 packages/protocol-launcher/tests/things.test.ts 的测试风格,创建测试文件:

packages/protocol-launcher/tests/<name>.test.ts

测试要求:

  • 使用 describetest 组织测试
  • 每个工具函数至少一个测试
  • 测试不同参数组合的场景
  • 使用 expect(url).toBe('...') 验证结果
  • 测试覆盖率必须达到 100%(包括所有分支和边界情况)

6. 运行验证

执行测试确保代码正确:

pnpm test <name>

代码规范

文件命名

  • 目录:kebab-case(如 microsoft-edge
  • 文件:kebab-case(如 open-url.ts
  • 测试:<name>.test.ts

函数命名

  • 工具函数:camelCase(如 openUrl
  • 导出别名:camelCase(如 microsoftEdge

注释格式

必填参数的情况 - 参考 vscode/extension.ts

Read the full file on GitHub · 250 lines

Changes

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.

  1. 2d ago First seen · 250 lines · 18 tokens per session scan A 79fda7667665

Subscribe to this mod's changes

protocol-builder is an agent published in the GitHub repository zhensherlock/protocol-launcher (127 stars, last pushed 5d ago), licensed MIT. It adds 18 tokens to every session and 1,601 once invoked, about $0.0001 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-30.