harness-lab: Command for Claude Code

.claude/commands/harness-setup.md

harness-setup is a command for Claude Code from Joe-rq/harness-lab. It costs 54 tokens per session (1,594 once invoked), scanned A, original, MIT.

An installer that adds the harness-lab governance framework to an existing Git project. The framework provides shared rules, work-request tracking, and progress handover files for coding-agent sessions.

In plain words
What is it for?
Use it to add AGENTS.md, CLAUDE.md, requirements tracking, progress records, optional modules, and optional pre-tool checks to a project.
Why use it?
It checks whether the project is suitable, detects existing governance files, and avoids replacing them by default. This reduces setup work and helps prevent configuration conflicts.

Command for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is Joe-rq/harness-lab's own configuration. It tells Claude Code how to work on harness-lab 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 harness-lab configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is node scripts/req-cli.mjs create --title "Your first requirement".

Reuse

Borrowing it

Nothing to install: this file belongs to Joe-rq/harness-lab. 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/Joe-rq/harness-lab/master/.claude/commands/harness-setup.md
Clone the repo
git clone --depth 1 https://github.com/Joe-rq/harness-lab

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-setup

README.md
[![agentmods](https://agentmods.dev/badge/commands/joe-rq/harness-lab/harness-setup.svg)](https://agentmods.dev/commands/joe-rq/harness-lab/harness-setup)
Your own site
<a href="https://agentmods.dev/commands/joe-rq/harness-lab/harness-setup"><img src="https://agentmods.dev/badge/commands/joe-rq/harness-lab/harness-setup.svg" alt="Measured on agentmods" height="20"></a>
Per session 54 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,594 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.00054 $0.01594
Opus 5 $0.00027 $0.00797
Sonnet 5 $0.00011 $0.00319
Haiku 4.5 $0.00005 $0.00159

Measured 6d ago against content hash 77132e647721, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

harness-setup 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 6d 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/commands/harness-setup.md · 138 lines

How it starts

The opening of the file, as written. The whole thing — 138 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/harness-setup

目标

将 harness-lab 治理框架接入到当前 Git 项目,并让安装结果与当前仓库的真实治理契约一致。

前置检查

  1. Git 仓库检测

    • 当前目录必须包含 .git/
    • 如果不是 Git 仓库,先提示用户运行 git init
  2. 现有治理文件检测

    • 检查是否存在:AGENTS.md, CLAUDE.md, requirements/, .claude/progress.txt
    • 如果存在,记录冲突文件列表
    • 当前安装器的真实策略是默认跳过已有文件,避免覆盖目标项目内容

推荐执行方式

在目标项目中运行:

node /path/to/harness-lab/scripts/harness-install.mjs --defaults

如果目标项目的 package.json 在子目录(例如 app/package.json),仍在 Git 根目录运行安装器,并显式指定脚本绑定位置:

node /path/to/harness-lab/scripts/harness-install.mjs --defaults --package-dir app

包含治理 hooks:

node /path/to/harness-lab/scripts/harness-install.mjs --defaults --with-hook

如果 harness-lab 以 npm 包形式安装,package.json 暴露 harness-install bin 后,也可以使用:

npx --yes --package=harness-lab harness-install --defaults
npx --yes --package=harness-lab harness-install --defaults --dry-run
npx --yes --package=harness-lab harness-install --defaults --package-dir app
npx --yes --package=harness-lab harness-install --defaults --with-hook

模块

核心模块(必须安装)

  • AGENTS.md - 治理规则主入口
  • CLAUDE.md - 会话入口协议
  • requirements/ - REQ 生命周期管理
  • .claude/progress.txt - 跨会话进度交接

默认模块

模块 说明 默认
docs/ 设计稿和规范目录 yes
context/ 业务/技术/经验索引 yes
skills/.agents/skills/source-command-* 阶段导航技能、Claude Code source-command skills(含 worktree-req yes
CLI 脚本 REQ lifecycle/status/experience、reflect/align、audit/health、docs gate、doctor、invariant 与其运行依赖 yes
治理 hooks .claude/settings.example.json, scripts/session-start.js, scripts/req-check.js, scripts/scope-guard.mjs, 本地 hook 配置 no,需 --with-hook

安装器真实行为

  1. 源目录

    • 默认使用安装脚本所在仓库作为源目录
    • 可通过 --source /path/to/harness-lab 显式指定
  2. 冲突处理

    • 检测已存在文件
    • 默认跳过已存在文件
    • 当前不实现覆盖/取消的交互式分支
  3. 初始化配置

    • 创建或补齐 requirements/ 目录结构
    • 默认保留目标项目已有 REQ、报告和经验历史;仅在 --clean-template-history 下清理带模板标记的历史文件
    • 仅在不存在时初始化 .claude/progress.txt;重装逐字节保留现有进度
    • 合并合法的 .claude/settings.local.json,非法 JSON 原样保留并终止安装
    • 生成 requirements/reports/harness-setup-report.md

Read the full file on GitHub · 138 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. 6d ago First seen · 138 lines · 54 tokens per session scan A 77132e647721

Subscribe to this mod's changes

harness-setup is a command published in the GitHub repository Joe-rq/harness-lab (20 stars, last pushed 24d ago), licensed MIT. It adds 54 tokens to every session and 1,594 once invoked, about $0.0003 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.