repo-harness 0.6.0 → 0.7.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 (75) hide show
  1. package/.agents/skills/repo-harness-chatgpt-browser/SKILL.md +106 -0
  2. package/README.es.md +13 -13
  3. package/README.fr.md +13 -14
  4. package/README.ja.md +7 -6
  5. package/README.md +100 -14
  6. package/README.zh-CN.md +35 -11
  7. package/assets/hooks/lib/workflow-state.sh +83 -13
  8. package/assets/reference-configs/agentic-development-flow.md +7 -0
  9. package/assets/reference-configs/document-generation.md +1 -0
  10. package/assets/reference-configs/handoff-protocol.md +5 -7
  11. package/assets/reference-configs/harness-overview.md +13 -0
  12. package/assets/reference-configs/sprint-contracts.md +26 -6
  13. package/assets/skill-commands/repo-harness-goal/SKILL.md +1 -1
  14. package/assets/skill-version.json +6 -2
  15. package/assets/templates/contract.template.md +15 -4
  16. package/assets/templates/helpers/archive-workflow.sh +2 -2
  17. package/assets/templates/helpers/capture-plan.sh +2 -2
  18. package/assets/templates/helpers/check-task-workflow.sh +161 -2
  19. package/assets/templates/helpers/contract-run.ts +71 -8
  20. package/assets/templates/helpers/contract-worktree.sh +5 -9
  21. package/assets/templates/helpers/ensure-task-workflow.sh +28 -6
  22. package/assets/templates/helpers/harness-trace-grade.sh +150 -0
  23. package/assets/templates/helpers/new-plan.sh +2 -2
  24. package/assets/templates/helpers/plan-to-todo.sh +45 -4
  25. package/assets/templates/helpers/prepare-handoff.sh +51 -4
  26. package/assets/templates/helpers/sprint-backlog.sh +8 -2
  27. package/assets/templates/helpers/verify-contract.sh +90 -13
  28. package/assets/templates/helpers/verify-sprint.sh +496 -14
  29. package/assets/templates/plan.template.md +2 -2
  30. package/assets/templates/review.template.md +13 -1
  31. package/assets/workflow-contract.v1.json +2 -0
  32. package/docs/repo-harness-chatgpt-browser-engine.md +184 -0
  33. package/package.json +10 -2
  34. package/scripts/archive-workflow.sh +2 -2
  35. package/scripts/capture-plan.sh +2 -2
  36. package/scripts/check-ci.sh +35 -1
  37. package/scripts/check-release-published.sh +51 -0
  38. package/scripts/check-tarball-install-smoke.sh +58 -0
  39. package/scripts/check-task-workflow.sh +161 -2
  40. package/scripts/contract-run.ts +71 -8
  41. package/scripts/contract-worktree.sh +5 -9
  42. package/scripts/ensure-task-workflow.sh +28 -6
  43. package/scripts/harness-trace-grade.sh +150 -0
  44. package/scripts/lib/project-init-lib.sh +30 -8
  45. package/scripts/new-plan.sh +2 -2
  46. package/scripts/plan-to-todo.sh +45 -4
  47. package/scripts/prepare-handoff.sh +51 -4
  48. package/scripts/sprint-backlog.sh +8 -2
  49. package/scripts/verify-contract.sh +90 -13
  50. package/scripts/verify-sprint.sh +496 -14
  51. package/src/cli/chatgpt-browser/engine.ts +182 -0
  52. package/src/cli/chatgpt-browser/file-policy.ts +158 -0
  53. package/src/cli/chatgpt-browser/native-provider.ts +378 -0
  54. package/src/cli/chatgpt-browser/oracle-provider.ts +108 -0
  55. package/src/cli/chatgpt-browser/prompt-assembler.ts +29 -0
  56. package/src/cli/chatgpt-browser/session-store.ts +294 -0
  57. package/src/cli/chatgpt-browser/types.ts +159 -0
  58. package/src/cli/commands/chatgpt.ts +309 -0
  59. package/src/cli/commands/mcp.ts +244 -0
  60. package/src/cli/index.ts +24 -1
  61. package/src/cli/mcp/audit.ts +32 -0
  62. package/src/cli/mcp/auth.ts +106 -0
  63. package/src/cli/mcp/instructions.ts +9 -0
  64. package/src/cli/mcp/oauth.ts +214 -0
  65. package/src/cli/mcp/paths.ts +115 -0
  66. package/src/cli/mcp/policy.ts +127 -0
  67. package/src/cli/mcp/redaction.ts +53 -0
  68. package/src/cli/mcp/repo.ts +24 -0
  69. package/src/cli/mcp/server.ts +87 -0
  70. package/src/cli/mcp/setup.ts +681 -0
  71. package/src/cli/mcp/tools.ts +995 -0
  72. package/src/cli/mcp/transports/http.ts +372 -0
  73. package/src/cli/mcp/transports/stdio.ts +8 -0
  74. package/src/cli/mcp/types.ts +34 -0
  75. package/src/effects/fs-transaction.ts +287 -12
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: repo-harness-chatgpt-browser
3
+ description: Use when the user wants Codex to consult their logged-in ChatGPT Web session through repo-harness browser engine for planning, architecture review, PRD critique, or Codex goal generation.
4
+ ---
5
+
6
+ # repo-harness ChatGPT Browser
7
+
8
+ Use this skill when the user asks to consult ChatGPT Web, GPT Pro, browser GPT, or a logged-in ChatGPT account through repo-harness.
9
+
10
+ ## Rules
11
+
12
+ 1. This uses the user's logged-in ChatGPT Web browser session, not the OpenAI API.
13
+ 2. Do not ask for or handle passwords, SSO secrets, 2FA codes, cookies, browser storage, or tokens.
14
+ 3. Before a non-dry-run consult, state that it may create or continue a real ChatGPT Web conversation.
15
+ 4. Prefer dry-run first when files are involved:
16
+
17
+ ```bash
18
+ repo-harness chatgpt browser-consult --repo . --dry-run --prompt "<prompt>" --file <path>
19
+ ```
20
+
21
+ 5. For readiness, run:
22
+
23
+ ```bash
24
+ repo-harness chatgpt browser-doctor --repo .
25
+ ```
26
+
27
+ 6. Use browser consult for planning, review, critique, and goal generation. Do not use it as the executor for code edits.
28
+ 7. Save useful results into repo-harness artifacts with repo-relative `--write-output` paths such as:
29
+
30
+ ```text
31
+ .ai/harness/handoff/chatgpt-review.md
32
+ .ai/harness/handoff/codex-goal.md
33
+ plans/prds/*.prd.md
34
+ plans/sprints/*.sprint.md
35
+ ```
36
+
37
+ 8. If login, captcha, workspace picker, or SSO is required, stop and ask the user to complete it in the browser.
38
+ 9. Do not enable remote CDP unless the user explicitly asked for remote browser control and the security boundary is documented.
39
+ 10. For MCP usage, require the server to be started with:
40
+
41
+ ```bash
42
+ repo-harness mcp serve --repo . --enable-chatgpt-browser
43
+ ```
44
+
45
+ 11. Do not rely on provider stdout `Artifact:` / `Output:` paths being imported. Browser engine session records save prompt, transcript, output, metadata, and trusted provider IDs; ordinary stdout paths are ignored.
46
+ 12. Native provider uses the current ChatGPT Web model selection. Do not pass `--model` or `--thinking` with `--provider native`; use Oracle when model selection is required.
47
+
48
+ ## Common Commands
49
+
50
+ Dry-run consult:
51
+
52
+ ```bash
53
+ repo-harness chatgpt browser-consult \
54
+ --repo . \
55
+ --dry-run \
56
+ --prompt "Review this sprint and return execution risks." \
57
+ --file plans/sprints/example.sprint.md
58
+ ```
59
+
60
+ Oracle provider consult:
61
+
62
+ ```bash
63
+ repo-harness chatgpt browser-consult \
64
+ --repo . \
65
+ --provider oracle \
66
+ --prompt "Review this PRD and return risks plus a smallest next step." \
67
+ --file plans/prds/example.prd.md \
68
+ --write-output .ai/harness/handoff/chatgpt-review.md
69
+ ```
70
+
71
+ Native provider spike:
72
+
73
+ ```bash
74
+ repo-harness chatgpt browser-doctor --repo . --provider native
75
+ repo-harness chatgpt browser-consult \
76
+ --repo . \
77
+ --provider native \
78
+ --browser-channel chrome \
79
+ --keep-browser \
80
+ --prompt "Reply exactly OK"
81
+ ```
82
+
83
+ Use native provider only when the user is ready for a visible ChatGPT Web run. If login is required, keep the browser open and have the user complete login manually; do not request or handle credentials.
84
+
85
+ Read the result:
86
+
87
+ ```bash
88
+ repo-harness chatgpt browser-list --repo .
89
+ repo-harness chatgpt browser-session --repo . <sessionId>
90
+ repo-harness chatgpt browser-open --repo . <sessionId>
91
+ ```
92
+
93
+ Continue from a saved session:
94
+
95
+ ```bash
96
+ repo-harness chatgpt browser-followup \
97
+ --repo . \
98
+ --session <sessionId> \
99
+ --prompt "Challenge the previous result and return the smallest next step."
100
+ ```
101
+
102
+ Plan cleanup before deleting local session records:
103
+
104
+ ```bash
105
+ repo-harness chatgpt browser-cleanup --repo . --status dry_run --limit 20
106
+ ```
package/README.es.md CHANGED
@@ -56,17 +56,17 @@ En un repositorio adoptado, la superficie se mantiene pequeña:
56
56
  | `tasks/contracts/`, `tasks/reviews/` y `.ai/harness/checks/` | Scope, verificación y evidencia de review para probar que el trabajo terminó. |
57
57
  | `.ai/harness/handoff/` y `tasks/current.md` | Session journal y estado resumible, derivados de workflow artifacts en vez de chat memory. |
58
58
 
59
- ## Novedades en 0.6.0
60
-
61
- - **Transactional adoption plans.** `repo-harness adopt --dry-run --json` ahora
62
- emite un operation plan protocol v1 con IDs estables, summary, content hashes
63
- y rollback metadata.
64
- - **Bootstrap files gestionados por el manifest.** Los templates iniciales
65
- `docs/spec.md`, `tasks/todos.md`, `tasks/current.md` y `tasks/lessons.md`
66
- ahora salen del workflow contract manifest, no de strings locales del planner.
67
- - **Apply TypeScript experimental.** `repo-harness adopt --experimental-ts-apply`
68
- puede aplicar el safe operation subset con atomic writes, target locks,
69
- backups y preflight rejection para boundaries self-host no soportadas.
59
+ ## Novedades en 0.7.0
60
+
61
+ - **ChatGPT browser engine.** `repo-harness chatgpt browser-*` crea sesiones
62
+ ChatGPT Web repo-locales con archivos revisados por policy, sin usar OpenAI API.
63
+ - **MCP browser tools opt-in.** `repo-harness mcp serve
64
+ --enable-chatgpt-browser` expone consult/read/list/continue/open; por defecto
65
+ estos tools siguen desactivados.
66
+ - **Oracle y native providers.** El engine incluye un Oracle browser wrapper y
67
+ un spike native vía Chrome instalado + CDP local.
68
+ - **Hosted CI y release smoke.** El repo añade un GitHub CI gate y un tarball
69
+ install smoke que arranca los binarios empaquetados de `repo-harness`.
70
70
 
71
71
  ## Qué hace el producto
72
72
 
@@ -383,8 +383,8 @@ Guards habituales:
383
383
 
384
384
  ## Release actual
385
385
 
386
- - npm package: `repo-harness@0.6.0`
387
- - Generated workflow stamp: `repo-harness@0.6.0+template@0.6.0`
386
+ - npm package: `repo-harness@0.7.0`
387
+ - Generated workflow stamp: `repo-harness@0.7.0+template@0.7.0`
388
388
  - GitHub repository: `Ancienttwo/repo-harness`
389
389
  - Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
390
390
 
package/README.fr.md CHANGED
@@ -56,18 +56,17 @@ Dans un dépôt adopté, la surface à comprendre reste volontairement réduite
56
56
  | `tasks/contracts/`, `tasks/reviews/` et `.ai/harness/checks/` | Scope, vérification et preuves de review pour démontrer que le travail est terminé. |
57
57
  | `.ai/harness/handoff/` et `tasks/current.md` | Session journal et état resumable dérivés des workflow artifacts plutôt que de la chat memory. |
58
58
 
59
- ## Nouveautés de la 0.6.0
60
-
61
- - **Transactional adoption plans.** `repo-harness adopt --dry-run --json` émet
62
- maintenant un operation plan protocol v1 avec IDs stables, summary, content
63
- hashes et rollback metadata.
64
- - **Bootstrap files gérés par le manifest.** Les templates initiaux
65
- `docs/spec.md`, `tasks/todos.md`, `tasks/current.md` et `tasks/lessons.md`
66
- viennent désormais du workflow contract manifest plutôt que de strings locales
67
- au planner.
68
- - **Apply TypeScript expérimental.** `repo-harness adopt --experimental-ts-apply`
69
- peut appliquer le safe operation subset avec atomic writes, target locks,
70
- backups et preflight rejection des boundaries self-host non prises en charge.
59
+ ## Nouveautés de la 0.7.0
60
+
61
+ - **ChatGPT browser engine.** `repo-harness chatgpt browser-*` crée des sessions
62
+ ChatGPT Web repo-locales avec des fichiers contrôlés par policy, sans OpenAI API.
63
+ - **MCP browser tools opt-in.** `repo-harness mcp serve
64
+ --enable-chatgpt-browser` expose consult/read/list/continue/open, désactivés
65
+ par défaut.
66
+ - **Oracle et native providers.** Le moteur inclut un Oracle browser wrapper et
67
+ un spike native via Chrome installé et CDP local.
68
+ - **Hosted CI et release smoke.** Le dépôt ajoute un GitHub CI gate et un
69
+ tarball install smoke qui démarre les binaires packagés `repo-harness`.
71
70
 
72
71
  ## Ce que fait le produit
73
72
 
@@ -388,8 +387,8 @@ Guards courants :
388
387
 
389
388
  ## Release actuelle
390
389
 
391
- - npm package : `repo-harness@0.6.0`
392
- - Generated workflow stamp : `repo-harness@0.6.0+template@0.6.0`
390
+ - npm package : `repo-harness@0.7.0`
391
+ - Generated workflow stamp : `repo-harness@0.7.0+template@0.7.0`
393
392
  - GitHub repository : `Ancienttwo/repo-harness`
394
393
  - Release history : [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
395
394
 
package/README.ja.md CHANGED
@@ -47,11 +47,12 @@ Agent に完全な PRD または Sprint を渡せば、あとは review and `nex
47
47
  | `tasks/contracts/`, `tasks/reviews/`, `.ai/harness/checks/` | 作業完了を証明する scope、verification、review evidence。 |
48
48
  | `.ai/harness/handoff/` と `tasks/current.md` | chat memory ではなく workflow artifacts から派生する session journal と resumable status。 |
49
49
 
50
- ## 0.6.0 の新機能
50
+ ## 0.7.0 の新機能
51
51
 
52
- - **Transactional adoption plans。** `repo-harness adopt --dry-run --json` は、安定した ID、summary、content hash、rollback metadata を含む protocol v1 operation plan を出力します。
53
- - **Manifest-owned bootstrap files。** 初期 `docs/spec.md`、`tasks/todos.md`、`tasks/current.md`、`tasks/lessons.md` templates は、planner-local strings ではなく workflow contract manifest から来るようになりました。
54
- - **Experimental TypeScript apply。** `repo-harness adopt --experimental-ts-apply` は、atomic writes、target locks、backups、unsupported self-host boundary の preflight rejection を使って safe operation subset を適用できます。
52
+ - **ChatGPT browser engine。** `repo-harness chatgpt browser-*` は、OpenAI API を使わず、policy-checked な repo-local ChatGPT Web consult session を作れます。
53
+ - **Opt-in MCP browser tools。** `repo-harness mcp serve --enable-chatgpt-browser` のときだけ consult/read/list/continue/open tools を公開し、デフォルトでは無効です。
54
+ - **Oracle and native providers。** Oracle browser wrapper と、installed Chrome + local CDP を使う native spike を含みます。
55
+ - **Hosted CI and release smoke。** GitHub CI gate と、packaged `repo-harness` binaries を起動する tarball install smoke を追加しました。
55
56
 
56
57
  ## repo-harness は何をするか
57
58
 
@@ -351,8 +352,8 @@ hook がブロックしたときは、まず terminal の構造化された出
351
352
 
352
353
  ## 現在の Release
353
354
 
354
- - npm package:`repo-harness@0.6.0`
355
- - Generated workflow stamp:`repo-harness@0.6.0+template@0.6.0`
355
+ - npm package:`repo-harness@0.7.0`
356
+ - Generated workflow stamp:`repo-harness@0.7.0+template@0.7.0`
356
357
  - GitHub repository:`Ancienttwo/repo-harness`
357
358
  - Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
358
359
 
package/README.md CHANGED
@@ -50,17 +50,43 @@ In an adopted repo, the surface area is intentionally small:
50
50
  | `tasks/contracts/`, `tasks/reviews/`, and `.ai/harness/checks/` | Scope, verification, and review evidence for proving the work is done. |
51
51
  | `.ai/harness/handoff/` and `tasks/current.md` | Session journal and resumable status, derived from workflow artifacts instead of chat memory. |
52
52
 
53
- ## What's New in 0.6.0
54
-
55
- - **Transactional adoption plans.** `repo-harness adopt --dry-run --json` now
56
- emits a protocol v1 operation plan with stable IDs, summaries, content hashes,
57
- and rollback metadata.
58
- - **Manifest-owned bootstrap files.** The initial `docs/spec.md`,
59
- `tasks/todos.md`, `tasks/current.md`, and `tasks/lessons.md` templates now
60
- come from the workflow contract manifest instead of planner-local strings.
61
- - **Experimental TypeScript apply.** `repo-harness adopt --experimental-ts-apply`
62
- can apply the safe operation subset with atomic writes, target locks, backups,
63
- and preflight rejection for unsupported self-host boundaries.
53
+ ## Human Review Path
54
+
55
+ Start with `tasks/reviews/<task>.review.md`. The `## Human Review Card` is the
56
+ one-screen decision surface: verdict, change type, intended vs actual files,
57
+ commands passed, external acceptance, residual risk, reviewer action, and
58
+ rollback. Then inspect the active contract, latest trace in
59
+ `.ai/harness/checks/latest.json`, and the changed files. Accept only when the
60
+ review recommends pass, the card verdict is pass, and external acceptance is
61
+ pass, `not_required`, or an explicit manual override.
62
+
63
+ ## Agent Tracking Path
64
+
65
+ Agents read source artifacts before derived summaries:
66
+
67
+ | Agent reads first | Human reviews first |
68
+ | --- | --- |
69
+ | Current user prompt and referenced files | `tasks/reviews/<task>.review.md` Human Review Card |
70
+ | `AGENTS.md` / `CLAUDE.md` | Changed files and diff |
71
+ | Active plan in `.ai/harness/active-plan` | Active contract allowed paths and exit criteria |
72
+ | Active contract in `tasks/contracts/` | `.ai/harness/checks/latest.json` and run trace |
73
+ | Latest handoff in `.ai/harness/handoff/` | Residual risks and rollback |
74
+
75
+ `tasks/current.md` is only an orientation snapshot. If it disagrees with the
76
+ active plan, contract, review, checks, or handoff, the source artifacts win.
77
+
78
+ ## What's New in 0.7.0
79
+
80
+ - **ChatGPT browser engine.** `repo-harness chatgpt browser-*` can create
81
+ policy-checked, repo-local ChatGPT Web consult sessions without using the
82
+ OpenAI API.
83
+ - **Opt-in MCP browser tools.** `repo-harness mcp serve
84
+ --enable-chatgpt-browser` exposes consult/read/list/continue/open tools while
85
+ keeping them disabled by default.
86
+ - **Oracle and native providers.** The engine supports an Oracle browser wrapper
87
+ plus a native installed-Chrome CDP spike for logged-in ChatGPT Web runs.
88
+ - **Hosted CI and release smoke.** The repo now ships a GitHub CI gate and a
89
+ tarball install smoke that starts the packaged `repo-harness` binaries.
64
90
 
65
91
  ## What repo-harness Does
66
92
 
@@ -74,11 +100,71 @@ target repository so Claude, Codex, and humans can agree on:
74
100
  - which checks and review evidence prove the work is done
75
101
  - how hooks should warn, block, trace, and hand off work across sessions
76
102
 
77
- It is not an agent gateway, product runtime, database service, or MCP server.
78
103
  The product boundary is deliberately boring: inspect a repo, install or refresh
79
104
  workflow files, route host events through repo-local hooks, and verify that the
80
105
  workflow surfaces stay consistent.
81
106
 
107
+ As an optional sidecar, `repo-harness mcp` exposes only workflow artifacts to
108
+ MCP clients. ChatGPT can use it as a planner/reviewer to read state and move an
109
+ idea through PRD, checklist Sprint, and Codex goal handoff artifacts; it does
110
+ not get source-code write access, arbitrary shell execution, or a default Codex
111
+ runner. Codex remains the executor. The generated manual setup guide lives at
112
+ `docs/repo-harness-chatgpt-mcp-setup.md`, and the local CLI handoff is
113
+ `repo-harness mcp prepare-goal --prd <prd> --sprint <sprint>`.
114
+
115
+ ### MCP Connector Quickstart
116
+
117
+ Use the MCP sidecar when you want ChatGPT to plan against the real repo state
118
+ and Codex to execute the resulting file-backed Sprint.
119
+
120
+ ```bash
121
+ repo-harness mcp setup chatgpt --repo .
122
+ repo-harness mcp serve --repo . --transport http --host 127.0.0.1 --port 8765 --profile planner
123
+ ```
124
+
125
+ Expose that local server through an HTTPS tunnel and create a ChatGPT Connector
126
+ with the `/mcp` URL. The generated guide is written to:
127
+
128
+ ```text
129
+ docs/repo-harness-chatgpt-mcp-setup.md
130
+ ```
131
+
132
+ The human workflow is:
133
+
134
+ 1. ChatGPT reads repo-harness workflow files through MCP.
135
+ 2. ChatGPT writes a PRD with `write_prd_from_idea`.
136
+ 3. ChatGPT writes a checklist Sprint with `write_checklist_sprint`.
137
+ 4. ChatGPT prepares `.ai/harness/handoff/codex-goal.md` with `prepare_codex_goal_from_sprint`.
138
+ 5. Codex runs the host-native `/goal` prompt and stages each completed Sprint phase.
139
+
140
+ Local fallback for the last handoff step:
141
+
142
+ ```bash
143
+ repo-harness mcp prepare-goal --repo . --prd plans/prds/<feature>.prd.md --sprint plans/sprints/<feature>.sprint.md
144
+ ```
145
+
146
+ The agent-facing Skill is installed at:
147
+
148
+ ```text
149
+ .agents/skills/repo-harness-chatgpt-bridge/SKILL.md
150
+ ```
151
+
152
+ That Skill tells Codex how to consume ChatGPT-produced PRD/Sprint/Goal artifacts
153
+ without granting ChatGPT source-code writes or shell execution.
154
+
155
+ Dev Mode can opt into local agent execution through MCP. This is off by default.
156
+ When the user enables the `orchestrator` profile with the dev runner setting,
157
+ ChatGPT can call `run_agent_goal`, which reads only
158
+ `.ai/harness/handoff/codex-goal.md` and runs the fixed handoff through an
159
+ allowed local CLI such as `codex exec` or `claude -p`.
160
+
161
+ ```bash
162
+ repo-harness mcp serve --repo . --transport http --profile orchestrator --enable-dev-runner --dev-runner-agents codex
163
+ ```
164
+
165
+ This setting is for local Developer Mode only. It is timeout-bounded, audited,
166
+ and not arbitrary shell.
167
+
82
168
  ## How It Works
83
169
 
84
170
  The design has three layers:
@@ -464,8 +550,8 @@ Most common guards:
464
550
 
465
551
  ## Current Release
466
552
 
467
- - npm package: `repo-harness@0.6.0`
468
- - Generated workflow stamp: `repo-harness@0.6.0+template@0.6.0`
553
+ - npm package: `repo-harness@0.7.0`
554
+ - Generated workflow stamp: `repo-harness@0.7.0+template@0.7.0`
469
555
  - GitHub repository: `Ancienttwo/repo-harness`
470
556
  - Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
471
557
 
package/README.zh-CN.md CHANGED
@@ -43,16 +43,40 @@ handoff、检查结果和 review evidence 写回项目文件,让下一个 agen
43
43
  | `tasks/contracts/`、`tasks/reviews/`、`.ai/harness/checks/` | 证明完成所需的 scope、verification 和 review evidence。 |
44
44
  | `.ai/harness/handoff/` 和 `tasks/current.md` | session journal 与可恢复状态,从 workflow artifacts 派生,而不是依赖聊天记忆。 |
45
45
 
46
- ## 0.6.0 新特性
46
+ ## Human Review Path
47
47
 
48
- - **事务型 adoption plan。** `repo-harness adopt --dry-run --json` 现在输出
49
- protocol v1 operation plan,包含稳定 ID、summary、content hash 和 rollback metadata。
50
- - **Manifest-owned bootstrap 文件。** 初始 `docs/spec.md`、`tasks/todos.md`、
51
- `tasks/current.md`、`tasks/lessons.md` 模板改由 workflow contract manifest 管理,
52
- 不再放在 planner 本地字符串里。
53
- - **实验性 TypeScript apply。** `repo-harness adopt --experimental-ts-apply`
54
- 可以执行 safe operation subset,并使用 atomic write、target lock、backup 和
55
- unsupported self-host boundary preflight。
48
+ 先读 `tasks/reviews/<task>.review.md`。`## Human Review Card` 是一屏决策面:
49
+ verdict、change type、预期/实际改动文件、已通过命令、external acceptance、
50
+ 残余风险、reviewer action 和 rollback。然后检查 active contract、
51
+ `.ai/harness/checks/latest.json` 里的 latest trace,以及实际 diff。只有当 review
52
+ recommend pass、card verdict 为 pass,且 external acceptance 为 pass、not_required
53
+ 或明确 manual override 时,才进入 closeout。
54
+
55
+ ## Agent Tracking Path
56
+
57
+ Agent 先读 source artifacts,再读派生摘要:
58
+
59
+ | Agent reads first | Human reviews first |
60
+ | --- | --- |
61
+ | 当前用户 prompt 和引用文件 | `tasks/reviews/<task>.review.md` 的 Human Review Card |
62
+ | `AGENTS.md` / `CLAUDE.md` | changed files 和 diff |
63
+ | `.ai/harness/active-plan` 指向的 active plan | active contract 的 allowed paths 和 exit criteria |
64
+ | `tasks/contracts/` 下的 active contract | `.ai/harness/checks/latest.json` 和 run trace |
65
+ | `.ai/harness/handoff/` 下的 latest handoff | 残余风险和 rollback |
66
+
67
+ `tasks/current.md` 只是 orientation snapshot。如果它和 active plan、contract、
68
+ review、checks 或 handoff 冲突,以 source artifacts 为准。
69
+
70
+ ## 0.7.0 新特性
71
+
72
+ - **ChatGPT browser engine。** `repo-harness chatgpt browser-*` 可以用
73
+ policy-checked 文件输入创建 repo-local ChatGPT Web consult session,不走 OpenAI API。
74
+ - **Opt-in MCP browser tools。** `repo-harness mcp serve
75
+ --enable-chatgpt-browser` 才会暴露 consult/read/list/continue/open 工具,默认关闭。
76
+ - **Oracle 和 native provider。** Browser engine 支持 Oracle browser wrapper,
77
+ 也支持基于本机已安装 Chrome CDP 的 logged-in ChatGPT Web spike。
78
+ - **Hosted CI 和 release smoke。** 仓库新增 GitHub CI gate,并用 tarball install
79
+ smoke 验证 packaged `repo-harness` binaries 能启动。
56
80
 
57
81
  ## 产品做什么
58
82
 
@@ -418,8 +442,8 @@ hook block 工作时,先看 terminal 里的结构化输出。核心字段是
418
442
 
419
443
  ## 当前 Release
420
444
 
421
- - npm package:`repo-harness@0.6.0`
422
- - Generated workflow stamp:`repo-harness@0.6.0+template@0.6.0`
445
+ - npm package:`repo-harness@0.7.0`
446
+ - Generated workflow stamp:`repo-harness@0.7.0+template@0.7.0`
423
447
  - GitHub repository:`Ancienttwo/repo-harness`
424
448
  - Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
425
449
 
@@ -362,9 +362,31 @@ workflow_preferred_or_legacy_path() {
362
362
  fi
363
363
  }
364
364
 
365
+ workflow_plan_declared_path() {
366
+ local plan_file="$1"
367
+ local label="$2"
368
+ [[ -f "$plan_file" ]] || return 1
369
+ awk -v label="$label" '
370
+ BEGIN { pattern = "^> \\*\\*" label "\\*\\*:" }
371
+ $0 ~ pattern {
372
+ sub(pattern "[[:space:]]*", "")
373
+ gsub(/`/, "")
374
+ gsub(/\r/, "")
375
+ print
376
+ exit
377
+ }
378
+ ' "$plan_file" | xargs
379
+ }
380
+
365
381
  derive_contract_path() {
366
382
  local plan_file="$1"
367
- local stem slug
383
+ local stem slug explicit
384
+
385
+ explicit="$(workflow_plan_declared_path "$plan_file" "Task Contract" || workflow_plan_declared_path "$plan_file" "Sprint Contract" || true)"
386
+ if [[ -n "$explicit" ]]; then
387
+ printf '%s' "$explicit"
388
+ return 0
389
+ fi
368
390
 
369
391
  stem="$(workflow_plan_artifact_stem_from_path "$plan_file" || true)"
370
392
  slug="$(workflow_plan_slug_from_path "$plan_file" || true)"
@@ -574,6 +596,7 @@ workflow_next_action() {
574
596
 
575
597
  if [[ "$total" -gt "$done" ]]; then
576
598
  message="${next_pending:-continue active plan Task Breakdown}"
599
+ message="If a major module was just completed, stage its coherent diff first; then continue the next Task Breakdown item: ${message}"
577
600
  printf 'task\t-\t%s\n' "$message"
578
601
  return 0
579
602
  fi
@@ -583,17 +606,17 @@ workflow_next_action() {
583
606
  checks_file="$(workflow_checks_file)"
584
607
 
585
608
  if [[ -z "$review_file" || ! -f "$review_file" ]]; then
586
- printf 'check\t/check\tRun /check and record a sprint review before finishing this worktree.\n'
609
+ printf 'check\t/check\tStage the completed module diff first; then run /check and record a sprint review before finishing this worktree.\n'
587
610
  return 0
588
611
  fi
589
612
 
590
613
  if ! workflow_review_recommends_pass "$review_file"; then
591
- printf 'check\t/check\tRun /check until %s records Recommendation: pass.\n' "$review_file"
614
+ printf 'check\t/check\tStage the completed module diff first; then run /check until %s records Recommendation: pass.\n' "$review_file"
592
615
  return 0
593
616
  fi
594
617
 
595
618
  if [[ -z "$contract_file" || ! -f "$contract_file" ]]; then
596
- printf 'check\t/check\tRegenerate the active sprint contract, then run /check.\n'
619
+ printf 'check\t/check\tStage the completed module diff first; then regenerate the active sprint contract and run /check.\n'
597
620
  return 0
598
621
  fi
599
622
 
@@ -601,17 +624,17 @@ workflow_next_action() {
601
624
  IFS=$'\t' read -r external_state external_reviewer external_source external_message <<< "$external_status"
602
625
  if [[ "$external_state" != "pass" && "$external_state" != "manual_override" ]]; then
603
626
  expected_source="$(workflow_external_acceptance_expected_source)"
604
- printf 'check\t/check\t%s Run external acceptance via %s and record ## External Acceptance Advice in %s.\n' "${external_message:-External acceptance is missing.}" "$expected_source" "$review_file"
627
+ printf 'check\t/check\tStage the completed module diff first; then %s Run external acceptance via %s and record ## External Acceptance Advice in %s.\n' "${external_message:-External acceptance is missing.}" "$expected_source" "$review_file"
605
628
  return 0
606
629
  fi
607
630
 
608
631
  if [[ ! -f "$checks_file" ]]; then
609
- printf 'check\t/check\tRun /check and verify-sprint so %s exists.\n' "$checks_file"
632
+ printf 'check\t/check\tStage the completed module diff first; then run /check and verify-sprint so %s exists.\n' "$checks_file"
610
633
  return 0
611
634
  fi
612
635
 
613
636
  if ! checks_error="$(workflow_checks_pass "$checks_file" "$contract_file" "$review_file")"; then
614
- printf 'check\t/check\t%s\n' "$checks_error"
637
+ printf 'check\t/check\tStage the completed module diff first; then resolve check evidence: %s\n' "$checks_error"
615
638
  return 0
616
639
  fi
617
640
 
@@ -1053,9 +1076,14 @@ workflow_active_contract() {
1053
1076
  }
1054
1077
 
1055
1078
  workflow_active_review() {
1056
- local active_plan stem slug reviews_dir
1079
+ local active_plan stem slug reviews_dir explicit
1057
1080
  active_plan="$(get_active_plan || true)"
1058
1081
  [[ -n "$active_plan" ]] || return 1
1082
+ explicit="$(workflow_plan_declared_path "$active_plan" "Task Review" || workflow_plan_declared_path "$active_plan" "Sprint Review" || true)"
1083
+ if [[ -n "$explicit" ]]; then
1084
+ printf '%s' "$explicit"
1085
+ return 0
1086
+ fi
1059
1087
  stem="$(workflow_plan_artifact_stem_from_path "$active_plan" || true)"
1060
1088
  slug="$(workflow_plan_slug_from_path "$active_plan" || true)"
1061
1089
  [[ -n "$stem" && -n "$slug" ]] || return 1
@@ -1064,9 +1092,14 @@ workflow_active_review() {
1064
1092
  }
1065
1093
 
1066
1094
  workflow_active_notes() {
1067
- local active_plan stem slug notes_dir
1095
+ local active_plan stem slug notes_dir explicit
1068
1096
  active_plan="$(get_active_plan || true)"
1069
1097
  [[ -n "$active_plan" ]] || return 1
1098
+ explicit="$(workflow_plan_declared_path "$active_plan" "Implementation Notes" || workflow_plan_declared_path "$active_plan" "Notes File" || true)"
1099
+ if [[ -n "$explicit" ]]; then
1100
+ printf '%s' "$explicit"
1101
+ return 0
1102
+ fi
1070
1103
  stem="$(workflow_plan_artifact_stem_from_path "$active_plan" || true)"
1071
1104
  slug="$(workflow_plan_slug_from_path "$active_plan" || true)"
1072
1105
  [[ -n "$stem" && -n "$slug" ]] || return 1
@@ -1099,8 +1132,8 @@ workflow_with_lock() {
1099
1132
  while ! mkdir "$lock_dir" 2>/dev/null; do
1100
1133
  if [[ "$waited" -ge 40 ]]; then
1101
1134
  now="$(date +%s)"
1102
- mtime="$(stat -f '%m' "$lock_dir" 2>/dev/null || stat -c '%Y' "$lock_dir" 2>/dev/null || echo 0)"
1103
- if [[ "${mtime:-0}" -gt 0 && $((now - mtime)) -ge 60 ]]; then
1135
+ mtime="$(stat -c '%Y' "$lock_dir" 2>/dev/null || stat -f '%m' "$lock_dir" 2>/dev/null || echo 0)"
1136
+ if [[ "${mtime:-0}" =~ ^[0-9]+$ && "${mtime:-0}" -gt 0 && $((now - mtime)) -ge 60 ]]; then
1104
1137
  rmdir "$lock_dir" 2>/dev/null || true
1105
1138
  waited=0
1106
1139
  continue
@@ -1502,7 +1535,8 @@ workflow_write_handoff() {
1502
1535
  local reason="${1:-session-stop}"
1503
1536
  local handoff_file active_plan active_contract active_review active_notes checks_file next_task changed_files diff_stat spec_file source_plan parent_run_id supersedes
1504
1537
  local next_action next_stage next_command next_message
1505
- local resume_file trace_file recent_commands blockers decisions goal
1538
+ local resume_file trace_file recent_commands blockers decisions goal latest_trace_file
1539
+ local active_sprint active_sprint_row
1506
1540
  local changed_count untracked_count
1507
1541
 
1508
1542
  workflow_ensure_harness_surface
@@ -1514,6 +1548,26 @@ workflow_write_handoff() {
1514
1548
  active_contract="$(workflow_active_contract || true)"
1515
1549
  active_review="$(workflow_active_review || true)"
1516
1550
  active_notes="$(workflow_active_notes || true)"
1551
+ active_sprint=""
1552
+ if [[ -f ".ai/harness/sprint/active-sprint" ]]; then
1553
+ active_sprint="$(cat ".ai/harness/sprint/active-sprint" 2>/dev/null | xargs)"
1554
+ fi
1555
+ active_sprint_row="(none)"
1556
+ if [[ -n "$active_sprint" && -f "$active_sprint" ]]; then
1557
+ active_sprint_row="$(
1558
+ awk -v plan="$active_plan" '
1559
+ /^\|[[:space:]]*[0-9]+[[:space:]]*\|/ {
1560
+ if (plan != "" && index($0, plan) > 0) {
1561
+ print
1562
+ found = 1
1563
+ exit
1564
+ }
1565
+ }
1566
+ END { if (!found) exit 1 }
1567
+ ' "$active_sprint" 2>/dev/null || true
1568
+ )"
1569
+ active_sprint_row="${active_sprint_row:-Active sprint: ${active_sprint}}"
1570
+ fi
1517
1571
  source_plan="$(get_todo_source_plan || true)"
1518
1572
  if [[ "$source_plan" == "(none)" ]]; then
1519
1573
  source_plan=""
@@ -1585,6 +1639,12 @@ workflow_write_handoff() {
1585
1639
  fi
1586
1640
  decisions="Use filesystem artifacts as source of truth; treat SQLite/thread state as a rebuildable read model only."
1587
1641
  blockers="(none recorded)"
1642
+ if [[ -f "$checks_file" ]] && command -v jq >/dev/null 2>&1; then
1643
+ latest_trace_file="$(jq -r '.run_file // empty' "$checks_file" 2>/dev/null || true)"
1644
+ else
1645
+ latest_trace_file=""
1646
+ fi
1647
+ latest_trace_file="${latest_trace_file:-$checks_file}"
1588
1648
 
1589
1649
  cat > "$handoff_file" <<EOF_HANDOFF
1590
1650
  # Harness Handoff
@@ -1613,11 +1673,21 @@ ${recent_commands}
1613
1673
  ## Checks
1614
1674
 
1615
1675
  - Checks file: ${checks_file}
1676
+ - Latest trace: ${latest_trace_file}
1616
1677
 
1617
1678
  ## Blockers
1618
1679
 
1619
1680
  - ${blockers}
1620
1681
 
1682
+ ## Active Artifacts
1683
+
1684
+ - Active plan: ${active_plan:-(none)}
1685
+ - Active contract: ${active_contract:-(none)}
1686
+ - Active sprint row: ${active_sprint_row}
1687
+ - Review file: ${active_review:-(none)}
1688
+ - Latest trace/checks file: ${latest_trace_file}
1689
+ - Resume packet: ${resume_file}
1690
+
1621
1691
  ## Exact Next Step
1622
1692
 
1623
1693
  - ${next_task}
@@ -1625,7 +1695,7 @@ ${recent_commands}
1625
1695
  ## Resume Prompt
1626
1696
 
1627
1697
  - Resume packet: ${resume_file}
1628
- - Start a fresh Codex session and read this handoff before continuing; do not rely on auto-compact.
1698
+ - Start a fresh Codex session and read source artifacts first, then this handoff, before continuing; do not rely on auto-compact.
1629
1699
 
1630
1700
  ## Source Artifacts
1631
1701
 
@@ -58,6 +58,13 @@ work, or shared contracts, report the P1/P2/P3 evidence explicitly.
58
58
 
59
59
  ## Daily Flow
60
60
 
61
+ | Agent reads first | Human reviews first |
62
+ |-----------|---------|
63
+ | Current user prompt and referenced files | Human Review Card in `tasks/reviews/<task>.review.md` |
64
+ | `AGENTS.md` / `CLAUDE.md` and active plan | Changed files and active contract scope |
65
+ | Active contract, notes, latest checks, and handoff | Latest trace/checks, residual risk, rollback |
66
+ | `tasks/current.md` only for orientation | External acceptance or manual override |
67
+
61
68
  1. Route the request by intent before reading broadly.
62
69
  2. Read the repo-local contract first: `AGENTS.md` or `CLAUDE.md`, `tasks/todos.md`, `tasks/lessons.md`, and `.ai/harness/policy.json`.
63
70
  3. Use the selected skill or mode to produce either an approved plan, a root cause, or a review verdict.
@@ -31,6 +31,7 @@ Create these only when the agent has concrete repo evidence or the user asks:
31
31
  - Prefer short docs that name sources, owners, and verification commands.
32
32
  - Let capability `CLAUDE.md` and `AGENTS.md` carry local contract projections; root docs stay concise.
33
33
  - Keep complete workstream TODOs in `tasks/workstreams/<domain>/<capability>/`; contract blocks should link to them instead of becoming task logs.
34
+ - Keep onboarding docs split by reader: agents read active source artifacts first; humans review the Human Review Card, diff, latest trace, and rollback first.
34
35
  - Hooks may create `docs/architecture/requests/*.md`; agents own semantic snapshots, embedded Mermaid, and optional `mermaid` HTML output.
35
36
  - Archive handled architecture requests with `.ai/harness/scripts/archive-architecture-request.sh`; keep `docs/architecture/requests/` pending-only and preserve handled requests under `docs/architecture/requests/archive/YYYY/`.
36
37
  - When both Mermaid and HTML exist, keep the Mermaid in Markdown as the semantic source and make the HTML link back to that Markdown source.