repo-harness 0.2.4 → 0.3.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 (101) hide show
  1. package/AGENTS.md +3 -2
  2. package/CLAUDE.md +3 -2
  3. package/README.es.md +5 -6
  4. package/README.fr.md +5 -6
  5. package/README.ja.md +6 -6
  6. package/README.md +92 -65
  7. package/README.zh-CN.md +55 -38
  8. package/SKILL.md +8 -9
  9. package/assets/hooks/codex.hooks.template.json +9 -13
  10. package/assets/hooks/hook-input.sh +14 -2
  11. package/assets/hooks/lib/session-state.sh +4 -1
  12. package/assets/hooks/lib/workflow-state.sh +104 -15
  13. package/assets/hooks/post-bash.sh +6 -0
  14. package/assets/hooks/post-edit-guard.sh +52 -7
  15. package/assets/hooks/{context-pressure-hook.sh → post-tool-observer.sh} +100 -19
  16. package/assets/hooks/pre-edit-guard.sh +80 -0
  17. package/assets/hooks/prompt-guard.sh +448 -897
  18. package/assets/hooks/run-hook.sh +26 -26
  19. package/assets/hooks/session-start-context.sh +62 -4
  20. package/assets/hooks/settings.template.json +9 -13
  21. package/assets/partials/05-workflow.partial.md +1 -1
  22. package/assets/partials/07-footer.partial.md +1 -1
  23. package/assets/partials-agents/02-operating-mode.partial.md +2 -2
  24. package/assets/partials-agents/03-orchestration.partial.md +1 -1
  25. package/assets/partials-agents/04-task-protocol.partial.md +1 -1
  26. package/assets/partials-agents/08-deep-docs.partial.md +1 -1
  27. package/assets/reference-configs/agentic-development-flow.md +1 -0
  28. package/assets/reference-configs/external-tooling.md +2 -2
  29. package/assets/reference-configs/harness-overview.md +1 -1
  30. package/assets/reference-configs/hook-operations.md +32 -48
  31. package/assets/reference-configs/sprint-contracts.md +14 -0
  32. package/assets/skill-commands/manifest.json +7 -0
  33. package/assets/skill-commands/repo-harness-migrate/SKILL.md +1 -1
  34. package/assets/skill-commands/repo-harness-sprint/SKILL.md +39 -0
  35. package/assets/skill-version.json +3 -5
  36. package/assets/templates/helpers/architecture-drift.sh +49 -2
  37. package/assets/templates/helpers/architecture-event.ts +19 -3
  38. package/assets/templates/helpers/archive-architecture-request.sh +29 -0
  39. package/assets/templates/helpers/archive-workflow.sh +49 -16
  40. package/assets/templates/helpers/capability-resolver.ts +1 -1
  41. package/assets/templates/helpers/capture-plan.sh +1 -1
  42. package/assets/templates/helpers/check-task-workflow.sh +123 -2
  43. package/assets/templates/helpers/context-contract-sync.sh +23 -4
  44. package/assets/templates/helpers/contract-worktree.sh +46 -0
  45. package/assets/templates/helpers/ensure-task-workflow.sh +5 -2
  46. package/assets/templates/helpers/migrate-project-template.sh +0 -3
  47. package/assets/templates/helpers/migrate-workflow-docs.ts +4 -0
  48. package/assets/templates/helpers/plan-to-todo.sh +2 -2
  49. package/assets/templates/helpers/refresh-current-status.sh +59 -1
  50. package/assets/templates/helpers/select-agent-context-blocks.sh +2 -2
  51. package/assets/templates/helpers/sprint-backlog.sh +815 -0
  52. package/assets/templates/helpers/sync-brain-docs.sh +74 -4
  53. package/assets/templates/helpers/workflow-contract.ts +0 -7
  54. package/assets/templates/sprint.template.md +66 -0
  55. package/assets/workflow-contract.v1.json +16 -0
  56. package/docs/reference-configs/agentic-development-flow.md +1 -0
  57. package/docs/reference-configs/external-tooling.md +2 -2
  58. package/docs/reference-configs/harness-overview.md +1 -1
  59. package/docs/reference-configs/hook-operations.md +32 -48
  60. package/docs/reference-configs/sprint-contracts.md +14 -0
  61. package/package.json +1 -1
  62. package/scripts/architecture-drift.sh +49 -2
  63. package/scripts/architecture-event.ts +19 -3
  64. package/scripts/archive-architecture-request.sh +29 -0
  65. package/scripts/archive-workflow.sh +49 -16
  66. package/scripts/capability-resolver.ts +1 -1
  67. package/scripts/capture-plan.sh +1 -1
  68. package/scripts/check-task-workflow.sh +123 -2
  69. package/scripts/context-contract-sync.sh +23 -4
  70. package/scripts/contract-worktree.sh +46 -0
  71. package/scripts/ensure-task-workflow.sh +5 -2
  72. package/scripts/hook-shim.sh +60 -4
  73. package/scripts/init-project.sh +1 -1
  74. package/scripts/lib/project-init-lib.sh +45 -33
  75. package/scripts/migrate-project-template.sh +1 -1
  76. package/scripts/migrate-workflow-docs.ts +4 -0
  77. package/scripts/plan-to-todo.sh +2 -2
  78. package/scripts/refresh-current-status.sh +59 -1
  79. package/scripts/repo-harness.sh +152 -20
  80. package/scripts/select-agent-context-blocks.sh +2 -2
  81. package/scripts/sprint-backlog.sh +815 -0
  82. package/scripts/sync-brain-docs.sh +74 -4
  83. package/scripts/sync-codex-installed-copies.sh +9 -64
  84. package/scripts/workflow-contract.ts +0 -7
  85. package/src/cli/commands/doctor.ts +52 -0
  86. package/src/cli/commands/hook.ts +2 -1
  87. package/src/cli/commands/prompt-guard-decision.ts +150 -0
  88. package/src/cli/commands/status.ts +1 -1
  89. package/src/cli/hook/prompt-intents.ts +534 -0
  90. package/src/cli/hook/route-registry.ts +1 -1
  91. package/src/cli/hook/runtime.ts +98 -6
  92. package/src/cli/hook-entry.ts +2 -2
  93. package/src/cli/index.ts +8 -10
  94. package/src/cli/installer/managed-entries.ts +2 -1
  95. package/assets/hooks/atomic-commit.sh +0 -78
  96. package/assets/hooks/atomic-pending.sh +0 -22
  97. package/assets/hooks/finalize-handoff.sh +0 -12
  98. package/assets/hooks/pre-code-change.sh +0 -33
  99. package/assets/hooks/tdd-guard-hook.sh +0 -78
  100. package/assets/hooks/trace-event.sh +0 -76
  101. package/scripts/check-versions.ts +0 -488
package/AGENTS.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # repo-harness AGENTS.md
2
2
 
3
- This repository self-hosts the `repo-harness` contract, formerly `repo-harness-skill` and `project-initializer`. Claude and Codex should follow the same repo-local workflow surface.
3
+ This repository self-hosts the `repo-harness` contract; the former `repo-harness-skill` and `project-initializer` names are retired and removed by installed-copy sync. Claude and Codex should follow the same repo-local workflow surface.
4
4
 
5
5
  ## Canonical Workflow Files
6
6
 
7
7
  - `tasks/current.md` for the tracked current-status snapshot derived from workflow artifacts
8
8
  - `tasks/todo.md` for deferred medium/long-term goals, not active execution checklists
9
+ - `tasks/sprints/` for program-level sprint PRDs and ordered backlogs, operated by `scripts/sprint-backlog.sh` (Sprint = program layer; task contracts stay the execution slices)
9
10
  - `.ai/context/capabilities.json` for the capability registry and longest-prefix context boundaries
10
11
  - `tasks/workstreams/` for capability long-running workstreams that project durable progress into local contracts
11
12
  - `tasks/lessons.md` for correction-derived rules
@@ -22,7 +23,7 @@ This repository self-hosts the `repo-harness` contract, formerly `repo-harness-s
22
23
 
23
24
  - Sync `tasks/` whenever substantive repo changes are made.
24
25
  - Use `tasks/notes/<plan-stem>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; `<plan-stem>` is the active plan filename without `plan-` and `.md` (for example `20260531-0045-governance-workflow`). Do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
25
- - Treat `.ai/hooks/` as the shared repo-local hook implementation; user-level `~/.claude/settings.json` and `~/.codex/hooks.json` are the host adapters.
26
+ - Treat hook execution as central-first: trusted repos run `~/.repo-harness/hooks/` (bash shim) or the packaged CLI copy; this self-host repo pins `"hook_source": "repo"` in `.ai/harness/policy.json` so `.ai/hooks/` stays the live development runtime, with `assets/hooks/` as the product source mirrored on install. User-level `~/.claude/settings.json` and `~/.codex/hooks.json` are the host adapters.
26
27
  - Keep the umbrella hierarchy explicit: architecture owns stable truth, capability contracts own local agent context, `tasks/workstreams/<domain>/<capability>/` owns durable progress, and `tasks/todo.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
27
28
  - Treat `.ai/context/capabilities.json` as the source of truth for capability prefixes; `agent-context-blocks.txt` and nested agent files are compatibility inputs only.
28
29
  - Keep architecture drift handling split: `architecture-drift.sh` writes architecture requests/events, `workstream-sync.sh` maintains durable capability workstreams, and `context-contract-sync.sh` only updates controlled local `CLAUDE.md`/`AGENTS.md` architecture blocks.
package/CLAUDE.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # repo-harness AGENTS.md
2
2
 
3
- This repository self-hosts the `repo-harness` contract, formerly `repo-harness-skill` and `project-initializer`. Claude and Codex should follow the same repo-local workflow surface.
3
+ This repository self-hosts the `repo-harness` contract; the former `repo-harness-skill` and `project-initializer` names are retired and removed by installed-copy sync. Claude and Codex should follow the same repo-local workflow surface.
4
4
 
5
5
  ## Canonical Workflow Files
6
6
 
7
7
  - `tasks/current.md` for the tracked current-status snapshot derived from workflow artifacts
8
8
  - `tasks/todo.md` for deferred medium/long-term goals, not active execution checklists
9
+ - `tasks/sprints/` for program-level sprint PRDs and ordered backlogs, operated by `scripts/sprint-backlog.sh` (Sprint = program layer; task contracts stay the execution slices)
9
10
  - `.ai/context/capabilities.json` for the capability registry and longest-prefix context boundaries
10
11
  - `tasks/workstreams/` for capability long-running workstreams that project durable progress into local contracts
11
12
  - `tasks/lessons.md` for correction-derived rules
@@ -22,7 +23,7 @@ This repository self-hosts the `repo-harness` contract, formerly `repo-harness-s
22
23
 
23
24
  - Sync `tasks/` whenever substantive repo changes are made.
24
25
  - Use `tasks/notes/<plan-stem>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; `<plan-stem>` is the active plan filename without `plan-` and `.md` (for example `20260531-0045-governance-workflow`). Do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
25
- - Treat `.ai/hooks/` as the shared repo-local hook implementation; user-level `~/.claude/settings.json` and `~/.codex/hooks.json` are the host adapters.
26
+ - Treat hook execution as central-first: trusted repos run `~/.repo-harness/hooks/` (bash shim) or the packaged CLI copy; this self-host repo pins `"hook_source": "repo"` in `.ai/harness/policy.json` so `.ai/hooks/` stays the live development runtime, with `assets/hooks/` as the product source mirrored on install. User-level `~/.claude/settings.json` and `~/.codex/hooks.json` are the host adapters.
26
27
  - Keep the umbrella hierarchy explicit: architecture owns stable truth, capability contracts own local agent context, `tasks/workstreams/<domain>/<capability>/` owns durable progress, and `tasks/todo.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
27
28
  - Treat `.ai/context/capabilities.json` as the source of truth for capability prefixes; `agent-context-blocks.txt` and nested agent files are compatibility inputs only.
28
29
  - Keep architecture drift handling split: `architecture-drift.sh` writes architecture requests/events, `workstream-sync.sh` maintains durable capability workstreams, and `context-contract-sync.sh` only updates controlled local `CLAUDE.md`/`AGENTS.md` architecture blocks.
package/README.es.md CHANGED
@@ -186,7 +186,7 @@ adoptar este workflow.
186
186
  npx -y repo-harness init
187
187
  ```
188
188
 
189
- La npm package release line es ahora `0.2.x`; el workflow compatibility model line
189
+ La npm package release line es ahora `0.3.x`; el workflow compatibility model line
190
190
  generado se rastrea por separado como `5.x`. `repo-harness init` es el bootstrap
191
191
  global y `repo-harness update` es el refresco repo-local. `repo-harness init`
192
192
  configura el CLI, los hook adapters de nivel usuario, Waza, Mermaid, el brain
@@ -204,14 +204,13 @@ bun src/cli/index.ts init
204
204
  Modelo de rutas locales:
205
205
 
206
206
  - Repositorio fuente: `~/Projects/repo-harness`
207
- - Claude skill aliases: `~/.claude/skills/repo-harness`, `~/.claude/skills/repo-harness-skill`
207
+ - Claude skill alias: `~/.claude/skills/repo-harness`
208
208
  - Codex discoverable skill alias: `~/.codex/skills/repo-harness`
209
- - Codex compatibility fallback alias: `~/.codex/skills/repo-harness-skill`
210
209
 
211
210
  `~/Projects/repo-harness` es la única source of truth editable. Las rutas locales
212
211
  de Claude/Codex son runtime entrypoints respaldados por symlinks. Los directorios
213
- del runtime `project-initializer` ya retirado los limpia
214
- `scripts/sync-codex-installed-copies.sh`.
212
+ de los runtimes ya retirados `repo-harness-skill` y `project-initializer` los
213
+ elimina `scripts/sync-codex-installed-copies.sh`.
215
214
 
216
215
  ### Prerrequisitos mínimos
217
216
 
@@ -326,7 +325,7 @@ Guards habituales:
326
325
 
327
326
  ## Release actual
328
327
 
329
- - npm package: `repo-harness@0.2.4`
328
+ - npm package: `repo-harness@0.3.0`
330
329
  - Generated workflow compatibility: `5.2.3`
331
330
  - GitHub repository: `Ancienttwo/repo-harness`
332
331
  - Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
package/README.fr.md CHANGED
@@ -190,7 +190,7 @@ de ce workflow.
190
190
  npx -y repo-harness init
191
191
  ```
192
192
 
193
- La release line du package npm est désormais `0.2.x` ; la generated workflow
193
+ La release line du package npm est désormais `0.3.x` ; la generated workflow
194
194
  compatibility model line est suivie séparément en `5.x`. `repo-harness init`
195
195
  sert au bootstrap global et `repo-harness update` sert au rafraîchissement
196
196
  repo-local. `repo-harness init` configure le CLI, les hook adapters de niveau
@@ -208,14 +208,13 @@ bun src/cli/index.ts init
208
208
  Modèle de chemins locaux :
209
209
 
210
210
  - Dépôt source : `~/Projects/repo-harness`
211
- - Claude skill aliases : `~/.claude/skills/repo-harness`, `~/.claude/skills/repo-harness-skill`
211
+ - Claude skill alias : `~/.claude/skills/repo-harness`
212
212
  - Codex discoverable skill alias : `~/.codex/skills/repo-harness`
213
- - Codex compatibility fallback alias : `~/.codex/skills/repo-harness-skill`
214
213
 
215
214
  `~/Projects/repo-harness` est l'unique source of truth éditable. Les chemins
216
215
  Claude/Codex locaux sont des runtime entrypoints adossés à des symlinks. Les
217
- répertoires du runtime `project-initializer` retiré sont nettoyés par
218
- `scripts/sync-codex-installed-copies.sh`.
216
+ répertoires des runtimes retirés `repo-harness-skill` et `project-initializer`
217
+ sont supprimés par `scripts/sync-codex-installed-copies.sh`.
219
218
 
220
219
  ### Prérequis minimaux
221
220
 
@@ -330,7 +329,7 @@ Guards courants :
330
329
 
331
330
  ## Release actuelle
332
331
 
333
- - npm package : `repo-harness@0.2.4`
332
+ - npm package : `repo-harness@0.3.0`
334
333
  - Generated workflow compatibility : `5.2.3`
335
334
  - GitHub repository : `Ancienttwo/repo-harness`
336
335
  - Release history : [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
package/README.ja.md CHANGED
@@ -159,7 +159,7 @@ flowchart TD
159
159
  npx -y repo-harness init
160
160
  ```
161
161
 
162
- npm package の release line は現在 `0.2.x` です。生成される workflow compatibility model line は
162
+ npm package の release line は現在 `0.3.x` です。生成される workflow compatibility model line は
163
163
  別途 `5.x` として追跡されます。`repo-harness init` は global bootstrap、`repo-harness update` は
164
164
  repo-local refresh です。`repo-harness init` は CLI、user-level hook adapters、Waza、Mermaid、
165
165
  brain root、CodeGraph MCP を設定し、退役した `scripts/setup-plugins.sh` の Claude plugin path は使いません。
@@ -175,13 +175,13 @@ bun src/cli/index.ts init
175
175
  ローカルパスのモデル:
176
176
 
177
177
  - ソースリポジトリ:`~/Projects/repo-harness`
178
- - Claude skill aliases:`~/.claude/skills/repo-harness`、`~/.claude/skills/repo-harness-skill`
178
+ - Claude skill alias:`~/.claude/skills/repo-harness`
179
179
  - Codex discoverable skill alias:`~/.codex/skills/repo-harness`
180
- - Codex compatibility fallback alias:`~/.codex/skills/repo-harness-skill`
181
180
 
182
181
  `~/Projects/repo-harness` が唯一の編集可能な source of truth です。ローカルの Claude/Codex パスは
183
- symlink に裏打ちされた runtime entrypoint です。退役した `project-initializer` runtime ディレクトリは
184
- `scripts/sync-codex-installed-copies.sh` によって整理されます。
182
+ symlink に裏打ちされた runtime entrypoint です。退役した `repo-harness-skill`
183
+ `project-initializer` の runtime ディレクトリは
184
+ `scripts/sync-codex-installed-copies.sh` によって削除されます。
185
185
 
186
186
  ### 最小の前提条件
187
187
 
@@ -293,7 +293,7 @@ hook がブロックしたときは、まず terminal の構造化された出
293
293
 
294
294
  ## 現在の Release
295
295
 
296
- - npm package:`repo-harness@0.2.4`
296
+ - npm package:`repo-harness@0.3.0`
297
297
  - Generated workflow compatibility:`5.2.3`
298
298
  - GitHub repository:`Ancienttwo/repo-harness`
299
299
  - Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
package/README.md CHANGED
@@ -6,8 +6,8 @@
6
6
 
7
7
  Repo-local agentic development harness CLI and skill runtime for Claude/Codex
8
8
  workflows. The npm package and primary command are now `repo-harness`.
9
- `repo-harness-skill` remains a compatibility alias, while `project-initializer`
10
- install paths are retired and removed by installed-copy sync.
9
+ The legacy `repo-harness-skill` and `project-initializer` install paths are
10
+ retired and removed by installed-copy sync.
11
11
  Repository: `https://github.com/Ancienttwo/repo-harness`
12
12
 
13
13
  [English](README.md) | [简体中文](README.zh-CN.md) | [日本語](README.ja.md) | [Français](README.fr.md) | [Español](README.es.md)
@@ -34,30 +34,28 @@ This repository now dogfoods its own tasks-first contract. It is both:
34
34
  read a 1KB capability contract or query the index instead of spending thousands of
35
35
  tokens rediscovering structure.
36
36
 
37
- ## What's New in 0.2.4
38
-
39
- - **Plan consultation stays advisory.** Questions and status reports that mention
40
- plans, workflows, hooks, `new plan`, or `方案` no longer fall into
41
- `PlanStatusGuard` or create plan files unless they explicitly start execution.
42
- - **Autoresearch is no longer a background hook.** The self-host-only
43
- `autoresearch-advisory.sh` route is retired from `.ai/hooks`, generated hook
44
- installers, and user-level adapters. Autoresearch evidence is now gathered by
45
- an explicit agent-run workflow, not by an always-on hook.
46
- - **Hook parity is stricter.** Self-host `.ai/hooks/` and installable
47
- `assets/hooks/` now match without maintainer-only hook exceptions.
48
- - **Copied hook fallback.** Installed prompt hooks now keep PlanCaptureGate
49
- guidance working even when the copied runtime cannot reach the TypeScript
50
- decision engine.
51
- - **Darwin readiness gates.** Workflow checks now catch stale handoff/resume
52
- plan references, and public action-command skills have static quality gates
53
- for failure modes, boundaries, and high-risk checkpoints.
54
- - **Authoritative eval evidence.** Benchmark reports now include
55
- `full_test_count`, `dry_run_ratio`, `grader_pass_rate`, and
56
- `effectiveness_authority`, so dry-run smoke output cannot be mistaken for
57
- release-grade skill effectiveness proof.
58
- - **Tooling freshness.** The self-host CodeGraph dev dependency is refreshed to
59
- `0.9.9`, and gbrain readiness probes try `doctor --json --fast` before the
60
- full doctor path.
37
+ ## What's New in 0.3.0
38
+
39
+ - **Sprint program layer.** `repo-harness-sprint`, `tasks/sprints/`, sprint
40
+ templates, active sprint markers, and `scripts/sprint-backlog.sh` now capture
41
+ program-level PRDs and ordered backlogs without turning `tasks/todo.md` into
42
+ an active execution checklist.
43
+ - **Central-first hook runtime.** User-level Claude/Codex adapters dispatch into
44
+ `repo-harness-hook`; central packaged hooks are the default runtime, while
45
+ this self-host repo can still pin `"hook_source": "repo"` for live hook
46
+ development.
47
+ - **Prompt decisions moved to TypeScript.** Prompt-text intent classification is
48
+ Unicode-aware in `src/cli/hook/prompt-intents.ts`, the shell hook receives one
49
+ verdict JSON line, and prompt-layer plan/spec/contract gates are advisory.
50
+ - **Edit-layer enforcement.** Implementation writes are enforced at
51
+ `pre-edit-guard.sh`, where the guard can key off path, active plan state, and
52
+ repo files instead of natural-language guesses.
53
+ - **Cheaper always-on hooks.** `trace-event.sh` and `context-pressure-hook.sh`
54
+ are merged into `post-tool-observer.sh`: one dispatch, one stdin parse, one
55
+ trace file, and sampled context-budget probes.
56
+ - **Legacy surface cleanup.** The retired `repo-harness-skill`,
57
+ `project-initializer`, `PROJECT_INITIALIZER_*` fallbacks, duplicate shell
58
+ classifier table, orphan version checker, and split observer hooks are gone.
61
59
 
62
60
  ## What repo-harness Does
63
61
 
@@ -87,19 +85,28 @@ The design has three layers:
87
85
  `.ai/harness/`, helper scripts, and `.ai/hooks/`.
88
86
  3. **Host adapters**: user-level `~/.claude/settings.json` and
89
87
  `~/.codex/hooks.json` route Claude/Codex events into `repo-harness-hook`.
90
- The hook entrypoint exits silently for non-opt-in repos and dispatches into
91
- the current repo's `.ai/hooks/*` scripts only when
92
- `.ai/harness/workflow-contract.json` exists.
88
+ The hook entrypoint exits silently for non-opt-in repos. For opted-in repos,
89
+ it resolves hooks central-first through the packaged install or
90
+ `~/.repo-harness/hooks/`, with repo policy able to pin self-host development
91
+ back to `.ai/hooks/*`.
93
92
 
94
93
  For `UserPromptSubmit`, the public adapter contract stays
95
94
  `repo-harness-hook UserPromptSubmit --route default`. The CLI route registry
96
95
  dispatches that route to `.ai/hooks/prompt-guard.sh`. The shell hook remains the
97
96
  repo-local adapter for host JSON parsing, workflow file reads, capture side
98
- effects, quality gate rendering, and host-safe stdout/stderr. The prompt intent
99
- and workflow-state decision is handled by the TypeScript decision engine behind
100
- `repo-harness-hook prompt-guard-decide`, which returns one action enum from an
101
- explicit decision table. That split keeps host configuration stable while moving
102
- the brittle classifier/state-machine layer out of shell conditionals.
97
+ effects, and host-safe stdout/stderr. It pipes the prompt text into
98
+ `repo-harness-hook prompt-guard-decide`, where every prompt-text intent
99
+ classifier (Unicode-aware, `src/cli/hook/prompt-intents.ts`) and the
100
+ `intent x plan state` decision table live; the engine returns one verdict JSON
101
+ line with the action, the classified intent facts, and derived strings. The
102
+ shell keeps no duplicate classifier or fallback decision table — when the
103
+ engine is unreachable the prompt layer degrades to a one-shot advisory.
104
+
105
+ Prompt-layer plan/spec/contract gates are advisory routing. Hard enforcement
106
+ lives at the edit boundary: `pre-edit-guard.sh` blocks implementation edits
107
+ unless the active plan is Approved/Executing (policy
108
+ `.guards.edit_plan_gate`: enforce | advice | off). Done-claim gates keep
109
+ blocking because they verify file-backed completion evidence, not language.
103
110
 
104
111
  The core invariant is that durable truth lives in the repo, not in a chat
105
112
  thread. Hooks are accelerators and guardrails; the authority remains the
@@ -108,13 +115,20 @@ file-backed plan, contract, review, checks, and handoff artifacts.
108
115
  ## Task Workflow: Plan to Closeout
109
116
 
110
117
  The diagram below assumes the harness is already installed in the repo. It shows
111
- the normal task lifecycle: plan, project into a sprint contract, check out the
118
+ the normal lifecycle from a program sprint backlog down to one contract task:
119
+ draft or select the task, project it into execution files, check out the
112
120
  contract worktree when policy requires it, implement under hooks, verify, review,
113
- and close out.
121
+ complete the sprint task when applicable, and close out.
114
122
 
115
123
  ```mermaid
116
124
  flowchart TD
117
- UserTask["User task or planning prompt"] --> Discovery["Due diligence<br/>P1 map, P2 trace, P3 decision"]
125
+ Program["Program goal or release theme"] --> Sprint{"Sprint layer needed?"}
126
+ Sprint -->|yes| SprintDoc["Sprint PRD + backlog<br/>tasks/sprints/*.sprint.md"]
127
+ SprintDoc --> NextTask["Select next sprint task<br/>sprint-backlog.sh next"]
128
+ Sprint -->|no| UserTask["User task or planning prompt"]
129
+ NextTask --> UserTask
130
+
131
+ UserTask --> Discovery["Due diligence<br/>P1 map, P2 trace, P3 decision"]
118
132
  Discovery --> PlanDraft["Draft plan<br/>plans/plan-*.md"]
119
133
  PlanDraft --> PlanReview{"Plan ready for execution?"}
120
134
  PlanReview -->|no| Refine["Refine plan, scope, evidence contract"]
@@ -123,6 +137,7 @@ flowchart TD
123
137
 
124
138
  Approve --> Project["Project plan into execution<br/>capture-plan.sh --execute<br/>or plan-to-todo.sh --plan"]
125
139
  Project --> Active["Active markers<br/>.ai/harness/active-plan<br/>.ai/harness/active-worktree"]
140
+ Project --> SprintActive["Sprint projection<br/>active-sprint marker<br/>tasks/current.md"]
126
141
  Project --> Contract["Sprint contract<br/>tasks/contracts/YYYYMMDD-HHMM-task-slug.contract.md"]
127
142
  Project --> ReviewFile["Review file<br/>tasks/reviews/YYYYMMDD-HHMM-task-slug.review.md"]
128
143
  Project --> Notes["Task notes<br/>tasks/notes/YYYYMMDD-HHMM-task-slug.notes.md"]
@@ -146,7 +161,10 @@ flowchart TD
146
161
  External --> DoneGate{"Contract, checks, review, and acceptance pass?"}
147
162
  DoneGate -->|no| Repair["Repair failing evidence or implementation"]
148
163
  Repair --> Implement
149
- DoneGate -->|yes| Closeout["Closeout<br/>scripts/contract-worktree.sh finish"]
164
+ DoneGate -->|yes| SprintComplete{"Sprint task active?"}
165
+ SprintComplete -->|yes| MarkSprint["Mark backlog item complete<br/>sprint-backlog.sh complete-task"]
166
+ SprintComplete -->|no| Closeout["Closeout<br/>scripts/contract-worktree.sh finish"]
167
+ MarkSprint --> Closeout
150
168
 
151
169
  Closeout --> Commit["Commit contract branch"]
152
170
  Commit --> Merge["Fast-forward target branch"]
@@ -183,14 +201,13 @@ npx -y repo-harness update
183
201
  repository to install or refresh workflow files, hook assets, host adapters,
184
202
  skill aliases, and repo-local verification surfaces from the current npm package.
185
203
 
186
- The npm package release line is now `0.2.x`; generated workflow compatibility is
187
- tracked separately as the `5.x` model line. The `0.2.4` package keeps first-run
204
+ The npm package release line is now `0.3.x`; generated workflow compatibility is
205
+ tracked separately as the `5.x` model line. The `0.3.0` package keeps first-run
188
206
  global bootstrap (`repo-harness init`) separate from repo-local refresh
189
- (`repo-harness update`), preserves the typed global bootstrap and read-only
190
- config security sentinel, tightens hook parity, retires the self-host
191
- autoresearch advisory hook, prevents consultative plan/workflow prompts from
192
- being mistaken for execution, and adds copied-hook fallback, readiness checks,
193
- and skill-eval authority reporting.
207
+ (`repo-harness update`), adds the sprint program layer, moves hook execution to
208
+ central-first runtime resolution, moves prompt decisions into TypeScript,
209
+ enforces implementation writes at the edit boundary, and merges always-on hook
210
+ observers into one cheaper path.
194
211
  These sit on top of the renamed `repo-harness` CLI, user-level hook
195
212
  adapter bootstrap, AI-native scaffold overlays, the typed prompt-guard decision
196
213
  engine, plan-stem task artifact naming, `REPO_HARNESS_*` runtime aliases, Waza
@@ -207,16 +224,14 @@ bun src/cli/index.ts update
207
224
  Local path model:
208
225
 
209
226
  - Source repo: `~/Projects/repo-harness`
210
- - Claude skill aliases: `~/.claude/skills/repo-harness`, `~/.claude/skills/repo-harness-skill`
227
+ - Claude skill alias: `~/.claude/skills/repo-harness`
211
228
  - Codex discoverable skill alias: `~/.codex/skills/repo-harness`
212
- - Codex compatibility fallback alias: `~/.codex/skills/repo-harness-skill`
213
229
 
214
230
  The `~/Projects/repo-harness` repo is the only editable source of truth. Local
215
231
  Claude/Codex paths are symlink-backed runtime entrypoints. Only
216
232
  `~/.codex/skills/repo-harness` should expose `SKILL.md` and
217
- `assets/skill-commands/`; compatibility directories exist only so renamed
218
- repos can still resolve upstream assets without duplicate command discovery.
219
- The retired `project-initializer` directories under `~/.codex/skills` and
233
+ `assets/skill-commands/`. The retired `repo-harness-skill` and
234
+ `project-initializer` directories under `~/.codex/skills` and
220
235
  `~/.claude/skills` are deleted by `scripts/sync-codex-installed-copies.sh`.
221
236
 
222
237
  ### Minimum prerequisites
@@ -274,16 +289,29 @@ before applying anything.
274
289
  - Repo-local `.claude/settings.json` and `.codex/hooks.json` hook adapters are legacy project-level config and should be retired during migration.
275
290
  - Codex must mark `~/.codex/hooks.json` as trusted in Codex Settings before those hooks run.
276
291
  - Debug in this order: user-level adapter config -> `repo-harness-hook` (or fallback `repo-harness hook`) -> route registry -> `.ai/hooks/*`.
292
+ - If `repo-harness-hook` reports `.ai/hooks` drift, refresh the repo-local copy with `repo-harness update --repo <root>`.
277
293
 
278
- `SessionStart` runs two ordered scripts before work begins:
294
+ `SessionStart` resolves hooks central-first, then runs two ordered scripts before
295
+ work begins:
279
296
 
280
297
  ```mermaid
281
298
  flowchart LR
282
- SessionStart["Claude/Codex SessionStart"] --> Ctx["session-start-context.sh<br/>resume + handoff context"]
299
+ SessionStart["Claude/Codex SessionStart"] --> Adapter["user-level adapter"]
300
+ Adapter --> Entry["repo-harness-hook SessionStart --route default"]
301
+ Entry --> Source{"hook source"}
302
+ Source -->|central default| Central["packaged hooks<br/>or ~/.repo-harness/hooks"]
303
+ Source -->|repo policy pin| Repo["repo .ai/hooks<br/>self-host development"]
304
+ Central --> Ctx["session-start-context.sh<br/>resume + sprint + handoff context"]
305
+ Repo --> Ctx
283
306
  Ctx --> Sec["security-sentinel.sh<br/>read-only config scan, fingerprint-gated"]
284
307
  Sec --> SSOut["SessionStart additionalContext<br/>prior-session state + SecurityConfig findings"]
285
308
  ```
286
309
 
310
+ `SessionStart` and `Stop` hooks are advisory for missing repo-local scripts: stale
311
+ repos get a drift warning instead of a startup failure. Required guard routes,
312
+ including edit and prompt gates, still fail closed when their scripts are
313
+ missing.
314
+
287
315
  Prompt guard has one extra internal step:
288
316
 
289
317
  ```mermaid
@@ -292,15 +320,15 @@ flowchart LR
292
320
  Adapter --> CLI["repo-harness-hook UserPromptSubmit --route default"]
293
321
  CLI --> Route["route registry"]
294
322
  Route --> Shell[".ai/hooks/prompt-guard.sh"]
295
- Shell --> Decision["repo-harness-hook prompt-guard-decide<br/>TypeScript decision table"]
296
- Decision --> Action["single action enum"]
297
- Action --> Shell
323
+ Shell -->|"stdin {prompt}"| Decision["repo-harness-hook prompt-guard-decide<br/>TypeScript classifiers + decision table"]
324
+ Decision -->|"verdict JSON<br/>action + intent facts + derived"| Shell
298
325
  Shell --> RouteHint["Waza route hint<br/>explicit think/planning matched first → /think"]
299
- Shell --> HostOutput["host-safe allow, advice, block, or done gate output"]
326
+ Shell --> HostOutput["host-safe advice, done gate, or capture output"]
300
327
  ```
301
328
 
302
- The shell layer still owns filesystem authority and side effects. TypeScript owns
303
- only the classifier plus `intent x plan state` decision table.
329
+ The shell layer owns filesystem authority and side effects. TypeScript owns all
330
+ prompt-text classification plus the `intent x plan state` decision table.
331
+ Plan-state blocks render at the PreToolUse edit layer, not here.
304
332
 
305
333
  ## Hook Failure Playbook
306
334
 
@@ -313,7 +341,7 @@ fields are `guard`, `reason`, `fix`, `failure_class`, and `run_id`.
313
341
 
314
342
  Most common guards:
315
343
 
316
- - `PlanStatusGuard`: no active plan, or the plan is not ready to execute
344
+ - `PlanStatusGuard` (edit layer): an implementation edit was attempted with no active plan, or the plan is not ready to execute; the prompt layer emits the same guard name as advisory guidance
317
345
  - `ContractGuard`: approved execution has not yet produced the contract/review/notes scaffold
318
346
  - `ContractGuard`: completion was claimed before the task contract passed
319
347
  - `WorktreeGuard`: writes were attempted in the primary worktree while linked worktrees are enforced
@@ -330,7 +358,7 @@ Most common guards:
330
358
 
331
359
  ## Current Release
332
360
 
333
- - npm package: `repo-harness@0.2.4`
361
+ - npm package: `repo-harness@0.3.0`
334
362
  - Generated workflow compatibility: `5.2.3`
335
363
  - GitHub repository: `Ancienttwo/repo-harness`
336
364
  - Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
@@ -402,6 +430,7 @@ Source-owned command facades live in `assets/skill-commands/`. They keep host
402
430
  skill discovery compatible while the CLI and hooks own execution:
403
431
 
404
432
  - Planning and review: `repo-harness-plan`, `repo-harness-review`, `repo-harness-autoplan`
433
+ - Sprint program layer: `repo-harness-sprint` (PRD + ordered backlog in `tasks/sprints/`, executed task-by-task through the contract flow)
405
434
  - 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`
406
435
  - Branch project creation command: `repo-harness-scaffold`
407
436
 
@@ -435,11 +464,9 @@ passes. These commands call existing repo-local helpers and keep their scope
435
464
  narrow instead of refreshing the full harness.
436
465
 
437
466
  Codex installed-copy rule: only `~/.codex/skills/repo-harness` exposes the root
438
- skill and `repo-harness-*` command facades. The compatibility directory
439
- `~/.codex/skills/repo-harness-skill` is a runtime fallback bundle only; it must
440
- not contain `SKILL.md` files or `assets/skill-commands/`. The retired
441
- `~/.codex/skills/project-initializer` and `~/.claude/skills/project-initializer`
442
- directories are removed during sync.
467
+ skill and `repo-harness-*` command facades. The retired `repo-harness-skill`
468
+ and `project-initializer` directories under `~/.codex/skills` and
469
+ `~/.claude/skills` are removed during sync.
443
470
 
444
471
  After cloning or moving this source repo, rebuild the local runtime aliases with:
445
472
 
package/README.zh-CN.md CHANGED
@@ -23,25 +23,25 @@ repo-local workflow 的自托管样例。
23
23
  做渐进式上下文加载:一份小而稳定的 root context(约 12KB),加上只在改到对应文件时才加载的
24
24
  capability 块。agent 读一份 1KB 的 capability 合约或查索引,而不是花上千 token 重新摸清结构。
25
25
 
26
- ## 0.2.4 新特性
27
-
28
- - **计划咨询保持 advisory。** 提到 plans、workflow、hooks、`new plan` 或 `方案` 的问题和状态报告,
29
- 不再因为包含执行相关词就进入 `PlanStatusGuard` 或创建 plan 文件;只有明确开始执行时才触发执行门。
30
- - **Autoresearch 不再是后台 hook。** 自托管专用的 `autoresearch-advisory.sh` route 已从
31
- `.ai/hooks`、生成的 hook installer 和 user-level adapters 里退休。需要 autoresearch 证据时,
32
- agent 显式运行实验流程,而不是靠常驻 hook 提示。
33
- - **Hook parity 更严格。** 自托管 `.ai/hooks/` 和可安装的 `assets/hooks/` 现在必须完全一致,
34
- 不再保留 maintainer-only hook exception。
35
- - **复制版 hook fallback。** 已安装的 prompt hook 即使找不到 TypeScript decision
36
- engine,也会保留 PlanCaptureGate guidance,而不是直接报 engine unavailable
37
- - **Darwin readiness gates。** Workflow checks 现在会抓 stale handoff/resume plan
38
- references;公共 action-command skills 也增加 failure modes、boundaries 和高风险
39
- checkpoint 的静态质量门。
40
- - **权威 eval evidence。** Benchmark report 现在输出 `full_test_count`、
41
- `dry_run_ratio`、`grader_pass_rate` 和 `effectiveness_authority`,避免把 dry-run
42
- smoke 当成 release-grade skill effectiveness 证明。
43
- - **Tooling freshness。** self-host CodeGraph dev dependency 刷到 `0.9.9`,gbrain
44
- readiness 会先尝试 `doctor --json --fast`,再 fallback 到完整 doctor。
26
+ ## 0.3.0 新特性
27
+
28
+ - **Sprint program layer。** `repo-harness-sprint`、`tasks/sprints/`、sprint
29
+ template、active sprint marker 和 `scripts/sprint-backlog.sh` 现在承接 program
30
+ PRD 与有序 backlog,不再把 `tasks/todo.md` 当成活跃执行 checklist。
31
+ - **Central-first hook runtime。** User-level Claude/Codex adapters 进入
32
+ `repo-harness-hook`;默认跑 central packaged hooks,本仓库自托管开发时仍可通过
33
+ `"hook_source": "repo"` 钉回 repo `.ai/hooks`。
34
+ - **Prompt decision 进入 TypeScript。** Prompt-text intent classifier 在
35
+ `src/cli/hook/prompt-intents.ts` 里处理 Unicode,shell hook 只接收一行 verdict
36
+ JSON,prompt 层的 plan/spec/contract gate 退为 advisory
37
+ - **Edit-layer enforcement。** 真正的实现写入由 `pre-edit-guard.sh` 拦截,依据路径、
38
+ active plan state 和仓库文件判断,不再靠自然语言猜测。
39
+ - **Always-on hooks 更轻。** `trace-event.sh` 与 `context-pressure-hook.sh` 合并为
40
+ `post-tool-observer.sh`:一次 dispatch、一次 stdin parse、一份 trace 文件,并抽样跑
41
+ context-budget probes。
42
+ - **Legacy surface 清理。** 已退休的 `repo-harness-skill`、`project-initializer`、
43
+ `PROJECT_INITIALIZER_*` fallbacks、重复 shell classifier table、孤立 version checker
44
+ 和拆分 observer hooks 都已移除。
45
45
 
46
46
  ## 产品做什么
47
47
 
@@ -69,8 +69,9 @@ repo-local hooks,然后验证这些 workflow surfaces 仍然一致。
69
69
  `.ai/hooks/`。
70
70
  3. **Host adapter 层**:user-level `~/.claude/settings.json` 和 `~/.codex/hooks.json`
71
71
  把 Claude/Codex events 路由到 `repo-harness-hook`。hook entrypoint 会先检查当前
72
- repo 是否存在 `.ai/harness/workflow-contract.json`;没有 opt in 就静默退出,有 opt in
73
- 才进入当前仓库的 `.ai/hooks/*`。
72
+ repo 是否存在 `.ai/harness/workflow-contract.json`;没有 opt in 就静默退出。有 opt in
73
+ 时按 central-first 解析 packaged install 或 `~/.repo-harness/hooks/`,repo policy
74
+ 也可以把自托管开发钉回 `.ai/hooks/*`。
74
75
 
75
76
  对 `UserPromptSubmit` 来说,公开 adapter contract 仍然是
76
77
  `repo-harness-hook UserPromptSubmit --route default`。CLI route registry 会把这个
@@ -86,13 +87,20 @@ classifier/state-machine 层不再散落在 shell 条件分支里。
86
87
 
87
88
  ## 任务 Workflow:从 Plan 到 Closeout
88
89
 
89
- 下面这张图假设目标仓库已经安装 harness。它展示的是单个任务的正常闭环:
90
- 先形成 plan,再投射到 sprint contract,需要时 checkout 隔离 worktree,在 hooks 保护下实现,
91
- 然后验证、review、external acceptance,最后 closeout。
90
+ 下面这张图假设目标仓库已经安装 harness。它展示的是从 program sprint backlog
91
+ 到单个 contract task 的正常闭环:先选择或形成任务,再投射到执行文件,需要时
92
+ checkout 隔离 worktree,在 hooks 保护下实现,然后验证、review、external acceptance
93
+ 必要时标记 sprint task 完成,最后 closeout。
92
94
 
93
95
  ```mermaid
94
96
  flowchart TD
95
- UserTask["用户任务或 planning prompt"] --> Discovery["前置调查<br/>P1 map, P2 trace, P3 decision"]
97
+ Program["Program goal 或 release theme"] --> Sprint{"需要 sprint layer?"}
98
+ Sprint -->|是| SprintDoc["Sprint PRD + backlog<br/>tasks/sprints/*.sprint.md"]
99
+ SprintDoc --> NextTask["选择下一个 sprint task<br/>sprint-backlog.sh next"]
100
+ Sprint -->|否| UserTask["用户任务或 planning prompt"]
101
+ NextTask --> UserTask
102
+
103
+ UserTask --> Discovery["前置调查<br/>P1 map, P2 trace, P3 decision"]
96
104
  Discovery --> PlanDraft["Draft plan<br/>plans/plan-*.md"]
97
105
  PlanDraft --> PlanReview{"Plan 是否可执行?"}
98
106
  PlanReview -->|否| Refine["收敛 scope 和 evidence contract"]
@@ -101,6 +109,7 @@ flowchart TD
101
109
 
102
110
  Approve --> Project["投射到执行面<br/>capture-plan.sh --execute<br/>或 plan-to-todo.sh --plan"]
103
111
  Project --> Active["Active markers<br/>.ai/harness/active-plan<br/>.ai/harness/active-worktree"]
112
+ Project --> SprintActive["Sprint projection<br/>active-sprint marker<br/>tasks/current.md"]
104
113
  Project --> Contract["Sprint contract<br/>tasks/contracts/YYYYMMDD-HHMM-task-slug.contract.md"]
105
114
  Project --> ReviewFile["Review file<br/>tasks/reviews/YYYYMMDD-HHMM-task-slug.review.md"]
106
115
  Project --> Notes["Task notes<br/>tasks/notes/YYYYMMDD-HHMM-task-slug.notes.md"]
@@ -124,7 +133,10 @@ flowchart TD
124
133
  External --> DoneGate{"Contract、checks、review、acceptance 是否通过?"}
125
134
  DoneGate -->|否| Repair["修复失败 evidence 或实现"]
126
135
  Repair --> Implement
127
- DoneGate -->|是| Closeout["Closeout<br/>scripts/contract-worktree.sh finish"]
136
+ DoneGate -->|是| SprintComplete{"存在 active sprint task?"}
137
+ SprintComplete -->|是| MarkSprint["标记 backlog item 完成<br/>sprint-backlog.sh complete-task"]
138
+ SprintComplete -->|否| Closeout["Closeout<br/>scripts/contract-worktree.sh finish"]
139
+ MarkSprint --> Closeout
128
140
 
129
141
  Closeout --> Commit["提交 contract branch"]
130
142
  Commit --> Merge["Fast-forward target branch"]
@@ -159,12 +171,11 @@ npx -y repo-harness update
159
171
  安装或刷新 workflow files、hook assets、host adapters、skill aliases 和
160
172
  repo-local verification surfaces。
161
173
 
162
- npm package release line 现在是 `0.2.x`;生成的 workflow compatibility model line
163
- 单独以 `5.x` 追踪。`repo-harness@0.2.4` 继续把首次全局引导(`repo-harness init`)
164
- 和 repo-local 刷新(`repo-harness update`)拆开,保留 typed global bootstrap 与只读
165
- 配置安全哨兵,同时收紧 hook parity,退休自托管 autoresearch advisory hook,避免
166
- 计划/工作流咨询 prompt 被误判成执行请求,并增加复制版 hook fallback、readiness checks
167
- 和 skill-eval authority reporting。
174
+ npm package release line 现在是 `0.3.x`;生成的 workflow compatibility model line
175
+ 单独以 `5.x` 追踪。`repo-harness@0.3.0` 继续把首次全局引导(`repo-harness init`)
176
+ 和 repo-local 刷新(`repo-harness update`)拆开,新增 sprint program layer,把 hook
177
+ 执行切到 central-first runtime resolution,把 prompt decision 移进 TypeScript,在
178
+ edit boundary 执行实现写入门,并把 always-on hook observers 合并为更轻的一条路径。
168
179
  这些能力叠加在改名后的 CLI、user-level hook adapter bootstrap、AI-native scaffold overlays、
169
180
  typed prompt-guard decision engine、plan-stem task artifact 命名、`REPO_HARNESS_*`
170
181
  runtime aliases、Waza runtime skill sync,以及 maintainer 发布 npm 前使用的 release gate 之上。
@@ -180,12 +191,12 @@ bun src/cli/index.ts update
180
191
  本地路径模型:
181
192
 
182
193
  - 源码仓库:`~/Projects/repo-harness`
183
- - Claude skill aliases:`~/.claude/skills/repo-harness`、`~/.claude/skills/repo-harness-skill`
194
+ - Claude skill alias:`~/.claude/skills/repo-harness`
184
195
  - Codex discoverable skill alias:`~/.codex/skills/repo-harness`
185
- - Codex compatibility fallback alias:`~/.codex/skills/repo-harness-skill`
186
196
 
187
197
  `~/Projects/repo-harness` 是唯一可编辑 source of truth。本地 Claude/Codex 路径是
188
- symlink-backed runtime entrypoints。退休的 `project-initializer` runtime 目录会被
198
+ symlink-backed runtime entrypoints。退休的 `repo-harness-skill`
199
+ `project-initializer` runtime 目录会被
189
200
  `scripts/sync-codex-installed-copies.sh` 清理。
190
201
 
191
202
  ### 最小前置条件
@@ -242,11 +253,17 @@ bun test
242
253
  - Codex 必须在 Settings 里信任 `~/.codex/hooks.json`,hooks 才会执行。
243
254
  - 调试顺序:user-level adapter config -> `repo-harness-hook` 或 fallback `repo-harness hook` -> route registry -> `.ai/hooks/*`。
244
255
 
245
- `SessionStart` 在开工前按顺序跑两个脚本:
256
+ `SessionStart` 先按 central-first 解析 hook source,再按顺序跑两个脚本:
246
257
 
247
258
  ```mermaid
248
259
  flowchart LR
249
- SessionStart["Claude/Codex SessionStart"] --> Ctx["session-start-context.sh<br/>恢复 + handoff 上下文"]
260
+ SessionStart["Claude/Codex SessionStart"] --> Adapter["user-level adapter"]
261
+ Adapter --> Entry["repo-harness-hook SessionStart --route default"]
262
+ Entry --> Source{"hook source"}
263
+ Source -->|central default| Central["packaged hooks<br/>或 ~/.repo-harness/hooks"]
264
+ Source -->|repo policy pin| Repo["repo .ai/hooks<br/>self-host development"]
265
+ Central --> Ctx["session-start-context.sh<br/>恢复 + sprint + handoff 上下文"]
266
+ Repo --> Ctx
250
267
  Ctx --> Sec["security-sentinel.sh<br/>只读配置扫描,按指纹门控"]
251
268
  Sec --> SSOut["SessionStart additionalContext<br/>上次会话状态 + SecurityConfig 发现项"]
252
269
  ```
@@ -297,7 +314,7 @@ hook block 工作时,先看 terminal 里的结构化输出。核心字段是
297
314
 
298
315
  ## 当前 Release
299
316
 
300
- - npm package:`repo-harness@0.2.4`
317
+ - npm package:`repo-harness@0.3.0`
301
318
  - Generated workflow compatibility:`5.2.3`
302
319
  - GitHub repository:`Ancienttwo/repo-harness`
303
320
  - Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)