repo-harness 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.es.md +11 -10
  2. package/README.fr.md +11 -11
  3. package/README.ja.md +10 -10
  4. package/README.md +62 -29
  5. package/README.zh-CN.md +41 -24
  6. package/assets/reference-configs/AGENTS.md +13 -0
  7. package/assets/reference-configs/CLAUDE.md +13 -0
  8. package/assets/reference-configs/external-tooling.md +9 -2
  9. package/assets/reference-configs/harness-overview.md +1 -1
  10. package/assets/reference-configs/hook-operations.md +1 -1
  11. package/assets/skill-commands/repo-harness-init/SKILL.md +4 -4
  12. package/assets/skill-version.json +6 -2
  13. package/assets/templates/contract.template.md +1 -1
  14. package/assets/templates/helpers/check-skill-version.ts +3 -1
  15. package/assets/templates/helpers/check-task-workflow.sh +15 -3
  16. package/assets/templates/helpers/workflow-contract.ts +3 -1
  17. package/assets/workflow-contract.v1.json +47 -47
  18. package/docs/images/image.png +0 -0
  19. package/package.json +1 -1
  20. package/scripts/architecture-event.ts +0 -0
  21. package/scripts/assemble-template.ts +0 -0
  22. package/scripts/capability-config.ts +0 -0
  23. package/scripts/capability-resolver.ts +0 -0
  24. package/scripts/check-skill-version.ts +3 -1
  25. package/scripts/check-task-workflow.sh +15 -3
  26. package/scripts/contract-run.ts +0 -0
  27. package/scripts/create-project-dirs.sh +0 -0
  28. package/scripts/factor-lab-check.sh +0 -0
  29. package/scripts/factor-lab-new.sh +0 -0
  30. package/scripts/factor-lab-promote.sh +0 -0
  31. package/scripts/factor-lab-reject.sh +0 -0
  32. package/scripts/hook-dispatch-diet-report.ts +0 -0
  33. package/scripts/initializer-question-pack.ts +0 -0
  34. package/scripts/lib/project-init-lib.sh +125 -69
  35. package/scripts/loop-engine-cutover-gate.ts +0 -0
  36. package/scripts/migrate-project-template.sh +17 -4
  37. package/scripts/route-nl-vs-ts-eval.ts +0 -0
  38. package/scripts/run-skill-evals.ts +0 -0
  39. package/scripts/run-skill-hook.ts +0 -0
  40. package/scripts/workflow-contract.ts +3 -1
  41. package/src/cli/commands/doctor.ts +1 -1
  42. package/src/cli/commands/global-runtime.ts +10 -5
  43. package/src/cli/commands/init-hook.ts +30 -2
  44. package/src/cli/commands/init.ts +47 -1
  45. package/src/cli/commands/run.ts +23 -0
  46. package/src/cli/commands/status.ts +1 -1
  47. package/src/cli/hook/runtime.ts +1 -1
  48. package/src/cli/index.ts +169 -17
  49. package/src/cli/repo-adoption/reclaim-runtime.ts +682 -0
  50. package/src/cli/runtime/helper-runner.ts +169 -0
package/README.es.md CHANGED
@@ -42,7 +42,7 @@ repo-local que él mismo genera para los proyectos downstream.
42
42
  opcionales según el tipo de proyecto y cuatro hook profiles (`standard`,
43
43
  `minimal`, `biome`, `biome-strict`). Ejecuta
44
44
  `npx -y repo-harness init`; no necesitas clonar el repositorio fuente.
45
- - **Comando de refresco del repo (`repo-harness update`).** La instalación y el
45
+ - **Comando de adopción del repo (`repo-harness adopt`).** La instalación y el
46
46
  refresco de repos existentes tienen su propia superficie de comando, manteniendo
47
47
  la ruta de migración repo-local anterior mientras `init` queda dedicado al
48
48
  runtime global.
@@ -100,7 +100,7 @@ En conjunto hay tres capas:
100
100
  1. **Capa del paquete fuente**: este repositorio mantiene la CLI, los command
101
101
  skill facades, los templates, los hook assets, el workflow contract, los tests
102
102
  y el release gate.
103
- 2. **Capa del contract del repositorio objetivo**: `repo-harness update` o la
103
+ 2. **Capa del contract del repositorio objetivo**: `repo-harness adopt` o la
104
104
  migración escribe `docs/spec.md`, `plans/`, `tasks/`, `.ai/context/`,
105
105
  `.ai/harness/`, helper scripts y `.ai/hooks/`.
106
106
  3. **Capa del host adapter**: el `~/.claude/settings.json` y el
@@ -208,7 +208,8 @@ npx -y repo-harness init
208
208
 
209
209
  La npm package release line y el generated workflow stamp usan ahora la misma
210
210
  línea `0.4.x`. `repo-harness init` es el bootstrap
211
- global y `repo-harness update` es el refresco repo-local. `repo-harness init`
211
+ global, `repo-harness update` es el refresco user-level y `repo-harness adopt`
212
+ es el refresco repo-local. `repo-harness init`
212
213
  configura el CLI, los hook adapters de nivel usuario, Waza, Mermaid, el brain
213
214
  root y CodeGraph MCP; el viejo camino Claude plugin `scripts/setup-plugins.sh`
214
215
  queda retirado.
@@ -245,17 +246,17 @@ elimina `scripts/sync-codex-installed-copies.sh`.
245
246
  En un repositorio existente, ejecuta desde el repo root:
246
247
 
247
248
  ```bash
248
- npx -y repo-harness update --dry-run
249
+ npx -y repo-harness adopt --dry-run
249
250
  ```
250
251
 
251
252
  Aplica solo después de que el reporte del dry-run sea correcto:
252
253
 
253
254
  ```bash
254
- npx -y repo-harness update
255
+ npx -y repo-harness adopt
255
256
  ```
256
257
 
257
258
  Para un proyecto o módulo nuevo, usa la branch command `repo-harness-scaffold`.
258
- Para un repositorio existente, usa `repo-harness update`; este instala o refresca
259
+ Para un repositorio existente, usa `repo-harness adopt`; este instala o refresca
259
260
  el harness y no crea el stack tecnológico de la aplicación.
260
261
 
261
262
  ### Cómo se ve el éxito
@@ -345,8 +346,8 @@ Guards habituales:
345
346
 
346
347
  ## Release actual
347
348
 
348
- - npm package: `repo-harness@0.4.3`
349
- - Generated workflow stamp: `repo-harness@0.4.3+template@0.4.3`
349
+ - npm package: `repo-harness@0.5.0`
350
+ - Generated workflow stamp: `repo-harness@0.5.0+template@0.5.0`
350
351
  - GitHub repository: `Ancienttwo/repo-harness`
351
352
  - Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
352
353
 
@@ -360,7 +361,7 @@ Guards habituales:
360
361
  - `assets/workflow-contract.v1.json`
361
362
  - Los generated repos usan por defecto el repo-local harness flow:
362
363
  - `docs/spec.md -> plans/ -> tasks/contracts/ -> tasks/reviews/ -> .ai/context/context-map.json -> .ai/harness/*`
363
- - `repo-harness update` refresca las runtime pieces:
364
+ - `repo-harness update` refresca las runtime pieces de usuario:
364
365
  - los `repo-harness` skill aliases
365
366
  - los global Codex/Claude hook adapters
366
367
  - las Waza skills: `think`, `hunt`, `check`, `health`
@@ -393,7 +394,7 @@ compatibilidad de discovery por skills, mientras el CLI y los hooks ejecutan:
393
394
  - Repo workflow actions: `repo-harness-ship`, `repo-harness-init`, `repo-harness-migrate`, `repo-harness-upgrade`, `repo-harness-capability`, `repo-harness-architecture`, `repo-harness-handoff`, `repo-harness-deploy`, `repo-harness-repair`, `repo-harness-check`
394
395
  - Branch project creation: `repo-harness-scaffold`
395
396
 
396
- `repo-harness update` se usa para repositorios existentes; `repo-harness-scaffold`
397
+ `repo-harness adopt` se usa para repositorios existentes; `repo-harness-scaffold`
397
398
  queda como branch command para crear proyectos o módulos nuevos. `hooks-init`, `docs-init` y
398
399
  `create-project-dirs` son pasos internos, no commands públicos.
399
400
 
package/README.fr.md CHANGED
@@ -42,7 +42,7 @@ workflow repo-local qu'il génère lui-même pour les projets en aval.
42
42
  optionnels selon le type de projet, et quatre hook profiles (`standard`,
43
43
  `minimal`, `biome`, `biome-strict`). Exécutez
44
44
  `npx -y repo-harness init` ; aucun clone du dépôt source n'est nécessaire.
45
- - **Commande de rafraîchissement du dépôt (`repo-harness update`).** L'installation
45
+ - **Commande d'adoption du dépôt (`repo-harness adopt`).** L'installation
46
46
  et le rafraîchissement des dépôts existants ont leur propre surface de commande,
47
47
  tout en conservant l'ancien chemin de migration repo-local et en gardant `init`
48
48
  dédié au runtime global.
@@ -102,7 +102,7 @@ L'ensemble se découpe en trois couches :
102
102
  1. **Couche package source** : ce dépôt maintient le CLI, les command skill
103
103
  facades, les templates, les hook assets, le workflow contract, les tests et le
104
104
  release gate.
105
- 2. **Couche contrat du dépôt cible** : `repo-harness update` ou une migration écrit
105
+ 2. **Couche contrat du dépôt cible** : `repo-harness adopt` ou une migration écrit
106
106
  `docs/spec.md`, `plans/`, `tasks/`, `.ai/context/`, `.ai/harness/`, les helper
107
107
  scripts et `.ai/hooks/`.
108
108
  3. **Couche host adapter** : les `~/.claude/settings.json` et `~/.codex/hooks.json`
@@ -213,8 +213,8 @@ npx -y repo-harness init
213
213
 
214
214
  La release line du package npm et le generated workflow stamp utilisent
215
215
  désormais la même ligne `0.4.x`. `repo-harness init`
216
- sert au bootstrap global et `repo-harness update` sert au rafraîchissement
217
- repo-local. `repo-harness init` configure le CLI, les hook adapters de niveau
216
+ sert au bootstrap global, `repo-harness update` au rafraîchissement
217
+ user-level, et `repo-harness adopt` au rafraîchissement repo-local. `repo-harness init` configure le CLI, les hook adapters de niveau
218
218
  utilisateur, Waza, Mermaid, le brain root et CodeGraph MCP ; l'ancien chemin
219
219
  Claude plugin `scripts/setup-plugins.sh` est retiré.
220
220
 
@@ -250,17 +250,17 @@ sont supprimés par `scripts/sync-codex-installed-copies.sh`.
250
250
  Pour un dépôt existant, exécutez depuis le repo root :
251
251
 
252
252
  ```bash
253
- npx -y repo-harness update --dry-run
253
+ npx -y repo-harness adopt --dry-run
254
254
  ```
255
255
 
256
256
  Appliquez seulement une fois que le rapport du dry-run est correct :
257
257
 
258
258
  ```bash
259
- npx -y repo-harness update
259
+ npx -y repo-harness adopt
260
260
  ```
261
261
 
262
262
  Pour un nouveau projet ou un nouveau module, utilisez la branch command
263
- `repo-harness-scaffold`. Pour un dépôt existant, utilisez `repo-harness update` ;
263
+ `repo-harness-scaffold`. Pour un dépôt existant, utilisez `repo-harness adopt` ;
264
264
  il installe ou rafraîchit le harness sans créer de stack applicatif.
265
265
 
266
266
  ### À quoi ressemble le succès
@@ -350,8 +350,8 @@ Guards courants :
350
350
 
351
351
  ## Release actuelle
352
352
 
353
- - npm package : `repo-harness@0.4.3`
354
- - Generated workflow stamp : `repo-harness@0.4.3+template@0.4.3`
353
+ - npm package : `repo-harness@0.5.0`
354
+ - Generated workflow stamp : `repo-harness@0.5.0+template@0.5.0`
355
355
  - GitHub repository : `Ancienttwo/repo-harness`
356
356
  - Release history : [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
357
357
 
@@ -365,7 +365,7 @@ Guards courants :
365
365
  - `assets/workflow-contract.v1.json`
366
366
  - Les generated repos utilisent par défaut le repo-local harness flow :
367
367
  - `docs/spec.md -> plans/ -> tasks/contracts/ -> tasks/reviews/ -> .ai/context/context-map.json -> .ai/harness/*`
368
- - `repo-harness update` rafraîchit les runtime pieces :
368
+ - `repo-harness update` rafraîchit les runtime pieces utilisateur :
369
369
  - les `repo-harness` skill aliases
370
370
  - les global Codex/Claude hook adapters
371
371
  - les Waza skills : `think`, `hunt`, `check`, `health`
@@ -399,7 +399,7 @@ aux hooks :
399
399
  - Repo workflow actions : `repo-harness-ship`, `repo-harness-init`, `repo-harness-migrate`, `repo-harness-upgrade`, `repo-harness-capability`, `repo-harness-architecture`, `repo-harness-handoff`, `repo-harness-deploy`, `repo-harness-repair`, `repo-harness-check`
400
400
  - Branch project creation : `repo-harness-scaffold`
401
401
 
402
- `repo-harness update` sert aux dépôts existants ; `repo-harness-scaffold` sert de
402
+ `repo-harness adopt` sert aux dépôts existants ; `repo-harness-scaffold` sert de
403
403
  branch command pour créer un nouveau projet ou module. `hooks-init`, `docs-init` et
404
404
  `create-project-dirs` sont des étapes internes, pas des commands publiques.
405
405
 
package/README.ja.md CHANGED
@@ -34,7 +34,7 @@ skill runtime を提供します。
34
34
  commit/pending)、プロジェクト種別ごとのオプション LSP plugins、そして 4 段階の hook profile
35
35
  (`standard`、`minimal`、`biome`、`biome-strict`)を扱います。
36
36
  実行は `npx -y repo-harness init`。source checkout は不要です。
37
- - **Repo refresh コマンド(`repo-harness update`)。** 既存 repo の install / refresh は
37
+ - **Repo adoption コマンド(`repo-harness adopt`)。** 既存 repo の install / refresh は
38
38
  独立した command surface になり、従来の repo-local migration path を保ちながら
39
39
  `init` は global runtime setup に集中します。
40
40
  - **CodeGraph index の自己修復。** prompt hook が構造的な code-navigation intent を検出し、
@@ -79,7 +79,7 @@ product boundary は意図的に地味です。対象リポジトリを検査し
79
79
 
80
80
  1. **ソースパッケージ層**:本リポジトリが CLI、CLI-backed command facades、templates、hook assets、
81
81
  workflow contract、tests、release gate を所有します。
82
- 2. **対象リポジトリ contract 層**:`repo-harness update` または migration が、`docs/spec.md`、
82
+ 2. **対象リポジトリ contract 層**:`repo-harness adopt` または migration が、`docs/spec.md`、
83
83
  `plans/`、`tasks/`、`.ai/context/`、`.ai/harness/`、helper scripts、`.ai/hooks/` といった
84
84
  repo-local ファイルを書き込みます。
85
85
  3. **Host adapter 層**:user-level の `~/.claude/settings.json` と `~/.codex/hooks.json` が
@@ -180,7 +180,7 @@ npx -y repo-harness init
180
180
 
181
181
  npm package と generated workflow stamp は現在同じ `0.4.x` release line を使います。
182
182
  `repo-harness init` は global bootstrap、`repo-harness update` は
183
- repo-local refresh です。`repo-harness init` は CLI、user-level hook adapters、Waza、Mermaid、
183
+ user-level refresh、`repo-harness adopt` は repo-local refresh です。`repo-harness init` は CLI、user-level hook adapters、Waza、Mermaid、
184
184
  brain root、CodeGraph MCP を設定し、退役した `scripts/setup-plugins.sh` の Claude plugin path は使いません。
185
185
 
186
186
  ソースの checkout から作業する場合:
@@ -214,17 +214,17 @@ symlink に裏打ちされた runtime entrypoint です。退役した `repo-har
214
214
  既存リポジトリでは repo root から実行します。
215
215
 
216
216
  ```bash
217
- npx -y repo-harness update --dry-run
217
+ npx -y repo-harness adopt --dry-run
218
218
  ```
219
219
 
220
220
  dry-run のレポートが正しいことを確認してから適用します。
221
221
 
222
222
  ```bash
223
- npx -y repo-harness update
223
+ npx -y repo-harness adopt
224
224
  ```
225
225
 
226
226
  新しいプロジェクトやモジュールには支線 command `repo-harness-scaffold` を使います。既存リポジトリには
227
- `repo-harness update` を使います。これは harness をインストールまたはリフレッシュするもので、アプリケーション
227
+ `repo-harness adopt` を使います。これは harness をインストールまたはリフレッシュするもので、アプリケーション
228
228
  スタックは作成しません。
229
229
 
230
230
  ### 成功した状態
@@ -312,8 +312,8 @@ hook がブロックしたときは、まず terminal の構造化された出
312
312
 
313
313
  ## 現在の Release
314
314
 
315
- - npm package:`repo-harness@0.4.3`
316
- - Generated workflow stamp:`repo-harness@0.4.3+template@0.4.3`
315
+ - npm package:`repo-harness@0.5.0`
316
+ - Generated workflow stamp:`repo-harness@0.5.0+template@0.5.0`
317
317
  - GitHub repository:`Ancienttwo/repo-harness`
318
318
  - Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
319
319
 
@@ -327,7 +327,7 @@ hook がブロックしたときは、まず terminal の構造化された出
327
327
  - `assets/workflow-contract.v1.json`
328
328
  - Generated repos はデフォルトで repo-local harness flow を使います:
329
329
  - `docs/spec.md -> plans/ -> tasks/contracts/ -> tasks/reviews/ -> .ai/context/context-map.json -> .ai/harness/*`
330
- - `repo-harness update` は runtime pieces をリフレッシュします:
330
+ - `repo-harness update` は user-level runtime pieces をリフレッシュします:
331
331
  - `repo-harness` skill aliases
332
332
  - global Codex/Claude hook adapters
333
333
  - Waza skills:`think`、`hunt`、`check`、`health`
@@ -358,7 +358,7 @@ knowledge sync、handoff retrieval の workflow 設計に影響を与えてい
358
358
  - Repo workflow actions:`repo-harness-ship`、`repo-harness-init`、`repo-harness-migrate`、`repo-harness-upgrade`、`repo-harness-capability`、`repo-harness-architecture`、`repo-harness-handoff`、`repo-harness-deploy`、`repo-harness-repair`、`repo-harness-check`
359
359
  - Branch project creation:`repo-harness-scaffold`
360
360
 
361
- `repo-harness update` は既存リポジトリ向け、`repo-harness-scaffold` は支線 command として新しいプロジェクトやモジュールを作成します。
361
+ `repo-harness adopt` は既存リポジトリ向け、`repo-harness-scaffold` は支線 command として新しいプロジェクトやモジュールを作成します。
362
362
  `hooks-init`、`docs-init`、`create-project-dirs` は内部ステップであり、公開 commands ではありません。
363
363
 
364
364
  ## Maintainer Reference
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # repo-harness
2
2
 
3
3
  <p align="center">
4
- <img src="docs/images/repo-harness-hook-carrot.png" alt="repo-harness hooks leading Codex and Claude forward with repo-local workflow state" width="900">
4
+ <img src="docs/images/image.png" alt="One next button joining Claude and Codex under repo-harness workflow rules" width="760">
5
5
  </p>
6
6
 
7
7
  Repo-local agentic development harness CLI and skill runtime for Claude/Codex
@@ -43,20 +43,21 @@ In an adopted repo, the surface area is intentionally small:
43
43
  | `tasks/contracts/`, `tasks/reviews/`, and `.ai/harness/checks/` | Scope, verification, and review evidence for proving the work is done. |
44
44
  | `.ai/harness/handoff/` and `tasks/current.md` | Session journal and resumable status, derived from workflow artifacts instead of chat memory. |
45
45
 
46
- ## What's New in 0.4.3
47
-
48
- - **Runtime docs lookup.** `repo-harness docs list|path|show` resolves bundled
49
- runtime/reference docs from the installed package instead of requiring copied
50
- repo prose.
51
- - **Init-hook bootstrap audit.** `repo-harness init-hook --json` reports concrete
52
- Agent actions for missing working rules, adapter drift, stale CLI installs,
53
- and tooling readiness.
54
- - **First-principles edit guard.** Managed hook routes now include
55
- anti-overengineering guidance for implementation edits while keeping the guard
56
- advisory.
57
- - **Slimmer generated reference docs.** Generated and migrated repos write
58
- deterministic `docs/reference-configs/*.md` pointer stubs while `.ai/harness/*`
59
- and `.ai/context/*` remain local runtime artifacts.
46
+ ## What's New in 0.5.0
47
+
48
+ - **Clean command boundary.** `repo-harness update` now refreshes only the
49
+ user-level CLI/runtime surface, while `repo-harness adopt` owns repo-local
50
+ workflow install, refresh, and migration.
51
+ - **Package-dispatched helper runtime.** Generated `scripts/*` wrappers can
52
+ delegate through `repo-harness run <helper>`, so adopted repos do not need to
53
+ vendor every helper implementation when the installed package already owns it.
54
+ - **Eight managed hook routes.** The README now documents the exact hook route
55
+ matrix that Claude and Codex adapters install: session context, edit guards,
56
+ delegated-agent routing, post-edit and post-bash observers, always-on trace,
57
+ prompt routing, and stop closeout.
58
+ - **Release-ready install examples.** The first-run and refresh commands now
59
+ show the split between machine bootstrap, user-level updates, read-only setup
60
+ audit, and repo-local adoption.
60
61
 
61
62
  ## What repo-harness Does
62
63
 
@@ -81,7 +82,7 @@ The design has three layers:
81
82
 
82
83
  1. **Source package**: this repository owns the CLI, CLI-backed command facades,
83
84
  templates, hook assets, workflow contract, tests, and release gate.
84
- 2. **Target repo contract**: `repo-harness update` or migration writes repo-local
85
+ 2. **Target repo contract**: `repo-harness adopt` or migration writes repo-local
85
86
  files such as `docs/spec.md`, `plans/`, `tasks/`, `.ai/context/`,
86
87
  `.ai/harness/`, helper scripts, and `.ai/hooks/`.
87
88
  3. **Host adapters**: user-level `~/.claude/settings.json` and
@@ -225,28 +226,45 @@ user-level hook adapters, configures Waza runtime skills, persists a brain root
225
226
  under `~/.repo-harness/config.json`, and configures CodeGraph MCP. It does not
226
227
  apply repo-local workflow files to the current directory.
227
228
 
228
- For an Agent-owned, read-only bootstrap audit, run `npx -y repo-harness
229
- init-hook --json` or add `--check-updates` for version advisories. `init-hook`
230
- is not a runtime hook: it does not write user-level files, install updates, or
229
+ For an Agent-owned, read-only bootstrap audit, run `npx -y repo-harness setup
230
+ check --json` or add `--check-updates` for version advisories. `setup check` is
231
+ not a runtime hook: it does not write user-level files, install updates, or
231
232
  register adapters. It emits `agent_actions` with the reason, risk, target files,
232
233
  optional command, and verification surface for the Agent to execute deliberately.
234
+ `repo-harness init-hook` remains a compatibility alias.
235
+
236
+ ### Install and refresh examples
237
+
238
+ ```bash
239
+ # First machine bootstrap: global CLI, skills, host adapters, Waza, brain, CodeGraph.
240
+ npx -y repo-harness init
241
+
242
+ # Refresh user-level CLI/runtime pieces after a package update.
243
+ repo-harness update
244
+
245
+ # Ask for read-only repair guidance without writing files.
246
+ repo-harness update --check
247
+
248
+ # Refresh repo-local workflow files in an adopted repository.
249
+ repo-harness adopt --repo /path/to/repo
250
+ ```
233
251
 
234
252
  ### 2. Preview the repo-local contract
235
253
 
236
254
  ```bash
237
- npx -y repo-harness update --dry-run
255
+ npx -y repo-harness adopt --dry-run
238
256
  ```
239
257
 
240
258
  Run the dry run from the target repository root. It reports the specs, task
241
259
  state, helper runtime, hook adapter target, and verification files that would be
242
260
  created or refreshed. It should not create an application stack; existing repos
243
- use `repo-harness update`, while new projects or modules use
261
+ use `repo-harness adopt`, while new projects or modules use
244
262
  `repo-harness-scaffold`.
245
263
 
246
264
  ### 3. Apply, then prove the workflow
247
265
 
248
266
  ```bash
249
- npx -y repo-harness update
267
+ npx -y repo-harness adopt
250
268
  bash scripts/check-task-workflow.sh --strict
251
269
  bun test
252
270
  ```
@@ -289,17 +307,17 @@ Claude/Codex paths are symlink-backed runtime entrypoints. Only
289
307
  For an existing repo, run from the repo root:
290
308
 
291
309
  ```bash
292
- npx -y repo-harness update --dry-run
310
+ npx -y repo-harness adopt --dry-run
293
311
  ```
294
312
 
295
313
  Apply only after the dry-run report looks correct:
296
314
 
297
315
  ```bash
298
- npx -y repo-harness update
316
+ npx -y repo-harness adopt
299
317
  ```
300
318
 
301
319
  For a new project or module, use the branch command `repo-harness-scaffold`. For
302
- an existing repo, use `repo-harness update`; it installs or refreshes the harness
320
+ an existing repo, use `repo-harness adopt`; it installs or refreshes the harness
303
321
  without creating an application stack.
304
322
 
305
323
  ### Success looks like this
@@ -325,7 +343,22 @@ before applying anything.
325
343
  - Repo-local `.claude/settings.json` and `.codex/hooks.json` hook adapters are legacy project-level config and should be retired during migration.
326
344
  - Codex must mark `~/.codex/hooks.json` as trusted in Codex Settings before those hooks run.
327
345
  - Debug in this order: user-level adapter config -> `repo-harness-hook` (or fallback `repo-harness hook`) -> route registry -> `.ai/hooks/*`.
328
- - If `repo-harness-hook` reports `.ai/hooks` drift, refresh the repo-local copy with `repo-harness update --repo <root>`.
346
+ - If `repo-harness-hook` reports `.ai/hooks` drift, refresh the repo-local copy with `repo-harness adopt --repo <root>`.
347
+
348
+ The installed adapter owns eight managed hook routes. The route tuple
349
+ `event + routeId + matcher` is the stable contract; script names are the current
350
+ implementation under `assets/hooks/` or a repo-pinned `.ai/hooks/` copy.
351
+
352
+ | Route | Matcher | Scripts | Function |
353
+ | --- | --- | --- | --- |
354
+ | `SessionStart.default` | all sessions | `session-start-context.sh`, `security-sentinel.sh` | Injects prior handoff, sprint status, and read-only config-security findings before work starts. |
355
+ | `PreToolUse.edit` | `Edit|Write` | `worktree-guard.sh`, `pre-edit-guard.sh` | Enforces worktree policy and plan/contract readiness before implementation edits. |
356
+ | `PreToolUse.subagent` | `Task|Agent|SendUserMessage` | `subagent-return-channel-guard.sh` | Keeps delegated work returning through the parent session instead of leaking completion claims. |
357
+ | `PostToolUse.edit` | `Edit|Write` | `post-edit-guard.sh` | Records edit traces, refreshes handoff/task status, and queues architecture drift when controlled files change. |
358
+ | `PostToolUse.bash` | `Bash` | `post-bash.sh` | Observes command results and captures verification evidence without replacing the command runner. |
359
+ | `PostToolUse.always` | all tools | `post-tool-observer.sh` | Provides low-noise always-on trace and runtime observation; stale pinned copies soft-skip with a refresh hint. |
360
+ | `UserPromptSubmit.default` | all prompts | `prompt-guard.sh` | Classifies prompt intent, routes planning/check/hunt hints, and renders host-safe workflow guidance. |
361
+ | `Stop.default` | session stop | `stop-orchestrator.sh` | Finalizes handoff and guards against ending with unresolved draft-plan or completion evidence gaps. |
329
362
 
330
363
  `SessionStart` resolves hooks central-first, then runs two ordered scripts before
331
364
  work begins:
@@ -394,8 +427,8 @@ Most common guards:
394
427
 
395
428
  ## Current Release
396
429
 
397
- - npm package: `repo-harness@0.4.3`
398
- - Generated workflow stamp: `repo-harness@0.4.3+template@0.4.3`
430
+ - npm package: `repo-harness@0.5.0`
431
+ - Generated workflow stamp: `repo-harness@0.5.0+template@0.5.0`
399
432
  - GitHub repository: `Ancienttwo/repo-harness`
400
433
  - Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
401
434
 
@@ -484,7 +517,7 @@ skill discovery compatible while the CLI and hooks own execution:
484
517
  - Repo workflow actions: `repo-harness-ship`, `repo-harness-init`, `repo-harness-migrate`, `repo-harness-upgrade`, `repo-harness-capability`, `repo-harness-architecture`, `repo-harness-handoff`, `repo-harness-deploy`, `repo-harness-repair`, `repo-harness-check`
485
518
  - Branch project creation command: `repo-harness-scaffold`
486
519
 
487
- `repo-harness update` is for an existing repo; `repo-harness-scaffold` creates a
520
+ `repo-harness adopt` is for an existing repo; `repo-harness-scaffold` creates a
488
521
  new project or module scaffold as a side command. `hooks-init`, `docs-init`, and
489
522
  `create-project-dirs` are internal steps, not public commands.
490
523
 
package/README.zh-CN.md CHANGED
@@ -32,18 +32,18 @@ repo-local workflow 的自托管样例。
32
32
  | `tasks/contracts/`、`tasks/reviews/`、`.ai/harness/checks/` | 证明完成所需的 scope、verification 和 review evidence。 |
33
33
  | `.ai/harness/handoff/` 和 `tasks/current.md` | session journal 与可恢复状态,从 workflow artifacts 派生,而不是依赖聊天记忆。 |
34
34
 
35
- ## 0.4.3 新特性
36
-
37
- - **Runtime docs lookup。** `repo-harness docs list|path|show` 从已安装 package
38
- 解析 bundled runtime/reference docs,不再要求把完整 repo prose 复制到下游。
39
- - **Init-hook bootstrap audit。** `repo-harness init-hook --json` 会把缺失的
40
- working rules、adapter drift、stale CLI install 和 tooling readiness 汇成
41
- 具体 Agent actions
42
- - **First-principles edit guard。** Managed hook routes 增加实现编辑时的
43
- anti-overengineering guidance,同时保持 advisory,不把风格判断变成硬拦截。
44
- - **更轻的 generated reference docs。** 生成和迁移的仓库写入确定性的
45
- `docs/reference-configs/*.md` pointer stubs,`.ai/harness/*` `.ai/context/*`
46
- 继续作为 repo-local runtime artifacts
35
+ ## 0.5.0 新特性
36
+
37
+ - **清晰的命令边界。** `repo-harness update` 只负责 user-level CLI/runtime
38
+ 刷新;`repo-harness adopt` 负责 repo-local workflow 安装、刷新和迁移。
39
+ - **Package-dispatched helper runtime。** 生成的 `scripts/*` wrapper 可以通过
40
+ `repo-harness run <helper>` 委派到已安装 package,不必在每个下游仓库复制完整
41
+ helper implementation
42
+ - **8 managed hook routes。** README 现在明确记录 Claude/Codex adapter
43
+ 安装的 route matrix:session context、edit guards、delegated-agent routing、
44
+ post-edit/post-bash observers、always-on trace、prompt routing stop closeout。
45
+ - **发布前安装刷新例子。** First 5 Minutes 明确区分 machine bootstrap、
46
+ user-level update、read-only setup audit 和 repo-local adoption
47
47
 
48
48
  ## 产品做什么
49
49
 
@@ -66,7 +66,7 @@ repo-local hooks,然后验证这些 workflow surfaces 仍然一致。
66
66
 
67
67
  1. **源码包层**:本仓库维护 CLI、CLI-backed command facades、templates、hook assets、
68
68
  workflow contract、tests 和 release gate。
69
- 2. **目标仓库合约层**:`repo-harness update` 或 migration 会写入 `docs/spec.md`、
69
+ 2. **目标仓库合约层**:`repo-harness adopt` 或 migration 会写入 `docs/spec.md`、
70
70
  `plans/`、`tasks/`、`.ai/context/`、`.ai/harness/`、helper scripts 和
71
71
  `.ai/hooks/`。
72
72
  3. **Host adapter 层**:user-level `~/.claude/settings.json` 和 `~/.codex/hooks.json`
@@ -189,25 +189,42 @@ skill aliases,安装 user-level hook adapters,配置 Waza runtime skills,
189
189
  root 持久化到 `~/.repo-harness/config.json`,并配置 CodeGraph MCP。它不会把当前目录
190
190
  默认迁移成 repo-local workflow。
191
191
 
192
- 如果要让 Agent 做只读 bootstrap audit,运行 `npx -y repo-harness init-hook
193
- --json`;需要版本提示时加 `--check-updates`。`init-hook` 不是 runtime hook:
192
+ 如果要让 Agent 做只读 bootstrap audit,运行 `npx -y repo-harness setup check
193
+ --json`;需要版本提示时加 `--check-updates`。`setup check` 不是 runtime hook:
194
194
  它不会写 user-level files、安装更新或注册 adapters,只输出带 reason、risk、
195
195
  targets、可选 command 和 verification 的 `agent_actions`,由 Agent 再显式执行。
196
+ `repo-harness init-hook` 保留为兼容 alias。
197
+
198
+ ### 安装和刷新例子
199
+
200
+ ```bash
201
+ # 首次机器级 bootstrap:global CLI、skills、host adapters、Waza、brain、CodeGraph。
202
+ npx -y repo-harness init
203
+
204
+ # 包更新后刷新 user-level CLI/runtime。
205
+ repo-harness update
206
+
207
+ # 只读检查需要 agent 修复什么,不写文件。
208
+ repo-harness update --check
209
+
210
+ # 刷新已接入仓库里的 repo-local workflow 文件。
211
+ repo-harness adopt --repo /path/to/repo
212
+ ```
196
213
 
197
214
  ### 2. 预览 repo-local contract
198
215
 
199
216
  ```bash
200
- npx -y repo-harness update --dry-run
217
+ npx -y repo-harness adopt --dry-run
201
218
  ```
202
219
 
203
220
  在目标仓库根目录运行 dry-run。它会报告将要创建或刷新的 spec、task state、
204
221
  helper runtime、hook adapter target 和 verification files。它不会创建应用技术栈;
205
- 已有仓库走 `repo-harness update`,新项目或新模块走 `repo-harness-scaffold`。
222
+ 已有仓库走 `repo-harness adopt`,新项目或新模块走 `repo-harness-scaffold`。
206
223
 
207
224
  ### 3. 应用后验证 workflow
208
225
 
209
226
  ```bash
210
- npx -y repo-harness update
227
+ npx -y repo-harness adopt
211
228
  bash scripts/check-task-workflow.sh --strict
212
229
  bun test
213
230
  ```
@@ -247,17 +264,17 @@ symlink-backed runtime entrypoints。退休的 `repo-harness-skill` 与
247
264
  已有仓库从 repo root 执行:
248
265
 
249
266
  ```bash
250
- npx -y repo-harness update --dry-run
267
+ npx -y repo-harness adopt --dry-run
251
268
  ```
252
269
 
253
270
  dry-run 报告正确后再应用:
254
271
 
255
272
  ```bash
256
- npx -y repo-harness update
273
+ npx -y repo-harness adopt
257
274
  ```
258
275
 
259
276
  新项目或新模块使用支线 command `repo-harness-scaffold`。已有仓库使用
260
- `repo-harness update`;它会安装或刷新 harness,不会创建应用技术栈。
277
+ `repo-harness adopt`;它会安装或刷新 harness,不会创建应用技术栈。
261
278
 
262
279
  ### 成功长什么样
263
280
 
@@ -343,8 +360,8 @@ hook block 工作时,先看 terminal 里的结构化输出。核心字段是
343
360
 
344
361
  ## 当前 Release
345
362
 
346
- - npm package:`repo-harness@0.4.3`
347
- - Generated workflow stamp:`repo-harness@0.4.3+template@0.4.3`
363
+ - npm package:`repo-harness@0.5.0`
364
+ - Generated workflow stamp:`repo-harness@0.5.0+template@0.5.0`
348
365
  - GitHub repository:`Ancienttwo/repo-harness`
349
366
  - Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
350
367
 
@@ -401,7 +418,7 @@ Co-authored-by: codex <codex@openai.com>
401
418
  - Repo workflow actions:`repo-harness-ship`、`repo-harness-init`、`repo-harness-migrate`、`repo-harness-upgrade`、`repo-harness-capability`、`repo-harness-architecture`、`repo-harness-handoff`、`repo-harness-deploy`、`repo-harness-repair`、`repo-harness-check`
402
419
  - 支线项目创建 command:`repo-harness-scaffold`
403
420
 
404
- `repo-harness update` 用于已有仓库;`repo-harness-scaffold` 作为支线 command 创建新项目或模块。
421
+ `repo-harness adopt` 用于已有仓库;`repo-harness-scaffold` 作为支线 command 创建新项目或模块。
405
422
  `hooks-init`、`docs-init` 和 `create-project-dirs` 是内部步骤,不是公共 commands。
406
423
 
407
424
  `repo-harness-scaffold` 保持 A-K plan catalog 作为项目类型 authority;AI-native
@@ -0,0 +1,13 @@
1
+ # Functional Block Agent Context
2
+
3
+ Keep this file focused on the local contract for this primary functional block.
4
+
5
+ ## Local Context Contract
6
+
7
+ - Describe only the ownership, boundaries, stable entrypoints, and local verification commands for this functional block.
8
+ - Keep sibling `CLAUDE.md` and `AGENTS.md` files aligned. Claude Code consumes `CLAUDE.md`; Codex consumes `AGENTS.md`.
9
+ - Record the local LSP/tooling profile here when it differs from the repo default.
10
+ - Route deep implementation detail into nearby docs instead of inflating root agent context files.
11
+ - Treat `.ai/context/context-map.json` as the index of discoverable context files.
12
+ - Do not keep pushing context files deeper by default; add lower-level files only for a separately owned functional block with its own commands and invariants.
13
+ - Prefer repo-local workflow artifacts over tool-specific chat memory.
@@ -0,0 +1,13 @@
1
+ # Functional Block Agent Context
2
+
3
+ Keep this file focused on the local contract for this primary functional block.
4
+
5
+ ## Local Context Contract
6
+
7
+ - Describe only the ownership, boundaries, stable entrypoints, and local verification commands for this functional block.
8
+ - Keep sibling `CLAUDE.md` and `AGENTS.md` files aligned. Claude Code consumes `CLAUDE.md`; Codex consumes `AGENTS.md`.
9
+ - Record the local LSP/tooling profile here when it differs from the repo default.
10
+ - Route deep implementation detail into nearby docs instead of inflating root agent context files.
11
+ - Treat `.ai/context/context-map.json` as the index of discoverable context files.
12
+ - Do not keep pushing context files deeper by default; add lower-level files only for a separately owned functional block with its own commands and invariants.
13
+ - Prefer repo-local workflow artifacts over tool-specific chat memory.
@@ -20,11 +20,18 @@ Codex/Claude hook adapters, Waza (`think`, `hunt`, `check`, `health`), brain
20
20
  root persistence, Mermaid, and CodeGraph CLI/MCP configuration. It must not
21
21
  silently install unrelated toolchains or Claude marketplace plugins.
22
22
 
23
+ `repo-harness update` refreshes only the CLI and repo-harness-owned user-level
24
+ runtime by default. Third-party tooling and CodeGraph registration stay
25
+ readiness findings from `repo-harness setup check` unless the update command is
26
+ run with an explicit opt-in such as `--with-external-skills` or
27
+ `--configure-codegraph`.
28
+
23
29
  The cross-review skills are **harness-owned and self-contained** — their source
24
30
  lives in `assets/skills/<skill>/` and they wrap the peer CLI (`codex exec` /
25
31
  `claude -p`) in a read-only sandbox with no gstack dependency, so installing them
26
- is a workflow-owned repo-local update concern, not an unrelated toolchain. They
27
- install host-aware during `repo-harness update`: `codex-review` only into `~/.claude/skills` (a Claude session asking
32
+ is a workflow-owned runtime concern, not an unrelated toolchain. They install
33
+ host-aware during `repo-harness init` and explicit external-skill refreshes:
34
+ `codex-review` only into `~/.claude/skills` (a Claude session asking
28
35
  Codex for an independent review) and `claude-review` only into `~/.codex/skills`
29
36
  (a Codex session asking Claude). When gstack is present, its `/codex` and
30
37
  `gstack-claude` skills are a more featureful superset; the harness skills are the
@@ -4,7 +4,7 @@ This repo uses a shared long-running harness. The durable workflow lives in repo
4
4
 
5
5
  ## Adoption Model
6
6
 
7
- Use this file as the first onboarding map after `repo-harness update` installs
7
+ Use this file as the first onboarding map after `repo-harness adopt` installs
8
8
  or refreshes a repo. The harness gives agents three durable surfaces:
9
9
 
10
10
  - **Shared standards**: `docs/spec.md`, `docs/reference-configs/`, root
@@ -14,7 +14,7 @@ Start with the shortest truth path:
14
14
  Central-first means one `install` (or one CLI upgrade) updates hook behavior for every trusted opt-in repo at once; vendored `.ai/hooks` copies are inert defaults unless the repo pins `"hook_source": "repo"`. Missing advisory scripts warn and skip, but required guard routes still fail closed. `repo-harness doctor` and `scripts/repo-harness.sh status` report which source is active for the current repo.
15
15
  Generated host adapter commands carry a 30 second timeout; long-running work belongs in explicit CLI commands, not hook foreground execution.
16
16
 
17
- `repo-harness update`, migration, and new-project scaffold paths do not copy the full hook runtime into ordinary downstream repos. Without a `"hook_source": "repo"` pin they prune stale top-level `.ai/hooks/*.sh` entry scripts and refresh only `.ai/hooks/lib/` helper libraries plus a README tombstone, because active execution should come from the user-level adapter and packaged hooks. Repos that intentionally develop or override hooks must set `"hook_source": "repo"` before syncing a full vendored hook runtime.
17
+ `repo-harness adopt`, migration, and new-project scaffold paths do not copy the full hook runtime into ordinary downstream repos. Without a `"hook_source": "repo"` pin they prune stale top-level `.ai/hooks/*.sh` entry scripts and refresh only `.ai/hooks/lib/` helper libraries plus a README tombstone, because active execution should come from the user-level adapter and packaged hooks. Repos that intentionally develop or override hooks must set `"hook_source": "repo"` before syncing a full vendored hook runtime.
18
18
 
19
19
  `UserPromptSubmit.default` dispatches to the active `prompt-guard.sh` resolved by the central-first hook source decision. For ordinary repos that means the packaged/user-level runtime; `.ai/hooks/prompt-guard.sh` is active only when the repo pins `"hook_source": "repo"`. The shell layer parses host prompt JSON, reads workflow files, performs capture side effects, and renders host-safe output; it pipes `{"prompt": ...}` into `repo-harness-hook prompt-guard-decide`, which owns every prompt-text intent classifier (Unicode-aware, in `src/cli/hook/prompt-intents.ts`) plus the intent x state decision table and returns one verdict JSON line (action, intent facts, derived strings). If the engine is unreachable or predates the protocol, the prompt layer degrades to a one-shot advisory instead of guessing; there is no shell fallback decision table.
20
20
 
@@ -11,18 +11,18 @@ Use this command for an existing repository that needs the repo-local agentic wo
11
11
  ## Protocol
12
12
 
13
13
  1. Confirm the target repo path.
14
- 2. If running from the target repo root, use `repo-harness update`; do not require `--repo .`.
14
+ 2. If running from the target repo root, use `repo-harness adopt`; do not require `--repo .`.
15
15
  3. Run `bun scripts/inspect-project-state.ts --repo <repo> --format text`.
16
16
  4. If the repo is legacy, route to `repo-harness-migrate`.
17
- 5. Otherwise run the safe path through `repo-harness update` or `bash scripts/migrate-project-template.sh --repo <repo> --apply`.
18
- 6. Bootstrap the expected host runtime dependencies in the same pass: Waza (`think`, `hunt`, `check`, `health`) and the bundled cross-review skills when source copies are available.
17
+ 5. Otherwise run the safe path through `repo-harness adopt` or `bash scripts/migrate-project-template.sh --repo <repo> --apply`.
18
+ 6. If user-level runtime dependencies are missing, run `repo-harness update` separately; repo adoption must not write HOME.
19
19
  7. Verify with `bash .ai/harness/scripts/check-task-workflow.sh --strict` inside the target repo when the helper exists.
20
20
 
21
21
  ## Failure Modes
22
22
 
23
23
  - If the repo has legacy workflow docs, route to `repo-harness-migrate`.
24
24
  - If the user asks for a new product skeleton, route to `repo-harness-scaffold`.
25
- - If global runtime setup fails, report the exact target and rerun the focused install command.
25
+ - If global runtime setup is missing, report the exact target and rerun the focused `repo-harness update` command.
26
26
 
27
27
  ## Boundaries
28
28