nitm-ai-dev-toolkit 4.0.0 → 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 (136) hide show
  1. package/CHANGELOG.md +37 -1
  2. package/README.md +60 -4
  3. package/bin/cli.js +152 -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/prompt-snippets/assign-tasks.md +6 -2
  40. package/src/monorepo/.claude/prompt-snippets/bootstrap.md +22 -13
  41. package/src/monorepo/.claude/prompt-snippets/factory.md +20 -0
  42. package/src/monorepo/.claude/prompt-snippets/implement-feature.md +2 -2
  43. package/src/monorepo/.claude/prompt-snippets/tasks.md +49 -87
  44. package/src/monorepo/.claude/rules-snippets/documentation.md +8 -6
  45. package/src/monorepo/.cursor/agents/factory-approver.agent.md +11 -0
  46. package/src/monorepo/.cursor/agents/factory-builder.agent.md +11 -0
  47. package/src/monorepo/.cursor/agents/factory-reviewer-code.agent.md +11 -0
  48. package/src/monorepo/.cursor/agents/factory-reviewer-security.agent.md +11 -0
  49. package/src/monorepo/.cursor/agents/factory-reviewer-ui.agent.md +11 -0
  50. package/src/monorepo/.cursor/agents/factory-reviewer-ux.agent.md +11 -0
  51. package/src/monorepo/.cursor/agents/factory-spec-writer.agent.md +11 -0
  52. package/src/monorepo/.cursor/commands/factory.md +24 -0
  53. package/src/monorepo/.github/agents/factory-approver.agent.md +11 -0
  54. package/src/monorepo/.github/agents/factory-builder.agent.md +11 -0
  55. package/src/monorepo/.github/agents/factory-reviewer-code.agent.md +11 -0
  56. package/src/monorepo/.github/agents/factory-reviewer-security.agent.md +11 -0
  57. package/src/monorepo/.github/agents/factory-reviewer-ui.agent.md +11 -0
  58. package/src/monorepo/.github/agents/factory-reviewer-ux.agent.md +11 -0
  59. package/src/monorepo/.github/agents/factory-spec-writer.agent.md +11 -0
  60. package/src/monorepo/.github/prompts/factory.prompt.md +25 -0
  61. package/src/monorepo/.opencode/agents/factory-approver.md +20 -0
  62. package/src/monorepo/.opencode/agents/factory-builder.md +20 -0
  63. package/src/monorepo/.opencode/agents/factory-reviewer-code.md +20 -0
  64. package/src/monorepo/.opencode/agents/factory-reviewer-security.md +20 -0
  65. package/src/monorepo/.opencode/agents/factory-reviewer-ui.md +20 -0
  66. package/src/monorepo/.opencode/agents/factory-reviewer-ux.md +20 -0
  67. package/src/monorepo/.opencode/agents/factory-spec-writer.md +20 -0
  68. package/src/monorepo/.opencode/commands/factory.md +29 -0
  69. package/src/monorepo/AGENTS.md +22 -1
  70. package/src/monorepo/README.md +6 -0
  71. package/src/monorepo/factory/README.md +194 -0
  72. package/src/monorepo/factory/_gitignore +5 -0
  73. package/src/repo/.agents/skills/factory/SKILL.md +593 -0
  74. package/src/repo/.claude/agents/admin-portal.agent.md +1 -1
  75. package/src/repo/.claude/agents/api-specialist.agent.md +1 -1
  76. package/src/repo/.claude/agents/backend-architect.agent.md +1 -1
  77. package/src/repo/.claude/agents/documenter.agent.md +1 -1
  78. package/src/repo/.claude/agents/factory-approver.agent.md +12 -0
  79. package/src/repo/.claude/agents/factory-builder.agent.md +12 -0
  80. package/src/repo/.claude/agents/factory-reviewer-code.agent.md +12 -0
  81. package/src/repo/.claude/agents/factory-reviewer-security.agent.md +12 -0
  82. package/src/repo/.claude/agents/factory-reviewer-ui.agent.md +12 -0
  83. package/src/repo/.claude/agents/factory-reviewer-ux.agent.md +12 -0
  84. package/src/repo/.claude/agents/factory-spec-writer.agent.md +12 -0
  85. package/src/repo/.claude/agents/feature-builder.agent.md +1 -1
  86. package/src/repo/.claude/agents/frontend-developer.agent.md +1 -1
  87. package/src/repo/.claude/agents/green.agent.md +1 -1
  88. package/src/repo/.claude/agents/implementer.agent.md +1 -1
  89. package/src/repo/.claude/agents/planner.agent.md +1 -1
  90. package/src/repo/.claude/agents/red.agent.md +1 -1
  91. package/src/repo/.claude/agents/refactor.agent.md +1 -1
  92. package/src/repo/.claude/agents/researcher.agent.md +1 -1
  93. package/src/repo/.claude/agents/reviewer.agent.md +1 -1
  94. package/src/repo/.claude/agents/tdd.agent.md +1 -1
  95. package/src/repo/.claude/agents-snippets/factory-approver.md +72 -0
  96. package/src/repo/.claude/agents-snippets/factory-builder.md +100 -0
  97. package/src/repo/.claude/agents-snippets/factory-reviewer-code.md +57 -0
  98. package/src/repo/.claude/agents-snippets/factory-reviewer-security.md +48 -0
  99. package/src/repo/.claude/agents-snippets/factory-reviewer-ui.md +64 -0
  100. package/src/repo/.claude/agents-snippets/factory-reviewer-ux.md +64 -0
  101. package/src/repo/.claude/agents-snippets/factory-spec-writer.md +117 -0
  102. package/src/repo/.claude/agents-snippets/feature-builder.md +1 -1
  103. package/src/repo/.claude/commands/factory.md +24 -0
  104. package/src/repo/.claude/prompt-snippets/assign-tasks.md +6 -2
  105. package/src/repo/.claude/prompt-snippets/bootstrap.md +30 -20
  106. package/src/repo/.claude/prompt-snippets/factory.md +20 -0
  107. package/src/repo/.claude/prompt-snippets/implement-feature.md +2 -2
  108. package/src/repo/.claude/prompt-snippets/tasks.md +49 -112
  109. package/src/repo/.cursor/agents/factory-approver.agent.md +11 -0
  110. package/src/repo/.cursor/agents/factory-builder.agent.md +11 -0
  111. package/src/repo/.cursor/agents/factory-reviewer-code.agent.md +11 -0
  112. package/src/repo/.cursor/agents/factory-reviewer-security.agent.md +11 -0
  113. package/src/repo/.cursor/agents/factory-reviewer-ui.agent.md +11 -0
  114. package/src/repo/.cursor/agents/factory-reviewer-ux.agent.md +11 -0
  115. package/src/repo/.cursor/agents/factory-spec-writer.agent.md +11 -0
  116. package/src/repo/.cursor/commands/factory.md +24 -0
  117. package/src/repo/.github/agents/factory-approver.agent.md +11 -0
  118. package/src/repo/.github/agents/factory-builder.agent.md +11 -0
  119. package/src/repo/.github/agents/factory-reviewer-code.agent.md +11 -0
  120. package/src/repo/.github/agents/factory-reviewer-security.agent.md +11 -0
  121. package/src/repo/.github/agents/factory-reviewer-ui.agent.md +11 -0
  122. package/src/repo/.github/agents/factory-reviewer-ux.agent.md +11 -0
  123. package/src/repo/.github/agents/factory-spec-writer.agent.md +11 -0
  124. package/src/repo/.github/prompts/factory.prompt.md +25 -0
  125. package/src/repo/.opencode/agents/factory-approver.md +20 -0
  126. package/src/repo/.opencode/agents/factory-builder.md +20 -0
  127. package/src/repo/.opencode/agents/factory-reviewer-code.md +20 -0
  128. package/src/repo/.opencode/agents/factory-reviewer-security.md +20 -0
  129. package/src/repo/.opencode/agents/factory-reviewer-ui.md +20 -0
  130. package/src/repo/.opencode/agents/factory-reviewer-ux.md +20 -0
  131. package/src/repo/.opencode/agents/factory-spec-writer.md +20 -0
  132. package/src/repo/.opencode/commands/factory.md +29 -0
  133. package/src/repo/AGENTS.md +19 -1
  134. package/src/repo/README.md +6 -0
  135. package/src/repo/factory/README.md +194 -0
  136. package/src/repo/factory/_gitignore +5 -0
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Factory Reviewer Security
3
+ description: "Audit a factory job's branch diff for security problems in a fresh context. Dispatched by the factory orchestrator."
4
+ tools: ["read", "search", "edit", "runInTerminal", "terminalLastCommand"]
5
+ ---
6
+
7
+ # Factory Reviewer (Security) Agent
8
+
9
+ Audit a factory job's branch diff for security problems in a fresh context.
10
+
11
+ **CRITICAL: READ:** [.claude/agents-snippets/factory-reviewer-security.md](../../.claude/agents-snippets/factory-reviewer-security.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Factory Reviewer UI
3
+ description: "Review a factory job's feature at its build location for design-system consistency, spacing, typography, contrast, and responsive layout, without signing in or writing to real services. Dispatched by the factory orchestrator."
4
+ tools: ["read", "search", "edit", "runInTerminal", "terminalLastCommand"]
5
+ ---
6
+
7
+ # Factory Reviewer (UI) Agent
8
+
9
+ Review a factory job's feature at its build location for design-system consistency, spacing, typography, contrast, and responsive layout, without signing in or writing to real services.
10
+
11
+ **CRITICAL: READ:** [.claude/agents-snippets/factory-reviewer-ui.md](../../.claude/agents-snippets/factory-reviewer-ui.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Factory Reviewer UX
3
+ 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."
4
+ tools: ["read", "search", "edit", "runInTerminal", "terminalLastCommand"]
5
+ ---
6
+
7
+ # Factory Reviewer (UX) Agent
8
+
9
+ 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.
10
+
11
+ **CRITICAL: READ:** [.claude/agents-snippets/factory-reviewer-ux.md](../../.claude/agents-snippets/factory-reviewer-ux.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Factory Spec Writer
3
+ description: "Write a testable spec.md for a factory job from a feature request, after inspecting the real code. Dispatched by the factory orchestrator."
4
+ tools: ["read", "search", "edit", "runInTerminal", "terminalLastCommand"]
5
+ ---
6
+
7
+ # Factory Spec Writer Agent
8
+
9
+ Write a testable spec.md for a factory job from a feature request, after inspecting the real code.
10
+
11
+ **CRITICAL: READ:** [.claude/agents-snippets/factory-spec-writer.md](../../.claude/agents-snippets/factory-spec-writer.md)
@@ -0,0 +1,25 @@
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
+ tools: ["agent", "edit", "search", "read", "runInTerminal", "terminalLastCommand"]
4
+ argument-hint: "[--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]"
5
+ ---
6
+
7
+ # Factory
8
+
9
+ ## Agent Dispatch
10
+
11
+ > **Run in the main session.** The orchestrator dispatches these agents; they cannot dispatch others.
12
+
13
+ | Agent | When to use |
14
+ |-------|-------------|
15
+ | `factory-spec-writer` | Spec stage (`spec` mode) writes `spec.md`; plan stage (`plan` mode) writes `plan.md` and `tasks.md` |
16
+ | `factory-builder` | Build, repair, and rework: writes `build.md` in the job folder; its code goes in the build location |
17
+ | `factory-reviewer-code` | Review round, `code` lens |
18
+ | `factory-reviewer-security` | Review round, `security` lens |
19
+ | `factory-reviewer-ux` | Review round, `ux` lens (opt-in) |
20
+ | `factory-reviewer-ui` | Review round, `ui` lens (opt-in) |
21
+ | `factory-approver` | Approval gate: writes `decision.md` |
22
+
23
+ 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.
24
+
25
+ **CRITICAL: READ:** [.claude/prompt-snippets/factory.md](../../.claude/prompt-snippets/factory.md).
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: "Decide whether a factory job is approved for merge or escalated to a human, checking history, final diff, a spot-checked criterion, a dry-run merge, and escalation triggers. 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 Approver Agent
17
+
18
+ Decide whether a factory job is approved for merge or escalated to a human.
19
+
20
+ @.claude/agents-snippets/factory-approver.md
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: "Build a factory job's feature inside its git worktree, following TDD, and log results in build.md. Runs in build, repair, or rework mode. 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 Builder Agent
17
+
18
+ Build a factory job's feature inside its git worktree, following TDD, and log results in build.md.
19
+
20
+ @.claude/agents-snippets/factory-builder.md
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: "Review a factory job's branch for correctness, simplicity, reuse, conventions, and docs, and run the project's checks. 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 (Code) Agent
17
+
18
+ Review a factory job's branch for correctness, simplicity, reuse, conventions, and docs, and run the project's checks.
19
+
20
+ @.claude/agents-snippets/factory-reviewer-code.md
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: "Audit a factory job's branch diff for security problems in a fresh context. 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 (Security) Agent
17
+
18
+ Audit a factory job's branch diff for security problems in a fresh context.
19
+
20
+ @.claude/agents-snippets/factory-reviewer-security.md
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: "Review a factory job's feature at its build location for design-system consistency, spacing, typography, contrast, and responsive layout, 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 (UI) Agent
17
+
18
+ Review a factory job's feature at its build location for design-system consistency, spacing, typography, contrast, and responsive layout, without signing in or writing to real services.
19
+
20
+ @.claude/agents-snippets/factory-reviewer-ui.md
@@ -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
@@ -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
@@ -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}}
@@ -149,6 +164,7 @@ For detailed standards on specific topics, refer to these skills in `.agents/ski
149
164
  | **Debugging** | `systematic-debugging/SKILL.md` | Debugging workflows |
150
165
  | **Documentation** | `project-documentation/SKILL.md` | README, comments, ADRs, changelogs |
151
166
  | **Executing Plans** | `executing-plans/SKILL.md` | Following through on implementation plans |
167
+ | **Factory** | `factory/SKILL.md` | Opt-in spec-to-merge feature pipeline |
152
168
  | **Finishing Branches** | `finishing-a-development-branch/SKILL.md` | Completing and merging branches |
153
169
  | **GitHub CLI** | `gh-cli/SKILL.md` | GitHub Issues CLI command reference |
154
170
  | **GitLab CLI** | `glab-cli/SKILL.md` | GitLab MRs, issues, pipelines CLI reference |
@@ -348,13 +364,18 @@ Subagents are typically **agent-initiated** — the coordinator decides when to
348
364
 
349
365
  > **Docs:** [VS Code Subagents](https://code.visualstudio.com/docs/copilot/agents/subagents) · [Cursor Subagents](https://cursor.com/docs/subagents)
350
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
+
351
371
  ## Documentation Requirements
352
372
 
353
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.
354
374
 
355
375
  **Quick summary:**
356
376
 
357
- - 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
358
379
  - Add fixes to the monthly log in `apps/{{APP_NAME}}/docs/fixes/{{YYYY-MM}}.md` (or a dedicated folder for complex fixes)
359
380
  - Use root `docs/` only for monorepo-wide concerns: `docs/architecture/`, `docs/integration/`, `docs/guides/`
360
381
  - Update `docs/api/`, `README.md`, and `CHANGELOG.md` when applicable
@@ -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 |
@@ -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/