@agentskit/harness

中文文档
0.22.3发布于 2026/09/28MITTypeScriptES Module构建来源已验证近 30 天下载 1.1万

Portable, evidence-backed development harness for coding agents.

原始使用文档
文档目录13 节
  1. docbridge: covers: - package:@agentskit/harness
  2. Install
  3. 60 seconds
  4. What a run looks like
  5. The worker leaves evidence, not promises
  6. Configuration, by example
  7. GitHub Issues as the configured tracker
  8. Commands
  9. As a library
  10. Also: the verification protocol
  11. More
  12. Release
  13. AgentsKit ecosystem

docbridge: covers: - package:@agentskit/harness

@agentskit/harness

The keep-pushing loop for your SDLC. A vague objective becomes a PRD, the PRD becomes issues, each issue becomes a frozen contract, a worker in its own worktree, a reviewed pull request proven against a definition of done, a merge — and, behind a human gate, a release.

The local UI is optional and loopback-protected: it projects .ak-loop/ files and events and can start typed Harness jobs without adding a daemon or database. Its primary flow is issue-first: select an available issue, freeze its contract/profile/limits, enqueue it, and resolve only human decisions from the persistent Inbox. Docs: harness.agentskit.io

Install

pnpm add -D @agentskit/harness     # Node 22+

Node 22 or newer. Two binaries: ak-harness (everything) and ak-verify (the same binary under the common verification-protocol name).

60 seconds

npx ak-harness loop init           # writes loop.config.yaml from a preset
npx ak-harness loop doctor         # providers, routing, slots, queue — dispatches nothing
npx ak-harness ui                  # local operational view at http://127.0.0.1:4321
npx ak-harness loop tick --dry-run --max 1
npx ak-harness loop install        # puts tick + deliver on a schedule

Then it runs without you: tick contracts and dispatches, deliver drives the pull request to merge.

What a run looks like

$ ak-harness loop tick --max 1
{"status":"ok","routing":{"orchestrator":"codex/gpt-5.6-sol","builder":"codex/gpt-5.6-luna"},
 "results":[{"issue":"REP-141","outcome":"dispatched","branch":"you/rep-141-usage-flag",
             "worktree":"rep-141-usage-flag","contractDigest":"9f2c1ab4…"}]}

$ ak-harness loop deliver
{"results":[{"issue":"REP-141","outcome":"fix-round","pr":482,
             "reason":"review found 2 blocking finding(s)"}]}

$ ak-harness loop deliver
{"results":[{"issue":"REP-141","outcome":"merged","pr":482,
             "actions":["local verify passed before review","verify.json supplied 2 outcome proof(s)",
                        "definition of done proven (5 item(s))"]}]}

The worker leaves evidence, not promises

Three files in .ak-loop/ at the root of its worktree. deliver reads them before the merge gate; a missing one comes back as a fix round naming the file.

// .ak-loop/verify.json — what it ran, outcome by outcome
{ "ranAt": "2026-09-20T18:04:11.000Z", "command": "pnpm test packages/report", "exitCode": 0,
  "outcomes": [{ "id": "o1", "status": "passed", "evidence": "42 passed | 0 failed" }] }
// .ak-loop/dod.json — both definition-of-done lists
{ "project":  [{ "id": "tests", "status": "passed", "evidence": "212 tests · 212 pass" }],
  "outcomes": [{ "id": "o1",    "status": "passed", "evidence": "returns 404 for an unknown id" }] }

.ak-loop/plan.md is the third: the plan the worker actually followed, and where it departed from the approved one.

Configuration, by example

# loop.config.yaml — the project's layer (there are four; the project outweighs the global one)
project: { name: report, repo: acme/report, baseBranch: main }
delivery:
  verifyCommand: pnpm lint && pnpm test
  review: { minSeverity: med, votes: 1 }
  merge: { auto: true, requireChecks: true }
# Every issue must prove the project's list, on top of its own contract outcomes.
dod:
  items:
    - { id: tests, description: the suite is green, kind: command, command: [pnpm, test] }
    - { id: changelog, description: the changelog moved, kind: file-changed, glob: CHANGELOG.md }
# One motor, three kinds of demand. A pin narrows the candidates; it never widens them.
flows:
  default: standard
  profiles:
    standard: { review: { votes: 1, minSeverity: med } }
    critical:
      review: { votes: 3, minSeverity: nit }
      merge: { requireHumanApproval: true }
      roles: { review: { provider: codex, model: gpt-5.6-sol, effort: xhigh } }
    incident:
      merge: { requireChecks: false }
      stages: { planner: false, vote: false, review: false }
      maxFixRounds: 1
  select:
    - { flow: incident, anyLabels: [sev1] }
    - { flow: critical, anyLabels: ['area:billing'] }
# A layer says which test closes an issue — cheaper than the whole suite on a monorepo.
layers:
  - { id: L2, label: 'layer:L2', paths: ['packages/runtime/**'], verify: pnpm test packages/runtime }

GitHub Issues as the configured tracker

Set the tracker to GitHub when the UI and execution loop should operate on issues from project.repo:

connectors:
  tracker: github
github:
  issues:
    state: open
    maxIssues: 500
    refreshSeconds: 60
    labels:
      todo: loop:todo
      inProgress: loop:in-progress
      review: loop:review
      done: loop:done
      blocked: loop:blocked

The Harness calls the existing gh CLI, sorts by most recently updated, and caches the board at .ak-loop/ui/github-issues.json. gh auth status and repository write permission are checked before a mutating job. Lifecycle labels are exclusive; done closes an issue and active states reopen it. Missing configured labels fail closed. The UI exposes typed, confirmed actions and jobs; only one tracker is selected per configuration.

The Harness reads loop.config.yaml; it does not consume a project's .github/ai-loop.yaml, whose schema belongs to a different executor.

Commands

Read-only
loop doctorProviders, usage, routing, slots, selected tracker board, installed agents
loop debriefWhat the loop is doing right now, per issue
loop observe --since 24hAnomalies and metrics; --precheck gives a scheduler exit code
loop retro --since 7dDigest, learnings and calibration suggestions
loop status · loop watch --once · loop pausedSchedule, in-flight phases, what it stopped on
Acts
loop tick · loop deliverOne dispatch pass · one delivery pass (both take --dry-run)
loop plan start | answer | approve | architect | approve-design | decomposeObjective → PRD → design → issues, two human gates
loop release status | approve | runPromote a batch a human approved, bound to a head sha
loop install · loop uninstall · loop resumeSchedule, and clearing a pause

As a library

import { loadLoopConfig, resolveFlowSettings, assessDod, readPhaseArtifacts } from '@agentskit/harness'

const { config } = loadLoopConfig('loop.config.yaml')
const flow = resolveFlowSettings(config, { labels: ['sev1'] })
// → flow.review.votes, flow.merge.requireChecks, flow.flow.name === 'incident'

const artifacts = readPhaseArtifacts('/path/to/worktree', config)
// → [{ name: 'verify', file: '.ak-loop/verify.json', present: true, valid: true, detail: '2 outcome(s)' }, …]
// plugin.mjs, declared in `plugins.modules` — a gate of your own
export default function register(bus) {
  bus.on('pr.merged', (event) => metrics.count('merged', event.issue))
  bus.hook('beforeMerge', ({ issue }) => isChangeFreeze() ? { block: true, reason: `freeze: ${issue}` } : undefined)
}

Also: the verification protocol

The same binary runs the single-run protocol the loop is built on — a frozen contract, executable checks bound to the current revision, and an explicit human decision:

ak-harness plan approved --by human
ak-harness start
ak-verify run --json
ak-verify approve approved --by human --json
{"status":"passed","criteria":["api-behavior"]}

Every check's final output line is JSON mapping to the outcome ids it proves. Evidence is bound to a committed Git HEAD; any source, configuration or contract change moves the run to STALE. Runs append a hash-chained events.ndjson — verify one with ak-harness events verify [run-id].

Runnable example: examples/minimum-profile.mjs (after pnpm build).

More

Release

The publish job in .github/workflows/release-harness.yml publishes on a merge to main, through npm Trusted Publishing (GitHub OIDC) — no NPM_TOKEN anywhere. It lives in the same workflow as the checks and needs every one of them, so a commit cannot publish past a red gate; a version not yet on the registry is the trigger. That file holds the checks as well as the publish: npm Trusted Publishing authorises by repository and workflow filename, so renaming it breaks releases until the npm setting matches. The candidate checklist and any open blocker live in release/manifest.json and release/notes.md.

Free and open source under MIT. See LICENSE.

AgentsKit ecosystem

版本与发布记录

@agentskit/harness 共发布 23 个版本,首次发布于 2026/08/31;过去 12 个月发布了 23 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.22.3latest2026/09/281 个月前
0.22.22026/09/271 个月前
0.22.12026/09/271 个月前
0.22.02026/09/271 个月前
0.21.02026/09/261 个月前
0.20.02026/09/261 个月前

关于 @agentskit/harness 的常见问题

@agentskit/harness 是什么?

Portable, evidence-backed development harness for coding agents.

如何安装 @agentskit/harness?

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

@agentskit/harness 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agentskit/harness 支持 ESM 还是 CommonJS?

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

@agentskit/harness 需要什么版本的 Node.js?

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

@agentskit/harness 可以商用吗?

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

@agentskit/harness 的下载量有多少?

根据 npm 官方下载统计,@agentskit/harness 在 2026/10/05 – 2026/11/03 这 30 天内被下载 10,976 次,日均约 366 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agentskit/harness 还在维护吗?

最新版本 0.22.3 发布于 2026/09/28(1 个月前);至今共发布 23 个版本,其中过去 12 个月发布了 23 个;首次发布于 2026/08/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。