nitm-ai-dev-toolkit 5.0.0 → 5.1.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 (224) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +30 -10
  3. package/bin/cli.js +635 -88
  4. package/package.json +1 -1
  5. package/src/monorepo/.agents/skills/factory/SKILL.md +123 -57
  6. package/src/monorepo/{.claude/agents-snippets/factory-approver.md → .agents/skills/factory/roles/approve.md} +3 -3
  7. package/src/monorepo/{.claude/agents-snippets/factory-builder.md → .agents/skills/factory/roles/build.md} +3 -3
  8. package/src/monorepo/{.claude/agents-snippets/factory-reviewer-code.md → .agents/skills/factory/roles/review-code.md} +5 -5
  9. package/src/{repo/.claude/agents-snippets/factory-reviewer-security.md → monorepo/.agents/skills/factory/roles/review-security.md} +4 -4
  10. package/src/monorepo/{.claude/agents-snippets/factory-reviewer-ui.md → .agents/skills/factory/roles/review-ui.md} +6 -6
  11. package/src/monorepo/{.claude/agents-snippets/factory-reviewer-ux.md → .agents/skills/factory/roles/review-ux.md} +6 -6
  12. package/src/monorepo/{.claude/agents-snippets/factory-spec-writer.md → .agents/skills/factory/roles/spec.md} +2 -2
  13. package/src/monorepo/.claude/agents/implementer.agent.md +1 -1
  14. package/src/monorepo/.claude/agents/planner.agent.md +1 -1
  15. package/src/monorepo/.claude/agents/reviewer.agent.md +1 -1
  16. package/src/monorepo/.claude/commands/assign-tasks.md +1 -0
  17. package/src/monorepo/.claude/commands/factory.md +9 -9
  18. package/src/monorepo/.claude/commands/ponytail-review.md +1 -1
  19. package/src/monorepo/.claude/prompt-snippets/assign-tasks.md +13 -3
  20. package/src/monorepo/.claude/prompt-snippets/bootstrap-patch.md +32 -25
  21. package/src/monorepo/.claude/prompt-snippets/bootstrap-upgrade.md +13 -14
  22. package/src/monorepo/.claude/prompt-snippets/bootstrap.md +12 -12
  23. package/src/monorepo/.claude/prompt-snippets/factory.md +5 -5
  24. package/src/monorepo/.claude/prompt-snippets/implement-feature.md +3 -1
  25. package/src/monorepo/.claude/rules-snippets/subagent-workflow.md +2 -2
  26. package/src/monorepo/.cursor/commands/factory.md +9 -9
  27. package/src/monorepo/.github/prompts/factory.prompt.md +9 -9
  28. package/src/monorepo/.opencode/agents/admin-portal.md +1 -4
  29. package/src/monorepo/.opencode/agents/api-specialist.md +1 -4
  30. package/src/monorepo/.opencode/agents/backend-architect.md +1 -4
  31. package/src/monorepo/.opencode/agents/documenter.md +1 -4
  32. package/src/monorepo/.opencode/agents/feature-builder.md +1 -4
  33. package/src/monorepo/.opencode/agents/frontend-developer.md +1 -4
  34. package/src/monorepo/.opencode/agents/green.md +1 -4
  35. package/src/monorepo/.opencode/agents/implementer.md +1 -4
  36. package/src/monorepo/.opencode/agents/planner.md +1 -4
  37. package/src/monorepo/.opencode/agents/red.md +1 -4
  38. package/src/monorepo/.opencode/agents/refactor.md +1 -4
  39. package/src/monorepo/.opencode/agents/researcher.md +1 -4
  40. package/src/monorepo/.opencode/agents/reviewer.md +1 -4
  41. package/src/monorepo/.opencode/agents/tdd.md +1 -4
  42. package/src/monorepo/.opencode/commands/assign-tasks.md +1 -1
  43. package/src/monorepo/.opencode/commands/bootstrap-patch.md +1 -1
  44. package/src/monorepo/.opencode/commands/bootstrap-upgrade.md +1 -1
  45. package/src/monorepo/.opencode/commands/bootstrap.md +1 -1
  46. package/src/monorepo/.opencode/commands/commit-push.md +1 -1
  47. package/src/monorepo/.opencode/commands/constitution.md +1 -1
  48. package/src/monorepo/.opencode/commands/create-skill.md +1 -1
  49. package/src/monorepo/.opencode/commands/factory.md +9 -9
  50. package/src/monorepo/.opencode/commands/implement-feature.md +1 -1
  51. package/src/monorepo/.opencode/commands/implement-fixes.md +1 -1
  52. package/src/monorepo/.opencode/commands/implement.md +1 -1
  53. package/src/monorepo/.opencode/commands/plan.md +1 -1
  54. package/src/monorepo/.opencode/commands/playwright-test.md +1 -1
  55. package/src/monorepo/.opencode/commands/ponytail-audit.md +1 -1
  56. package/src/monorepo/.opencode/commands/ponytail-debt.md +1 -1
  57. package/src/monorepo/.opencode/commands/ponytail-gain.md +1 -1
  58. package/src/monorepo/.opencode/commands/ponytail-help.md +1 -1
  59. package/src/monorepo/.opencode/commands/ponytail-review.md +1 -1
  60. package/src/monorepo/.opencode/commands/ponytail.md +1 -1
  61. package/src/monorepo/.opencode/commands/release-notes.md +1 -1
  62. package/src/monorepo/.opencode/commands/review-pr.md +1 -1
  63. package/src/monorepo/.opencode/commands/review.md +1 -1
  64. package/src/monorepo/.opencode/commands/specify.md +1 -1
  65. package/src/monorepo/.opencode/commands/tasks.md +1 -1
  66. package/src/monorepo/.opencode/opencode.jsonc +1 -2
  67. package/src/monorepo/.opencode/rules/agent-conduct.md +1 -1
  68. package/src/monorepo/.opencode/rules/api-server.md +1 -1
  69. package/src/monorepo/.opencode/rules/coding-standards.md +1 -1
  70. package/src/monorepo/.opencode/rules/component-structure.md +1 -1
  71. package/src/monorepo/.opencode/rules/core-libraries.md +1 -1
  72. package/src/monorepo/.opencode/rules/environment-tooling.md +1 -1
  73. package/src/monorepo/.opencode/rules/logging-comments.md +1 -1
  74. package/src/monorepo/.opencode/rules/logging.md +1 -1
  75. package/src/monorepo/.opencode/rules/prisma-migrations.md +1 -1
  76. package/src/monorepo/.opencode/rules/project-context.md +1 -1
  77. package/src/monorepo/.opencode/rules/server-client-separation.md +1 -1
  78. package/src/monorepo/.opencode/rules/subagent-workflow.md +1 -1
  79. package/src/monorepo/.opencode/rules/testing-quality.md +1 -1
  80. package/src/monorepo/.opencode/rules/ui-accessibility.md +1 -1
  81. package/src/monorepo/.opencode/rules/version-control.md +1 -1
  82. package/src/monorepo/.opencode/rules/what-to-avoid.md +1 -1
  83. package/src/monorepo/AGENTS.md +4 -4
  84. package/src/monorepo/README.md +5 -5
  85. package/src/monorepo/factory/README.md +51 -24
  86. package/src/monorepo/factory/worktree-bootstrap.md +32 -0
  87. package/src/repo/.agents/skills/factory/SKILL.md +122 -56
  88. package/src/repo/{.claude/agents-snippets/factory-approver.md → .agents/skills/factory/roles/approve.md} +3 -3
  89. package/src/repo/{.claude/agents-snippets/factory-builder.md → .agents/skills/factory/roles/build.md} +3 -3
  90. package/src/repo/{.claude/agents-snippets/factory-reviewer-code.md → .agents/skills/factory/roles/review-code.md} +5 -5
  91. package/src/{monorepo/.claude/agents-snippets/factory-reviewer-security.md → repo/.agents/skills/factory/roles/review-security.md} +4 -4
  92. package/src/repo/{.claude/agents-snippets/factory-reviewer-ui.md → .agents/skills/factory/roles/review-ui.md} +6 -6
  93. package/src/repo/{.claude/agents-snippets/factory-reviewer-ux.md → .agents/skills/factory/roles/review-ux.md} +6 -6
  94. package/src/repo/{.claude/agents-snippets/factory-spec-writer.md → .agents/skills/factory/roles/spec.md} +2 -2
  95. package/src/repo/.claude/agents/implementer.agent.md +1 -1
  96. package/src/repo/.claude/agents/planner.agent.md +1 -1
  97. package/src/repo/.claude/agents/reviewer.agent.md +1 -1
  98. package/src/repo/.claude/commands/assign-tasks.md +1 -0
  99. package/src/repo/.claude/commands/factory.md +9 -9
  100. package/src/repo/.claude/commands/ponytail-review.md +1 -1
  101. package/src/repo/.claude/prompt-snippets/assign-tasks.md +13 -3
  102. package/src/repo/.claude/prompt-snippets/bootstrap-patch.md +32 -25
  103. package/src/repo/.claude/prompt-snippets/bootstrap-upgrade.md +17 -17
  104. package/src/repo/.claude/prompt-snippets/bootstrap.md +12 -12
  105. package/src/repo/.claude/prompt-snippets/factory.md +5 -5
  106. package/src/repo/.claude/prompt-snippets/implement-feature.md +3 -1
  107. package/src/repo/.claude/rules-snippets/subagent-workflow.md +2 -2
  108. package/src/repo/.cursor/commands/factory.md +9 -9
  109. package/src/repo/.github/prompts/factory.prompt.md +9 -9
  110. package/src/repo/.opencode/agents/admin-portal.md +1 -4
  111. package/src/repo/.opencode/agents/api-specialist.md +1 -4
  112. package/src/repo/.opencode/agents/backend-architect.md +1 -4
  113. package/src/repo/.opencode/agents/documenter.md +1 -4
  114. package/src/repo/.opencode/agents/feature-builder.md +1 -4
  115. package/src/repo/.opencode/agents/frontend-developer.md +1 -4
  116. package/src/repo/.opencode/agents/green.md +1 -4
  117. package/src/repo/.opencode/agents/implementer.md +1 -4
  118. package/src/repo/.opencode/agents/planner.md +1 -4
  119. package/src/repo/.opencode/agents/red.md +1 -4
  120. package/src/repo/.opencode/agents/refactor.md +1 -4
  121. package/src/repo/.opencode/agents/researcher.md +1 -4
  122. package/src/repo/.opencode/agents/reviewer.md +1 -4
  123. package/src/repo/.opencode/agents/tdd.md +1 -4
  124. package/src/repo/.opencode/commands/assign-tasks.md +1 -1
  125. package/src/repo/.opencode/commands/bootstrap-patch.md +1 -1
  126. package/src/repo/.opencode/commands/bootstrap-upgrade.md +1 -1
  127. package/src/repo/.opencode/commands/bootstrap.md +1 -1
  128. package/src/repo/.opencode/commands/commit-push.md +1 -1
  129. package/src/repo/.opencode/commands/constitution.md +1 -1
  130. package/src/repo/.opencode/commands/create-skill.md +1 -1
  131. package/src/repo/.opencode/commands/factory.md +9 -9
  132. package/src/repo/.opencode/commands/implement-feature.md +1 -1
  133. package/src/repo/.opencode/commands/implement-fixes.md +1 -1
  134. package/src/repo/.opencode/commands/implement.md +1 -1
  135. package/src/repo/.opencode/commands/plan.md +1 -1
  136. package/src/repo/.opencode/commands/playwright-test.md +1 -1
  137. package/src/repo/.opencode/commands/ponytail-audit.md +1 -1
  138. package/src/repo/.opencode/commands/ponytail-debt.md +1 -1
  139. package/src/repo/.opencode/commands/ponytail-gain.md +1 -1
  140. package/src/repo/.opencode/commands/ponytail-help.md +1 -1
  141. package/src/repo/.opencode/commands/ponytail-review.md +1 -1
  142. package/src/repo/.opencode/commands/ponytail.md +1 -1
  143. package/src/repo/.opencode/commands/release-notes.md +1 -1
  144. package/src/repo/.opencode/commands/review-pr.md +1 -1
  145. package/src/repo/.opencode/commands/review.md +1 -1
  146. package/src/repo/.opencode/commands/specify.md +1 -1
  147. package/src/repo/.opencode/commands/tasks.md +1 -1
  148. package/src/repo/.opencode/opencode.jsonc +1 -2
  149. package/src/repo/.opencode/rules/agent-conduct.md +1 -1
  150. package/src/repo/.opencode/rules/api-server.md +1 -1
  151. package/src/repo/.opencode/rules/coding-standards.md +1 -1
  152. package/src/repo/.opencode/rules/component-structure.md +1 -1
  153. package/src/repo/.opencode/rules/core-libraries.md +1 -1
  154. package/src/repo/.opencode/rules/environment-tooling.md +1 -1
  155. package/src/repo/.opencode/rules/logging-comments.md +1 -1
  156. package/src/repo/.opencode/rules/logging.md +1 -1
  157. package/src/repo/.opencode/rules/prisma-migrations.md +1 -1
  158. package/src/repo/.opencode/rules/project-context.md +1 -1
  159. package/src/repo/.opencode/rules/server-client-separation.md +1 -1
  160. package/src/repo/.opencode/rules/subagent-workflow.md +1 -1
  161. package/src/repo/.opencode/rules/testing-quality.md +1 -1
  162. package/src/repo/.opencode/rules/ui-accessibility.md +1 -1
  163. package/src/repo/.opencode/rules/version-control.md +1 -1
  164. package/src/repo/.opencode/rules/what-to-avoid.md +1 -1
  165. package/src/repo/AGENTS.md +4 -4
  166. package/src/repo/README.md +5 -5
  167. package/src/repo/factory/README.md +44 -23
  168. package/src/repo/factory/worktree-bootstrap.md +32 -0
  169. package/src/monorepo/.claude/agents/factory-approver.agent.md +0 -12
  170. package/src/monorepo/.claude/agents/factory-builder.agent.md +0 -12
  171. package/src/monorepo/.claude/agents/factory-reviewer-code.agent.md +0 -12
  172. package/src/monorepo/.claude/agents/factory-reviewer-security.agent.md +0 -12
  173. package/src/monorepo/.claude/agents/factory-reviewer-ui.agent.md +0 -12
  174. package/src/monorepo/.claude/agents/factory-reviewer-ux.agent.md +0 -12
  175. package/src/monorepo/.claude/agents/factory-spec-writer.agent.md +0 -12
  176. package/src/monorepo/.cursor/agents/factory-approver.agent.md +0 -11
  177. package/src/monorepo/.cursor/agents/factory-builder.agent.md +0 -11
  178. package/src/monorepo/.cursor/agents/factory-reviewer-code.agent.md +0 -11
  179. package/src/monorepo/.cursor/agents/factory-reviewer-security.agent.md +0 -11
  180. package/src/monorepo/.cursor/agents/factory-reviewer-ui.agent.md +0 -11
  181. package/src/monorepo/.cursor/agents/factory-reviewer-ux.agent.md +0 -11
  182. package/src/monorepo/.cursor/agents/factory-spec-writer.agent.md +0 -11
  183. package/src/monorepo/.github/agents/factory-approver.agent.md +0 -11
  184. package/src/monorepo/.github/agents/factory-builder.agent.md +0 -11
  185. package/src/monorepo/.github/agents/factory-reviewer-code.agent.md +0 -11
  186. package/src/monorepo/.github/agents/factory-reviewer-security.agent.md +0 -11
  187. package/src/monorepo/.github/agents/factory-reviewer-ui.agent.md +0 -11
  188. package/src/monorepo/.github/agents/factory-reviewer-ux.agent.md +0 -11
  189. package/src/monorepo/.github/agents/factory-spec-writer.agent.md +0 -11
  190. package/src/monorepo/.opencode/agents/factory-approver.md +0 -20
  191. package/src/monorepo/.opencode/agents/factory-builder.md +0 -20
  192. package/src/monorepo/.opencode/agents/factory-reviewer-code.md +0 -20
  193. package/src/monorepo/.opencode/agents/factory-reviewer-security.md +0 -20
  194. package/src/monorepo/.opencode/agents/factory-reviewer-ui.md +0 -20
  195. package/src/monorepo/.opencode/agents/factory-reviewer-ux.md +0 -20
  196. package/src/monorepo/.opencode/agents/factory-spec-writer.md +0 -20
  197. package/src/repo/.claude/agents/factory-approver.agent.md +0 -12
  198. package/src/repo/.claude/agents/factory-builder.agent.md +0 -12
  199. package/src/repo/.claude/agents/factory-reviewer-code.agent.md +0 -12
  200. package/src/repo/.claude/agents/factory-reviewer-security.agent.md +0 -12
  201. package/src/repo/.claude/agents/factory-reviewer-ui.agent.md +0 -12
  202. package/src/repo/.claude/agents/factory-reviewer-ux.agent.md +0 -12
  203. package/src/repo/.claude/agents/factory-spec-writer.agent.md +0 -12
  204. package/src/repo/.cursor/agents/factory-approver.agent.md +0 -11
  205. package/src/repo/.cursor/agents/factory-builder.agent.md +0 -11
  206. package/src/repo/.cursor/agents/factory-reviewer-code.agent.md +0 -11
  207. package/src/repo/.cursor/agents/factory-reviewer-security.agent.md +0 -11
  208. package/src/repo/.cursor/agents/factory-reviewer-ui.agent.md +0 -11
  209. package/src/repo/.cursor/agents/factory-reviewer-ux.agent.md +0 -11
  210. package/src/repo/.cursor/agents/factory-spec-writer.agent.md +0 -11
  211. package/src/repo/.github/agents/factory-approver.agent.md +0 -11
  212. package/src/repo/.github/agents/factory-builder.agent.md +0 -11
  213. package/src/repo/.github/agents/factory-reviewer-code.agent.md +0 -11
  214. package/src/repo/.github/agents/factory-reviewer-security.agent.md +0 -11
  215. package/src/repo/.github/agents/factory-reviewer-ui.agent.md +0 -11
  216. package/src/repo/.github/agents/factory-reviewer-ux.agent.md +0 -11
  217. package/src/repo/.github/agents/factory-spec-writer.agent.md +0 -11
  218. package/src/repo/.opencode/agents/factory-approver.md +0 -20
  219. package/src/repo/.opencode/agents/factory-builder.md +0 -20
  220. package/src/repo/.opencode/agents/factory-reviewer-code.md +0 -20
  221. package/src/repo/.opencode/agents/factory-reviewer-security.md +0 -20
  222. package/src/repo/.opencode/agents/factory-reviewer-ui.md +0 -20
  223. package/src/repo/.opencode/agents/factory-reviewer-ux.md +0 -20
  224. package/src/repo/.opencode/agents/factory-spec-writer.md +0 -20
@@ -2,7 +2,7 @@
2
2
 
3
3
  Server and client code boundary enforcement.
4
4
 
5
- @.claude/rules-snippets/server-client-separation.md
5
+ Read and follow `.claude/rules-snippets/server-client-separation.md` when these standards apply.
6
6
 
7
7
  ## Key points
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Subagent workflow and orchestration patterns.
4
4
 
5
- @.claude/rules-snippets/subagent-workflow.md
5
+ Read and follow `.claude/rules-snippets/subagent-workflow.md` when these standards apply.
6
6
 
7
7
  ## Key points
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Testing standards and quality gates.
4
4
 
5
- @.claude/rules-snippets/testing-quality.md
5
+ Read and follow `.claude/rules-snippets/testing-quality.md` when these standards apply.
6
6
 
7
7
  ## Key points
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  UI accessibility and responsive design standards.
4
4
 
5
- @.claude/rules-snippets/ui-accessibility.md
5
+ Read and follow `.claude/rules-snippets/ui-accessibility.md` when these standards apply.
6
6
 
7
7
  ## Key points
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Version control and commit conventions.
4
4
 
5
- @.claude/rules-snippets/version-control.md
5
+ Read and follow `.claude/rules-snippets/version-control.md` when these standards apply.
6
6
 
7
7
  ## Key points
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Patterns and practices to avoid.
4
4
 
5
- @.claude/rules-snippets/what-to-avoid.md
5
+ Read and follow `.claude/rules-snippets/what-to-avoid.md` when these standards apply.
6
6
 
7
7
  ## Key points
8
8
 
@@ -119,11 +119,11 @@ Each app has its own `AGENTS.md` with detailed patterns:
119
119
 
120
120
  ## OpenCode V2 Context
121
121
 
122
- OpenCode use with toolkit v4 requires native V2; Slim >=3.0.0 requires OpenCode >=2.0.7. Read [native setup](README.md#native-opencode-v2) before migration. All bootstrap flows run `opencode --version` before changes for confirmed OpenCode use: V1 must stop and upgrade OpenCode or remain on toolkit 3.x; missing/unparseable versions block OpenCode steps and toolkit 4.0.0 marking. Directory presence is not harness proof; other-harness-only setup is unaffected.
122
+ OpenCode use with toolkit 4.0.0 and later requires native V2; Slim >=3.0.0 requires OpenCode >=2.0.7. Read [native setup](README.md#native-opencode-v2) before migration. All bootstrap flows run `opencode --version` before changes for confirmed OpenCode use: V1 must stop and upgrade OpenCode or remain on toolkit 3.x; missing/unparseable versions block OpenCode steps and marking the installed toolkit version (4.0.0 or later). Directory presence is not harness proof; other-harness-only setup is unaffected.
123
123
 
124
- Use `agents`/`system`, `request.body.temperature`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`), `commands`, `plugins`, directory-based `skills`, and `mcp.servers`. Preserve user models/providers/plugins and Slim's separate strict schema; do not host-migrate its `prompt`/`permission`/`variant` fields or silently upgrade the separate external starter. Templates register the author's native V2 `@dietrichgebert/ponytail@4.12.0` locally instead of a bundled Ponytail plugin; `opentmux` stays commented as V1-only. Remove only known obsolete toolkit Ponytail `.js`/`.mjs`/`.ts` copies after backup and approval, preserve unrelated local plugins, and merge/deduplicate upstream registration locally without editing global config. No local API port or bridge is used; plugin/runtime integration is untested.
124
+ Use `agents`/`system`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`), `commands`, `plugins`, directory-based `skills`, and `mcp.servers`. Preserve user models/providers/plugins and Slim's separate strict schema; do not host-migrate its `prompt`/`permission`/`variant` fields or silently upgrade the separate external starter. The OpenCode Ponytail plugin (`@dietrichgebert/ponytail`) is installed globally by the operator; the toolkit does not register it. Bootstrap may check for it and tell the operator to install it globally, but must never add it to project config. `opentmux` stays commented as V1-only. Remove only known obsolete toolkit Ponytail `.js`/`.mjs`/`.ts` copies after backup and approval, and preserve unrelated local plugins. No local API port or bridge is used; plugin/runtime integration is untested. The Claude Code hooks in `hooks/*.json` use `${CLAUDE_PLUGIN_ROOT}` and are plugin-only: they fire only when installed through the Ponytail plugin, not from project settings.
125
125
 
126
- Ambient root/nested `AGENTS.md` works; config `instructions` entries do not load. `@refs` are ordinary text: explicitly read linked snippets. `request.body.temperature` remains in config, but the current runner does not send it. Preserve `lsp: true`; use workspace lint/typecheck/compiler commands, not unavailable V2 LSP diagnostics. Back up V1 before native conversion; converted files are incompatible with V1. Activate on the next run/restart.
126
+ Ambient root/nested `AGENTS.md` works. Config `instructions` entries load only when the runtime injects them (OpenChamber does; other hosts may not), so do not rely on them: write explicit "Read and follow" wrappers regardless. `@refs` are ordinary text: explicitly read linked snippets. Do not set a temperature; the current runner does not send one. Preserve `lsp: true`; use workspace lint/typecheck/compiler commands, not unavailable V2 LSP diagnostics. Back up V1 before native conversion; converted files are incompatible with V1. Activate on the next run/restart.
127
127
 
128
128
  ## Detailed Instructions
129
129
 
@@ -366,7 +366,7 @@ Subagents are typically **agent-initiated** — the coordinator decides when to
366
366
 
367
367
  ### Factory (opt-in)
368
368
 
369
- An optional file-driven pipeline for feature-sized work, alongside Feature Builder and TDD. Start it with `/factory <request>` in Claude Code, Copilot, Cursor, or OpenCode. The orchestrator reads the project and asks only the glaring questions before it creates anything, then asks you to continue or change the answers. Resume a feature with `/factory start <KEY | slug | job-id>`. Codex runs the orchestrator skill directly. Each job belongs to a feature folder in `docs/features/`, stops at a spec gate and a plan gate for your confirmation before any ticket or build, builds in its own git worktree unless you ask for `--in-place`, and moves its tickets when the project tracks them. The orchestrator is [.agents/skills/factory/SKILL.md](.agents/skills/factory/SKILL.md). Its seven agents are `factory-spec-writer`, `factory-builder`, `factory-reviewer-code`, `factory-reviewer-security`, `factory-reviewer-ux`, `factory-reviewer-ui`, and `factory-approver`, with wrappers in each harness's agents folder that point to the shared snippets in `.claude/agents-snippets/`. Setup, placeholders, and approval modes are in [factory/README.md](factory/README.md). Jobs name the affected apps and packages in their spec, and checks run for those with the filtered commands in [Commands](#commands).
369
+ An optional file-driven pipeline for feature-sized work, alongside Feature Builder and TDD. Start it with `/factory <request>` in Claude Code, Copilot, Cursor, or OpenCode. The orchestrator reads the project and asks only the glaring questions before it creates anything, then asks you to continue or change the answers. Resume a feature with `/factory start <KEY | slug | job-id>`. Codex runs the orchestrator skill directly. Each job belongs to a feature folder in `docs/features/`, stops at a spec gate and a plan gate for your confirmation before any ticket or build, builds in its own git worktree unless you ask for `--in-place`, and moves its tickets when the project tracks them. The orchestrator is [.agents/skills/factory/SKILL.md](.agents/skills/factory/SKILL.md). It runs on the native `planner` (spec and plan), `implementer` (build, repair, and rework), and `reviewer` (the code, security, ux, and ui lenses, and approval) agents. Each role's Factory rules are in its brief in `.agents/skills/factory/roles/`. Setup, placeholders, and approval modes are in [factory/README.md](factory/README.md). Jobs name the affected apps and packages in their spec, and checks run for those with the filtered commands in [Commands](#commands).
370
370
 
371
371
  ## Documentation Requirements
372
372
 
@@ -58,17 +58,17 @@ This is a monorepo managed with {{BUILD_SYSTEM}}.
58
58
 
59
59
  ### Native OpenCode V2
60
60
 
61
- Toolkit v4 requires **OpenCode V2 (major >=2)** for OpenCode use; oh-my-opencode-slim >=3.0.0 requires OpenCode >=2.0.7. Bootstrap, patch, and upgrade run `opencode --version` before changes (optional leading `v` accepted). V1 must stop before OpenCode customization/migration or marking toolkit 4.0.0: upgrade OpenCode or remain on toolkit 3.x. A missing CLI or unparseable version stops OpenCode steps and version marking until confirmed/installed. Confirm harness use from runtime evidence or ask, not scaffold directories; other-harness-only setup is unaffected.
61
+ Toolkit 4.0.0 and later require **OpenCode V2 (major >=2)** for OpenCode use; oh-my-opencode-slim >=3.0.0 requires OpenCode >=2.0.7. Bootstrap, patch, and upgrade run `opencode --version` before changes (optional leading `v` accepted). V1 must stop before OpenCode customization/migration or marking toolkit 4.0.0: upgrade OpenCode or remain on toolkit 3.x. A missing CLI or unparseable version stops OpenCode steps and version marking until confirmed/installed. Confirm harness use from runtime evidence or ask, not scaffold directories; other-harness-only setup is unaffected.
62
62
 
63
- The template's local `plugins` array registers the author's native V2 package `@dietrichgebert/ponytail@4.12.0`, alongside `opencode-mem` and `@tarquinen/opencode-dcp@latest`; `opentmux` remains commented as V1-only. The obsolete local Ponytail plugin is no longer bundled; no local API port or bridge is used. For existing projects, back up and obtain approval before removing only known toolkit `.opencode/plugins/ponytail.js`, `.mjs`, or `.ts` copies; preserve unrelated local plugins and merge/deduplicate upstream registration locally without editing global plugins. Native local plugins are discovered automatically; do not register them twice.
63
+ The template's local `plugins` array registers `opencode-mem` and `@tarquinen/opencode-dcp@latest`; `opentmux` remains commented as V1-only. The OpenCode Ponytail plugin (`@dietrichgebert/ponytail`) is installed globally by the operator and is not registered by the toolkit. Bootstrap may check for it and tell the operator to install it globally, but never adds it to project config. The obsolete local Ponytail plugin is no longer bundled; no local API port or bridge is used. For existing projects, back up and obtain approval before removing only known toolkit `.opencode/plugins/ponytail.js`, `.mjs`, or `.ts` copies; preserve unrelated local plugins and global plugins. Native local plugins are discovered automatically. The Claude Code hooks in `hooks/*.json` use `${CLAUDE_PLUGIN_ROOT}` and are plugin-only: they fire only when installed through the Ponytail plugin, not from project settings.
64
64
 
65
65
  With approval, merge `"plugins": ["oh-my-opencode-slim@3.0.0"]` locally without replacing other registrations. Slim's separate strict schema retains `prompt`, `permission`, and `variant`; do not host-migrate it. The external starter is a separate package, not automatically upgraded. Plugin/runtime integration has not been tested.
66
66
 
67
- Use native `agents`/`system`, `request.body.temperature`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`), `commands`/`subagent`, `plugins` with `{ "package": "…", "options": {} }`, skill-directory arrays, and `mcp.servers` with inverse `disabled` and `timeout.catalog`/`timeout.execution`. Follow the [V2 migration guide](https://opencode.ai/v2/docs/migrate-v1) and [plugin guide](https://opencode.ai/v2/docs/build/plugins); the published schema may describe V1 and is not V2 validation authority.
67
+ Use native `agents`/`system`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`), `commands`/`subagent`, `plugins` with `{ "package": "…", "options": {} }`, skill-directory arrays, and `mcp.servers` with inverse `disabled` and `timeout.catalog`/`timeout.execution`. Follow the [V2 migration guide](https://opencode.ai/v2/docs/migrate-v1) and [plugin guide](https://opencode.ai/v2/docs/build/plugins); the published schema may describe V1 and is not V2 validation authority.
68
68
 
69
- Ambient root/nested `AGENTS.md` works; config `instructions` entries are not loaded. `@refs` are ordinary text: read linked snippets explicitly. `request.body.temperature` remains in config, but the current runner does not send it. Preserve `lsp: true`; use workspace lint/typecheck/compiler commands (no V2 LSP tools/diagnostics currently).
69
+ Ambient root/nested `AGENTS.md` works. Config `instructions` entries load only when the runtime injects them (OpenChamber does; other hosts may not), so do not rely on them: write explicit "Read and follow" wrappers regardless. `@refs` are ordinary text: read linked snippets explicitly. Do not set a temperature; the current runner does not send one. Preserve `lsp: true`; use workspace lint/typecheck/compiler commands (no V2 LSP tools/diagnostics currently).
70
70
 
71
- `--env opencode` supplies minimal shared references without activating other harnesses. Back up V1, merge rather than clobber models/providers/plugins, and activate on the next run/restart. Native-converted files are incompatible with V1. Verify with installed V2; `doctor` is not runtime validation. Toolkit 4.0.0 publishing has not been executed.
71
+ `--env opencode` supplies minimal shared references without activating other harnesses. Back up V1, merge rather than clobber models/providers/plugins, and activate on the next run/restart. Native-converted files are incompatible with V1. Verify with installed V2; `doctor` is not runtime validation.
72
72
 
73
73
  ### Native Codex
74
74
 
@@ -1,17 +1,17 @@
1
1
  # Factory (opt-in)
2
2
 
3
- A file-driven pipeline for feature-sized work. One orchestrator session runs a feature through intake → spec → plan → build → review → approve → merge. Agents get their context only from files, and each agent writes only its own file. Feature docs live in `docs/features/`, and job state lives here in `factory/jobs/`.
3
+ A file-driven pipeline for feature-sized work. One orchestrator session runs a feature through intake → spec → plan → build → review → approve → merge. Agents get their context only from files, and each agent writes only its own file. Feature docs live in feature folders (see Feature folders), and job state lives here in `factory/jobs/`.
4
4
 
5
5
  The factory is **opt-in**. It sits alongside Feature Builder and TDD and changes nothing they do. Nothing runs until you invoke `/factory`. Quick fixes stay direct.
6
6
 
7
- Orchestrator: [.agents/skills/factory/SKILL.md](../.agents/skills/factory/SKILL.md). Its agents have wrappers in `.claude/agents/`, `.github/agents/`, `.cursor/agents/`, and `.opencode/agents/`. See [Harnesses](#harnesses).
7
+ Orchestrator: [.agents/skills/factory/SKILL.md](../.agents/skills/factory/SKILL.md). It runs on the native `planner`, `implementer`, and `reviewer` agents, and its role briefs live in `.agents/skills/factory/roles/`. See [Harnesses](#harnesses).
8
8
 
9
9
  ## Install
10
10
 
11
11
  1. **Install it.** The toolkit installer copies this folder into your project root as `factory/`.
12
- 2. **Document your commands in `AGENTS.md`.** Agents read setup, dev, test, lint, and build commands from there, and the dev command must document how to pass a port (a flag or an env var). In a monorepo, document the root commands and the filtered form for each app and package, for example `--filter=<app>`. Without them the factory stops and asks you.
13
- 3. **Replace the placeholders** below in `.agents/skills/factory/SKILL.md` and `.claude/agents-snippets/factory-*.md`. Bootstrap does this when it runs.
14
- 4. **Commit** `factory/README.md`, `factory/.gitignore`, and the factory agents and skill. Runtime state is ignored (see Layout). Feature docs in `docs/features/` are committed with the code.
12
+ 2. **Document your commands in `AGENTS.md`.** Agents read setup, dev, test, lint, and build commands from there, and the dev command must document how to pass a port (a flag or an env var). In a monorepo, document the root commands and the filtered form for each app and package, for example `--filter=<app>`. Without them the factory stops and asks you. Edit `factory/worktree-bootstrap.md` for the setup each new worktree needs (see Build location).
13
+ 3. **Replace the placeholders** below in `.agents/skills/factory/SKILL.md` and `.agents/skills/factory/roles/*.md`. Bootstrap does this when it runs.
14
+ 4. **Commit** `factory/README.md`, `factory/.gitignore`, and the factory skill with its role briefs. Runtime state is ignored (see Layout). Feature docs in the feature folders are committed with the code.
15
15
  5. **Run it** from your harness: `/factory <feature request>` to start from a request, or `/factory start <KEY | slug | job-id>` to pick up an existing feature. See [Harnesses](#harnesses) for each entry point.
16
16
 
17
17
  ## Placeholders
@@ -22,6 +22,8 @@ Orchestrator: [.agents/skills/factory/SKILL.md](../.agents/skills/factory/SKILL.
22
22
  | FACTORY_PORT_BASE | Base dev-server port. Job `n` uses builder `base + 10n`, ux `+1`, ui `+2` | `5100` |
23
23
  | APPROVAL_MODE | `human`: stop at `awaiting-human` for `/factory approve`. `auto`: merge on `APPROVE` | `human` |
24
24
  | FACTORY_REVIEW_LENSES | Comma list from `code, security, ux, ui` | `code, security` |
25
+ | FACTORY_FEATURE_PATHS | Feature-folder roots, comma list, relative to the repo root. `*` matches one folder name. Search covers every root. New folders go to the first root without `*`, or to a `*` root when the request's code sits in one app | monorepo: `apps/*/docs/features, docs/features`; repo: `docs/features` |
26
+ | MERGE_MODE | `local`: `--no-ff` merge here, never pushed. `push-mr`: push and open a merge or pull request (see Merge modes). Any other value is `local` | `local` |
25
27
 
26
28
  `ux` and `ui` need browser tooling to verify anything. Without it they report every check as `Not verified`, and the job goes straight to `needs-human`. Enable them only when your agents can drive a browser.
27
29
 
@@ -31,13 +33,13 @@ Orchestrator: [.agents/skills/factory/SKILL.md](../.agents/skills/factory/SKILL.
31
33
  | --- | --- |
32
34
  | `/factory <request>` | Intake: the orchestrator reads the project and the features it touches, asks only the glaring questions, then asks you to continue or change the answers. Nothing is created before that |
33
35
  | `/factory start <request \| KEY \| slug \| job-id>` | Find or create the feature folder, then start a job, or resume the open job for it (for example one waiting at a gate) |
34
- | `/factory approve <job-id>` | Merge a job in `awaiting-human` or `needs-human`. On a `merged` job, moves its tickets to Done |
36
+ | `/factory approve <job-id>` | Merge a job in `awaiting-human` or `needs-human` (`local`), or open its merge request (`push-mr`; approve again once the forge has merged it, to finish). On a `merged` job, moves its tickets to Done |
35
37
  | `/factory rework <job-id> <note>` | Start a fresh builder with your note and a fresh retry budget |
36
38
  | `/factory abandon <job-id>` | Close a job that will not continue. Nothing is merged. Removes its worktree and branch only when the branch has no unmerged commits. Tickets stay as they are |
37
39
  | `/factory status [--all]` | Summarize open jobs from their `job.json` files. Closed jobs are hidden unless `--all` |
38
40
  | `/factory watch [--all]` | Show the status table, then print the command for the live view to run in a terminal (read-only). Closed jobs are hidden unless `--all` |
39
41
  | `/factory archive [--all] [--dry-run]` | Move closed jobs to `factory/archive/`. Open jobs never move. See [Archive](#archive) |
40
- | `/factory prune [--all] [--abandoned] [--dry-run]` | Permanently delete closed jobs from `factory/jobs/` and `factory/archive/`, after one confirmation. Open jobs and `docs/features/` are never touched. See [Prune](#prune) |
42
+ | `/factory prune [--all] [--abandoned] [--dry-run]` | Permanently delete closed jobs from `factory/jobs/` and `factory/archive/`, after one confirmation. Open jobs and feature folders are never touched. See [Prune](#prune) |
41
43
 
42
44
  `--in-place` can follow either form (`/factory --in-place <request>`, `/factory start --in-place <...>`). It builds in the main checkout instead of a worktree. See [In-place builds](#in-place-builds).
43
45
 
@@ -45,24 +47,32 @@ There is no queue. Start each feature with a request, a ticket key, or a slug.
45
47
 
46
48
  ## Harnesses
47
49
 
48
- The orchestrator and agents are the same in every harness. Each harness has its own entry point and agent wrappers. Every wrapper points to the shared snippets in `.claude/agents-snippets/`.
50
+ The orchestrator and agents are the same in every harness. Each harness has its own entry point. Every role runs on a native agent: `planner` for the spec writer, `implementer` for the builder, and `reviewer` for each review lens and the approver, with the lens or approval mode named in the dispatch. The role briefs in `.agents/skills/factory/roles/` hold the Factory rules.
49
51
 
50
- | Harness | Entry point | Agent wrappers |
52
+ | Harness | Entry point | Native agents |
51
53
  | --- | --- | --- |
52
54
  | Claude Code | `/factory` (`.claude/commands/factory.md`) | `.claude/agents/` |
53
55
  | GitHub Copilot | `/factory` prompt (`.github/prompts/factory.prompt.md`) | `.github/agents/` |
54
56
  | Cursor | `/factory` (`.cursor/commands/factory.md`) | `.cursor/agents/` |
55
57
  | OpenCode | `/factory` (`.opencode/commands/factory.md`) | `.opencode/agents/` |
56
- | Codex | The factory skill (`.agents/skills/factory/SKILL.md`) | None. Runs the snippets directly, one role at a time in one session (see Harness notes in SKILL.md) |
58
+ | Codex | The factory skill (`.agents/skills/factory/SKILL.md`) | None. Runs each role brief directly, one role at a time in one session (see Harness notes in SKILL.md) |
59
+
60
+ In OpenCode with the Slim plugin, `oracle` and `designer` are optional alternatives to `reviewer`, if you configure them as edit-denied. The default is the native agents.
57
61
 
58
62
  ## Feature folders and sizing
59
63
 
60
- Each job belongs to a feature folder, `docs/features/<KEY>-<slug>/` (or `docs/features/<slug>/` before a ticket exists). Feature folders always live at the repository root, even in a monorepo. Factory jobs do not use `apps/<app>/docs/features/`; the per-app docs rules cover app docs only. The spec writer puts `spec.md` there. Then the plan step adds `plan.md`, which carries the size, and, for large work, a slim `tasks.md`, one line per task:
64
+ Each job belongs to a feature folder: `docs/features/<KEY>-<slug>/` at the repository root, or `apps/<app>/docs/features/<KEY>-<slug>/` for work in one app (`<slug>` in place of `<KEY>-<slug>` before a ticket exists). The roots come from `FACTORY_FEATURE_PATHS`. The spec writer puts `spec.md` there. Then the plan step adds `plan.md`, which carries the size, and, for large work, a slim `tasks.md`, one line per task:
61
65
 
62
66
  ```
63
67
  - [ ] T1 <one-line task> [P] — PROJ-1235
64
68
  ```
65
69
 
70
+ Where a new folder goes:
71
+
72
+ - Code in one app: `apps/<app>/docs/features/`. The per-app docs rules still cover the app's own docs.
73
+ - Code in several apps, or none: the root `docs/features/`.
74
+ - An existing folder stays where it is. Every root in `FACTORY_FEATURE_PATHS` is searched.
75
+
66
76
  Sizing is decided in `plan.md`:
67
77
 
68
78
  - **Small** (one or two steps): `spec.md` and `plan.md` only, no tickets.
@@ -89,16 +99,31 @@ Any value other than exactly `auto` is treated as `human`.
89
99
 
90
100
  By default each job builds in its own git worktree on branch `factory/<id>`, so the main checkout stays free. A job's `job.json` records this in `worktree` (`true`) and the worktree path in `worktree_path`.
91
101
 
102
+ ### Worktree bootstrap
103
+
104
+ Before the builder starts in a new worktree, the factory runs the steps listed in `factory/worktree-bootstrap.md`: one shell command per line, in order, from the worktree root. Typical steps install dependencies or vendored packages, copy `.env` from the main checkout, and create or migrate a database for the job. The file ships with no active steps, so edit it for your project. Each step receives `FACTORY_JOB_ID`, `FACTORY_PORT_BUILDER`, `FACTORY_WORKTREE`, and `FACTORY_MAIN_CHECKOUT`.
105
+
106
+ Steps must be safe to run again, because rework reruns them. A failing step stops the build and writes `bootstrap.md` in the job folder. Fix the cause, then run `/factory rework <job-id>`. In-place builds skip the bootstrap.
107
+
92
108
  ### In-place builds
93
109
 
94
110
  Ask for an in-place build with `--in-place`, or by saying so at intake or at the plan gate. The build then runs in the main checkout, on branch `factory/<id>`.
95
111
 
96
- - The job starts only when the main checkout is on the default branch with no tracked changes outside `docs/features/`, no other in-place job is open, and no worktree job holds its build location. Otherwise the job waits at the plan gate and says why.
112
+ - The job starts only when the main checkout is on the default branch with no tracked changes outside the feature folders, no other in-place job is open, and no worktree job holds its build location. Otherwise the job waits at the plan gate and says why.
97
113
  - While the job is open, the main checkout stays on `factory/<id>`. Do not switch it until the job is merged or abandoned.
98
114
  - The feature docs are committed on the branch when the build starts, so the main checkout has no tracked feature-doc changes to block a merge.
99
115
  - The merge switches the main checkout back to the default branch and removes only the branch, not a worktree.
100
116
  - A worktree job cannot merge while an in-place job holds its build location, and an in-place job cannot start while a worktree job holds one. Each refusal names the job in the way.
101
117
 
118
+ ## Merge modes
119
+
120
+ Set `MERGE_MODE`. The approval gates are the same in both modes.
121
+
122
+ - **`local`** (default). The merge runs in the main checkout: `--no-ff`, the test commands, then the worktree and branch are removed. Nothing is pushed. Use it for a solo repo with no forge review.
123
+ - **`push-mr`**. Approve pushes `factory/<id>` after a local test run, then opens a merge request (GitLab, `glab mr create`) or a pull request (GitHub, `gh pr create`). The job waits in `awaiting-human` with the request's URL. Review and merge it on the forge, then run `/factory approve <job-id>` again. That run removes the worktree and branch and moves tickets to Done. It needs the matching CLI, authenticated.
124
+
125
+ `push-mr` suits forge-reviewed setups, where required reviews or CI gates sit on the forge after your approval. It never force-pushes and never merges locally. Under `auto`, approve opens the request without a pause, but the forge merge and the second `/factory approve` stay yours.
126
+
102
127
  ## Suggested checks (`qa.md`)
103
128
 
104
129
  The builder writes `qa.md` in the feature folder, on the job's branch. It has how to run the feature (dev server, port, seed data, flags), numbered manual checks tied to acceptance criteria, and what the automated tests do not cover. When a job waits for you, the orchestrator prints it with the reviewers' `Not verified` items under the line `Suggested checks before /factory approve — not a gate`. It is a checklist. It never affects a verdict, and a missing `qa.md` is only noted.
@@ -111,7 +136,7 @@ When a job is tracked, its tickets follow it:
111
136
  | --- | --- |
112
137
  | Build starts | In Progress |
113
138
  | Review starts | In Review |
114
- | You approve and the merge runs | Done |
139
+ | The merge completes: the local merge, or a `push-mr` request merged and finished with approve | Done |
115
140
  | Job abandoned | Left as they are |
116
141
 
117
142
  The parent and every sub-task move together. The orchestrator uses the project's status names, and asks once for them if it does not know them. A failed ticket update is recorded in the job and reported. It never blocks the pipeline.
@@ -119,22 +144,22 @@ The parent and every sub-task move together. The orchestrator uses the project's
119
144
  ## How a job runs
120
145
 
121
146
  1. **Intake.** For `/factory <request>`, the orchestrator reads the project and asks only the glaring questions. You answer them, then choose to continue or change the answers. Nothing is created before you continue.
122
- 2. **Spec.** `factory-spec-writer` inspects the code and writes `spec.md` with numbered acceptance criteria.
147
+ 2. **Spec.** `planner` (spec mode) inspects the code and writes `spec.md` with numbered acceptance criteria.
123
148
  3. **Spec gate.** You confirm the spec, or request changes.
124
- 4. **Plan.** `factory-spec-writer` in plan mode writes `plan.md` (with the size) and `tasks.md` for large work.
149
+ 4. **Plan.** `planner` in plan mode writes `plan.md` (with the size) and `tasks.md` for large work.
125
150
  5. **Plan gate.** You confirm the plan, or request changes. Nothing is ticketed or built before you confirm.
126
- 6. **Tickets and build location.** If tracked, the parent and sub-tasks are created and their keys are written into `tasks.md`. The folder is renamed to carry the key. Then a builder gets its own git worktree on branch `factory/<id>`, or the in-place branch. The job's feature docs are committed on that branch.
151
+ 6. **Tickets and build location.** If tracked, the parent and sub-tasks are created and their keys are written into `tasks.md`. The folder is renamed to carry the key. Then a builder gets its own git worktree on branch `factory/<id>` (bootstrapped first, see Build location), or the in-place branch. The job's feature docs are committed on that branch.
127
152
  7. **Build.** The builder follows TDD, ticks `tasks.md` as it completes tasks, writes `build.md`, and writes `qa.md`.
128
- 8. **Review.** Every configured lens reviews the branch, writing `round-N/review-<lens>.md` with `VERDICT: PASS` or `VERDICT: CHANGES`.
153
+ 8. **Review.** Every configured lens reviews the branch, and each reviewer's report is saved as `round-N/review-<lens>.md` with `VERDICT: PASS` or `VERDICT: CHANGES`.
129
154
  9. **Repair.** Any `CHANGES` sends the builder back to fix it. Two repairs at most, so three review rounds. Then the job escalates to you.
130
- 10. **Approve.** `factory-approver` writes `decision.md` with `APPROVE` or `ESCALATE`.
131
- 11. **Merge.** Local only, never pushed. `--no-ff` merge, the project's test command, then the worktree (if any) and branch are removed. Feature docs in the main checkout are set aside first (copies in `main-copies/`), so the merge brings in the branch's committed copies.
155
+ 10. **Approve.** `reviewer` in approval mode (fresh context) returns `APPROVE` or `ESCALATE`, and the orchestrator writes it to `decision.md`.
156
+ 11. **Merge.** `local` mode: local only, never pushed. `push-mr` mode: push and open the request, then finish on the second approve (see Merge modes). `--no-ff` merge, the test commands for the affected apps and packages, then the worktree (if any) and branch are removed. Feature docs in the main checkout are set aside first (copies in `main-copies/`), so the merge brings in the branch's committed copies.
132
157
 
133
158
  Jobs that escalate (`needs-human`) keep their branch and worktree so you can inspect them. Use `/factory rework` or `/factory approve` to continue.
134
159
 
135
160
  ## Abandon
136
161
 
137
- `/factory abandon <job-id>` closes a job that will not continue. It merges nothing. The worktree and branch are removed only when the branch has no unmerged commits. Every job that reached its build keeps its branch and worktree, because its feature-docs commit is unmerged; review them and remove the branch yourself when you are done. Tickets stay where they are, and the report lists their keys. An abandoned job cannot be resumed: `/factory start <slug or KEY>` starts a new one.
162
+ `/factory abandon <job-id>` closes a job that will not continue. It merges nothing. The worktree and branch are removed only when the branch has no unmerged commits. Every job that reached its build keeps its branch and worktree, because its feature-docs commit is unmerged; review them and remove the branch yourself when you are done. Tickets stay where they are, and the report lists their keys. A `push-mr` request stays open on the forge; the report gives its URL for the operator to close. An abandoned job cannot be resumed: `/factory start <slug or KEY>` starts a new one.
138
163
 
139
164
  ## Archive
140
165
 
@@ -147,14 +172,14 @@ Jobs that escalate (`needs-human`) keep their branch and worktree so you can ins
147
172
 
148
173
  ## Prune
149
174
 
150
- `/factory prune [--all] [--abandoned] [--dry-run]` permanently deletes closed jobs from `factory/jobs/` and `factory/archive/`. By default only `merged` jobs are deleted; `--abandoned` also deletes `abandoned` jobs. The age rule is the same as archive: jobs last updated more than 7 days ago, and `--all` drops the age limit. The list comes first, and nothing is deleted until you confirm once in chat. A pruned job cannot be recovered. Open jobs and `docs/features/` are never touched.
175
+ `/factory prune [--all] [--abandoned] [--dry-run]` permanently deletes closed jobs from `factory/jobs/` and `factory/archive/`. By default only `merged` jobs are deleted; `--abandoned` also deletes `abandoned` jobs. The age rule is the same as archive: jobs last updated more than 7 days ago, and `--all` drops the age limit. The list comes first, and nothing is deleted until you confirm once in chat. A pruned job cannot be recovered. Open jobs and feature folders are never touched.
151
176
 
152
177
  Without `--abandoned`, abandoned jobs are kept and counted, and the flow offers to rerun with it. When abandoned jobs are pruned, each one whose branch still exists gets the same per-branch question as archive. Merged branches are only listed. `npx nitm-ai-dev-toolkit factory prune` lists by default; add `--yes` to delete (and `--abandoned` to include abandoned jobs).
153
178
 
154
179
  ## Layout
155
180
 
156
181
  ```
157
- docs/features/ tracked by the project
182
+ <feature root>/ tracked by the project (roots: FACTORY_FEATURE_PATHS)
158
183
  <KEY>-<slug>/
159
184
  spec.md
160
185
  plan.md
@@ -163,9 +188,10 @@ docs/features/ tracked by the project
163
188
  factory/
164
189
  README.md this file
165
190
  .gitignore ignores jobs/ and archive/
191
+ worktree-bootstrap.md setup steps run in each new worktree (edit for your project)
166
192
  jobs/ runtime state (ignored by git)
167
193
  <NNN-slug>/
168
- job.json stage, round, reviews, size, tracking, worktree, failed_stage, approval mode
194
+ job.json stage, round, reviews, size, tracking, worktree, mr, failed_stage, approval mode
169
195
  intake.md intake questions and answers (only when asked)
170
196
  spec-<k>.md after a change request at the spec gate
171
197
  plan-<k>.md after a change request at the plan gate
@@ -173,6 +199,7 @@ factory/
173
199
  round-<N>/review-<lens>.md
174
200
  decision.md
175
201
  merge-conflict.md after a merge conflict; blocks approve
202
+ bootstrap.md after a failed worktree bootstrap step; blocks the build
176
203
  rework-<k>.md
177
204
  main-copies/ feature docs moved aside at merge
178
205
  archive/ closed jobs moved by /factory archive (ignored by git)
@@ -187,7 +214,7 @@ Stages, in order: `spec`, `awaiting-spec`, `plan`, `awaiting-plan`, `build`, `re
187
214
 
188
215
  - **Write boundaries are conventions.** Each agent is told which files it writes, but nothing enforces that. The real gates are the spec and plan gates, the reviewer verdicts, the approver's checks, and the merge preconditions and test run.
189
216
  - **Harness behavior varies.** Parallel review and builder resume depend on the harness. If dispatch is background-only, the orchestrator polls for each file until a 15-minute default timeout (the request can set another). A timed-out agent is never re-dispatched: the job stops at `needs-human`. See Harness notes in [SKILL.md](../.agents/skills/factory/SKILL.md).
190
- - **Local merge only.** The factory never pushes. Open a pull request yourself if you want review on a remote.
217
+ - **Local merge by default.** `local` never pushes. `push-mr` pushes only on approve, and only the `factory/<id>` branch. Force-push is never used.
191
218
  - **One job at a time per checkout** is the tested path. An in-place job also holds the main checkout until it merges or is abandoned.
192
219
  - **UI lenses need a browser.** Without one they cannot verify anything and the job escalates.
193
220
  - **Tickets are best-effort.** Creation failures stop at the plan gate. Transition failures are recorded and reported.
@@ -0,0 +1,32 @@
1
+ # Worktree bootstrap (factory)
2
+
3
+ The factory runs the steps below in each new job worktree, in order, before the builder starts. Edit this file for your project; it is yours after install and `upgrade` never overwrites it without `--force`.
4
+
5
+ Rules:
6
+
7
+ - One shell command per line. Lines starting with `#` are notes. Blank lines are skipped.
8
+ - Each command runs from the worktree root with `sh -c`. It stops the build at the first failure.
9
+ - Each command gets these variables:
10
+ - `FACTORY_JOB_ID`: the job id, such as `001-onboarding-bootstrap`. Use it to name per-job resources, such as a database.
11
+ - `FACTORY_PORT_BUILDER`: the builder's dev-server port. Pass it with the flag or env var that `AGENTS.md` documents.
12
+ - `FACTORY_WORKTREE`: the worktree path (also the current directory).
13
+ - `FACTORY_MAIN_CHECKOUT`: the main checkout, where ignored local files such as `.env` live.
14
+ - Steps must be safe to run again. Rework reruns the whole list.
15
+ - Keep secrets out of this file. Copy them from `FACTORY_MAIN_CHECKOUT` instead.
16
+
17
+ The list ships with no active steps. Uncomment the ones your project needs, or replace them. Examples:
18
+
19
+ ```sh
20
+ # Dependencies: pick the one AGENTS.md documents.
21
+ # npm ci
22
+ # pnpm install --frozen-lockfile
23
+ # composer install --no-interaction
24
+ # bundle install --path vendor/bundle
25
+ # go mod vendor
26
+
27
+ # Local env file, copied only when the main checkout has one and this worktree does not.
28
+ # [ -f "$FACTORY_MAIN_CHECKOUT/.env" ] && [ ! -f .env ] && cp "$FACTORY_MAIN_CHECKOUT/.env" .env
29
+
30
+ # Database for this job only. Replace with your own create and migrate commands.
31
+ # createdb "app_${FACTORY_JOB_ID}" && DATABASE_URL="postgres:///app_${FACTORY_JOB_ID}" npm run db:migrate
32
+ ```