# harness-offload 中文文档

规范地址：https://npmcn.com/package/harness-offload/

版本：0\.2\.1
npm 元数据更新时间：2026-11-03T19:07:32.003Z
中文译文更新时间：2026-11-03T19:59:31.181Z
软件包许可：MIT

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/harness-offload
原文对照：https://npmcn.com/package/harness-offload/?lang=original
项目主页：https://github.com/levgiorg/harness-offload#readme
源码仓库：https://github.com/levgiorg/harness-offload

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：4 MB，132 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- Node.js 要求：\>=22
- 运行依赖：3 个
- peer 依赖：typebox \*
- 首次发布：2026-11-03T19:05:53.147Z
- 最新版本发布：2026-11-03T19:07:31.812Z
- 已发布版本数：3（近 12 个月 3 个）

## 中文简介

线束卸载器：通过将批量I/O委托给您已经付费的廉价模型，将其排除在编码代理的上下文中。

## 安装

```sh
npm install harness-offload
```

也可以使用：`pnpm add harness-offload`、`yarn add harness-offload`、`bun add harness-offload`

## README

# 利用卸载

**让庞大的文件、长日志和仓库范围的搜索远离编码代理的上下文。**  
你已经付费的计划中的一个小模型会阅读它们，并将答案交给你，每一行参考都经过检查。

[![ci](https://github.com/levgiorg/harness-offload/actions/workflows/ci.yml/badge.svg)](https://github.com/levgiorg/harness-offload/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/harness-offload)](https://www.npmjs.com/package/harness-offload) [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/levgiorg/harness-offload/blob/main/LICENSE)

Claude Code·Codex·Gemini CLI·Copilot CLI·Cursor·OpenCode·Pi·Qwen Code·Crush·Kilo·Windsurf·任何MCP客户端

![A coding agent tries to read a 919-line file; Harness Offload blocks it with an outline, Haiku answers the question with seven checked citations, and a 2,323-line CI log becomes a short digest](https://raw.githubusercontent.com/levgiorg/harness-offload/main/docs/assets/demo.gif)

真实输出，重播：worker `claude:haiku` 克劳德的计划

## 安装

```bash
npx harness-offload@latest install
```

它询问你的哪个代理设置它(Claude Code, Codex, Cursor, Gemini CLI, Copilot CLI, Qwen Code， Crush, Pi, OpenCode, Kilo（它找到的是勾选的），无论是对你所有的项目还是只对这个项目， 准确显示将要更改的内容，只有在您同意后才安装。然后每个代理读取 **它自己的小 以你已经支付的计划为模型**： Claude Code→Haiku、Codex→gpt-6-luna、Gemini CLI→Flash-Lite…

**只有克劳德代码？** `claude plugin install harness-offload --marketplace levgiorg/harness-offload`

它改变了什么，在哪里

| 代理 | 会发生什么 | 在 |
| --- | --- | --: |
| 克劳德代码 | `claude plugin install … --scope user` (或 `project`） | 由Claude Code管理(`~/.claude`，或者项目的 `.claude/settings.json`） |
| Codex·副驾驶CLI·Qwen Code·Pi·Devin | 自己的插件/扩展命令 | 由每个代理管理 |
| 双子座CLI | 一个新的扩展文件夹 | `~/.gemini/extensions/harness-offload/` |
| 光标 | 插件的副本 | `~/.cursor/plugins/local/harness-offload/` |
| OpenCode·Kilo | 一个一行的插件文件 | `~/.config/opencode/plugins/`， `~/.config/kilo/plugin/` |
| 粉碎 | 2个钩子和一个指南添加到你的设置中（保留备份） | `~/.config/crush/crush.json` |
| 卸载本身 | 它自己的副本，所以代理不依赖于NPX缓存 | `~/.local/share/harness-offload/` |

什么也跑不掉。 `npm install` 时间;只有 `install` 改变任何东西。每个代理的详细信息： [文档/ hosts.md](https://github.com/levgiorg/harness-offload/blob/main/docs/hosts.md)。

-   **检查:** `npx harness-offload doctor` · **更新:** 再次运行安装命令(它显示为 `updated 0.2.0 → …`）
-   **改变阅读的人** （另一个模型，一个API密钥，一个本地模型）： `npx harness-offload model …` （[18家供应商+本地](https://github.com/levgiorg/harness-offload/blob/main/docs/backends.md)),或 `/harness-offload:setup` 克劳德法典
-   **没有问题** （脚本，CI，或从代理内部）： `npx harness-offload@latest install --yes [--agents claude,codex] [--scope project]`
-   **删除:** `npx harness-offload uninstall` （问；你的设置保持不变，除非你这么说）·克劳德代码单独： `claude plugin uninstall harness-offload@harness-offload`
-   **让你的经纪人去做：** 粘贴 _“快跑 `npx harness-offload@latest install --dry-run`，让我看看它会改变什么，然后运行它 `--yes --agents <this agent>`”。_

## 它节省了什么？

| 你的代理人要求 | 会读到 | 回来 | 事实发现 |
| --- | --- | --: | --: |
| 关于919线模块的问题 | 9666令牌 | 402 - 412 | 4 / 4 |
| 包含两个故障的2,323行CI日志 | 32771年 | 651 - 665 | 3 / 3 |
| 从Pytest文件编写的参考测试 | 759 | 52 | 30 / 30和24 / 26测试通过¹ |

测量2026-11-02，Haiku作为工人，在两个引擎上（范围=两个引擎）- [文档/ VALIDATION.md](https://github.com/levgiorg/harness-offload/blob/main/docs/VALIDATION.md)． ¹在生成的测试中，两个失败是错误的期望值： 回顾一下 `write` 产生。

## 如何使用它

你通常不会：钩子抓住昂贵的动作并引导代理。当您或代理商直接需要时：

```bash
offload read -q "how are late fees applied?" src/ledger.ts   # answer + checked path:line citations
offload explore "where is the retry policy configured?"      # read-only search across the repo
offload run -- npm test                                      # long output → digest + verbatim errors
offload task review-sql src/db/                             # your own task: your instructions, checked citations
offload dashboard --open                                     # what stayed out of your context
```

您自己的任务是几行配置 [文档/ commands.md](https://github.com/levgiorg/harness-offload/blob/main/docs/commands.md#your-own-tasks)。

![The offload dashboard: tokens kept out of context per day, breakdowns by kind and model, and citation checks (example data)](https://raw.githubusercontent.com/levgiorg/harness-offload/main/docs/assets/dashboard.png)

## 它是如何工作的

1.  **一个钩子把大的读回来。** 完整阅读超过600行(或一个 `cat` （一）得到一个大纲和更便宜的选择。
2.  **一个小模特读着它。** `offload` 将文件发送给工作线程，并删除所有拒绝权限和秘密。
3.  **答案是正确的。** 每一个 `path:Lx-Ly` 必须引用确实存在的文本，否则会被标记。
4.  **嘈杂的输出变成了摘要。** 逐字错误行和尾来自脚本；模型只添加一个摘要。

一切都无法打开：如果没有工作人员可用，代理的工具就会像以前一样工作。

## 文档

|  |  |
| --- | --- |
| [利用](https://github.com/levgiorg/harness-offload/blob/main/docs/hosts.md) | 每个集成做什么，安装注意事项 |
| [后端](https://github.com/levgiorg/harness-offload/blob/main/docs/backends.md) | `@host`、OpenCode、Codex、Gemini、Copilot、Qwen、Crush、Pi、API密钥、本地模型、回退 |
| [命令](https://github.com/levgiorg/harness-offload/blob/main/docs/commands.md) | 每个命令，出口密码，故障排除 |
| [配置](https://github.com/levgiorg/harness-offload/blob/main/docs/configuration.md) | 阈值，保护模式，每个项目设置，隐私 |
| [它是如何工作的](https://github.com/levgiorg/harness-offload/blob/main/docs/how-it-works.md) | 设计，注意事项，为什么这些数字只是估计值 |
| [相比](https://github.com/levgiorg/harness-offload/blob/main/docs/comparison.md) | 它与RTK、挤压、上下文模式、分流和模型路由器有何不同 |
| [表演](https://github.com/levgiorg/harness-offload/blob/main/docs/performance.md) | 每个工具调用的挂钩成本，有和没有卸载（测量） |
| [安全](https://github.com/levgiorg/harness-offload/blob/main/SECURITY.md) | 信任模式，员工锁定，已知极限 |
| [发展](https://github.com/levgiorg/harness-offload/blob/main/docs/development.md) | 测试，布局，发布 |

## 贡献

欢迎pr——CI运行两个引擎的一致性套件、路由表、三种操作系统上的TypeScript测试，并对每个pull请求进行检测。看到 [CONTRIBUTING.md](https://github.com/levgiorg/harness-offload/blob/main/CONTRIBUTING.md)。

## 致谢

Harness Offload是麻省理工学院许可的原始代码。它的想法是由Spotify的“分流”插件形成的 (apache - 2.0 `spotify/portal-ai-plugins`)，它将大的读取路由到更便宜的模型 coding-agent挂钩;OpenCode无头的 `opencode run`;Claude Code的钩子和插件系统， Codex, Cursor， Gemini CLI和Pi；Boris Cherny关于目标驱动和循环驱动的代理工作流的笔记；和 关于代币节省的社区研究（JetBrains对输出压缩器的研究，LogDx-CI基准）。 不包括第三方源代码。 统计报告嵌入了Archivo、Public Sans和Courier Prime字体的拉丁子集 (SIL开放字体许可证1.1 [LICENSE-FONTS](https://github.com/levgiorg/harness-offload/blob/main/LICENSE-FONTS)）.

## 许可证

[麻省理工学院](https://github.com/levgiorg/harness-offload/blob/main/LICENSE)

## 常见问题

### harness-offload 是什么？

线束卸载器：通过将批量I/O委托给您已经付费的廉价模型，将其排除在编码代理的上下文中。

### 如何安装 harness-offload？

在项目目录运行 npm install harness-offload，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 offload、harness-offload，可以用 npx offload 直接运行。

### harness-offload 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/harness-offload 是否存在。

### harness-offload 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### harness-offload 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=22。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### harness-offload 可以商用吗？

harness-offload 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### harness-offload 还在维护吗？

最新版本 0\.2\.1 发布于 2026/11/04（今天）；至今共发布 3 个版本，其中过去 12 个月发布了 3 个；首次发布于 2026/11/04。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

