repo-harness 0.8.4 → 0.9.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 (90) hide show
  1. package/AGENTS.md +18 -14
  2. package/CLAUDE.md +18 -14
  3. package/README.es.md +3 -3
  4. package/README.fr.md +3 -3
  5. package/README.ja.md +3 -3
  6. package/README.md +20 -7
  7. package/README.zh-CN.md +9 -3
  8. package/assets/AGENTS.md +5 -5
  9. package/assets/CLAUDE.md +5 -5
  10. package/assets/hooks/AGENTS.md +7 -7
  11. package/assets/hooks/CLAUDE.md +7 -7
  12. package/assets/hooks/codex-delegation-advisor.sh +38 -5
  13. package/assets/hooks/lib/workflow-state.sh +30 -5
  14. package/assets/hooks/prompt-guard.sh +4 -4
  15. package/assets/hooks/stop-orchestrator.sh +9 -1
  16. package/assets/hooks/subagent-start-context.sh +8 -0
  17. package/assets/reference-configs/agentic-development-flow.md +1 -1
  18. package/assets/reference-configs/external-tooling.md +241 -0
  19. package/assets/reference-configs/global-working-rules.md +8 -2
  20. package/assets/reference-configs/sprint-contracts.md +13 -0
  21. package/assets/skill-commands/manifest.json +1 -1
  22. package/assets/skill-commands/repo-harness-check/SKILL.md +8 -0
  23. package/assets/skill-commands/repo-harness-plan/SKILL.md +6 -0
  24. package/assets/skill-commands/repo-harness-prd/SKILL.md +15 -10
  25. package/assets/skill-commands/repo-harness-review/SKILL.md +4 -0
  26. package/assets/skill-commands/repo-harness-sprint/SKILL.md +4 -0
  27. package/assets/skill-version.json +10 -2
  28. package/assets/templates/contract.template.md +34 -1
  29. package/assets/templates/design-brief.template.md +75 -0
  30. package/assets/templates/helpers/capability-config.ts +4 -29
  31. package/assets/templates/helpers/capability-resolver.ts +66 -13
  32. package/assets/templates/helpers/check-agent-tooling.sh +152 -0
  33. package/assets/templates/helpers/contract-run.ts +336 -8
  34. package/assets/templates/helpers/ensure-task-workflow.sh +165 -8
  35. package/assets/templates/helpers/harness-trace-grade.sh +1 -1
  36. package/assets/templates/helpers/inspect-project-state.ts +12 -0
  37. package/assets/templates/helpers/install-agent-fleet.sh +223 -0
  38. package/assets/templates/helpers/plan-to-todo.sh +140 -6
  39. package/assets/templates/helpers/sprint-backlog.sh +16 -1
  40. package/assets/templates/helpers/verify-contract.sh +175 -1
  41. package/assets/templates/helpers/verify-sprint.sh +68 -0
  42. package/assets/templates/helpers/workflow-contract.ts +1 -0
  43. package/assets/templates/implementation-notes.template.md +4 -0
  44. package/assets/templates/prd.template.md +8 -1
  45. package/assets/templates/review.template.md +1 -1
  46. package/assets/workflow-contract.v1.json +1 -0
  47. package/package.json +1 -1
  48. package/scripts/AGENTS.md +68 -0
  49. package/scripts/CLAUDE.md +68 -0
  50. package/scripts/archive-workflow.sh +6 -3
  51. package/scripts/capability-config.ts +4 -29
  52. package/scripts/capability-resolver.ts +66 -13
  53. package/scripts/check-agent-tooling.sh +152 -0
  54. package/scripts/check-tarball-install-smoke.sh +27 -0
  55. package/scripts/contract-run.ts +336 -8
  56. package/scripts/ensure-task-workflow.sh +165 -8
  57. package/scripts/harness-trace-grade.sh +1 -1
  58. package/scripts/init-project.sh +1 -0
  59. package/scripts/initializer-question-pack.ts +5 -4
  60. package/scripts/inspect-project-state.ts +12 -0
  61. package/scripts/install-agent-fleet.sh +223 -0
  62. package/scripts/lib/project-init-lib.sh +153 -14
  63. package/scripts/migrate-project-template.sh +1 -0
  64. package/scripts/new-spec.sh +3 -1
  65. package/scripts/new-sprint.sh +6 -3
  66. package/scripts/plan-to-todo.sh +140 -6
  67. package/scripts/route-nl-vs-ts-eval.ts +12 -7
  68. package/scripts/sprint-backlog.sh +16 -1
  69. package/scripts/switch-plan.sh +3 -1
  70. package/scripts/verify-contract.sh +175 -1
  71. package/scripts/verify-sprint.sh +71 -1
  72. package/scripts/workflow-contract.ts +1 -0
  73. package/src/cli/chatgpt-browser/file-policy.ts +45 -3
  74. package/src/cli/chatgpt-browser/native-provider.ts +8 -8
  75. package/src/cli/commands/capability-context.ts +17 -39
  76. package/src/cli/commands/global-runtime.ts +84 -5
  77. package/src/cli/commands/init.ts +68 -40
  78. package/src/cli/commands/security.ts +5 -5
  79. package/src/cli/commands/validators.ts +74 -0
  80. package/src/cli/hook/minimal-change-context.ts +1 -0
  81. package/src/cli/hook/prompt-guard-decision.ts +12 -12
  82. package/src/cli/hook/review-rubric.ts +4 -3
  83. package/src/cli/index.ts +100 -77
  84. package/src/cli/mcp/general-repo-access.ts +8 -6
  85. package/src/cli/mcp/server.ts +1 -1
  86. package/src/cli/mcp/tools.ts +20 -1
  87. package/src/cli/mcp/transports/http.ts +2 -2
  88. package/src/cli/tty-prompt.ts +28 -0
  89. package/assets/templates/AGENTS.md +0 -13
  90. package/assets/templates/CLAUDE.md +0 -13
package/AGENTS.md CHANGED
@@ -36,6 +36,7 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
36
36
  - Treat `deploy/` as the trackable deployment and operations surface for runbooks, submission materials, release checklists, helper scripts, ordered SQL files under `deploy/sql/`, and env examples.
37
37
  - Treat `_ops/` as ignored local operations state for secrets, real env files, provider state, artifacts, logs, and scratch files; do not commit or agent-edit `_ops/*`.
38
38
  - Treat contract-level task execution as worktree-first: `repo-harness run plan-to-todo --plan <approved-plan>` starts `repo-harness run contract-worktree start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `repo-harness run contract-worktree finish`.
39
+ - Treat the EXECUTION_BOUNDARY anti-extras clause as mandatory on every delegated runner surface (contract worker prompts, the Codex delegation advisor hook, subagent start context, and MCP `codex-goal` documents): absent requirements are forbidden design space, not permission to improve, and unrequested extras fail closed.
39
40
  - After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete work-package plan, capture it with `repo-harness run capture-plan --artifact-level work-package --slug <slug> --title <title>` so `plans/` becomes the file-backed source of truth; if the user has already approved implementation, capture with `--status Approved --execute --promotion-reason <merge_boundary|rollback_boundary|verification_boundary|risk_boundary|human_decision_boundary|worktree_boundary>` or run `repo-harness run plan-to-todo --plan <active-plan>`.
40
41
  - Promote work into a top-level `plans/plan-*.md` only when `Artifact Level: work-package` is justified by a merge/PR unit, rollback surface, independent verification boundary, review/acceptance boundary, high-risk surface, or otherwise cannot remain a checklist item in the current active plan or sprint backlog. Inline sprint rows and checklist rows stay in the sprint backlog or active plan `## Task Breakdown`; contract rows may expand into plan -> contract -> review -> notes only through the work-package gate.
41
42
  - If current repo state conflicts with the task, open an isolated `codex/<task-slug>` worktree, finish there, run Waza `/check`-style validation, then merge back to `main` without absorbing unrelated dirty changes.
@@ -63,35 +64,38 @@ bash scripts/migrate-project-template.sh --repo . --dry-run
63
64
  <!-- BEGIN ARCHITECTURE CONTRACT -->
64
65
  ## Architecture Contract
65
66
 
66
- - Functional block: `.ai/hooks`
67
- - Capability ID: `runtime-harness-hook-adapters`
68
- - Matched prefix: `.ai/hooks`
69
- - Architecture domain: `runtime-harness`
70
- - Architecture capability: `hook-adapters`
71
- - Architecture module: `docs/architecture/modules/runtime-harness/hook-adapters.md`
72
- - Last architecture event: 2026-05-29T09:44:46+0800
73
- - Last changed path: `.ai/hooks/session-start-context.sh`
67
+ - Functional block: `scripts/inspect-project-state.ts`
68
+ - Capability ID: `workflow-engine-inspection-migration`
69
+ - Matched prefix: `scripts/inspect-project-state.ts`
70
+ - Architecture domain: `workflow-engine`
71
+ - Architecture capability: `inspection-migration`
72
+ - Architecture module: `docs/architecture/modules/workflow-engine/inspection-migration.md`
73
+ - Last architecture event: 2026-07-03T15:44:54+0800
74
+ - Last changed path: `docs/architecture/requests/archive/2026/workflow-engine-inspection-migration.md`
74
75
  - Severity: high
75
- - Change type: workflow-surface
76
+ - Change type: architecture-closeout
76
77
  - Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
77
- - Entrypoints: `.ai/hooks`
78
+ - Entrypoints: `scripts/inspect-project-state.ts`
78
79
  - Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
79
80
  - Forbidden dependencies: Do not cross sibling app/service/package boundaries without an architecture snapshot or explicit plan.
80
- - Runtime path: `.ai/hooks`
81
+ - Runtime path: `scripts/inspect-project-state.ts`
81
82
  - LSP/tooling profile: `typescript-lsp`
82
83
  - Verification: Use root required checks plus local commands recorded in this capability contract.
83
84
  - Latest snapshot: `(none yet)`
84
- - Semantic diagram source: `docs/architecture/modules/runtime-harness/hook-adapters.md`
85
+ - Semantic diagram source: `docs/architecture/modules/workflow-engine/inspection-migration.md`
85
86
  - Latest human diagram: `(none yet)`
86
87
  - Pending architecture request: `(none)`
87
88
 
88
89
  ## Active Workstreams
89
90
 
90
- - (none yet)
91
+ - `tasks/workstreams/workflow-engine/inspection-migration/20260703-inspection-migration.md`
92
+ - status: active
93
+ - current_slice: completed-20260703-architecture-closeout
94
+ - source_plan: (none)
91
95
 
92
96
  ## Current Session Projection
93
97
 
94
- - Durable progress lives under `tasks/workstreams/runtime-harness/hook-adapters`.
98
+ - Durable progress lives under `tasks/workstreams/workflow-engine/inspection-migration`.
95
99
  - `tasks/current.md` is the tracked derived status snapshot; it is not a live lock or task source.
96
100
  - `tasks/todos.md` is the deferred-goal ledger; current execution slices stay in the active plan's `## Task Breakdown`.
97
101
  <!-- END ARCHITECTURE CONTRACT -->
package/CLAUDE.md CHANGED
@@ -36,6 +36,7 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
36
36
  - Treat `deploy/` as the trackable deployment and operations surface for runbooks, submission materials, release checklists, helper scripts, ordered SQL files under `deploy/sql/`, and env examples.
37
37
  - Treat `_ops/` as ignored local operations state for secrets, real env files, provider state, artifacts, logs, and scratch files; do not commit or agent-edit `_ops/*`.
38
38
  - Treat contract-level task execution as worktree-first: `repo-harness run plan-to-todo --plan <approved-plan>` starts `repo-harness run contract-worktree start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `repo-harness run contract-worktree finish`.
39
+ - Treat the EXECUTION_BOUNDARY anti-extras clause as mandatory on every delegated runner surface (contract worker prompts, the Codex delegation advisor hook, subagent start context, and MCP `codex-goal` documents): absent requirements are forbidden design space, not permission to improve, and unrequested extras fail closed.
39
40
  - After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete work-package plan, capture it with `repo-harness run capture-plan --artifact-level work-package --slug <slug> --title <title>` so `plans/` becomes the file-backed source of truth; if the user has already approved implementation, capture with `--status Approved --execute --promotion-reason <merge_boundary|rollback_boundary|verification_boundary|risk_boundary|human_decision_boundary|worktree_boundary>` or run `repo-harness run plan-to-todo --plan <active-plan>`.
40
41
  - Promote work into a top-level `plans/plan-*.md` only when `Artifact Level: work-package` is justified by a merge/PR unit, rollback surface, independent verification boundary, review/acceptance boundary, high-risk surface, or otherwise cannot remain a checklist item in the current active plan or sprint backlog. Inline sprint rows and checklist rows stay in the sprint backlog or active plan `## Task Breakdown`; contract rows may expand into plan -> contract -> review -> notes only through the work-package gate.
41
42
  - If current repo state conflicts with the task, open an isolated `codex/<task-slug>` worktree, finish there, run Waza `/check`-style validation, then merge back to `main` without absorbing unrelated dirty changes.
@@ -63,35 +64,38 @@ bash scripts/migrate-project-template.sh --repo . --dry-run
63
64
  <!-- BEGIN ARCHITECTURE CONTRACT -->
64
65
  ## Architecture Contract
65
66
 
66
- - Functional block: `.ai/hooks`
67
- - Capability ID: `runtime-harness-hook-adapters`
68
- - Matched prefix: `.ai/hooks`
69
- - Architecture domain: `runtime-harness`
70
- - Architecture capability: `hook-adapters`
71
- - Architecture module: `docs/architecture/modules/runtime-harness/hook-adapters.md`
72
- - Last architecture event: 2026-05-29T09:44:46+0800
73
- - Last changed path: `.ai/hooks/session-start-context.sh`
67
+ - Functional block: `scripts/inspect-project-state.ts`
68
+ - Capability ID: `workflow-engine-inspection-migration`
69
+ - Matched prefix: `scripts/inspect-project-state.ts`
70
+ - Architecture domain: `workflow-engine`
71
+ - Architecture capability: `inspection-migration`
72
+ - Architecture module: `docs/architecture/modules/workflow-engine/inspection-migration.md`
73
+ - Last architecture event: 2026-07-03T15:44:54+0800
74
+ - Last changed path: `docs/architecture/requests/archive/2026/workflow-engine-inspection-migration.md`
74
75
  - Severity: high
75
- - Change type: workflow-surface
76
+ - Change type: architecture-closeout
76
77
  - Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
77
- - Entrypoints: `.ai/hooks`
78
+ - Entrypoints: `scripts/inspect-project-state.ts`
78
79
  - Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
79
80
  - Forbidden dependencies: Do not cross sibling app/service/package boundaries without an architecture snapshot or explicit plan.
80
- - Runtime path: `.ai/hooks`
81
+ - Runtime path: `scripts/inspect-project-state.ts`
81
82
  - LSP/tooling profile: `typescript-lsp`
82
83
  - Verification: Use root required checks plus local commands recorded in this capability contract.
83
84
  - Latest snapshot: `(none yet)`
84
- - Semantic diagram source: `docs/architecture/modules/runtime-harness/hook-adapters.md`
85
+ - Semantic diagram source: `docs/architecture/modules/workflow-engine/inspection-migration.md`
85
86
  - Latest human diagram: `(none yet)`
86
87
  - Pending architecture request: `(none)`
87
88
 
88
89
  ## Active Workstreams
89
90
 
90
- - (none yet)
91
+ - `tasks/workstreams/workflow-engine/inspection-migration/20260703-inspection-migration.md`
92
+ - status: active
93
+ - current_slice: completed-20260703-architecture-closeout
94
+ - source_plan: (none)
91
95
 
92
96
  ## Current Session Projection
93
97
 
94
- - Durable progress lives under `tasks/workstreams/runtime-harness/hook-adapters`.
98
+ - Durable progress lives under `tasks/workstreams/workflow-engine/inspection-migration`.
95
99
  - `tasks/current.md` is the tracked derived status snapshot; it is not a live lock or task source.
96
100
  - `tasks/todos.md` is the deferred-goal ledger; current execution slices stay in the active plan's `## Task Breakdown`.
97
101
  <!-- END ARCHITECTURE CONTRACT -->
package/README.es.md CHANGED
@@ -85,7 +85,7 @@ artifacts.
85
85
  ## Novedades
86
86
 
87
87
  Las notas de versión viven en [`docs/CHANGELOG.md`](docs/CHANGELOG.md). La línea
88
- actual es `0.8.4`.
88
+ actual es `0.9.0`.
89
89
 
90
90
  ## Cómo funciona
91
91
 
@@ -419,8 +419,8 @@ Guards habituales:
419
419
 
420
420
  ## Release actual
421
421
 
422
- - npm package: `repo-harness@0.8.4`
423
- - Generated workflow stamp: `repo-harness@0.8.4+template@0.8.4`
422
+ - npm package: `repo-harness@0.9.0`
423
+ - Generated workflow stamp: `repo-harness@0.9.0+template@0.9.0`
424
424
  - GitHub repository: `Ancienttwo/repo-harness`
425
425
  - Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
426
426
 
package/README.fr.md CHANGED
@@ -85,7 +85,7 @@ l'emportent.
85
85
  ## Nouveautés
86
86
 
87
87
  Les notes de version vivent dans [`docs/CHANGELOG.md`](docs/CHANGELOG.md). La
88
- ligne actuelle est `0.8.4`.
88
+ ligne actuelle est `0.9.0`.
89
89
 
90
90
  ## Comment ça marche
91
91
 
@@ -424,8 +424,8 @@ Guards courants :
424
424
 
425
425
  ## Release actuelle
426
426
 
427
- - npm package : `repo-harness@0.8.4`
428
- - Generated workflow stamp : `repo-harness@0.8.4+template@0.8.4`
427
+ - npm package : `repo-harness@0.9.0`
428
+ - Generated workflow stamp : `repo-harness@0.9.0+template@0.9.0`
429
429
  - GitHub repository : `Ancienttwo/repo-harness`
430
430
  - Release history : [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
431
431
 
package/README.ja.md CHANGED
@@ -75,7 +75,7 @@ review、checks、handoff と食い違う場合は、source artifacts を優先
75
75
  ## What's New
76
76
 
77
77
  リリースノートは [`docs/CHANGELOG.md`](docs/CHANGELOG.md) にあります。現在の
78
- ラインは `0.8.4` です。
78
+ ラインは `0.9.0` です。
79
79
 
80
80
  ## 仕組み
81
81
 
@@ -398,8 +398,8 @@ hook がブロックしたときは、まず terminal の構造化された出
398
398
 
399
399
  ## 現在の Release
400
400
 
401
- - npm package:`repo-harness@0.8.4`
402
- - Generated workflow stamp:`repo-harness@0.8.4+template@0.8.4`
401
+ - npm package:`repo-harness@0.9.0`
402
+ - Generated workflow stamp:`repo-harness@0.9.0+template@0.9.0`
403
403
  - GitHub repository:`Ancienttwo/repo-harness`
404
404
  - Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
405
405
 
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-gptpro.png" alt="repo-harness architecture and ChatGPT Pro local planner workflow diagram" width="960">
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">
5
5
  </p>
6
6
 
7
7
  `repo-harness` turns Claude/Codex coding sessions into a repeatable repo-local
@@ -61,6 +61,12 @@ rollback. Then inspect the active contract, latest trace in
61
61
  review recommends pass, the card verdict is pass, and external acceptance is
62
62
  pass, `not_required`, or an explicit manual override.
63
63
 
64
+ Runtime-heavy validators such as Unity, browser E2E, mobile simulators, hardware
65
+ rigs, or staging smoke tests can publish external verification manifests under
66
+ the ignored run-evidence surface. This is a manual convention today, not an
67
+ automatic `repo-harness check` discovery or gate. See
68
+ [`docs/reference-configs/external-tooling.md`](docs/reference-configs/external-tooling.md#external-verification-evidence).
69
+
64
70
  ## Agent Tracking Path
65
71
 
66
72
  Agents read source artifacts before derived summaries:
@@ -79,7 +85,7 @@ active plan, contract, review, checks, or handoff, the source artifacts win.
79
85
  ## What's New
80
86
 
81
87
  Release notes live in [`docs/CHANGELOG.md`](docs/CHANGELOG.md). The current line
82
- is `0.8.4`.
88
+ is `0.9.0`.
83
89
 
84
90
  ## How It Works
85
91
 
@@ -93,6 +99,10 @@ The design has three layers:
93
99
  3. **Host adapters**: user-level `~/.claude/settings.json` and
94
100
  `~/.codex/hooks.json` route Claude/Codex events into `repo-harness-hook`.
95
101
 
102
+ <p align="center">
103
+ <img src="docs/images/repo-harness-gptpro.png" alt="repo-harness architecture and ChatGPT Pro local planner workflow diagram" width="960">
104
+ </p>
105
+
96
106
  The hook entrypoint exits silently for non-opt-in repos. For opted-in repos,
97
107
  it resolves hooks central-first through the packaged install or
98
108
  `~/.repo-harness/hooks/`, with repo policy able to pin self-host development
@@ -269,9 +279,12 @@ repo-harness install
269
279
  `install` is the first-run global bootstrap path. It installs the current npm
270
280
  package as the global CLI, refreshes repo-harness skill aliases, installs
271
281
  user-level hook adapters, configures Waza runtime skills, persists a brain root
272
- under `~/.repo-harness/config.json`, and configures CodeGraph MCP. It does not
273
- apply repo-local workflow files to the current directory. `repo-harness init`
274
- remains a compatibility alias for existing scripts.
282
+ under `~/.repo-harness/config.json`, and configures CodeGraph MCP. In an
283
+ interactive terminal it asks Y/n before installing the external skills and
284
+ CodeGraph pieces (Enter keeps today's default of installing both); non-TTY
285
+ runs and `--json` stay unprompted with the same default-on behavior. It does
286
+ not apply repo-local workflow files to the current directory. `repo-harness
287
+ init` remains a compatibility alias for existing scripts.
275
288
 
276
289
  For an Agent-owned, read-only bootstrap audit, run `repo-harness setup check
277
290
  --json` or add `--check-updates` for version advisories. `setup check` is
@@ -599,8 +612,8 @@ Most common guards:
599
612
 
600
613
  ## Current Release
601
614
 
602
- - npm package: `repo-harness@0.8.4`
603
- - Generated workflow stamp: `repo-harness@0.8.4+template@0.8.4`
615
+ - npm package: `repo-harness@0.9.0`
616
+ - Generated workflow stamp: `repo-harness@0.9.0+template@0.9.0`
604
617
  - GitHub repository: `Ancienttwo/repo-harness`
605
618
  - Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
606
619
 
package/README.zh-CN.md CHANGED
@@ -52,6 +52,12 @@ verdict、change type、预期/实际改动文件、已通过命令、external a
52
52
  recommend pass、card verdict 为 pass,且 external acceptance 为 pass、not_required
53
53
  或明确 manual override 时,才进入 closeout。
54
54
 
55
+ Unity、浏览器 E2E、mobile simulator、硬件测试和 staging smoke test 这类
56
+ 运行时重验证器,可以把 external verification manifest 写到被忽略的 run-evidence
57
+ surface。当前这只是手动约定,不是 `repo-harness check` 已经会自动发现或 gate
58
+ 的能力。详见
59
+ [`docs/reference-configs/external-tooling.md`](docs/reference-configs/external-tooling.md#external-verification-evidence)。
60
+
55
61
  ## Agent Tracking Path
56
62
 
57
63
  Agent 先读 source artifacts,再读派生摘要:
@@ -69,7 +75,7 @@ review、checks 或 handoff 冲突,以 source artifacts 为准。
69
75
 
70
76
  ## What's New
71
77
 
72
- Release notes 见 [`docs/CHANGELOG.md`](docs/CHANGELOG.md),当前版本线是 `0.8.4`。
78
+ Release notes 见 [`docs/CHANGELOG.md`](docs/CHANGELOG.md),当前版本线是 `0.9.0`。
73
79
 
74
80
  ## 工作原理
75
81
 
@@ -445,8 +451,8 @@ hook block 工作时,先看 terminal 里的结构化输出。核心字段是
445
451
 
446
452
  ## 当前 Release
447
453
 
448
- - npm package:`repo-harness@0.8.4`
449
- - Generated workflow stamp:`repo-harness@0.8.4+template@0.8.4`
454
+ - npm package:`repo-harness@0.9.0`
455
+ - Generated workflow stamp:`repo-harness@0.9.0+template@0.9.0`
450
456
  - GitHub repository:`Ancienttwo/repo-harness`
451
457
  - Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
452
458
 
package/assets/AGENTS.md CHANGED
@@ -37,10 +37,10 @@ Owns the workflow-engine-contract-assets capability boundary declared in .ai/con
37
37
  - Architecture domain: `workflow-engine`
38
38
  - Architecture capability: `contract-assets`
39
39
  - Architecture module: `docs/architecture/modules/workflow-engine/contract-assets.md`
40
- - Last architecture event: 2026-05-29T02:15:07+0800
41
- - Last changed path: `tasks/workstreams/workflow-engine/contract-assets/cleanup-script-policy.md`
42
- - Severity: medium
43
- - Change type: workstream-sync
40
+ - Last architecture event: 2026-07-05T04:35:33+0800
41
+ - Last changed path: `.ai/harness/policy.json`
42
+ - Severity: high
43
+ - Change type: workflow-surface
44
44
  - Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
45
45
  - Entrypoints: `.ai/harness/policy.json`
46
46
  - Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
@@ -63,6 +63,6 @@ Owns the workflow-engine-contract-assets capability boundary declared in .ai/con
63
63
  ## Current Session Projection
64
64
 
65
65
  - Durable progress lives under `tasks/workstreams/workflow-engine/contract-assets`.
66
- - `tasks/current.md` is a tracked derived status snapshot, not a live lock or task source.
66
+ - `tasks/current.md` is the tracked derived status snapshot; it is not a live lock or task source.
67
67
  - `tasks/todos.md` is the deferred-goal ledger; current execution slices stay in the active plan's `## Task Breakdown`.
68
68
  <!-- END ARCHITECTURE CONTRACT -->
package/assets/CLAUDE.md CHANGED
@@ -37,10 +37,10 @@ Owns the workflow-engine-contract-assets capability boundary declared in .ai/con
37
37
  - Architecture domain: `workflow-engine`
38
38
  - Architecture capability: `contract-assets`
39
39
  - Architecture module: `docs/architecture/modules/workflow-engine/contract-assets.md`
40
- - Last architecture event: 2026-05-29T02:15:07+0800
41
- - Last changed path: `tasks/workstreams/workflow-engine/contract-assets/cleanup-script-policy.md`
42
- - Severity: medium
43
- - Change type: workstream-sync
40
+ - Last architecture event: 2026-07-05T04:35:33+0800
41
+ - Last changed path: `.ai/harness/policy.json`
42
+ - Severity: high
43
+ - Change type: workflow-surface
44
44
  - Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
45
45
  - Entrypoints: `.ai/harness/policy.json`
46
46
  - Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
@@ -63,6 +63,6 @@ Owns the workflow-engine-contract-assets capability boundary declared in .ai/con
63
63
  ## Current Session Projection
64
64
 
65
65
  - Durable progress lives under `tasks/workstreams/workflow-engine/contract-assets`.
66
- - `tasks/current.md` is a tracked derived status snapshot, not a live lock or task source.
66
+ - `tasks/current.md` is the tracked derived status snapshot; it is not a live lock or task source.
67
67
  - `tasks/todos.md` is the deferred-goal ledger; current execution slices stay in the active plan's `## Task Breakdown`.
68
68
  <!-- END ARCHITECTURE CONTRACT -->
@@ -37,27 +37,27 @@ Owns the runtime-harness-hook-adapters capability boundary declared in .ai/conte
37
37
  ## Refresh Hints
38
38
 
39
39
  - `bun test tests/hook-runtime.test.ts tests/hook-contracts.test.ts tests/workflow-contract.test.ts`
40
- - `repo-harness run check-task-workflow --strict`
40
+ - `bash scripts/check-task-workflow.sh --strict`
41
41
  <!-- END CAPABILITY CONTEXT -->
42
42
 
43
43
  <!-- BEGIN ARCHITECTURE CONTRACT -->
44
44
  ## Architecture Contract
45
45
 
46
- - Functional block: `.ai/hooks`
46
+ - Functional block: `assets/hooks`
47
47
  - Capability ID: `runtime-harness-hook-adapters`
48
- - Matched prefix: `.ai/hooks`
48
+ - Matched prefix: `assets/hooks`
49
49
  - Architecture domain: `runtime-harness`
50
50
  - Architecture capability: `hook-adapters`
51
51
  - Architecture module: `docs/architecture/modules/runtime-harness/hook-adapters.md`
52
- - Last architecture event: 2026-06-13T00:04:13+0800
53
- - Last changed path: `.ai/hooks/post-tool-observer.sh`
52
+ - Last architecture event: 2026-07-05T13:45:11+0800
53
+ - Last changed path: `assets/hooks/codex-delegation-advisor.sh`
54
54
  - Severity: high
55
55
  - Change type: workflow-surface
56
56
  - Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
57
- - Entrypoints: `.ai/hooks`
57
+ - Entrypoints: `assets/hooks`
58
58
  - Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
59
59
  - Forbidden dependencies: Do not cross sibling app/service/package boundaries without an architecture snapshot or explicit plan.
60
- - Runtime path: `.ai/hooks`
60
+ - Runtime path: `assets/hooks`
61
61
  - LSP/tooling profile: `typescript-lsp`
62
62
  - Verification: Use root required checks plus local commands recorded in this capability contract.
63
63
  - Latest snapshot: `(none yet)`
@@ -37,27 +37,27 @@ Owns the runtime-harness-hook-adapters capability boundary declared in .ai/conte
37
37
  ## Refresh Hints
38
38
 
39
39
  - `bun test tests/hook-runtime.test.ts tests/hook-contracts.test.ts tests/workflow-contract.test.ts`
40
- - `repo-harness run check-task-workflow --strict`
40
+ - `bash scripts/check-task-workflow.sh --strict`
41
41
  <!-- END CAPABILITY CONTEXT -->
42
42
 
43
43
  <!-- BEGIN ARCHITECTURE CONTRACT -->
44
44
  ## Architecture Contract
45
45
 
46
- - Functional block: `.ai/hooks`
46
+ - Functional block: `assets/hooks`
47
47
  - Capability ID: `runtime-harness-hook-adapters`
48
- - Matched prefix: `.ai/hooks`
48
+ - Matched prefix: `assets/hooks`
49
49
  - Architecture domain: `runtime-harness`
50
50
  - Architecture capability: `hook-adapters`
51
51
  - Architecture module: `docs/architecture/modules/runtime-harness/hook-adapters.md`
52
- - Last architecture event: 2026-06-13T00:04:13+0800
53
- - Last changed path: `.ai/hooks/post-tool-observer.sh`
52
+ - Last architecture event: 2026-07-05T13:45:11+0800
53
+ - Last changed path: `assets/hooks/codex-delegation-advisor.sh`
54
54
  - Severity: high
55
55
  - Change type: workflow-surface
56
56
  - Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
57
- - Entrypoints: `.ai/hooks`
57
+ - Entrypoints: `assets/hooks`
58
58
  - Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
59
59
  - Forbidden dependencies: Do not cross sibling app/service/package boundaries without an architecture snapshot or explicit plan.
60
- - Runtime path: `.ai/hooks`
60
+ - Runtime path: `assets/hooks`
61
61
  - LSP/tooling profile: `typescript-lsp`
62
62
  - Verification: Use root required checks plus local commands recorded in this capability contract.
63
63
  - Latest snapshot: `(none yet)`
@@ -94,6 +94,25 @@ JSON_INPUT="$input" REPO_ROOT="${HOOK_REPO_ROOT:-$(pwd)}" bun -e '
94
94
  if (!trigger) process.exit(0);
95
95
 
96
96
  const repoRoot = process.env.REPO_ROOT || process.cwd();
97
+
98
+ let policyDelegation = {};
99
+ try {
100
+ policyDelegation =
101
+ JSON.parse(fs.readFileSync(path.join(repoRoot, ".ai", "harness", "policy.json"), "utf8")).delegation || {};
102
+ } catch {
103
+ policyDelegation = {};
104
+ }
105
+ const maxAgents = Number.isInteger(policyDelegation.max_agents) ? policyDelegation.max_agents : 3;
106
+ const maxDepth = Number.isInteger(policyDelegation.max_depth) ? policyDelegation.max_depth : 1;
107
+ const preferredRunners =
108
+ Array.isArray(policyDelegation.preferred_runners) && policyDelegation.preferred_runners.length
109
+ ? policyDelegation.preferred_runners
110
+ : ["subagent"];
111
+ const fallbackRunner =
112
+ typeof policyDelegation.fallback_runner === "string" && policyDelegation.fallback_runner
113
+ ? policyDelegation.fallback_runner
114
+ : null;
115
+
97
116
  const stateDir = path.join(repoRoot, ".ai", "harness", "delegation");
98
117
  fs.mkdirSync(stateDir, { recursive: true });
99
118
 
@@ -107,10 +126,12 @@ JSON_INPUT="$input" REPO_ROOT="${HOOK_REPO_ROOT:-$(pwd)}" bun -e '
107
126
  spawned: false,
108
127
  fallback_used: false,
109
128
  mode: "explicit",
110
- max_agents: 3,
111
- max_depth: 1,
129
+ max_agents: maxAgents,
130
+ max_depth: maxDepth,
112
131
  allow_parallel_writers: false,
113
132
  stop_fallback: true,
133
+ preferred_runners: preferredRunners,
134
+ fallback_runner: fallbackRunner,
114
135
  trigger: trigger.name,
115
136
  prompt_hash: crypto.createHash("sha1").update(prompt).digest("hex"),
116
137
  scope_source: scope?.source || "unscoped",
@@ -132,20 +153,32 @@ JSON_INPUT="$input" REPO_ROOT="${HOOK_REPO_ROOT:-$(pwd)}" bun -e '
132
153
  "",
133
154
  "The current user prompt explicitly enabled bounded delegation.",
134
155
  "",
135
- "If this task contains at least two independent, bounded workstreams, call spawn_agent before doing the corresponding work in the parent.",
156
+ "Treat the active task contract (tasks/contracts/<active-plan-stem>.contract.md) as the authoritative execution brief: Goal, Scope, Allowed Paths, and Exit Criteria. Do not re-derive scope from this conversation.",
157
+ "",
158
+ `Runner preference (policy delegation.preferred_runners): ${preferredRunners.join(", ")}. Native subagent (spawn_agent) is the preferred parallelism accelerator that consumes the contract brief. When spawn_agent is unavailable, sandboxed, or unreliable, degrade to ${fallbackRunner || "main-thread"} on the SAME contract via contract-run. Runner-availability degradation MUST be recorded in the contract-run manifest and MUST NOT silently succeed; it is a runner-availability fallback, not a product-semantics change.`,
159
+ "",
160
+ "If this task contains at least two independent, bounded workstreams, dispatch per the contract before doing the corresponding work in the parent; otherwise run it sequentially.",
136
161
  "",
137
162
  "Rules:",
138
- "- Spawn no more than 3 agents.",
163
+ `- Spawn no more than ${maxAgents} agents.`,
139
164
  "- Use explorer for read-only code mapping.",
140
165
  "- Use worker only for an isolated implementation slice.",
141
166
  "- Use reviewer for correctness, regression, security, and missing-test review.",
142
167
  "- Never give two agents overlapping write ownership.",
143
- "- Keep max spawn depth at 1.",
168
+ `- Keep max spawn depth at ${maxDepth}.`,
144
169
  "- Give every agent a precise scope and required return format.",
145
170
  "- Wait for all requested agents.",
146
171
  "- Reconcile contradictory findings in the parent.",
147
172
  "- Close completed agent threads.",
148
173
  "- Do not spawn for a trivial or strictly sequential task.",
174
+ "",
175
+ "Execution boundary: implement exactly the Goal, In scope items, Allowed Paths, and Exit Criteria in this brief. Treat absent requirements as forbidden design space, not as permission to improve.",
176
+ "",
177
+ "Do not add optional features, alternate UX, extra integrations, migration paths, compatibility behavior, fallback behavior, telemetry, broad cleanup, refactors, new abstractions, extra docs, or polish unless that work is explicitly listed under In scope or required by Exit Criteria.",
178
+ "",
179
+ "If you discover useful additional work, record it under Out of scope / Future work in the notes or review artifact. Do not implement it. Do not end with unsolicited offers to do more work.",
180
+ "",
181
+ "If the requested outcome cannot be completed without expanding scope, fail closed: stop, name the missing decision, and cite the exact file/section that blocks execution.",
149
182
  ].join("\n");
150
183
 
151
184
  process.stdout.write(`${JSON.stringify({
@@ -1317,7 +1317,7 @@ workflow_review_rubric_version() {
1317
1317
 
1318
1318
  # Classify the top-of-file Review Rubric Version. Echoes one of:
1319
1319
  # absent - no rubric line at all (a genuine pre-rubric legacy artifact)
1320
- # 1 - the supported modern rubric version
1320
+ # 1 or 2 - a supported rubric version (1 = legacy, 2 = current)
1321
1321
  # malformed - a rubric line is present but is not a supported version
1322
1322
  # (non-numeric, 0, an unsupported number, or quote/space garbage)
1323
1323
  # A present-but-unsupported rubric means the artifact claims a schema this gate
@@ -1333,8 +1333,8 @@ workflow_review_rubric_class() {
1333
1333
  trimmed="${trimmed%"${trimmed##*[![:space:]]}"}"
1334
1334
  if [[ -z "$trimmed" ]]; then
1335
1335
  printf 'absent'
1336
- elif [[ "$trimmed" == "1" ]]; then
1337
- printf '1'
1336
+ elif [[ "$trimmed" == "1" || "$trimmed" == "2" ]]; then
1337
+ printf '%s' "$trimmed"
1338
1338
  else
1339
1339
  printf 'malformed'
1340
1340
  fi
@@ -1420,7 +1420,7 @@ workflow_review_freshness_status() {
1420
1420
  # path here — the external-acceptance gate is the authority that requires a
1421
1421
  # supported rubric (a rubric-less review fails external acceptance), so absent
1422
1422
  # is still blocked at every Done/finish/verify gate that enforces external.
1423
- if [[ "$rubric_class" == "1" ]]; then
1423
+ if [[ "$rubric_class" != "absent" ]]; then
1424
1424
  printf 'missing\t-\tReview fingerprint is missing for rubric v%s; rerun /check and peer acceptance to record the current Reviewed Diff Fingerprint.\n' "$rubric_class"
1425
1425
  return 0
1426
1426
  fi
@@ -1570,7 +1570,7 @@ workflow_external_acceptance_status() {
1570
1570
  fi
1571
1571
 
1572
1572
  # Bind the peer's acceptance to the exact diff they reviewed. A supported rubric
1573
- # (v1) requires the External Acceptance section to carry its own current Reviewed
1573
+ # (v1+) requires the External Acceptance section to carry its own current Reviewed
1574
1574
  # Diff Fingerprint and scope; otherwise a stale F1 acceptance keeps satisfying the
1575
1575
  # gate after the implementation moves to F2, because the top-of-file fingerprint
1576
1576
  # is agent-editable. An absent or malformed rubric fails closed here — external
@@ -1930,6 +1930,31 @@ ${changed_files}
1930
1930
  \`\`\`
1931
1931
  EOF_HANDOFF
1932
1932
 
1933
+ cat > "$resume_file" <<EOF_RESUME
1934
+ # Codex Resume Packet
1935
+ <!-- generated-by: workflow_write_handoff v1 -->
1936
+
1937
+ > **Generated**: $(date '+%Y-%m-%d %H:%M:%S')
1938
+ > **Reason**: ${reason}
1939
+
1940
+ ## Resume Prompt
1941
+
1942
+ Start a fresh session for this task; do not rely on auto-compact or prior chat history. Read the source artifacts below, then the handoff, before continuing from Exact Next Step.
1943
+
1944
+ - ${next_task}
1945
+
1946
+ ## Source Artifacts
1947
+
1948
+ - Handoff: ${handoff_file}
1949
+ - Spec: ${spec_file}
1950
+ - Active plan: ${active_plan:-(none)}
1951
+ - Active contract: ${active_contract:-(none)}
1952
+ - Review: ${active_review:-(none)}
1953
+ - Notes: ${active_notes:-(none)}
1954
+ - Research: $(workflow_policy_get '.tasks.research_dir' 'docs/researches')/
1955
+ - Checks: ${checks_file}
1956
+ EOF_RESUME
1957
+
1933
1958
  workflow_append_event "handoff_refresh" "$reason" "{\"source_plan\":\"$(workflow_json_escape "${source_plan:-}")\",\"parent_run_id\":\"$(workflow_json_escape "$parent_run_id")\"}"
1934
1959
  workflow_write_run_summary "$reason"
1935
1960
  }
@@ -807,7 +807,7 @@ emit_review_fingerprint_prompt() {
807
807
  review_file="$(workflow_active_review || true)"
808
808
  echo "[ReviewFreshness] Current implementation diff fingerprint: ${fingerprint:-unknown}"
809
809
  echo "[ReviewFreshness] Record these review metadata lines in ${review_file:-tasks/reviews/<slug>.review.md}:"
810
- echo "> **Review Rubric Version**: 1"
810
+ echo "> **Review Rubric Version**: 2"
811
811
  echo "> **Reviewed Diff Fingerprint**: ${fingerprint:-unknown}"
812
812
  echo "> **Reviewed Scope**: branch+staged+unstaged+untracked"
813
813
  }
@@ -865,9 +865,9 @@ emit_external_acceptance_prompt() {
865
865
  echo "[ExternalAcceptance] Diff scope for peer: branch diff against target, staged diff, unstaged diff, and untracked files."
866
866
  cat <<EOF_EXTERNAL_ACCEPTANCE
867
867
  [ExternalAcceptance] Prompt to send with $command:
868
- Review the current sprint for acceptance only. Do not run /check. Do not edit files. Do not write files. Inspect the diff scope, contract, review evidence, checks evidence, and Review Rubric v1, then return only a Markdown block that can be pasted into ${review_file:-tasks/reviews/<slug>.review.md}.
868
+ Review the current sprint for acceptance only. Do not run /check. Do not edit files. Do not write files. Inspect the diff scope, contract, review evidence, checks evidence, and Review Rubric v2, then return only a Markdown block that can be pasted into ${review_file:-tasks/reviews/<slug>.review.md}.
869
869
 
870
- ${rubric:-[ReviewRubric] Deep Diff Review Rubric v1 unavailable; use severity order P0/P1/P2/P3 and report no style-only nits.}
870
+ ${rubric:-[ReviewRubric] Deep Diff Review Rubric v2 unavailable; use severity order P0/P1/P2/P3 and report no style-only nits.}
871
871
 
872
872
  ## External Acceptance Advice
873
873
  > **External Acceptance**: pass
@@ -875,7 +875,7 @@ ${rubric:-[ReviewRubric] Deep Diff Review Rubric v1 unavailable; use severity or
875
875
  > **External Source**: $expected_source
876
876
  > **External Started**: YYYY-MM-DDTHH:MM:SS+0800
877
877
  > **External Completed**: YYYY-MM-DDTHH:MM:SS+0800
878
- > **Review Rubric Version**: 1
878
+ > **Review Rubric Version**: 2
879
879
  > **Reviewed Diff Fingerprint**: ${fingerprint:-unknown}
880
880
  > **Reviewed Scope**: branch+staged+unstaged+untracked
881
881
 
@@ -253,7 +253,7 @@ minimal_change_render_handoff_section() {
253
253
  }
254
254
 
255
255
  minimal_change_append_handoff() {
256
- local handoff_file tmp_file
256
+ local handoff_file tmp_file resume_file
257
257
 
258
258
  [[ -n "$MINIMAL_CHANGE_REVIEW_VERDICT" ]] || return 0
259
259
  [[ "$MINIMAL_CHANGE_REVIEW_VERDICT" != "disabled" ]] || return 0
@@ -275,6 +275,14 @@ minimal_change_append_handoff() {
275
275
  printf '\n' >> "$tmp_file"
276
276
  minimal_change_render_handoff_section >> "$tmp_file"
277
277
  mv "$tmp_file" "$handoff_file"
278
+
279
+ # refresh_handoff (workflow_write_handoff) already wrote a resume packet
280
+ # whose mtime matched the handoff snapshot at that time; this function just
281
+ # mutated handoff_file again, so bump the resume packet's mtime to match or
282
+ # check_handoff_resume_pair sees it as stale. Its content does not
283
+ # reference minimal-change-review data, so no rewrite is needed.
284
+ resume_file="$(workflow_resume_packet_file)"
285
+ [[ -f "$resume_file" ]] && touch -r "$handoff_file" "$resume_file" 2>/dev/null || true
278
286
  }
279
287
 
280
288
  minimal_change_reason_suffix() {
@@ -113,6 +113,14 @@ JSON_INPUT="$HOOK_STDIN_JSON" REPO_ROOT="${HOOK_REPO_ROOT:-$(pwd)}" bun -e '
113
113
  "- recommended parent action",
114
114
  "",
115
115
  "Do not claim overall task completion.",
116
+ "",
117
+ "Execution boundary: implement exactly the Goal, In scope items, Allowed Paths, and Exit Criteria in this brief. Treat absent requirements as forbidden design space, not as permission to improve.",
118
+ "",
119
+ "Do not add optional features, alternate UX, extra integrations, migration paths, compatibility behavior, fallback behavior, telemetry, broad cleanup, refactors, new abstractions, extra docs, or polish unless that work is explicitly listed under In scope or required by Exit Criteria.",
120
+ "",
121
+ "If you discover useful additional work, record it under Out of scope / Future work in the notes or review artifact. Do not implement it. Do not end with unsolicited offers to do more work.",
122
+ "",
123
+ "If the requested outcome cannot be completed without expanding scope, fail closed: stop, name the missing decision, and cite the exact file/section that blocks execution.",
116
124
  ].join("\n");
117
125
 
118
126
  process.stdout.write(`${JSON.stringify({