revfactory/harness
GitHub: revfactory/harness
Harness 是一个 Claude Code 插件级元工厂,能够根据领域描述自动设计并生成专业化的多智能体团队架构及配套技能。
Stars: 8437 | Forks: 1153
# Harness — Claude Code 的团队架构工厂
**English** | [한국어](README_KO.md) | [日本語](README_JA.md)
## 概述
Harness 利用 Claude Code 的 agent 团队系统,将复杂任务分解为协调运作的专业 agent 团队。只需说“为这个项目构建一个 harness”,它就会自动生成针对你的领域定制的 agent 定义(`.claude/agents/`)和技能(`.claude/skills/`)。
## 类别 — Harness 的定位
Harness 位于 Claude Code 生态系统的 **L3 Meta-Factory** 层 —— 该层用于生成其他 harness,而不是作为一个具体的 harness 存在。在 L3 层内部,我们选择了一个特定的子层:**Team-Architecture Factory(团队架构工厂)**。
| 层级 | 功能 | 共存的邻近项目 |
|-------|--------------|---------------------------|
| **L3 — Meta-Factory / Team-Architecture Factory**(本项目) | 领域描述 → 通过 6 种预定义的团队模式生成 agent 团队 + 技能 | — |
| L3 — Meta-Factory / Runtime-Configuration Factory | 确定性、可重复的 runtime 配置 | [coleam00/Archon](https://github.com/coleam00/Archon) |
| L3 — Meta-Factory / Codex Runtime Port | 相同概念,Codex runtime | [SaehwanPark/meta-harness](https://github.com/SaehwanPark/meta-harness) |
| L2 — Cross-Harness Workflow | 跨多个 harness 标准化技能/规则/钩子 | [affaan-m/ECC](https://github.com/affaan-m/everything-claude-code) |
## 核心功能
- **Agent 团队设计** — 6 种架构模式:Pipeline、Fan-out/Fan-in、Expert Pool、Producer-Reviewer、Supervisor 和 Hierarchical Delegation
- **技能生成** — 通过 Progressive Disclosure 自动生成技能,实现高效的上下文管理
- **编排调度** — Agent 间的数据传递、错误处理以及团队协调协议
- **验证机制** — 触发验证、dry-run 测试以及有无技能的对比测试
## 工作流
```
Phase 1: Domain Analysis
↓
Phase 2: Team Architecture Design (Agent Teams vs Subagents)
↓
Phase 3: Agent Definition Generation (.claude/agents/)
↓
Phase 4: Skill Generation (.claude/skills/)
↓
Phase 5: Integration & Orchestration
↓
Phase 6: Validation & Testing
```
## 安装说明
### 通过 Marketplace 安装
#### 添加 marketplace
```
/plugin marketplace add revfactory/harness
```
#### 安装插件
```
/plugin install harness@harness-marketplace
```
### 直接作为全局 Skill 安装
```
# 将 skills 目录复制到 ~/.claude/skills/harness/
cp -r skills/harness ~/.claude/skills/harness
```
## 插件结构
```
harness/
├── .claude-plugin/
│ └── plugin.json # Plugin manifest
├── skills/
│ └── harness/
│ ├── SKILL.md # Main skill definition (6-Phase workflow)
│ └── references/
│ ├── agent-design-patterns.md # 6 architectural patterns
│ ├── orchestrator-template.md # Team/subagent orchestrator templates
│ ├── team-examples.md # 5 real-world team configurations
│ ├── skill-writing-guide.md # Skill authoring guide
│ ├── skill-testing-guide.md # Testing & evaluation methodology
│ └── qa-agent-guide.md # QA agent integration guide
└── README.md
```
## 使用方法
在 Claude Code 中使用如下提示词触发:
```
Build a harness for this project
Design an agent team for this domain
Set up a harness
```
### 执行模式
| 模式 | 描述 | 推荐场景 |
|------|-------------|-----------------|
| **Agent Teams**(默认) | TeamCreate + SendMessage + TaskCreate | 2 个及以上需要协作的 agent |
| **Subagents** | 直接调用 Agent 工具 | 一次性任务,无需 agent 间通信 |
### 架构模式
| 模式 | 描述 |
|---------|-------------|
| Pipeline | 顺序依赖任务 |
| Fan-out/Fan-in | 并行独立任务 |
| Expert Pool | 基于上下文的选择性调用 |
| Producer-Reviewer | 先生成后质量审查 |
| Supervisor | 带有动态任务分配的中心 agent |
| Hierarchical Delegation | 自上而下的递归委派 |
## 输出结果
由 Harness 生成的文件:
```
your-project/
├── .claude/
│ ├── agents/ # Agent definition files
│ │ ├── analyst.md
│ │ ├── builder.md
│ │ └── qa.md
│ └── skills/ # Skill files
│ ├── analyze/
│ │ └── SKILL.md
│ └── build/
│ ├── SKILL.md
│ └── references/
```
## 使用场景 — 尝试这些提示词
安装 Harness 后,将以下任意提示词复制到 Claude Code 中:
**深度研究**
```
Build a harness for deep research. I need an agent team that can investigate
any topic from multiple angles — web search, academic sources, community
sentiment — then cross-validate findings and produce a comprehensive report.
```
**网站开发**
```
Build a harness for full-stack website development. The team should handle
design, frontend (React/Next.js), backend (API), and QA testing in a
coordinated pipeline from wireframe to deployment.
```
**网络漫画 / 连环画制作**
```
Build a harness for webtoon episode production. I need agents for story
writing, character design prompts, panel layout planning, and dialogue
editing. They should review each other's work for style consistency.
```
**YouTube 内容规划**
```
Build a harness for YouTube content creation. The team should research
trending topics, write scripts, optimize titles/tags for SEO, and plan
thumbnail concepts — all coordinated by a supervisor agent.
```
**代码审查与重构**
```
Build a harness for comprehensive code review. I want parallel agents
checking architecture, security vulnerabilities, performance bottlenecks,
and code style — then merging all findings into a single report.
```
**技术文档**
```
Build a harness that generates API documentation from this codebase.
Agents should analyze endpoints, write descriptions, generate usage
examples, and review for completeness.
```
**数据 Pipeline 设计**
```
Build a harness for designing data pipelines. I need agents for schema
design, ETL logic, data validation rules, and monitoring setup that
delegate sub-tasks hierarchically.
```
**营销活动**
```
Build a harness for marketing campaign creation. The team should research
the target market, write ad copy, design visual concepts, and set up
A/B test plans with iterative quality review.
```
## 共存关系 — Harness 与邻近项目
在 Claude Code / agent 框架生态系统中,Harness 并非孤立存在。以下代码库位于相邻的层级;每个项目都以平行的“X 是……,Harness 是……”的形式进行描述,以便您选择适合自己需求的项目或组合使用多个项目。
| 代码库 | 他们的定位 | 与 Harness 的关系 |
|------|----------------|-------------------------|
| [coleam00/Archon](https://github.com/coleam00/Archon) | “harness 构建器” — 确定性、可重复的 runtime 配置 | **同属 L3,相邻子层。** Archon 是 Runtime-Configuration Factory,Harness 是 Team-Architecture Factory。选择 Archon 获取 runtime 确定性,选择 Harness 进行团队架构设计,或者将它们结合使用。 |
| [SaehwanPark/meta-harness](https://github.com/SaehwanPark/meta-harness) | 相同概念的 Codex 移植版 | **同属 L3,不同 runtime。** 在 Claude Code 上使用 Harness,在 Codex 上使用 meta-harness。 |
| [affaan-m/ECC](https://github.com/affaan-m/everything-claude-code) | “Agent harness 性能与工作流层”(位于现有 harness 之上) | **不同层级。** ECC 是跨 harness 的标准化层;Harness 是生成 harness 的工厂。可以进行串联组合。 |
| [wshobson/agents](https://github.com/wshobson/agents) | Subagent / 技能目录(182 个 agent,149 个技能) | **工厂 ↔ 零部件供应。** wshobson 是可供挑选的目录;Harness 负责设计团队。将 wshobson 的条目作为部件吸收到 Harness 生成的团队中。 |
| [LangGraph](https://langchain-ai.github.io/langgraph/) | 状态图编排,与 LLM 无关 | **不同赛道。** LangGraph 用于长时间运行、状态可恢复的编排;Harness 用于快速、Claude Code 原生的团队设计。 |
## 使用 Harness 构建
### Harness 100
**[revfactory/harness-100](https://github.com/revfactory/harness-100)** — 涵盖 10 个领域的 100 个生产就绪 agent 团队 harness,提供英文和韩文版本(共 200 个包)。每个 harness 包含 4-5 个专家 agent、一个编排技能和特定领域的技能 —— 均由此插件生成。包含 1,808 个 markdown 文件,涵盖内容创作、软件开发、数据/AI、商业战略、教育、法律、健康等领域。
### 研究:Harness 有效性的 A/B 测试
**[revfactory/claude-code-harness](https://github.com/revfactory/claude-code-harness)** — 跨 15 个软件工程任务的对照实验,旨在衡量结构化预配置对 LLM 代码 agent 输出质量的影响。
| 指标 | 未使用 Harness | 使用 Harness | 提升 |
|--------|:-:|:-:|:-:|
| 平均质量得分 | 49.5 | 79.3 | **+60%** |
| 胜率 | — | — | **100%** (15/15) |
| 输出方差 | — | — | **-32%** |
关键发现:有效性随任务复杂性成正比增长 —— 任务越难,提升幅度越大(Basic +23.8,Advanced +29.6,Expert +36.2)。
**通用说明文案:** 平均质量提升 +60%(49.5 → 79.3),胜率 15/15,方差 −32%(n=15,作者自测 A/B,第三方复现待定)。
## 前置条件
- [启用 Agent Teams](https://code.claude.com/docs/en/agent-teams):`CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`
## 常见问题
Q1. “+60%”是不是夸大宣传了?
**A.** +60% 的数据来自**作者自测的 A/B 测试(n=15,15 个任务,在姊妹仓库 `claude-code-harness` 中测量)**。本仓库中的每一处引用都在同一句话中附带了“n=15,作者自测,第三方复现待定”的声明。关于是否采用的决策,我们建议进行 2-4 周的内部试点并测量您自己的数据。
**证据:**
- 作者 A/B 测试:[revfactory/claude-code-harness](https://github.com/revfactory/claude-code-harness)
- 论文:*Hwang, M. (2026). Harness: Structured Pre-Configuration for Enhancing LLM Code Agent Output Quality*
Q2. 为什么叫“harness factory”而不是“harness builder”?这难道不是在和 Archon 竞争吗?
**A.** Archon 生成确定性的 runtime 配置 —— 它是一个 **Runtime-Configuration Factory**。Harness 生成 agent 团队架构(团队结构、消息协议、审查关卡)—— 它是一个 **Team-Architecture Factory**。它们是**同一个 L3 Meta-Factory 的相邻子层**,满足不同的需求。选择 Archon 获取 runtime 确定性,选择 Harness 获取团队架构模式,或者将它们结合使用(用 Harness 设计架构 → 用 Archon 部署 runtime)。
**证据:**
- Archon 自我定位:[clawfit docs/reference-levels.md](https://github.com/hongsw/clawfit/blob/main/docs/reference-levels.md)
- 子层声明:参见上方的**类别 — Harness 的定位**部分
- Archon 仓库:[github.com/coleam00/Archon](https://github.com/coleam00/Archon)
Q3. “仅限 Claude Code”是不是太狭窄了?Gemini/Codex 怎么办?
**A.** 目前官方 runtime 仅限 Claude Code。相同概念的 Codex 移植版 —— [SaehwanPark/meta-harness](https://github.com/SaehwanPark/meta-harness) —— 已经公开,因此 Codex 团队可以从那里开始。Harness 选择了“Claude Code 原生、深入”而不是“多 runtime、浅尝辄止”;与兄弟仓库(meta-harness、harness-init、OpenRig)的跨 runtime 合作已在路线图上。
**证据:**
- Codex 移植版:[github.com/SaehwanPark/meta-harness](https://github.com/SaehwanPark/meta-harness)
- 跨 runtime 脚手架:[github.com/Gizele1/harness-init](https://github.com/Gizele1/harness-init)
## 许可证
Apache 2.0
标签:AI智能体, C2, Claude Code, SOC Prime, 代码生成, 后端开发, 多智能体协作, 开发工具, 架构设计, 渗透测试工具, 防御加固