repo-harness 0.9.2 → 0.11.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 (362) hide show
  1. package/AGENTS.md +16 -9
  2. package/CLAUDE.md +16 -9
  3. package/README.es.md +106 -98
  4. package/README.fr.md +112 -105
  5. package/README.ja.md +99 -93
  6. package/README.md +158 -134
  7. package/README.zh-CN.md +101 -104
  8. package/SKILL.md +15 -404
  9. package/agents/fleet/deep-reasoner.md +14 -0
  10. package/agents/fleet/explorer.md +17 -0
  11. package/agents/fleet/fast-worker.md +14 -0
  12. package/agents/fleet/gatekeeper.md +17 -0
  13. package/agents/fleet/harness-evaluator.md +16 -0
  14. package/agents/fleet/root-cause-prover.md +17 -0
  15. package/assets/AGENTS.md +14 -6
  16. package/assets/CLAUDE.md +14 -6
  17. package/assets/hooks/AGENTS.md +7 -7
  18. package/assets/hooks/CLAUDE.md +7 -7
  19. package/assets/hooks/lib/workflow-state.sh +351 -496
  20. package/assets/hooks/projection.json +1 -3
  21. package/assets/initializer-question-pack.v4.json +2 -3
  22. package/assets/partials/04-project-structure.partial.md +4 -4
  23. package/assets/partials/05-workflow.partial.md +4 -6
  24. package/assets/partials/08-orchestration.partial.md +1 -1
  25. package/assets/partials-agents/02-operating-mode.partial.md +4 -4
  26. package/assets/partials-agents/03-orchestration.partial.md +1 -1
  27. package/assets/partials-agents/04-task-protocol.partial.md +2 -2
  28. package/assets/partials-agents/08-deep-docs.partial.md +3 -3
  29. package/assets/reference-configs/agentic-development-flow.md +47 -29
  30. package/assets/reference-configs/ai-workflows.md +0 -1
  31. package/assets/reference-configs/changelog-versioning.md +0 -1
  32. package/assets/reference-configs/coding-standards.md +0 -1
  33. package/assets/reference-configs/design-options.md +244 -0
  34. package/assets/reference-configs/development-protocol.md +0 -1
  35. package/assets/reference-configs/document-generation.md +2 -2
  36. package/assets/reference-configs/evaluator-rubric.md +0 -1
  37. package/assets/reference-configs/external-tooling.md +156 -127
  38. package/assets/reference-configs/git-strategy.md +0 -1
  39. package/assets/reference-configs/global-working-rules.md +28 -2
  40. package/assets/reference-configs/harness-overview.md +77 -9
  41. package/assets/reference-configs/hook-operations.md +94 -74
  42. package/assets/reference-configs/minimal-change-hooks.md +17 -15
  43. package/assets/reference-configs/release-deploy.md +1 -2
  44. package/assets/reference-configs/spa-day-protocol.md +0 -2
  45. package/assets/reference-configs/sprint-contracts.md +86 -6
  46. package/assets/reference-configs/ux-feature-guard.md +144 -0
  47. package/assets/reference-configs/workflow-orchestration.md +0 -1
  48. package/assets/skill-commands/AGENTS.md +3 -0
  49. package/assets/skill-commands/CLAUDE.md +3 -0
  50. package/assets/skill-commands/manifest.json +416 -88
  51. package/assets/skill-commands/repo-harness-architecture/SKILL.md +2 -1
  52. package/assets/skill-commands/repo-harness-check/SKILL.md +3 -8
  53. package/assets/skill-commands/repo-harness-check/references/deploy-readiness.md +30 -0
  54. package/assets/skill-version.json +15 -3
  55. package/assets/skills/claude-plan/SKILL.md +263 -0
  56. package/assets/skills/repo-harness-chatgpt/SKILL.md +29 -0
  57. package/assets/skills/repo-harness-chatgpt/references/bridge.md +169 -0
  58. package/assets/skills/repo-harness-chatgpt/references/consult.md +85 -0
  59. package/assets/skills/repo-harness-chatgpt/references/continue.md +57 -0
  60. package/assets/skills/repo-harness-chatgpt/references/read-back.md +87 -0
  61. package/assets/skills/repo-harness-chatgpt/references/setup.md +92 -0
  62. package/assets/skills/repo-harness-cross-review/SKILL.md +37 -0
  63. package/assets/skills/repo-harness-cross-review/references/claude-mode.md +38 -0
  64. package/assets/skills/repo-harness-cross-review/references/codex-mode.md +29 -0
  65. package/assets/skills/repo-harness-plan/SKILL.md +26 -0
  66. package/assets/{skill-commands/repo-harness-plan/SKILL.md → skills/repo-harness-plan/references/create.md} +11 -15
  67. package/assets/{skill-commands/repo-harness-review/SKILL.md → skills/repo-harness-plan/references/review.md} +8 -12
  68. package/assets/skills/repo-harness-product/SKILL.md +29 -0
  69. package/assets/{skill-commands/repo-harness-goal/SKILL.md → skills/repo-harness-product/references/goal.md} +20 -21
  70. package/assets/{skill-commands/repo-harness-prd/SKILL.md → skills/repo-harness-product/references/prd.md} +29 -28
  71. package/assets/{skill-commands/repo-harness-sprint/SKILL.md → skills/repo-harness-product/references/sprint.md} +15 -17
  72. package/assets/skills/repo-harness-setup/SKILL.md +34 -0
  73. package/assets/skills/repo-harness-setup/references/adopt-init.md +21 -0
  74. package/assets/skills/repo-harness-setup/references/capability.md +27 -0
  75. package/assets/skills/repo-harness-setup/references/migrate.md +30 -0
  76. package/assets/skills/repo-harness-setup/references/repair.md +22 -0
  77. package/assets/{skill-commands/repo-harness-scaffold/SKILL.md → skills/repo-harness-setup/references/scaffold.md} +6 -12
  78. package/assets/skills/repo-harness-setup/references/upgrade.md +29 -0
  79. package/assets/templates/contract.template.md +16 -7
  80. package/assets/templates/design-brief.template.md +63 -4
  81. package/assets/templates/helpers/acceptance-receipt.ts +859 -0
  82. package/assets/templates/helpers/architecture-event.ts +15 -2
  83. package/assets/templates/helpers/architecture-queue.sh +8 -2
  84. package/assets/templates/helpers/archive-architecture-request.sh +168 -28
  85. package/assets/templates/helpers/archive-workflow.sh +301 -20
  86. package/assets/templates/helpers/capability-config.ts +12 -5
  87. package/assets/templates/helpers/capability-resolver.ts +521 -237
  88. package/assets/templates/helpers/capture-plan.sh +5 -8
  89. package/assets/templates/helpers/check-agent-tooling.sh +310 -334
  90. package/assets/templates/helpers/check-architecture-sync.sh +11 -4
  91. package/assets/templates/helpers/check-brain-manifest.sh +0 -7
  92. package/assets/templates/helpers/check-context-files.sh +0 -0
  93. package/assets/templates/helpers/check-deploy-sql-order.sh +330 -54
  94. package/assets/templates/helpers/check-skill-version.ts +0 -0
  95. package/assets/templates/helpers/check-task-sync.sh +5 -0
  96. package/assets/templates/helpers/check-task-workflow.sh +8 -20
  97. package/assets/templates/helpers/codex-handoff-resume.sh +21 -223
  98. package/assets/templates/helpers/contract-run.ts +206 -32
  99. package/assets/templates/helpers/contract-worktree.sh +405 -56
  100. package/assets/templates/helpers/ensure-task-workflow.sh +141 -58
  101. package/assets/templates/helpers/harness-trace-grade.sh +21 -18
  102. package/assets/templates/helpers/heartbeat-triage.sh +6 -1
  103. package/assets/templates/helpers/install-agent-fleet.sh +141 -76
  104. package/assets/templates/helpers/maintenance-triage.sh +0 -0
  105. package/assets/templates/helpers/merge-gate.ts +545 -0
  106. package/assets/templates/helpers/new-plan.sh +2 -2
  107. package/assets/templates/helpers/new-spec.sh +0 -0
  108. package/assets/templates/helpers/new-sprint.sh +0 -0
  109. package/assets/templates/helpers/plan-to-todo.sh +42 -22
  110. package/assets/templates/helpers/prepare-codex-handoff.sh +17 -163
  111. package/assets/templates/helpers/prepare-handoff.sh +0 -0
  112. package/assets/templates/helpers/recovery-view-cli.ts +833 -0
  113. package/assets/templates/helpers/refresh-current-status.sh +19 -19
  114. package/assets/templates/helpers/run-bounded-verifier-command.ts +136 -0
  115. package/assets/templates/helpers/ship-worktrees.sh +176 -53
  116. package/assets/templates/helpers/sprint-backlog.sh +6 -1
  117. package/assets/templates/helpers/summarize-failures.sh +0 -0
  118. package/assets/templates/helpers/switch-plan.sh +2 -5
  119. package/assets/templates/helpers/validate-harness-profile-benchmark.ts +39 -0
  120. package/assets/templates/helpers/verify-contract.sh +248 -20
  121. package/assets/templates/helpers/verify-sprint.sh +401 -160
  122. package/assets/templates/helpers/workflow-contract.ts +117 -30
  123. package/assets/templates/helpers/workstream-sync.sh +8 -2
  124. package/assets/templates/plan.template.md +2 -2
  125. package/assets/templates/prd.template.md +1 -1
  126. package/assets/templates/review.template.md +25 -13
  127. package/assets/workflow-contract.v1.json +108 -7
  128. package/install.ps1 +21 -5
  129. package/install.sh +28 -4
  130. package/interfaces/effective-state-v1.ts +1 -0
  131. package/interfaces/types.ts +7 -0
  132. package/package.json +12 -6
  133. package/references/handoff.md +28 -0
  134. package/references/workflow-packaging-rubric.md +19 -0
  135. package/scripts/AGENTS.md +10 -2
  136. package/scripts/CLAUDE.md +10 -2
  137. package/scripts/acceptance-receipt.ts +859 -0
  138. package/scripts/architecture-event.ts +15 -2
  139. package/scripts/architecture-queue.sh +8 -2
  140. package/scripts/archive-architecture-request.sh +168 -28
  141. package/scripts/archive-workflow.sh +301 -20
  142. package/scripts/capability-config.ts +12 -5
  143. package/scripts/capability-resolver.ts +65 -248
  144. package/scripts/capture-plan.sh +5 -8
  145. package/scripts/check-agent-tooling.sh +310 -334
  146. package/scripts/check-architecture-sync.sh +11 -4
  147. package/scripts/check-brain-manifest.sh +0 -7
  148. package/scripts/check-ci.sh +7 -1
  149. package/scripts/check-deploy-sql-order.sh +330 -54
  150. package/scripts/check-npm-release.sh +1 -0
  151. package/scripts/check-state-boundaries.ts +809 -0
  152. package/scripts/check-tarball-install-smoke.sh +151 -59
  153. package/scripts/check-task-sync.sh +5 -0
  154. package/scripts/check-task-workflow.sh +8 -20
  155. package/scripts/codex-handoff-resume.sh +21 -223
  156. package/scripts/contract-run.ts +206 -32
  157. package/scripts/contract-worktree.sh +405 -56
  158. package/scripts/create-project-dirs.sh +3 -2
  159. package/scripts/emit-verify-evidence.ts +158 -0
  160. package/scripts/ensure-task-workflow.sh +141 -58
  161. package/scripts/harness-trace-grade.sh +21 -18
  162. package/scripts/heartbeat-triage.sh +6 -1
  163. package/scripts/hook-dispatch-diet-report.ts +374 -138
  164. package/scripts/init-project.sh +3 -2
  165. package/scripts/install-agent-fleet.sh +141 -76
  166. package/scripts/lib/project-init-lib.sh +151 -213
  167. package/scripts/merge-gate.ts +545 -0
  168. package/scripts/new-plan.sh +2 -2
  169. package/scripts/plan-to-todo.sh +42 -22
  170. package/scripts/prepare-codex-handoff.sh +17 -163
  171. package/scripts/recovery-view-cli.ts +833 -0
  172. package/scripts/refresh-current-status.sh +19 -19
  173. package/scripts/run-bdd2-evals.ts +1368 -0
  174. package/scripts/run-bounded-verifier-command.ts +136 -0
  175. package/scripts/run-harness-profile-benchmark.ts +1434 -0
  176. package/scripts/run-skill-evals.ts +498 -36
  177. package/scripts/run-skill-routing-eval.ts +1601 -0
  178. package/scripts/session-context-packet-panel.ts +560 -0
  179. package/scripts/ship-worktrees.sh +176 -53
  180. package/scripts/skill-surface-select.ts +105 -0
  181. package/scripts/sprint-backlog.sh +6 -1
  182. package/scripts/switch-plan.sh +2 -5
  183. package/scripts/sync-codex-installed-copies.sh +235 -31
  184. package/scripts/sync-helper-sources.ts +198 -0
  185. package/scripts/sync-hook-sources.ts +96 -113
  186. package/scripts/validate-harness-profile-benchmark.ts +39 -0
  187. package/scripts/verify-contract.sh +248 -20
  188. package/scripts/verify-sprint.sh +401 -160
  189. package/scripts/workflow-contract.ts +117 -30
  190. package/scripts/workstream-sync.sh +8 -2
  191. package/src/cli/chatgpt-browser/file-policy.ts +6 -27
  192. package/src/cli/commands/adopt-plan.ts +80 -111
  193. package/src/cli/commands/capability-context.ts +2 -12
  194. package/src/cli/commands/cross-review.ts +80 -0
  195. package/src/cli/commands/doctor.ts +12 -23
  196. package/src/cli/commands/global-runtime.ts +312 -62
  197. package/src/cli/commands/hook.ts +7 -9
  198. package/src/cli/commands/init-hook.ts +11 -0
  199. package/src/cli/commands/init.ts +188 -86
  200. package/src/cli/commands/install.ts +3 -1
  201. package/src/cli/commands/mcp.ts +52 -4
  202. package/src/cli/commands/migrate.ts +10 -40
  203. package/src/cli/commands/prompt-guard-decision.ts +2 -0
  204. package/src/cli/commands/run.ts +19 -1
  205. package/src/cli/commands/state.ts +124 -0
  206. package/src/cli/commands/status.ts +55 -1
  207. package/src/cli/commands/validators.ts +1 -1
  208. package/src/cli/hook/circuit-breaker.ts +278 -0
  209. package/src/cli/hook/command-observed.ts +259 -0
  210. package/src/cli/hook/delegation-state.ts +328 -0
  211. package/src/cli/hook/event-telemetry.ts +313 -0
  212. package/src/cli/hook/handler-contract.ts +39 -0
  213. package/src/cli/hook/handler-registry.ts +121 -0
  214. package/src/cli/hook/hook-input.ts +230 -0
  215. package/src/cli/hook/legacy-active-plan-migration.ts +88 -0
  216. package/src/cli/hook/minimal-change-context.ts +4 -2
  217. package/src/cli/hook/mutation-guard.ts +1062 -0
  218. package/src/cli/hook/mutation-observed.ts +902 -0
  219. package/src/cli/hook/prompt-guard-decision.ts +13 -4
  220. package/src/cli/hook/prompt-handler.ts +800 -0
  221. package/src/cli/hook/prompt-intents.ts +16 -5
  222. package/src/cli/hook/prompt-router.ts +75 -0
  223. package/src/cli/hook/review-subject.ts +45 -0
  224. package/src/cli/hook/route-registry.ts +32 -21
  225. package/src/cli/hook/runtime.ts +334 -312
  226. package/src/cli/hook/session-context-budget.ts +397 -0
  227. package/src/cli/hook/session-context.ts +1405 -0
  228. package/src/cli/hook/state-snapshot.ts +2 -363
  229. package/src/cli/hook/stop-handler.ts +570 -0
  230. package/src/cli/hook/subagent-handler.ts +697 -0
  231. package/src/cli/hook/trace-observer.ts +202 -0
  232. package/src/cli/hook-entry.ts +57 -15
  233. package/src/cli/index.ts +221 -113
  234. package/src/cli/installer/install-profile.ts +1026 -0
  235. package/src/cli/installer/managed-entries.ts +25 -13
  236. package/src/cli/installer/targets/claude.ts +2 -2
  237. package/src/cli/installer/targets/codex.ts +2 -2
  238. package/src/cli/installer/types.ts +3 -1
  239. package/src/cli/mcp/auth.ts +27 -16
  240. package/src/cli/mcp/codegraph-adapter.ts +42 -11
  241. package/src/cli/mcp/coding-tools.ts +640 -0
  242. package/src/cli/mcp/coding-workspaces.ts +495 -0
  243. package/src/cli/mcp/general-repo-access/authority.ts +580 -0
  244. package/src/cli/mcp/general-repo-access.ts +33 -613
  245. package/src/cli/mcp/instructions.ts +7 -2
  246. package/src/cli/mcp/oauth.ts +179 -30
  247. package/src/cli/mcp/policy.ts +24 -27
  248. package/src/cli/mcp/process-sessions.ts +764 -0
  249. package/src/cli/mcp/reader-tools.ts +14 -204
  250. package/src/cli/mcp/server.ts +126 -21
  251. package/src/cli/mcp/setup.ts +419 -269
  252. package/src/cli/mcp/state-tools.ts +164 -0
  253. package/src/cli/mcp/tools.ts +41 -52
  254. package/src/cli/mcp/transports/http.ts +330 -75
  255. package/src/cli/mcp/types.ts +10 -9
  256. package/src/cli/repo-adoption/target.ts +58 -0
  257. package/src/cli/runtime/helper-runner.ts +329 -46
  258. package/src/cli/runtime/write-all-sync.ts +26 -0
  259. package/src/core/adoption/gitignore-plan.ts +6 -0
  260. package/src/{effects → core/adoption}/managed-block.ts +1 -1
  261. package/src/core/adoption/managed-hook-config.ts +85 -0
  262. package/src/core/adoption/operations.ts +4 -0
  263. package/src/core/adoption/plan.ts +32 -120
  264. package/src/core/adoption/rollback.ts +20 -0
  265. package/src/core/adoption/source-checkout.ts +43 -0
  266. package/src/core/adoption/standard-plan.ts +829 -0
  267. package/src/core/capabilities/registry.ts +474 -0
  268. package/src/core/evidence/canonical-json.ts +26 -0
  269. package/src/core/evidence/checkpoint.ts +278 -0
  270. package/src/core/evidence/fold.ts +135 -0
  271. package/src/core/evidence/idempotency.ts +42 -0
  272. package/src/core/evidence/json-walk.ts +47 -0
  273. package/src/core/evidence/payload-cap.ts +18 -0
  274. package/src/core/evidence/redaction.ts +209 -0
  275. package/src/core/evidence/types.ts +74 -0
  276. package/src/core/evidence/ulid.ts +69 -0
  277. package/src/core/loop/loop-event-protocol.ts +211 -0
  278. package/src/core/review/cross-review.ts +300 -0
  279. package/src/core/skill-surface/catalog.ts +761 -0
  280. package/src/core/skill-surface/profile-components.ts +44 -0
  281. package/src/core/source-projection.ts +228 -0
  282. package/src/core/state/artifact-parsers.ts +167 -0
  283. package/src/core/state/project-effective-state.ts +402 -0
  284. package/src/core/state/project-state-snapshot.ts +45 -0
  285. package/src/core/state/types.ts +131 -0
  286. package/src/core/workflow/artifact-requirement-policy.ts +239 -0
  287. package/src/core/workflow/operation-readiness.ts +310 -0
  288. package/src/core/workflow/profile.ts +310 -0
  289. package/src/effects/evidence/atomic-append.ts +59 -0
  290. package/src/effects/evidence/attested-import.ts +320 -0
  291. package/src/effects/evidence/blob-store.ts +74 -0
  292. package/src/effects/evidence/checkpoint-store.ts +452 -0
  293. package/src/effects/evidence/checks-materializer.ts +277 -0
  294. package/src/effects/evidence/epoch.ts +9 -0
  295. package/src/effects/evidence/event-log.ts +132 -0
  296. package/src/effects/evidence/event-writer.ts +124 -0
  297. package/src/effects/evidence/paths.ts +28 -0
  298. package/src/effects/evidence/post-bash-importer.ts +345 -0
  299. package/src/effects/evidence/recovery-materializer.ts +850 -0
  300. package/src/effects/evidence/secret-env.ts +16 -0
  301. package/src/effects/evidence/verify-producer.ts +360 -0
  302. package/src/effects/expensive-run-lock.ts +19 -0
  303. package/src/effects/fs-transaction.ts +366 -24
  304. package/src/effects/git/common-directory.ts +14 -0
  305. package/src/effects/locking/exclusive-directory-lock.ts +415 -0
  306. package/src/effects/loop/state-input-collector.ts +169 -0
  307. package/src/effects/process-group-launcher.ts +84 -0
  308. package/src/effects/process-runner.ts +189 -18
  309. package/src/effects/process-supervisor.ts +468 -0
  310. package/src/effects/repo-registry.ts +248 -26
  311. package/src/effects/review/cross-review-runner.ts +367 -0
  312. package/src/{cli/hook → effects/review}/diff-fingerprint.ts +147 -144
  313. package/src/effects/state/collect-state-inputs.ts +129 -0
  314. package/src/effects/state/git-state-version-store.ts +165 -0
  315. package/src/effects/state/resolve-effective-state.ts +686 -0
  316. package/src/effects/state/state-cache.ts +80 -0
  317. package/src/effects/state/state-lock.ts +7 -0
  318. package/.agents/skills/repo-harness-chatgpt-browser/SKILL.md +0 -112
  319. package/assets/hooks/anti-simplification.sh +0 -12
  320. package/assets/hooks/changelog-guard.sh +0 -80
  321. package/assets/hooks/codex-delegation-advisor.sh +0 -214
  322. package/assets/hooks/codex.hooks.template.json +0 -77
  323. package/assets/hooks/first-principles-guard.sh +0 -72
  324. package/assets/hooks/hook-input.sh +0 -618
  325. package/assets/hooks/lib/minimal-change.sh +0 -77
  326. package/assets/hooks/lib/session-state.sh +0 -106
  327. package/assets/hooks/minimal-change-context.sh +0 -16
  328. package/assets/hooks/minimal-change-observer.sh +0 -18
  329. package/assets/hooks/post-bash.sh +0 -215
  330. package/assets/hooks/post-edit-guard.sh +0 -273
  331. package/assets/hooks/post-tool-observer.sh +0 -99
  332. package/assets/hooks/pre-edit-guard.sh +0 -240
  333. package/assets/hooks/prompt-guard.sh +0 -1291
  334. package/assets/hooks/run-hook.sh +0 -124
  335. package/assets/hooks/security-sentinel.sh +0 -115
  336. package/assets/hooks/session-start-context.sh +0 -581
  337. package/assets/hooks/settings.template.json +0 -62
  338. package/assets/hooks/stop-orchestrator.sh +0 -463
  339. package/assets/hooks/subagent-return-channel-guard.sh +0 -107
  340. package/assets/hooks/subagent-start-context.sh +0 -132
  341. package/assets/hooks/subagent-stop-quality.sh +0 -121
  342. package/assets/hooks/worktree-guard.sh +0 -39
  343. package/assets/skill-commands/repo-harness-autoplan/SKILL.md +0 -58
  344. package/assets/skill-commands/repo-harness-capability/SKILL.md +0 -36
  345. package/assets/skill-commands/repo-harness-deploy/SKILL.md +0 -40
  346. package/assets/skill-commands/repo-harness-gptpro/SKILL.md +0 -106
  347. package/assets/skill-commands/repo-harness-gptpro-setup/SKILL.md +0 -75
  348. package/assets/skill-commands/repo-harness-handoff/SKILL.md +0 -36
  349. package/assets/skill-commands/repo-harness-init/SKILL.md +0 -31
  350. package/assets/skill-commands/repo-harness-migrate/SKILL.md +0 -33
  351. package/assets/skill-commands/repo-harness-repair/SKILL.md +0 -29
  352. package/assets/skill-commands/repo-harness-upgrade/SKILL.md +0 -33
  353. package/assets/skills/claude-review/SKILL.md +0 -231
  354. package/assets/skills/codex-review/SKILL.md +0 -103
  355. package/assets/templates/helpers/migrate-project-template.sh +0 -54
  356. package/assets/templates/helpers/migrate-workflow-docs.ts +0 -413
  357. package/scripts/hook-shim.sh +0 -93
  358. package/scripts/mcp-rollout-gate.ts +0 -658
  359. package/scripts/migrate-project-template.sh +0 -1178
  360. package/scripts/migrate-workflow-docs.ts +0 -413
  361. package/scripts/repo-harness.sh +0 -516
  362. package/src/cli/repo-adoption/reclaim-runtime.ts +0 -654
package/AGENTS.md CHANGED
@@ -17,15 +17,15 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
17
17
  - `.ai/harness/policy.json` for the machine-readable workflow contract
18
18
  - `.ai/context/context-map.json` for progressive context loading
19
19
  - `docs/architecture/index.md` for umbrella architecture status, drift requests, snapshots, and diagram links
20
- - `docs/reference-configs/agentic-development-flow.md` for gstack/Waza routing rules
20
+ - `docs/reference-configs/agentic-development-flow.md` for parent-agent/Waza routing and P1/P2/P3 rules
21
21
 
22
22
  ## Operating Rules
23
23
 
24
24
  - Sync `tasks/` whenever substantive repo changes are made.
25
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.
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
+ - Treat hook execution as typed and user-level: `~/.claude/settings.json` and `~/.codex/hooks.json` invoke `repo-harness-hook`, whose route registry selects exactly one in-process handler. `.ai/hooks/lib/workflow-state.sh` is an operator-helper library, never a host-event dispatcher.
27
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/todos.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
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
+ - Treat `.ai/context/capabilities.json` as the source of truth for capability prefixes; `agent-context-blocks.txt` and nested agent files are initialization inputs only, never runtime resolver authority.
29
29
  - Keep architecture drift handling split: `architecture-queue.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.
30
30
  - Keep `assets/workflow-contract.v1.json` and `.ai/harness/workflow-contract.json` in sync.
31
31
  - Keep `CLAUDE.md` and `AGENTS.md` short; put detailed guidance in `docs/reference-configs/`.
@@ -33,22 +33,29 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
33
33
  - Treat `.ai/harness/checks/*.latest.{json,md}` and `.ai/harness/runs/` as ignored runtime evidence cache; commit durable conclusions in `tasks/reviews/`, `tasks/contracts/`, `tasks/notes/`, or `docs/researches/` instead.
34
34
  - Treat architecture/spec/research docs as the human reading entrypoint. Before closing a workflow, promote durable conclusions into `docs/architecture/`, `docs/researches/`, `docs/spec.md`, or `tasks/lessons.md`; then archive fulfilled plan/contract/review/notes/todo artifacts so root workflow surfaces represent active work only. `.rgignore` hides archived workflow artifacts and runtime evidence from default `rg` searches; use explicit paths or `rg -uu` for audits.
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
- - 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.
36
+ - Treat `deploy/` as the trackable deployment and operations surface for runbooks, submission materials, release checklists, helper scripts, ordered SQL files, and env examples; follow `.ai/harness/policy.json#operations.deploy_sql` for configured SQL roots and naming modes, otherwise keep SQL directly under `deploy/sql/` with 4-digit ascending prefixes.
37
37
  - Treat `_ops/` as ignored local operations state for secrets, real env files, provider state, artifacts, logs, and scratch files; do not commit or agent-edit `_ops/*`.
38
38
  - Treat contract-level task execution as worktree-first: `repo-harness run plan-to-todo --plan <approved-plan>` starts `repo-harness run contract-worktree start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `repo-harness run contract-worktree finish`.
39
39
  - Treat the EXECUTION_BOUNDARY anti-extras clause as mandatory on every delegated runner surface (contract worker prompts, the Codex delegation advisor hook, subagent start context, and MCP `codex-goal` documents): absent requirements are forbidden design space, not permission to improve, and unrequested extras fail closed.
40
40
  - After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete work-package plan, capture it with `repo-harness run capture-plan --artifact-level work-package --slug <slug> --title <title>` so `plans/` becomes the file-backed source of truth; if the user has already approved implementation, capture with `--status Approved --execute --promotion-reason <merge_boundary|rollback_boundary|verification_boundary|risk_boundary|human_decision_boundary|worktree_boundary>` or run `repo-harness run plan-to-todo --plan <active-plan>`.
41
41
  - Promote work into a top-level `plans/plan-*.md` only when `Artifact Level: work-package` is justified by a merge/PR unit, rollback surface, independent verification boundary, review/acceptance boundary, high-risk surface, or otherwise cannot remain a checklist item in the current active plan or sprint backlog. Inline sprint rows and checklist rows stay in the sprint backlog or active plan `## Task Breakdown`; contract rows may expand into plan -> contract -> review -> notes only through the work-package gate.
42
42
  - If current repo state conflicts with the task, open an isolated `codex/<task-slug>` worktree, finish there, run Waza `/check`-style validation, then merge back to `main` without absorbing unrelated dirty changes.
43
- - 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`.
43
+ - Route product discovery and complex/design planning to the parent agent: use `geju` for pre-contract framing, complete P1/P2/P3 with the parent agent's own capabilities, and freeze the accepted direction into the plan and contract. Route daily small/medium planning, bug hunts, and checks to Waza `/think`, `/hunt`, and `/check`. Route a proactive multi-direction visual/UX choice mid-task to the design-options convention (`repo-harness docs show design-options`).
44
44
  - Codex automation profile is runtime-referenced, not vendored: required skills are `health`, `check`, and `diagram-design` from `~/.codex/skills`.
45
- - Route knowledge sync and handoff retrieval to `gbrain`.
46
- - Register valuable repo-authored docs in `.ai/harness/brain-manifest.json` with `sync.direction=repo-to-brain`; `scripts/sync-brain-docs.sh` and the PostEdit hook mirror only those explicit entries into the default brain vault.
45
+ - Keep durable repo knowledge in `docs/researches/`, `tasks/lessons.md`, and the canonical workflow artifacts.
46
+ - Treat `.ai/harness/brain-manifest.json` and `repo-harness run sync-brain-docs` as explicit operator-invoked export surfaces only; hooks and workflow checks must not read, write, or gate on external brain-vault state.
47
47
  - Treat Waza as Codex-first: `~/.codex/skills` is the Codex runtime source; `~/.agents/skills` is skills CLI staging/cache only. Update by staging upstream Waza, copying the eight managed `SKILL.md` files into Codex, and verifying with `cmp`.
48
48
  - Use `docs/reference-configs/external-tooling.md` and `bash scripts/check-agent-tooling.sh --host both --check-updates` for environment checks; this self-host repo vendors CodeGraph as a dev dependency while generated downstream repos keep the global MCP default unless local policy opts in.
49
- - When changing `scripts/migrate-project-template.sh` or `scripts/lib/project-init-lib.sh`, verify self-migration of this repo still works.
49
+ - When changing adoption planner or transaction code, verify `repo-harness adopt --repo . --dry-run` and a fixture apply use the same TS operation model.
50
50
  - Treat repo-local `.claude/settings.json` and `.codex/hooks.json` hook adapters as retired legacy config; migration may back them up locally, but they are not product deliverables.
51
51
 
52
+ ## Code Optimization Principles
53
+
54
+ - Reason from first principles: identify observable conditions, controllable inputs, the invariant, and the actual pressure point before changing structure.
55
+ - Keep one source of truth for each datum; every other representation must be a deterministic projection with a drift check.
56
+ - Do not add steady-state compatibility code, dual authority, semantic fallbacks, aliases, or shadow parsers. Explicit one-shot migrations must fail closed and remove the retired path in the same work-package.
57
+ - Create shared components only for observed reuse or a cross-module invariant. Prefer an existing monorepo workspace only when independently meaningful consumers need the shared package; do not convert this single-package repo without that boundary.
58
+
52
59
  ## Required Checks
53
60
 
54
61
  ```bash
@@ -58,7 +65,7 @@ bash scripts/check-architecture-sync.sh
58
65
  bash scripts/check-task-sync.sh
59
66
  repo-harness run check-task-workflow --strict
60
67
  bun scripts/inspect-project-state.ts --repo . --format text
61
- bash scripts/migrate-project-template.sh --repo . --dry-run
68
+ bun src/cli/index.ts adopt --repo . --dry-run
62
69
  ```
63
70
 
64
71
  <!-- BEGIN ARCHITECTURE CONTRACT -->
package/CLAUDE.md CHANGED
@@ -17,15 +17,15 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
17
17
  - `.ai/harness/policy.json` for the machine-readable workflow contract
18
18
  - `.ai/context/context-map.json` for progressive context loading
19
19
  - `docs/architecture/index.md` for umbrella architecture status, drift requests, snapshots, and diagram links
20
- - `docs/reference-configs/agentic-development-flow.md` for gstack/Waza routing rules
20
+ - `docs/reference-configs/agentic-development-flow.md` for parent-agent/Waza routing and P1/P2/P3 rules
21
21
 
22
22
  ## Operating Rules
23
23
 
24
24
  - Sync `tasks/` whenever substantive repo changes are made.
25
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.
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
+ - Treat hook execution as typed and user-level: `~/.claude/settings.json` and `~/.codex/hooks.json` invoke `repo-harness-hook`, whose route registry selects exactly one in-process handler. `.ai/hooks/lib/workflow-state.sh` is an operator-helper library, never a host-event dispatcher.
27
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/todos.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
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
+ - Treat `.ai/context/capabilities.json` as the source of truth for capability prefixes; `agent-context-blocks.txt` and nested agent files are initialization inputs only, never runtime resolver authority.
29
29
  - Keep architecture drift handling split: `architecture-queue.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.
30
30
  - Keep `assets/workflow-contract.v1.json` and `.ai/harness/workflow-contract.json` in sync.
31
31
  - Keep `CLAUDE.md` and `AGENTS.md` short; put detailed guidance in `docs/reference-configs/`.
@@ -33,22 +33,29 @@ This repository self-hosts the `repo-harness` contract; the former `repo-harness
33
33
  - Treat `.ai/harness/checks/*.latest.{json,md}` and `.ai/harness/runs/` as ignored runtime evidence cache; commit durable conclusions in `tasks/reviews/`, `tasks/contracts/`, `tasks/notes/`, or `docs/researches/` instead.
34
34
  - Treat architecture/spec/research docs as the human reading entrypoint. Before closing a workflow, promote durable conclusions into `docs/architecture/`, `docs/researches/`, `docs/spec.md`, or `tasks/lessons.md`; then archive fulfilled plan/contract/review/notes/todo artifacts so root workflow surfaces represent active work only. `.rgignore` hides archived workflow artifacts and runtime evidence from default `rg` searches; use explicit paths or `rg -uu` for audits.
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
- - 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.
36
+ - Treat `deploy/` as the trackable deployment and operations surface for runbooks, submission materials, release checklists, helper scripts, ordered SQL files, and env examples; follow `.ai/harness/policy.json#operations.deploy_sql` for configured SQL roots and naming modes, otherwise keep SQL directly under `deploy/sql/` with 4-digit ascending prefixes.
37
37
  - Treat `_ops/` as ignored local operations state for secrets, real env files, provider state, artifacts, logs, and scratch files; do not commit or agent-edit `_ops/*`.
38
38
  - Treat contract-level task execution as worktree-first: `repo-harness run plan-to-todo --plan <approved-plan>` starts `repo-harness run contract-worktree start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `repo-harness run contract-worktree finish`.
39
39
  - Treat the EXECUTION_BOUNDARY anti-extras clause as mandatory on every delegated runner surface (contract worker prompts, the Codex delegation advisor hook, subagent start context, and MCP `codex-goal` documents): absent requirements are forbidden design space, not permission to improve, and unrequested extras fail closed.
40
40
  - After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete work-package plan, capture it with `repo-harness run capture-plan --artifact-level work-package --slug <slug> --title <title>` so `plans/` becomes the file-backed source of truth; if the user has already approved implementation, capture with `--status Approved --execute --promotion-reason <merge_boundary|rollback_boundary|verification_boundary|risk_boundary|human_decision_boundary|worktree_boundary>` or run `repo-harness run plan-to-todo --plan <active-plan>`.
41
41
  - Promote work into a top-level `plans/plan-*.md` only when `Artifact Level: work-package` is justified by a merge/PR unit, rollback surface, independent verification boundary, review/acceptance boundary, high-risk surface, or otherwise cannot remain a checklist item in the current active plan or sprint backlog. Inline sprint rows and checklist rows stay in the sprint backlog or active plan `## Task Breakdown`; contract rows may expand into plan -> contract -> review -> notes only through the work-package gate.
42
42
  - If current repo state conflicts with the task, open an isolated `codex/<task-slug>` worktree, finish there, run Waza `/check`-style validation, then merge back to `main` without absorbing unrelated dirty changes.
43
- - 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`.
43
+ - Route product discovery and complex/design planning to the parent agent: use `geju` for pre-contract framing, complete P1/P2/P3 with the parent agent's own capabilities, and freeze the accepted direction into the plan and contract. Route daily small/medium planning, bug hunts, and checks to Waza `/think`, `/hunt`, and `/check`. Route a proactive multi-direction visual/UX choice mid-task to the design-options convention (`repo-harness docs show design-options`).
44
44
  - Codex automation profile is runtime-referenced, not vendored: required skills are `health`, `check`, and `diagram-design` from `~/.codex/skills`.
45
- - Route knowledge sync and handoff retrieval to `gbrain`.
46
- - Register valuable repo-authored docs in `.ai/harness/brain-manifest.json` with `sync.direction=repo-to-brain`; `scripts/sync-brain-docs.sh` and the PostEdit hook mirror only those explicit entries into the default brain vault.
45
+ - Keep durable repo knowledge in `docs/researches/`, `tasks/lessons.md`, and the canonical workflow artifacts.
46
+ - Treat `.ai/harness/brain-manifest.json` and `repo-harness run sync-brain-docs` as explicit operator-invoked export surfaces only; hooks and workflow checks must not read, write, or gate on external brain-vault state.
47
47
  - Treat Waza as Codex-first: `~/.codex/skills` is the Codex runtime source; `~/.agents/skills` is skills CLI staging/cache only. Update by staging upstream Waza, copying the eight managed `SKILL.md` files into Codex, and verifying with `cmp`.
48
48
  - Use `docs/reference-configs/external-tooling.md` and `bash scripts/check-agent-tooling.sh --host both --check-updates` for environment checks; this self-host repo vendors CodeGraph as a dev dependency while generated downstream repos keep the global MCP default unless local policy opts in.
49
- - When changing `scripts/migrate-project-template.sh` or `scripts/lib/project-init-lib.sh`, verify self-migration of this repo still works.
49
+ - When changing adoption planner or transaction code, verify `repo-harness adopt --repo . --dry-run` and a fixture apply use the same TS operation model.
50
50
  - Treat repo-local `.claude/settings.json` and `.codex/hooks.json` hook adapters as retired legacy config; migration may back them up locally, but they are not product deliverables.
51
51
 
52
+ ## Code Optimization Principles
53
+
54
+ - Reason from first principles: identify observable conditions, controllable inputs, the invariant, and the actual pressure point before changing structure.
55
+ - Keep one source of truth for each datum; every other representation must be a deterministic projection with a drift check.
56
+ - Do not add steady-state compatibility code, dual authority, semantic fallbacks, aliases, or shadow parsers. Explicit one-shot migrations must fail closed and remove the retired path in the same work-package.
57
+ - Create shared components only for observed reuse or a cross-module invariant. Prefer an existing monorepo workspace only when independently meaningful consumers need the shared package; do not convert this single-package repo without that boundary.
58
+
52
59
  ## Required Checks
53
60
 
54
61
  ```bash
@@ -58,7 +65,7 @@ bash scripts/check-architecture-sync.sh
58
65
  bash scripts/check-task-sync.sh
59
66
  repo-harness run check-task-workflow --strict
60
67
  bun scripts/inspect-project-state.ts --repo . --format text
61
- bash scripts/migrate-project-template.sh --repo . --dry-run
68
+ bun src/cli/index.ts adopt --repo . --dry-run
62
69
  ```
63
70
 
64
71
  <!-- BEGIN ARCHITECTURE CONTRACT -->
package/README.es.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # repo-harness
2
2
 
3
- <p align="center">
4
- <img src="docs/images/repo-harness-gptpro.png" alt="repo-harness architecture and ChatGPT Pro local planner workflow diagram" width="960">
5
- </p>
6
-
7
3
  `repo-harness` convierte las sesiones de programación con Claude/Codex en un
8
4
  workflow repo-local repetible. Incluye un CLI y hooks de skill/runtime que
9
5
  escriben contexto, planes, handoffs, checks y evidencias de review dentro del
@@ -30,10 +26,11 @@ Dirección del repositorio: `https://github.com/Ancienttwo/repo-harness`
30
26
  - **El estado de la sesión vive en archivos, no en el historial de chat.** Las
31
27
  distintas sesiones de agente —Claude, Codex, ahora o más tarde— se mantienen
32
28
  sincronizadas a través del repositorio en lugar de un hilo de chat. Cuando
33
- arranca una sesión nueva, `.ai/hooks/session-start-context.sh` inyecta el
29
+ arranca una sesión nueva, el session-context builder in-process
30
+ (`src/cli/hook/session-context.ts`) inyecta el
34
31
  resume packet de la sesión anterior (`.ai/harness/handoff/resume.md`,
35
32
  `tasks/current.md`); al terminar la sesión y tras cada edición,
36
- `finalize-handoff.sh` y `post-edit-guard.sh` escriben de vuelta el siguiente
33
+ los typed handlers `session-context`, `stop` y `mutation-observed` escriben de vuelta el siguiente
37
34
  handoff. Una tarea puede cortarse a mitad de camino y la siguiente sesión
38
35
  retoma directamente el next step exacto, los puntos de bloqueo y los archivos
39
36
  modificados sin tener que volver a inferirlos.
@@ -85,37 +82,32 @@ artifacts.
85
82
  ## Novedades
86
83
 
87
84
  Las notas de versión viven en [`docs/CHANGELOG.md`](docs/CHANGELOG.md). La línea
88
- actual es `0.9.2`.
85
+ actual es `0.11.0`.
89
86
 
90
87
  ## Cómo funciona
91
88
 
92
- En conjunto hay tres capas:
89
+ En conjunto hay tres capas y un único runtime typed para host events:
93
90
 
94
91
  1. **Capa del paquete fuente**: este repositorio mantiene la CLI, los command
95
92
  skill facades, los templates, los hook assets, el workflow contract, los tests
96
93
  y el release gate.
97
94
  2. **Capa del contract del repositorio objetivo**: `repo-harness adopt` o la
98
95
  migración escribe `docs/spec.md`, `plans/`, `tasks/`, `.ai/context/`,
99
- `.ai/harness/`, helper scripts y `.ai/hooks/`.
96
+ `.ai/harness/` y helper scripts. `.ai/hooks/lib/workflow-state.sh` es solo
97
+ una proyección de operator helper.
100
98
  3. **Capa del host adapter**: el `~/.claude/settings.json` y el
101
99
  `~/.codex/hooks.json` a nivel de usuario enrutan los events de Claude/Codex
102
- hacia `repo-harness-hook`. El hook entrypoint primero comprueba si el repo
103
- actual tiene un `.ai/harness/workflow-contract.json`; si no hay opt in, sale en
104
- silencio, y solo si hay opt in entra en los `.ai/hooks/*` del repo actual.
105
-
106
- Para `UserPromptSubmit`, el adapter contract público sigue siendo
107
- `repo-harness-hook UserPromptSubmit --route default`. El CLI route registry hace
108
- dispatch de esa route a `.ai/hooks/prompt-guard.sh`. El shell hook se sigue
109
- ocupando del parseo del host JSON, la lectura de los archivos de workflow, los
110
- side effects de plan capture, el render del quality gate y el stdout/stderr
111
- host-safe. La decisión sobre el prompt intent y el workflow state se delega al
112
- TypeScript decision engine detrás de `repo-harness-hook prompt-guard-decide`, que
113
- devuelve un action enum desde una decision table explícita. Así la configuración
114
- del host no cambia, pero la capa más propensa a errores —el classifier y la
115
- state-machine— deja de estar dispersa en ramas condicionales de shell.
100
+ hacia `repo-harness-hook`. Tras validar `.ai/harness/workflow-contract.json`,
101
+ el route registry usa `event + routeId + matcher` para invocar exactamente un
102
+ typed handler.
103
+
104
+ Todos los events siguen `host adapter -> repo-harness-hook -> route registry ->
105
+ typed handler`. `UserPromptSubmit.default` usa `prompt`; edit/bash/stop usan
106
+ `mutation-observed`, `command-observed` y `stop`. No existe un segundo shell
107
+ dispatcher ni un runtime distinto por provider.
116
108
 
117
109
  El invariante central: los hechos persistentes viven en el repositorio, no en la
118
- ventana de chat. Los hooks son solo aceleradores y guardrails; la verdadera
110
+ ventana de chat. Los typed handlers son solo aceleradores y guardrails; la verdadera
119
111
  authority son los archivos de plan, contract, review, checks y handoff.
120
112
 
121
113
  ## Task Workflow: de Plan a Closeout
@@ -172,20 +164,20 @@ flowchart TD
172
164
  ## Bucles largos de producto
173
165
 
174
166
  Para trabajo Greenfield y Brownfield, adelanta la discovery y el juicio de
175
- engineering plan en Claude-Fable antes de pedirle a Codex que haga loops de
167
+ engineering plan en el parent agent antes de pedirle a Codex que haga loops de
176
168
  ejecución:
177
169
 
178
- 1. En Claude-Fable, usa gstack `office-hours` para product discovery o
179
- `plan-eng-review` para review del plan de ingeniería. La salida debe ser los
180
- development documents que fijan la intención de producto, la arquitectura, los
181
- riesgos y el evidence contract.
170
+ 1. Antes de crear un contract, el parent agent invoca `geju` para abrir el marco y
171
+ después completa P1/P2/P3 con sus propias capacidades repo/runtime. Fija la
172
+ intención de producto, la arquitectura, los riesgos, el falsifier y el evidence
173
+ contract aceptados en los development documents.
182
174
  2. Convierte esos documentos en un PRD Sprint bajo `plans/prds/`, con un
183
175
  backlog ordenado y sub-plans detallados para cada execution slice.
184
176
  3. Crea un Codex Goal que apunte a ese archivo de sprint. repo-harness puede
185
177
  entonces proyectar cada sprint item por el flow normal plan -> contract ->
186
178
  worktree -> verification.
187
179
 
188
- Ese handoff mantiene precisos los loops largos: Claude-Fable se ocupa del juicio
180
+ Ese handoff mantiene precisos los loops largos: el parent agent se ocupa del juicio
189
181
  amplio al inicio, el PRD Sprint es la durable source of truth, y Codex Goal mode
190
182
  retoma contra un sprint concreto en vez de reinterpretar el chat original.
191
183
 
@@ -200,8 +192,9 @@ recomienda al aplicar el settings merge.
200
192
 
201
193
  ### Instalar el CLI
202
194
 
203
- La ruta por defecto no requiere Node.js: el instalador usa Bun como runtime. Si
204
- Bun no existe, instala Bun primero y después instala el CLI `repo-harness`.
195
+ La ruta por defecto no requiere Node.js: el instalador usa Bun >= 1.1.35 como
196
+ runtime. Si Bun no existe o es anterior, lo instala o actualiza antes de
197
+ instalar el CLI `repo-harness`.
205
198
 
206
199
  ```bash
207
200
  # macOS / Linux
@@ -212,7 +205,7 @@ irm https://raw.githubusercontent.com/Ancienttwo/repo-harness/main/install.ps1 |
212
205
  ```
213
206
 
214
207
  <details>
215
- <summary>¿Ya tienes Bun? Usa Bun primero, o npx como fallback</summary>
208
+ <summary>¿Ya tienes Bun >= 1.1.35? Usa Bun primero, o npx como fallback</summary>
216
209
 
217
210
  ```bash
218
211
  # Bun (recomendado)
@@ -251,7 +244,7 @@ Aplica solo después de que el reporte del dry-run sea correcto:
251
244
  repo-harness adopt
252
245
  ```
253
246
 
254
- Para un proyecto o módulo nuevo, usa la branch command `repo-harness-scaffold`.
247
+ Para un proyecto o módulo nuevo, usa el modo scaffold de `repo-harness-setup`.
255
248
  Para un repositorio existente, usa `repo-harness adopt`; este instala o refresca
256
249
  el harness y no crea el stack tecnológico de la aplicación.
257
250
 
@@ -264,7 +257,7 @@ El comando debería terminar imprimiendo `=== Migration Report ===`, e incluir:
264
257
  - `Host hook adapters are user-level:`: recordatorio de instalar los global adapters y de confiar en `~/.codex/hooks.json`
265
258
  - `Workflow migration:`: el plan de creación o refresco de las repo-local harness surfaces
266
259
  - `Helper runtime:`: la cadena de herramientas operativa que obtendrás tras aplicar
267
- - `--- External Tooling ---`: el routing de gstack/Waza/gbrain más las advisory de instalación/actualización
260
+ - `--- External Tooling ---`: la guía de planning parent/Geju, la readiness de Waza y CodeGraph y las advisory de instalación/actualización
268
261
 
269
262
  ### Los dos comandos siguientes
270
263
 
@@ -339,36 +332,39 @@ auditado, y no es un shell arbitrario.
339
332
 
340
333
  ## Hook Authority Map
341
334
 
342
- - `.ai/hooks/` es la única shared hook implementation que se debe editar de forma prioritaria.
343
- - `~/.claude/settings.json` es el Claude adapter a nivel de usuario, encargado de hacer dispatch a los opted-in repos.
344
- - `~/.codex/hooks.json` es el Codex adapter a nivel de usuario, hace dispatch al mismo runner.
345
- - Los hook adapters repo-local `.claude/settings.json` y `.codex/hooks.json` son legacy project-level config y deben retirarse durante la migración.
346
- - Codex debe confiar en `~/.codex/hooks.json` en sus Settings para que los hooks se ejecuten.
347
- - Orden de depuración: user-level adapter config -> `repo-harness-hook` o el fallback `repo-harness hook` -> route registry -> `.ai/hooks/*`.
335
+ `repo-harness-hook` es el único host-event runtime. El adapter a nivel de usuario
336
+ solo entrega el event; route registry usa el tuple estable `event + routeId + matcher`
337
+ para invocar exactamente un typed handler. `assets/hooks/lib/workflow-state.sh` y
338
+ `.ai/hooks/lib/workflow-state.sh` son proyecciones de operator helper, no dispatchers.
348
339
 
340
+ - `~/.claude/settings.json`: Claude adapter a nivel de usuario.
341
+ - `~/.codex/hooks.json`: Codex adapter a nivel de usuario; requiere confianza en Settings.
342
+ - `.claude/settings.json` / `.codex/hooks.json` repo-locales: inputs legacy que se retiran durante migration.
343
+ - Los cambios de handler viven en `src/cli/hook/`; sincroniza la proyección con `bun run sync:hooks`.
349
344
 
350
- The installed adapter owns eight managed hook routes. The route tuple
351
- `event + routeId + matcher` is the stable contract; script names are the current
352
- implementation under `assets/hooks/` or a repo-pinned `.ai/hooks/` copy.
345
+ The installed adapter owns the managed hook routes. Each route invokes one typed
346
+ handler; no existe un segundo runtime de shell ni un runtime específico por provider.
353
347
 
354
- | Route | Matcher | Scripts | Function |
348
+ | Route | Matcher | Typed handler | Function |
355
349
  | --- | --- | --- | --- |
356
- | `SessionStart.default` | all sessions | `session-start-context.sh`, `security-sentinel.sh` | Injects prior handoff, sprint status, and read-only config-security findings before work starts. |
357
- | `PreToolUse.edit` | `Edit|Write` | `worktree-guard.sh`, `pre-edit-guard.sh` | Enforces worktree policy and plan/contract readiness before implementation edits. |
358
- | `PreToolUse.subagent` | `Task|Agent|SendUserMessage` | `subagent-return-channel-guard.sh` | Keeps delegated work returning through the parent session instead of leaking completion claims. |
359
- | `PostToolUse.edit` | `Edit|Write` | `post-edit-guard.sh` | Records edit traces, refreshes handoff/task status, and queues architecture drift when controlled files change. |
360
- | `PostToolUse.bash` | `Bash` | `post-bash.sh` | Observes command results and captures verification evidence without replacing the command runner. |
361
- | `PostToolUse.always` | all tools | `post-tool-observer.sh` | Provides low-noise always-on trace and runtime observation; stale pinned copies soft-skip with a refresh hint. |
362
- | `UserPromptSubmit.default` | all prompts | `prompt-guard.sh` | Classifies prompt intent, routes planning/check/hunt hints, and renders host-safe workflow guidance. |
363
- | `Stop.default` | session stop | `stop-orchestrator.sh` | Finalizes handoff and guards against ending with unresolved draft-plan or completion evidence gaps. |
350
+ | `SessionStart.default` | all sessions | `src/cli/hook/session-context.ts` (in-process builder) | Injects prior handoff, sprint status, and read-only config-security findings before work starts. |
351
+ | `PreToolUse.edit` | `Edit|Write` | `src/cli/hook/mutation-guard.ts` (in-process handler) | Enforces worktree policy and plan/contract readiness before implementation edits. |
352
+ | `PreToolUse.subagent` | `Task|Agent|SendUserMessage` | `subagent` | Keeps delegated work returning through the parent session instead of leaking completion claims. |
353
+ | `PostToolUse.edit` | `Edit|Write` | `mutation-observed` | Records the edit journal and controlled-file observations. |
354
+ | `PostToolUse.bash` | `Bash` | `command-observed` | Observes command results and captures verification evidence without replacing the command runner. |
355
+ | `PostToolUse.always` | all tools | `trace-observer` | Provides low-noise always-on trace and runtime observation. |
356
+ | `UserPromptSubmit.default` | all prompts | `prompt` | Classifies prompt intent, routes planning/check/hunt hints, and renders host-safe workflow guidance. |
357
+ | `Stop.default` | session stop | `src/cli/hook/stop-handler.ts` (in-process handler) | Finalizes handoff and guards against ending with unresolved draft-plan or completion evidence gaps. |
364
358
 
365
- `SessionStart` ejecuta dos scripts ordenados antes de empezar el trabajo:
359
+ `SessionStart` ejecuta el session-context builder in-process, que ensambla el contexto antes de empezar el trabajo:
366
360
 
367
361
  ```mermaid
368
362
  flowchart LR
369
- SessionStart["Claude/Codex SessionStart"] --> Ctx["session-start-context.sh<br/>contexto de resume + handoff"]
370
- Ctx --> Sec["security-sentinel.sh<br/>escaneo de configuración de solo lectura, fingerprint-gated"]
371
- Sec --> SSOut["SessionStart additionalContext<br/>estado de la sesión anterior + hallazgos de SecurityConfig"]
363
+ SessionStart["Claude/Codex SessionStart"] --> Ctx["session-context.ts<br/>in-process builder"]
364
+ Ctx --> Resume["contexto de resume + handoff"]
365
+ Ctx --> Sec["security scan<br/>escaneo de configuración de solo lectura, fingerprint-gated"]
366
+ Resume --> SSOut["SessionStart additionalContext<br/>estado de la sesión anterior + hallazgos de SecurityConfig"]
367
+ Sec --> SSOut
372
368
  ```
373
369
 
374
370
  El prompt guard tiene un paso interno adicional:
@@ -378,17 +374,14 @@ flowchart LR
378
374
  Host["Claude/Codex UserPromptSubmit"] --> Adapter["user-level adapter"]
379
375
  Adapter --> CLI["repo-harness-hook UserPromptSubmit --route default"]
380
376
  CLI --> Route["route registry"]
381
- Route --> Shell[".ai/hooks/prompt-guard.sh"]
382
- Shell --> Decision["repo-harness-hook prompt-guard-decide<br/>TypeScript decision table"]
383
- Decision --> Action["single action enum"]
384
- Action --> Shell
385
- Shell --> RouteHint["Waza route hint<br/>think/planning explícito coincide primero → /think"]
386
- Shell --> HostOutput["host-safe allow, advice, block, or done gate output"]
377
+ Route --> Handler["prompt handler<br/>typed decision table"]
378
+ Handler --> RouteHint["Waza route hint<br/>think/planning explícito coincide primero → /think"]
379
+ Handler --> HostOutput["host-safe allow, advice, block, or done gate output"]
387
380
  ```
388
381
 
389
- La capa de shell sigue teniendo la authority del sistema de archivos y los side
390
- effects. TypeScript solo tiene el classifier más la decision table de
391
- `intent x plan state`.
382
+ El typed handler posee el parseo de entrada, el estado de archivos y los side effects
383
+ declarados; el runtime solo unifica el host output. AcceptanceReceipt es la authority
384
+ de closeout y review Markdown es una proyección.
392
385
 
393
386
  ## Hook Failure Playbook
394
387
 
@@ -410,7 +403,8 @@ Guards habituales:
410
403
  ## Repo Workflow
411
404
 
412
405
  - Root routing docs: `CLAUDE.md`, `AGENTS.md`
413
- - Shared hook layer: `.ai/hooks/`
406
+ - Typed hook runtime: `src/cli/hook/` (a través de `repo-harness-hook`)
407
+ - Operator helper projection: `.ai/hooks/lib/workflow-state.sh`
414
408
  - User-level adapter layer: `~/.claude/settings.json`, `~/.codex/hooks.json`
415
409
  - Active execution surface: `tasks/`
416
410
  - Plan source of truth: `plans/`
@@ -419,8 +413,8 @@ Guards habituales:
419
413
 
420
414
  ## Release actual
421
415
 
422
- - npm package: `repo-harness@0.9.2`
423
- - Generated workflow stamp: `repo-harness@0.9.2+template@0.9.2`
416
+ - npm package: `repo-harness@0.11.0`
417
+ - Generated workflow stamp: `repo-harness@0.11.0+template@0.11.0`
424
418
  - GitHub repository: `Ancienttwo/repo-harness`
425
419
  - Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
426
420
 
@@ -435,10 +429,6 @@ Gracias a [TW93](https://x.com/HiTw93), autor de Waza. Los skills centrales
435
429
  `think`, `hunt`, `check` y `health` dan forma al ritmo diario de planning, bug
436
430
  hunt y verification de `repo-harness`.
437
431
 
438
- Gracias a [Garry Tan](https://x.com/garrytan), autor de gstack y gbrain. Ambos
439
- influyeron en el workflow de product discovery, plan/design review, release
440
- documentation, knowledge sync y handoff retrieval.
441
-
442
432
  Gracias a [Peter Steinberger](https://x.com/steipete), autor de Oracle
443
433
  (`@steipete/oracle`, MIT). Es el motor de consult de navegador GPT Pro / ChatGPT
444
434
  Web por defecto de `chatgpt-browser`: el provider Oracle ejecuta el binario oracle
@@ -458,35 +448,53 @@ Mantén esta atribución opt-in y visible por commit. No la incorpores en script
458
448
 
459
449
  ## Action Command Skills
460
450
 
461
- Los command facades públicos están en `assets/skill-commands/`; preservan la
462
- compatibilidad de discovery por skills, mientras el CLI y los hooks ejecutan:
463
-
464
- - Planning / review: `repo-harness-plan`, `repo-harness-review`, `repo-harness-autoplan`
465
- - Product planning layer: `repo-harness-prd` (activa `$geju`, luego usa drafting Claude-first con `claude -p --model opus`; Codex queda solo como fallback)
466
- - Sprint program layer: `repo-harness-sprint` (convierte un PRD en un backlog ordenado bajo `plans/sprints/`)
467
- - Goal session layer: `repo-harness-goal` / `repo-harness:goal` (prepara prompts `/goal` de Codex/Claude desde un PRD o Sprint detallado; si falta el documento, lo pide primero)
468
- - 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`
469
- - Branch project creation: `repo-harness-scaffold`
451
+ Los packages canónicos están en `assets/skills/` (packages canónicos
452
+ activados) y en `assets/skill-commands/` (sobrevivientes que evolucionan en su
453
+ sitio); preservan el alcance de discovery por skills, mientras el CLI y los
454
+ hooks ejecutan:
455
+
456
+ - Router: `repo-harness` (Skill raíz, sincronizado sin condición en cada
457
+ profile)
458
+ - Capa setup: `repo-harness-setup` (modos adopt/init, migrate, upgrade,
459
+ repair, scaffold, y capability-configuration; router-only, nunca
460
+ descubierto automáticamente por un profile)
461
+ - Planning: `repo-harness-plan` (crea un plan decision-complete, o revisa uno
462
+ existente)
463
+ - Capa product planning: `repo-harness-product` (modos PRD, Sprint, y Goal; el
464
+ modo PRD activa `$geju`, luego usa drafting Claude-first con `claude -p
465
+ --model opus`, Codex queda solo como fallback; el modo Sprint convierte un
466
+ PRD en un backlog ordenado bajo `plans/sprints/`, cada fila se expande con
467
+ `$think` antes del contract flow; el modo Goal prepara prompts `/goal` de
468
+ Codex/Claude desde un PRD o Sprint detallado y lo pide primero si falta)
469
+ - Verificación: `repo-harness-check` (checks de workflow/release más una
470
+ referencia deploy-readiness)
471
+ - Release: `repo-harness-ship`
472
+ - Architecture: `repo-harness-architecture`
473
+ - Cross-model review: `repo-harness-cross-review` (host-aware; se instala en
474
+ ambos hosts para el profile strict)
475
+ - Integración ChatGPT: `repo-harness-chatgpt` (consult/continuation de Oracle
476
+ browser/GPT Pro, setup de MCP Connector, bridge handoff, y read-back
477
+ evidence; solo setup explícito, nunca implicado por product planning)
470
478
 
471
479
  La cadena de planning está separada por capas:
472
480
 
473
481
  ```text
474
- idea -> repo-harness-prd -> repo-harness-sprint from-prd -> repo-harness-goal
482
+ idea -> repo-harness-product (modo PRD) -> repo-harness-product (modo Sprint, from-prd) -> repo-harness-product (modo Goal)
475
483
  ```
476
484
 
477
- Usa `repo-harness-prd` cuando la fuente todavía es una idea de producto: primero
478
- ejecuta un direction pass con `$geju`, luego pide a Claude vía `claude -p --model opus` que
479
- redacte el PRD, con Codex solo como fallback. Usa
480
- `repo-harness-sprint from-prd <plans/prds/*.prd.md>` para convertir un PRD
481
- aprobado en un Sprint backlog ordenado con acceptance lines verificables por
482
- máquina. Usa `repo-harness-goal` solo cuando ya exista un PRD o Sprint detallado;
483
- prepara un prompt `/goal` acotado para Codex/Claude y mantiene el PRD/Sprint como
484
- source of truth. Si falta ese documento, el goal command debe pedirlo antes de
485
- empezar implementación desde el chat.
485
+ Usa el modo PRD de `repo-harness-product` cuando la fuente todavía es una idea
486
+ de producto: primero ejecuta un direction pass con `$geju`, luego pide a
487
+ Claude vía `claude -p --model opus` que redacte el PRD, con Codex solo como
488
+ fallback. Usa su modo Sprint (`from-prd <plans/prds/*.prd.md>`) para convertir
489
+ un PRD aprobado en un Sprint backlog ordenado con acceptance lines
490
+ verificables por máquina. Usa su modo Goal solo cuando ya exista un PRD o
491
+ Sprint detallado; prepara un prompt `/goal` acotado para Codex/Claude y
492
+ mantiene el PRD/Sprint como source of truth. Si falta ese documento, el modo
493
+ Goal debe pedirlo antes de empezar implementación desde el chat.
486
494
 
487
- `repo-harness adopt` se usa para repositorios existentes; `repo-harness-scaffold`
488
- queda como branch command para crear proyectos o módulos nuevos. `hooks-init`, `docs-init` y
489
- `create-project-dirs` son pasos internos, no commands públicos.
495
+ `repo-harness adopt` se usa para repositorios existentes; el modo scaffold de
496
+ `repo-harness-setup` queda para crear proyectos o módulos nuevos. `hooks-init`,
497
+ `docs-init` y `create-project-dirs` son pasos internos, no commands públicos.
490
498
 
491
499
  ## Maintainer Reference
492
500
 
@@ -545,7 +553,7 @@ bun test
545
553
  bash scripts/check-task-sync.sh
546
554
  bash scripts/check-task-workflow.sh --strict
547
555
  bun scripts/inspect-project-state.ts --repo . --format text
548
- bash scripts/migrate-project-template.sh --repo . --dry-run
556
+ bun src/cli/index.ts adopt --repo . --dry-run
549
557
  bash scripts/check-agent-tooling.sh --host both --check-updates
550
558
  bun run benchmark:skills --eval route-workflow-check
551
559
  ```
@@ -582,7 +590,7 @@ bun run benchmark:skills --eval repair-agents-task-sync
582
590
  - Scaffolding scripts:
583
591
  - `scripts/init-project.sh`
584
592
  - `scripts/create-project-dirs.sh`
585
- - Legacy-doc migrator: `scripts/migrate-workflow-docs.ts`
593
+ - Canonical adoption planner: `src/core/adoption/standard-plan.ts`
586
594
 
587
595
  ## Generated vs Self-Hosted Hook Projection
588
596
 
@@ -620,7 +628,7 @@ bash scripts/check-architecture-sync.sh
620
628
  bash scripts/check-task-sync.sh
621
629
  bash scripts/check-task-workflow.sh --strict
622
630
  bun scripts/inspect-project-state.ts --repo . --format text
623
- bash scripts/migrate-project-template.sh --repo . --dry-run
631
+ bun src/cli/index.ts adopt --repo . --dry-run
624
632
  bash scripts/check-agent-tooling.sh --host both --check-updates
625
633
  bun run benchmark:skills --eval route-workflow-check
626
634
  ```