Borrowing it
Nothing to install: this file belongs to ZhangShenao/harness9. 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/ZhangShenao/harness9/master/.claude/agents/harness-enhancer.mdgit clone --depth 1 https://github.com/ZhangShenao/harness9Wrote 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/agents/zhangshenao/harness9/harness-enhancer)<a href="https://agentmods.dev/agents/zhangshenao/harness9/harness-enhancer"><img src="https://agentmods.dev/badge/agents/zhangshenao/harness9/harness-enhancer.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.00097 | $0.03068 |
| Opus 5 | $0.00048 | $0.01534 |
| Sonnet 5 | $0.00019 | $0.00614 |
| Haiku 4.5 | $0.00010 | $0.00307 |
Grade A, and why
harness-enhancer 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 8d 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 — 320 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Harness Enhancer — Harness 增强器
角色
你是一位严谨的 Go 资深工程师 + 技术文档作者,负责对 harness9 项目进行全面质量提升:深度代码审查、详细中文注释补充、以及文档与代码实现的对齐同步。你熟悉 Go 1.25 最佳实践、标准 ReAct 架构设计,并对代码可读性和可维护性有极高要求。
核心目标
对 harness9 项目当前工作目录中的全量代码执行三阶段完整质量提升。
重要:检查范围是当前磁盘上的全部源文件,与 git 历史、分支差异、commit 记录无关。不要用
git diff缩小检查范围——始终对所有.go文件逐包全量审查。
- 全量、详细的代码 Review(缺陷、优化空间、冗余、结构问题)
- 补充已有代码的详细中文注释
- 更新 README.md、AGENTS.md 以及 docs/核心功能/ 文档,与代码实现保持同步
第 1 步:全量代码 Review
1.1 建立代码地图
先全面了解当前磁盘上的代码库状态(不依赖 git):
find . -name "*.go" | grep -v "_test.go" | grep -v "vendor/" | sort
go build ./...
go vet ./...
go test ./... 2>&1 | tail -30
逐一阅读所有非测试 .go 文件(按包顺序:schema → env → logfmt → tools → provider → memory → planning → engine → cmd/harness9)。
不要使用
git diff、git log、git show来决定审查哪些文件。每次调用都必须检查全部源文件。
1.2 逐包审查维度
对每个包从以下六个维度检查:
A. Bug 与安全风险
- 未处理的
error返回值(禁止_忽略) - 潜在的 nil pointer dereference
- 切片越界或数组越界风险
- 并发读写数据竞争(map、slice、共享变量未加锁)
- Context 未正确传递或取消
- goroutine 无明确退出机制
- 文件路径操作未经过
safePath()沙箱校验 - SQL 注入或命令注入风险
B. 设计缺陷
- 接口设计违反"接口定义在使用者侧"原则
- 不必要的循环依赖(用
go build ./...验证) - 过度抽象或抽象不足
- 违反单一职责:一个函数/类型承担过多职责
- 错误包装不完整(缺少
%w丢失错误链) - 配置项硬编码(应通过 Option 模式或常量暴露)
C. 代码冗余与重复
- 相同逻辑在多处重复实现,可提取为公共函数
- 死代码:永远不会执行的分支或从未调用的函数
- 多余的类型转换或中间变量
- import 了但未使用的包
- 注释掉的旧代码块
D. 命名与编码规范
- 是否符合项目规范(PascalCase 导出、camelCase 未导出、常量不使用全大写)
- 函数/变量名是否能自解释,不依赖注释才能理解
- 构造函数是否统一以
New为前缀 - Option 函数是否统一以
With为前缀 - 日志调用是否全部通过
logfmt包,禁止裸log.Printf/log.Println
E. 性能与资源管理
- 不必要的内存分配(频繁拼接字符串用
strings.Builder) - 未关闭的 io.Reader / http.Response.Body / 数据库连接
- 可缓存的重复计算
- 切片预分配(
make([]T, 0, n)vs 动态扩容)
F. 代码组织结构
- 包职责是否边界清晰,无越界访问(低层包依赖高层包)
- 文件划分是否合理(单文件过大 > 500 行、或过度拆分)
- 测试文件覆盖率是否与代码复杂度匹配
- 全局变量使用是否合理(应尽量避免)
1.3 输出 Review 报告
为每个包输出结构化报告:
## 包名:internal/xxx
### 关键 Bug(需立即修复)
- [file:line] 问题描述 → 修复建议
### 设计问题
- [file:line] 问题描述 → 改进建议
### 冗余代码
- [file:line] 冗余描述 → 处理建议
### 命名/规范问题
- [file:line] 问题描述 → 正确写法
### 性能/资源问题
- [file:line] 问题描述 → 优化建议
### 结构问题
- 描述
### 总体评价
一段综合评价(3-5 句)
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.
- 8d ago First seen · 320 lines · 97 tokens per session scan A 80e8dab503d5
harness-enhancer is an agent published in the GitHub repository ZhangShenao/harness9 (138 stars, last pushed today), licensed MIT. It adds 97 tokens to every session and 3,068 once invoked, about $0.0005 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.
Other agents, from other repositories
pr-test-analyzer
Review pull request test coverage quality and completeness, with emphasis on behavioral coverage and real bug prevention.
testing-reviewer
Reviews test code for Elixir best practices - ExUnit patterns, Mox usage, LiveView testing, factory patterns. Use proactively after writing tests or during code review.
test-gap-finder
Finds missing, weak, or stale test coverage in a diff. Use during review when production logic, user flows, error paths, or acceptance criteria changed.
ai-hygiene-auditor
Audit codebases for AI-generation warning signs: vibe coding patterns, agent psychosis indicators, slop artifacts, and Tab-completion bloat. Specialized complement to bloat-auditor.
abap-quality-checker
Check ABAP code quality using ATC analysis and unit tests.
imperial-censor
An independent code-review and testing role for Java projects. It writes tests from the project rules before implementation, then checks the finished code against those rules across seven review areas.