@entelligentsia/forgecli 1.0.10 → 1.0.14

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 (167) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/CHANGELOG-forge-plugin.md +150 -0
  3. package/dist/bin/forge.js +0 -0
  4. package/dist/extensions/forgecli/config-layer.d.ts +16 -0
  5. package/dist/extensions/forgecli/config-layer.js +5 -0
  6. package/dist/extensions/forgecli/config-layer.js.map +1 -1
  7. package/dist/extensions/forgecli/dashboard/component.d.ts +102 -0
  8. package/dist/extensions/forgecli/dashboard/component.js +882 -0
  9. package/dist/extensions/forgecli/dashboard/component.js.map +1 -0
  10. package/dist/extensions/forgecli/dashboard/register.d.ts +2 -0
  11. package/dist/extensions/forgecli/dashboard/register.js +45 -0
  12. package/dist/extensions/forgecli/dashboard/register.js.map +1 -0
  13. package/dist/extensions/forgecli/dashboard/view-model.d.ts +35 -0
  14. package/dist/extensions/forgecli/dashboard/view-model.js +54 -0
  15. package/dist/extensions/forgecli/dashboard/view-model.js.map +1 -0
  16. package/dist/extensions/forgecli/fix-bug.js +72 -7
  17. package/dist/extensions/forgecli/fix-bug.js.map +1 -1
  18. package/dist/extensions/forgecli/forge-cli-schema.json +4 -0
  19. package/dist/extensions/forgecli/forge-commands.js +1 -0
  20. package/dist/extensions/forgecli/forge-commands.js.map +1 -1
  21. package/dist/extensions/forgecli/forge-init/phase4-register.js +53 -0
  22. package/dist/extensions/forgecli/forge-init/phase4-register.js.map +1 -1
  23. package/dist/extensions/forgecli/forge-subagent.js +6 -4
  24. package/dist/extensions/forgecli/forge-subagent.js.map +1 -1
  25. package/dist/extensions/forgecli/index.js +5 -0
  26. package/dist/extensions/forgecli/index.js.map +1 -1
  27. package/dist/extensions/forgecli/lib/halt-advisor.d.ts +54 -0
  28. package/dist/extensions/forgecli/lib/halt-advisor.js +90 -0
  29. package/dist/extensions/forgecli/lib/halt-advisor.js.map +1 -0
  30. package/dist/extensions/forgecli/migration-engine.js +25 -12
  31. package/dist/extensions/forgecli/migration-engine.js.map +1 -1
  32. package/dist/extensions/forgecli/orchestrator-status-bar.d.ts +25 -0
  33. package/dist/extensions/forgecli/orchestrator-status-bar.js +183 -0
  34. package/dist/extensions/forgecli/orchestrator-status-bar.js.map +1 -0
  35. package/dist/extensions/forgecli/orchestrator-tree.d.ts +96 -0
  36. package/dist/extensions/forgecli/orchestrator-tree.js +390 -0
  37. package/dist/extensions/forgecli/orchestrator-tree.js.map +1 -0
  38. package/dist/extensions/forgecli/project-orientation.js +12 -8
  39. package/dist/extensions/forgecli/project-orientation.js.map +1 -1
  40. package/dist/extensions/forgecli/regenerate.d.ts +16 -0
  41. package/dist/extensions/forgecli/regenerate.js +110 -0
  42. package/dist/extensions/forgecli/regenerate.js.map +1 -1
  43. package/dist/extensions/forgecli/run-sprint.js +33 -3
  44. package/dist/extensions/forgecli/run-sprint.js.map +1 -1
  45. package/dist/extensions/forgecli/run-task.d.ts +32 -0
  46. package/dist/extensions/forgecli/run-task.js +185 -12
  47. package/dist/extensions/forgecli/run-task.js.map +1 -1
  48. package/dist/extensions/forgecli/thread-switcher.js +105 -764
  49. package/dist/extensions/forgecli/thread-switcher.js.map +1 -1
  50. package/dist/extensions/forgecli/viewport-events.js +32 -0
  51. package/dist/extensions/forgecli/viewport-events.js.map +1 -1
  52. package/dist/forge-payload/.base-pack/commands/fix-bug.md +1 -1
  53. package/dist/forge-payload/.base-pack/commands/run-sprint.md +1 -1
  54. package/dist/forge-payload/.base-pack/commands/run-task.md +1 -1
  55. package/dist/forge-payload/.base-pack/personas/architect.md +1 -1
  56. package/dist/forge-payload/.base-pack/personas/bug-fixer.md +1 -1
  57. package/dist/forge-payload/.base-pack/personas/collator.md +3 -3
  58. package/dist/forge-payload/.base-pack/personas/engineer.md +1 -1
  59. package/dist/forge-payload/.base-pack/personas/librarian.md +1 -1
  60. package/dist/forge-payload/.base-pack/personas/orchestrator.md +1 -1
  61. package/dist/forge-payload/.base-pack/personas/product-manager.md +1 -1
  62. package/dist/forge-payload/.base-pack/personas/qa-engineer.md +1 -1
  63. package/dist/forge-payload/.base-pack/personas/supervisor.md +1 -1
  64. package/dist/forge-payload/.base-pack/workflows/_fragments/event-emission-schema.md +1 -1
  65. package/dist/forge-payload/.base-pack/workflows/_fragments/friction-emit.md +1 -1
  66. package/dist/forge-payload/.base-pack/workflows/_fragments/iron-laws.md +1 -1
  67. package/dist/forge-payload/.base-pack/workflows/_fragments/progress-reporting.md +2 -2
  68. package/dist/forge-payload/.base-pack/workflows/_fragments/store-cli-verbs.md +11 -2
  69. package/dist/forge-payload/.base-pack/workflows/architect_approve.md +6 -7
  70. package/dist/forge-payload/.base-pack/workflows/architect_review_sprint_completion.md +2 -2
  71. package/dist/forge-payload/.base-pack/workflows/architect_sprint_intake.md +2 -2
  72. package/dist/forge-payload/.base-pack/workflows/architect_sprint_plan.md +5 -5
  73. package/dist/forge-payload/.base-pack/workflows/collator_agent.md +4 -6
  74. package/dist/forge-payload/.base-pack/workflows/commit_task.md +5 -6
  75. package/dist/forge-payload/.base-pack/workflows/enhance.md +5 -5
  76. package/dist/forge-payload/.base-pack/workflows/implement_plan.md +6 -7
  77. package/dist/forge-payload/.base-pack/workflows/migrate_structural.md +12 -13
  78. package/dist/forge-payload/.base-pack/workflows/plan_task.md +5 -6
  79. package/dist/forge-payload/.base-pack/workflows/review_code.md +8 -8
  80. package/dist/forge-payload/.base-pack/workflows/review_plan.md +8 -8
  81. package/dist/forge-payload/.base-pack/workflows/sprint_retrospective.md +3 -3
  82. package/dist/forge-payload/.base-pack/workflows/triage.md +12 -9
  83. package/dist/forge-payload/.base-pack/workflows/update_implementation.md +2 -2
  84. package/dist/forge-payload/.base-pack/workflows/update_plan.md +2 -2
  85. package/dist/forge-payload/.base-pack/workflows/validate_task.md +5 -6
  86. package/dist/forge-payload/.base-pack/workflows-js/wfl-fix-bug.js +490 -0
  87. package/dist/forge-payload/.base-pack/workflows-js/wfl-run-sprint.js +416 -0
  88. package/dist/forge-payload/.base-pack/workflows-js/wfl-run-task.js +608 -0
  89. package/dist/forge-payload/.claude-plugin/plugin.json +1 -1
  90. package/dist/forge-payload/.schemas/config.schema.json +2 -3
  91. package/dist/forge-payload/.schemas/enum-catalog.json +2 -2
  92. package/dist/forge-payload/.schemas/event.schema.json +16 -0
  93. package/dist/forge-payload/.schemas/migrations.json +236 -0
  94. package/dist/forge-payload/commands/health.md +29 -0
  95. package/dist/forge-payload/commands/rebuild.md +143 -15
  96. package/dist/forge-payload/commands/update.md +28 -27
  97. package/dist/forge-payload/hooks/preflight-session.cjs +99 -0
  98. package/dist/forge-payload/init/phases/phase-3-materialize.md +18 -5
  99. package/dist/forge-payload/integrity.json +7 -6
  100. package/dist/forge-payload/meta/fragments/tool-discipline.md +1 -1
  101. package/dist/forge-payload/meta/personas/meta-architect.md +1 -1
  102. package/dist/forge-payload/meta/personas/meta-bug-fixer.md +1 -1
  103. package/dist/forge-payload/meta/personas/meta-collator.md +7 -7
  104. package/dist/forge-payload/meta/personas/meta-engineer.md +1 -1
  105. package/dist/forge-payload/meta/personas/meta-orchestrator.md +1 -1
  106. package/dist/forge-payload/meta/personas/meta-supervisor.md +1 -1
  107. package/dist/forge-payload/meta/tool-specs/store-cli.spec.md +1 -1
  108. package/dist/forge-payload/meta/workflows/_fragments/event-emission-schema.md +1 -1
  109. package/dist/forge-payload/meta/workflows/_fragments/friction-emit.md +1 -1
  110. package/dist/forge-payload/meta/workflows/_fragments/iron-laws.md +1 -1
  111. package/dist/forge-payload/meta/workflows/_fragments/progress-reporting.md +2 -2
  112. package/dist/forge-payload/meta/workflows/_fragments/store-cli-verbs.md +11 -2
  113. package/dist/forge-payload/meta/workflows/meta-approve.md +6 -7
  114. package/dist/forge-payload/meta/workflows/meta-bug-triage.md +12 -9
  115. package/dist/forge-payload/meta/workflows/meta-collate.md +5 -7
  116. package/dist/forge-payload/meta/workflows/meta-commit.md +5 -6
  117. package/dist/forge-payload/meta/workflows/meta-enhance.md +5 -5
  118. package/dist/forge-payload/meta/workflows/meta-fix-bug.md +35 -11
  119. package/dist/forge-payload/meta/workflows/meta-implement.md +15 -7
  120. package/dist/forge-payload/meta/workflows/meta-migrate.md +13 -14
  121. package/dist/forge-payload/meta/workflows/meta-new-sprint.md +3 -3
  122. package/dist/forge-payload/meta/workflows/meta-orchestrate.md +138 -39
  123. package/dist/forge-payload/meta/workflows/meta-plan-sprint.md +6 -6
  124. package/dist/forge-payload/meta/workflows/meta-plan-task.md +12 -6
  125. package/dist/forge-payload/meta/workflows/meta-retro.md +4 -4
  126. package/dist/forge-payload/meta/workflows/meta-retrospective.md +4 -4
  127. package/dist/forge-payload/meta/workflows/meta-review-implementation.md +8 -8
  128. package/dist/forge-payload/meta/workflows/meta-review-plan.md +8 -8
  129. package/dist/forge-payload/meta/workflows/meta-review-sprint-completion.md +3 -3
  130. package/dist/forge-payload/meta/workflows/meta-sprint-intake.md +3 -3
  131. package/dist/forge-payload/meta/workflows/meta-sprint-plan.md +6 -6
  132. package/dist/forge-payload/meta/workflows/meta-update-implementation.md +2 -2
  133. package/dist/forge-payload/meta/workflows/meta-update-plan.md +2 -2
  134. package/dist/forge-payload/meta/workflows/meta-validate.md +5 -6
  135. package/dist/forge-payload/schemas/config.schema.json +2 -3
  136. package/dist/forge-payload/schemas/enum-catalog.json +2 -2
  137. package/dist/forge-payload/schemas/event.schema.json +16 -0
  138. package/dist/forge-payload/schemas/structure-manifest.json +75 -73
  139. package/dist/forge-payload/skills/refresh-kb-links/SKILL.md +14 -7
  140. package/dist/forge-payload/tools/banners.cjs +29 -10
  141. package/dist/forge-payload/tools/check-structure.cjs +88 -7
  142. package/dist/forge-payload/tools/collate.cjs +16 -2
  143. package/dist/forge-payload/tools/manage-config.cjs +5 -7
  144. package/dist/forge-payload/tools/parse-gates.cjs +73 -1
  145. package/dist/forge-payload/tools/postflight-gate.cjs +252 -0
  146. package/dist/forge-payload/tools/preflight-gate.cjs +47 -0
  147. package/dist/forge-payload/tools/substitute-placeholders.cjs +5 -4
  148. package/dist/forge-payload/tools/verify-phase.cjs +17 -0
  149. package/package.json +1 -1
  150. package/dist/bin/forgecli.d.ts +0 -2
  151. package/dist/bin/forgecli.js +0 -6
  152. package/dist/bin/forgecli.js.map +0 -1
  153. package/dist/extensions/forgecli/config-tui/index.d.ts +0 -5
  154. package/dist/extensions/forgecli/config-tui/index.js +0 -5
  155. package/dist/extensions/forgecli/config-tui/index.js.map +0 -1
  156. package/dist/extensions/forgecli/loaders/persona-skill-loader.d.ts +0 -45
  157. package/dist/extensions/forgecli/loaders/persona-skill-loader.js +0 -227
  158. package/dist/extensions/forgecli/loaders/persona-skill-loader.js.map +0 -1
  159. package/dist/extensions/forgecli/loaders/template-render.d.ts +0 -20
  160. package/dist/extensions/forgecli/loaders/template-render.js +0 -85
  161. package/dist/extensions/forgecli/loaders/template-render.js.map +0 -1
  162. package/dist/extensions/forgecli/loaders/workflow-loader.d.ts +0 -41
  163. package/dist/extensions/forgecli/loaders/workflow-loader.js +0 -164
  164. package/dist/extensions/forgecli/loaders/workflow-loader.js.map +0 -1
  165. package/dist/forge-payload/.base-pack/workflows/fix_bug.md +0 -446
  166. package/dist/forge-payload/.base-pack/workflows/orchestrate_task.md +0 -928
  167. package/dist/forge-payload/.base-pack/workflows/run_sprint.md +0 -225
@@ -23,7 +23,7 @@ Regenerate markdown views from the JSON store. This is a deterministic operation
23
23
 
24
24
  - Collation is a read-and-rewrite of generated markdown. Do not mutate any JSON record under `.forge/store/`; the store is the source of truth and collation flows downstream from it.
25
25
  - Read `.forge/personas/collator.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
26
- - All store reads via `forge_store` (or `node "$FORGE_ROOT/tools/store-cli.cjs"`). Never edit `.forge/store/*.json` directly.
26
+ - All store reads via `forge_store` (or `node .forge/tools/store-cli.cjs`). Never edit `.forge/store/*.json` directly.
27
27
  - Do NOT call `set-summary` or `set-bug-summary` from within collation. The collator writes markdown views and a `WRITEBACK-SUMMARY.json` disk file only. Calling `set-summary` mutates the JSON store and violates Iron Law 1 (the store is the source of truth; collation flows downstream from it, not into it). The orchestrator reads `WRITEBACK-SUMMARY.json` directly — no store write is needed.
28
28
 
29
29
  <!-- See _fragments/store-write-verification.md — NOTE: this file uses an intentionally modified
@@ -46,8 +46,7 @@ Never set `FORGE_SKIP_WRITE_VALIDATION=1` — operator-only emergency switch.
46
46
 
47
47
  ```
48
48
  1. Preferred: Run Plugin Tool
49
- - Read `paths.forgeRoot` from `.forge/config.json` as `FORGE_ROOT`
50
- - Run: `node "$FORGE_ROOT/tools/collate.cjs" [SPRINT_ID]`
49
+ - Run: `node .forge/tools/collate.cjs [SPRINT_ID]`
51
50
  - If tool succeeds, proceed to Finalize
52
51
 
53
52
  2. Fallback: Manual Collation
@@ -61,9 +60,8 @@ Never set `FORGE_SKIP_WRITE_VALIDATION=1` — operator-only emergency switch.
61
60
  - Rebuild the architecture context pack so orchestrators have a fresh summary
62
61
  after any KB updates (architecture docs may have changed during the sprint):
63
62
  ```
64
- FORGE_ROOT=$(node -e "console.log(require('./.forge/config.json').paths.forgeRoot)")
65
- ENGINEERING=$(node "$FORGE_ROOT/tools/manage-config.cjs" get paths.engineering 2>/dev/null || echo engineering)
66
- node "$FORGE_ROOT/tools/build-context-pack.cjs" \
63
+ ENGINEERING=$(node .forge/tools/manage-config.cjs get paths.engineering 2>/dev/null || echo engineering)
64
+ node .forge/tools/build-context-pack.cjs \
67
65
  --arch-dir "$ENGINEERING/architecture" \
68
66
  --out-md .forge/cache/context-pack.md \
69
67
  --out-json .forge/cache/context-pack.json
@@ -101,5 +99,5 @@ Never set `FORGE_SKIP_WRITE_VALIDATION=1` — operator-only emergency switch.
101
99
  (Claude Code only); on any other runtime treat as unavailable and proceed.
102
100
  Do NOT shell out to a `cost-cli.cjs` — there is no such tool.
103
101
  2. Parse: `inputTokens`, `outputTokens`, `cacheReadTokens`, `cacheWriteTokens`, `estimatedCostUSD`.
104
- 3. Write the usage sidecar via `node "$FORGE_ROOT/tools/store-cli.cjs" emit {sprintId} '{sidecar-json}' --sidecar`.
102
+ 3. Write the usage sidecar via `node .forge/tools/store-cli.cjs emit {sprintId} '{sidecar-json}' --sidecar`.
105
103
  - **Event Emission:** Ensure the "complete" event includes the `eventId` passed by the orchestrator.
@@ -31,7 +31,7 @@ Seal a completed and approved task by committing its artifacts to the VCS and up
31
31
 
32
32
  - Commit only the artifacts produced for this task; do not sweep unrelated working-tree changes into the commit. The commit boundary mirrors the task boundary.
33
33
  - Read `.forge/personas/engineer.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
34
- - All store I/O via `forge_store` (or `node "$FORGE_ROOT/tools/store-cli.cjs"`). Never edit `.forge/store/*.json` directly.
34
+ - All store I/O via `forge_store` (or `node .forge/tools/store-cli.cjs`). Never edit `.forge/store/*.json` directly.
35
35
 
36
36
  ## Store-Write Verification
37
37
 
@@ -42,9 +42,8 @@ Seal a completed and approved task by committing its artifacts to the VCS and up
42
42
  ```
43
43
 
44
44
  0a. Pre-flight Gate Check:
45
- - Resolve FORGE_ROOT (`node -e "console.log(require('./.forge/config.json').paths.forgeRoot)"`).
46
45
  - **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
- - Run: `node "$FORGE_ROOT/tools/preflight-gate.cjs" --phase commit --{entity_kind} {record_id}`
46
+ - Run: `node .forge/tools/preflight-gate.cjs --phase commit --{entity_kind} {record_id}`
48
47
  - Exit 1 (gate failed) → print stderr and HALT. Do not proceed; do not attempt to produce the artifact.
49
48
  - Exit 2 (misconfiguration) → print stderr and HALT.
50
49
  - Exit 0 → continue.
@@ -53,7 +52,7 @@ Seal a completed and approved task by committing its artifacts to the VCS and up
53
52
  - If `--force` is present in the invocation arguments, skip this step entirely.
54
53
  - If `entity_kind == "bug"`, skip this step entirely (bug state is managed by meta-fix-bug.md).
55
54
  - Read current task state:
56
- `node "$FORGE_ROOT/tools/store-cli.cjs" read task {record_id} --json`
55
+ `node .forge/tools/store-cli.cjs read task {record_id} --json`
57
56
  - Extract the `status` field from the JSON output.
58
57
  - Allowed states for this phase: `approved`.
59
58
  - If the current status is NOT in the allowed set:
@@ -79,8 +78,8 @@ Seal a completed and approved task by committing its artifacts to the VCS and up
79
78
 
80
79
  4. Store Finalization:
81
80
  - Transitions:
82
- - **Task mode** — `approved → committed` (terminal): `node "$FORGE_ROOT/tools/store-cli.cjs" update-status task {taskId} status committed`
83
- - **Bug mode** — `in-progress → fixed` (terminal): `node "$FORGE_ROOT/tools/store-cli.cjs" update-status bug {bugId} status fixed`. This is the ONLY phase in the bug pipeline that writes `bug.status` post-triage (see `meta-fix-bug.md § Iron Laws #2`). Do NOT write `approved` or `verified` — those values are vestigial enum members slated for removal.
81
+ - **Task mode** — `approved → committed` (terminal): `node .forge/tools/store-cli.cjs update-status task {taskId} status committed`
82
+ - **Bug mode** — `in-progress → fixed` (terminal): `node .forge/tools/store-cli.cjs update-status bug {bugId} status fixed`. This is the ONLY phase in the bug pipeline that writes `bug.status` post-triage (see `meta-fix-bug.md § Iron Laws #2`). Do NOT write `approved` or `verified` — those values are vestigial enum members slated for removal.
84
83
 
85
84
  5. Finalize:
86
85
  - **Do NOT emit a phase event yourself.** The orchestrator 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.
@@ -10,7 +10,7 @@ deps:
10
10
  templates: []
11
11
  sub_workflows: []
12
12
  kb_docs: []
13
- config_fields: [paths.engineering, paths.forgeRoot]
13
+ config_fields: [paths.engineering]
14
14
  ---
15
15
 
16
16
  # Meta-Workflow: Enhancement Agent
@@ -20,7 +20,7 @@ deps:
20
20
 
21
21
  - Orchestrator-only: this workflow runs with full tool access in the orchestrator session. NEVER delegate it to a subagent.
22
22
  - Read `.forge/personas/engineer.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
23
- - All store I/O via `forge_store` (or `node "$FORGE_ROOT/tools/store-cli.cjs"`). Never edit `.forge/store/*.json` directly.
23
+ - All store I/O via `forge_store` (or `node .forge/tools/store-cli.cjs`). Never edit `.forge/store/*.json` directly.
24
24
  - Phase 1 only touches `{{KEY}}` token text; never rewrite persona prose, algorithm steps, or role definitions.
25
25
 
26
26
  <!-- See _fragments/store-write-verification.md — NOTE: this file uses an intentionally abbreviated
@@ -140,7 +140,7 @@ Invoked by T09 post-init hook (`--auto`) or manually via `/forge:rebuild --enric
140
140
 
141
141
  2. **Skip runtime passthrough keys** — keys used at runtime (e.g., `{{TASK_ID}}`, `{{SPRINT_ID}}`,
142
142
  `{{ARGUMENTS}}`) are intentional and must not be substituted. Read
143
- `$FORGE_ROOT/tools/substitute-placeholders.cjs` to identify the RUNTIME_PASSTHROUGH_KEYS list.
143
+ `.forge/tools/substitute-placeholders.cjs` to identify the RUNTIME_PASSTHROUGH_KEYS list.
144
144
  Exclude them from the fill candidates.
145
145
 
146
146
  3. **Derive values from codebase signals** — for each remaining `{{KEY}}`, attempt to derive a
@@ -172,7 +172,7 @@ Invoked by T09 post-init hook (`--auto`) or manually via `/forge:rebuild --enric
172
172
 
173
173
  6. **Snapshot gate** — if at least one fill was applied:
174
174
  ```sh
175
- node "$FORGE_ROOT/tools/manage-versions.cjs" add-snapshot \
175
+ node .forge/tools/manage-versions.cjs add-snapshot \
176
176
  --source post-init \
177
177
  --enhanced-elements "<comma-separated list of relative .forge/ paths that were modified>"
178
178
  ```
@@ -180,7 +180,7 @@ Invoked by T09 post-init hook (`--auto`) or manually via `/forge:rebuild --enric
180
180
 
181
181
  7. **Emit enhancement event** to the store:
182
182
  ```sh
183
- node "$FORGE_ROOT/tools/store-cli.cjs" emit enhancement '{
183
+ node .forge/tools/store-cli.cjs emit enhancement '{
184
184
  "eventId": "<ISO timestamp slug>_enhance_phase1",
185
185
  "taskId": "enhancement",
186
186
  "sprintId": "enhancement",
@@ -138,7 +138,13 @@ Differences are confined to the **triage** step and the **path branch**.
138
138
 
139
139
  ```
140
140
  1. Pre-loop setup (mirrors meta-orchestrate.md):
141
- - Resolve FORGE_ROOT.
141
+ - Session Preflight (see `meta-orchestrate.md § Session Preflight`):
142
+ Read `.forge/cache/preflight-status.json` if present and fresh; otherwise
143
+ run `node .forge/tools/forge-preflight.cjs --bug {bugId}` and read
144
+ its stdout. Use `blob.forgeRoot` as FORGE_ROOT for the remainder of the
145
+ run — do not re-derive it. Branch on `blob.ok`: ok:true → proceed;
146
+ ok:false → halt (fast-fail-safe), emit escalation event, instruct operator
147
+ to fix the surfaced preflight warning before re-running.
142
148
  - Detect execution cluster from ANTHROPIC_DEFAULT_*_MODEL env vars.
143
149
  - Clear progress log: store-cli progress-clear bugs
144
150
  - Read bug record. If status ∈ {blocked, escalated, fixed, abandoned}:
@@ -159,6 +165,12 @@ Differences are confined to the **triage** step and the **path branch**.
159
165
  - On return, orchestrator transitions status:
160
166
  store-cli update-status bug {bugId} status triaged
161
167
  store-cli update-status bug {bugId} status in-progress
168
+ # Digest-compliance note (FORGE-S27-T05): update-status is already silent on
169
+ # success (no stdout on the success path). The two-step triaged→in-progress
170
+ # transition is a required state-machine contract per Iron Law 2 — only triage
171
+ # and commit own bug.status writes. Collapsing these two writes into one would
172
+ # be a behavioral violation. This is not LLM-hand-run glue; it executes as a
173
+ # direct tool call after the triage subagent returns.
162
174
  - Read summaries.triage.route. If neither "A" nor "B": escalate
163
175
  (verdict_malformed). Do not guess.
164
176
 
@@ -171,12 +183,22 @@ Differences are confined to the **triage** step and the **path branch**.
171
183
  - Resolve model (cluster + ROLE_TIER).
172
184
  - Compute eventId, agent_name, banner_name (from PERSONA_MAP /
173
185
  BANNER_MAP below).
174
- - Announce phase: banner + "→ {bugId} [{display_model}]".
186
+ - Announce phase:
187
+ run_bash(f'node .forge/tools/banners.cjs --badge {banner_name} --quiet')
188
+ # Digest-compliance note (FORGE-S27-T05): --quiet makes banners.cjs emit
189
+ # zero stdout (unconditional; no isTTY branch). The badge is fully
190
+ # suppressed during the automated run_bash call — it does not enter the
191
+ # LLM context window. Mirrors meta-orchestrate.md:399–411 treatment.
192
+ print(f" → {bugId} [{display_model}]\n")
175
193
  - Start progress Monitor on .forge/store/events/bugs/progress.log.
176
194
  - Preflight gate: preflight-gate.cjs --phase {role} --bug {bugId}
177
- Exit 1 or 2 escalate (see meta-orchestrate.md § Escalation Procedure)
178
- with bug_id substituted for task_id. Update bug.status to "escalated"
179
- only if it is currently "in-progress" (do not downgrade other states).
195
+ Exit 1 structured JSON on stdout ({ phase, reasonCode, detail, remediation });
196
+ parse and render it exactly as meta-orchestrate.md § Execution Algorithm
197
+ does for tasks (safe_parse_json(stdout) format reason + remediation).
198
+ Exit 2 → escalate (misconfiguration). In both cases:
199
+ see meta-orchestrate.md § Escalation Procedure with bug_id substituted
200
+ for task_id. Update bug.status to "escalated" only if it is currently
201
+ "in-progress" (do not downgrade other states).
180
202
  - Compose role-block, architecture-block, summary-block, overlay (via
181
203
  build-overlay.cjs --bug {bugId}).
182
204
  - Spawn subagent via Agent tool. Subagent prompt passes:
@@ -209,10 +231,12 @@ Differences are confined to the **triage** step and the **path branch**.
209
231
  phase that writes bug.status post-triage.
210
232
 
211
233
  6. Finalize (collator, housekeeping):
212
- - Aggregate cost data from .forge/store/events/bugs/*.json filtered by
213
- this bugId, and append a "## Cost Summary" section to the bug's
214
- INDEX.md artifact.
215
- - Run `node "$FORGE_ROOT/tools/collate.cjs" {bugId} --purge-events`.
234
+ - Run `node .forge/tools/collate.cjs {bugId} --purge-events`.
235
+ # Note (FORGE-S27-T05): collate.cjs --purge-events already handles cost
236
+ # aggregation and embeds the "## Cost" section into the bug's INDEX.md
237
+ # automatically (see collate.cjs buildBugIndex). Do NOT attempt a separate
238
+ # cost-aggregation round-trip before calling collate — it is redundant and
239
+ # may produce a duplicate section. The collate call is the single step.
216
240
  Collate purges only this bug's events from the shared bugs/ dir
217
241
  (filtered by bugId reference) — it does NOT purge other bugs' events.
218
242
  - Run preflight finalize gate: preflight-gate.cjs --phase finalize --bug {bugId}.
@@ -282,7 +306,7 @@ differences are:
282
306
  ```
283
307
  # --- Materialize project overlay (replaces MASTER_INDEX.md read in subagent) ---
284
308
  overlay_result = run_bash(
285
- f'node "$FORGE_ROOT/tools/build-overlay.cjs" --bug {bug_id} --format md'
309
+ f'node .forge/tools/build-overlay.cjs --bug {bug_id} --format md'
286
310
  )
287
311
  bug_overlay_md = overlay_result.stdout if overlay_result.exit_code == 0 else ""
288
312
 
@@ -461,7 +485,7 @@ or is redundant with another skill — emit a `friction` event so
461
485
  | `skill_stale` | A skill's guidance contradicts current architecture / supersedes its own advice. |
462
486
  | `skill_redundant` | Two skills provided overlapping or conflicting guidance for the same decision. |
463
487
 
464
- **Recording friction (subagent side):** call `node "$FORGE_ROOT/tools/friction-emit.cjs` `--workflow {workflow} --persona {persona-noun} --issue {token} [--subkind {token}] [--evidence '{...}']`. The tool appends one judgement-only record to `.forge/cache/FRICTION-{workflow}.jsonl`. The orchestrator drains the file at phase-end, stamps runtime attribution (model, provider, usage, wall times, eventId) onto each record, and emits the events via `store-cli emit` as event type `"friction"`. The schema enforces `{workflow, persona, issue}` as required when `type === "friction"`; `subkind` is the frozen enum `skill_unused|skill_failed|skill_missing|skill_stale|skill_redundant` or experimental `^x_[a-z_]+$`. Emit one record per distinct friction signal — do not coalesce.
488
+ **Recording friction (subagent side):** call `node .forge/tools/friction-emit.cjs` `--workflow {workflow} --persona {persona-noun} --issue {token} [--subkind {token}] [--evidence '{...}']`. The tool appends one judgement-only record to `.forge/cache/FRICTION-{workflow}.jsonl`. The orchestrator drains the file at phase-end, stamps runtime attribution (model, provider, usage, wall times, eventId) onto each record, and emits the events via `store-cli emit` as event type `"friction"`. The schema enforces `{workflow, persona, issue}` as required when `type === "friction"`; `subkind` is the frozen enum `skill_unused|skill_failed|skill_missing|skill_stale|skill_redundant` or experimental `^x_[a-z_]+$`. Emit one record per distinct friction signal — do not coalesce.
465
489
 
466
490
  ## Progress Reporting
467
491
 
@@ -31,9 +31,8 @@ The Engineer implements the approved plan: write code, run tests, verify, and do
31
31
  ```
32
32
 
33
33
  0a. Pre-flight Gate Check:
34
- - Resolve FORGE_ROOT (`node -e "console.log(require('./.forge/config.json').paths.forgeRoot)"`).
35
34
  - **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
- - Run: `node "$FORGE_ROOT/tools/preflight-gate.cjs" --phase implement --{entity_kind} {record_id}`
35
+ - Run: `node .forge/tools/preflight-gate.cjs --phase implement --{entity_kind} {record_id}`
37
36
  - Exit 1 (gate failed) → print stderr and HALT. Do not proceed; do not attempt to produce the artifact.
38
37
  - Exit 2 (misconfiguration) → print stderr and HALT.
39
38
  - Exit 0 → continue.
@@ -42,7 +41,7 @@ The Engineer implements the approved plan: write code, run tests, verify, and do
42
41
  - If `--force` is present in the invocation arguments, skip this step entirely.
43
42
  - If `entity_kind == "bug"`, skip this step entirely (bug state is managed by meta-fix-bug.md).
44
43
  - Read current task state:
45
- `node "$FORGE_ROOT/tools/store-cli.cjs" read task {record_id} --json`
44
+ `node .forge/tools/store-cli.cjs read task {record_id} --json`
46
45
  - Extract the `status` field from the JSON output.
47
46
  - Allowed states for this phase: `plan-approved`.
48
47
  - If the current status is NOT in the allowed set:
@@ -83,10 +82,10 @@ The Engineer implements the approved plan: write code, run tests, verify, and do
83
82
  - Out-of-band escapes (any state): `plan-revision-required`, `code-revision-required`, `blocked`, `escalated`, `abandoned`
84
83
  Update status — check current state first:
85
84
  - If predecessor is `planned` or `implementing`:
86
- `node "$FORGE_ROOT/tools/store-cli.cjs" update-status task {taskId} status implemented`
85
+ `node .forge/tools/store-cli.cjs update-status task {taskId} status implemented`
87
86
  - If predecessor is `plan-approved` (two-step mandatory — FSM forbids skipping `implementing`):
88
- `node "$FORGE_ROOT/tools/store-cli.cjs" update-status task {taskId} status implementing`
89
- `node "$FORGE_ROOT/tools/store-cli.cjs" update-status task {taskId} status implemented`
87
+ `node .forge/tools/store-cli.cjs update-status task {taskId} status implementing`
88
+ `node .forge/tools/store-cli.cjs update-status task {taskId} status implemented`
90
89
  - **Bug mode** — NO status write. The bug remains `in-progress` until the commit phase transitions it to `fixed`. Writing `bug.status` here violates `meta-fix-bug.md § Iron Laws #2`.
91
90
  - **Do NOT emit a phase event yourself.** The orchestrator 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.
92
91
 
@@ -100,6 +99,15 @@ The Engineer implements the approved plan: write code, run tests, verify, and do
100
99
  Or (bug mode):
101
100
  `forge_store({ command:"set-bug-summary", args:["{bugId}", "implementation"] })`
102
101
  The sidecar path is auto-resolved from the record's `path` — never pass it.
102
+
103
+ 8. Post-Phase Output Guard: the `outputs` block below is the authoritative enforcer.
104
+ You MUST satisfy it before returning. If PROGRESS.md is missing or too small,
105
+ re-run the relevant step before emitting the complete event.
106
+ ```
107
+
108
+ ```outputs phase=implement
109
+ artifact {engineering}/{sprint}/{task}/PROGRESS.md min=200
110
+ require summaries.implementation.verdict == n/a
103
111
  ```
104
112
 
105
113
  <!-- See _fragments/iron-laws.md for Iron Laws section structure guidance -->
@@ -107,7 +115,7 @@ The Engineer implements the approved plan: write code, run tests, verify, and do
107
115
 
108
116
  - Follow the Algorithm step by step. Execute the approved PLAN.md exactly; do not invent scope or skip steps without updating the plan first.
109
117
  - Read `.forge/personas/engineer.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
110
- - All store I/O via `forge_store` (or `node "$FORGE_ROOT/tools/store-cli.cjs"`). Never edit `.forge/store/*.json` directly.
118
+ - All store I/O via `forge_store` (or `node .forge/tools/store-cli.cjs`). Never edit `.forge/store/*.json` directly.
111
119
  - Run the full test suite before declaring the task implemented. Silent continuation past test failures is never acceptable.
112
120
 
113
121
  ## Store-Write Verification
@@ -35,15 +35,18 @@ or when `.forge/structure-versions.json` is absent (pre-T05 install detected).
35
35
 
36
36
  - Migration operations are reversible and user-confirmed before any destructive writes. Do not skip the Phase 2 confirmation gate — proceed only after the user explicitly accepts the migration plan.
37
37
  - Read `.forge/personas/engineer.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
38
- - All store I/O via `forge_store` (or `node "$FORGE_ROOT/tools/store-cli.cjs"`). Never edit `.forge/store/*.json` directly.
38
+ - All store I/O via `forge_store` (or `node .forge/tools/store-cli.cjs`). Never edit `.forge/store/*.json` directly.
39
39
 
40
40
  ## Pre-conditions
41
41
 
42
42
  - `/forge:init` has run: `.forge/config.json` exists and is readable.
43
43
  - `.forge/structure-versions.json` is absent OR `--structural` was passed.
44
- - The Forge plugin root is resolvable:
44
+ - The Forge plugin root is resolvable. Migration reads plugin source
45
+ (`$FORGE_ROOT/init/base-pack`, `$FORGE_ROOT/.claude-plugin/plugin.json`)
46
+ that is not vendored into `.forge/`, so resolve the active plugin install
47
+ root from `CLAUDE_PLUGIN_ROOT` (this workflow runs plugin-side):
45
48
  ```sh
46
- export FORGE_ROOT=$(node -e "console.log(require('./.forge/config.json').paths.forgeRoot)")
49
+ export FORGE_ROOT="${CLAUDE_PLUGIN_ROOT}"
47
50
  ```
48
51
 
49
52
  ---
@@ -58,7 +61,7 @@ Check that `.forge/config.json` exists. If it does not, stop:
58
61
 
59
62
  > "Forge has not been initialised in this project. Run `/forge:init` first."
60
63
 
61
- Read `FORGE_ROOT` from `.forge/config.json`.
64
+ Resolve `FORGE_ROOT` from `${CLAUDE_PLUGIN_ROOT}` (the active plugin install root).
62
65
 
63
66
  **0b. Detect install generation.**
64
67
 
@@ -273,8 +276,7 @@ Write `.forge/project-context.json` with the synthesised content.
273
276
 
274
277
  Validate via the store tool:
275
278
  ```sh
276
- export FORGE_ROOT
277
- node "$FORGE_ROOT/tools/validate-store.cjs" --dry-run
279
+ node .forge/tools/validate-store.cjs --dry-run
278
280
  ```
279
281
 
280
282
  If this exits non-zero, report the validation errors to the user and HALT. Do
@@ -284,7 +286,7 @@ NOT remove the sentinel — the user can fix the issue and re-run.
284
286
 
285
287
  ```sh
286
288
  export FORGE_ROOT
287
- node "$FORGE_ROOT/tools/substitute-placeholders.cjs" \
289
+ node .forge/tools/substitute-placeholders.cjs \
288
290
  --forge-root "$FORGE_ROOT" \
289
291
  --base-pack "$FORGE_ROOT/init/base-pack" \
290
292
  --config ".forge/config.json" \
@@ -302,8 +304,7 @@ user. Do NOT remove the sentinel (preserves ability to re-run after fixing).
302
304
  #### Step 3d — Register snapshot (T05)
303
305
 
304
306
  ```sh
305
- export FORGE_ROOT
306
- node "$FORGE_ROOT/tools/manage-versions.cjs" init
307
+ node .forge/tools/manage-versions.cjs init
307
308
  ```
308
309
 
309
310
  `manage-versions init` is idempotent. Since `.forge/structure-versions.json`
@@ -347,9 +348,8 @@ rm .forge/archive/pre-migration/.migration-in-progress
347
348
  **Verification (CLI-accessible only — do NOT invoke `/forge:health` here):**
348
349
 
349
350
  ```sh
350
- export FORGE_ROOT
351
351
  # 1. Validate the store
352
- node "$FORGE_ROOT/tools/validate-store.cjs" --dry-run
352
+ node .forge/tools/validate-store.cjs --dry-run
353
353
 
354
354
  # 2. Verify substitution outputs are non-empty
355
355
  ls .forge/personas/*.md .forge/skills/*.md .forge/workflows/*.md .forge/templates/*.md
@@ -375,9 +375,8 @@ Read that file and extract the `sprintId` field. If no sprint files exist, use
375
375
  `"migration"` as the `sprintId` placeholder.
376
376
 
377
377
  ```sh
378
- export FORGE_ROOT
379
378
  MIGRATION_END=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
380
- node "$FORGE_ROOT/tools/store-cli.cjs" emit "{projectSprintId}" '{
379
+ node .forge/tools/store-cli.cjs emit "{projectSprintId}" '{
381
380
  "eventId": "migration-'"$(date -u +%Y%m%dT%H%M%SZ)"'",
382
381
  "taskId": "migration",
383
382
  "sprintId": "{projectSprintId}",
@@ -467,7 +466,7 @@ cd .forge && md5sum -c archive/pre-migration/MANIFEST.md5 2>/dev/null | grep -v
467
466
  - **Workflow Structure:** The generated `migrate_structural.md` must follow the strict multi-phase Algorithm block format (Phase 0 pre-flight → Phase 1 read/extract → Phase 2 confirmation gate → Phase 3 write → Phase 4 verify/emit → Rollback Procedure → Error Handling).
468
467
  - **Context Isolation:** Forbid inline execution of archival or substitution operations; use `forge_store` reads and structured `node` invocations for all store interactions.
469
468
  - **Project Specifics:**
470
- - Reference the project's `paths.engineering` and `paths.forgeRoot` from `.forge/config.json` for all path resolutions.
469
+ - Reference the project's `paths.engineering` from `.forge/config.json` for path resolutions; resolve the plugin root from `${CLAUDE_PLUGIN_ROOT}` (not `config.paths.forgeRoot`, which is retired).
471
470
  - Include the project's migration path docs in the Error Handling table (e.g., expected schema files, archive paths).
472
471
  - **Token Reporting:** See `_fragments/finalize.md` — wire via `file_ref:`. Token reporting is diagnostic only (migration is not an orchestrated phase — it emits its own record via `store-cli emit` in Phase 4).
473
472
  - **Event Emission:** Migration emits its own completion event directly via `store-cli emit` in Phase 4 (orchestrator-exception; this is not a task phase). The "do NOT emit yourself" rule does not apply here.
@@ -23,7 +23,7 @@ Capture sprint requirements via a structured interview and document them for pla
23
23
 
24
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
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.
26
+ - All store I/O via `forge_store` (or `node .forge/tools/store-cli.cjs`). Never edit `.forge/store/*.json` directly.
27
27
 
28
28
  ## Algorithm
29
29
 
@@ -56,7 +56,7 @@ Capture sprint requirements via a structured interview and document them for pla
56
56
  - Ensure all deliverables are measurable and testable
57
57
 
58
58
  5. Finalize:
59
- - Update sprint status via `node "$FORGE_ROOT/tools/store-cli.cjs" update-status sprint {sprintId} status planning`
59
+ - Update sprint status via `node .forge/tools/store-cli.cjs update-status sprint {sprintId} status planning`
60
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
61
  ```
62
62
 
@@ -79,6 +79,6 @@ Capture sprint requirements via a structured interview and document them for pla
79
79
  - Set token fields to `null`: `"inputTokens": null, "outputTokens": null, "estimatedCostUSD": null`.
80
80
  - Add `"source": "missing"` to sidecar JSON.
81
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`.
82
+ 4. Write the usage sidecar via `node .forge/tools/store-cli.cjs emit {sprintId} '{sidecar-json}' --sidecar`.
83
83
  5. **NEVER skip sidecar write.** Always emit (reported or placeholder with nulls).
84
84
  - **Event Emission:** Ensure the "complete" event includes the `eventId` passed by the orchestrator.