@entelligentsia/forgecli 0.21.0 → 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 (297) hide show
  1. package/CHANGELOG.md +21 -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/forge-artifact-tool.d.ts +6 -8
  23. package/dist/extensions/forgecli/forge-artifact-tool.js +80 -195
  24. package/dist/extensions/forgecli/forge-artifact-tool.js.map +1 -1
  25. package/dist/extensions/forgecli/forge-commands.js +57 -18
  26. package/dist/extensions/forgecli/forge-commands.js.map +1 -1
  27. package/dist/extensions/forgecli/forge-init/phase4-register.js +6 -7
  28. package/dist/extensions/forgecli/forge-init/phase4-register.js.map +1 -1
  29. package/dist/extensions/forgecli/forge-init/run-phases.d.ts +4 -0
  30. package/dist/extensions/forgecli/forge-init/run-phases.js +304 -0
  31. package/dist/extensions/forgecli/forge-init/run-phases.js.map +1 -0
  32. package/dist/extensions/forgecli/forge-init/verifiers.d.ts +14 -5
  33. package/dist/extensions/forgecli/forge-init/verifiers.js +79 -62
  34. package/dist/extensions/forgecli/forge-init/verifiers.js.map +1 -1
  35. package/dist/extensions/forgecli/forge-init.js +131 -76
  36. package/dist/extensions/forgecli/forge-init.js.map +1 -1
  37. package/dist/extensions/forgecli/forge-subagent.d.ts +9 -0
  38. package/dist/extensions/forgecli/forge-subagent.js +11 -6
  39. package/dist/extensions/forgecli/forge-subagent.js.map +1 -1
  40. package/dist/extensions/forgecli/forge-tools.d.ts +28 -4
  41. package/dist/extensions/forgecli/forge-tools.js +122 -73
  42. package/dist/extensions/forgecli/forge-tools.js.map +1 -1
  43. package/dist/extensions/forgecli/health-check.js +3 -3
  44. package/dist/extensions/forgecli/health-check.js.map +1 -1
  45. package/dist/extensions/forgecli/hook-dispatcher.d.ts +1 -1
  46. package/dist/extensions/forgecli/hooks/check-update.d.ts +8 -0
  47. package/dist/extensions/forgecli/hooks/check-update.js +29 -1
  48. package/dist/extensions/forgecli/hooks/check-update.js.map +1 -1
  49. package/dist/extensions/forgecli/hooks/post-init-hook.js +6 -6
  50. package/dist/extensions/forgecli/hooks/post-init-hook.js.map +1 -1
  51. package/dist/extensions/forgecli/hooks/post-sprint-hook.js +6 -6
  52. package/dist/extensions/forgecli/hooks/post-sprint-hook.js.map +1 -1
  53. package/dist/extensions/forgecli/hooks/triage-error.js +1 -0
  54. package/dist/extensions/forgecli/hooks/triage-error.js.map +1 -1
  55. package/dist/extensions/forgecli/implement.js +20 -2
  56. package/dist/extensions/forgecli/implement.js.map +1 -1
  57. package/dist/extensions/forgecli/index.js +39 -32
  58. package/dist/extensions/forgecli/index.js.map +1 -1
  59. package/dist/extensions/forgecli/lib/pipeline-guard.d.ts +41 -0
  60. package/dist/extensions/forgecli/lib/pipeline-guard.js +100 -0
  61. package/dist/extensions/forgecli/lib/pipeline-guard.js.map +1 -0
  62. package/dist/extensions/forgecli/loaders/persona-skill-loader.js +2 -2
  63. package/dist/extensions/forgecli/loaders/persona-skill-loader.js.map +1 -1
  64. package/dist/extensions/forgecli/migrate.d.ts +3 -0
  65. package/dist/extensions/forgecli/migrate.js +4 -2
  66. package/dist/extensions/forgecli/migrate.js.map +1 -1
  67. package/dist/extensions/forgecli/plan.js +21 -2
  68. package/dist/extensions/forgecli/plan.js.map +1 -1
  69. package/dist/extensions/forgecli/quiz-agent.js +7 -7
  70. package/dist/extensions/forgecli/quiz-agent.js.map +1 -1
  71. package/dist/extensions/forgecli/regenerate.js +49 -18
  72. package/dist/extensions/forgecli/regenerate.js.map +1 -1
  73. package/dist/extensions/forgecli/remove-command.js +1 -1
  74. package/dist/extensions/forgecli/remove-command.js.map +1 -1
  75. package/dist/extensions/forgecli/report-bug.js +1 -1
  76. package/dist/extensions/forgecli/report-bug.js.map +1 -1
  77. package/dist/extensions/forgecli/retrospective.js +9 -9
  78. package/dist/extensions/forgecli/retrospective.js.map +1 -1
  79. package/dist/extensions/forgecli/review-code.d.ts +13 -0
  80. package/dist/extensions/forgecli/review-code.js +62 -3
  81. package/dist/extensions/forgecli/review-code.js.map +1 -1
  82. package/dist/extensions/forgecli/review-plan.d.ts +13 -0
  83. package/dist/extensions/forgecli/review-plan.js +65 -3
  84. package/dist/extensions/forgecli/review-plan.js.map +1 -1
  85. package/dist/extensions/forgecli/skill-curator-subagent.d.ts +2 -1
  86. package/dist/extensions/forgecli/skill-curator-subagent.js +2 -1
  87. package/dist/extensions/forgecli/skill-curator-subagent.js.map +1 -1
  88. package/dist/extensions/forgecli/sprint-intake.js +6 -6
  89. package/dist/extensions/forgecli/sprint-intake.js.map +1 -1
  90. package/dist/extensions/forgecli/sprint-plan.js +9 -9
  91. package/dist/extensions/forgecli/sprint-plan.js.map +1 -1
  92. package/dist/extensions/forgecli/status-command.js +1 -1
  93. package/dist/extensions/forgecli/status-command.js.map +1 -1
  94. package/dist/extensions/forgecli/store-query.js +11 -11
  95. package/dist/extensions/forgecli/store-query.js.map +1 -1
  96. package/dist/extensions/forgecli/store-repair.js +7 -7
  97. package/dist/extensions/forgecli/store-repair.js.map +1 -1
  98. package/dist/extensions/forgecli/validate.js +17 -2
  99. package/dist/extensions/forgecli/validate.js.map +1 -1
  100. package/dist/forge-payload/.base-pack/commands/check-agent.md +22 -0
  101. package/dist/forge-payload/.base-pack/commands/new-sprint.md +22 -0
  102. package/dist/forge-payload/.base-pack/commands/plan-sprint.md +22 -0
  103. package/dist/forge-payload/.base-pack/commands/quiz-agent.md +2 -18
  104. package/dist/forge-payload/.base-pack/commands/retro.md +22 -0
  105. package/dist/forge-payload/.base-pack/commands/retrospective.md +2 -18
  106. package/dist/forge-payload/.base-pack/commands/sprint-intake.md +2 -18
  107. package/dist/forge-payload/.base-pack/commands/sprint-plan.md +2 -18
  108. package/dist/forge-payload/.base-pack/workflows/_fragments/friction-emit.md +2 -2
  109. package/dist/forge-payload/.base-pack/workflows/_fragments/generation-instructions.md +4 -4
  110. package/dist/forge-payload/.base-pack/workflows/_fragments/iron-laws.md +1 -1
  111. package/dist/forge-payload/.base-pack/workflows/architect_approve.md +13 -1
  112. package/dist/forge-payload/.base-pack/workflows/commit_task.md +12 -1
  113. package/dist/forge-payload/.base-pack/workflows/enhance.md +6 -6
  114. package/dist/forge-payload/.base-pack/workflows/fix_bug.md +1 -1
  115. package/dist/forge-payload/.base-pack/workflows/implement_plan.md +14 -2
  116. package/dist/forge-payload/.base-pack/workflows/migrate_structural.md +2 -2
  117. package/dist/forge-payload/.base-pack/workflows/orchestrate_task.md +20 -4
  118. package/dist/forge-payload/.base-pack/workflows/plan_task.md +14 -2
  119. package/dist/forge-payload/.base-pack/workflows/review_code.md +37 -7
  120. package/dist/forge-payload/.base-pack/workflows/review_plan.md +36 -6
  121. package/dist/forge-payload/.base-pack/workflows/run_sprint.md +2 -2
  122. package/dist/forge-payload/.base-pack/workflows/validate_task.md +37 -7
  123. package/dist/forge-payload/.claude-plugin/plugin.json +1 -1
  124. package/dist/forge-payload/.schemas/config.schema.json +0 -5
  125. package/dist/forge-payload/.schemas/enum-catalog.json +9 -13
  126. package/dist/forge-payload/.schemas/migrations.json +54 -0
  127. package/dist/forge-payload/agents/tomoshibi.md +150 -6
  128. package/dist/forge-payload/commands/add-pipeline.md +1 -1
  129. package/dist/forge-payload/commands/add-task.md +1 -1
  130. package/dist/forge-payload/commands/calibrate.md +4 -350
  131. package/dist/forge-payload/commands/check-agent.md +38 -0
  132. package/dist/forge-payload/commands/config.md +3 -113
  133. package/dist/forge-payload/commands/enhance.md +5 -32
  134. package/dist/forge-payload/commands/health.md +155 -13
  135. package/dist/forge-payload/commands/init.md +25 -31
  136. package/dist/forge-payload/commands/migrate.md +6 -154
  137. package/dist/forge-payload/commands/quiz-agent.md +2 -34
  138. package/dist/forge-payload/commands/rebuild.md +664 -0
  139. package/dist/forge-payload/commands/regenerate.md +2 -774
  140. package/dist/forge-payload/commands/remove.md +10 -13
  141. package/dist/forge-payload/commands/repair.md +187 -0
  142. package/dist/forge-payload/commands/search.md +73 -0
  143. package/dist/forge-payload/commands/status.md +105 -0
  144. package/dist/forge-payload/commands/store-query.md +2 -69
  145. package/dist/forge-payload/commands/store-repair.md +2 -183
  146. package/dist/forge-payload/commands/update-tools.md +4 -50
  147. package/dist/forge-payload/commands/update.md +64 -58
  148. package/dist/forge-payload/hooks/check-update.cjs +1 -1
  149. package/dist/forge-payload/hooks/post-init.cjs +2 -2
  150. package/dist/forge-payload/hooks/post-sprint.cjs +2 -2
  151. package/dist/forge-payload/hooks/triage-error.cjs +11 -10
  152. package/dist/forge-payload/init/phases/phase-1-collect.md +138 -0
  153. package/dist/forge-payload/init/phases/phase-2-discover.md +127 -0
  154. package/dist/forge-payload/init/phases/phase-3-materialize.md +113 -0
  155. package/dist/forge-payload/init/phases/phase-4-register.md +159 -0
  156. package/dist/forge-payload/integrity.json +21 -24
  157. package/dist/forge-payload/meta/fragments/tool-discipline.md +22 -0
  158. package/dist/forge-payload/meta/templates/meta-retro.md +28 -0
  159. package/dist/forge-payload/meta/workflows/_fragments/friction-emit.md +2 -2
  160. package/dist/forge-payload/meta/workflows/_fragments/generation-instructions.md +4 -4
  161. package/dist/forge-payload/meta/workflows/_fragments/iron-laws.md +1 -1
  162. package/dist/forge-payload/meta/workflows/meta-approve.md +13 -1
  163. package/dist/forge-payload/meta/workflows/meta-check-agent.md +138 -0
  164. package/dist/forge-payload/meta/workflows/meta-commit.md +12 -1
  165. package/dist/forge-payload/meta/workflows/meta-enhance.md +5 -5
  166. package/dist/forge-payload/meta/workflows/meta-fix-bug.md +1 -1
  167. package/dist/forge-payload/meta/workflows/meta-implement.md +13 -1
  168. package/dist/forge-payload/meta/workflows/meta-migrate.md +3 -3
  169. package/dist/forge-payload/meta/workflows/meta-new-sprint.md +84 -0
  170. package/dist/forge-payload/meta/workflows/meta-orchestrate.md +20 -4
  171. package/dist/forge-payload/meta/workflows/meta-plan-sprint.md +152 -0
  172. package/dist/forge-payload/meta/workflows/meta-plan-task.md +13 -1
  173. package/dist/forge-payload/meta/workflows/meta-retro.md +73 -0
  174. package/dist/forge-payload/meta/workflows/meta-review-implementation.md +37 -7
  175. package/dist/forge-payload/meta/workflows/meta-review-plan.md +36 -6
  176. package/dist/forge-payload/meta/workflows/meta-validate.md +37 -7
  177. package/dist/forge-payload/schemas/config.schema.json +0 -5
  178. package/dist/forge-payload/schemas/enum-catalog.json +9 -13
  179. package/dist/forge-payload/schemas/structure-manifest.json +6 -8
  180. package/dist/forge-payload/tools/artifact.cjs +295 -0
  181. package/dist/forge-payload/tools/banners.cjs +3 -4
  182. package/dist/forge-payload/tools/build-context-pack.cjs +1 -1
  183. package/dist/forge-payload/tools/check-structure.cjs +8 -3
  184. package/dist/forge-payload/tools/store-cli.cjs +67 -7
  185. package/dist/forge-payload/tools/substitute-placeholders.cjs +1 -1
  186. package/dist/forge-payload/tools/verify-apply.cjs +75 -0
  187. package/dist/forge-payload/tools/verify-phase.cjs +259 -0
  188. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  189. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +0 -17
  190. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  191. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +21 -38
  192. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  193. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
  194. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +5 -4
  195. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
  196. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +2 -1
  197. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
  198. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +5 -2
  199. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
  200. package/node_modules/@earendil-works/pi-ai/package.json +1 -1
  201. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +24 -1
  202. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.d.ts.map +1 -1
  203. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.js +2 -3
  204. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.js.map +1 -1
  205. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.d.ts +1 -0
  206. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.d.ts.map +1 -1
  207. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.js +52 -22
  208. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.js.map +1 -1
  209. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  210. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +16 -4
  211. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  212. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
  213. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +45 -50
  214. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
  215. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
  216. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +43 -81
  217. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
  218. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  219. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/file-mutation-queue.js +27 -12
  220. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/file-mutation-queue.js.map +1 -1
  221. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
  222. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +2 -3
  223. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js.map +1 -1
  224. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -1
  225. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +3 -3
  226. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js.map +1 -1
  227. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -1
  228. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +5 -5
  229. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js.map +1 -1
  230. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.d.ts +2 -0
  231. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.d.ts.map +1 -1
  232. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js +37 -0
  233. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js.map +1 -1
  234. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
  235. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +9 -8
  236. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js.map +1 -1
  237. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
  238. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js +20 -35
  239. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js.map +1 -1
  240. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.d.ts +3 -0
  241. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  242. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js +64 -7
  243. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js.map +1 -1
  244. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  245. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +15 -3
  246. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
  247. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.d.ts +3 -1
  248. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.d.ts.map +1 -1
  249. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.js +14 -8
  250. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.js.map +1 -1
  251. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.d.ts +30 -0
  252. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.d.ts.map +1 -0
  253. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js +124 -0
  254. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js.map +1 -0
  255. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.d.ts +2 -0
  256. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.d.ts.map +1 -0
  257. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js +31 -0
  258. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js.map +1 -0
  259. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.d.ts +7 -27
  260. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.d.ts.map +1 -1
  261. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +75 -115
  262. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js.map +1 -1
  263. package/node_modules/@earendil-works/pi-coding-agent/docs/terminal-setup.md +6 -0
  264. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  265. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  266. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
  267. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  268. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +12 -14
  269. package/node_modules/@earendil-works/pi-coding-agent/package.json +5 -5
  270. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts +3 -0
  271. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +1 -0
  272. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +53 -0
  273. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +1 -0
  274. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  275. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +4 -1
  276. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  277. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +2 -0
  278. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  279. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +13 -1
  280. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  281. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
  282. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
  283. package/node_modules/@earendil-works/pi-tui/package.json +2 -2
  284. package/package.json +6 -6
  285. package/dist/extensions/forgecli/forge-init/phase-descriptors.d.ts +0 -72
  286. package/dist/extensions/forgecli/forge-init/phase-descriptors.js +0 -359
  287. package/dist/extensions/forgecli/forge-init/phase-descriptors.js.map +0 -1
  288. package/dist/extensions/forgecli/forge-init/prompts.d.ts +0 -10
  289. package/dist/extensions/forgecli/forge-init/prompts.js +0 -91
  290. package/dist/extensions/forgecli/forge-init/prompts.js.map +0 -1
  291. package/dist/extensions/forgecli/lib/store-error-remediation.d.ts +0 -65
  292. package/dist/extensions/forgecli/lib/store-error-remediation.js +0 -298
  293. package/dist/extensions/forgecli/lib/store-error-remediation.js.map +0 -1
  294. package/dist/forge-payload/hooks/check-update.js +0 -378
  295. package/dist/forge-payload/hooks/forge-permissions.js +0 -164
  296. package/dist/forge-payload/hooks/triage-error.js +0 -77
  297. 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
 
@@ -595,8 +595,8 @@ Invoked by T09 post-sprint hook or manually via `/forge:enhance --phase 2`.
595
595
 
596
596
  ### When to run
597
597
 
598
- Invoked by `/forge:enhance --phase 3` (default when no phase given), or delegated by
599
- `/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.
600
600
 
601
601
  ### Algorithm
602
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.
@@ -0,0 +1,152 @@
1
+ ---
2
+ requirements:
3
+ reasoning: High
4
+ context: Medium
5
+ speed: Low
6
+ deps:
7
+ personas: [architect]
8
+ skills: [architect, generic]
9
+ templates: [SPRINT_MANIFEST_TEMPLATE, TASK_PROMPT_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 Plan
16
+
17
+ ## Purpose
18
+
19
+ Break sprint requirements into a set of estimated tasks with a dependency graph.
20
+
21
+ ## Algorithm
22
+
23
+ ```
24
+ 0. Pre-flight Gate Check:
25
+ - Probe token reporting: if the host runtime exposes a `/cost` slash command
26
+ (Claude Code), invoke it; on any other runtime treat as unavailable. Do
27
+ NOT search for or invent a `cost-cli.cjs` — there is no such tool.
28
+ - If the probe succeeds → note for later (will use reported data)
29
+ - If the probe fails or is unavailable → note for later (will use estimates)
30
+
31
+ 1. Load Context:
32
+ - Query the store to orient on current project state before reading docs:
33
+ ```sh
34
+ node "$FORGE_ROOT/tools/store-cli.cjs" nlp "latest sprint"
35
+ node "$FORGE_ROOT/tools/store-cli.cjs" nlp "open bugs"
36
+ ```
37
+ Use results (titles, statuses, excerpts, file refs) to skip manual MASTER_INDEX.md navigation where sufficient.
38
+ - Read SPRINT_REQUIREMENTS.md
39
+ - Read architecture and domain docs
40
+ - Read the stack checklist
41
+
42
+ 2. Task Decomposition:
43
+ - Break requirements into atomic tasks
44
+ - Assign each task to a Feature (if applicable)
45
+ - Define clear acceptance criteria for each task
46
+ - Use the `ID-description` format (e.g., `FORGE-S05-agent-runtime-portability`) for sprint and task folders.
47
+
48
+ 3. Estimation and Sequencing:
49
+ - Estimate each task (S, M, L) based on complexity
50
+ - Define the dependency graph (which tasks must precede others)
51
+ - Identify the critical path
52
+
53
+ 4. Documentation:
54
+ - Write SPRINT_PLAN.md to `engineering/sprints/{sprintId}/SPRINT_PLAN.md`
55
+ - Create each task via `node "$FORGE_ROOT/tools/store-cli.cjs" write task '{task-json}'`.
56
+ If the command exits non-zero or the PreToolUse hook blocks the write:
57
+ parse the error, correct the JSON, and retry (see Store-Write Verification).
58
+ Do not proceed to the next task until this write succeeds.
59
+ - Update the sprint record with all new task IDs via `node "$FORGE_ROOT/tools/store-cli.cjs" write sprint '{updated-sprint-json}'` (the sprint JSON must include the complete `taskIds` array with all newly created task IDs).
60
+ If the command exits non-zero or the PreToolUse hook blocks the write:
61
+ parse the error, correct the JSON, and retry (see Store-Write Verification).
62
+ Do not proceed until this write succeeds.
63
+ - For each task, create its task folder and write TASK_PROMPT.md:
64
+ * Folder: `engineering/sprints/{sprintId}/{taskId}/`
65
+ * File: `TASK_PROMPT.md` — populate from `.forge/templates/TASK_PROMPT_TEMPLATE.md`
66
+ filling in title, objective, acceptance criteria, entities, DSL/CLI changes, and operational impact
67
+ - Update sprint status via `node "$FORGE_ROOT/tools/store-cli.cjs" update-status sprint {sprintId} status active`.
68
+ If the command exits non-zero, parse the error and retry
69
+ (see Store-Write Verification). Do not proceed until this write succeeds.
70
+
71
+ 5. Finalize:
72
+ - **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.
73
+ ```
74
+
75
+ <!-- See _fragments/iron-laws.md for Iron Laws section structure guidance (sprint-plan uses verbatim Anti-Pattern Guard pattern — orchestrator-special case) -->
76
+ ## Anti-Pattern Guard
77
+
78
+ The generated workflow MUST include the following section verbatim, placed immediately
79
+ after the Purpose heading and before the Algorithm block:
80
+
81
+ ```
82
+ ## Iron Laws
83
+
84
+ - YOU MUST NOT write any code, pseudocode, or implementation sketch.
85
+ - YOU MUST NOT produce a plan of your own before reading this workflow.
86
+ - YOU MUST follow the Algorithm below step by step. Reading it is not optional.
87
+ - If you have already read SPRINT_REQUIREMENTS.md and feel ready to decompose tasks:
88
+ stop. Return to step 1 of the Algorithm and proceed from there.
89
+ ```
90
+
91
+ <!-- See _fragments/store-write-verification.md — NOTE: this file uses an intentionally expanded
92
+ Store-Write Verification variant that explains what counts as a store write in the sprint-plan
93
+ context (includes direct Write/Edit tool calls). Canonical fragment is reference only. -->
94
+ ## Store-Write Verification
95
+
96
+ Every write to the Forge store MUST succeed before the agent proceeds to the next
97
+ step. Store writes include `store-cli` commands (`write`, `update-status`, `emit`)
98
+ and direct `Write`/`Edit` tool calls against Forge-owned paths under
99
+ `.forge/store/`.
100
+
101
+ If a write is rejected — either by `store-cli` exiting non-zero or by the
102
+ `PreToolUse` write-boundary hook blocking the call with exit code 2 — the agent
103
+ MUST:
104
+
105
+ 1. **Parse the error.** Both `store-cli` and the write-boundary hook emit
106
+ structured messages naming the offending field and referencing the relevant
107
+ schema file (e.g. `forge/schemas/task.schema.json`). Read the error carefully
108
+ to identify which field is wrong and what the schema expects.
109
+ 2. **Correct the data.** Fix the JSON payload to satisfy the schema: add missing
110
+ required fields, fix type mismatches, remove undeclared properties, correct
111
+ enum values, etc. If the hook message mentions a schema file, read that file
112
+ to understand the full shape.
113
+ 3. **Retry the write.** Re-attempt the same store write with the corrected payload.
114
+ 4. **Repeat until success.** Do NOT advance past the current step, emit events,
115
+ or produce further artifacts until the write is confirmed successful.
116
+
117
+ **Maximum retries: 3.** If the write still fails after 3 correction attempts,
118
+ halt and escalate to the human. Include the original payload, the corrected
119
+ payload, and all error messages in the escalation.
120
+
121
+ **Do NOT** set `FORGE_SKIP_WRITE_VALIDATION=1` to bypass a schema error. That
122
+ environment variable is reserved for emergency operator repair only.
123
+
124
+ <!-- See _fragments/generation-instructions.md for Generation Instructions template -->
125
+ ## Generation Instructions
126
+
127
+ - **Persona Self-Load:** The generated workflow MUST begin by reading `.forge/personas/architect.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.
128
+ - **Workflow Structure:** The generated `sprint_plan.md` must follow the strict "Algorithm" block format.
129
+ - **Context Isolation:** Forbid inline execution of task decomposition or estimation; use the `Agent` tool for sub-tasks.
130
+ - **Project Specifics:**
131
+ - Use project-specific estimation guidelines.
132
+ - Reference project's task manifest schema.
133
+ - **Token Reporting:** The generated workflow MUST mandate the following before returning:
134
+ 1. Probe session token usage: invoke `/cost` if the host runtime supports it
135
+ (Claude Code only); on any other runtime treat as unavailable. Do NOT
136
+ shell out to a `cost-cli.cjs` — there is no such tool.
137
+ 2. If the probe succeeds:
138
+ - Parse: `inputTokens`, `outputTokens`, `cacheReadTokens`, `cacheWriteTokens`, `estimatedCostUSD`.
139
+ - Add `"source": "reported"` to sidecar JSON.
140
+ 3. If the probe fails or is unavailable:
141
+ - Set token fields to `null`: `"inputTokens": null, "outputTokens": null, "estimatedCostUSD": null`.
142
+ - Add `"source": "missing"` to sidecar JSON.
143
+ - Log: "Token data unavailable (cost probe failed). Backfill later via estimate-usage.cjs."
144
+ 4. Write the usage sidecar via `node "$FORGE_ROOT/tools/store-cli.cjs" emit {sprintId} '{sidecar-json}' --sidecar`.
145
+ 5. **NEVER skip sidecar write.** Always emit (reported or placeholder with nulls).
146
+ - **Event Emission:** Ensure the "complete" event includes the `eventId` passed by the orchestrator.
147
+ - **Store-Write Verification:** The generated workflow MUST include the "Store-Write
148
+ Verification" section verbatim. Every `store-cli write`, `store-cli update-status`,
149
+ and `store-cli emit` command in the Algorithm must be annotated with the
150
+ parse-correct-retry instruction: "If the command exits non-zero or the
151
+ PreToolUse hook blocks the write: parse the error, correct the JSON, and retry
152
+ (see Store-Write Verification). Do not proceed until this write succeeds."