nitm-ai-dev-toolkit 3.0.23 → 5.0.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 (187) hide show
  1. package/CHANGELOG.md +44 -3
  2. package/README.md +93 -6
  3. package/bin/cli.js +155 -25
  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 +593 -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/factory.md +24 -0
  39. package/src/monorepo/.claude/commands/ponytail-audit.md +4 -6
  40. package/src/monorepo/.claude/commands/ponytail-debt.md +3 -5
  41. package/src/monorepo/.claude/commands/ponytail-gain.md +2 -4
  42. package/src/monorepo/.claude/commands/ponytail-help.md +2 -4
  43. package/src/monorepo/.claude/commands/ponytail-review.md +3 -5
  44. package/src/monorepo/.claude/commands/ponytail.md +3 -5
  45. package/src/monorepo/.claude/prompt-snippets/assign-tasks.md +6 -2
  46. package/src/monorepo/.claude/prompt-snippets/bootstrap-patch.md +32 -17
  47. package/src/monorepo/.claude/prompt-snippets/bootstrap-upgrade.md +76 -51
  48. package/src/monorepo/.claude/prompt-snippets/bootstrap.md +57 -29
  49. package/src/monorepo/.claude/prompt-snippets/factory.md +20 -0
  50. package/src/monorepo/.claude/prompt-snippets/implement-feature.md +2 -2
  51. package/src/monorepo/.claude/prompt-snippets/tasks.md +49 -87
  52. package/src/monorepo/.claude/rules-snippets/documentation.md +8 -6
  53. package/src/monorepo/.cursor/agents/factory-approver.agent.md +11 -0
  54. package/src/monorepo/.cursor/agents/factory-builder.agent.md +11 -0
  55. package/src/monorepo/.cursor/agents/factory-reviewer-code.agent.md +11 -0
  56. package/src/monorepo/.cursor/agents/factory-reviewer-security.agent.md +11 -0
  57. package/src/monorepo/.cursor/agents/factory-reviewer-ui.agent.md +11 -0
  58. package/src/monorepo/.cursor/agents/factory-reviewer-ux.agent.md +11 -0
  59. package/src/monorepo/.cursor/agents/factory-spec-writer.agent.md +11 -0
  60. package/src/monorepo/.cursor/commands/factory.md +24 -0
  61. package/src/monorepo/.github/agents/factory-approver.agent.md +11 -0
  62. package/src/monorepo/.github/agents/factory-builder.agent.md +11 -0
  63. package/src/monorepo/.github/agents/factory-reviewer-code.agent.md +11 -0
  64. package/src/monorepo/.github/agents/factory-reviewer-security.agent.md +11 -0
  65. package/src/monorepo/.github/agents/factory-reviewer-ui.agent.md +11 -0
  66. package/src/monorepo/.github/agents/factory-reviewer-ux.agent.md +11 -0
  67. package/src/monorepo/.github/agents/factory-spec-writer.agent.md +11 -0
  68. package/src/monorepo/.github/prompts/factory.prompt.md +25 -0
  69. package/src/monorepo/.github/prompts/review-staged.prompt.md +1 -1
  70. package/src/monorepo/.opencode/agents/admin-portal.md +10 -4
  71. package/src/monorepo/.opencode/agents/api-specialist.md +10 -4
  72. package/src/monorepo/.opencode/agents/backend-architect.md +10 -4
  73. package/src/monorepo/.opencode/agents/documenter.md +10 -4
  74. package/src/monorepo/.opencode/agents/factory-approver.md +20 -0
  75. package/src/monorepo/.opencode/agents/factory-builder.md +20 -0
  76. package/src/monorepo/.opencode/agents/factory-reviewer-code.md +20 -0
  77. package/src/monorepo/.opencode/agents/factory-reviewer-security.md +20 -0
  78. package/src/monorepo/.opencode/agents/factory-reviewer-ui.md +20 -0
  79. package/src/monorepo/.opencode/agents/factory-reviewer-ux.md +20 -0
  80. package/src/monorepo/.opencode/agents/factory-spec-writer.md +20 -0
  81. package/src/monorepo/.opencode/agents/feature-builder.md +13 -5
  82. package/src/monorepo/.opencode/agents/frontend-developer.md +10 -4
  83. package/src/monorepo/.opencode/agents/green.md +10 -4
  84. package/src/monorepo/.opencode/agents/implementer.md +10 -4
  85. package/src/monorepo/.opencode/agents/planner.md +10 -4
  86. package/src/monorepo/.opencode/agents/red.md +10 -4
  87. package/src/monorepo/.opencode/agents/refactor.md +10 -4
  88. package/src/monorepo/.opencode/agents/researcher.md +10 -4
  89. package/src/monorepo/.opencode/agents/reviewer.md +10 -4
  90. package/src/monorepo/.opencode/agents/tdd.md +13 -5
  91. package/src/monorepo/.opencode/commands/factory.md +29 -0
  92. package/src/monorepo/.opencode/opencode.jsonc +8 -10
  93. package/src/monorepo/AGENTS.md +30 -1
  94. package/src/monorepo/CLAUDE.md +1 -1
  95. package/src/monorepo/README.md +20 -0
  96. package/src/monorepo/factory/README.md +194 -0
  97. package/src/monorepo/factory/_gitignore +5 -0
  98. package/src/repo/.agents/skills/factory/SKILL.md +593 -0
  99. package/src/repo/.claude/agents/admin-portal.agent.md +1 -1
  100. package/src/repo/.claude/agents/api-specialist.agent.md +1 -1
  101. package/src/repo/.claude/agents/backend-architect.agent.md +1 -1
  102. package/src/repo/.claude/agents/documenter.agent.md +2 -2
  103. package/src/repo/.claude/agents/factory-approver.agent.md +12 -0
  104. package/src/repo/.claude/agents/factory-builder.agent.md +12 -0
  105. package/src/repo/.claude/agents/factory-reviewer-code.agent.md +12 -0
  106. package/src/repo/.claude/agents/factory-reviewer-security.agent.md +12 -0
  107. package/src/repo/.claude/agents/factory-reviewer-ui.agent.md +12 -0
  108. package/src/repo/.claude/agents/factory-reviewer-ux.agent.md +12 -0
  109. package/src/repo/.claude/agents/factory-spec-writer.agent.md +12 -0
  110. package/src/repo/.claude/agents/feature-builder.agent.md +1 -1
  111. package/src/repo/.claude/agents/frontend-developer.agent.md +1 -1
  112. package/src/repo/.claude/agents/green.agent.md +1 -1
  113. package/src/repo/.claude/agents/implementer.agent.md +1 -1
  114. package/src/repo/.claude/agents/planner.agent.md +2 -2
  115. package/src/repo/.claude/agents/red.agent.md +1 -1
  116. package/src/repo/.claude/agents/refactor.agent.md +1 -1
  117. package/src/repo/.claude/agents/researcher.agent.md +2 -2
  118. package/src/repo/.claude/agents/reviewer.agent.md +2 -2
  119. package/src/repo/.claude/agents/tdd.agent.md +1 -1
  120. package/src/repo/.claude/agents-snippets/factory-approver.md +72 -0
  121. package/src/repo/.claude/agents-snippets/factory-builder.md +100 -0
  122. package/src/repo/.claude/agents-snippets/factory-reviewer-code.md +57 -0
  123. package/src/repo/.claude/agents-snippets/factory-reviewer-security.md +48 -0
  124. package/src/repo/.claude/agents-snippets/factory-reviewer-ui.md +64 -0
  125. package/src/repo/.claude/agents-snippets/factory-reviewer-ux.md +64 -0
  126. package/src/repo/.claude/agents-snippets/factory-spec-writer.md +117 -0
  127. package/src/repo/.claude/agents-snippets/feature-builder.md +1 -1
  128. package/src/repo/.claude/commands/factory.md +24 -0
  129. package/src/repo/.claude/commands/ponytail-audit.md +4 -6
  130. package/src/repo/.claude/commands/ponytail-debt.md +3 -5
  131. package/src/repo/.claude/commands/ponytail-gain.md +2 -4
  132. package/src/repo/.claude/commands/ponytail-help.md +2 -4
  133. package/src/repo/.claude/commands/ponytail-review.md +3 -5
  134. package/src/repo/.claude/commands/ponytail.md +3 -5
  135. package/src/repo/.claude/prompt-snippets/assign-tasks.md +6 -2
  136. package/src/repo/.claude/prompt-snippets/bootstrap-patch.md +32 -17
  137. package/src/repo/.claude/prompt-snippets/bootstrap-upgrade.md +87 -77
  138. package/src/repo/.claude/prompt-snippets/bootstrap.md +71 -74
  139. package/src/repo/.claude/prompt-snippets/factory.md +20 -0
  140. package/src/repo/.claude/prompt-snippets/implement-feature.md +2 -2
  141. package/src/repo/.claude/prompt-snippets/tasks.md +49 -112
  142. package/src/repo/.cursor/agents/factory-approver.agent.md +11 -0
  143. package/src/repo/.cursor/agents/factory-builder.agent.md +11 -0
  144. package/src/repo/.cursor/agents/factory-reviewer-code.agent.md +11 -0
  145. package/src/repo/.cursor/agents/factory-reviewer-security.agent.md +11 -0
  146. package/src/repo/.cursor/agents/factory-reviewer-ui.agent.md +11 -0
  147. package/src/repo/.cursor/agents/factory-reviewer-ux.agent.md +11 -0
  148. package/src/repo/.cursor/agents/factory-spec-writer.agent.md +11 -0
  149. package/src/repo/.cursor/commands/factory.md +24 -0
  150. package/src/repo/.github/agents/factory-approver.agent.md +11 -0
  151. package/src/repo/.github/agents/factory-builder.agent.md +11 -0
  152. package/src/repo/.github/agents/factory-reviewer-code.agent.md +11 -0
  153. package/src/repo/.github/agents/factory-reviewer-security.agent.md +11 -0
  154. package/src/repo/.github/agents/factory-reviewer-ui.agent.md +11 -0
  155. package/src/repo/.github/agents/factory-reviewer-ux.agent.md +11 -0
  156. package/src/repo/.github/agents/factory-spec-writer.agent.md +11 -0
  157. package/src/repo/.github/prompts/factory.prompt.md +25 -0
  158. package/src/repo/.opencode/agents/admin-portal.md +10 -4
  159. package/src/repo/.opencode/agents/api-specialist.md +10 -4
  160. package/src/repo/.opencode/agents/backend-architect.md +10 -4
  161. package/src/repo/.opencode/agents/documenter.md +10 -4
  162. package/src/repo/.opencode/agents/factory-approver.md +20 -0
  163. package/src/repo/.opencode/agents/factory-builder.md +20 -0
  164. package/src/repo/.opencode/agents/factory-reviewer-code.md +20 -0
  165. package/src/repo/.opencode/agents/factory-reviewer-security.md +20 -0
  166. package/src/repo/.opencode/agents/factory-reviewer-ui.md +20 -0
  167. package/src/repo/.opencode/agents/factory-reviewer-ux.md +20 -0
  168. package/src/repo/.opencode/agents/factory-spec-writer.md +20 -0
  169. package/src/repo/.opencode/agents/feature-builder.md +13 -5
  170. package/src/repo/.opencode/agents/frontend-developer.md +10 -4
  171. package/src/repo/.opencode/agents/green.md +10 -4
  172. package/src/repo/.opencode/agents/implementer.md +10 -4
  173. package/src/repo/.opencode/agents/planner.md +10 -4
  174. package/src/repo/.opencode/agents/red.md +10 -4
  175. package/src/repo/.opencode/agents/refactor.md +10 -4
  176. package/src/repo/.opencode/agents/researcher.md +10 -4
  177. package/src/repo/.opencode/agents/reviewer.md +10 -4
  178. package/src/repo/.opencode/agents/tdd.md +13 -5
  179. package/src/repo/.opencode/commands/factory.md +29 -0
  180. package/src/repo/.opencode/opencode.jsonc +8 -10
  181. package/src/repo/AGENTS.md +27 -1
  182. package/src/repo/CLAUDE.md +1 -1
  183. package/src/repo/README.md +20 -0
  184. package/src/repo/factory/README.md +194 -0
  185. package/src/repo/factory/_gitignore +5 -0
  186. package/src/monorepo/.opencode/plugins/ponytail.mjs +0 -93
  187. package/src/repo/.opencode/plugins/ponytail.mjs +0 -93
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: "Review a factory job's feature at its build location for flows, states, copy, accessibility, and mobile, without signing in or writing to real services. Dispatched by the factory orchestrator."
3
+ mode: subagent
4
+ request:
5
+ body:
6
+ temperature: 0.1
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: allow
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
14
+ ---
15
+
16
+ # Factory Reviewer (UX) Agent
17
+
18
+ Review a factory job's feature at its build location for flows, states, copy, accessibility, and mobile, without signing in or writing to real services.
19
+
20
+ @.claude/agents-snippets/factory-reviewer-ux.md
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: "Write a testable spec.md for a factory job from a feature request, after inspecting the real code. Dispatched by the factory orchestrator."
3
+ mode: subagent
4
+ request:
5
+ body:
6
+ temperature: 0.1
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: allow
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
14
+ ---
15
+
16
+ # Factory Spec Writer Agent
17
+
18
+ Write a testable spec.md for a factory job from a feature request, after inspecting the real code.
19
+
20
+ @.claude/agents-snippets/factory-spec-writer.md
@@ -1,11 +1,19 @@
1
1
  ---
2
2
  description: "Coordinate end-to-end feature development using subagents for planning, implementation, and review. Orchestrates the full development lifecycle."
3
3
  mode: subagent
4
- temperature: 0.3
5
- permission:
6
- edit: allow
7
- bash: allow
8
- task: allow
4
+ request:
5
+ body:
6
+ temperature: 0.3
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: allow
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
14
+ - action: subagent
15
+ resource: "*"
16
+ effect: allow
9
17
  ---
10
18
 
11
19
  # Feature Builder — Coordinator
@@ -1,10 +1,16 @@
1
1
  ---
2
2
  description: "Build user interfaces, implement components, handle state management, and optimize frontend performance. Use for responsive, accessible, and performant web applications."
3
3
  mode: subagent
4
- temperature: 0.1
5
- permission:
6
- edit: allow
7
- bash: allow
4
+ request:
5
+ body:
6
+ temperature: 0.1
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: allow
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
8
14
  ---
9
15
 
10
16
  # Frontend Developer
@@ -1,10 +1,16 @@
1
1
  ---
2
2
  description: "Write minimal code to make failing tests pass. Part of the TDD red-green-refactor cycle."
3
3
  mode: subagent
4
- temperature: 0.1
5
- permission:
6
- edit: allow
7
- bash: allow
4
+ request:
5
+ body:
6
+ temperature: 0.1
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: allow
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
8
14
  ---
9
15
 
10
16
  # Green Agent (TDD — Make Tests Pass)
@@ -1,10 +1,16 @@
1
1
  ---
2
2
  description: "Implement code changes for a specific task. Follow TDD, write tests alongside code, and self-review before reporting completion."
3
3
  mode: subagent
4
- temperature: 0.1
5
- permission:
6
- edit: allow
7
- bash: allow
4
+ request:
5
+ body:
6
+ temperature: 0.1
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: allow
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
8
14
  ---
9
15
 
10
16
  # Implementer Agent
@@ -1,10 +1,16 @@
1
1
  ---
2
2
  description: "Break down feature requests into implementation tasks. Read specifications, analyze codebase patterns, and produce structured plans with dependencies."
3
3
  mode: subagent
4
- temperature: 0.1
5
- permission:
6
- edit: allow
7
- bash: allow
4
+ request:
5
+ body:
6
+ temperature: 0.1
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: allow
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
8
14
  ---
9
15
 
10
16
  # Planner Agent
@@ -1,10 +1,16 @@
1
1
  ---
2
2
  description: "Write failing tests that define expected behavior. Part of the TDD red-green-refactor cycle."
3
3
  mode: subagent
4
- temperature: 0.1
5
- permission:
6
- edit: allow
7
- bash: allow
4
+ request:
5
+ body:
6
+ temperature: 0.1
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: allow
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
8
14
  ---
9
15
 
10
16
  # Red Agent (TDD — Write Failing Tests)
@@ -1,10 +1,16 @@
1
1
  ---
2
2
  description: "Improve code quality and structure while keeping all tests passing. Part of the TDD red-green-refactor cycle."
3
3
  mode: subagent
4
- temperature: 0.1
5
- permission:
6
- edit: allow
7
- bash: allow
4
+ request:
5
+ body:
6
+ temperature: 0.1
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: allow
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
8
14
  ---
9
15
 
10
16
  # Refactor Agent (TDD — Improve Code Quality)
@@ -1,10 +1,16 @@
1
1
  ---
2
2
  description: "Research codebase patterns, dependencies, and technical context. Analyze code structure, find relevant examples, and report findings without making changes."
3
3
  mode: subagent
4
- temperature: 0.1
5
- permission:
6
- edit: deny
7
- bash: deny
4
+ request:
5
+ body:
6
+ temperature: 0.1
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: deny
11
+ - action: shell
12
+ resource: "*"
13
+ effect: deny
8
14
  ---
9
15
 
10
16
  # Researcher Agent
@@ -1,10 +1,16 @@
1
1
  ---
2
2
  description: "Review code changes for correctness, code quality, security, and adherence to project patterns. Provide actionable feedback with specific file and line references. Use immediately after writing or modifying code, or as a quality gate in orchestrated workflows."
3
3
  mode: subagent
4
- temperature: 0.1
5
- permission:
6
- edit: deny
7
- bash: allow
4
+ request:
5
+ body:
6
+ temperature: 0.1
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: deny
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
8
14
  ---
9
15
 
10
16
  # Reviewer Agent
@@ -1,11 +1,19 @@
1
1
  ---
2
2
  description: "Implement a feature using test-driven development with red-green-refactor cycle. Coordinates specialized subagents for writing failing tests, implementing code, and refactoring."
3
3
  mode: subagent
4
- temperature: 0.3
5
- permission:
6
- edit: allow
7
- bash: allow
8
- task: allow
4
+ request:
5
+ body:
6
+ temperature: 0.3
7
+ permissions:
8
+ - action: edit
9
+ resource: "*"
10
+ effect: allow
11
+ - action: shell
12
+ resource: "*"
13
+ effect: allow
14
+ - action: subagent
15
+ resource: "*"
16
+ effect: allow
9
17
  ---
10
18
 
11
19
  # TDD Coordinator Agent
@@ -0,0 +1,29 @@
1
+ ---
2
+ description: "Run an opt-in factory job: intake, spec and plan gates, build in a worktree or in place, reviews, approval, local merge"
3
+ ---
4
+
5
+ # Factory
6
+
7
+ ## Agent Dispatch
8
+
9
+ > **Run in the main session.** The orchestrator dispatches these agents; they cannot dispatch others.
10
+
11
+ | Agent | When to use |
12
+ |-------|-------------|
13
+ | `factory-spec-writer` | Spec stage (`spec` mode) writes `spec.md`; plan stage (`plan` mode) writes `plan.md` and `tasks.md` |
14
+ | `factory-builder` | Build, repair, and rework: writes `build.md` in the job folder; edits code at the build location |
15
+ | `factory-reviewer-code` | Review round, `code` lens |
16
+ | `factory-reviewer-security` | Review round, `security` lens |
17
+ | `factory-reviewer-ux` | Review round, `ux` lens (opt-in) |
18
+ | `factory-reviewer-ui` | Review round, `ui` lens (opt-in) |
19
+ | `factory-approver` | Approval gate: writes `decision.md` |
20
+
21
+ Dispatch each agent by its kebab-case name, as in the first column. Copilot may show a display name; pick the agent with that name.
22
+
23
+ ## Arguments
24
+
25
+ Subcommands: `[--in-place] <feature request>` · `start [--in-place] <request | KEY | slug | job-id>` · `approve <job-id>` · `rework <job-id> <note>` · `abandon <job-id>` · `status [--all]` · `watch [--all]` · `archive [--all] [--dry-run]` · `prune [--all] [--abandoned] [--dry-run]`
26
+
27
+ $ARGUMENTS
28
+
29
+ @.claude/prompt-snippets/factory.md
@@ -5,17 +5,15 @@
5
5
  ".opencode/rules/*.md",
6
6
  ".agents/skills/orient-to-recent-work/SKILL.md"
7
7
  ],
8
- "skills": {
9
- "paths": [
10
- ".agents/skills/**/*.md",
11
- ".claude/skills/**/*.md"
12
- ]
13
- },
14
- "plugin": [
8
+ "skills": [
9
+ ".agents/skills",
10
+ ".claude/skills"
11
+ ],
12
+ "plugins": [
15
13
  "opencode-mem",
16
14
  "@tarquinen/opencode-dcp@latest",
17
- "@dietrichgebert/ponytail",
18
- "opentmux"
15
+ "@dietrichgebert/ponytail@4.12.0"
16
+ // "opentmux": V1-only; enable only after it supports V2.
19
17
  ],
20
18
  "lsp": true
21
- }
19
+ }
@@ -44,6 +44,21 @@ The [orient-to-recent-work](.agents/skills/orient-to-recent-work/SKILL.md) skill
44
44
  | `{{PACKAGE_SCOPE}}/{{PACKAGE_NAME_2}}` | {{PACKAGE_2_DESCRIPTION}} |
45
45
  | `{{PACKAGE_SCOPE}}/config` | Shared configuration |
46
46
 
47
+ ## Commands
48
+
49
+ Root commands cover every app and package. Filtered commands run one workspace, where `<workspace>` is its package name. The filter syntax follows `{{PACKAGE_MANAGER}}` (pnpm and turbo `--filter`, npm `-w`, yarn `workspace`). `dev`, `test`, `lint`, and `build` are the workspace's script names. Default dev port for each app: its own `AGENTS.md`.
50
+
51
+ | Task | Root | Filtered (one workspace) |
52
+ | --------------- | ------------------- | ------------------------------------------------ |
53
+ | Setup | `{{SETUP_COMMAND}}` | n/a, setup runs once at the root |
54
+ | Dev server | `{{DEV_COMMAND}}` | `{{PACKAGE_MANAGER}} --filter <workspace> dev` |
55
+ | Dev server port | `{{DEV_PORT_FLAG}}` | same flag on the filtered dev command |
56
+ | Test | `{{TEST_COMMAND}}` | `{{PACKAGE_MANAGER}} --filter <workspace> test` |
57
+ | Lint | `{{LINT_COMMAND}}` | `{{PACKAGE_MANAGER}} --filter <workspace> lint` |
58
+ | Build | `{{BUILD_COMMAND}}` | `{{PACKAGE_MANAGER}} --filter <workspace> build` |
59
+
60
+ `{{DEV_PORT_FLAG}}` is the flag or env var that sets the port; `<port>` is the port value.
61
+
47
62
  ## Project Management
48
63
 
49
64
  **Tracker:** {{ISSUE_TRACKER}}
@@ -102,6 +117,14 @@ Each app has its own `AGENTS.md` with detailed patterns:
102
117
  - `{{APP_DIR}}/{{APP_NAME_1}}/AGENTS.md` - {{APP_1_DESCRIPTION}} patterns
103
118
  - `{{APP_DIR}}/{{APP_NAME_2}}/AGENTS.md` - {{APP_2_DESCRIPTION}} patterns
104
119
 
120
+ ## OpenCode V2 Context
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.
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.
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.
127
+
105
128
  ## Detailed Instructions
106
129
 
107
130
  ### Native Codex
@@ -141,6 +164,7 @@ For detailed standards on specific topics, refer to these skills in `.agents/ski
141
164
  | **Debugging** | `systematic-debugging/SKILL.md` | Debugging workflows |
142
165
  | **Documentation** | `project-documentation/SKILL.md` | README, comments, ADRs, changelogs |
143
166
  | **Executing Plans** | `executing-plans/SKILL.md` | Following through on implementation plans |
167
+ | **Factory** | `factory/SKILL.md` | Opt-in spec-to-merge feature pipeline |
144
168
  | **Finishing Branches** | `finishing-a-development-branch/SKILL.md` | Completing and merging branches |
145
169
  | **GitHub CLI** | `gh-cli/SKILL.md` | GitHub Issues CLI command reference |
146
170
  | **GitLab CLI** | `glab-cli/SKILL.md` | GitLab MRs, issues, pipelines CLI reference |
@@ -340,13 +364,18 @@ Subagents are typically **agent-initiated** — the coordinator decides when to
340
364
 
341
365
  > **Docs:** [VS Code Subagents](https://code.visualstudio.com/docs/copilot/agents/subagents) · [Cursor Subagents](https://cursor.com/docs/subagents)
342
366
 
367
+ ### Factory (opt-in)
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).
370
+
343
371
  ## Documentation Requirements
344
372
 
345
373
  Documentation updates are **mandatory before committing** any feature or fix. See [`.github/instructions/documentation.instructions.md`](.github/instructions/documentation.instructions.md) for the full pre-commit checklist, templates, and AI agent directives.
346
374
 
347
375
  **Quick summary:**
348
376
 
349
- - Create or update `apps/{{APP_NAME}}/docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/` (spec + plan) for every feature
377
+ - Create or update `apps/{{APP_NAME}}/docs/features/<feature>/` (spec + plan) for every feature, where `<feature>` is `<KEY>-<slug>` or `<slug>`
378
+ - Features run through the factory pipeline live in root `docs/features/<feature>/` because the pipeline is root-scoped; other features stay in their app or package
350
379
  - Add fixes to the monthly log in `apps/{{APP_NAME}}/docs/fixes/{{YYYY-MM}}.md` (or a dedicated folder for complex fixes)
351
380
  - Use root `docs/` only for monorepo-wide concerns: `docs/architecture/`, `docs/integration/`, `docs/guides/`
352
381
  - Update `docs/api/`, `README.md`, and `CHANGELOG.md` when applicable
@@ -59,5 +59,5 @@
59
59
  - Commands are in `.opencode/commands/`.
60
60
  - Rules are in `.opencode/rules/`.
61
61
  - Agents are in `.opencode/agents/`.
62
- - Instructions are loaded from `AGENTS.md`, `.github/instructions/`, and `.claude/rules/`.
62
+ - Native V2 loads ambient `AGENTS.md`, not config `instructions` entries. Explicitly read referenced snippets (`@refs` are ordinary text, not attachments). See [OpenCode setup](README.md#native-opencode-v2).
63
63
  - Skills are loaded from `.agents/skills/` and `.claude/skills/`.
@@ -13,6 +13,12 @@ Templates use `{{PLACEHOLDER}}` syntax (SCREAMING_SNAKE_CASE). The most common p
13
13
  | `{{LANGUAGE}}` | Programming language (TypeScript, PHP, Python, C#, etc.) |
14
14
  | `{{PACKAGE_MANAGER}}` | Package manager (npm, pnpm, composer, pip, etc.) |
15
15
  | `{{DEV_PORT}}` | Development server port |
16
+ | `{{DEV_PORT_FLAG}}` | Flag or env var that sets the dev port |
17
+ | `{{SETUP_COMMAND}}` | Install command |
18
+ | `{{DEV_COMMAND}}` | Dev server command |
19
+ | `{{TEST_COMMAND}}` | Test command |
20
+ | `{{LINT_COMMAND}}` | Lint command |
21
+ | `{{BUILD_COMMAND}}` | Build command |
16
22
  | `{{DEPLOY_PLATFORM}}` | Deployment target |
17
23
  | `{{ISSUE_TRACKER}}` | Issue tracker (Jira, Linear, GitHub Issues) |
18
24
  | `{{ISSUE_ID}}` | Issue or ticket identifier |
@@ -50,6 +56,20 @@ This is a monorepo managed with {{BUILD_SYSTEM}}.
50
56
 
51
57
  ## Getting Started
52
58
 
59
+ ### Native OpenCode V2
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.
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.
64
+
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
+
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.
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).
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.
72
+
53
73
  ### Native Codex
54
74
 
55
75
  `--env codex` includes `.codex/`, `.agents/`, and shared context, plus `.github/instructions/` and `.claude/rules-snippets/` solely to supply AGENTS-linked standards and their wrapper source content. No other harness command, agent, or config directories are installed; these references do not establish Copilot/Claude use or load automatically as Codex rules. Other harness scopes are unchanged.
@@ -0,0 +1,194 @@
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 `docs/features/`, 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). 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.
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
+
26
+ `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
+
28
+ ## Invocations
29
+
30
+ | Command | What it does |
31
+ | --- | --- |
32
+ | `/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
+ | `/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 |
35
+ | `/factory rework <job-id> <note>` | Start a fresh builder with your note and a fresh retry budget |
36
+ | `/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
+ | `/factory status [--all]` | Summarize open jobs from their `job.json` files. Closed jobs are hidden unless `--all` |
38
+ | `/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
+ | `/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) |
41
+
42
+ `--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
+
44
+ There is no queue. Start each feature with a request, a ticket key, or a slug.
45
+
46
+ ## Harnesses
47
+
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/`.
49
+
50
+ | Harness | Entry point | Agent wrappers |
51
+ | --- | --- | --- |
52
+ | Claude Code | `/factory` (`.claude/commands/factory.md`) | `.claude/agents/` |
53
+ | GitHub Copilot | `/factory` prompt (`.github/prompts/factory.prompt.md`) | `.github/agents/` |
54
+ | Cursor | `/factory` (`.cursor/commands/factory.md`) | `.cursor/agents/` |
55
+ | 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) |
57
+
58
+ ## Feature folders and sizing
59
+
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:
61
+
62
+ ```
63
+ - [ ] T1 <one-line task> [P] — PROJ-1235
64
+ ```
65
+
66
+ Sizing is decided in `plan.md`:
67
+
68
+ - **Small** (one or two steps): `spec.md` and `plan.md` only, no tickets.
69
+ - **Large**: `tasks.md` plus tickets, when your `AGENTS.md` documents a project management tool. Otherwise `tasks.md` only.
70
+ - **Unclear**: the orchestrator asks you at the plan gate.
71
+
72
+ ## Gates
73
+
74
+ Every job stops twice, in every approval mode, before anything is ticketed or built:
75
+
76
+ 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]`.
77
+ 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.
78
+
79
+ 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>`.
80
+
81
+ ## Approval modes
82
+
83
+ - **`human`** (default). An approved job stops at `awaiting-human`. Read the branch and `qa.md`, then run `/factory approve <job-id>`.
84
+ - **`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.
85
+
86
+ Any value other than exactly `auto` is treated as `human`.
87
+
88
+ ## Build location
89
+
90
+ 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
+
92
+ ### In-place builds
93
+
94
+ 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
+
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.
97
+ - While the job is open, the main checkout stays on `factory/<id>`. Do not switch it until the job is merged or abandoned.
98
+ - 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
+ - The merge switches the main checkout back to the default branch and removes only the branch, not a worktree.
100
+ - 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
+
102
+ ## Suggested checks (`qa.md`)
103
+
104
+ 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.
105
+
106
+ ## Tickets
107
+
108
+ When a job is tracked, its tickets follow it:
109
+
110
+ | Job event | Tickets |
111
+ | --- | --- |
112
+ | Build starts | In Progress |
113
+ | Review starts | In Review |
114
+ | You approve and the merge runs | Done |
115
+ | Job abandoned | Left as they are |
116
+
117
+ 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.
118
+
119
+ ## How a job runs
120
+
121
+ 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.
123
+ 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.
125
+ 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.
127
+ 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`.
129
+ 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.
132
+
133
+ Jobs that escalate (`needs-human`) keep their branch and worktree so you can inspect them. Use `/factory rework` or `/factory approve` to continue.
134
+
135
+ ## Abandon
136
+
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.
138
+
139
+ ## Archive
140
+
141
+ `/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.
142
+
143
+ - By default, only jobs last updated more than 7 days ago move. `--all` moves every closed job.
144
+ - `--dry-run` lists what would move and moves nothing.
145
+ - 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.
146
+ - 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.
147
+
148
+ ## Prune
149
+
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.
151
+
152
+ 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
+
154
+ ## Layout
155
+
156
+ ```
157
+ docs/features/ tracked by the project
158
+ <KEY>-<slug>/
159
+ spec.md
160
+ plan.md
161
+ tasks.md large work only
162
+ qa.md builder, on the branch: suggested checks (not a gate)
163
+ factory/
164
+ README.md this file
165
+ .gitignore ignores jobs/ and archive/
166
+ jobs/ runtime state (ignored by git)
167
+ <NNN-slug>/
168
+ job.json stage, round, reviews, size, tracking, worktree, failed_stage, approval mode
169
+ intake.md intake questions and answers (only when asked)
170
+ spec-<k>.md after a change request at the spec gate
171
+ plan-<k>.md after a change request at the plan gate
172
+ build.md
173
+ round-<N>/review-<lens>.md
174
+ decision.md
175
+ merge-conflict.md after a merge conflict; blocks approve
176
+ rework-<k>.md
177
+ main-copies/ feature docs moved aside at merge
178
+ archive/ closed jobs moved by /factory archive (ignored by git)
179
+ <NNN-slug>/ same layout as jobs/; never resumed
180
+ ```
181
+
182
+ Job folders are ignored by git. They are working state, not history. Copy one out if you want an audit trail.
183
+
184
+ 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.
185
+
186
+ ## Limitations
187
+
188
+ - **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
+ - **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.
191
+ - **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
+ - **UI lenses need a browser.** Without one they cannot verify anything and the job escalates.
193
+ - **Tickets are best-effort.** Creation failures stop at the plan gate. Transition failures are recorded and reported.
194
+ - **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/