tool-repair-skill-for-hermes-and-opencode

DSH PLUGIN模型与账号接入

仓库 bojansandhaus/tool-repair-skill-for-hermes-and-opencode

模型与账号接入 L4 · 沙盒安装通过 安全审查:低风险 可信度:银 可安装插件
安装这个插件

tool-repair-skill-for-hermes-and-opencode 是 bojansandhaus 维护的 模型与账号接入 类 DSH 可安装插件, 仓库为 bojansandhaus/tool-repair-skill-for-hermes-and-opencode,许可证 MIT。 下面按「装什么、怎么装、验没验过、跑起来要注意什么」逐项列出。

一句话选型结论

按资料字段整理

tool-repair-skill-for-hermes-and-opencode 是模型与账号接入类的 DSH 可安装插件,验证等级 L4 · 沙盒安装通过,安全审查为低风险,有可直接复制的安装命令。验证通过不等于安全:插件会读写文件、执行命令或联网,装前先到仓库确认它做了什么;涉及密钥或系统权限的,建议先在隔离环境试装。

分类模型与账号接入 收录类型可安装插件 验证等级L4 · 沙盒安装通过 安全审查低风险
验证等级 L4 L4 · 沙盒安装通过
GitHub 星标 4 复刻 未标注 · 未关闭 issue 未标注
最近更新 2026-10-09 创建于 未标注
README 15.4 KB 正文体量,越大说明说明书写得越细

安装

可安装插件
在 DSH 里执行,装完用 dsh plugin list 确认已挂上;标了 L4 / L5 的命令已在沙盒里真实跑通
dsh plugin --profile web add github:bojansandhaus/tool-repair-skill-for-hermes-and-opencode#v1.0.6
  1. 1
    确认版本与运行环境

    仓库没有标注兼容版本与 Node.js 要求,先确认你的 DSH 版本能装,再继续。

  2. 2
    执行安装命令

    在 DSH 里执行上面的命令;多包仓库要注意区分具体子包名,别装错包。

  3. 3
    确认已挂载

    用 dsh plugin list 查看列表里是否出现这个插件,出现即挂载成功。

  4. 4
    试跑并检查权限

    加载后跑一个最小用例,确认它能正常工作;同时看它申请了哪些文件、命令或网络权限。

兼容 DSH 版本未标注版本不匹配时安装会报错
Node.js 要求未标注来自仓库 package.json 的 engines 字段
前置依赖无需要同时安装的同级依赖
npm 包名未发布到 npm可用 npm view 查看包信息

能做什么

模型与账号接入
字段来自项目仓库与公开索引,中文说明由本站标注

适用场景

智能体编排终端命令

验证等级与安全审查

L4 · 沙盒安装通过
自动化流程结论,不是人工审核
验证等级L4 · 沙盒安装通过安装命令在隔离沙盒内真实执行成功,无依赖错误
安全审查低风险静态分析结论,未标注不代表已通过审查
仓库健康度活跃按仓库活跃度与最近更新时间给出
可信度银综合仓库活跃度与验证结果

选择建议

装之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 验证等级 L4:在沙盒里真实装过,依赖能装上,不是纸面声明。
  • 静态安全审查为低风险,没有发现明显可疑行为。
  • 有可直接复制的安装命令,不用自己翻文档找入口。

先想清楚的地方

  • 没有声明 Node.js 版本要求,版本不匹配可能装不上。
  • 验证通过不等于安全:插件会读写文件、执行命令或联网,装前先到仓库确认它做了什么。

更适合

  • 需要在模型与账号接入场景里给 DSH 补能力的人。
  • 想装完就能用、不想自己排依赖的人。
  • 能接受在本地装依赖、愿意自己确认权限的人。

不太适合

  • 只使用 DSH 官方内置能力、不接受第三方插件的人。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
插件验证等级安全审查星标兼容版本安装命令
tool-repair-skill-for-hermes-and-opencode当前 L4 · 沙盒安装通过 低风险 4 未标注 有
archify L4 · 沙盒安装通过 低风险 8.0 万 未标注 有
DeepSeek-Reasonix L4 · 沙盒安装通过 低风险 3.6 万 未标注 有
nocobase L3 · 安装规范通过 低风险 2.5 万 0.1.1-rc.2 无
learn-harness-engineering L4 · 沙盒安装通过 低风险 2.0 万 未标注 有
dsh-our-free-model 未做沙盒验证 未标注 8,064 未标注 无

仓库档案

模型与账号接入
字段来自项目仓库与公开索引,中文说明由本站标注
作者 / 维护方bojansandhaus仓库 tool-repair-skill-for-hermes-and-opencode · 默认分支 未标注
分类模型与账号接入ai
收录类型可安装插件声明了 dsh.bundle、可用 dsh plugin add 安装的条目
开发语言未标注仓库主语言
许可证MIT商用或二次分发前请确认条款原文
星标 / 复刻 / issue4 / 未标注 / 未标注收录时的数值,非实时
创建 / 更新未标注 · 2026-10-09最后推送 未标注
本站收录2026-10-30首次进入本站目录的时间

README 全文

15.4 KB
作者原文,中文版优先;只做安全转义,不改内容

Tool Repair Skill for Hermes and OpenCode


A harness-level fix for LLM tool calling. Catches the common JSON
formatting mistakes open models make and fixes them deterministically before
the tool executor ever sees them. Ships with adapters for four agent
frameworks:

Adapter Language Repair strategy
Hermes (two calls) Python Mutate args pre-dispatch, then append repair notes to the result. Built and tested against this library's own 34-test Python suite and 21-test TypeScript parity suite.
OpenCode (plugin) TypeScript tool.execute.before hook, mutates args directly
Claude Code (hooks) Bash + jq PreToolUse block so the model retries, PostToolUse telemetry. Cannot mutate arguments: PreToolUse can only allow or block, so this adapter corrects by feedback, not in place.
DeepSeek Harness (hook bridge) Bash + jq PreToolUse command hook registered with a harness bridge plugin. Also cannot mutate arguments: the seam allows deny, not rewrite.

Based on the approach that made DeepSeek V4 Pro outperform Opus 4.7 on tool
calling (see CommandCode's write-up on tool call repairs,
their deep dive,
and this video walkthrough).

The Problem

Open models (DeepSeek, GLM, Qwen, Kimi) make the same tiny JSON mistakes in tool calls over and over. Each mistake triggers a validation error. The model retries with the same bad format. The session degrades through 50+ wasted retry cycles. The model never learns because the error messages are opaque.

These mistakes are not random. They are a small finite set of patterns caused by the model's training distribution leaking through the tool boundary.

Harness vs Model

Most people frame this as a model problem: "DeepSeek is bad at tool calling, wait for the next version." That is wrong. It is a harness problem. The harness sits between the model and the tool executor. It decides what to do with the model's output: reject it and waste tokens retrying, or fix it silently and move on. A harness that repairs deterministically turns a bad-at-tool-calling model into a functional one in about 200 lines of code.

The model did not change. The harness got more forgiving in exactly the places it needed to be.

The Repair Rules This Applies

Pattern What the model sends What it should be
Null omission {"cmd": "ls", "timeout": null} {"cmd": "ls"}
Null preserved {"name": null} where name is required unchanged, so the validator reports it
Stringified array {"files": "[\"a\",\"b\"]"} {"files": ["a", "b"]}
Empty object {"files": {}} {"files": []}
Bare string {"files": "main.ts"} {"files": ["main.ts"]}
Markdown autolink {"filePath": "/x/[f.md](http://f.md)"} {"filePath": "/x/f.md"}

How It Works

flowchart TD
subgraph Harness["HARNESS BOUNDARY"]
direction TB
P["Parse JSON"] --> V{"Schema Valid?"}
V -->|"Yes"| D["Execute Tool"]
V -->|"No"| W["Walk Issue List by Path"]
W --> R["Apply Repairsin Priority Order"]
R --> RV{"Re-validate"}
RV -->|"Pass"| D
RV -->|"Fail"| E["Return Readable Errorwith Guidance"]
end

M["Model Output(raw tool call JSON)"] --> P
D --> N["Tool Result+ Repair Note"]
E --> N
N --> B["Back to Model"]

Everything inside the HARNESS BOUNDARY box is your agent framework. The model provides the raw JSON and receives the result. All repair logic, validation, and correction notes are handled at the harness layer.

Key design rule: a repair only fires when it is unambiguously the right thing, so legitimate data survives. The rules that could touch arbitrary content are narrow on purpose. A string is only parsed as an array when it parses as one; an auto-link is only unwrapped when the link text equals the URL's own path component; an array-shaped repair only fires when the schema says the field is an array; a null is only dropped when the schema neither requires the field nor admits null for it. So writeFile content that happens to be JSON-shaped, a real [click](https://example.com) link, and bracketed prose like [1, 2] and [3, 4] all pass through untouched, and the test suite asserts each of those cases.

Components

tool_repair.py (the core library)

Standalone Python module with no dependencies beyond stdlib. Main entry point:

from agent.tool_repair import repair_function_args

repaired_args, repair_notes = repair_function_args(
function_name="readFile",
function_args={"path": "/tmp/test.txt", "limit": None},
tool_schema=None,  # optional JSON schema for type-aware repairs
)
# repaired_args = {"path": "/tmp/test.txt"}
# repair_notes = ["[repair: null values removed for optional fields]"]

Can be imported and used by any agent framework, not just Hermes.

Hermes Agent integration (two calls)

The library is built and tested: 34 Python tests, 21 TypeScript parity tests, and
CI runs both plus the module self-test. Integrating it into a Hermes harness is
two calls at the harness layer, between the model's output and the tool
executor:

  1. agent/agent_runtime_helpers.py. sanitize_tool_call_arguments() is a harness function that walks tool calls before dispatch. Call repair_function_args() on the parsed dict after json.loads() has already succeeded. If repairs trigger, write the fixed JSON back to the call's arguments.

  2. agent/tool_dispatch_helpers.py. make_tool_result_message() is a harness function that builds the tool result before it goes back to the model. Call deduplicate_repair_notes() there to append the repair notes to the result content.

The model reads the repair note alongside the successful result and adapts on the next turn. The harness did the fixing. The model just benefits from seeing what was fixed.

Hermes plugin manifest

references/plugin.yaml declares the hook surface (transform_llm_output) and plugin-architecture.md sketches the wiring. The pre_tool_call hook today can block a call but cannot modify arguments, so the two-call integration above is what you write; plugin-architecture.md describes the hook surface that would make it a config toggle instead.

Adapted For Other Frameworks

This repo ships adapters for two other agent frameworks in the adapters/
directory. Each adapter wraps the same core tool_repair.py library with the
harness-specific wiring.

Adapter Location Key mechanism
Hermes SKILL.md sanitize_tool_call_arguments pre-dispatch + repair notes.
OpenCode adapters/opencode/ tool.execute.before TS plugin, mutates args directly
Claude Code adapters/claude-code/ PreToolUse block + PostToolUse telemetry (bash + jq)
DeepSeek Harness adapters/deepseek-harness/ PreToolUse command hook via a harness bridge plugin (bash + jq)
Shared detectors adapters/shared/detect.sh the one copy of the bash + jq selects all three shell hooks source

OpenCode has the cleanest integration because its tool.execute.before hook
supports argument mutation. Claude Code and DeepSeek Harness are the most
limited: both can only block a call, not mutate it, so they waste a turn when
they detect a pattern. The DeepSeek Harness adapter reads the harness' own
payload keys (tool_name, tool_input), which is why it is a separate script,
but its detectors are not a second copy: adapters/shared/detect.sh is sourced
by all three shell hooks, so a change to a select cannot land in one adapter
and miss the others the way it did in v1.0.1 and v1.0.5.

See each adapter's README for setup instructions.

Safety Guarantees

  • String-valued content is not at risk. The stringified-array rule only fires on a string that parses as a JSON array, and the auto-link rule only fires when the link text equals the URL's own path component. Prose like [1, 2] and [3, 4] and a real link like [click](https://example.com) pass through untouched, which the test suite asserts.
  • Non-JSON tool data is unaffected. The repair layer only examines tool call arguments (the JSON dict describing what the tool should do), not tool results, binary content, images, or multimodal data.
  • Schema-aware array repairs. Array-specific repairs (empty-object-to-array, bare-string-wrap) only fire when the tool JSON schema confirms the field expects an array type. Without a schema, only safe universal repairs run (null-strip, stringified-array-parse, autolink-unwrap).
  • A bracketed string that does not parse is never wrapped into an array element. [not json] is either prose or a broken array serialization, and turning it into ["[not json]"] produces a valid-looking call full of garbage. It is left for the validator to report. A malformed or boolean JSON Schema is walked past rather than raising.
  • The caller's dict is not mutated. repair_function_args deep-copies its input, so the documented write-back pattern (if fixed != parsed) actually fires, and a tool call that needs no repair produces no write-back.
  • Repair notes deduplicate. If a repair note was already appended on a previous turn, it won't get stacked again.

Dependencies

The core library (tool_repair.py) needs nothing beyond Python standard library.

Adapter Dependencies
Hermes Hermes Agent (any recent version), stdlib only for the library
OpenCode TypeScript, OpenCode CLI
Claude Code bash, jq
DeepSeek Harness @deepseek-ai/dsh, bash, jq

No pip packages, no npm modules, no external services for the core library.

How to Install

Core library (any framework)

cp references/tool_repair.py /your/project/tool_repair.py
from tool_repair import repair_function_args
fixed, notes = repair_function_args("my_tool", {"some_field": None})

Hermes Agent

Copy the library, then add the two calls described in Components:

cp references/tool_repair.py /path/to/hermes/agent/tool_repair.py

Or prompt your agent:

> Clone https://github.com/bojansandhaus/tool-repair-skill-for-hermes-and-opencode.git, copy references/tool_repair.py into the Hermes agent directory, then call repair_function_args inside sanitize_tool_call_arguments after json.loads() succeeds and deduplicate_repair_notes in make_tool_result_message. There is no Hermes config key for this; it needs those two code changes.

OpenCode

Copy the TypeScript adapter into your OpenCode plugins directory:

cp -r adapters/opencode/* ~/.config/opencode/plugins/

Or prompt your agent:

> Clone https://github.com/bojansandhaus/tool-repair-skill-for-hermes-and-opencode.git and copy the TypeScript plugin from adapters/opencode/ to ~/.config/opencode/plugins/.

Claude Code

Copy the hook scripts and the shared detectors, then configure in claude.json:

mkdir -p .claude/hooks
cp -r adapters/claude-code adapters/shared .claude/hooks/
chmod +x .claude/hooks/claude-code/*.sh

The hooks read their detectors from adapters/shared/detect.sh, one copy
shared with the DeepSeek Harness adapter and the telemetry hook, so the
directory layout has to come with them. Set TOOL_REPAIR_SHARED_DIR if you
install them somewhere else.

Or prompt your agent:

> Clone https://github.com/bojansandhaus/tool-repair-skill-for-hermes-and-opencode.git, copy the hook scripts from adapters/claude-code/ to .claude/hooks/, copy adapters/shared/ next to them, make them executable, and add the pre_tool_use and post_tool_use hook entries to claude.json.

{
"hooks": {
"pre_tool_use": {
"matcher": "*",
"command": "bash .claude/hooks/pre_tool_use.sh"
},
"post_tool_use": {
"matcher": "*",
"command": "bash .claude/hooks/post_tool_use.sh"
}
}
}

DeepSeek Harness

Copy the hook plus the shared detectors it reads, then register it with one of
the bridge plugins the harness ships (@deepseek-ai/dsh-hooks-claude-code or
@deepseek-ai/dsh-hooks-codex):

mkdir -p ~/.dsh/tool-repair
cp -r adapters/deepseek-harness adapters/shared ~/.dsh/tool-repair/
chmod +x ~/.dsh/tool-repair/deepseek-harness/pre_tool_use.sh

Write ~/.dsh/tool-repair/hooks.json:

{
"hooks": {
"PreToolUse": [
{
"matcher": "*",
"hooks": [
{ "type": "command", "command": "bash ~/.dsh/tool-repair/deepseek-harness/pre_tool_use.sh" }
]
}
]
}
}

And add the bridge to ~/.dsh/cordis.patch.yml:

- id: hooks-claude-code
name: '@deepseek-ai/dsh-hooks-claude-code'
config:
configPath: ~/.dsh/tool-repair/hooks.json

Or prompt your agent:

> Clone https://github.com/bojansandhaus/tool-repair-skill-for-hermes-and-opencode,
> copy adapters/deepseek-harness/ and adapters/shared/ into
> ~/.dsh/tool-repair/ keeping the layout, make
> ~/.dsh/tool-repair/deepseek-harness/pre_tool_use.sh executable, write a hooks.json
> registering it as a PreToolUse command hook, and add a
> @deepseek-ai/dsh-hooks-claude-code entry pointing at it in
> ~/.dsh/cordis.patch.yml.

Note which bridge you are running. The Claude Code bridge forwards the whole
arguments object, so every field is inspected. The Codex bridge forwards
tool_input: {command: commandOf(exec.arguments)} — one string — so only
command-shaped defects are detected there and the hook says so on stderr
every time. See adapters/deepseek-harness/README.md for the Codex bridge
variant, the verification steps, and the limitations.

Clone the repo

git clone https://github.com/bojansandhaus/tool-repair-skill-for-hermes-and-opencode.git
cd tool-repair-skill-for-hermes-and-opencode

Usage

From any Python project

import json
from tool_repair import repair_function_args

def dispatch_tool(name, args_json):
args = json.loads(args_json)
if isinstance(args, dict):
fixed_args, notes = repair_function_args(name, args)
if notes:
print(f"Repaired {name}: {notes}")
args_json = json.dumps(fixed_args)
# proceed with the tool call

In Hermes Agent

Two calls, in sanitize_tool_call_arguments and make_tool_result_message, as
shown in Components. There is no config key for this; it is harness code.

Roadmap

  • [x] Core repair library (5 repair rules)
  • [x] Hermes integration (two calls: repair_function_args pre-dispatch, deduplicate_repair_notes on the result)
  • [x] OpenCode adapter (TypeScript plugin)
  • [x] Claude Code adapter (bash + jq hooks)
  • [x] DeepSeek Harness adapter (bash + jq hook via a bridge plugin)
  • [x] Schema-aware repairs (array fields, and required/nullable null safety)
  • [ ] Per-model repair telemetry (dashboard tab)
  • [ ] Model-specific repair profiles (DeepSeek, GLM, Kimi quirks)

License

MIT. Free to use, modify, and distribute. This is a direct implementation of patterns discovered by the CommandCode team. Credit for the original insight goes to them.

常见问题

5 问
答案由本站依据条目字段整理,不引用上游原文
tool-repair-skill-for-hermes-and-opencode 怎么安装?

在 DSH 里执行 `dsh plugin --profile web add github:bojansandhaus/tool-repair-skill-for-hermes-and-opencode#v1.0.6` 即可。

tool-repair-skill-for-hermes-and-opencode 的验证等级是什么意思?

L4 · 沙盒安装通过。安装命令在隔离沙盒内真实执行成功,无依赖错误

tool-repair-skill-for-hermes-and-opencode 安全吗?

低风险。

tool-repair-skill-for-hermes-and-opencode 装之前要先确认什么?

先看它会读写哪些文件、执行哪些命令、连接哪些网络地址;验证等级只说明装得上、跑得起来,不等于安全。涉及密钥或系统权限的,建议先在隔离环境试装。

tool-repair-skill-for-hermes-and-opencode 用的是什么许可证?

上游标注为 MIT。商用或二次分发前请到仓库确认许可证原文。

模型与账号接入
按星标排序,可作替代方案

archify

archify

从仓库或系统描述生成经过校验的自包含交互式架构图、流程图、时序图、数据流图和生命周期图。

L4 · 沙盒安装通过 8.0 万 星

nocobase

nocobase

L3 · 安装规范通过 2.5 万 星

dsh-our-free-model

dsh-our-free-model

为 DeepSeek Harness 挂载免登录、免 API Key 的免费前沿模型通道,装完即用,并附用量看板与 OpenAI 兼容本地转

未标注验证等级 8,064 星

dsh-purge

dsh-purge

dsh-purge 是一款 DeepSeek Harness 设置插件,可修改默认副本、权限策略和工具限制,并添加规则卡片以分组应用补丁,支

L5 · 运行验证通过 4,573 星

bojansandhaus 的其它插件

1 个

插件的元信息来自作者仓库;分类、验证等级与安全结论的中文说明为中文整理,最近核验 —。