nitm-ai-dev-toolkit 4.0.0 → 5.0.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 (256) hide show
  1. package/CHANGELOG.md +83 -1
  2. package/README.md +87 -11
  3. package/bin/cli.js +721 -84
  4. package/bin/factory-archive.js +71 -0
  5. package/bin/factory-prune.js +79 -0
  6. package/bin/factory-watch.js +509 -0
  7. package/package.json +1 -1
  8. package/src/monorepo/.agents/skills/factory/SKILL.md +643 -0
  9. package/src/monorepo/.claude/agents/admin-portal.agent.md +1 -1
  10. package/src/monorepo/.claude/agents/api-specialist.agent.md +1 -1
  11. package/src/monorepo/.claude/agents/backend-architect.agent.md +1 -1
  12. package/src/monorepo/.claude/agents/documenter.agent.md +1 -1
  13. package/src/monorepo/.claude/agents/factory-approver.agent.md +12 -0
  14. package/src/monorepo/.claude/agents/factory-builder.agent.md +12 -0
  15. package/src/monorepo/.claude/agents/factory-reviewer-code.agent.md +12 -0
  16. package/src/monorepo/.claude/agents/factory-reviewer-security.agent.md +12 -0
  17. package/src/monorepo/.claude/agents/factory-reviewer-ui.agent.md +12 -0
  18. package/src/monorepo/.claude/agents/factory-reviewer-ux.agent.md +12 -0
  19. package/src/monorepo/.claude/agents/factory-spec-writer.agent.md +12 -0
  20. package/src/monorepo/.claude/agents/feature-builder.agent.md +1 -1
  21. package/src/monorepo/.claude/agents/frontend-developer.agent.md +1 -1
  22. package/src/monorepo/.claude/agents/green.agent.md +1 -1
  23. package/src/monorepo/.claude/agents/implementer.agent.md +1 -1
  24. package/src/monorepo/.claude/agents/planner.agent.md +1 -1
  25. package/src/monorepo/.claude/agents/red.agent.md +1 -1
  26. package/src/monorepo/.claude/agents/refactor.agent.md +1 -1
  27. package/src/monorepo/.claude/agents/researcher.agent.md +1 -1
  28. package/src/monorepo/.claude/agents/reviewer.agent.md +1 -1
  29. package/src/monorepo/.claude/agents/tdd.agent.md +1 -1
  30. package/src/monorepo/.claude/agents-snippets/factory-approver.md +72 -0
  31. package/src/monorepo/.claude/agents-snippets/factory-builder.md +101 -0
  32. package/src/monorepo/.claude/agents-snippets/factory-reviewer-code.md +57 -0
  33. package/src/monorepo/.claude/agents-snippets/factory-reviewer-security.md +48 -0
  34. package/src/monorepo/.claude/agents-snippets/factory-reviewer-ui.md +64 -0
  35. package/src/monorepo/.claude/agents-snippets/factory-reviewer-ux.md +64 -0
  36. package/src/monorepo/.claude/agents-snippets/factory-spec-writer.md +119 -0
  37. package/src/monorepo/.claude/agents-snippets/feature-builder.md +1 -1
  38. package/src/monorepo/.claude/commands/assign-tasks.md +1 -0
  39. package/src/monorepo/.claude/commands/factory.md +24 -0
  40. package/src/monorepo/.claude/commands/ponytail-review.md +1 -1
  41. package/src/monorepo/.claude/prompt-snippets/assign-tasks.md +16 -2
  42. package/src/monorepo/.claude/prompt-snippets/bootstrap-patch.md +31 -24
  43. package/src/monorepo/.claude/prompt-snippets/bootstrap-upgrade.md +12 -13
  44. package/src/monorepo/.claude/prompt-snippets/bootstrap.md +30 -21
  45. package/src/monorepo/.claude/prompt-snippets/factory.md +20 -0
  46. package/src/monorepo/.claude/prompt-snippets/implement-feature.md +4 -2
  47. package/src/monorepo/.claude/prompt-snippets/tasks.md +49 -87
  48. package/src/monorepo/.claude/rules-snippets/documentation.md +8 -6
  49. package/src/monorepo/.claude/rules-snippets/subagent-workflow.md +2 -2
  50. package/src/monorepo/.cursor/agents/factory-approver.agent.md +11 -0
  51. package/src/monorepo/.cursor/agents/factory-builder.agent.md +11 -0
  52. package/src/monorepo/.cursor/agents/factory-reviewer-code.agent.md +11 -0
  53. package/src/monorepo/.cursor/agents/factory-reviewer-security.agent.md +11 -0
  54. package/src/monorepo/.cursor/agents/factory-reviewer-ui.agent.md +11 -0
  55. package/src/monorepo/.cursor/agents/factory-reviewer-ux.agent.md +11 -0
  56. package/src/monorepo/.cursor/agents/factory-spec-writer.agent.md +11 -0
  57. package/src/monorepo/.cursor/commands/factory.md +24 -0
  58. package/src/monorepo/.github/agents/factory-approver.agent.md +11 -0
  59. package/src/monorepo/.github/agents/factory-builder.agent.md +11 -0
  60. package/src/monorepo/.github/agents/factory-reviewer-code.agent.md +11 -0
  61. package/src/monorepo/.github/agents/factory-reviewer-security.agent.md +11 -0
  62. package/src/monorepo/.github/agents/factory-reviewer-ui.agent.md +11 -0
  63. package/src/monorepo/.github/agents/factory-reviewer-ux.agent.md +11 -0
  64. package/src/monorepo/.github/agents/factory-spec-writer.agent.md +11 -0
  65. package/src/monorepo/.github/prompts/factory.prompt.md +25 -0
  66. package/src/monorepo/.opencode/agents/admin-portal.md +1 -1
  67. package/src/monorepo/.opencode/agents/api-specialist.md +1 -1
  68. package/src/monorepo/.opencode/agents/backend-architect.md +1 -1
  69. package/src/monorepo/.opencode/agents/documenter.md +1 -1
  70. package/src/monorepo/.opencode/agents/factory-approver.md +20 -0
  71. package/src/monorepo/.opencode/agents/factory-builder.md +20 -0
  72. package/src/monorepo/.opencode/agents/factory-reviewer-code.md +20 -0
  73. package/src/monorepo/.opencode/agents/factory-reviewer-security.md +20 -0
  74. package/src/monorepo/.opencode/agents/factory-reviewer-ui.md +20 -0
  75. package/src/monorepo/.opencode/agents/factory-reviewer-ux.md +20 -0
  76. package/src/monorepo/.opencode/agents/factory-spec-writer.md +20 -0
  77. package/src/monorepo/.opencode/agents/feature-builder.md +1 -1
  78. package/src/monorepo/.opencode/agents/frontend-developer.md +1 -1
  79. package/src/monorepo/.opencode/agents/green.md +1 -1
  80. package/src/monorepo/.opencode/agents/implementer.md +1 -1
  81. package/src/monorepo/.opencode/agents/planner.md +1 -1
  82. package/src/monorepo/.opencode/agents/red.md +1 -1
  83. package/src/monorepo/.opencode/agents/refactor.md +1 -1
  84. package/src/monorepo/.opencode/agents/researcher.md +1 -1
  85. package/src/monorepo/.opencode/agents/reviewer.md +1 -1
  86. package/src/monorepo/.opencode/agents/tdd.md +1 -1
  87. package/src/monorepo/.opencode/commands/assign-tasks.md +1 -1
  88. package/src/monorepo/.opencode/commands/bootstrap-patch.md +1 -1
  89. package/src/monorepo/.opencode/commands/bootstrap-upgrade.md +1 -1
  90. package/src/monorepo/.opencode/commands/bootstrap.md +1 -1
  91. package/src/monorepo/.opencode/commands/commit-push.md +1 -1
  92. package/src/monorepo/.opencode/commands/constitution.md +1 -1
  93. package/src/monorepo/.opencode/commands/create-skill.md +1 -1
  94. package/src/monorepo/.opencode/commands/factory.md +29 -0
  95. package/src/monorepo/.opencode/commands/implement-feature.md +1 -1
  96. package/src/monorepo/.opencode/commands/implement-fixes.md +1 -1
  97. package/src/monorepo/.opencode/commands/implement.md +1 -1
  98. package/src/monorepo/.opencode/commands/plan.md +1 -1
  99. package/src/monorepo/.opencode/commands/playwright-test.md +1 -1
  100. package/src/monorepo/.opencode/commands/ponytail-audit.md +1 -1
  101. package/src/monorepo/.opencode/commands/ponytail-debt.md +1 -1
  102. package/src/monorepo/.opencode/commands/ponytail-gain.md +1 -1
  103. package/src/monorepo/.opencode/commands/ponytail-help.md +1 -1
  104. package/src/monorepo/.opencode/commands/ponytail-review.md +1 -1
  105. package/src/monorepo/.opencode/commands/ponytail.md +1 -1
  106. package/src/monorepo/.opencode/commands/release-notes.md +1 -1
  107. package/src/monorepo/.opencode/commands/review-pr.md +1 -1
  108. package/src/monorepo/.opencode/commands/review.md +1 -1
  109. package/src/monorepo/.opencode/commands/specify.md +1 -1
  110. package/src/monorepo/.opencode/commands/tasks.md +1 -1
  111. package/src/monorepo/.opencode/opencode.jsonc +1 -2
  112. package/src/monorepo/.opencode/rules/agent-conduct.md +1 -1
  113. package/src/monorepo/.opencode/rules/api-server.md +1 -1
  114. package/src/monorepo/.opencode/rules/coding-standards.md +1 -1
  115. package/src/monorepo/.opencode/rules/component-structure.md +1 -1
  116. package/src/monorepo/.opencode/rules/core-libraries.md +1 -1
  117. package/src/monorepo/.opencode/rules/environment-tooling.md +1 -1
  118. package/src/monorepo/.opencode/rules/logging-comments.md +1 -1
  119. package/src/monorepo/.opencode/rules/logging.md +1 -1
  120. package/src/monorepo/.opencode/rules/prisma-migrations.md +1 -1
  121. package/src/monorepo/.opencode/rules/project-context.md +1 -1
  122. package/src/monorepo/.opencode/rules/server-client-separation.md +1 -1
  123. package/src/monorepo/.opencode/rules/subagent-workflow.md +1 -1
  124. package/src/monorepo/.opencode/rules/testing-quality.md +1 -1
  125. package/src/monorepo/.opencode/rules/ui-accessibility.md +1 -1
  126. package/src/monorepo/.opencode/rules/version-control.md +1 -1
  127. package/src/monorepo/.opencode/rules/what-to-avoid.md +1 -1
  128. package/src/monorepo/AGENTS.md +25 -4
  129. package/src/monorepo/README.md +10 -4
  130. package/src/monorepo/factory/README.md +219 -0
  131. package/src/monorepo/factory/_gitignore +5 -0
  132. package/src/monorepo/factory/worktree-bootstrap.md +32 -0
  133. package/src/repo/.agents/skills/factory/SKILL.md +643 -0
  134. package/src/repo/.claude/agents/admin-portal.agent.md +1 -1
  135. package/src/repo/.claude/agents/api-specialist.agent.md +1 -1
  136. package/src/repo/.claude/agents/backend-architect.agent.md +1 -1
  137. package/src/repo/.claude/agents/documenter.agent.md +1 -1
  138. package/src/repo/.claude/agents/factory-approver.agent.md +12 -0
  139. package/src/repo/.claude/agents/factory-builder.agent.md +12 -0
  140. package/src/repo/.claude/agents/factory-reviewer-code.agent.md +12 -0
  141. package/src/repo/.claude/agents/factory-reviewer-security.agent.md +12 -0
  142. package/src/repo/.claude/agents/factory-reviewer-ui.agent.md +12 -0
  143. package/src/repo/.claude/agents/factory-reviewer-ux.agent.md +12 -0
  144. package/src/repo/.claude/agents/factory-spec-writer.agent.md +12 -0
  145. package/src/repo/.claude/agents/feature-builder.agent.md +1 -1
  146. package/src/repo/.claude/agents/frontend-developer.agent.md +1 -1
  147. package/src/repo/.claude/agents/green.agent.md +1 -1
  148. package/src/repo/.claude/agents/implementer.agent.md +1 -1
  149. package/src/repo/.claude/agents/planner.agent.md +1 -1
  150. package/src/repo/.claude/agents/red.agent.md +1 -1
  151. package/src/repo/.claude/agents/refactor.agent.md +1 -1
  152. package/src/repo/.claude/agents/researcher.agent.md +1 -1
  153. package/src/repo/.claude/agents/reviewer.agent.md +1 -1
  154. package/src/repo/.claude/agents/tdd.agent.md +1 -1
  155. package/src/repo/.claude/agents-snippets/factory-approver.md +72 -0
  156. package/src/repo/.claude/agents-snippets/factory-builder.md +100 -0
  157. package/src/repo/.claude/agents-snippets/factory-reviewer-code.md +57 -0
  158. package/src/repo/.claude/agents-snippets/factory-reviewer-security.md +48 -0
  159. package/src/repo/.claude/agents-snippets/factory-reviewer-ui.md +64 -0
  160. package/src/repo/.claude/agents-snippets/factory-reviewer-ux.md +64 -0
  161. package/src/repo/.claude/agents-snippets/factory-spec-writer.md +117 -0
  162. package/src/repo/.claude/agents-snippets/feature-builder.md +1 -1
  163. package/src/repo/.claude/commands/assign-tasks.md +1 -0
  164. package/src/repo/.claude/commands/factory.md +24 -0
  165. package/src/repo/.claude/commands/ponytail-review.md +1 -1
  166. package/src/repo/.claude/prompt-snippets/assign-tasks.md +16 -2
  167. package/src/repo/.claude/prompt-snippets/bootstrap-patch.md +31 -24
  168. package/src/repo/.claude/prompt-snippets/bootstrap-upgrade.md +16 -16
  169. package/src/repo/.claude/prompt-snippets/bootstrap.md +38 -28
  170. package/src/repo/.claude/prompt-snippets/factory.md +20 -0
  171. package/src/repo/.claude/prompt-snippets/implement-feature.md +4 -2
  172. package/src/repo/.claude/prompt-snippets/tasks.md +49 -112
  173. package/src/repo/.claude/rules-snippets/subagent-workflow.md +2 -2
  174. package/src/repo/.cursor/agents/factory-approver.agent.md +11 -0
  175. package/src/repo/.cursor/agents/factory-builder.agent.md +11 -0
  176. package/src/repo/.cursor/agents/factory-reviewer-code.agent.md +11 -0
  177. package/src/repo/.cursor/agents/factory-reviewer-security.agent.md +11 -0
  178. package/src/repo/.cursor/agents/factory-reviewer-ui.agent.md +11 -0
  179. package/src/repo/.cursor/agents/factory-reviewer-ux.agent.md +11 -0
  180. package/src/repo/.cursor/agents/factory-spec-writer.agent.md +11 -0
  181. package/src/repo/.cursor/commands/factory.md +24 -0
  182. package/src/repo/.github/agents/factory-approver.agent.md +11 -0
  183. package/src/repo/.github/agents/factory-builder.agent.md +11 -0
  184. package/src/repo/.github/agents/factory-reviewer-code.agent.md +11 -0
  185. package/src/repo/.github/agents/factory-reviewer-security.agent.md +11 -0
  186. package/src/repo/.github/agents/factory-reviewer-ui.agent.md +11 -0
  187. package/src/repo/.github/agents/factory-reviewer-ux.agent.md +11 -0
  188. package/src/repo/.github/agents/factory-spec-writer.agent.md +11 -0
  189. package/src/repo/.github/prompts/factory.prompt.md +25 -0
  190. package/src/repo/.opencode/agents/admin-portal.md +1 -1
  191. package/src/repo/.opencode/agents/api-specialist.md +1 -1
  192. package/src/repo/.opencode/agents/backend-architect.md +1 -1
  193. package/src/repo/.opencode/agents/documenter.md +1 -1
  194. package/src/repo/.opencode/agents/factory-approver.md +20 -0
  195. package/src/repo/.opencode/agents/factory-builder.md +20 -0
  196. package/src/repo/.opencode/agents/factory-reviewer-code.md +20 -0
  197. package/src/repo/.opencode/agents/factory-reviewer-security.md +20 -0
  198. package/src/repo/.opencode/agents/factory-reviewer-ui.md +20 -0
  199. package/src/repo/.opencode/agents/factory-reviewer-ux.md +20 -0
  200. package/src/repo/.opencode/agents/factory-spec-writer.md +20 -0
  201. package/src/repo/.opencode/agents/feature-builder.md +1 -1
  202. package/src/repo/.opencode/agents/frontend-developer.md +1 -1
  203. package/src/repo/.opencode/agents/green.md +1 -1
  204. package/src/repo/.opencode/agents/implementer.md +1 -1
  205. package/src/repo/.opencode/agents/planner.md +1 -1
  206. package/src/repo/.opencode/agents/red.md +1 -1
  207. package/src/repo/.opencode/agents/refactor.md +1 -1
  208. package/src/repo/.opencode/agents/researcher.md +1 -1
  209. package/src/repo/.opencode/agents/reviewer.md +1 -1
  210. package/src/repo/.opencode/agents/tdd.md +1 -1
  211. package/src/repo/.opencode/commands/assign-tasks.md +1 -1
  212. package/src/repo/.opencode/commands/bootstrap-patch.md +1 -1
  213. package/src/repo/.opencode/commands/bootstrap-upgrade.md +1 -1
  214. package/src/repo/.opencode/commands/bootstrap.md +1 -1
  215. package/src/repo/.opencode/commands/commit-push.md +1 -1
  216. package/src/repo/.opencode/commands/constitution.md +1 -1
  217. package/src/repo/.opencode/commands/create-skill.md +1 -1
  218. package/src/repo/.opencode/commands/factory.md +29 -0
  219. package/src/repo/.opencode/commands/implement-feature.md +1 -1
  220. package/src/repo/.opencode/commands/implement-fixes.md +1 -1
  221. package/src/repo/.opencode/commands/implement.md +1 -1
  222. package/src/repo/.opencode/commands/plan.md +1 -1
  223. package/src/repo/.opencode/commands/playwright-test.md +1 -1
  224. package/src/repo/.opencode/commands/ponytail-audit.md +1 -1
  225. package/src/repo/.opencode/commands/ponytail-debt.md +1 -1
  226. package/src/repo/.opencode/commands/ponytail-gain.md +1 -1
  227. package/src/repo/.opencode/commands/ponytail-help.md +1 -1
  228. package/src/repo/.opencode/commands/ponytail-review.md +1 -1
  229. package/src/repo/.opencode/commands/ponytail.md +1 -1
  230. package/src/repo/.opencode/commands/release-notes.md +1 -1
  231. package/src/repo/.opencode/commands/review-pr.md +1 -1
  232. package/src/repo/.opencode/commands/review.md +1 -1
  233. package/src/repo/.opencode/commands/specify.md +1 -1
  234. package/src/repo/.opencode/commands/tasks.md +1 -1
  235. package/src/repo/.opencode/opencode.jsonc +1 -2
  236. package/src/repo/.opencode/rules/agent-conduct.md +1 -1
  237. package/src/repo/.opencode/rules/api-server.md +1 -1
  238. package/src/repo/.opencode/rules/coding-standards.md +1 -1
  239. package/src/repo/.opencode/rules/component-structure.md +1 -1
  240. package/src/repo/.opencode/rules/core-libraries.md +1 -1
  241. package/src/repo/.opencode/rules/environment-tooling.md +1 -1
  242. package/src/repo/.opencode/rules/logging-comments.md +1 -1
  243. package/src/repo/.opencode/rules/logging.md +1 -1
  244. package/src/repo/.opencode/rules/prisma-migrations.md +1 -1
  245. package/src/repo/.opencode/rules/project-context.md +1 -1
  246. package/src/repo/.opencode/rules/server-client-separation.md +1 -1
  247. package/src/repo/.opencode/rules/subagent-workflow.md +1 -1
  248. package/src/repo/.opencode/rules/testing-quality.md +1 -1
  249. package/src/repo/.opencode/rules/ui-accessibility.md +1 -1
  250. package/src/repo/.opencode/rules/version-control.md +1 -1
  251. package/src/repo/.opencode/rules/what-to-avoid.md +1 -1
  252. package/src/repo/AGENTS.md +22 -4
  253. package/src/repo/README.md +10 -4
  254. package/src/repo/factory/README.md +213 -0
  255. package/src/repo/factory/_gitignore +5 -0
  256. package/src/repo/factory/worktree-bootstrap.md +32 -0
@@ -0,0 +1,213 @@
1
+ # Factory (opt-in)
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 feature folders (see Feature folders), and job state lives here in `factory/jobs/`.
4
+
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
+
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).
8
+
9
+ ## Install
10
+
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). 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 `.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 the feature folders are committed with the code.
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
+
17
+ ## Placeholders
18
+
19
+ | Placeholder | Meaning | Default |
20
+ | --- | --- | --- |
21
+ | DEFAULT_BRANCH | Branch jobs start from and merge into | `main` |
22
+ | FACTORY_PORT_BASE | Base dev-server port. Job `n` uses builder `base + 10n`, ux `+1`, ui `+2` | `5100` |
23
+ | APPROVAL_MODE | `human`: stop at `awaiting-human` for `/factory approve`. `auto`: merge on `APPROVE` | `human` |
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 | `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` |
27
+
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.
29
+
30
+ ## Invocations
31
+
32
+ | Command | What it does |
33
+ | --- | --- |
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 |
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) |
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 |
37
+ | `/factory rework <job-id> <note>` | Start a fresh builder with your note and a fresh retry budget |
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 |
39
+ | `/factory status [--all]` | Summarize open jobs from their `job.json` files. Closed jobs are hidden unless `--all` |
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` |
41
+ | `/factory archive [--all] [--dry-run]` | Move closed jobs to `factory/archive/`. Open jobs never move. See [Archive](#archive) |
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) |
43
+
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).
45
+
46
+ There is no queue. Start each feature with a request, a ticket key, or a slug.
47
+
48
+ ## Harnesses
49
+
50
+ 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/`.
51
+
52
+ | Harness | Entry point | Agent wrappers |
53
+ | --- | --- | --- |
54
+ | Claude Code | `/factory` (`.claude/commands/factory.md`) | `.claude/agents/` |
55
+ | GitHub Copilot | `/factory` prompt (`.github/prompts/factory.prompt.md`) | `.github/agents/` |
56
+ | Cursor | `/factory` (`.cursor/commands/factory.md`) | `.cursor/agents/` |
57
+ | OpenCode | `/factory` (`.opencode/commands/factory.md`) | `.opencode/agents/` |
58
+ | 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) |
59
+
60
+ ## Feature folders and sizing
61
+
62
+ Each job belongs to a feature folder, `docs/features/<KEY>-<slug>/` (or `docs/features/<slug>/` before a ticket exists). 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:
63
+
64
+ ```
65
+ - [ ] T1 <one-line task> [P] — PROJ-1235
66
+ ```
67
+
68
+ Sizing is decided in `plan.md`:
69
+
70
+ - **Small** (one or two steps): `spec.md` and `plan.md` only, no tickets.
71
+ - **Large**: `tasks.md` plus tickets, when your `AGENTS.md` documents a project management tool. Otherwise `tasks.md` only.
72
+ - **Unclear**: the orchestrator asks you at the plan gate.
73
+
74
+ ## Gates
75
+
76
+ Every job stops twice, in every approval mode, before anything is ticketed or built:
77
+
78
+ 1. **Spec gate** (`awaiting-spec`). You read the spec summary, the acceptance criteria count, each open `[PRODUCT DECISION]` item, and open questions. Answer every open decision before you confirm: answers go in your change request, are saved as `spec-<k>.md`, and the spec writer records each one as `[DECIDED]`.
79
+ 2. **Plan gate** (`awaiting-plan`). You read the plan, the tasks, the size, the tracking proposal, and the build mode. Confirm, request changes (saved as `plan-<k>.md`), or change size, tracking, or build mode. Requests that touch the spec go back through the spec gate.
80
+
81
+ Session ended at a gate? `/factory start <job-id | slug | KEY>` shows that gate again. A job whose build has started resumes without the prompt. A job that stopped before its build because a spec or plan step failed reruns that step with `/factory start <job-id>`.
82
+
83
+ ## Approval modes
84
+
85
+ - **`human`** (default). An approved job stops at `awaiting-human`. Read the branch and `qa.md`, then run `/factory approve <job-id>`.
86
+ - **`auto`**. An approved job merges automatically. The approver still escalates anything touching auth, payments, data security, deployment, migrations, email, production data, new dependencies, or unresolved product decisions. Its tickets stay In Review until you run `/factory approve <job-id>`, which then moves them to Done.
87
+
88
+ Any value other than exactly `auto` is treated as `human`.
89
+
90
+ ## Build location
91
+
92
+ 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`.
93
+
94
+ ### Worktree bootstrap
95
+
96
+ 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`.
97
+
98
+ 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.
99
+
100
+ ### In-place builds
101
+
102
+ 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>`.
103
+
104
+ - 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.
105
+ - While the job is open, the main checkout stays on `factory/<id>`. Do not switch it until the job is merged or abandoned.
106
+ - 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.
107
+ - The merge switches the main checkout back to the default branch and removes only the branch, not a worktree.
108
+ - 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.
109
+
110
+ ## Merge modes
111
+
112
+ Set `MERGE_MODE`. The approval gates are the same in both modes.
113
+
114
+ - **`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.
115
+ - **`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.
116
+
117
+ `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.
118
+
119
+ ## Suggested checks (`qa.md`)
120
+
121
+ 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.
122
+
123
+ ## Tickets
124
+
125
+ When a job is tracked, its tickets follow it:
126
+
127
+ | Job event | Tickets |
128
+ | --- | --- |
129
+ | Build starts | In Progress |
130
+ | Review starts | In Review |
131
+ | The merge completes: the local merge, or a `push-mr` request merged and finished with approve | Done |
132
+ | Job abandoned | Left as they are |
133
+
134
+ 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.
135
+
136
+ ## How a job runs
137
+
138
+ 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.
139
+ 2. **Spec.** `factory-spec-writer` inspects the code and writes `spec.md` with numbered acceptance criteria.
140
+ 3. **Spec gate.** You confirm the spec, or request changes.
141
+ 4. **Plan.** `factory-spec-writer` in plan mode writes `plan.md` (with the size) and `tasks.md` for large work.
142
+ 5. **Plan gate.** You confirm the plan, or request changes. Nothing is ticketed or built before you confirm.
143
+ 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.
144
+ 7. **Build.** The builder follows TDD, ticks `tasks.md` as it completes tasks, writes `build.md`, and writes `qa.md`.
145
+ 8. **Review.** Every configured lens reviews the branch, writing `round-N/review-<lens>.md` with `VERDICT: PASS` or `VERDICT: CHANGES`.
146
+ 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.
147
+ 10. **Approve.** `factory-approver` writes `decision.md` with `APPROVE` or `ESCALATE`.
148
+ 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 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.
149
+
150
+ Jobs that escalate (`needs-human`) keep their branch and worktree so you can inspect them. Use `/factory rework` or `/factory approve` to continue.
151
+
152
+ ## Abandon
153
+
154
+ `/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.
155
+
156
+ ## Archive
157
+
158
+ `/factory archive [--all] [--dry-run]` moves closed jobs (`merged` or `abandoned`) from `factory/jobs/` to `factory/archive/`. Open jobs never move. `npx nitm-ai-dev-toolkit factory archive` makes the same moves on its own. `/factory archive` runs it, then handles branches.
159
+
160
+ - By default, only jobs last updated more than 7 days ago move. `--all` moves every closed job.
161
+ - `--dry-run` lists what would move and moves nothing.
162
+ - Archived jobs cannot be resumed. `/factory start <archived-id>` says the job is closed. Their ids still count, so new job ids never repeat until a prune removes them.
163
+ - For each archived abandoned job whose branch still exists, the orchestrator asks once whether to delete the branch and its worktree. Nothing is deleted without your yes. Branches of merged jobs are only listed.
164
+
165
+ ## Prune
166
+
167
+ `/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.
168
+
169
+ 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).
170
+
171
+ ## Layout
172
+
173
+ ```
174
+ <feature root>/ tracked by the project (roots: FACTORY_FEATURE_PATHS)
175
+ <KEY>-<slug>/
176
+ spec.md
177
+ plan.md
178
+ tasks.md large work only
179
+ qa.md builder, on the branch: suggested checks (not a gate)
180
+ factory/
181
+ README.md this file
182
+ .gitignore ignores jobs/ and archive/
183
+ worktree-bootstrap.md setup steps run in each new worktree (edit for your project)
184
+ jobs/ runtime state (ignored by git)
185
+ <NNN-slug>/
186
+ job.json stage, round, reviews, size, tracking, worktree, mr, failed_stage, approval mode
187
+ intake.md intake questions and answers (only when asked)
188
+ spec-<k>.md after a change request at the spec gate
189
+ plan-<k>.md after a change request at the plan gate
190
+ build.md
191
+ round-<N>/review-<lens>.md
192
+ decision.md
193
+ merge-conflict.md after a merge conflict; blocks approve
194
+ bootstrap.md after a failed worktree bootstrap step; blocks the build
195
+ rework-<k>.md
196
+ main-copies/ feature docs moved aside at merge
197
+ archive/ closed jobs moved by /factory archive (ignored by git)
198
+ <NNN-slug>/ same layout as jobs/; never resumed
199
+ ```
200
+
201
+ Job folders are ignored by git. They are working state, not history. Copy one out if you want an audit trail.
202
+
203
+ Stages, in order: `spec`, `awaiting-spec`, `plan`, `awaiting-plan`, `build`, `review`, `approve`, `awaiting-human`, `merged`, `needs-human`. `abandoned` closes a job from any open stage.
204
+
205
+ ## Limitations
206
+
207
+ - **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.
208
+ - **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).
209
+ - **Local merge by default.** `local` never pushes. `push-mr` pushes only on approve, and only the `factory/<id>` branch. Force-push is never used.
210
+ - **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.
211
+ - **UI lenses need a browser.** Without one they cannot verify anything and the job escalates.
212
+ - **Tickets are best-effort.** Creation failures stop at the plan gate. Transition failures are recorded and reported.
213
+ - **Live status:** run `npx nitm-ai-dev-toolkit factory watch` (live) or `factory status` (one-shot). Both read `jobs/*/job.json` from disk and hide closed jobs unless `--all` is passed. `factory archive` moves closed jobs, and `factory prune` deletes them. Nothing else changes files.
@@ -0,0 +1,5 @@
1
+ # Factory runtime state: job folders, job.json, and reviews.
2
+ # Working state, not history. README.md stays tracked.
3
+ jobs/
4
+ # Closed jobs moved by /factory archive. Same contents as jobs/.
5
+ archive/
@@ -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
+ ```