repo-harness 0.0.0 → 0.1.1

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 (247) hide show
  1. package/AGENTS.md +89 -0
  2. package/CLAUDE.md +89 -0
  3. package/LICENSE +21 -0
  4. package/README.md +295 -1
  5. package/SKILL.md +289 -0
  6. package/agents/openai.yaml +4 -0
  7. package/assets/hooks/AGENTS.md +13 -0
  8. package/assets/hooks/CLAUDE.md +13 -0
  9. package/assets/hooks/anti-simplification.sh +30 -0
  10. package/assets/hooks/atomic-commit.sh +78 -0
  11. package/assets/hooks/atomic-pending.sh +22 -0
  12. package/assets/hooks/changelog-guard.sh +80 -0
  13. package/assets/hooks/codex.hooks.template.json +58 -0
  14. package/assets/hooks/context-pressure-hook.sh +116 -0
  15. package/assets/hooks/finalize-handoff.sh +12 -0
  16. package/assets/hooks/hook-input.sh +532 -0
  17. package/assets/hooks/lib/session-state.sh +48 -0
  18. package/assets/hooks/lib/workflow-state.sh +948 -0
  19. package/assets/hooks/post-bash.sh +42 -0
  20. package/assets/hooks/post-edit-guard.sh +219 -0
  21. package/assets/hooks/pre-code-change.sh +33 -0
  22. package/assets/hooks/pre-edit-guard.sh +156 -0
  23. package/assets/hooks/prompt-guard.sh +571 -0
  24. package/assets/hooks/run-hook.sh +26 -0
  25. package/assets/hooks/session-start-context.sh +118 -0
  26. package/assets/hooks/settings.template.json +58 -0
  27. package/assets/hooks/tdd-guard-hook.sh +78 -0
  28. package/assets/hooks/trace-event.sh +56 -0
  29. package/assets/hooks/worktree-guard.sh +39 -0
  30. package/assets/initializer-question-pack.v1.json +132 -0
  31. package/assets/initializer-question-pack.v1.schema.json +46 -0
  32. package/assets/initializer-question-pack.v2.json +174 -0
  33. package/assets/initializer-question-pack.v3.json +206 -0
  34. package/assets/initializer-question-pack.v3.schema.json +92 -0
  35. package/assets/initializer-question-pack.v4.json +253 -0
  36. package/assets/initializer-question-pack.v4.schema.json +98 -0
  37. package/assets/partials/01-header.partial.md +10 -0
  38. package/assets/partials/02-iron-rules.partial.md +30 -0
  39. package/assets/partials/03-philosophy.partial.md +32 -0
  40. package/assets/partials/04-project-structure.partial.md +36 -0
  41. package/assets/partials/05-workflow.partial.md +79 -0
  42. package/assets/partials/06-cloudflare.partial.md +15 -0
  43. package/assets/partials/07-footer.partial.md +38 -0
  44. package/assets/partials/08-orchestration.partial.md +48 -0
  45. package/assets/partials/09-compact-instructions.partial.md +11 -0
  46. package/assets/partials/_assembly-order.md +40 -0
  47. package/assets/partials-agents/01-header.partial.md +8 -0
  48. package/assets/partials-agents/02-operating-mode.partial.md +44 -0
  49. package/assets/partials-agents/03-orchestration.partial.md +44 -0
  50. package/assets/partials-agents/04-task-protocol.partial.md +69 -0
  51. package/assets/partials-agents/05-coding-constraints.partial.md +20 -0
  52. package/assets/partials-agents/06-quality-safety.partial.md +23 -0
  53. package/assets/partials-agents/07-cloudflare.partial.md +10 -0
  54. package/assets/partials-agents/08-deep-docs.partial.md +32 -0
  55. package/assets/plan-map.json +212 -0
  56. package/assets/project-structures/expo-nativewind.txt +52 -0
  57. package/assets/project-structures/monorepo.txt +63 -0
  58. package/assets/project-structures/remix.txt +50 -0
  59. package/assets/project-structures/vite-tanstack.txt +51 -0
  60. package/assets/reference-configs/AGENTS.md +13 -0
  61. package/assets/reference-configs/CLAUDE.md +13 -0
  62. package/assets/reference-configs/agentic-development-flow.md +77 -0
  63. package/assets/reference-configs/ai-workflows.md +14 -0
  64. package/assets/reference-configs/changelog-versioning.md +13 -0
  65. package/assets/reference-configs/coding-standards.md +14 -0
  66. package/assets/reference-configs/development-protocol.md +20 -0
  67. package/assets/reference-configs/document-generation.md +34 -0
  68. package/assets/reference-configs/evaluator-rubric.md +19 -0
  69. package/assets/reference-configs/external-tooling.md +294 -0
  70. package/assets/reference-configs/git-strategy.md +14 -0
  71. package/assets/reference-configs/global-working-rules.md +48 -0
  72. package/assets/reference-configs/handoff-protocol.md +41 -0
  73. package/assets/reference-configs/harness-overview.md +66 -0
  74. package/assets/reference-configs/hook-operations.md +69 -0
  75. package/assets/reference-configs/release-deploy.md +14 -0
  76. package/assets/reference-configs/spa-day-protocol.md +14 -0
  77. package/assets/reference-configs/sprint-contracts.md +38 -0
  78. package/assets/reference-configs/workflow-orchestration.md +14 -0
  79. package/assets/skill-commands/AGENTS.md +13 -0
  80. package/assets/skill-commands/CLAUDE.md +13 -0
  81. package/assets/skill-commands/agentic-dev-architecture/SKILL.md +35 -0
  82. package/assets/skill-commands/agentic-dev-autoplan/SKILL.md +41 -0
  83. package/assets/skill-commands/agentic-dev-capability/SKILL.md +30 -0
  84. package/assets/skill-commands/agentic-dev-check/SKILL.md +27 -0
  85. package/assets/skill-commands/agentic-dev-deploy/SKILL.md +34 -0
  86. package/assets/skill-commands/agentic-dev-handoff/SKILL.md +30 -0
  87. package/assets/skill-commands/agentic-dev-init/SKILL.md +25 -0
  88. package/assets/skill-commands/agentic-dev-migrate/SKILL.md +23 -0
  89. package/assets/skill-commands/agentic-dev-plan/SKILL.md +25 -0
  90. package/assets/skill-commands/agentic-dev-repair/SKILL.md +23 -0
  91. package/assets/skill-commands/agentic-dev-review/SKILL.md +24 -0
  92. package/assets/skill-commands/agentic-dev-scaffold/SKILL.md +23 -0
  93. package/assets/skill-commands/agentic-dev-upgrade/SKILL.md +23 -0
  94. package/assets/skill-commands/manifest.json +104 -0
  95. package/assets/skill-hooks.json +41 -0
  96. package/assets/skill-version.json +119 -0
  97. package/assets/templates/AGENTS.md +13 -0
  98. package/assets/templates/CLAUDE.md +13 -0
  99. package/assets/templates/architecture.template.md +80 -0
  100. package/assets/templates/brief.template.md +38 -0
  101. package/assets/templates/contract.template.md +75 -0
  102. package/assets/templates/decisions.template.md +85 -0
  103. package/assets/templates/factor-factory/factor-backtest-report.template.md +36 -0
  104. package/assets/templates/factor-factory/factor-hypothesis.template.md +30 -0
  105. package/assets/templates/factor-factory/factor-registry.template.json +5 -0
  106. package/assets/templates/gitignore.template +53 -0
  107. package/assets/templates/guides/metro-esm-gotchas.template.md +46 -0
  108. package/assets/templates/helpers/architecture-drift.sh +426 -0
  109. package/assets/templates/helpers/architecture-event.ts +449 -0
  110. package/assets/templates/helpers/archive-architecture-request.sh +212 -0
  111. package/assets/templates/helpers/archive-workflow.sh +196 -0
  112. package/assets/templates/helpers/capability-config.ts +394 -0
  113. package/assets/templates/helpers/capability-resolver.ts +473 -0
  114. package/assets/templates/helpers/capture-plan.sh +272 -0
  115. package/assets/templates/helpers/check-agent-tooling.sh +1335 -0
  116. package/assets/templates/helpers/check-brain-manifest.sh +243 -0
  117. package/assets/templates/helpers/check-context-files.sh +49 -0
  118. package/assets/templates/helpers/check-deploy-sql-order.sh +105 -0
  119. package/assets/templates/helpers/check-skill-version.ts +164 -0
  120. package/assets/templates/helpers/check-task-sync.sh +62 -0
  121. package/assets/templates/helpers/check-task-workflow.sh +444 -0
  122. package/assets/templates/helpers/codex-handoff-resume.sh +192 -0
  123. package/assets/templates/helpers/context-budget.ts +463 -0
  124. package/assets/templates/helpers/context-contract-sync.sh +490 -0
  125. package/assets/templates/helpers/contract-worktree.sh +398 -0
  126. package/assets/templates/helpers/ensure-task-workflow.sh +954 -0
  127. package/assets/templates/helpers/inspect-project-state.ts +266 -0
  128. package/assets/templates/helpers/maintenance-triage.sh +167 -0
  129. package/assets/templates/helpers/migrate-project-template.sh +57 -0
  130. package/assets/templates/helpers/migrate-workflow-docs.ts +333 -0
  131. package/assets/templates/helpers/new-plan.sh +169 -0
  132. package/assets/templates/helpers/new-spec.sh +44 -0
  133. package/assets/templates/helpers/new-sprint.sh +46 -0
  134. package/assets/templates/helpers/plan-to-todo.sh +618 -0
  135. package/assets/templates/helpers/prepare-codex-handoff.sh +139 -0
  136. package/assets/templates/helpers/prepare-handoff.sh +22 -0
  137. package/assets/templates/helpers/select-agent-context-blocks.sh +65 -0
  138. package/assets/templates/helpers/summarize-failures.sh +125 -0
  139. package/assets/templates/helpers/switch-plan.sh +147 -0
  140. package/assets/templates/helpers/sync-brain-docs.sh +288 -0
  141. package/assets/templates/helpers/verify-contract.sh +610 -0
  142. package/assets/templates/helpers/verify-sprint.sh +167 -0
  143. package/assets/templates/helpers/workflow-contract.ts +178 -0
  144. package/assets/templates/helpers/workstream-sync.sh +263 -0
  145. package/assets/templates/implementation-notes.template.md +37 -0
  146. package/assets/templates/packages.template.md +45 -0
  147. package/assets/templates/plan.template.md +77 -0
  148. package/assets/templates/research.template.md +25 -0
  149. package/assets/templates/review.template.md +54 -0
  150. package/assets/templates/spec.template.md +31 -0
  151. package/assets/templates/tech-stack.template.md +29 -0
  152. package/assets/versions.json +77 -0
  153. package/assets/workflow-contract.v1.json +444 -0
  154. package/docs/reference-configs/AGENTS.md +13 -0
  155. package/docs/reference-configs/CLAUDE.md +13 -0
  156. package/docs/reference-configs/agentic-development-flow.md +77 -0
  157. package/docs/reference-configs/ai-workflows.md +14 -0
  158. package/docs/reference-configs/changelog-versioning.md +13 -0
  159. package/docs/reference-configs/coding-standards.md +14 -0
  160. package/docs/reference-configs/development-protocol.md +20 -0
  161. package/docs/reference-configs/document-generation.md +34 -0
  162. package/docs/reference-configs/evaluator-rubric.md +19 -0
  163. package/docs/reference-configs/external-tooling.md +294 -0
  164. package/docs/reference-configs/git-strategy.md +14 -0
  165. package/docs/reference-configs/global-working-rules.md +48 -0
  166. package/docs/reference-configs/handoff-protocol.md +41 -0
  167. package/docs/reference-configs/harness-overview.md +66 -0
  168. package/docs/reference-configs/hook-operations.md +69 -0
  169. package/docs/reference-configs/release-deploy.md +14 -0
  170. package/docs/reference-configs/spa-day-protocol.md +14 -0
  171. package/docs/reference-configs/sprint-contracts.md +38 -0
  172. package/docs/reference-configs/workflow-orchestration.md +14 -0
  173. package/package.json +41 -7
  174. package/scripts/agentic-dev.sh +377 -0
  175. package/scripts/architecture-drift.sh +426 -0
  176. package/scripts/architecture-event.ts +449 -0
  177. package/scripts/archive-architecture-request.sh +212 -0
  178. package/scripts/archive-workflow.sh +196 -0
  179. package/scripts/assemble-template.ts +885 -0
  180. package/scripts/canary-global-hook.sh +263 -0
  181. package/scripts/capability-config.ts +394 -0
  182. package/scripts/capability-resolver.ts +473 -0
  183. package/scripts/capture-plan.sh +272 -0
  184. package/scripts/check-agent-tooling.sh +1335 -0
  185. package/scripts/check-brain-manifest.sh +243 -0
  186. package/scripts/check-context-files.sh +49 -0
  187. package/scripts/check-deploy-sql-order.sh +105 -0
  188. package/scripts/check-skill-version.ts +165 -0
  189. package/scripts/check-task-sync.sh +62 -0
  190. package/scripts/check-task-workflow.sh +444 -0
  191. package/scripts/check-versions.ts +488 -0
  192. package/scripts/codex-handoff-resume.sh +192 -0
  193. package/scripts/context-budget.ts +463 -0
  194. package/scripts/context-contract-sync.sh +490 -0
  195. package/scripts/contract-worktree.sh +398 -0
  196. package/scripts/create-project-dirs.sh +325 -0
  197. package/scripts/ensure-codegraph.sh +16 -0
  198. package/scripts/ensure-task-workflow.sh +954 -0
  199. package/scripts/factor-lab-check.sh +73 -0
  200. package/scripts/factor-lab-new.sh +96 -0
  201. package/scripts/factor-lab-promote.sh +86 -0
  202. package/scripts/factor-lab-reject.sh +68 -0
  203. package/scripts/hook-shim.sh +37 -0
  204. package/scripts/init-project.sh +525 -0
  205. package/scripts/initializer-question-pack.ts +144 -0
  206. package/scripts/inspect-project-state.ts +266 -0
  207. package/scripts/lib/AGENTS.md +13 -0
  208. package/scripts/lib/CLAUDE.md +13 -0
  209. package/scripts/lib/project-init-lib.sh +2035 -0
  210. package/scripts/maintenance-triage.sh +167 -0
  211. package/scripts/migrate-project-template.sh +964 -0
  212. package/scripts/migrate-workflow-docs.ts +333 -0
  213. package/scripts/new-plan.sh +169 -0
  214. package/scripts/new-spec.sh +44 -0
  215. package/scripts/new-sprint.sh +46 -0
  216. package/scripts/plan-to-todo.sh +618 -0
  217. package/scripts/prepare-codex-handoff.sh +139 -0
  218. package/scripts/prepare-handoff.sh +22 -0
  219. package/scripts/run-skill-evals.ts +971 -0
  220. package/scripts/run-skill-hook.ts +244 -0
  221. package/scripts/select-agent-context-blocks.sh +65 -0
  222. package/scripts/setup-plugins.sh +938 -0
  223. package/scripts/summarize-failures.sh +125 -0
  224. package/scripts/switch-plan.sh +147 -0
  225. package/scripts/sync-brain-docs.sh +288 -0
  226. package/scripts/sync-codex-installed-copies.sh +219 -0
  227. package/scripts/verify-contract.sh +610 -0
  228. package/scripts/verify-sprint.sh +167 -0
  229. package/scripts/workflow-contract.ts +178 -0
  230. package/scripts/workstream-sync.sh +263 -0
  231. package/src/cli/commands/doctor.ts +225 -0
  232. package/src/cli/commands/hook.ts +125 -0
  233. package/src/cli/commands/init.ts +306 -0
  234. package/src/cli/commands/install.ts +73 -0
  235. package/src/cli/commands/migrate.ts +154 -0
  236. package/src/cli/commands/status.ts +136 -0
  237. package/src/cli/commands/tools.ts +83 -0
  238. package/src/cli/hook/route-registry.ts +101 -0
  239. package/src/cli/index.ts +163 -0
  240. package/src/cli/installer/managed-entries.ts +76 -0
  241. package/src/cli/installer/shared.ts +65 -0
  242. package/src/cli/installer/targets/claude.ts +136 -0
  243. package/src/cli/installer/targets/codex.ts +138 -0
  244. package/src/cli/installer/targets/registry.ts +28 -0
  245. package/src/cli/installer/types.ts +72 -0
  246. package/src/cli/tools/codegraph.ts +192 -0
  247. package/index.js +0 -2
package/AGENTS.md ADDED
@@ -0,0 +1,89 @@
1
+ # agentic-dev AGENTS.md
2
+
3
+ This repository self-hosts the `agentic-dev` contract, formerly `agentic-dev-skill` and `project-initializer`. Claude and Codex should follow the same repo-local workflow surface.
4
+
5
+ ## Canonical Workflow Files
6
+
7
+ - `tasks/todo.md` for the current execution checklist and verification notes
8
+ - `.ai/context/capabilities.json` for the capability registry and longest-prefix context boundaries
9
+ - `tasks/workstreams/` for capability long-running workstreams that project the current slice into `tasks/todo.md`
10
+ - `tasks/lessons.md` for correction-derived rules
11
+ - `tasks/research.md` for deep repo knowledge
12
+ - `tasks/notes/` for task-local implementation decisions, deviations, tradeoffs, and open questions
13
+ - `plans/` for timestamped plans, with `plans/archive/` for history
14
+ - `.ai/harness/workflow-contract.json` for the installed workflow contract manifest
15
+ - `.ai/harness/policy.json` for the machine-readable workflow contract
16
+ - `.ai/context/context-map.json` for progressive context loading
17
+ - `docs/architecture/index.md` for umbrella architecture status, drift requests, snapshots, and diagram links
18
+ - `docs/reference-configs/agentic-development-flow.md` for gstack/Waza routing rules
19
+
20
+ ## Operating Rules
21
+
22
+ - Sync `tasks/` whenever substantive repo changes are made.
23
+ - Use `tasks/notes/<slug>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
24
+ - Treat `.ai/hooks/` as the shared hook implementation, `.claude/settings.json` as the Claude adapter, and `.codex/hooks.json` as the Codex adapter.
25
+ - Keep the umbrella hierarchy explicit: architecture owns stable truth, capability contracts own local agent context, `tasks/workstreams/<domain>/<capability>/` owns durable progress, and `tasks/todo.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
26
+ - 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.
27
+ - Keep architecture drift handling split: `architecture-drift.sh` writes architecture requests/events, `workstream-sync.sh` maintains durable capability workstreams, and `context-contract-sync.sh` only updates controlled local `CLAUDE.md`/`AGENTS.md` architecture blocks.
28
+ - Keep `assets/workflow-contract.v1.json` and `.ai/harness/workflow-contract.json` in sync.
29
+ - Keep `CLAUDE.md` and `AGENTS.md` short; put detailed guidance in `docs/reference-configs/`.
30
+ - Treat Codex auto-compact as a fallback only; use `.ai/harness/handoff/current.md` and `.ai/harness/handoff/resume.md` for long-task rollover.
31
+ - 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 `tasks/research.md`.
32
+ - 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.
33
+ - 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/*`.
34
+ - Treat contract-level task execution as worktree-first: `scripts/plan-to-todo.sh --plan <approved-plan>` starts `scripts/contract-worktree.sh start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `scripts/contract-worktree.sh finish`.
35
+ - After Codex Plan mode, Waza `/think`, or `agentic-dev-plan` produces a decision-complete plan, capture it with `scripts/capture-plan.sh --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` or run `scripts/plan-to-todo.sh --plan <active-plan>`.
36
+ - 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.
37
+ - 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`.
38
+ - Codex automation profile is runtime-referenced, not vendored: required skills are `health`, `check`, and `diagram-design` from `~/.codex/skills`.
39
+ - Route knowledge sync and handoff retrieval to `gbrain`.
40
+ - 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.
41
+ - 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`.
42
+ - 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.
43
+ - When changing `scripts/migrate-project-template.sh` or `scripts/lib/project-init-lib.sh`, verify self-migration of this repo still works.
44
+ - Treat `.codex/hooks.json` as a product hook adapter; do not treat generated backup files or other `.codex/*` runtime residue as product deliverables.
45
+
46
+ ## Required Checks
47
+
48
+ ```bash
49
+ bun test
50
+ bash scripts/check-deploy-sql-order.sh
51
+ bash scripts/check-task-sync.sh
52
+ bash scripts/check-task-workflow.sh --strict
53
+ bun scripts/inspect-project-state.ts --repo . --format text
54
+ bash scripts/migrate-project-template.sh --repo . --dry-run
55
+ ```
56
+
57
+ <!-- BEGIN ARCHITECTURE CONTRACT -->
58
+ ## Architecture Contract
59
+
60
+ - Functional block: `assets/hooks`
61
+ - Capability ID: `runtime-harness-hook-adapters`
62
+ - Matched prefix: `assets/hooks`
63
+ - Architecture domain: `runtime-harness`
64
+ - Architecture capability: `hook-adapters`
65
+ - Architecture module: `docs/architecture/modules/runtime-harness/hook-adapters.md`
66
+ - Last architecture event: 2026-05-28T15:48:16+0800
67
+ - Last changed path: `assets/hooks/hook-input.sh`
68
+ - Severity: high
69
+ - Change type: workflow-surface
70
+ - Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
71
+ - Entrypoints: `assets/hooks`
72
+ - Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
73
+ - Forbidden dependencies: Do not cross sibling app/service/package boundaries without an architecture snapshot or explicit plan.
74
+ - Runtime path: `assets/hooks`
75
+ - LSP/tooling profile: `typescript-lsp`
76
+ - Verification: Use root required checks plus local commands recorded in this capability contract.
77
+ - Latest snapshot: `(none yet)`
78
+ - Latest diagram: `(none yet)`
79
+ - Pending architecture request: `docs/architecture/requests/20260528-154816-assets-hooks-assets-hooks-hook-input-sh.md`
80
+
81
+ ## Active Workstreams
82
+
83
+ - (none yet)
84
+
85
+ ## Current Session Projection
86
+
87
+ - Durable progress lives under `tasks/workstreams/runtime-harness/hook-adapters`.
88
+ - `tasks/todo.md` is the deferred-goal ledger; current execution slices stay in the active plan's `## Task Breakdown`.
89
+ <!-- END ARCHITECTURE CONTRACT -->
package/CLAUDE.md ADDED
@@ -0,0 +1,89 @@
1
+ # agentic-dev AGENTS.md
2
+
3
+ This repository self-hosts the `agentic-dev` contract, formerly `agentic-dev-skill` and `project-initializer`. Claude and Codex should follow the same repo-local workflow surface.
4
+
5
+ ## Canonical Workflow Files
6
+
7
+ - `tasks/todo.md` for the current execution checklist and verification notes
8
+ - `.ai/context/capabilities.json` for the capability registry and longest-prefix context boundaries
9
+ - `tasks/workstreams/` for capability long-running workstreams that project the current slice into `tasks/todo.md`
10
+ - `tasks/lessons.md` for correction-derived rules
11
+ - `tasks/research.md` for deep repo knowledge
12
+ - `tasks/notes/` for task-local implementation decisions, deviations, tradeoffs, and open questions
13
+ - `plans/` for timestamped plans, with `plans/archive/` for history
14
+ - `.ai/harness/workflow-contract.json` for the installed workflow contract manifest
15
+ - `.ai/harness/policy.json` for the machine-readable workflow contract
16
+ - `.ai/context/context-map.json` for progressive context loading
17
+ - `docs/architecture/index.md` for umbrella architecture status, drift requests, snapshots, and diagram links
18
+ - `docs/reference-configs/agentic-development-flow.md` for gstack/Waza routing rules
19
+
20
+ ## Operating Rules
21
+
22
+ - Sync `tasks/` whenever substantive repo changes are made.
23
+ - Use `tasks/notes/<slug>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
24
+ - Treat `.ai/hooks/` as the shared hook implementation, `.claude/settings.json` as the Claude adapter, and `.codex/hooks.json` as the Codex adapter.
25
+ - Keep the umbrella hierarchy explicit: architecture owns stable truth, capability contracts own local agent context, `tasks/workstreams/<domain>/<capability>/` owns durable progress, and `tasks/todo.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
26
+ - 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.
27
+ - Keep architecture drift handling split: `architecture-drift.sh` writes architecture requests/events, `workstream-sync.sh` maintains durable capability workstreams, and `context-contract-sync.sh` only updates controlled local `CLAUDE.md`/`AGENTS.md` architecture blocks.
28
+ - Keep `assets/workflow-contract.v1.json` and `.ai/harness/workflow-contract.json` in sync.
29
+ - Keep `CLAUDE.md` and `AGENTS.md` short; put detailed guidance in `docs/reference-configs/`.
30
+ - Treat Codex auto-compact as a fallback only; use `.ai/harness/handoff/current.md` and `.ai/harness/handoff/resume.md` for long-task rollover.
31
+ - 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 `tasks/research.md`.
32
+ - 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.
33
+ - 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/*`.
34
+ - Treat contract-level task execution as worktree-first: `scripts/plan-to-todo.sh --plan <approved-plan>` starts `scripts/contract-worktree.sh start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `scripts/contract-worktree.sh finish`.
35
+ - After Codex Plan mode, Waza `/think`, or `agentic-dev-plan` produces a decision-complete plan, capture it with `scripts/capture-plan.sh --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` or run `scripts/plan-to-todo.sh --plan <active-plan>`.
36
+ - 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.
37
+ - 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`.
38
+ - Codex automation profile is runtime-referenced, not vendored: required skills are `health`, `check`, and `diagram-design` from `~/.codex/skills`.
39
+ - Route knowledge sync and handoff retrieval to `gbrain`.
40
+ - 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.
41
+ - 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`.
42
+ - 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.
43
+ - When changing `scripts/migrate-project-template.sh` or `scripts/lib/project-init-lib.sh`, verify self-migration of this repo still works.
44
+ - Treat `.codex/hooks.json` as a product hook adapter; do not treat generated backup files or other `.codex/*` runtime residue as product deliverables.
45
+
46
+ ## Required Checks
47
+
48
+ ```bash
49
+ bun test
50
+ bash scripts/check-deploy-sql-order.sh
51
+ bash scripts/check-task-sync.sh
52
+ bash scripts/check-task-workflow.sh --strict
53
+ bun scripts/inspect-project-state.ts --repo . --format text
54
+ bash scripts/migrate-project-template.sh --repo . --dry-run
55
+ ```
56
+
57
+ <!-- BEGIN ARCHITECTURE CONTRACT -->
58
+ ## Architecture Contract
59
+
60
+ - Functional block: `assets/hooks`
61
+ - Capability ID: `runtime-harness-hook-adapters`
62
+ - Matched prefix: `assets/hooks`
63
+ - Architecture domain: `runtime-harness`
64
+ - Architecture capability: `hook-adapters`
65
+ - Architecture module: `docs/architecture/modules/runtime-harness/hook-adapters.md`
66
+ - Last architecture event: 2026-05-28T15:48:16+0800
67
+ - Last changed path: `assets/hooks/hook-input.sh`
68
+ - Severity: high
69
+ - Change type: workflow-surface
70
+ - Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
71
+ - Entrypoints: `assets/hooks`
72
+ - Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
73
+ - Forbidden dependencies: Do not cross sibling app/service/package boundaries without an architecture snapshot or explicit plan.
74
+ - Runtime path: `assets/hooks`
75
+ - LSP/tooling profile: `typescript-lsp`
76
+ - Verification: Use root required checks plus local commands recorded in this capability contract.
77
+ - Latest snapshot: `(none yet)`
78
+ - Latest diagram: `(none yet)`
79
+ - Pending architecture request: `docs/architecture/requests/20260528-154816-assets-hooks-assets-hooks-hook-input-sh.md`
80
+
81
+ ## Active Workstreams
82
+
83
+ - (none yet)
84
+
85
+ ## Current Session Projection
86
+
87
+ - Durable progress lives under `tasks/workstreams/runtime-harness/hook-adapters`.
88
+ - `tasks/todo.md` is the deferred-goal ledger; current execution slices stay in the active plan's `## Task Breakdown`.
89
+ <!-- END ARCHITECTURE CONTRACT -->
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AncientTwo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,297 @@
1
1
  # repo-harness
2
2
 
3
- Reserved package name for the repo-local agentic development harness CLI.
3
+ Repo-local agentic development harness CLI and skill runtime for Claude/Codex
4
+ workflows. Formerly `agentic-dev-skill` and `project-initializer`;
5
+ `agentic-dev-skill` remains a compatibility alias, while `project-initializer`
6
+ install paths are retired and removed by installed-copy sync.
7
+ Repository: `https://github.com/Ancienttwo/repo-harness`
8
+
9
+ This repository now dogfoods its own tasks-first contract. It is both:
10
+
11
+ - the source repo for the `repo-harness` CLI and `agentic-dev` skill runtime
12
+ - a self-hosted example of the repo-local workflow it generates for other projects
13
+
14
+ ## First 5 Minutes
15
+
16
+ This is the fastest path for an AI tooling owner evaluating whether the workflow is
17
+ safe to adopt in a real repo.
18
+
19
+ ### Install or refresh the local runtime
20
+
21
+ ```bash
22
+ npx -y repo-harness init
23
+ ```
24
+
25
+ The npm package name and primary installed command are `repo-harness`.
26
+ `agentic-dev` remains a compatibility command alias. When working from a source
27
+ checkout instead of npm, run:
28
+
29
+ ```bash
30
+ git clone https://github.com/Ancienttwo/repo-harness.git ~/Projects/repo-harness
31
+ cd ~/Projects/repo-harness
32
+ bun src/cli/index.ts init
33
+ ```
34
+
35
+ Local path model:
36
+
37
+ - Source repo: `~/Projects/repo-harness`
38
+ - Claude skill aliases: `~/.claude/skills/agentic-dev`, `~/.claude/skills/agentic-dev-skill`
39
+ - Codex discoverable skill alias: `~/.codex/skills/agentic-dev`
40
+ - Codex compatibility fallback alias: `~/.codex/skills/agentic-dev-skill`
41
+
42
+ The `~/Projects/repo-harness` repo is the only editable source of truth. Local
43
+ Claude/Codex paths are symlink-backed runtime entrypoints. Only
44
+ `~/.codex/skills/agentic-dev` should expose `SKILL.md` and
45
+ `assets/skill-commands/`; compatibility directories exist only so renamed
46
+ repos can still resolve upstream assets without duplicate command discovery.
47
+ The retired `project-initializer` directories under `~/.codex/skills` and
48
+ `~/.claude/skills` are deleted by `scripts/sync-codex-installed-copies.sh`.
49
+
50
+ ### Minimum prerequisites
51
+
52
+ - Git working tree
53
+ - `bash`
54
+ - `bun` for follow-up verification and template assembly
55
+ - `jq` is optional for `--dry-run`, but recommended when applying settings merges
56
+
57
+ ### Start here
58
+
59
+ For an existing repo, run from the repo root:
60
+
61
+ ```bash
62
+ npx -y repo-harness init --dry-run
63
+ ```
64
+
65
+ Apply only after the dry-run report looks correct:
66
+
67
+ ```bash
68
+ npx -y repo-harness init
69
+ ```
70
+
71
+ For a new project or module, use the `agentic-dev-scaffold` command skill. For
72
+ an existing repo, use `agentic-dev-init`; it installs or refreshes the harness
73
+ without creating an application stack.
74
+
75
+ ### Success looks like this
76
+
77
+ The command should end with `=== Migration Report ===` and summarize:
78
+
79
+ - `Project hooks synced from:` to show where generated hook behavior comes from
80
+ - `Claude hook config target: .claude/settings.json` to show the Claude adapter entry
81
+ - `Codex hook config target: .codex/hooks.json` to show the Codex adapter entry
82
+ - `Codex hook trust required:` to remind the user to trust the repo hook in Codex Settings
83
+ - `Workflow migration:` to show the repo-local harness surfaces it will create or refresh
84
+ - `Helper scripts:` to show the operational toolchain you get after apply
85
+ - `--- External Tooling ---` to show default gstack/Waza/gbrain routing plus advisory install/update hints
86
+
87
+ ### Next two commands
88
+
89
+ ```bash
90
+ bash scripts/check-task-workflow.sh --strict
91
+ bun test
92
+ ```
93
+
94
+ If the dry-run output looks wrong, stop there and inspect
95
+ [`docs/reference-configs/hook-operations.md`](docs/reference-configs/hook-operations.md)
96
+ before applying anything.
97
+
98
+ ## Hook Authority Map
99
+
100
+ - `.ai/hooks/` is the only shared hook implementation you should edit first.
101
+ - `.claude/settings.json` is the Claude adapter that dispatches into `.ai/hooks/run-hook.sh`.
102
+ - `.codex/hooks.json` is the Codex adapter that dispatches into the same runner.
103
+ - Codex must mark this repo hook as trusted in Codex Settings before those hooks run.
104
+ - Debug in this order: adapter config -> `run-hook.sh` -> `.ai/hooks/*`.
105
+
106
+ ## Hook Failure Playbook
107
+
108
+ When a hook blocks work, start with the structured output in the terminal. The core
109
+ fields are `guard`, `reason`, `fix`, `failure_class`, and `run_id`.
110
+
111
+ - Failure log: `.ai/harness/failures/latest.jsonl`
112
+ - Trace log: `.claude/.trace.jsonl`
113
+ - Deep guide: [`docs/reference-configs/hook-operations.md`](docs/reference-configs/hook-operations.md)
114
+
115
+ Most common guards:
116
+
117
+ - `PlanStatusGuard`: no active plan, or the plan is not ready to execute
118
+ - `ContractGuard`: approved execution has not yet produced the contract/review/notes scaffold
119
+ - `ContractGuard`: completion was claimed before the task contract passed
120
+ - `WorktreeGuard`: writes were attempted in the primary worktree while linked worktrees are enforced
121
+
122
+ ## Repo Workflow
123
+
124
+ - Root routing docs: `CLAUDE.md`, `AGENTS.md`
125
+ - Shared hook layer: `.ai/hooks/`
126
+ - Claude adapter layer: `.claude/settings.json`
127
+ - Codex adapter layer: `.codex/hooks.json`
128
+ - Active execution surface: `tasks/`
129
+ - Plan source of truth: `plans/`
130
+ - Durable progress: `tasks/workstreams/`
131
+ - Release history: `docs/CHANGELOG.md`
132
+
133
+ ## Current Model (5.2.3)
134
+
135
+ - Question flow uses **12 grouped decision points** with harness defaults inferred first.
136
+ - Plan menu is tiered:
137
+ - **Core Plans (A-F)** first.
138
+ - **Custom Presets (G-K)** only when needed.
139
+ - Skill routing is inspection-first:
140
+ - `scripts/inspect-project-state.ts`
141
+ - `scripts/migrate-workflow-docs.ts`
142
+ - `assets/workflow-contract.v1.json`
143
+ - Runtime mode is configurable with template vars:
144
+ - `{{RUNTIME_MODE}}`
145
+ - `{{RUNTIME_PROFILE}}`
146
+ - `{{RECOVERY_PROFILE}}`
147
+ - `{{STATE_PROFILE}}`
148
+ - Question-pack source of truth is in:
149
+ - `assets/initializer-question-pack.v4.json`
150
+ - Generated repos default to the repo-local harness flow:
151
+ - `docs/spec.md -> plans/ -> tasks/contracts/ -> tasks/reviews/ -> .ai/context/context-map.json -> .ai/harness/*`
152
+ - Generated and self-hosted repos install:
153
+ - `.ai/harness/workflow-contract.json`
154
+ - `.ai/harness/policy.json`
155
+ - Generated and migrated repos default `external_tooling` to:
156
+ - `complex -> gstack`
157
+ - `simple -> Waza` with Codex-first runtime copies in `~/.codex/skills`
158
+ - `knowledge -> gbrain`
159
+ - `agentic-dev init` bootstraps the Codex/Claude runtime pieces needed for the
160
+ default workflow:
161
+ - refreshes `agentic-dev` skill aliases
162
+ - installs global Codex/Claude hook adapters
163
+ - installs Waza skills (`check`, `design`, `health`, `hunt`, `learn`, `read`, `think`, `write`) through the skills CLI
164
+ - syncs `diagram-design` into Codex/Claude skill roots when a source copy exists
165
+ - Other external tooling stays advisory-only:
166
+ - `bash scripts/check-agent-tooling.sh --host both --check-updates`
167
+ - Waza update checks compare upstream `tw93/Waza` `SKILL.md` hashes without running `npx skills check`
168
+ - no automatic gstack, gbrain, CodeGraph MCP, daemon, or provider setup
169
+ - Manual distillation stays repo-local:
170
+ - repeated corrections -> `tasks/lessons.md`
171
+ - deep findings and hidden contracts -> `tasks/research.md`
172
+ - sprint verification evidence -> `tasks/reviews/*.review.md`
173
+ - durable capability progress -> `tasks/workstreams/`
174
+ - release history -> `docs/CHANGELOG.md`
175
+
176
+ ## Action Command Skills
177
+
178
+ Source-owned command skill facades live in `assets/skill-commands/`. They keep
179
+ the public surface action-style while sharing the same router, contract, scripts,
180
+ and tests:
181
+
182
+ - Planning and review: `agentic-dev-plan`, `agentic-dev-review`, `agentic-dev-autoplan`
183
+ - Repo workflow actions: `agentic-dev-init`, `agentic-dev-migrate`, `agentic-dev-upgrade`, `agentic-dev-capability`, `agentic-dev-architecture`, `agentic-dev-handoff`, `agentic-dev-deploy`, `agentic-dev-repair`, `agentic-dev-check`
184
+ - Project creation: `agentic-dev-scaffold`
185
+
186
+ `agentic-dev-init` is for an existing repo; `agentic-dev-scaffold` creates a new
187
+ project or module scaffold. `hooks-init`, `docs-init`, and `create-project-dirs`
188
+ are internal steps, not public commands.
189
+
190
+ Use `agentic-dev-capability` when the harness already exists and only selected
191
+ capability boundaries should be added. It updates `.ai/context/capabilities.json`,
192
+ syncs the requested local `AGENTS.md` / `CLAUDE.md` contract files, and validates
193
+ the registry without running a full init, migrate, or upgrade pass.
194
+
195
+ Use `agentic-dev-architecture`, `agentic-dev-handoff`, and `agentic-dev-deploy`
196
+ for focused architecture documentation, rollover, and deploy/ops readiness
197
+ passes. These commands call existing repo-local helpers and keep their scope
198
+ narrow instead of refreshing the full harness.
199
+
200
+ Codex installed-copy rule: only `~/.codex/skills/agentic-dev` exposes the root
201
+ skill and `agentic-dev-*` command facades. The compatibility directory
202
+ `~/.codex/skills/agentic-dev-skill` is a runtime fallback bundle only; it must
203
+ not contain `SKILL.md` files or `assets/skill-commands/`. The retired
204
+ `~/.codex/skills/project-initializer` and `~/.claude/skills/project-initializer`
205
+ directories are removed during sync.
206
+
207
+ After cloning or moving this source repo, rebuild the local runtime aliases with:
208
+
209
+ ```bash
210
+ bash scripts/sync-codex-installed-copies.sh
211
+ ```
212
+
213
+ By default, the script keeps local Claude/Codex runtime paths linked back to the
214
+ source repo. Set `AGENTIC_DEV_LINK_INSTALLED_COPIES=0` for copy-based staging,
215
+ and set `CODEX_SKILLS_ROOT` or `CLAUDE_SKILLS_ROOT` to stage under alternate
216
+ runtime roots.
217
+
218
+ ## Maintainer Reference
219
+
220
+ ### Self-check this repository's workflow contract
221
+
222
+ ```bash
223
+ bash scripts/check-task-sync.sh
224
+ bash scripts/check-task-workflow.sh --strict
225
+ bun scripts/inspect-project-state.ts --repo . --format text
226
+ bash scripts/migrate-project-template.sh --repo . --dry-run
227
+ ```
228
+
229
+ ### Explicit template assembly
230
+
231
+ ```bash
232
+ bun scripts/assemble-template.ts --plan C --name "MyProject"
233
+ bun scripts/assemble-template.ts --target agents --plan C --name "MyProject"
234
+ ```
235
+
236
+ ### Local benchmark skeleton
237
+
238
+ ```bash
239
+ bun run benchmark:skills --dry-run
240
+ ```
241
+
242
+ ### Run one eval across both Claude and Codex
243
+
244
+ ```bash
245
+ bun run benchmark:skills --eval repair-agents-task-sync
246
+ ```
247
+
248
+ ## Key Files
249
+
250
+ - Skill spec: `SKILL.md`
251
+ - Root routing docs: `CLAUDE.md`, `AGENTS.md`
252
+ - Plan mapping: `assets/plan-map.json`
253
+ - Question-pack: `assets/initializer-question-pack.v4.json`
254
+ - Shared hooks: `assets/hooks/`
255
+ - Workflow contract: `assets/workflow-contract.v1.json`
256
+ - Hook operations reference: `docs/reference-configs/hook-operations.md`
257
+ - Template assembler: `scripts/assemble-template.ts`
258
+ - Question inference helper: `scripts/initializer-question-pack.ts`
259
+ - State inspector: `scripts/inspect-project-state.ts`
260
+ - Legacy-doc migrator: `scripts/migrate-workflow-docs.ts`
261
+ - External tooling detector: `scripts/check-agent-tooling.sh`
262
+ - Scaffolding scripts:
263
+ - `scripts/init-project.sh`
264
+ - `scripts/create-project-dirs.sh`
265
+
266
+ ## Generated vs Self-Hosted Hook Parity
267
+
268
+ - Downstream hook behavior is defined by generated output from `assets/hooks/` plus
269
+ `assets/reference-configs/`.
270
+ - This repo dogfoods the same contract, but self-host behavior is not magically in
271
+ sync with generated repos unless a change explicitly updates both surfaces.
272
+ - Every hook change should say whether it affects `self-host`, `generated`, or `both`.
273
+
274
+ ## Package Manager Defaults
275
+
276
+ - General default priority: `bun > pnpm > npm`
277
+ - **Plan G/H** (Python-centric) default to **`uv`** as primary package manager.
278
+
279
+ ## Runtime Profiles
280
+
281
+ - `Plan-only (recommended)` (default)
282
+ - `Plan + Permissionless`
283
+ - `Standard (ask before each action)`
284
+
285
+ Configured in `assets/initializer-question-pack.v4.json` and consumed by `scripts/initializer-question-pack.ts`.
286
+
287
+ ## Verification
288
+
289
+ ```bash
290
+ bun test
291
+ bash scripts/check-task-sync.sh
292
+ bash scripts/check-task-workflow.sh --strict
293
+ bun scripts/inspect-project-state.ts --repo . --format text
294
+ bash scripts/migrate-project-template.sh --repo . --dry-run
295
+ bash scripts/check-agent-tooling.sh --host both --check-updates
296
+ bun run benchmark:skills --dry-run
297
+ ```