@entelligentsia/forgecli 0.20.3 → 1.0.2

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 (303) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +31 -33
  3. package/dist/CHANGELOG-forge-plugin.md +118 -0
  4. package/dist/CHANGELOG-pi.md +24 -1
  5. package/dist/bin/forgecli.d.ts +2 -0
  6. package/dist/bin/forgecli.js +6 -0
  7. package/dist/bin/forgecli.js.map +1 -0
  8. package/dist/extensions/forgecli/add-pipeline.js +1 -1
  9. package/dist/extensions/forgecli/add-pipeline.js.map +1 -1
  10. package/dist/extensions/forgecli/add-task.js +1 -1
  11. package/dist/extensions/forgecli/add-task.js.map +1 -1
  12. package/dist/extensions/forgecli/approve.js +17 -2
  13. package/dist/extensions/forgecli/approve.js.map +1 -1
  14. package/dist/extensions/forgecli/calibrate.js +11 -8
  15. package/dist/extensions/forgecli/calibrate.js.map +1 -1
  16. package/dist/extensions/forgecli/collate.js +1 -1
  17. package/dist/extensions/forgecli/collate.js.map +1 -1
  18. package/dist/extensions/forgecli/commit.js +17 -2
  19. package/dist/extensions/forgecli/commit.js.map +1 -1
  20. package/dist/extensions/forgecli/enhance.js +1 -1
  21. package/dist/extensions/forgecli/enhance.js.map +1 -1
  22. package/dist/extensions/forgecli/fix-bug.d.ts +1 -1
  23. package/dist/extensions/forgecli/fix-bug.js +14 -6
  24. package/dist/extensions/forgecli/fix-bug.js.map +1 -1
  25. package/dist/extensions/forgecli/forge-artifact-tool.d.ts +6 -8
  26. package/dist/extensions/forgecli/forge-artifact-tool.js +80 -195
  27. package/dist/extensions/forgecli/forge-artifact-tool.js.map +1 -1
  28. package/dist/extensions/forgecli/forge-commands.js +57 -18
  29. package/dist/extensions/forgecli/forge-commands.js.map +1 -1
  30. package/dist/extensions/forgecli/forge-init/phase4-register.js +6 -7
  31. package/dist/extensions/forgecli/forge-init/phase4-register.js.map +1 -1
  32. package/dist/extensions/forgecli/forge-init/run-phases.d.ts +4 -0
  33. package/dist/extensions/forgecli/forge-init/run-phases.js +304 -0
  34. package/dist/extensions/forgecli/forge-init/run-phases.js.map +1 -0
  35. package/dist/extensions/forgecli/forge-init/verifiers.d.ts +14 -5
  36. package/dist/extensions/forgecli/forge-init/verifiers.js +79 -62
  37. package/dist/extensions/forgecli/forge-init/verifiers.js.map +1 -1
  38. package/dist/extensions/forgecli/forge-init.js +131 -76
  39. package/dist/extensions/forgecli/forge-init.js.map +1 -1
  40. package/dist/extensions/forgecli/forge-subagent.d.ts +9 -0
  41. package/dist/extensions/forgecli/forge-subagent.js +11 -6
  42. package/dist/extensions/forgecli/forge-subagent.js.map +1 -1
  43. package/dist/extensions/forgecli/forge-tools.d.ts +28 -4
  44. package/dist/extensions/forgecli/forge-tools.js +122 -73
  45. package/dist/extensions/forgecli/forge-tools.js.map +1 -1
  46. package/dist/extensions/forgecli/health-check.js +3 -3
  47. package/dist/extensions/forgecli/health-check.js.map +1 -1
  48. package/dist/extensions/forgecli/hook-dispatcher.d.ts +1 -1
  49. package/dist/extensions/forgecli/hooks/check-update.d.ts +8 -0
  50. package/dist/extensions/forgecli/hooks/check-update.js +29 -1
  51. package/dist/extensions/forgecli/hooks/check-update.js.map +1 -1
  52. package/dist/extensions/forgecli/hooks/post-init-hook.js +6 -6
  53. package/dist/extensions/forgecli/hooks/post-init-hook.js.map +1 -1
  54. package/dist/extensions/forgecli/hooks/post-sprint-hook.js +6 -6
  55. package/dist/extensions/forgecli/hooks/post-sprint-hook.js.map +1 -1
  56. package/dist/extensions/forgecli/hooks/triage-error.js +1 -0
  57. package/dist/extensions/forgecli/hooks/triage-error.js.map +1 -1
  58. package/dist/extensions/forgecli/implement.js +20 -2
  59. package/dist/extensions/forgecli/implement.js.map +1 -1
  60. package/dist/extensions/forgecli/index.js +39 -32
  61. package/dist/extensions/forgecli/index.js.map +1 -1
  62. package/dist/extensions/forgecli/lib/pipeline-guard.d.ts +41 -0
  63. package/dist/extensions/forgecli/lib/pipeline-guard.js +100 -0
  64. package/dist/extensions/forgecli/lib/pipeline-guard.js.map +1 -0
  65. package/dist/extensions/forgecli/loaders/persona-skill-loader.js +2 -2
  66. package/dist/extensions/forgecli/loaders/persona-skill-loader.js.map +1 -1
  67. package/dist/extensions/forgecli/migrate.d.ts +3 -0
  68. package/dist/extensions/forgecli/migrate.js +4 -2
  69. package/dist/extensions/forgecli/migrate.js.map +1 -1
  70. package/dist/extensions/forgecli/plan.js +21 -2
  71. package/dist/extensions/forgecli/plan.js.map +1 -1
  72. package/dist/extensions/forgecli/quiz-agent.js +7 -7
  73. package/dist/extensions/forgecli/quiz-agent.js.map +1 -1
  74. package/dist/extensions/forgecli/regenerate.js +49 -18
  75. package/dist/extensions/forgecli/regenerate.js.map +1 -1
  76. package/dist/extensions/forgecli/remove-command.js +1 -1
  77. package/dist/extensions/forgecli/remove-command.js.map +1 -1
  78. package/dist/extensions/forgecli/report-bug.js +1 -1
  79. package/dist/extensions/forgecli/report-bug.js.map +1 -1
  80. package/dist/extensions/forgecli/retrospective.js +9 -9
  81. package/dist/extensions/forgecli/retrospective.js.map +1 -1
  82. package/dist/extensions/forgecli/review-code.d.ts +13 -0
  83. package/dist/extensions/forgecli/review-code.js +62 -3
  84. package/dist/extensions/forgecli/review-code.js.map +1 -1
  85. package/dist/extensions/forgecli/review-plan.d.ts +13 -0
  86. package/dist/extensions/forgecli/review-plan.js +65 -3
  87. package/dist/extensions/forgecli/review-plan.js.map +1 -1
  88. package/dist/extensions/forgecli/run-task.d.ts +2 -1
  89. package/dist/extensions/forgecli/run-task.js +48 -4
  90. package/dist/extensions/forgecli/run-task.js.map +1 -1
  91. package/dist/extensions/forgecli/skill-curator-subagent.d.ts +2 -1
  92. package/dist/extensions/forgecli/skill-curator-subagent.js +2 -1
  93. package/dist/extensions/forgecli/skill-curator-subagent.js.map +1 -1
  94. package/dist/extensions/forgecli/sprint-intake.js +6 -6
  95. package/dist/extensions/forgecli/sprint-intake.js.map +1 -1
  96. package/dist/extensions/forgecli/sprint-plan.js +9 -9
  97. package/dist/extensions/forgecli/sprint-plan.js.map +1 -1
  98. package/dist/extensions/forgecli/status-command.js +1 -1
  99. package/dist/extensions/forgecli/status-command.js.map +1 -1
  100. package/dist/extensions/forgecli/store-query.js +11 -11
  101. package/dist/extensions/forgecli/store-query.js.map +1 -1
  102. package/dist/extensions/forgecli/store-repair.js +7 -7
  103. package/dist/extensions/forgecli/store-repair.js.map +1 -1
  104. package/dist/extensions/forgecli/validate.js +17 -2
  105. package/dist/extensions/forgecli/validate.js.map +1 -1
  106. package/dist/forge-payload/.base-pack/commands/check-agent.md +22 -0
  107. package/dist/forge-payload/.base-pack/commands/new-sprint.md +22 -0
  108. package/dist/forge-payload/.base-pack/commands/plan-sprint.md +22 -0
  109. package/dist/forge-payload/.base-pack/commands/quiz-agent.md +2 -18
  110. package/dist/forge-payload/.base-pack/commands/retro.md +22 -0
  111. package/dist/forge-payload/.base-pack/commands/retrospective.md +2 -18
  112. package/dist/forge-payload/.base-pack/commands/sprint-intake.md +2 -18
  113. package/dist/forge-payload/.base-pack/commands/sprint-plan.md +2 -18
  114. package/dist/forge-payload/.base-pack/workflows/_fragments/friction-emit.md +2 -2
  115. package/dist/forge-payload/.base-pack/workflows/_fragments/generation-instructions.md +4 -4
  116. package/dist/forge-payload/.base-pack/workflows/_fragments/iron-laws.md +1 -1
  117. package/dist/forge-payload/.base-pack/workflows/architect_approve.md +13 -1
  118. package/dist/forge-payload/.base-pack/workflows/commit_task.md +12 -1
  119. package/dist/forge-payload/.base-pack/workflows/enhance.md +40 -10
  120. package/dist/forge-payload/.base-pack/workflows/fix_bug.md +1 -1
  121. package/dist/forge-payload/.base-pack/workflows/implement_plan.md +14 -2
  122. package/dist/forge-payload/.base-pack/workflows/migrate_structural.md +2 -2
  123. package/dist/forge-payload/.base-pack/workflows/orchestrate_task.md +20 -4
  124. package/dist/forge-payload/.base-pack/workflows/plan_task.md +14 -2
  125. package/dist/forge-payload/.base-pack/workflows/review_code.md +37 -7
  126. package/dist/forge-payload/.base-pack/workflows/review_plan.md +36 -6
  127. package/dist/forge-payload/.base-pack/workflows/run_sprint.md +2 -2
  128. package/dist/forge-payload/.base-pack/workflows/validate_task.md +37 -7
  129. package/dist/forge-payload/.claude-plugin/plugin.json +1 -1
  130. package/dist/forge-payload/.schemas/config.schema.json +0 -5
  131. package/dist/forge-payload/.schemas/enum-catalog.json +9 -13
  132. package/dist/forge-payload/.schemas/migrations.json +65 -0
  133. package/dist/forge-payload/agents/tomoshibi.md +150 -6
  134. package/dist/forge-payload/commands/add-pipeline.md +1 -1
  135. package/dist/forge-payload/commands/add-task.md +1 -1
  136. package/dist/forge-payload/commands/calibrate.md +4 -350
  137. package/dist/forge-payload/commands/check-agent.md +38 -0
  138. package/dist/forge-payload/commands/config.md +3 -113
  139. package/dist/forge-payload/commands/enhance.md +5 -32
  140. package/dist/forge-payload/commands/health.md +155 -13
  141. package/dist/forge-payload/commands/init.md +25 -31
  142. package/dist/forge-payload/commands/migrate.md +6 -154
  143. package/dist/forge-payload/commands/quiz-agent.md +2 -34
  144. package/dist/forge-payload/commands/rebuild.md +664 -0
  145. package/dist/forge-payload/commands/regenerate.md +2 -774
  146. package/dist/forge-payload/commands/remove.md +10 -13
  147. package/dist/forge-payload/commands/repair.md +187 -0
  148. package/dist/forge-payload/commands/search.md +73 -0
  149. package/dist/forge-payload/commands/status.md +105 -0
  150. package/dist/forge-payload/commands/store-query.md +2 -69
  151. package/dist/forge-payload/commands/store-repair.md +2 -183
  152. package/dist/forge-payload/commands/update-tools.md +4 -50
  153. package/dist/forge-payload/commands/update.md +64 -58
  154. package/dist/forge-payload/hooks/check-update.cjs +1 -1
  155. package/dist/forge-payload/hooks/post-init.cjs +2 -2
  156. package/dist/forge-payload/hooks/post-sprint.cjs +2 -2
  157. package/dist/forge-payload/hooks/triage-error.cjs +11 -10
  158. package/dist/forge-payload/init/phases/phase-1-collect.md +138 -0
  159. package/dist/forge-payload/init/phases/phase-2-discover.md +127 -0
  160. package/dist/forge-payload/init/phases/phase-3-materialize.md +113 -0
  161. package/dist/forge-payload/init/phases/phase-4-register.md +159 -0
  162. package/dist/forge-payload/integrity.json +21 -24
  163. package/dist/forge-payload/meta/fragments/tool-discipline.md +22 -0
  164. package/dist/forge-payload/meta/templates/meta-retro.md +28 -0
  165. package/dist/forge-payload/meta/workflows/_fragments/friction-emit.md +2 -2
  166. package/dist/forge-payload/meta/workflows/_fragments/generation-instructions.md +4 -4
  167. package/dist/forge-payload/meta/workflows/_fragments/iron-laws.md +1 -1
  168. package/dist/forge-payload/meta/workflows/meta-approve.md +13 -1
  169. package/dist/forge-payload/meta/workflows/meta-check-agent.md +138 -0
  170. package/dist/forge-payload/meta/workflows/meta-commit.md +12 -1
  171. package/dist/forge-payload/meta/workflows/meta-enhance.md +39 -9
  172. package/dist/forge-payload/meta/workflows/meta-fix-bug.md +1 -1
  173. package/dist/forge-payload/meta/workflows/meta-implement.md +13 -1
  174. package/dist/forge-payload/meta/workflows/meta-migrate.md +3 -3
  175. package/dist/forge-payload/meta/workflows/meta-new-sprint.md +84 -0
  176. package/dist/forge-payload/meta/workflows/meta-orchestrate.md +20 -4
  177. package/dist/forge-payload/meta/workflows/meta-plan-sprint.md +152 -0
  178. package/dist/forge-payload/meta/workflows/meta-plan-task.md +13 -1
  179. package/dist/forge-payload/meta/workflows/meta-retro.md +73 -0
  180. package/dist/forge-payload/meta/workflows/meta-review-implementation.md +37 -7
  181. package/dist/forge-payload/meta/workflows/meta-review-plan.md +36 -6
  182. package/dist/forge-payload/meta/workflows/meta-validate.md +37 -7
  183. package/dist/forge-payload/schemas/config.schema.json +0 -5
  184. package/dist/forge-payload/schemas/enum-catalog.json +9 -13
  185. package/dist/forge-payload/schemas/structure-manifest.json +6 -8
  186. package/dist/forge-payload/tools/artifact.cjs +295 -0
  187. package/dist/forge-payload/tools/banners.cjs +3 -4
  188. package/dist/forge-payload/tools/build-context-pack.cjs +1 -1
  189. package/dist/forge-payload/tools/check-structure.cjs +8 -3
  190. package/dist/forge-payload/tools/store-cli.cjs +67 -7
  191. package/dist/forge-payload/tools/substitute-placeholders.cjs +1 -1
  192. package/dist/forge-payload/tools/verify-apply.cjs +75 -0
  193. package/dist/forge-payload/tools/verify-phase.cjs +259 -0
  194. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  195. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +0 -17
  196. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  197. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +21 -38
  198. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  199. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
  200. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +5 -4
  201. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
  202. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +2 -1
  203. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
  204. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +5 -2
  205. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
  206. package/node_modules/@earendil-works/pi-ai/package.json +1 -1
  207. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +24 -1
  208. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.d.ts.map +1 -1
  209. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.js +2 -3
  210. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.js.map +1 -1
  211. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.d.ts +1 -0
  212. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.d.ts.map +1 -1
  213. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.js +52 -22
  214. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.js.map +1 -1
  215. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  216. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +16 -4
  217. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  218. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
  219. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +45 -50
  220. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
  221. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
  222. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +43 -81
  223. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
  224. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  225. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/file-mutation-queue.js +27 -12
  226. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/file-mutation-queue.js.map +1 -1
  227. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
  228. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +2 -3
  229. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js.map +1 -1
  230. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -1
  231. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +3 -3
  232. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js.map +1 -1
  233. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -1
  234. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +5 -5
  235. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js.map +1 -1
  236. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.d.ts +2 -0
  237. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.d.ts.map +1 -1
  238. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js +37 -0
  239. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js.map +1 -1
  240. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
  241. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +9 -8
  242. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js.map +1 -1
  243. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
  244. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js +20 -35
  245. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js.map +1 -1
  246. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.d.ts +3 -0
  247. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  248. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js +64 -7
  249. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js.map +1 -1
  250. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  251. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +15 -3
  252. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
  253. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.d.ts +3 -1
  254. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.d.ts.map +1 -1
  255. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.js +14 -8
  256. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.js.map +1 -1
  257. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.d.ts +30 -0
  258. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.d.ts.map +1 -0
  259. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js +124 -0
  260. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js.map +1 -0
  261. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.d.ts +2 -0
  262. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.d.ts.map +1 -0
  263. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js +31 -0
  264. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js.map +1 -0
  265. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.d.ts +7 -27
  266. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.d.ts.map +1 -1
  267. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +75 -115
  268. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js.map +1 -1
  269. package/node_modules/@earendil-works/pi-coding-agent/docs/terminal-setup.md +6 -0
  270. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  271. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  272. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
  273. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  274. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +12 -14
  275. package/node_modules/@earendil-works/pi-coding-agent/package.json +5 -5
  276. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts +3 -0
  277. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +1 -0
  278. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +53 -0
  279. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +1 -0
  280. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  281. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +4 -1
  282. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  283. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +2 -0
  284. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  285. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +13 -1
  286. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  287. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
  288. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
  289. package/node_modules/@earendil-works/pi-tui/package.json +2 -2
  290. package/package.json +6 -6
  291. package/dist/extensions/forgecli/forge-init/phase-descriptors.d.ts +0 -72
  292. package/dist/extensions/forgecli/forge-init/phase-descriptors.js +0 -359
  293. package/dist/extensions/forgecli/forge-init/phase-descriptors.js.map +0 -1
  294. package/dist/extensions/forgecli/forge-init/prompts.d.ts +0 -10
  295. package/dist/extensions/forgecli/forge-init/prompts.js +0 -91
  296. package/dist/extensions/forgecli/forge-init/prompts.js.map +0 -1
  297. package/dist/extensions/forgecli/lib/store-error-remediation.d.ts +0 -65
  298. package/dist/extensions/forgecli/lib/store-error-remediation.js +0 -298
  299. package/dist/extensions/forgecli/lib/store-error-remediation.js.map +0 -1
  300. package/dist/forge-payload/hooks/check-update.js +0 -378
  301. package/dist/forge-payload/hooks/forge-permissions.js +0 -164
  302. package/dist/forge-payload/hooks/triage-error.js +0 -77
  303. package/dist/forge-payload/hooks/validate-write.js +0 -250
@@ -33,8 +33,8 @@
33
33
  **`Persona Self-Load`** — *conditional*. Required when the generated workflow uses the
34
34
  Persona Self-Load pattern (the generated file must begin by reading a persona `.md` file
35
35
  before any other tool use). Specify the exact persona path. Used in: `meta-collate.md`,
36
- `meta-retrospective.md`, `meta-review-sprint-completion.md`, `meta-sprint-intake.md`,
37
- `meta-sprint-plan.md`. Omit for subagent-targeted workflows where the persona is loaded
36
+ `meta-retro.md`, `meta-review-sprint-completion.md`, `meta-new-sprint.md`,
37
+ `meta-plan-sprint.md`. Omit for subagent-targeted workflows where the persona is loaded
38
38
  by the orchestrator before dispatch.
39
39
 
40
40
  **`Workflow Structure`** — *required*. Names the generated file slug and asserts the
@@ -51,8 +51,8 @@ run inline, and mandates the `Agent` tool for sub-tasks.
51
51
  substitutions the generator must embed (stack commands, KB paths, template references,
52
52
  task ID format, etc.).
53
53
 
54
- **`Token Reporting`** — *required* (with one exception: `meta-quiz-agent.md` omits it
55
- because quiz-agent is an inline helper, not an orchestrated phase). Standard form: `See
54
+ **`Token Reporting`** — *required* (with one exception: `meta-check-agent.md` omits it
55
+ because check-agent is an inline helper, not an orchestrated phase). Standard form: `See
56
56
  \`_fragments/finalize.md\` — wire via \`file_ref:\`.` Expanded token-reporting prose is
57
57
  used in workflows where the generated file must mandate a specific sidecar-emit sequence
58
58
  (retrospective, sprint-intake, sprint-plan, review-sprint-completion) — in those cases,
@@ -52,7 +52,7 @@ into the standard three-bullet structure.
52
52
 
53
53
  Some workflows have no `## Iron Laws` section by design:
54
54
 
55
- - `meta-quiz-agent.md` — utility workflow; no store writes; no output contract.
55
+ - `meta-check-agent.md` — utility workflow; no store writes; no output contract.
56
56
  - `meta-review-sprint-completion.md` — read-only verification; no state transitions.
57
57
 
58
58
  Intentional omissions are documented with an inline comment before the `## Algorithm`
@@ -41,13 +41,25 @@ The Architect gives final sign-off on a completed task after Supervisor approval
41
41
 
42
42
  ```
43
43
 
44
- 0. Pre-flight Gate Check:
44
+ 0a. Pre-flight Gate Check:
45
45
  - Resolve FORGE_ROOT (`node -e "console.log(require('./.forge/config.json').paths.forgeRoot)"`).
46
46
  - **Entity-mode resolution:** read the kickoff arguments. `--task {id}` → `entity_kind = "task"`, `record_id = {id}`. `--bug {id}` → `entity_kind = "bug"`, `record_id = {id}`. All store-cli calls below substitute `{entity_kind}` and `{record_id}` for the literal "task"/{taskId} placeholders.
47
47
  - Run: `node "$FORGE_ROOT/tools/preflight-gate.cjs" --phase approve --{entity_kind} {record_id}`
48
48
  - Exit 1 (gate failed) → print stderr and HALT. Do not proceed; do not attempt to produce the artifact.
49
49
  - Exit 2 (misconfiguration) → print stderr and HALT.
50
50
  - Exit 0 → continue.
51
+
52
+ 0b. Pipeline Step Guard (user-invoked state check):
53
+ - If `--force` is present in the invocation arguments, skip this step entirely.
54
+ - If `entity_kind == "bug"`, skip this step entirely (bug state is managed by meta-fix-bug.md).
55
+ - Read current task state:
56
+ `node "$FORGE_ROOT/tools/store-cli.cjs" read task {record_id} --json`
57
+ - Extract the `status` field from the JSON output.
58
+ - Allowed states for this phase: `review-approved`.
59
+ - If the current status is NOT in the allowed set:
60
+ Print the following and HALT (do not proceed):
61
+ `× Task {record_id} is in state '{status}' — /forge:review-code (or /forge:validate) must complete first. To run the full pipeline: /forge:run-task {record_id}`
62
+
51
63
  1. Load Context:
52
64
  - Read task prompt
53
65
  - Read final PLAN.md
@@ -0,0 +1,138 @@
1
+ ---
2
+ requirements:
3
+ reasoning: Medium
4
+ context: High
5
+ speed: Low
6
+ deps:
7
+ personas: [qa-engineer]
8
+ skills: [qa-engineer, generic]
9
+ templates: []
10
+ sub_workflows: []
11
+ kb_docs: [architecture/stack.md, MASTER_INDEX.md]
12
+ config_fields: [paths.engineering]
13
+ ---
14
+
15
+ # 🍵 Meta-Workflow: Quiz Agent
16
+
17
+ ## Purpose
18
+
19
+ Verify that an agent has correctly loaded and understood the project's knowledge
20
+ base before beginning a high-stakes task (e.g. a schema change, a significant
21
+ refactor, a deployment, or a migration step).
22
+
23
+ The quiz is short — 5–7 questions drawn directly from the project's own architecture
24
+ and process docs. Vague answers fail. Pass requires specific, factual responses.
25
+
26
+ <!-- No Iron Laws section: quiz-agent is a utility workflow that makes no store writes and enforces no output contract. Knowledge-check only. It is invoked inline by other workflows, not dispatched as a task phase by the orchestrator. -->
27
+
28
+ ## Algorithm
29
+
30
+ ```
31
+ 1. Ask the quiz questions below (in order).
32
+
33
+ 2. Evaluate each answer:
34
+ - PASS: specific and factually correct per the project KB
35
+ - FAIL: vague ("some validation"), wrong, or "I'm not sure"
36
+
37
+ 3. Verdict:
38
+ - All pass → proceed with the original task.
39
+ - Any fail → re-read the KB docs listed in "Fail Action", then retry the quiz.
40
+ - Fail twice → escalate to the user before beginning the task.
41
+ ```
42
+
43
+ ## Questions
44
+
45
+ (Project-specific questions are generated here during init — see Generation Instructions.)
46
+
47
+ ## Pass Criteria
48
+
49
+ All questions answered correctly and specifically. Vague answers fail.
50
+
51
+ ## Fail Action
52
+
53
+ Re-read the project knowledge base docs listed here, then retry:
54
+
55
+ (Project-specific KB doc paths are embedded here during init.)
56
+
57
+ Then retry the quiz. If the agent fails twice, escalate to the user before
58
+ beginning the task.
59
+
60
+ ---
61
+
62
+ <!-- See _fragments/generation-instructions.md for Generation Instructions template (quiz-agent: no token-reporting or event-emission — inline helper workflow) -->
63
+ ## Generation Instructions
64
+
65
+ ### Overview
66
+
67
+ The generated `quiz_agent.md` tests whether an agent genuinely understands
68
+ THIS project's conventions, architecture, and processes — not Forge in general.
69
+
70
+ Questions must be answerable only by reading the project's own KB docs.
71
+ Generic questions about Claude Code or Forge internals are NOT appropriate
72
+ unless this project's KB explicitly documents them as project conventions.
73
+
74
+ ### Question generation
75
+
76
+ Read the following (already generated by earlier phases):
77
+ - `{KB_PATH}/architecture/` — all .md files
78
+ - `{KB_PATH}/business-domain/` — all .md files
79
+ - `{KB_PATH}/stack-checklist.md`
80
+ - `{KB_PATH}/MASTER_INDEX.md`
81
+
82
+ Generate 5–7 questions that test specific knowledge of this project. Each
83
+ question must:
84
+ 1. Reference a specific fact from the project KB (not common knowledge)
85
+ 2. Have an unambiguous correct answer findable in the KB
86
+ 3. Cover at least three of these categories:
87
+ - Stack conventions (language, framework rules, linting, build)
88
+ - Architecture (key components, service boundaries, data flow)
89
+ - Domain entities (core business objects and their relationships)
90
+ - Process (how work is tracked, committed, reviewed, deployed)
91
+ - Constraints (what is explicitly forbidden or required)
92
+
93
+ Avoid yes/no questions. Prefer "what", "where", "name", "describe" forms.
94
+
95
+ ### Fail Action doc list
96
+
97
+ List the architecture and business-domain docs that cover the question topics.
98
+ Use the actual paths as generated (e.g. `{KB_PATH}/architecture/stack.md`).
99
+ Include `{KB_PATH}/stack-checklist.md` always.
100
+
101
+ ## Template Output Format
102
+
103
+ ```markdown
104
+ # 🍵 Workflow: Quiz Agent — {Project Name}
105
+
106
+ ## Purpose
107
+
108
+ Verify that an agent has correctly loaded and understood the {Project Name}
109
+ knowledge base before beginning a high-stakes task.
110
+
111
+ ---
112
+
113
+ ## Questions
114
+
115
+ 1. **[Category]:** [Question text]
116
+ 2. ...
117
+
118
+ ## Pass Criteria
119
+
120
+ All [N] questions answered correctly and specifically. Vague answers
121
+ ("generally something", "I think it's...") fail.
122
+
123
+ ## Fail Action
124
+
125
+ Re-read:
126
+ - `{KB_PATH}/architecture/[doc1].md`
127
+ - `{KB_PATH}/architecture/[doc2].md`
128
+ - `{KB_PATH}/stack-checklist.md`
129
+ - (any other docs covering the question topics)
130
+
131
+ Then retry the quiz. If the agent fails twice, escalate to the user before
132
+ beginning the task.
133
+ ```
134
+
135
+ ### Token Reporting
136
+
137
+ The generated `quiz_agent.md` does NOT include Token Reporting or Event Emission —
138
+ it is invoked inline by other workflows (not by the orchestrator as a task phase).
@@ -41,7 +41,7 @@ Seal a completed and approved task by committing its artifacts to the VCS and up
41
41
 
42
42
  ```
43
43
 
44
- 0. Pre-flight Gate Check:
44
+ 0a. Pre-flight Gate Check:
45
45
  - Resolve FORGE_ROOT (`node -e "console.log(require('./.forge/config.json').paths.forgeRoot)"`).
46
46
  - **Entity-mode resolution:** read the kickoff arguments. `--task {id}` → `entity_kind = "task"`, `record_id = {id}`. `--bug {id}` → `entity_kind = "bug"`, `record_id = {id}`. All store-cli calls below substitute `{entity_kind}` and `{record_id}` for the literal "task"/{taskId} placeholders.
47
47
  - Run: `node "$FORGE_ROOT/tools/preflight-gate.cjs" --phase commit --{entity_kind} {record_id}`
@@ -49,6 +49,17 @@ Seal a completed and approved task by committing its artifacts to the VCS and up
49
49
  - Exit 2 (misconfiguration) → print stderr and HALT.
50
50
  - Exit 0 → continue.
51
51
 
52
+ 0b. Pipeline Step Guard (user-invoked state check):
53
+ - If `--force` is present in the invocation arguments, skip this step entirely.
54
+ - If `entity_kind == "bug"`, skip this step entirely (bug state is managed by meta-fix-bug.md).
55
+ - Read current task state:
56
+ `node "$FORGE_ROOT/tools/store-cli.cjs" read task {record_id} --json`
57
+ - Extract the `status` field from the JSON output.
58
+ - Allowed states for this phase: `approved`.
59
+ - If the current status is NOT in the allowed set:
60
+ Print the following and HALT (do not proceed):
61
+ `× Task {record_id} is in state '{status}' — /forge:approve must complete first. To run the full pipeline: /forge:run-task {record_id}`
62
+
52
63
  1. Load Context:
53
64
  - Read the record manifest (task or bug, per entity_kind).
54
65
  - Read ARCHITECT_APPROVAL.md from the record's artifact directory:
@@ -104,7 +104,7 @@ Receive the phase flag from the command invocation:
104
104
  |------|------|
105
105
  | `--phase 1` or `--auto` | Auto-apply: placeholder fills only — **use after** `/forge:init` completes to fill `{{KEY}}` placeholders from project signals |
106
106
  | `--phase 2` | Propose-diffs: sprint artifact + friction scan — **use after** a sprint completes to turn friction events into persona/skill enrichments |
107
- | `--phase 3` | Drift detection: full codebase vs structural-element comparison — **use on-demand** or after `/forge:calibrate` to detect stale references |
107
+ | `--phase 3` | Drift detection: full codebase vs structural-element comparison — **use on-demand** or after `/forge:health --fix` to detect stale references |
108
108
 
109
109
  Default to `--phase 3` if no phase flag is given.
110
110
 
@@ -126,7 +126,7 @@ Read `.forge/config.json`. Resolve:
126
126
 
127
127
  ### When to run
128
128
 
129
- Invoked by T09 post-init hook (`--auto`) or manually via `/forge:enhance --phase 1`.
129
+ Invoked by T09 post-init hook (`--auto`) or manually via `/forge:rebuild --enrich --phase 1`.
130
130
 
131
131
  ### Algorithm
132
132
 
@@ -207,7 +207,7 @@ Invoked by T09 post-init hook (`--auto`) or manually via `/forge:enhance --phase
207
207
 
208
208
  ### When to run
209
209
 
210
- Invoked by T09 post-sprint hook or manually via `/forge:enhance --phase 2`.
210
+ Invoked by T09 post-sprint hook or manually via `/forge:rebuild --enrich --phase 2`.
211
211
 
212
212
  ### Algorithm
213
213
 
@@ -376,7 +376,20 @@ Invoked by T09 post-sprint hook or manually via `/forge:enhance --phase 2`.
376
376
  usage telemetry, not friction, so recurrence is neutral by construction).
377
377
 
378
378
  5b.5. **Compression gate (reject >20% growth without 3+ frictions)** — a cheap
379
- deterministic filter that runs BEFORE the LLM judge (step 5c). Any
379
+ deterministic filter that runs BEFORE the LLM judge (step 5c).
380
+
381
+ **Before writing any rejections**, ensure the target directory exists:
382
+ ```sh
383
+ mkdir -p "$PROJECT_ROOT/.forge/enhancement-proposals"
384
+ ```
385
+
386
+ All gate and judge rejections MUST be written to:
387
+ ```
388
+ $PROJECT_ROOT/.forge/enhancement-proposals/phase2-<timestamp>-rejections.json
389
+ ```
390
+ NEVER write a bare `rejections.json` to the project root or any other location.
391
+
392
+ Any
380
393
  `update_skill` proposal that would grow the target file by more than 20%
381
394
  (byte-wise, UTF-8) must be backed by at least 3 supporting friction events;
382
395
  otherwise it is rejected here and never reaches the judge. `insert_skill`
@@ -416,9 +429,10 @@ Invoked by T09 post-sprint hook or manually via `/forge:enhance --phase 2`.
416
429
  "
417
430
  ```
418
431
 
419
- **Logging gate rejections.** Append every rejection from this step to the
420
- same `phase2-<timestamp>-rejections.json` sibling that step 5c uses, with
421
- the rejection record carrying `{ proposal, admit: false,
432
+ **Logging gate rejections.** Append every rejection from this step to
433
+ `$PROJECT_ROOT/.forge/enhancement-proposals/phase2-<timestamp>-rejections.json`
434
+ (the same file the LLM-judge gate in step 5c writes to). The rejection
435
+ record carries `{ proposal, admit: false,
422
436
  reason: 'compression_gate_growth_unsupported', growthRatio, currentBytes,
423
437
  newBytes, supportingFrictionCount, threshold, minSupportingFrictions }`.
424
438
  This keeps every drop — gate or judge — traceable in one place.
@@ -520,6 +534,22 @@ Invoked by T09 post-sprint hook or manually via `/forge:enhance --phase 2`.
520
534
  delete proposals from short-history runs as advisory until the full
521
535
  window is populated.
522
536
 
537
+ **Verification (after steps 5b.5 + 5c).** If any proposals were
538
+ rejected by either gate, verify the rejections file landed at the
539
+ contracted path:
540
+ ```sh
541
+ ls "$PROJECT_ROOT/.forge/enhancement-proposals/phase2-"*"-rejections.json"
542
+ ```
543
+ If the file is missing but rejections were recorded, the write targeted
544
+ the wrong path. Check for a stray `rejections.json` at the project root
545
+ and move it:
546
+ ```sh
547
+ [ -f "$PROJECT_ROOT/rejections.json" ] && \
548
+ mv "$PROJECT_ROOT/rejections.json" \
549
+ "$PROJECT_ROOT/.forge/enhancement-proposals/phase2-${TIMESTAMP}-rejections.json"
550
+ ```
551
+ NEVER leave a bare `rejections.json` at the project root.
552
+
523
553
  6. **Write proposal artifact**:
524
554
  ```sh
525
555
  mkdir -p "$PROJECT_ROOT/.forge/enhancement-proposals"
@@ -565,8 +595,8 @@ Invoked by T09 post-sprint hook or manually via `/forge:enhance --phase 2`.
565
595
 
566
596
  ### When to run
567
597
 
568
- Invoked by `/forge:enhance --phase 3` (default when no phase given), or delegated by
569
- `/forge:calibrate` after its Step 4 drift categorization.
598
+ Invoked by `/forge:rebuild --enrich --phase 3` (default when no phase given), or delegated by
599
+ `/forge:health --fix` after its Step 4 drift categorization.
570
600
 
571
601
  ### Algorithm
572
602
 
@@ -467,7 +467,7 @@ When the Bug Fixer, Supervisor, Architect, Engineer, or Collator detects skill
467
467
  friction during fix-bug — a referenced skill is unused, fails on invocation,
468
468
  is missing from the registry, has gone stale relative to current architecture,
469
469
  or is redundant with another skill — emit a `friction` event so
470
- `/forge:enhance --phase 2` can act on the signal.
470
+ `/forge:rebuild --enrich` (phase 2) can act on the signal.
471
471
 
472
472
  **Trigger conditions** (set `issue` to the matching token):
473
473
 
@@ -30,13 +30,25 @@ The Engineer implements the approved plan: write code, run tests, verify, and do
30
30
 
31
31
  ```
32
32
 
33
- 0. Pre-flight Gate Check:
33
+ 0a. Pre-flight Gate Check:
34
34
  - Resolve FORGE_ROOT (`node -e "console.log(require('./.forge/config.json').paths.forgeRoot)"`).
35
35
  - **Entity-mode resolution:** read the kickoff arguments. `--task {id}` → `entity_kind = "task"`, `record_id = {id}`. `--bug {id}` → `entity_kind = "bug"`, `record_id = {id}`. All store-cli calls below substitute `{entity_kind}` and `{record_id}` for the literal "task"/{taskId} placeholders.
36
36
  - Run: `node "$FORGE_ROOT/tools/preflight-gate.cjs" --phase implement --{entity_kind} {record_id}`
37
37
  - Exit 1 (gate failed) → print stderr and HALT. Do not proceed; do not attempt to produce the artifact.
38
38
  - Exit 2 (misconfiguration) → print stderr and HALT.
39
39
  - Exit 0 → continue.
40
+
41
+ 0b. Pipeline Step Guard (user-invoked state check):
42
+ - If `--force` is present in the invocation arguments, skip this step entirely.
43
+ - If `entity_kind == "bug"`, skip this step entirely (bug state is managed by meta-fix-bug.md).
44
+ - Read current task state:
45
+ `node "$FORGE_ROOT/tools/store-cli.cjs" read task {record_id} --json`
46
+ - Extract the `status` field from the JSON output.
47
+ - Allowed states for this phase: `plan-approved`.
48
+ - If the current status is NOT in the allowed set:
49
+ Print the following and HALT (do not proceed):
50
+ `× Task {record_id} is in state '{status}' — /forge:review-plan must complete first. To run the full pipeline: /forge:run-task {record_id}`
51
+
40
52
  1. Load Context:
41
53
  - Read `.forge/personas/engineer.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
42
54
  - store-cli verbs: `read` | `list` | `write` | `emit` | `update-status` | `set-summary` | `describe` | `nlp` | `query` | `delete` — there is no `get`/`set`/`find`. See `_fragments/store-cli-verbs.md` for full notes; run `--help` before improvising.
@@ -22,7 +22,7 @@ Translate a prose-heavy v0.x `.forge/` instance into the v0.40 format:
22
22
  `structure-versions.json` snapshot tracking (T05). Every operation is
23
23
  reversible, guarded by user confirmation, and idempotent on re-run.
24
24
 
25
- **Trigger:** Invoked by `/forge:migrate` when the user passes `--structural`
25
+ **Trigger:** Invoked by `/forge:init --migrate` when the user passes `--structural`
26
26
  or when `.forge/structure-versions.json` is absent (pre-T05 install detected).
27
27
 
28
28
  **Scope:** v0.x → v0.40 only. Installs older than v0.x should use
@@ -68,7 +68,7 @@ ls .forge/structure-versions.json 2>/dev/null && echo "EXISTS" || echo "ABSENT"
68
68
 
69
69
  - If `structure-versions.json` EXISTS: this is a post-T05 install. Warn the
70
70
  user that structural migration is not needed and offer to run the standard
71
- store-schema migration (Steps 1–7 of `/forge:migrate`) instead. Stop.
71
+ store-schema migration (Steps 1–7 of `/forge:init --migrate`) instead. Stop.
72
72
  - If ABSENT: proceed (pre-T05 install confirmed).
73
73
 
74
74
  **0c. Check for in-progress sentinel (idempotency).**
@@ -293,7 +293,7 @@ node "$FORGE_ROOT/tools/substitute-placeholders.cjs" \
293
293
  ```
294
294
 
295
295
  This overwrites `.forge/personas/`, `.forge/skills/`, `.forge/workflows/`,
296
- `.forge/templates/`, and `.claude/commands/forge/` with the freshly substituted
296
+ `.forge/templates/`, and `.claude/commands/<prefix>/` with the freshly substituted
297
297
  base-pack.
298
298
 
299
299
  If `substitute-placeholders.cjs` exits non-zero: halt, report the error to the
@@ -0,0 +1,84 @@
1
+ ---
2
+ requirements:
3
+ reasoning: High
4
+ context: Medium
5
+ speed: Low
6
+ deps:
7
+ personas: [product-manager]
8
+ skills: [architect, generic]
9
+ templates: [SPRINT_REQUIREMENTS_TEMPLATE, SPRINT_MANIFEST_TEMPLATE]
10
+ sub_workflows: []
11
+ kb_docs: [MASTER_INDEX.md, architecture/stack.md]
12
+ config_fields: [project.prefix, paths.engineering]
13
+ ---
14
+
15
+ # 🌸 Meta-Workflow: Sprint Intake
16
+
17
+ ## Purpose
18
+
19
+ Capture sprint requirements via a structured interview and document them for planning.
20
+
21
+ <!-- See _fragments/iron-laws.md for Iron Laws section structure guidance -->
22
+ ## Iron Laws
23
+
24
+ - Capture requirements accurately; do not editorialize or pre-select options on the user's behalf. The product manager documents what the user says, not what the agent thinks is best.
25
+ - Read `.forge/personas/product-manager.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
26
+ - All store I/O via `forge_store` (or `node "$FORGE_ROOT/tools/store-cli.cjs"`). Never edit `.forge/store/*.json` directly.
27
+
28
+ ## Algorithm
29
+
30
+ ```
31
+ 0. Project Orientation:
32
+ - Your current working directory is the project root.
33
+ - Forge config lives at `.forge/config.json` (relative to cwd); the `forge_config` MCP tool returns canonical values.
34
+ - Engineering knowledge lives under `engineering/` (relative to cwd) — `MASTER_INDEX.md`, `architecture/`, `business-domain/`, `sprints/`, `features/`.
35
+ - Paths in subsequent steps resolve against this cwd.
36
+
37
+ 1. Pre-flight Gate Check:
38
+ - Probe token reporting: if the host runtime exposes a `/cost` slash command
39
+ (Claude Code), invoke it; on any other runtime treat as unavailable and
40
+ proceed. Do NOT search for or invent a `cost-cli.cjs` — there is no such tool.
41
+ - If the probe succeeds → note for later (will use reported data)
42
+ - If the probe fails or is unavailable → note for later (will use estimates)
43
+
44
+ 2. Load Context:
45
+ - Read `engineering/MASTER_INDEX.md` (relative to cwd)
46
+ - Read any pending feature requests or bug reports under `engineering/`
47
+
48
+ 3. Requirements Interview:
49
+ - Conduct a structured interview with the user
50
+ - Capture: Objectives, Constraints, Deliverables, and Success Criteria
51
+ - Clarify ambiguous requirements through iterative questioning
52
+
53
+ 4. Document Requirements:
54
+ - Generate `engineering/sprints/<SPRINT_ID>/SPRINT_REQUIREMENTS.md`
55
+ - Map requirements to existing Features if applicable
56
+ - Ensure all deliverables are measurable and testable
57
+
58
+ 5. Finalize:
59
+ - Update sprint status via `node "$FORGE_ROOT/tools/store-cli.cjs" update-status sprint {sprintId} status planning`
60
+ - **Do NOT emit a phase event yourself.** The orchestrator (or kickoff handler) owns event emission — it composes the canonical event from runtime telemetry (model, provider, tokens, wall times) plus the SUMMARY you write in the next step. Subagents that call `store-cli emit` for phase events hallucinate runtime facts (see Plan 11 / Slice 2). Write the SUMMARY and return.
61
+ ```
62
+
63
+ <!-- See _fragments/generation-instructions.md for Generation Instructions template -->
64
+ ## Generation Instructions
65
+
66
+ - **Persona Self-Load:** The generated workflow MUST begin by reading `.forge/personas/product-manager.md` as its first step (before any other tool use). This replaces the former inline `## Persona` section. The persona identity line (emoji, name, tagline) should be printed to stdout after reading the file.
67
+ - **Workflow Structure:** The generated `sprint_intake.md` must follow the strict "Algorithm" block format.
68
+ - **Context Isolation:** Forbid inline execution of requirement analysis; use the `Agent` tool for sub-tasks.
69
+ - **Project Specifics:**
70
+ - Reference project-specific requirement templates.
71
+ - **Token Reporting:** The generated workflow MUST mandate the following before returning:
72
+ 1. Probe session token usage: invoke `/cost` if the host runtime supports it
73
+ (Claude Code only); on any other runtime treat as unavailable. Do NOT
74
+ shell out to a `cost-cli.cjs` — there is no such tool.
75
+ 2. If the probe succeeds:
76
+ - Parse: `inputTokens`, `outputTokens`, `cacheReadTokens`, `cacheWriteTokens`, `estimatedCostUSD`.
77
+ - Add `"source": "reported"` to sidecar JSON.
78
+ 3. If the probe fails or is unavailable:
79
+ - Set token fields to `null`: `"inputTokens": null, "outputTokens": null, "estimatedCostUSD": null`.
80
+ - Add `"source": "missing"` to sidecar JSON.
81
+ - Log: "Token data unavailable (cost probe failed). Backfill later via estimate-usage.cjs."
82
+ 4. Write the usage sidecar via `node "$FORGE_ROOT/tools/store-cli.cjs" emit {sprintId} '{sidecar-json}' --sidecar`.
83
+ 5. **NEVER skip sidecar write.** Always emit (reported or placeholder with nulls).
84
+ - **Event Emission:** Ensure the "complete" event includes the `eventId` passed by the orchestrator.
@@ -172,7 +172,7 @@ and what capabilities it has. Two modes are supported, selected by the
172
172
  | `reference` | Compact summary from `.forge/cache/persona-pack.json`, plus a file_ref pointer to the full persona/skill definitions. | ✅ |
173
173
  | `inline` | Legacy: inject the full verbatim persona and skill file contents. Kept for one version as a rollback path. | |
174
174
 
175
- The pack is built by `/forge:regenerate` and `/forge:materialize` via
175
+ The pack is built by `/forge:rebuild` via
176
176
  `forge/tools/build-persona-pack.cjs`. It compiles YAML frontmatter from
177
177
  `$FORGE_ROOT/meta/personas/meta-*.md` and `$FORGE_ROOT/meta/skills/meta-*.md`
178
178
  into `.forge/cache/persona-pack.json`.
@@ -199,7 +199,7 @@ def compose_role_block(persona_noun):
199
199
  # regeneration bug and should be reported via /forge:report-bug.
200
200
  raise OrchestratorError(
201
201
  f"persona '{persona_noun}' not in persona-pack. "
202
- "Run /forge:regenerate to rebuild the pack."
202
+ "Run /forge:rebuild to rebuild the pack."
203
203
  )
204
204
 
205
205
  lines = [
@@ -435,6 +435,20 @@ for each task in dependency_sorted(tasks):
435
435
  # --- Load finalize fragment (token reporting contract) ---
436
436
  finalize_fragment = read_file(f"{FORGE_ROOT}/meta/workflows/_fragments/finalize.md") if file_exists(f"{FORGE_ROOT}/meta/workflows/_fragments/finalize.md") else ""
437
437
 
438
+ # --- Compose review loop context block (review-role phases only) ---
439
+ # Injected between summary_block and role_block so reviewers know their
440
+ # position in the revision loop at the moment they are spawned.
441
+ # `iteration` is the current attempt number (pre-spawn, not post-increment).
442
+ # `phase.maxIterations` is the configured limit (default 3).
443
+ if phase.role in ("review-plan", "review-code", "validate"):
444
+ review_loop_context = (
445
+ f"### Review Loop Context\n"
446
+ f"- Iteration: {iteration} of {phase.maxIterations}\n"
447
+ f"- Is final iteration: {iteration >= phase.maxIterations}\n\n"
448
+ )
449
+ else:
450
+ review_loop_context = ""
451
+
438
452
  spawn_kwargs = dict(
439
453
  prompt=(
440
454
  f"Append progress entries to {progress_log_path} via store-cli "
@@ -442,6 +456,7 @@ for each task in dependency_sorted(tasks):
442
456
  f"---\n\n"
443
457
  f"{architecture_block}"
444
458
  f"{summary_block}"
459
+ f"{review_loop_context}"
445
460
  f"{role_block}\n\n"
446
461
  f"### Project Context\n"
447
462
  f"{overlay_md}\n\n"
@@ -490,6 +505,7 @@ for each task in dependency_sorted(tasks):
490
505
  f"- Banner key: {banner_name}\n\n"
491
506
  f"Append progress entries as you work.\n\n"
492
507
  f"---\n\n"
508
+ f"{review_loop_context}"
493
509
  f"{role_block}\n\n"
494
510
  f"### Current Working Context\n"
495
511
  f"- Sprint Root: {sprint_root_path}\n"
@@ -952,7 +968,7 @@ Refer subagents to `.forge/schemas/event.schema.json` instead.
952
968
 
953
969
  ## Friction Emit
954
970
 
955
- When the Orchestrator detects skill friction during orchestrate-task — a referenced skill is unused, fails on invocation, is missing from the registry, has gone stale relative to current architecture, or is redundant with another skill — emit a `friction` event so `/forge:enhance --phase 2` can act on the signal. This is the writer side of the channel whose reader landed in S13-T08; the reader is empty without these emits.
971
+ When the Orchestrator detects skill friction during orchestrate-task — a referenced skill is unused, fails on invocation, is missing from the registry, has gone stale relative to current architecture, or is redundant with another skill — emit a `friction` event so `/forge:rebuild --enrich` (phase 2) can act on the signal. This is the writer side of the channel whose reader landed in S13-T08; the reader is empty without these emits.
956
972
 
957
973
  **Trigger conditions** (set `issue` to the matching token):
958
974
 
@@ -992,4 +1008,4 @@ experimental `^x_[a-z_]+$`. Emit one record per distinct friction signal
992
1008
  — do not coalesce.
993
1009
 
994
1010
  The generated `orchestrate_task.md` MUST carry this section verbatim —
995
- `/forge:enhance --phase 2` greps for it.
1011
+ `/forge:rebuild --enrich` (phase 2) greps for it.