00:00:00
构建 Hermes 插件
本文档的完整中文翻译正在进行中。
概述
创建 Hermes 插件的分步指南。
快速开始
bash
hermes help
hermes config
hermes skills相关链接
获取帮助
如需帮助,请运行 hermes doctor 或访问 GitHub Issues。
原文档内容:
Build a Hermes Plugin
This guide walks through building a complete Hermes plugin from scratch. By the end you'll have a working plugin with multiple tools, lifecycle hooks, shipped data files, and a bundled skill — everything the plugin system supports.
What you're building
A calculator plugin with two tools:
calculate— evaluate math expressions (2**16,sqrt(144),pi * 5**2)unit_convert— convert between units (100 F → 37.78 C,5 km → 3.11 mi)
Plus a hook that logs every tool call, and a bundled skill file.
Step 1: Create the plugin directory
bash
mkdir -p ~/.hermes/plugins/calculator
cd ~/.hermes/plugins/calculatorStep 2: Write the manifest
Create plugin.yaml:
yaml
name: calculator
version: 1.0.0
description: Math calculator — evaluate expressions and convert units
provides_tools:
- calculate
- unit_convert
provides_hooks:
- post_tool_callThis tells Hermes: "I'm a plugin called calculator, I provide tools and hooks." The provides_tools and provides_hooks fields are lists of what the plugin registers.
Optional fields you could add:
yaml
author: Your Name
requires_env: # gate loading on env vars; prompted during install
- SOME_API_KEY # simple format — plugin disabled if missing
- name: OTHER_KEY # rich format — shows description/url during install
description: "Key for the Other service"
url: "https://other.com/keys"
secret: trueStep 3: Write the tool schemas
Create schemas.py — this is what the LLM reads to decide when to call your tools:
python
"""Tool schemas — what the LLM sees."""
CALCULATE = {
"name": "calculate",
"description": (
"Evaluate a mathematical expression and return the result. "
"Supports arithmetic (+, -, *, /, **), functions (sqrt, sin, cos, "
"log, abs, round, floor, ceil), and constants (pi, e). "
"Use this for any math the user asks about."
),
"parameters": {
"...
*[完整翻译即将推出]*