harness9: Agent for Claude Code

.claude/agents/harness-enhancer.md

harness-enhancer is an agent for Claude Code from ZhangShenao/harness9. It costs 97 tokens per session (3,068 once invoked), scanned A, original, MIT.

A full-repository quality review and improvement agent for a Go project. Go is a programming language, and a repository is the project folder containing its source code and supporting files.

In plain words
What is it for?
It helps inspect all Go source files, check builds and tests, identify security and design problems, add Chinese comments, and synchronize project documentation.
Why use it?
It brings code review, bug fixing, comments, tests, and documentation updates into one defined process for the whole project.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions AGENTS.md; mentions OpenCode.

This is ZhangShenao/harness9's own configuration. It tells Claude Code how to work on harness9 itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything harness9 configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/ZhangShenao/harness9/master/.claude/agents/harness-enhancer.md
Clone the repo
git clone --depth 1 https://github.com/ZhangShenao/harness9

Made for: Claude Code.

Wrote 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.

agentmods badge for harness-enhancer

README.md
[![agentmods](https://agentmods.dev/badge/agents/zhangshenao/harness9/harness-enhancer.svg)](https://agentmods.dev/agents/zhangshenao/harness9/harness-enhancer)
Your own site
<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>
Per session 97 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,068 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00097 $0.03068
Opus 5 $0.00048 $0.01534
Sonnet 5 $0.00019 $0.00614
Haiku 4.5 $0.00010 $0.00307

Measured 8d ago against content hash 80e8dab503d5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

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.

.claude/agents/harness-enhancer.md · 320 lines

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 文件逐包全量审查。

  1. 全量、详细的代码 Review(缺陷、优化空间、冗余、结构问题)
  2. 补充已有代码的详细中文注释
  3. 更新 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 diffgit loggit 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 句)

Read the full file on GitHub · 320 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. 8d ago First seen · 320 lines · 97 tokens per session scan A 80e8dab503d5

Subscribe to this mod's changes

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.