repo-harness 0.8.2 → 0.8.3

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 (119) hide show
  1. package/AGENTS.md +4 -4
  2. package/CLAUDE.md +4 -4
  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 +3 -3
  7. package/README.zh-CN.md +3 -3
  8. package/assets/hooks/AGENTS.md +1 -1
  9. package/assets/hooks/CLAUDE.md +1 -1
  10. package/assets/hooks/lib/workflow-state.sh +2 -2
  11. package/assets/hooks/post-edit-guard.sh +25 -8
  12. package/assets/hooks/pre-edit-guard.sh +4 -4
  13. package/assets/hooks/prompt-guard.sh +46 -29
  14. package/assets/hooks/session-start-context.sh +14 -26
  15. package/assets/hooks/stop-orchestrator.sh +2 -2
  16. package/assets/partials/04-project-structure.partial.md +4 -4
  17. package/assets/partials/05-workflow.partial.md +6 -6
  18. package/assets/partials/08-orchestration.partial.md +8 -8
  19. package/assets/partials-agents/02-operating-mode.partial.md +4 -4
  20. package/assets/partials-agents/03-orchestration.partial.md +2 -2
  21. package/assets/partials-agents/04-task-protocol.partial.md +4 -4
  22. package/assets/partials-agents/06-quality-safety.partial.md +2 -2
  23. package/assets/reference-configs/agentic-development-flow.md +5 -5
  24. package/assets/reference-configs/document-generation.md +1 -1
  25. package/assets/reference-configs/external-tooling.md +4 -4
  26. package/assets/reference-configs/harness-overview.md +9 -9
  27. package/assets/reference-configs/heartbeat-triage.md +5 -5
  28. package/assets/reference-configs/hook-operations.md +5 -5
  29. package/assets/reference-configs/sprint-contracts.md +4 -4
  30. package/assets/skill-commands/repo-harness-architecture/SKILL.md +5 -5
  31. package/assets/skill-commands/repo-harness-check/SKILL.md +7 -7
  32. package/assets/skill-commands/repo-harness-deploy/SKILL.md +1 -1
  33. package/assets/skill-commands/repo-harness-goal/SKILL.md +2 -2
  34. package/assets/skill-commands/repo-harness-handoff/SKILL.md +4 -4
  35. package/assets/skill-commands/repo-harness-init/SKILL.md +1 -1
  36. package/assets/skill-commands/repo-harness-plan/SKILL.md +4 -4
  37. package/assets/skill-commands/repo-harness-prd/SKILL.md +1 -1
  38. package/assets/skill-commands/repo-harness-ship/SKILL.md +3 -3
  39. package/assets/skill-commands/repo-harness-sprint/SKILL.md +7 -7
  40. package/assets/skill-version.json +7 -3
  41. package/assets/templates/contract.template.md +1 -1
  42. package/assets/templates/helpers/architecture-event.ts +3 -3
  43. package/assets/templates/helpers/architecture-queue.sh +14 -18
  44. package/assets/templates/helpers/archive-workflow.sh +6 -5
  45. package/assets/templates/helpers/capability-config.ts +12 -3
  46. package/assets/templates/helpers/capture-plan.sh +10 -8
  47. package/assets/templates/helpers/check-agent-tooling.sh +0 -1
  48. package/assets/templates/helpers/check-architecture-sync.sh +3 -11
  49. package/assets/templates/helpers/check-brain-manifest.sh +1 -5
  50. package/assets/templates/helpers/check-skill-version.ts +2 -4
  51. package/assets/templates/helpers/check-task-workflow.sh +28 -55
  52. package/assets/templates/helpers/context-contract-sync.sh +1 -1
  53. package/assets/templates/helpers/contract-worktree.sh +20 -19
  54. package/assets/templates/helpers/ensure-task-workflow.sh +35 -35
  55. package/assets/templates/helpers/factor-lab-check.sh +77 -0
  56. package/assets/templates/helpers/factor-lab-new.sh +100 -0
  57. package/assets/templates/helpers/factor-lab-promote.sh +90 -0
  58. package/assets/templates/helpers/factor-lab-reject.sh +72 -0
  59. package/assets/templates/helpers/heartbeat-triage.sh +2 -14
  60. package/assets/templates/helpers/new-plan.sh +5 -5
  61. package/assets/templates/helpers/new-spec.sh +3 -3
  62. package/assets/templates/helpers/new-sprint.sh +6 -5
  63. package/assets/templates/helpers/plan-to-todo.sh +9 -7
  64. package/assets/templates/helpers/prepare-codex-handoff.sh +5 -4
  65. package/assets/templates/helpers/prepare-handoff.sh +8 -7
  66. package/assets/templates/helpers/ship-worktrees.sh +16 -15
  67. package/assets/templates/helpers/sprint-backlog.sh +12 -13
  68. package/assets/templates/helpers/switch-plan.sh +3 -3
  69. package/assets/templates/helpers/verify-sprint.sh +13 -12
  70. package/assets/templates/helpers/workflow-contract.ts +3 -6
  71. package/assets/templates/helpers/workstream-sync.sh +4 -3
  72. package/assets/templates/plan.template.md +2 -2
  73. package/assets/templates/sprint.template.md +1 -1
  74. package/assets/workflow-contract.v1.json +5 -45
  75. package/package.json +10 -10
  76. package/scripts/architecture-event.ts +3 -3
  77. package/scripts/architecture-queue.sh +14 -18
  78. package/scripts/archive-workflow.sh +0 -2
  79. package/scripts/capability-config.ts +12 -3
  80. package/scripts/capture-plan.sh +10 -8
  81. package/scripts/check-agent-tooling.sh +4 -7
  82. package/scripts/check-architecture-sync.sh +3 -11
  83. package/scripts/check-brain-manifest.sh +1 -5
  84. package/scripts/check-skill-version.ts +2 -4
  85. package/scripts/check-task-workflow.sh +28 -55
  86. package/scripts/context-contract-sync.sh +1 -1
  87. package/scripts/contract-worktree.sh +20 -19
  88. package/scripts/create-project-dirs.sh +0 -9
  89. package/scripts/ensure-task-workflow.sh +36 -52
  90. package/scripts/factor-lab-check.sh +5 -1
  91. package/scripts/factor-lab-new.sh +6 -2
  92. package/scripts/factor-lab-promote.sh +6 -2
  93. package/scripts/factor-lab-reject.sh +6 -2
  94. package/scripts/heartbeat-triage.sh +2 -14
  95. package/scripts/init-project.sh +2 -11
  96. package/scripts/lib/project-init-lib.sh +32 -206
  97. package/scripts/mcp-observability-report.ts +0 -0
  98. package/scripts/mcp-rollout-gate.ts +0 -0
  99. package/scripts/migrate-project-template.sh +21 -30
  100. package/scripts/new-plan.sh +5 -5
  101. package/scripts/new-spec.sh +0 -2
  102. package/scripts/new-sprint.sh +0 -2
  103. package/scripts/plan-to-todo.sh +9 -7
  104. package/scripts/prepare-codex-handoff.sh +5 -4
  105. package/scripts/prepare-handoff.sh +8 -7
  106. package/scripts/ship-worktrees.sh +16 -15
  107. package/scripts/sprint-backlog.sh +12 -13
  108. package/scripts/switch-plan.sh +0 -2
  109. package/scripts/sync-hook-sources.ts +0 -0
  110. package/scripts/verify-sprint.sh +10 -11
  111. package/scripts/workflow-contract.ts +3 -6
  112. package/scripts/workstream-sync.sh +4 -3
  113. package/src/cli/commands/adopt-plan.ts +0 -1
  114. package/src/cli/commands/init.ts +15 -23
  115. package/src/cli/mcp/server.ts +21 -9
  116. package/src/cli/repo-adoption/reclaim-runtime.ts +19 -106
  117. package/src/cli/runtime/helper-runner.ts +7 -25
  118. package/src/core/adoption/plan.ts +1 -5
  119. package/src/core/adoption/helper-wrapper-plan.ts +0 -159
package/AGENTS.md CHANGED
@@ -6,7 +6,7 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
6
6
 
7
7
  - `tasks/current.md` for the tracked current-status snapshot derived from workflow artifacts
8
8
  - `tasks/todos.md` for deferred medium/long-term goals, not active execution checklists
9
- - `plans/prds/` for upper-layer PRDs; `plans/sprints/` for ordered sprint backlogs operated through `scripts/sprint-backlog.sh` (installed implementations live under `.ai/harness/scripts/`; task contracts stay the execution slices)
9
+ - `plans/prds/` for upper-layer PRDs; `plans/sprints/` for ordered sprint backlogs operated through `repo-harness run sprint-backlog`; task contracts stay the execution slices
10
10
  - `.ai/context/capabilities.json` for the capability registry and longest-prefix context boundaries
11
11
  - `tasks/workstreams/` for capability long-running workstreams that project durable progress into local contracts
12
12
  - `tasks/lessons.md` for correction-derived rules
@@ -35,8 +35,8 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
35
35
  - Treat `_ref/` as an occasional ignored external reference checkout cache, not a commit surface or daily workflow. Agents may read or refresh it for comparison; when it influences a decision, cite the source repo plus commit/tag and path in `tasks/notes/` or `docs/researches/`.
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
- - Treat contract-level task execution as worktree-first: `scripts/plan-to-todo.sh --plan <approved-plan>` starts `scripts/contract-worktree.sh start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `scripts/contract-worktree.sh finish`.
39
- - After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete work-package plan, capture it with `scripts/capture-plan.sh --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 `scripts/plan-to-todo.sh --plan <active-plan>`.
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
+ - 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
40
  - 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
41
  - 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.
42
42
  - Route product discovery to gstack `office-hours`, complex engineering plans to gstack `plan-eng-review`, design plans to gstack `plan-design-review`, and daily small/medium planning, bug hunts, and checks to Waza `/think`, `/hunt`, and `/check`.
@@ -55,7 +55,7 @@ bun test
55
55
  bash scripts/check-deploy-sql-order.sh
56
56
  bash scripts/check-architecture-sync.sh
57
57
  bash scripts/check-task-sync.sh
58
- bash scripts/check-task-workflow.sh --strict
58
+ repo-harness run check-task-workflow --strict
59
59
  bun scripts/inspect-project-state.ts --repo . --format text
60
60
  bash scripts/migrate-project-template.sh --repo . --dry-run
61
61
  ```
package/CLAUDE.md CHANGED
@@ -6,7 +6,7 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
6
6
 
7
7
  - `tasks/current.md` for the tracked current-status snapshot derived from workflow artifacts
8
8
  - `tasks/todos.md` for deferred medium/long-term goals, not active execution checklists
9
- - `plans/prds/` for upper-layer PRDs; `plans/sprints/` for ordered sprint backlogs operated through `scripts/sprint-backlog.sh` (installed implementations live under `.ai/harness/scripts/`; task contracts stay the execution slices)
9
+ - `plans/prds/` for upper-layer PRDs; `plans/sprints/` for ordered sprint backlogs operated through `repo-harness run sprint-backlog`; task contracts stay the execution slices
10
10
  - `.ai/context/capabilities.json` for the capability registry and longest-prefix context boundaries
11
11
  - `tasks/workstreams/` for capability long-running workstreams that project durable progress into local contracts
12
12
  - `tasks/lessons.md` for correction-derived rules
@@ -35,8 +35,8 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
35
35
  - Treat `_ref/` as an occasional ignored external reference checkout cache, not a commit surface or daily workflow. Agents may read or refresh it for comparison; when it influences a decision, cite the source repo plus commit/tag and path in `tasks/notes/` or `docs/researches/`.
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
- - Treat contract-level task execution as worktree-first: `scripts/plan-to-todo.sh --plan <approved-plan>` starts `scripts/contract-worktree.sh start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `scripts/contract-worktree.sh finish`.
39
- - After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete work-package plan, capture it with `scripts/capture-plan.sh --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 `scripts/plan-to-todo.sh --plan <active-plan>`.
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
+ - 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
40
  - 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
41
  - 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.
42
42
  - Route product discovery to gstack `office-hours`, complex engineering plans to gstack `plan-eng-review`, design plans to gstack `plan-design-review`, and daily small/medium planning, bug hunts, and checks to Waza `/think`, `/hunt`, and `/check`.
@@ -55,7 +55,7 @@ bun test
55
55
  bash scripts/check-deploy-sql-order.sh
56
56
  bash scripts/check-architecture-sync.sh
57
57
  bash scripts/check-task-sync.sh
58
- bash scripts/check-task-workflow.sh --strict
58
+ repo-harness run check-task-workflow --strict
59
59
  bun scripts/inspect-project-state.ts --repo . --format text
60
60
  bash scripts/migrate-project-template.sh --repo . --dry-run
61
61
  ```
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.2`.
88
+ actual es `0.8.3`.
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.2`
423
- - Generated workflow stamp: `repo-harness@0.8.2+template@0.8.2`
422
+ - npm package: `repo-harness@0.8.3`
423
+ - Generated workflow stamp: `repo-harness@0.8.3+template@0.8.3`
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.2`.
88
+ ligne actuelle est `0.8.3`.
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.2`
428
- - Generated workflow stamp : `repo-harness@0.8.2+template@0.8.2`
427
+ - npm package : `repo-harness@0.8.3`
428
+ - Generated workflow stamp : `repo-harness@0.8.3+template@0.8.3`
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.2` です。
78
+ ラインは `0.8.3` です。
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.2`
402
- - Generated workflow stamp:`repo-harness@0.8.2+template@0.8.2`
401
+ - npm package:`repo-harness@0.8.3`
402
+ - Generated workflow stamp:`repo-harness@0.8.3+template@0.8.3`
403
403
  - GitHub repository:`Ancienttwo/repo-harness`
404
404
  - Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
405
405
 
package/README.md CHANGED
@@ -79,7 +79,7 @@ active plan, contract, review, checks, or handoff, the source artifacts win.
79
79
  ## What's New
80
80
 
81
81
  Release notes live in [`docs/CHANGELOG.md`](docs/CHANGELOG.md). The current line
82
- is `0.8.2`.
82
+ is `0.8.3`.
83
83
 
84
84
  ## How It Works
85
85
 
@@ -599,8 +599,8 @@ Most common guards:
599
599
 
600
600
  ## Current Release
601
601
 
602
- - npm package: `repo-harness@0.8.2`
603
- - Generated workflow stamp: `repo-harness@0.8.2+template@0.8.2`
602
+ - npm package: `repo-harness@0.8.3`
603
+ - Generated workflow stamp: `repo-harness@0.8.3+template@0.8.3`
604
604
  - GitHub repository: `Ancienttwo/repo-harness`
605
605
  - Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
606
606
 
package/README.zh-CN.md CHANGED
@@ -69,7 +69,7 @@ review、checks 或 handoff 冲突,以 source artifacts 为准。
69
69
 
70
70
  ## What's New
71
71
 
72
- Release notes 见 [`docs/CHANGELOG.md`](docs/CHANGELOG.md),当前版本线是 `0.8.2`。
72
+ Release notes 见 [`docs/CHANGELOG.md`](docs/CHANGELOG.md),当前版本线是 `0.8.3`。
73
73
 
74
74
  ## 工作原理
75
75
 
@@ -445,8 +445,8 @@ hook block 工作时,先看 terminal 里的结构化输出。核心字段是
445
445
 
446
446
  ## 当前 Release
447
447
 
448
- - npm package:`repo-harness@0.8.2`
449
- - Generated workflow stamp:`repo-harness@0.8.2+template@0.8.2`
448
+ - npm package:`repo-harness@0.8.3`
449
+ - Generated workflow stamp:`repo-harness@0.8.3+template@0.8.3`
450
450
  - GitHub repository:`Ancienttwo/repo-harness`
451
451
  - Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
452
452
 
@@ -37,7 +37,7 @@ 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
- - `bash scripts/check-task-workflow.sh --strict`
40
+ - `repo-harness run check-task-workflow --strict`
41
41
  <!-- END CAPABILITY CONTEXT -->
42
42
 
43
43
  <!-- BEGIN ARCHITECTURE CONTRACT -->
@@ -37,7 +37,7 @@ 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
- - `bash scripts/check-task-workflow.sh --strict`
40
+ - `repo-harness run check-task-workflow --strict`
41
41
  <!-- END CAPABILITY CONTEXT -->
42
42
 
43
43
  <!-- BEGIN ARCHITECTURE CONTRACT -->
@@ -641,7 +641,7 @@ workflow_next_action() {
641
641
  target="$(workflow_target_branch)"
642
642
  current_branch="$(workflow_current_branch)"
643
643
  if workflow_is_linked_worktree && [[ -n "$current_branch" && "$current_branch" != "$target" ]]; then
644
- printf 'finish\tbash scripts/contract-worktree.sh finish\tReview/checks pass; finish and fast-forward merge this contract worktree.\n'
644
+ printf 'finish\trepo-harness run contract-worktree finish\tReview/checks pass; finish and fast-forward merge this contract worktree.\n'
645
645
  return 0
646
646
  fi
647
647
  fi
@@ -649,7 +649,7 @@ workflow_next_action() {
649
649
  if candidate="$(workflow_cleanup_candidate)"; then
650
650
  IFS=$'\t' read -r slug branch worktree <<< "$candidate"
651
651
  target="$(workflow_target_branch)"
652
- command="bash scripts/contract-worktree.sh cleanup --slug ${slug} --target ${target}"
652
+ command="repo-harness run contract-worktree cleanup --slug ${slug} --target ${target}"
653
653
  printf 'cleanup\t%s\tClean up merged contract worktree %s.\n' "$command" "${branch:-$slug}"
654
654
  return 0
655
655
  fi
@@ -11,10 +11,27 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
11
  # shellcheck source=/dev/null
12
12
  . "$SCRIPT_DIR/lib/workflow-state.sh"
13
13
 
14
+ repo_harness_runner_available() {
15
+ if [[ -n "${REPO_HARNESS_CLI:-}" && -f "$REPO_HARNESS_CLI" ]] && command -v bun >/dev/null 2>&1; then
16
+ return 0
17
+ fi
18
+ command -v repo-harness >/dev/null 2>&1
19
+ }
20
+
21
+ run_repo_harness_helper() {
22
+ local helper="$1"
23
+ shift
24
+ if [[ -n "${REPO_HARNESS_CLI:-}" && -f "$REPO_HARNESS_CLI" ]] && command -v bun >/dev/null 2>&1; then
25
+ bun "$REPO_HARNESS_CLI" run "$helper" "$@"
26
+ return $?
27
+ fi
28
+ repo-harness run "$helper" "$@"
29
+ }
30
+
14
31
  run_continuous_contract_verification() {
15
32
  local active_plan contract_file checks_file
16
33
 
17
- [[ -f "scripts/verify-contract.sh" ]] || return 0
34
+ repo_harness_runner_available || return 0
18
35
 
19
36
  active_plan="$(get_active_plan || true)"
20
37
  [[ -n "$active_plan" && -f "$active_plan" ]] || return 0
@@ -25,16 +42,16 @@ run_continuous_contract_verification() {
25
42
  mkdir -p "$(dirname "$checks_file")"
26
43
 
27
44
  if contract_references_path "$contract_file" "$FILE_PATH"; then
28
- bash "scripts/verify-contract.sh" --contract "$contract_file" --quiet --report-file "$checks_file" || true
45
+ run_repo_harness_helper verify-contract --contract "$contract_file" --quiet --report-file "$checks_file" || true
29
46
  fi
30
47
  }
31
48
 
32
49
  run_architecture_queue_sync() {
33
50
  local queue_output status
34
51
 
35
- [[ -x "scripts/architecture-queue.sh" ]] || return 0
52
+ repo_harness_runner_available || return 0
36
53
 
37
- if queue_output="$(bash "scripts/architecture-queue.sh" record --file "$FILE_PATH" 2>&1)"; then
54
+ if queue_output="$(run_repo_harness_helper architecture-queue record --file "$FILE_PATH" 2>&1)"; then
38
55
  :
39
56
  else
40
57
  status=$?
@@ -45,8 +62,8 @@ run_architecture_queue_sync() {
45
62
  [[ -n "$queue_output" ]] && printf '%s\n' "$queue_output"
46
63
 
47
64
  if printf '%s\n' "$queue_output" | grep -q '^\[ArchitectureDrift\] Request:'; then
48
- if [[ -x "scripts/context-contract-sync.sh" ]]; then
49
- if bash "scripts/context-contract-sync.sh" sync-latest; then
65
+ if repo_harness_runner_available; then
66
+ if run_repo_harness_helper context-contract-sync sync-latest; then
50
67
  :
51
68
  else
52
69
  status=$?
@@ -79,7 +96,7 @@ run_architecture_queue_sync() {
79
96
  }
80
97
 
81
98
  run_brain_doc_sync() {
82
- [[ -x "scripts/sync-brain-docs.sh" ]] || return 0
99
+ repo_harness_runner_available || return 0
83
100
  [[ -f ".ai/harness/brain-manifest.json" ]] || return 0
84
101
 
85
102
  # Fast-path: most edits are not repo-to-brain sources. Avoid starting the JS
@@ -88,7 +105,7 @@ run_brain_doc_sync() {
88
105
  return 0
89
106
  fi
90
107
 
91
- if bash "scripts/sync-brain-docs.sh" --changed "$FILE_PATH"; then
108
+ if run_repo_harness_helper sync-brain-docs --changed "$FILE_PATH"; then
92
109
  :
93
110
  else
94
111
  local status=$?
@@ -100,12 +100,12 @@ run_edit_plan_gate() {
100
100
  if [[ ! -f "docs/spec.md" ]]; then
101
101
  echo "[SpecGuard] Implementation edit without docs/spec.md: $FILE_PATH"
102
102
  if [[ "$mode" == "advice" ]]; then
103
- echo "[SpecGuard] Advisory: run bash scripts/new-spec.sh and capture stable product intent."
103
+ echo "[SpecGuard] Advisory: run repo-harness run new-spec and capture stable product intent."
104
104
  else
105
105
  hook_structured_error \
106
106
  "SpecGuard" \
107
107
  "Implementation edit to $FILE_PATH without docs/spec.md." \
108
- "Run bash scripts/new-spec.sh and capture stable product intent before implementing." \
108
+ "Run repo-harness run new-spec and capture stable product intent before implementing." \
109
109
  "missing_artifact"
110
110
  exit 2
111
111
  fi
@@ -115,12 +115,12 @@ run_edit_plan_gate() {
115
115
  if [[ -z "$gate_plan" || ! -f "$gate_plan" ]]; then
116
116
  echo "[PlanStatusGuard] No active plan covers implementation edit: $FILE_PATH"
117
117
  if [[ "$mode" == "advice" ]]; then
118
- echo "[PlanStatusGuard] Advisory: capture the approved plan with bash scripts/capture-plan.sh --slug <slug> --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --execute"
118
+ echo "[PlanStatusGuard] Advisory: capture the approved plan with repo-harness run capture-plan --slug <slug> --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --execute"
119
119
  else
120
120
  hook_structured_error \
121
121
  "PlanStatusGuard" \
122
122
  "Implementation edit to $FILE_PATH without an active plan." \
123
- "Capture the approved planning output with bash scripts/capture-plan.sh --slug <slug> --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --execute, or set policy .guards.edit_plan_gate to advice/off for this repo." \
123
+ "Capture the approved planning output with repo-harness run capture-plan --slug <slug> --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --execute, or set policy .guards.edit_plan_gate to advice/off for this repo." \
124
124
  "missing_artifact"
125
125
  exit 2
126
126
  fi
@@ -27,6 +27,23 @@ if [[ -f "$SCRIPT_DIR/lib/minimal-change.sh" ]]; then
27
27
  . "$SCRIPT_DIR/lib/minimal-change.sh"
28
28
  fi
29
29
 
30
+ repo_harness_runner_available() {
31
+ if [[ -n "${REPO_HARNESS_CLI:-}" && -f "$REPO_HARNESS_CLI" ]] && command -v bun >/dev/null 2>&1; then
32
+ return 0
33
+ fi
34
+ command -v repo-harness >/dev/null 2>&1
35
+ }
36
+
37
+ run_repo_harness_helper() {
38
+ local helper="$1"
39
+ shift
40
+ if [[ -n "${REPO_HARNESS_CLI:-}" && -f "$REPO_HARNESS_CLI" ]] && command -v bun >/dev/null 2>&1; then
41
+ bun "$REPO_HARNESS_CLI" run "$helper" "$@"
42
+ return $?
43
+ fi
44
+ repo-harness run "$helper" "$@"
45
+ }
46
+
30
47
  # --- Filesystem/worktree helpers (shell-owned authority) ---
31
48
 
32
49
  prompt_matches_worktree_record() {
@@ -518,7 +535,7 @@ emit_pending_orchestration_discussion() {
518
535
  echo "[PlanDiscussionGate] Pending plan/orchestration discussion is still open; continuing discussion, not implementation."
519
536
  echo "[PlanDiscussionGate] $(workflow_pending_orchestration_summary)"
520
537
  echo "[PlanDiscussionGate] When the decision is complete, capture the final plan body before editing implementation files:"
521
- echo " printf '%s\n' '<decision-complete plan body>' | bash scripts/capture-plan.sh --slug <slug> --title <title> --status Draft --source ${kind:-host-plan} --orchestration-kind ${kind:-host-plan} --route planning${source_arg}"
538
+ echo " printf '%s\n' '<decision-complete plan body>' | repo-harness run capture-plan --slug <slug> --title <title> --status Draft --source ${kind:-host-plan} --orchestration-kind ${kind:-host-plan} --route planning${source_arg}"
522
539
  }
523
540
 
524
541
  emit_pending_orchestration_capture_gate() {
@@ -531,7 +548,7 @@ emit_pending_orchestration_capture_gate() {
531
548
  echo "[PlanCaptureGate] Implementation requested while a pending plan/orchestration discussion has not been captured."
532
549
  echo "[PlanCaptureGate] $(workflow_pending_orchestration_summary)"
533
550
  echo "[PlanCaptureGate] Capture the final plan body first; if implementation is already approved, use --status Approved --execute with a work-package promotion reason:"
534
- echo " printf '%s\n' '<approved plan body>' | bash scripts/capture-plan.sh --slug <slug> --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --source ${kind:-host-plan} --orchestration-kind ${kind:-host-plan} --route planning --execute${source_arg}"
551
+ echo " printf '%s\n' '<approved plan body>' | repo-harness run capture-plan --slug <slug> --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --source ${kind:-host-plan} --orchestration-kind ${kind:-host-plan} --route planning --execute${source_arg}"
535
552
  return 0
536
553
  }
537
554
 
@@ -546,8 +563,8 @@ maybe_start_plan_workflow() {
546
563
  return 0
547
564
  fi
548
565
 
549
- if [[ ! -x "scripts/ensure-task-workflow.sh" ]]; then
550
- echo "[PlanStartGate] Think/plan intent detected, but scripts/ensure-task-workflow.sh is missing. Continue with planning and capture manually."
566
+ if ! repo_harness_runner_available; then
567
+ echo "[PlanStartGate] Think/plan intent detected, but repo-harness run is unavailable. Continue with planning and capture manually."
551
568
  return 0
552
569
  fi
553
570
 
@@ -558,7 +575,7 @@ maybe_start_plan_workflow() {
558
575
  kind="${PG_PENDING_KIND:-repo-harness-plan}"
559
576
  source_ref="$title"
560
577
  echo "[PlanStartGate] Think/plan intent detected. Starting independent file-backed Draft plan workflow."
561
- if ! start_output="$(bash "scripts/ensure-task-workflow.sh" --new-plan --slug "$slug" --title "$title" 2>&1)"; then
578
+ if ! start_output="$(run_repo_harness_helper ensure-task-workflow --new-plan --slug "$slug" --title "$title" 2>&1)"; then
562
579
  printf '%s\n' "$start_output"
563
580
  return 0
564
581
  fi
@@ -633,12 +650,12 @@ maybe_capture_embedded_approved_plan() {
633
650
  return 0
634
651
  fi
635
652
 
636
- if [[ ! -x "scripts/capture-plan.sh" ]]; then
637
- echo "[PlanCaptureGate] Embedded approved plan detected, but scripts/capture-plan.sh is missing."
653
+ if ! repo_harness_runner_available; then
654
+ echo "[PlanCaptureGate] Embedded approved plan detected, but repo-harness run is unavailable."
638
655
  hook_structured_error \
639
656
  "PlanCaptureGate" \
640
- "Embedded approved plan detected but scripts/capture-plan.sh is missing." \
641
- "Install workflow helpers before executing an embedded approved plan." \
657
+ "Embedded approved plan detected but repo-harness run is unavailable." \
658
+ "Install the repo-harness global runtime before executing an embedded approved plan." \
642
659
  "missing_artifact"
643
660
  exit 2
644
661
  fi
@@ -650,7 +667,7 @@ maybe_capture_embedded_approved_plan() {
650
667
  hook_structured_error \
651
668
  "PlanCaptureGate" \
652
669
  "PLEASE IMPLEMENT THIS PLAN was provided without a plan body." \
653
- "Paste the approved plan body after the marker so scripts/capture-plan.sh can store and project it." \
670
+ "Paste the approved plan body after the marker so repo-harness run capture-plan can store and project it." \
654
671
  "missing_artifact"
655
672
  exit 2
656
673
  fi
@@ -662,12 +679,12 @@ maybe_capture_embedded_approved_plan() {
662
679
  fi
663
680
 
664
681
  echo "[PlanCaptureGate] Embedded approved plan detected. Capturing and projecting before implementation."
665
- if ! capture_output="$(printf '%s\n' "$body" | bash "scripts/capture-plan.sh" --slug "$slug" --title "$title" --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --source user-approved-plan --route planning --execute 2>&1)"; then
682
+ if ! capture_output="$(printf '%s\n' "$body" | run_repo_harness_helper capture-plan --slug "$slug" --title "$title" --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --source user-approved-plan --route planning --execute 2>&1)"; then
666
683
  printf '%s\n' "$capture_output"
667
684
  hook_structured_error \
668
685
  "PlanCaptureGate" \
669
686
  "Embedded approved plan capture failed." \
670
- "Fix the capture-plan.sh or plan-to-todo.sh error before editing implementation files." \
687
+ "Fix the repo-harness run capture-plan or plan-to-todo error before editing implementation files." \
671
688
  "state_violation"
672
689
  exit 2
673
690
  fi
@@ -884,7 +901,7 @@ render_prompt_guard_action() {
884
901
  ;;
885
902
  spec_block)
886
903
  echo "[SpecGuard] Advisory: docs/spec.md is missing. Create stable product truth before implementation."
887
- echo "[SpecGuard] Run bash scripts/new-spec.sh and capture stable product intent; implementation edits without a spec are blocked at the edit layer."
904
+ echo "[SpecGuard] Run repo-harness run new-spec and capture stable product intent; implementation edits without a spec are blocked at the edit layer."
888
905
  exit 0
889
906
  ;;
890
907
  stale_active_plan_advice)
@@ -906,19 +923,19 @@ render_prompt_guard_action() {
906
923
  echo "[PlanCaptureGate] Approval detected before an active plan artifact exists."
907
924
  echo "[PlanCaptureGate] Let the agent run the approved-plan capture path now:"
908
925
  echo " git status --short --branch -uall"
909
- echo " printf '%s\n' '<approved plan body>' | bash scripts/capture-plan.sh --slug <slug> --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --source waza-think --route planning --execute"
926
+ echo " printf '%s\n' '<approved plan body>' | repo-harness run capture-plan --slug <slug> --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --source waza-think --route planning --execute"
910
927
  exit 0
911
928
  ;;
912
929
  plan_status_no_active_block)
913
930
  echo "[PlanStatusGuard] Advisory: No active plan found in plans/. Implementation edits will be blocked at the edit layer until a plan is captured."
914
- echo "[PlanStatusGuard] Capture the approved planning output with: bash scripts/capture-plan.sh --slug <slug> --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --execute"
915
- echo "[PlanStatusGuard] If there is no captured planning output yet, run: bash scripts/ensure-task-workflow.sh --slug <slug> --title <title>"
931
+ echo "[PlanStatusGuard] Capture the approved planning output with: repo-harness run capture-plan --slug <slug> --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --execute"
932
+ echo "[PlanStatusGuard] If there is no captured planning output yet, run: repo-harness run ensure-task-workflow --slug <slug> --title <title>"
916
933
  exit 0
917
934
  ;;
918
935
  plan_capture_draft_advice)
919
936
  echo "[PlanCaptureGate] Approval detected for $plan_status plan: $active_plan"
920
937
  echo "[PlanCaptureGate] Recapture the exact approved plan body with --artifact-level work-package --promotion-reason <reason> --status Approved --execute, or mark this plan Approved and run:"
921
- echo " bash scripts/plan-to-todo.sh --plan $active_plan"
938
+ echo " repo-harness run plan-to-todo --plan $active_plan"
922
939
  exit 0
923
940
  ;;
924
941
  plan_status_not_approved_block)
@@ -934,12 +951,12 @@ render_prompt_guard_action() {
934
951
  plan_execution_scaffold_advice)
935
952
  echo "[PlanExecutionGate] Approval detected for approved plan: $active_plan"
936
953
  echo "[PlanExecutionGate] Create the sprint contract/review/notes before implementation:"
937
- echo " bash scripts/plan-to-todo.sh --plan $active_plan"
954
+ echo " repo-harness run plan-to-todo --plan $active_plan"
938
955
  exit 0
939
956
  ;;
940
957
  contract_missing_block)
941
958
  echo "[ContractGuard] Advisory: missing active sprint contract for $active_plan."
942
- echo "[ContractGuard] Run bash scripts/plan-to-todo.sh --plan $active_plan to create the contract/review/notes scaffold before implementation."
959
+ echo "[ContractGuard] Run repo-harness run plan-to-todo --plan $active_plan to create the contract/review/notes scaffold before implementation."
943
960
  exit 0
944
961
  ;;
945
962
  done_missing_active_plan)
@@ -1109,11 +1126,11 @@ fi
1109
1126
  if [ "$done_intent" -eq 1 ]; then
1110
1127
  render_prompt_guard_action "$PG_ACTION"
1111
1128
 
1112
- if [ -f "scripts/verify-contract.sh" ]; then
1129
+ if repo_harness_runner_available; then
1113
1130
  # --read-only: hook-driven verification must not rewrite the contract Status
1114
1131
  # header, otherwise a transient failure (e.g. flaky `bun test`) dirties the
1115
1132
  # worktree and chains into worktree-guard on the next prompt.
1116
- if ! bash "scripts/verify-contract.sh" --contract "$contract_file" --strict --read-only; then
1133
+ if ! run_repo_harness_helper verify-contract --contract "$contract_file" --strict --read-only; then
1117
1134
  echo "[ContractGuard] Contract verification failed: $contract_file"
1118
1135
  hook_structured_error \
1119
1136
  "ContractGuard" \
@@ -1123,7 +1140,7 @@ if [ "$done_intent" -eq 1 ]; then
1123
1140
  exit 2
1124
1141
  fi
1125
1142
  else
1126
- echo "[ContractGuard] verify-contract.sh not found at scripts/verify-contract.sh (degraded mode: skipping strict verification)."
1143
+ echo "[ContractGuard] repo-harness run verify-contract is unavailable (degraded mode: skipping strict verification)."
1127
1144
  fi
1128
1145
 
1129
1146
  review_file="$(workflow_active_review || true)"
@@ -1196,7 +1213,7 @@ if [ "$done_intent" -eq 1 ]; then
1196
1213
  hook_structured_error \
1197
1214
  "EvidenceGuard" \
1198
1215
  "$checks_error" \
1199
- "Run bash scripts/verify-sprint.sh so .ai/harness/checks/latest.json records a passing current sprint verification." \
1216
+ "Run repo-harness run verify-sprint so .ai/harness/checks/latest.json records a passing current sprint verification." \
1200
1217
  "quality_gate"
1201
1218
  exit 2
1202
1219
  fi
@@ -1228,24 +1245,24 @@ if [ "$done_intent" -eq 1 ]; then
1228
1245
  exit 0
1229
1246
  fi
1230
1247
 
1231
- if [ ! -x scripts/archive-workflow.sh ]; then
1232
- echo "[AutoArchive] scripts/archive-workflow.sh is missing or not executable. Skipping auto-archive."
1248
+ if ! repo_harness_runner_available; then
1249
+ echo "[AutoArchive] repo-harness run archive-workflow is unavailable. Skipping auto-archive."
1233
1250
  hook_structured_error \
1234
1251
  "AutoArchive" \
1235
- "scripts/archive-workflow.sh is missing or not executable." \
1236
- "Install the workflow helper before relying on auto-archive." \
1252
+ "repo-harness run archive-workflow is unavailable." \
1253
+ "Install the repo-harness global runtime before relying on auto-archive." \
1237
1254
  "missing_artifact"
1238
1255
  exit 1
1239
1256
  fi
1240
1257
 
1241
1258
  outcome="${PG_DONE_OUTCOME:-Completed}"
1242
1259
  echo "[AutoArchive] All quality gates passed. Archiving $active_plan as outcome=$outcome"
1243
- if ! archive_output="$(bash scripts/archive-workflow.sh --plan "$active_plan" --outcome "$outcome" 2>&1)"; then
1260
+ if ! archive_output="$(run_repo_harness_helper archive-workflow --plan "$active_plan" --outcome "$outcome" 2>&1)"; then
1244
1261
  printf '%s\n' "$archive_output"
1245
1262
  hook_structured_error \
1246
1263
  "AutoArchive" \
1247
1264
  "Automatic archive failed for $active_plan." \
1248
- "Run bash scripts/archive-workflow.sh --plan $active_plan --outcome $outcome and resolve the error." \
1265
+ "Run repo-harness run archive-workflow --plan $active_plan --outcome $outcome and resolve the error." \
1249
1266
  "contract_failure"
1250
1267
  exit 1
1251
1268
  fi
@@ -15,22 +15,10 @@ workflow_rotate_events_file ".ai/harness/architecture/events.jsonl" 2>/dev/null
15
15
 
16
16
  resume_file="$(workflow_resume_packet_file)"
17
17
 
18
- helper_script_path() {
18
+ helper_command() {
19
19
  local helper_name="$1"
20
- local helper_dir
21
-
22
- helper_dir="$(workflow_policy_get '.harness.helper_runtime_dir' '.ai/harness/scripts')"
23
- if [[ -f "$helper_dir/$helper_name" ]]; then
24
- printf '%s/%s' "$helper_dir" "$helper_name"
25
- return 0
26
- fi
27
-
28
- if [[ -f "scripts/$helper_name" ]]; then
29
- printf '%s/%s' "scripts" "$helper_name"
30
- return 0
31
- fi
32
-
33
- printf '%s/%s' "$helper_dir" "$helper_name"
20
+ helper_name="${helper_name%.sh}"
21
+ printf 'repo-harness run %s' "$helper_name"
34
22
  }
35
23
 
36
24
  resume_available() {
@@ -304,10 +292,10 @@ architecture_queue_pending() {
304
292
  local pending_count="0"
305
293
  local oldest_epoch="" oldest_days="unknown"
306
294
  local now_epoch request detected detected_date detected_epoch
307
- local queue_script
295
+ local queue_cmd
308
296
 
309
297
  [[ -d "$requests_dir" ]] || return 1
310
- queue_script="$(helper_script_path "architecture-queue.sh")"
298
+ queue_cmd="$(helper_command "architecture-queue.sh")"
311
299
 
312
300
  now_epoch="$(date '+%s' 2>/dev/null || true)"
313
301
  while IFS= read -r request; do
@@ -336,13 +324,13 @@ architecture_queue_pending() {
336
324
  ${pending_count} capabilities have pending architecture drift (oldest ${oldest_days}). Run:
337
325
 
338
326
  \`\`\`bash
339
- bash ${queue_script} status
327
+ ${queue_cmd} status
340
328
  \`\`\`
341
329
  EOF_CONTEXT
342
330
  }
343
331
 
344
332
  pending_plan_capture_context() {
345
- local active_plan summary draft_path prompt_slug kind source_ref capture_source source_arg capture_script
333
+ local active_plan summary draft_path prompt_slug kind source_ref capture_source source_arg capture_cmd
346
334
 
347
335
  workflow_pending_orchestration_is_fresh || return 1
348
336
  active_plan="$(get_active_plan || true)"
@@ -358,7 +346,7 @@ pending_plan_capture_context() {
358
346
  if [[ -n "$source_ref" ]]; then
359
347
  source_arg=" --source-ref <source-ref>"
360
348
  fi
361
- capture_script="$(helper_script_path "capture-plan.sh")"
349
+ capture_cmd="$(helper_command "capture-plan.sh")"
362
350
 
363
351
  cat <<EOF_CONTEXT
364
352
  # Pending Plan Capture
@@ -372,13 +360,13 @@ A host/thread planning discussion is pending capture and no active repo plan is
372
360
  Capture the decision-complete plan body:
373
361
 
374
362
  \`\`\`bash
375
- printf '%s\n' '<decision-complete plan body>' | bash ${capture_script} --slug ${prompt_slug:-<slug>} --title <title> --status Draft --source ${capture_source} --orchestration-kind ${capture_source} --route planning${source_arg}
363
+ printf '%s\n' '<decision-complete plan body>' | ${capture_cmd} --slug ${prompt_slug:-<slug>} --title <title> --status Draft --source ${capture_source} --orchestration-kind ${capture_source} --route planning${source_arg}
376
364
  \`\`\`
377
365
 
378
366
  If the user has already approved implementation:
379
367
 
380
368
  \`\`\`bash
381
- printf '%s\n' '<approved plan body>' | bash ${capture_script} --slug ${prompt_slug:-<slug>} --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --source ${capture_source} --orchestration-kind ${capture_source} --route planning --execute${source_arg}
369
+ printf '%s\n' '<approved plan body>' | ${capture_cmd} --slug ${prompt_slug:-<slug>} --title <title> --artifact-level work-package --promotion-reason human_decision_boundary --status Approved --source ${capture_source} --orchestration-kind ${capture_source} --route planning --execute${source_arg}
382
370
  \`\`\`
383
371
  EOF_CONTEXT
384
372
  }
@@ -445,7 +433,7 @@ EOF_CONTEXT
445
433
  active_sprint_context() {
446
434
  local marker=".ai/harness/sprint/active-sprint"
447
435
  local sprint_file status progress next_task
448
- local sprint_script capture_script
436
+ local sprint_cmd capture_cmd
449
437
 
450
438
  if [[ -f ".ai/harness/policy.json" ]] && command -v jq >/dev/null 2>&1; then
451
439
  marker="$(jq -r '.sprints.active_marker_file // empty' .ai/harness/policy.json 2>/dev/null || true)"
@@ -481,8 +469,8 @@ active_sprint_context() {
481
469
  }
482
470
  END { if (!found) print "(none)" }
483
471
  ' "$sprint_file")"
484
- sprint_script="$(helper_script_path "sprint-backlog.sh")"
485
- capture_script="$(helper_script_path "capture-plan.sh")"
472
+ sprint_cmd="$(helper_command "sprint-backlog.sh")"
473
+ capture_cmd="$(helper_command "capture-plan.sh")"
486
474
 
487
475
  cat <<EOF_CONTEXT
488
476
  # Active Sprint
@@ -490,7 +478,7 @@ active_sprint_context() {
490
478
  - Sprint: \`${sprint_file}\` status=${status:-unknown} backlog=${progress}
491
479
  - Next sprint task: ${next_task}
492
480
  - Rule: a Sprint is a long-task container. Use \`\$think\` to expand the next sprint task into a detailed \`plans/plan-*.md\`, then run the existing plan -> contract -> worktree flow. \`tasks/todos.md\` stays the deferred-goal ledger.
493
- - Entrypoint: inspect with \`${sprint_script} next\`; after \`\$think\` produces an approved plan, capture it with \`${capture_script} --source waza-think --source-ref sprint:${sprint_file}#${next_task}\`.
481
+ - Entrypoint: inspect with \`${sprint_cmd} next\`; after \`\$think\` produces an approved plan, capture it with \`${capture_cmd} --source waza-think --source-ref sprint:${sprint_file}#${next_task}\`.
494
482
  EOF_CONTEXT
495
483
  }
496
484