forgedock 1.0.22 → 1.1.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 (184) hide show
  1. package/README.md +255 -211
  2. package/bin/batch-runner.mjs +339 -0
  3. package/bin/cinema.mjs +320 -0
  4. package/bin/demo.mjs +92 -7
  5. package/bin/engine/phases.mjs +168 -0
  6. package/bin/engine/projector.mjs +32 -0
  7. package/bin/engine/reconcile.mjs +11 -0
  8. package/bin/engine/runlog.mjs +79 -0
  9. package/bin/engine/state.mjs +32 -0
  10. package/bin/engine-cli.mjs +222 -0
  11. package/bin/engine.mjs +138 -0
  12. package/bin/forgedock.mjs +896 -1540
  13. package/bin/hooks/interactive-engine.mjs +509 -0
  14. package/bin/hooks/pre-tool-use.mjs +498 -0
  15. package/bin/hooks/subagent-stop-enforce.mjs +197 -0
  16. package/bin/journey.mjs +841 -0
  17. package/bin/registry.mjs +139 -0
  18. package/bin/report.mjs +447 -0
  19. package/bin/runner.mjs +136 -20
  20. package/bin/settings-hook.mjs +346 -0
  21. package/bin/tui.mjs +6 -3
  22. package/commands/adopt.md +4 -1
  23. package/commands/analytics.md +4 -1
  24. package/commands/audit-agents.md +110 -27
  25. package/commands/audit.md +20 -1
  26. package/commands/autopilot.md +84 -12
  27. package/commands/changelog.md +2 -1
  28. package/commands/ci-audit.md +2 -1
  29. package/commands/cleanup.md +161 -1
  30. package/commands/compat-audit.md +2 -1
  31. package/commands/deploy-info.md +63 -4
  32. package/commands/design-bench.md +6 -1
  33. package/commands/design-render-critique-loop.md +2 -1
  34. package/commands/design.md +1 -0
  35. package/commands/diagnose.md +2 -1
  36. package/commands/explain.md +2 -1
  37. package/commands/forge-stats.md +122 -2
  38. package/commands/forgedock-init.md +1 -1
  39. package/commands/geo-audit.md +3 -0
  40. package/commands/incident-response.md +2 -1
  41. package/commands/issue.md +24 -3
  42. package/commands/milestone.md +77 -12
  43. package/commands/optimize.md +2 -1
  44. package/commands/orchestrate/config.md +67 -0
  45. package/commands/orchestrate/phase-1-resolve.md +159 -0
  46. package/commands/orchestrate/phase-2-triage.md +126 -0
  47. package/commands/orchestrate/phase-2.5-synthesis.md +156 -0
  48. package/commands/orchestrate/phase-3-dependency.md +591 -0
  49. package/commands/orchestrate/phase-4-execution.md +962 -0
  50. package/commands/orchestrate/phase-5-cleanup.md +47 -0
  51. package/commands/orchestrate/phase-6-report.md +198 -0
  52. package/commands/orchestrate/safety.md +62 -0
  53. package/commands/orchestrate.md +25 -2027
  54. package/commands/pipeline-health/config.md +34 -0
  55. package/commands/pipeline-health/phase-1-context.md +180 -0
  56. package/commands/pipeline-health/phase-2-metrics.md +1729 -0
  57. package/commands/pipeline-health/phase-3-analyze.md +204 -0
  58. package/commands/pipeline-health/phase-4-proposals.md +117 -0
  59. package/commands/pipeline-health/phase-5-report.md +284 -0
  60. package/commands/pipeline-health/phase-6-summary.md +52 -0
  61. package/commands/pipeline-health.md +25 -2401
  62. package/commands/pipeline-resume.md +24 -1
  63. package/commands/pipeline-status.md +65 -0
  64. package/commands/qa-sweep.md +4 -1
  65. package/commands/quality-gate.md +326 -42
  66. package/commands/replay.md +2 -1
  67. package/commands/review-pr-agents/api.md +135 -0
  68. package/commands/review-pr-agents/auth.md +137 -0
  69. package/commands/review-pr-agents/billing.md +101 -0
  70. package/commands/review-pr-agents/concurrency.md +145 -0
  71. package/commands/review-pr-agents/database.md +103 -0
  72. package/commands/review-pr-agents/frontend.md +89 -0
  73. package/commands/review-pr-agents/infra.md +385 -0
  74. package/commands/review-pr-agents/protocols.md +185 -0
  75. package/commands/review-pr-agents/scraper.md +185 -0
  76. package/commands/review-pr-agents/security.md +406 -0
  77. package/commands/review-pr-agents.md +45 -1722
  78. package/commands/review-pr-staging.md +196 -40
  79. package/commands/review-pr.md +612 -56
  80. package/commands/rollback.md +2 -1
  81. package/commands/scope.md +2 -1
  82. package/commands/security-audit.md +2 -1
  83. package/commands/signal-planner.md +623 -0
  84. package/commands/sync-ecosystem.md +1 -0
  85. package/commands/test-gate.md +17 -1
  86. package/commands/validate.md +2 -1
  87. package/commands/work-on/build/architect.md +28 -0
  88. package/commands/work-on/build/context.md +2 -0
  89. package/commands/work-on/build/implement.md +19 -5
  90. package/commands/work-on/build/validate.md +62 -6
  91. package/commands/work-on/build.md +187 -30
  92. package/commands/work-on/close.md +132 -5
  93. package/commands/work-on/decompose.md +19 -1
  94. package/commands/work-on/investigate.md +117 -2
  95. package/commands/work-on/review.md +48 -4
  96. package/commands/work-on-monolithic.md +8 -2
  97. package/commands/work-on.md +247 -7
  98. package/docs/BRAND.md +16 -5
  99. package/docs/CI.md +2 -2
  100. package/docs/CODEX.md +36 -1
  101. package/docs/CONFIG.md +44 -42
  102. package/docs/FORGE-PROTOCOL.md +15 -1064
  103. package/docs/anthropic-devrel-outreach.md +2 -2
  104. package/docs/articles/command-decomposition-token-savings.md +214 -0
  105. package/docs/articles/model-release-playbook.md +131 -0
  106. package/docs/articles/per-repo-adaptive-scripts-token-savings.md +27 -25
  107. package/docs/claude-breakpoints.json +75 -5
  108. package/docs/design/abc-benchmark.md +1 -1
  109. package/docs/design/design-spec-schema.md +1 -1
  110. package/docs/design/divergent-generation.md +1 -1
  111. package/docs/design/eval-gate-runbook.md +178 -0
  112. package/docs/design/show-hn-draft.md +26 -1
  113. package/docs/design/token-cost-baseline-1298.md +59 -0
  114. package/docs/eval/README.md +117 -0
  115. package/docs/eval/corpus/seed-v1.json +6 -0
  116. package/docs/eval/published/claude-sonnet-4-6-2026-07-04.json +33 -0
  117. package/docs/site/annotations-explained.md +24 -0
  118. package/docs/site/command-learning-path.md +51 -14
  119. package/docs/site/command-reference.md +339 -113
  120. package/docs/site/for-companies.md +95 -0
  121. package/docs/site/forge-annotation-protocol.md +12 -256
  122. package/docs/site/getting-started.md +58 -12
  123. package/docs/site/github-is-the-memory.md +113 -0
  124. package/docs/site/how-it-works.md +3 -13
  125. package/docs/site/index.md +10 -2
  126. package/docs/spec/eval-run-result.md +147 -0
  127. package/docs/spec/forge-protocol-v1.md +441 -18
  128. package/docs/spec/label-state-machine.md +55 -0
  129. package/docs/spec/review-protocol.md +158 -0
  130. package/docs/spec-graph-schema.md +28 -0
  131. package/docs/superpowers/plans/2026-07-03-cinematic-onboarding-tui.md +2339 -0
  132. package/docs/superpowers/plans/2026-07-03-durable-execution-engine.md +1223 -0
  133. package/docs/superpowers/specs/2026-07-03-cinematic-onboarding-tui-design.md +157 -0
  134. package/docs/superpowers/specs/2026-07-03-durable-execution-engine-design.md +194 -0
  135. package/docs/superpowers/specs/2026-07-04-economic-self-governance-design.md +181 -0
  136. package/docs/superpowers/specs/2026-07-04-provenance-trail-design.md +189 -0
  137. package/examples/forgedock-demo/README.md +41 -22
  138. package/examples/forgedock-demo/issues/06-bug-tags-type-validation.md +43 -0
  139. package/examples/forgedock-demo/issues/07-bug-negative-offset-pagination.md +42 -0
  140. package/examples/forgedock-demo/issues/08-bug-patch-mass-assignment.md +49 -0
  141. package/examples/forgedock-demo/issues/09-bug-count-injection.md +47 -0
  142. package/examples/forgedock-demo/issues/10-feature-sort-param.md +39 -0
  143. package/examples/forgedock-demo/issues/11-feature-patch-tags.md +37 -0
  144. package/examples/forgedock-demo/issues/12-feature-bulk-create.md +42 -0
  145. package/examples/forgedock-demo/issues/13-feature-archive-notes.md +46 -0
  146. package/examples/forgedock-demo/issues/14-refactor-extract-title-validation.md +41 -0
  147. package/examples/forgedock-demo/issues/15-refactor-protected-route-flag.md +43 -0
  148. package/examples/forgedock-demo/issues/16-refactor-extract-store.md +45 -0
  149. package/examples/forgedock-demo/issues/17-perf-tags-dedup-set.md +35 -0
  150. package/examples/forgedock-demo/issues/18-perf-remove-redundant-sort.md +37 -0
  151. package/examples/forgedock-demo/issues/19-docs-api-reference-full.md +53 -0
  152. package/examples/forgedock-demo/issues/20-docs-intentional-flaw-convention.md +46 -0
  153. package/examples/forgedock-demo/scripts/smoke.js +18 -1
  154. package/examples/forgedock-demo/src/db.js +36 -11
  155. package/examples/forgedock-demo/src/routes/notes.js +106 -9
  156. package/examples/forgedock-demo/src/server.js +4 -1
  157. package/package.json +12 -4
  158. package/packages/protocol/LICENSE +21 -0
  159. package/packages/protocol/src/cli.js +135 -0
  160. package/packages/protocol/src/emit.js +146 -0
  161. package/packages/protocol/src/index.js +43 -0
  162. package/packages/protocol/src/parse.js +229 -0
  163. package/packages/protocol/src/types.js +171 -0
  164. package/packages/protocol/src/validate.js +122 -0
  165. package/scripts/bench-topology-cost.mjs +372 -0
  166. package/scripts/check-command-docs-drift.sh +198 -0
  167. package/scripts/check-protocol-restatements.sh +176 -0
  168. package/scripts/check-registry/README.md +72 -0
  169. package/scripts/check-registry/manifest.json +6 -0
  170. package/scripts/code-index.sh +454 -0
  171. package/scripts/conformance-check.mjs +168 -0
  172. package/scripts/doctor-pipeline-state.sh +484 -0
  173. package/scripts/eval-gate-baseline.json +17 -0
  174. package/scripts/eval-gate-scorecard.mjs +242 -0
  175. package/scripts/eval-scorecard-aggregator.mjs +252 -0
  176. package/scripts/flaky-quarantine.sh +241 -0
  177. package/scripts/forge-annotation.sh +567 -0
  178. package/scripts/issue-dedup.sh +236 -0
  179. package/scripts/validate-annotation-node.mjs +233 -0
  180. package/scripts/verify-env-vars.sh +18 -2
  181. package/scripts/verify-host-headers.sh +4 -4
  182. package/scripts/verify-route-registration.sh +2 -2
  183. package/scripts/worktree-lifecycle.sh +202 -0
  184. package/templates/devdocs/agent/using-forgedock.md +14 -0
@@ -0,0 +1,47 @@
1
+ ---
2
+ install: internal
3
+ ---
4
+ <!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
5
+ <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
6
+
7
+ # /orchestrate — Phase 5: Post-Batch Cleanup
8
+
9
+ ## Phase 5: Post-Batch Cleanup
10
+
11
+ **This phase is MANDATORY after every orchestration batch.** It prevents the rot that accumulates when multiple agents merge PRs in parallel — stale labels, orphaned worktrees, unclosed issues.
12
+
13
+ ### Step 5A: Run cleanup sweep
14
+
15
+ Invoke the `/cleanup` skill with `all` to sweep everything:
16
+
17
+ ```
18
+ Skill(skill="cleanup", args="all")
19
+ ```
20
+
21
+ This will:
22
+ - Fix stale workflow labels on any issues the agents left behind
23
+ - Close orphaned open issues whose PRs were merged (common when merging to `staging`)
24
+ - Remove worktrees created by agents in this batch
25
+ - Delete local/remote `fix/*` and `feat/*` branches whose PR has merged — detection uses merged-PR state (`gh pr list --state merged`) as the source of truth, so it covers feature-lane branches merged into a milestone branch as well as squash-merged branches, not just branches merged directly to staging
26
+ - Report milestones that hit 0 open issues — these are ready for `/milestone ship` (staging review + merge). Do NOT close them; closure happens after code reaches staging.
27
+ - Sync Project board state
28
+
29
+ ### Step 5B: Run agent audit
30
+
31
+ Invoke `/audit-agents` on this session to measure pipeline efficiency:
32
+
33
+ ```
34
+ Skill(skill="audit-agents", args="latest")
35
+ ```
36
+
37
+ Include the audit summary in the final report (Phase 6). Key metrics to surface:
38
+ - **Avg idle%** — percentage of time agents spent stalled vs working
39
+ - **Resume cycles** — how many times agents had to be resumed
40
+ - **Stall boundaries** — which phase transitions cause the most stalls
41
+
42
+ ### Step 5C: Report cleanup results
43
+
44
+ Include the cleanup summary in the final report (Phase 6). If cleanup found problems, call them out — they indicate agent pipeline failures that may need investigation.
45
+
46
+ ---
47
+
@@ -0,0 +1,198 @@
1
+ ---
2
+ install: internal
3
+ ---
4
+ <!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
5
+ <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
6
+
7
+ # /orchestrate — Phase 6: Consolidated Report
8
+
9
+ ## Phase 6: Consolidated Report
10
+
11
+ After ALL issues reach terminal state AND cleanup completes, present a final summary.
12
+
13
+ ### Step 6A: Collect trajectory data
14
+
15
+ ```bash
16
+ for NUM in {all_completed_issue_numbers}; do
17
+ gh api repos/{GH_REPO}/issues/${NUM}/comments \
18
+ --jq '.[] | select(.body | contains("<!-- FORGE:TRAJECTORY -->")) | .body' 2>/dev/null
19
+ done
20
+ ```
21
+
22
+ Aggregate into the batch-level analytics for Step 6B.
23
+
24
+ **Also collect the machine-readable summary cards** (`<!-- FORGE:CARD {json} -->`, embedded in
25
+ each issue's `FORGE:TRAJECTORY` comment by `/work-on` close phase). These power the per-issue and
26
+ batch cards in Step 6C:
27
+
28
+ ```bash
29
+ CARDS=""
30
+ for NUM in {all_completed_issue_numbers}; do
31
+ CARD=$(gh api repos/{GH_REPO}/issues/${NUM}/comments \
32
+ --jq '.[] | select(.body | contains("FORGE:CARD")) | .body' 2>/dev/null \
33
+ | sed -n 's/.*<!-- FORGE:CARD \(.*\) -->.*/\1/p' | head -1)
34
+ [ -n "$CARD" ] && CARDS="${CARDS}${CARD}"$'\n'
35
+ done
36
+ # CARDS is now a newline-delimited list of per-issue JSON objects (skip any issue whose
37
+ # card is absent — pre-card runs or non-merged terminal states degrade gracefully).
38
+ ```
39
+
40
+ ### Step 6B: Present consolidated report
41
+
42
+ ```
43
+ ## Orchestration Complete
44
+
45
+ **Scope**: {milestone / issue list}
46
+ **Duration**: {approximate time}
47
+
48
+ ### Investigations (Phase 2)
49
+ {IF investigations ran:}
50
+ | # | Investigation | Issues Created | Result |
51
+ |---|-------------|---------------|--------|
52
+ | #{INV1} | {title} | #{N1}, #{N2}, #{N3} | ✓ Closed |
53
+ {ELSE: "No investigations in this batch."}
54
+
55
+ ### Implementation Results
56
+
57
+ | # | Issue | Source | Result | PR | Target |
58
+ |---|-------|--------|--------|----|--------|
59
+ | #{A} | {title} | original | ✓ Merged | #{PR} | staging |
60
+ | #{B} | {title} | original | ✓ Merged | #{PR} | milestone/x |
61
+ | #{N1} | {title} | from #{INV1} | ✓ Merged | #{PR} | staging |
62
+ | #{C} | {title} | original | ✗ Invalid | — | — |
63
+ | #{D} | {title} | original | ⚠ Blocked | — | — |
64
+ | #{E} | {title} | original | ⏭ Skipped (dep) | — | — |
65
+
66
+ ### Review-Spawned Issues
67
+
68
+ {IF review findings were created during any agent run:}
69
+ | # | Finding | Source Issue | Source PR | Status |
70
+ |---|---------|-------------|-----------|--------|
71
+ | #{F1} | {title} | #{A} | PR #{PR} | ✓ Merged (in-batch) / ✓ Swept (completion sweep) / ⏳ Deferred (cosmetic) / ⛔ Deferred (gen2 cascade cap) |
72
+
73
+ {ELSE: "No review findings created during this batch."}
74
+
75
+ ### Completion Sweep <!-- Added: forge#1105 -->
76
+ - **Re-evaluated**: {N} deferred findings re-checked after DAG drain
77
+ - **Dispatched**: {N} findings cleared and executed (file overlap resolved)
78
+ - **Still deferred (cosmetic)**: {N} comment/typo findings (low-value, safe to leave)
79
+ - **Permanently deferred (gen2)**: {N} generation >= 2 findings (cascade cap — requires manual `/work-on`)
80
+
81
+ {IF permanently deferred > 0:}
82
+ **Action required**: The following findings were permanently deferred due to the generation >= 2 cascade cap. They will NOT be picked up automatically — run `/work-on #{N}` manually or include them in the next `/orchestrate` batch:
83
+ {list of permanently deferred issue numbers and titles}
84
+
85
+ {IF cosmetic deferred > 0:}
86
+ **Low-priority leftovers**: The following cosmetic findings remain open. They will be picked up by future runs or can be batched with `/orchestrate #{N1} #{N2}`:
87
+ {list of cosmetic deferred issue numbers and titles}
88
+
89
+ ### Summary
90
+ - **Investigations**: {N} completed, spawned {M} new issues
91
+ - **Review findings**: {N} spawned, {M} resolved in-batch, {K} swept, {J} deferred (cosmetic), {L} deferred (gen2)
92
+ - **Succeeded**: {N} issues resolved (implementation + sweep)
93
+ - **Failed**: {N} issues need attention
94
+ - **Skipped**: {N} issues (dependency failures)
95
+
96
+ ### Post-Batch Cleanup
97
+ - Labels fixed: {N}
98
+ - Orphaned issues closed: {N}
99
+ - Worktrees removed: {N}
100
+ - Branches pruned: {N}
101
+ - Milestones closed: {N}
102
+
103
+ ### Agent Efficiency (from /audit-agents)
104
+
105
+ | Agent | Issue | Total | Active | Idle% | Resumes | Stall Points |
106
+ |-------|-------|-------|--------|-------|---------|--------------|
107
+ {per-agent rows from audit}
108
+
109
+ **Batch efficiency**: {avg_idle_pct}% idle time
110
+ **Total resume cycles**: {sum_resumes} across {agent_count} agents
111
+ **Clean agents** (no stalls): {clean_count}/{agent_count}
112
+
113
+ ### Batch Trajectory Analytics
114
+
115
+ | Metric | Value |
116
+ |--------|-------|
117
+ | Issues attempted | {N} |
118
+ | Investigation invalidation rate | {N_invalid}/{N_investigated} ({%}) |
119
+ | Contracts posted | {N} |
120
+ | Contract→code divergences | {N} (agents that updated contract mid-build) |
121
+ | Review findings created | {N_total} |
122
+ | Findings queued after cascade control | {N_queued}/{N_total} ({N_deferred} deferred — see Step 4C) |
123
+ | Competing recommendations reconciled (Phase 2.5) | {RECONCILED_COUNT} (investigation plans arbitrated in place + serialized) |
124
+ | Findings validated | {N} |
125
+ | False positives | {N} ({%}) |
126
+ | Anomalies flagged | {N} |
127
+
128
+ **Domain breakdown**: {N} scraping, {N} frontend, {N} billing, ...
129
+ **Routing**: {N} fast-lane, {N} feature-lane
130
+
131
+ > `Findings queued after cascade control` reports Step 4C's defer/execute triage split (`QUEUED_FINDINGS` vs `DEFERRED_FINDINGS`) — it is NOT a dedup/arbitration computation; no such step exists for review findings. `Competing recommendations reconciled` is populated by Phase 2.5 (`RECONCILED_COUNT`), which reconciles investigation plans, not review findings. It is `0` when the batch had 0–1 investigations (synthesis is a no-op). <!-- Added: forge#1192, forge#1193 -->
132
+
133
+ **Systematic issues** (flag if detected):
134
+ - False positive rate > 30% → review agents may need tuning
135
+ - Invalidation rate < 10% or > 35% → investigation calibration off
136
+ - Same-domain merge conflicts between concurrent agents → domain serialization edges too loose
137
+ - Contract divergences > 20% → investigation quality may need improvement
138
+ - **Idle% > 50%** → agents stalling at phase boundaries; check work-on routing loop
139
+ - **Avg resumes > 1** → orchestrator having to compensate for agent stops
140
+
141
+ ### Next Steps
142
+ {If milestone and all issues done: "Milestone ready to ship. Run `/milestone ship {slug}` when ready. The ship command includes a pre-merge hunk-loss audit (Step 2.5) that detects staging-only hunks in milestone-modified files and rebases the milestone branch to absorb them before creating the PR — protecting against squash-merge regressions."}
143
+ {If some failed: "Issues #{X}, #{Y} need manual attention. Re-run with `/work-on #{X}` after resolving blockers."}
144
+ {If fast-lane: "All fixes merged to staging. Merge staging → main via GitHub web UI when ready to deploy."}
145
+ ```
146
+
147
+ ### Step 6C: Pipeline Summary Cards (the shareable moment)
148
+
149
+ Render one compact summary card per completed issue (from the `CARDS` JSON collected in Step 6A),
150
+ then a single batch-level summary card. These are the shareable artifacts a developer screenshots
151
+ after an orchestration run. Print all cards to stdout.
152
+
153
+ **Per-issue card** — emit one for each JSON object in `CARDS`. Use the same box-drawing style and
154
+ 51-column inner width as `work-on/close.md` Phase C4.5b. Read fields directly from the JSON
155
+ (`issue`, `title`, `pipeline`, `commits`, `additions`, `deletions`, `pr`, `pr_target`, `review`,
156
+ `elapsed_seconds`). Truncate long titles with `…`; render `null` numeric fields as `—`. The
157
+ `pipeline`/`status` field already encodes skipped phases (decomposed/invalid/blocked), so reflect
158
+ it verbatim. Skip issues with no card (graceful — pre-card or non-merged runs).
159
+
160
+ **Batch summary card** — aggregate across all collected cards:
161
+
162
+ ```
163
+ ╔═══════════════════════════════════════════════════╗
164
+ ║ ForgeDock Orchestration Complete ║
165
+ ╠═══════════════════════════════════════════════════╣
166
+ ║ ║
167
+ ║ Scope: {milestone / issue list} ║
168
+ ║ Issues: {N} merged · {M} blocked · {K} invalid ║
169
+ ║ Commits: {SUM_COMMITS} ({SUM_ADD} additions, {SUM_DEL} deletions) ║
170
+ ║ PRs: {N} merged ║
171
+ ║ Findings: {N} spawned · {M} resolved ║
172
+ ║ Time: {BATCH_ELAPSED} ║
173
+ ║ ║
174
+ ╚═══════════════════════════════════════════════════╝
175
+ ```
176
+
177
+ Aggregate with `jq` over the collected cards (every sum degrades gracefully — `null`/missing
178
+ fields are treated as 0; never fabricate):
179
+
180
+ ```bash
181
+ echo "$CARDS" | grep -v '^$' | jq -s '{
182
+ merged: (map(select(.status=="merged")) | length),
183
+ blocked: (map(select(.status=="blocked")) | length),
184
+ invalid: (map(select(.status=="invalid")) | length),
185
+ commits: (map(.commits // 0) | add),
186
+ adds: (map(.additions // 0) | add),
187
+ dels: (map(.deletions // 0) | add),
188
+ prs: (map(select(.pr != null)) | length),
189
+ elapsed: (map(.elapsed_seconds // 0) | add)
190
+ }'
191
+ ```
192
+
193
+ The batch card's `Findings:` line is filled from the review-finding counts already computed in
194
+ the Summary section above. `BATCH_ELAPSED` is the wall-clock duration of the orchestration run
195
+ (Step 6B `Duration`), not the sum of per-issue elapsed times.
196
+
197
+ ---
198
+
@@ -0,0 +1,62 @@
1
+ ---
2
+ install: internal
3
+ ---
4
+ <!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
5
+ <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
6
+
7
+ # /orchestrate — Safety Rules & Examples
8
+
9
+ ## Safety Rules
10
+
11
+ 1. **Every agent MUST invoke `/work-on` via the Skill tool.** No custom prompts. No manual implementation. Copy the Phase 4A template, fill in variables, done. (See HARD RULES at top of file.)
12
+ 2. **NEVER merge anything to `main`** — agents merge to `staging` or `milestone/{slug}` only
13
+ 3. **No artificial concurrency limit by default** — spawn as many agents as there are independent issues. Only file overlap and dependencies require sequencing. Set `forge.yaml → orchestration.max_concurrent` to cap in-flight workers and prevent rate-limit storms on large batches (see Engine mode § Concurrency model).
14
+ 4. **Always confirm with user before launching** — Step 3E is the mandatory checkpoint
15
+ 5. **No retries** — if an agent fails, report it and move on
16
+ 6. **Respect existing work** — skip issues already being worked on (`workflow:building`, `workflow:in-review`)
17
+ 7. **Dependency failures cascade** — if A fails and B depends on A, all transitive dependents of A are skipped (not attempted)
18
+ 8. **Always run post-batch cleanup** — Phase 5 is mandatory. Never skip `/cleanup all` after orchestration.
19
+ 9. **NEVER close/skip issues as duplicates** — only `/work-on` investigation agents can make that call after examining the actual code. The orchestrator delegates, it does not adjudicate. **This is distinct from Phase 2.5 plan reconciliation**: reconciling *competing recommendations* across investigation annotations (arbitrating incompatible plans, adding `Depends on #X` serialization edges) operates only on FORGE annotations and issue bodies — it never reads code and never closes/skips/merges an issue. Both issues in a reconciled conflict still run. Adjudicating *duplicate validity* (deciding two issues are the same bug and closing one) remains forbidden. <!-- Added: forge#1192 -->
20
+ 10. **Per-completion verification** — after each agent completes, check that it has `workflow:*` labels and structured comments. If an agent bypassed `/work-on`, report it as a pipeline failure.
21
+
22
+ ---
23
+
24
+ ## Examples
25
+
26
+ ### "orchestrate milestone api-expansion"
27
+ → Fetches all open issues in "API Expansion v1" milestone
28
+ → Builds DAG: #1526 → #1527 → #1528 → #1529 (chain), #1530 (no predecessors)
29
+ → Confirms with user, dispatches #1526 + #1530 immediately
30
+ → When #1526 completes, dispatches #1527 immediately (doesn't wait for #1530)
31
+ → Streaming continues until all issues reach terminal state
32
+
33
+ ### "orchestrate #1533 #1250"
34
+ → Fetches those 2 issues, no deps between them
35
+ → DAG: both have empty predecessor sets
36
+ → Confirms, dispatches both simultaneously
37
+
38
+ ### "orchestrate next 5"
39
+ → Gets top 5 priority issues, builds DAG
40
+ → Confirms, dispatches all ready issues immediately
41
+ → Dependent issues dispatch as predecessors complete
42
+
43
+ ### "orchestrate P0"
44
+ → Gets all P0 issues, runs them all (presumably urgent)
45
+ → DAG: likely all independent — dispatches simultaneously
46
+ → Confirms, executes
47
+
48
+ ### "orchestrate fast-lane"
49
+ → Gets all unmilestoned bugs/fixes
50
+ → Builds DAG from file-conflict and domain-serialization edges
51
+ → Dispatches all ready issues, streams dependent issues as predecessors complete
52
+
53
+ ### "orchestrate milestone user-auth-v2"
54
+ → Fetches all open issues in "User Auth v2" milestone
55
+ → Detects #42 is an investigation issue (title: "Investigate: session expiry race condition under high concurrency")
56
+ → Phase 2: Runs `/work-on 42` — investigation creates 3 new issues (#55-#57)
57
+ → Re-fetches milestone issues, now includes #55-#57
58
+ → Builds DAG: #38, #41, #55, #56 have no predecessors (ready); #39 depends on #38; #57 depends on #55
59
+ → Dispatches #38, #41, #55, #56 simultaneously
60
+ → When #38 completes, #39 dispatches immediately (doesn't wait for #41, #55, or #56)
61
+ → When #55 completes, #57 dispatches immediately (doesn't wait for others)
62
+ → Final report shows investigation spawned issues and streaming execution results