一个 git 仓库
repo-harness 是 repo-local 的。请在 git 工作树中运行——如果当前目录还不是仓库,先 git init。
本指南把一个仓库从零带到可用的 repo-harness 工作流:安装运行时、采用仓库、接好 agent 的 hook,并确认护栏会触发。
一个 git 仓库
repo-harness 是 repo-local 的。请在 git 工作树中运行——如果当前目录还不是仓库,先 git init。
一个 agent
用 Claude Code 或 Codex CLI 作为执行器。ChatGPT Pro 是可选的,用于规划。
Bun
CLI 运行在 Bun 上——如果缺失,安装脚本会自动拉取。无需配置 Node。
用最适合你的入口把 repo-harness 二进制装到机器上:
# macOS / Linux — installs Bun if missing, then the CLIcurl -fsSL https://raw.githubusercontent.com/Ancienttwo/repo-harness/main/install.sh | shbun add -g repo-harnessnpm install -g repo-harness每台机器只需运行一次 init。它是幂等的——它会为你将来用到的每个项目接好宿主 hook 适配器、Waza 技能和 CodeGraph 索引:
repo-harness init# ✓ host adapters · skills · CodeGraph configured随时检查就绪状态(只读):
repo-harness status # CLI version, host install state, route coveragerepo-harness doctor # PATH, version, hosts, trust state在仓库根目录下预览将要发生的改动。不会写入任何内容:
repo-harness adopt --dry-run # Migration Report应用 repo-local 契约:
repo-harness adoptAdopt 会检查仓库、安装工作流文件、接好 hook、构建 CodeGraph 索引,并运行工作流检查。它铺设的文件树:
init 会安装把编辑器事件派发进 repo-harness 的宿主适配器。把你的 agent 指向它们,然后重启会话让 hook 加载。
适配器位于你的用户设置中——~/.claude/settings.json——它把每个 SessionStart、PreToolUse、PostToolUse、UserPromptSubmit 和 Stop 事件路由进 harness。重启 Claude Code 以加载它。
Codex 读取 ~/.codex/hooks.json。在 init 写好它之后,在 Codex Settings 中信任该 hook 配置——Codex 不会执行未受信任的 hook。然后开启一个新会话。
Prompt 路由——提交任意 prompt。UserPromptSubmit hook 会对意图分类,并在其建议性输出中展示计划状态。
编辑护栏——在任何计划被批准之前,让 agent 编辑一个文件。PreToolUse.edit 护栏会 fail closed,在你捕获计划之前阻止写入。
工作流检查——直接运行门禁:
bash scripts/check-task-workflow.sh --strict绿色的检查意味着契约面是一致的,护栏已就位。
想让 ChatGPT Pro 读取你的计划而不碰源码?通过本地 MCP sidecar 只暴露工作流文件:
repo-harness mcp setup chatgpt --repo .repo-harness mcp serve --transport http \ --host 127.0.0.1 --port 8765 --profile planner完整细节——包括只读安全边界——见 ChatGPT Pro 规划器页面。