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,204 @@
1
+ ---
2
+ install: extras
3
+ ---
4
+ <!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
5
+ <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
6
+
7
+ # /pipeline-health — Phase 3: Analyze & Correlate
8
+
9
+ ## Phase 3: Analyze & Correlate
10
+
11
+ ### 3A: Defect category breakdown
12
+
13
+ **3A-I: Pre-merge defects** — Group review findings (from Phase 2B) by agent prefix.
14
+
15
+ First, count findings per category from the Phase 2B output:
16
+
17
+ ```bash
18
+ # Count review findings per agent prefix (SEC, AUTH, BILL, DB, FE, INFRA, API, CONC, SCRP)
19
+ # These are the current-period counts to compare against PRIOR_* vars from Phase 1C
20
+ COUNT_SEC=$(echo "$FINDINGS_RAW" | grep -c '"SEC' || echo 0)
21
+ COUNT_AUTH=$(echo "$FINDINGS_RAW" | grep -c '"AUTH' || echo 0)
22
+ COUNT_BILL=$(echo "$FINDINGS_RAW" | grep -c '"BILL' || echo 0)
23
+ COUNT_DB=$(echo "$FINDINGS_RAW" | grep -c '"DB' || echo 0)
24
+ COUNT_FE=$(echo "$FINDINGS_RAW" | grep -c '"FE' || echo 0)
25
+ COUNT_INFRA=$(echo "$FINDINGS_RAW" | grep -c '"INFRA' || echo 0)
26
+ COUNT_API=$(echo "$FINDINGS_RAW" | grep -c '"API' || echo 0)
27
+ COUNT_CONC=$(echo "$FINDINGS_RAW" | grep -c '"CONC' || echo 0)
28
+ COUNT_SCRP=$(echo "$FINDINGS_RAW" | grep -c '"SCRP' || echo 0)
29
+ # ISSUE_SPEC from Phase 2L audit findings
30
+ COUNT_ISSUE_SPEC=$ISSUE_SPEC_COUNT
31
+
32
+ TOTAL_FINDINGS=$((COUNT_SEC + COUNT_AUTH + COUNT_BILL + COUNT_DB + COUNT_FE + COUNT_INFRA + COUNT_API + COUNT_CONC + COUNT_SCRP))
33
+
34
+ # Compute trend for each category using _trend helper from Phase 1C
35
+ TREND_SEC=$( _trend "$COUNT_SEC" "$PRIOR_SEC")
36
+ TREND_AUTH=$( _trend "$COUNT_AUTH" "$PRIOR_AUTH")
37
+ TREND_BILL=$( _trend "$COUNT_BILL" "$PRIOR_BILL")
38
+ TREND_DB=$( _trend "$COUNT_DB" "$PRIOR_DB")
39
+ TREND_FE=$( _trend "$COUNT_FE" "$PRIOR_FE")
40
+ TREND_INFRA=$( _trend "$COUNT_INFRA" "$PRIOR_INFRA")
41
+ TREND_API=$( _trend "$COUNT_API" "$PRIOR_API")
42
+ TREND_CONC=$( _trend "$COUNT_CONC" "$PRIOR_CONC")
43
+ TREND_SCRP=$( _trend "$COUNT_SCRP" "$PRIOR_SCRP")
44
+ TREND_ISSUE_SPEC=$(_trend "$COUNT_ISSUE_SPEC" "$PRIOR_ISSUE_SPEC")
45
+
46
+ _pct() { [ "$TOTAL_FINDINGS" -gt 0 ] && echo "scale=0; $1 * 100 / $TOTAL_FINDINGS" | bc || echo "0"; }
47
+ ```
48
+
49
+ Then render the table using the computed values:
50
+
51
+ | Category | Count | % of Total | Trend vs Prior Period |
52
+ |----------|-------|------------|---------------------|
53
+ | SEC | $COUNT_SEC | $(_pct $COUNT_SEC)% | $TREND_SEC |
54
+ | AUTH | $COUNT_AUTH | $(_pct $COUNT_AUTH)% | $TREND_AUTH |
55
+ | BILL | $COUNT_BILL | $(_pct $COUNT_BILL)% | $TREND_BILL |
56
+ | DB | $COUNT_DB | $(_pct $COUNT_DB)% | $TREND_DB |
57
+ | FE | $COUNT_FE | $(_pct $COUNT_FE)% | $TREND_FE |
58
+ | INFRA | $COUNT_INFRA | $(_pct $COUNT_INFRA)% | $TREND_INFRA |
59
+ | API | $COUNT_API | $(_pct $COUNT_API)% | $TREND_API |
60
+ | CONC | $COUNT_CONC | $(_pct $COUNT_CONC)% | $TREND_CONC |
61
+ | SCRP | $COUNT_SCRP | $(_pct $COUNT_SCRP)% | $TREND_SCRP |
62
+ | ISSUE_SPEC | $COUNT_ISSUE_SPEC | $(_pct $COUNT_ISSUE_SPEC)% | $TREND_ISSUE_SPEC |
63
+
64
+ **If PRIOR_* vars are all empty (baseline run)**: all trend cells show "—" (no prior period to compare against).
65
+
66
+ **Note**: ISSUE_SPEC findings come from `/audit` (`audit-finding` label + body contains "ISSUE_SPEC"), not from review agents. They represent upstream failures — bad issue specs that the pipeline followed correctly but that produced wrong or wasted work.
67
+
68
+ **3A-II: Post-deploy defects** — Group audit findings (from Phase 2L) by failure point:
69
+
70
+ | Failure Point | Count | % of Total | Meaning |
71
+ |---------------|-------|------------|---------|
72
+ | INVESTIGATION | ? | ?% | Wrong verdict or missed scope — root cause misdiagnosed |
73
+ | IMPLEMENTATION | ? | ?% | Code written incorrectly or incompletely |
74
+ | REVIEW | ? | ?% | Review agents missed the issue or wrong agents triggered |
75
+ | REVIEW_FALSE_NEG | ? | ?% | Review agent saw area but approved a defect (escape signal) |
76
+ | QUALITY_GATE | ? | ?% | Static check should have caught this pattern but didn't |
77
+ | DEPLOY_GATE | ? | ?% | Deploy-info should have flagged risk but didn't |
78
+ | CONTEXT | ? | ?% | Missed relevant prior work or related code paths |
79
+ | ARCHITECT | ? | ?% | Missed code paths or wrong implementation plan |
80
+ | ORCHESTRATION | ? | ?% | Wave ordering wrong or dependency missed |
81
+ | ISSUE_SPEC | ? | ?% | Bad issue spec — pipeline followed it correctly, spec was wrong |
82
+ | OTHER | ? | ?% | Uncategorized or compound failure |
83
+
84
+ **Cross-signal analysis**: Compare 3A-I (pre-merge review findings) with 3A-II (post-deploy audit findings) to identify where the pipeline gates are misaligned. High REVIEW_FALSE_NEG in 3A-II with low REVIEW findings per PR in 3A-I suggests review agents are approving too liberally rather than finding real defects.
85
+
86
+ **Identify the top 3 defect categories across both tables.** These are where the builder/review is weakest and where pipeline improvements would have the highest ROI.
87
+
88
+ ### 3B: Prompt change impact
89
+
90
+ For each Forge commit in the window:
91
+ 1. What command was changed?
92
+ 2. What was the intent? (read the commit message)
93
+ 3. Did the target metric improve after this change?
94
+ - If the change was to `review-pr-agents.md` → did false positive rate change?
95
+ - If the change was to `work-on.md` Step 3G → did build failure rate change?
96
+ - If the change was to `orchestrate.md` → did milestone merge success rate change?
97
+
98
+ **Caution**: Correlation ≠ causation. Note confounding factors (e.g., milestone size, new developers).
99
+
100
+ ### 3C: Compute health score
101
+
102
+ ```
103
+ Health Score = weighted average of:
104
+ Pre-merge quality:
105
+ - Build pass rate (staging→main): weight 12% target 95%+
106
+ - Review findings per PR: weight 9% target < 0.5
107
+ - Manual fix-up rate: weight 8% target < 15%
108
+ - False positive rate: weight 6% target < 10%
109
+ - Pipeline self-correction rate: weight 7% target < 15%
110
+
111
+ Post-deploy quality:
112
+ - Post-deploy failure rate (Phase 2L): weight 9% target < 5%
113
+ - Review escape rate (Phase 2L): weight 9% target < 2%
114
+
115
+ Pipeline health signals:
116
+ - Issue quality score (Phase 2J): weight 8% target > 80%
117
+ - Investigation accuracy (Phase 2I): weight 6% target > 85%
118
+ - Milestone merge success rate: weight 6% target 80%+
119
+ - Orchestration efficiency (Phase 2K): weight 5% target score > 70
120
+ - Original work ratio: weight 4% target > 70%
121
+ - Issue close velocity (days): weight 1% target < 2 days
122
+
123
+ Transcript analytics (supplementary — Phase 2M–2Q):
124
+ - Transcript health score (Phase 2N/2Q): weight 10% target > 70
125
+ ```
126
+
127
+ **Total weight**: 12+9+8+6+7+9+9+8+6+6+5+4+1+10 = 100%.
128
+
129
+ **Post-deploy failure rate** (Phase 2L): scored as `max(0, 100 - (rate / 5%) * 100)` — i.e., 0% failure rate = 100 score, 5% failure rate = 0 score. If no audit findings exist in the window, score = 100.
130
+
131
+ **Review escape rate** (Phase 2L): scored as `max(0, 100 - (rate / 2%) * 100)` — i.e., 0% escape rate = 100 score, 2% escape rate = 0 score. If no REVIEW_FALSE_NEG findings exist, score = 100. This metric directly measures review agent effectiveness: a high escape rate with a low findings-per-PR rate indicates review agents are approving too liberally.
132
+
133
+ **Issue quality score** is computed from Phase 2J sub-metrics: invalidation rate (40%), ISSUE_SPEC findings (30%), re-investigation rate (20%), structure compliance (10%). A perfect score (100) requires: 0% invalidation, 0 ISSUE_SPEC audit findings, 0 re-investigations, 100% structure compliance.
134
+
135
+ **Investigation accuracy** comes from Phase 2I trajectory data: (CONFIRMED + PARTIAL) / total issues with trajectory comments. If no trajectory data is available in the window, omit this metric from the weighted average and redistribute its 7% proportionally across the other metrics.
136
+
137
+ **Orchestration efficiency score** is computed from Phase 2K metrics: avg idle% (40% weight — lower is better, 0% idle = 100 score), avg resumes per agent (35% weight — 0 resumes = 100, ≥2 resumes = 0), clean agent rate (25% weight — equals clean_rate%). If no persisted `FORGE:AUDIT-AGENTS` data is available in the window, omit this metric and redistribute its 5% proportionally across the remaining metrics.
138
+
139
+ **Transcript health score** (Phase 2N/2Q — supplementary signal, weight 10%): Computed from three Phase 2N/2Q output variables. If `TRANSCRIPT_DATA_AVAILABLE=false`, skip this metric and redistribute its 10% proportionally across the remaining metrics.
140
+
141
+ ```bash
142
+ if [ "${TRANSCRIPT_DATA_AVAILABLE:-false}" = "true" ]; then
143
+ # stall_rate_score: 0% stall rate = 100, 10%+ stall rate = 0
144
+ # STALL_TURN_RATE is a percentage integer from Phase 2N (e.g., 5 for 5%)
145
+ STALL_TURN_RATE=${STALL_TURN_RATE:-0}
146
+ STALL_RATE_SCORE=$(echo "scale=0; r=$STALL_TURN_RATE; if(r>10) 0 else (10-r)*10" | bc 2>/dev/null || echo 0)
147
+
148
+ # compaction_score: 0 compactions = 100, 5+ compactions = 0
149
+ # COMPACTION_TOTAL is the total compaction events across all sessions from Phase 2N
150
+ COMPACTION_TOTAL=${COMPACTION_TOTAL:-0}
151
+ COMPACTION_SCORE=$(echo "scale=0; c=$COMPACTION_TOTAL; if(c>5) 0 else (5-c)*20" | bc 2>/dev/null || echo 0)
152
+
153
+ # model_split_score: 0% opus = 100, 100% opus = 0
154
+ # OPUS_PCT is derived from Phase 2Q's model_distribution output (integer 0-100)
155
+ # If not set (Phase 2Q skipped), use 0 as conservative fallback
156
+ OPUS_PCT=${OPUS_PCT:-0}
157
+ MODEL_SPLIT_SCORE=$(echo "scale=0; 100 - $OPUS_PCT" | bc 2>/dev/null || echo 100)
158
+ [ "$MODEL_SPLIT_SCORE" -lt 0 ] 2>/dev/null && MODEL_SPLIT_SCORE=0
159
+
160
+ # Weighted composite: stall 50% + compaction 30% + model split 20%
161
+ TRANSCRIPT_HEALTH_SCORE=$(echo "scale=0; ($STALL_RATE_SCORE * 50 + $COMPACTION_SCORE * 30 + $MODEL_SPLIT_SCORE * 20) / 100" | bc 2>/dev/null || echo 0)
162
+ echo "Transcript health score: $TRANSCRIPT_HEALTH_SCORE/100 (stall_rate_score=$STALL_RATE_SCORE compaction_score=$COMPACTION_SCORE model_split_score=$MODEL_SPLIT_SCORE)"
163
+ TRANSCRIPT_SCORE_AVAILABLE=true
164
+ else
165
+ TRANSCRIPT_HEALTH_SCORE=""
166
+ TRANSCRIPT_SCORE_AVAILABLE=false
167
+ echo "Transcript health score: N/A (TRANSCRIPT_DATA_AVAILABLE=false — 10% weight redistributed proportionally)"
168
+ fi
169
+ ```
170
+
171
+ **Transcript flow qualitative flags** (supplementary, appear in report alongside the numeric score):
172
+ - Stall turn rate > 10%: flag as ⚠️ `High stall rate — agents spending >10% of turns in long waits`
173
+ - Compaction events > 5 in window: flag as ⚠️ `Frequent context compaction — consider reducing prompt or tool output size`
174
+ - Stall turn rate ≤ 10% and compaction ≤ 5: flag as ✅ `Session flow healthy`
175
+ - Data not available: flag as ℹ️ `Transcript flow metrics unavailable (requires Phase 2M session data)`
176
+
177
+ **Aggregated session metrics** (Phase 2Q): If `$TRANSCRIPT_AGGREGATION_AVAILABLE` is true, embed `$AGGREGATED_TRANSCRIPT_METRICS` verbatim into the \"Aggregated Session Metrics\" section of the Phase 5A report. The guardrail footnotes (5 harmful-takeaway warnings from #347) MUST be included in that section even when session count is low — they protect against misreading the metrics table. If `TRANSCRIPT_AGGREGATION_AVAILABLE` is false, emit the unavailability note from Phase 2Q.
178
+
179
+ **Anomaly signal**: If Phase 2I anomaly rate exceeds 10% of issues, flag it as a warning in the health report even though it does not feed the score directly — high anomaly rates indicate pipeline instability not captured by outcome metrics.
180
+
181
+ Score 0-100. Categorize:
182
+ - 90-100: Excellent — pipeline is shipping clean code
183
+ - 70-89: Good — some defect categories need attention
184
+ - 50-69: Needs work — specific pipeline links are underperforming
185
+ - < 50: Critical — systemic issues in the pipeline
186
+
187
+ **Health score trend**: Compare the computed score against `$PRIOR_HEALTH_SCORE` from Phase 1C:
188
+
189
+ ```bash
190
+ # Compute score trend string for report header
191
+ if [ -z "$PRIOR_HEALTH_SCORE" ]; then
192
+ SCORE_TREND="(baseline — no prior period)"
193
+ elif [ "$HEALTH_SCORE" -gt "$PRIOR_HEALTH_SCORE" ] 2>/dev/null; then
194
+ SCORE_TREND="(↑ from $PRIOR_HEALTH_SCORE — +$(( HEALTH_SCORE - PRIOR_HEALTH_SCORE )) pts)"
195
+ elif [ "$HEALTH_SCORE" -lt "$PRIOR_HEALTH_SCORE" ] 2>/dev/null; then
196
+ SCORE_TREND="(↓ from $PRIOR_HEALTH_SCORE — -$(( PRIOR_HEALTH_SCORE - HEALTH_SCORE )) pts)"
197
+ else
198
+ SCORE_TREND="(= unchanged from $PRIOR_HEALTH_SCORE)"
199
+ fi
200
+ echo "Health Score: $HEALTH_SCORE/100 $SCORE_TREND"
201
+ ```
202
+
203
+ ---
204
+
@@ -0,0 +1,117 @@
1
+ ---
2
+ install: extras
3
+ ---
4
+ <!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
5
+ <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
6
+
7
+ # /pipeline-health — Phase 4: Generate Improvement Proposals
8
+
9
+ ## Phase 4: Generate Improvement Proposals
10
+
11
+ ### 4A: Pattern recurrence analysis — check-promotion threshold <!-- Added: forge#1331 -->
12
+
13
+ Before the general improvement proposals, scan for `FORGE:PATTERN` tags in review-finding issues closed in the analysis window. When the same pattern slug appears on 3+ distinct issues, emit a check-promotion issue:
14
+
15
+ ```bash
16
+ # Collect all review-finding issues closed in the window with FORGE:PATTERN annotations
17
+ # {GH_FLAG} and {GH_REPO} are resolved from forge.yaml (see Config Resolution at top of file)
18
+ PATTERN_ISSUES=$(gh issue list {GH_FLAG} \
19
+ --label "review-finding" \
20
+ --state closed \
21
+ --search "FORGE:PATTERN" \
22
+ --limit 100 \
23
+ --json number,title,body,closedAt \
24
+ --jq ".[] | select(.closedAt >= \"$SINCE\") | {number: .number, title: .title, body: .body}" 2>/dev/null || echo "[]")
25
+
26
+ # Extract pattern slugs from FORGE:PATTERN HTML comments in issue bodies
27
+ # Format in issue body: <!-- FORGE:PATTERN: {slug} -->
28
+ PATTERN_LIST=$(echo "$PATTERN_ISSUES" | jq -r '
29
+ .body |
30
+ scan("<!-- FORGE:PATTERN: ([^\\s>]+) -->") |
31
+ .[0]
32
+ ' 2>/dev/null | sort | uniq -c | sort -rn)
33
+
34
+ # For each pattern that appears 3+ times, emit a check-promotion issue
35
+ while IFS= read -r line; do
36
+ COUNT=$(echo "$line" | awk '{print $1}')
37
+ SLUG=$(echo "$line" | awk '{print $2}')
38
+ [ -z "$SLUG" ] && continue
39
+ [ "$COUNT" -lt 3 ] && continue
40
+
41
+ # Check if a promotion issue already exists for this slug (avoid duplicates)
42
+ EXISTING_PROMOTION=$(gh issue list {GH_FLAG} \
43
+ --label "check-promotion" \
44
+ --state open \
45
+ --search "FORGE:PATTERN: $SLUG" \
46
+ --limit 5 \
47
+ --json number --jq '.[0].number' 2>/dev/null || echo "")
48
+
49
+ if [ -n "$EXISTING_PROMOTION" ]; then
50
+ echo "Check-promotion already open for pattern '$SLUG' as #${EXISTING_PROMOTION} — skipping."
51
+ continue
52
+ fi
53
+
54
+ # Collect the source finding issue numbers for this pattern
55
+ SOURCE_FINDINGS=$(echo "$PATTERN_ISSUES" | jq -r --arg slug "$SLUG" '
56
+ select(.body | test("<!-- FORGE:PATTERN: " + $slug + " -->")) |
57
+ "#\(.number)"
58
+ ' 2>/dev/null | head -10 | tr '\n' ' ')
59
+
60
+ gh issue create {GH_FLAG} \
61
+ --title "feat(quality-gate): promote pattern '$SLUG' to deterministic registry check (recurred ${COUNT}x)" \
62
+ --label "check-promotion,priority:P2" \
63
+ --body "$(cat <<CHECK_EOF
64
+ ## Problem
65
+
66
+ The review-finding pattern \`$SLUG\` has recurred ${COUNT} times in the analysis window ($(date -u +%Y-%m-%d) window). Each recurrence costs a full investigate→build→review→merge cycle. A static check catches this in milliseconds.
67
+
68
+ ## Source Findings
69
+
70
+ ${SOURCE_FINDINGS}
71
+
72
+ ## Task
73
+
74
+ 1. Read the source findings above to understand the defect class mechanically.
75
+ 2. Write \`scripts/check-registry/${SLUG}.sh\` following the check contract in \`scripts/check-registry/README.md\`.
76
+ 3. Add an entry to \`scripts/check-registry/manifest.json\` referencing the new script.
77
+ 4. Verify the check: test it by reintroducing the defect pattern and confirm the gate blocks.
78
+ 5. PR, review, merge — the check runs on all subsequent quality-gate invocations.
79
+
80
+ ## Acceptance Criteria
81
+
82
+ - [ ] \`scripts/check-registry/${SLUG}.sh\` exists, exits 1 on match with correct output format
83
+ - [ ] Manifest entry added: \`{ "slug": "${SLUG}", "script": "...", "source_findings": [...], ... }\`
84
+ - [ ] Seeded repo test: reintroduce the \`$SLUG\` pattern → quality gate blocks with REGISTRY-${SLUG} finding
85
+ - [ ] Gate runtime increase ≤5s for the registered check batch
86
+ - [ ] No regression: a clean changeset (no pattern) → gate passes
87
+
88
+ ## Pattern Tag
89
+
90
+ <!-- FORGE:PATTERN: ${SLUG} -->
91
+
92
+ <!-- AUTO-CREATED: pipeline-health Phase 4A — pattern recurrence threshold exceeded -->
93
+ CHECK_EOF
94
+ )"
95
+ echo "Created check-promotion issue for pattern '$SLUG' (recurred ${COUNT}x from: $SOURCE_FINDINGS)"
96
+ done <<< "$PATTERN_LIST"
97
+ ```
98
+
99
+ **Recurrence threshold**: 3 occurrences in the analysis window. The threshold is intentionally low — the cost of a false positive is one extra check that rarely fires; the cost of a false negative is another full pipeline cycle for a defect that a grep already knows about.
100
+
101
+ ---
102
+
103
+ ### 4B: General improvement proposals
104
+
105
+ For each of the top 3 defect categories:
106
+
107
+ 1. **Diagnose**: Why is the builder producing these defects? Read the relevant section of `work-on.md` — is there a check for this category? Is it too vague? Missing entirely?
108
+
109
+ 2. **Prescribe**: What specific change to which command file would reduce these defects?
110
+ - If the builder lacks a check → propose adding one to `work-on.md` or `quality-gate.md`
111
+ - If the review agent misses things → propose tightening the agent template in `review-pr-agents.md`
112
+ - If the orchestrator doesn't catch integration failures → propose a new inter-wave check
113
+
114
+ 3. **Scope**: Estimate the change size (lines added/modified) and risk level.
115
+
116
+ ---
117
+
@@ -0,0 +1,284 @@
1
+ ---
2
+ install: extras
3
+ ---
4
+ <!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
5
+ <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
6
+
7
+ # /pipeline-health — Phase 5: Report & Track
8
+
9
+ ## Phase 5: Report & Track
10
+
11
+ ### 5A: Post health report
12
+
13
+ Create a detailed health report as a GitHub issue in the Forge repo:
14
+
15
+ ```bash
16
+ gh issue create -R $FORGE_REPO \
17
+ --title "Pipeline Health: $REPO — $(date +%Y-%m-%d) — Score: [SCORE]/100" \
18
+ --label "health-report" \
19
+ --body "$(cat <<'EOF'
20
+ ## Pipeline Health Report
21
+
22
+ **Project**: $REPO
23
+ **Period**: $SINCE → $(date +%Y-%m-%dT%H:%M:%SZ)
24
+ **Health Score**: [SCORE]/100 ([CATEGORY]) $SCORE_TREND
25
+
26
+ ## Metrics
27
+
28
+ ### Pre-Merge Quality
29
+
30
+ | Metric | Value | Target | Status |
31
+ |--------|-------|--------|--------|
32
+ | Build pass rate (staging→main) | ?% | 95%+ | ✅/⚠️/❌ |
33
+ | Review findings per PR | ? | < 0.5 | ✅/⚠️/❌ |
34
+ | Manual fix-up rate | ?% | < 15% | ✅/⚠️/❌ |
35
+ | False positive rate | ?% | < 10% | ✅/⚠️/❌ |
36
+ | Pipeline self-correction rate | ?% | < 15% | ✅/⚠️/❌ |
37
+
38
+ ### Post-Deploy Quality
39
+
40
+ | Metric | Value | Target | Status |
41
+ |--------|-------|--------|--------|
42
+ | Post-deploy failure rate | ?% | < 5% | ✅/⚠️/❌ |
43
+ | Review escape rate (REVIEW_FALSE_NEG) | ?% | < 2% | ✅/⚠️/❌ |
44
+ | Mean time to detect | ? days | < 7 days | ✅/⚠️/❌ |
45
+ | Audit findings (total in window) | ? | — | ℹ️ |
46
+ | — by failure point | see breakdown | — | ℹ️ |
47
+
48
+ ### Pipeline Health Signals
49
+
50
+ | Metric | Value | Target | Status |
51
+ |--------|-------|--------|--------|
52
+ | Issue quality score | ?/100 | > 80 | ✅/⚠️/❌ |
53
+ | — Investigation invalidation rate | ?% | < 15% | ✅/⚠️/❌ |
54
+ | — ISSUE_SPEC audit findings | ? | 0 | ✅/⚠️/❌ |
55
+ | — Re-investigation rate | ? | 0 | ✅/⚠️/❌ |
56
+ | — Issue structure compliance | ?% | > 80% | ✅/⚠️/❌ |
57
+ | Investigation accuracy (trajectory) | ?% | > 85% | ✅/⚠️/❌ |
58
+ | Orchestration efficiency score | ?/100 | > 70 | ✅/⚠️/❌ |
59
+ | — Avg agent idle% | ?% | < 30% | ✅/⚠️/❌ |
60
+ | — Avg resume cycles per agent | ? | < 1 | ✅/⚠️/❌ |
61
+ | — Clean agent rate | ?% | > 60% | ✅/⚠️/❌ |
62
+ | — Batch stall rate | ?% (?/? issues) | < 10% | ✅/⚠️/❌ |
63
+ | — Escalated to needs-human | ? issues | 0 | ✅/⚠️/❌ |
64
+ | Original work ratio | ?% | > 70% | ✅/⚠️/❌ |
65
+ | Milestone merge success | ?% | 80%+ | ✅/⚠️/❌ |
66
+ | Issue close velocity | ? days | < 2 days | ✅/⚠️/❌ |
67
+ | Transcript health score (Phase 2N/2Q) | ?/100 $(_trend $TRANSCRIPT_HEALTH_SCORE $PRIOR_TRANSCRIPT_SCORE) | > 70 | ✅/⚠️/❌/ℹ️ |
68
+ | — Session flow flag | [✅ Healthy / ⚠️ flag / ℹ️ unavailable] | — | ℹ️ |
69
+ | — Aggregated session metrics (Phase 2Q) | [✅ Available / ℹ️ unavailable] | — | ℹ️ |
70
+ | Avg cost per issue (FORGE:DECISION_RECORD) | $? / ℹ️ unavailable | — | ℹ️ |
71
+
72
+ ## Trajectory Analytics
73
+
74
+ _From Phase 2I — FORGE:TRAJECTORY comments on [N] closed issues in window_
75
+
76
+ | Metric | Value |
77
+ |--------|-------|
78
+ | Issues with trajectory data | ? / ? closed |
79
+ | Investigation accuracy | ?% (CONFIRMED: ?, PARTIAL: ?, INVALID: ?) |
80
+ | Task type distribution | Bug Fix: ?, Feature: ?, Refactor: ?, Maintenance: ? |
81
+ | Anomalies flagged | ? issues |
82
+ | Notable anomalies | [list top 3 or "None"] |
83
+
84
+ _If no trajectory data available in window: "No FORGE:TRAJECTORY comments found — pipeline may be running pre-trajectory version or window is too narrow."_
85
+
86
+ ## Orchestration Efficiency
87
+
88
+ _From Phase 2K — persisted FORGE:AUDIT-AGENTS summaries ([N] sessions, [M] agents total) + FORGE:STALL_DETECTED annotations_
89
+
90
+ | Metric | Value | Target | Status |
91
+ |--------|-------|--------|--------|
92
+ | Avg agent idle% | ?% | < 30% | ✅/⚠️/❌ |
93
+ | Avg resume cycles per agent | ? | < 1 | ✅/⚠️/❌ |
94
+ | Clean agent rate | ?% | > 60% | ✅/⚠️/❌ |
95
+ | Batch stall rate | ?% (?/? issues) | < 10% | ✅/⚠️/❌ |
96
+ | Escalated to needs-human | ? issues | 0 | ✅/⚠️/❌ |
97
+
98
+ **Top stall boundaries** (phase transitions causing the most stalls):
99
+ | Boundary | Occurrences |
100
+ |----------|-------------|
101
+ | [boundary_1] | [N] |
102
+ | [boundary_2] | [N] |
103
+ | [boundary_3] | [N] |
104
+
105
+ _If no FORGE:AUDIT-AGENTS data available: "No persisted audit-agents summaries found in window. Run \`audit-agents --persist\` after orchestration runs to enable this metric. Proxy: [N] issues had resume/stall anomalies in trajectory data."_
106
+
107
+ _Batch stall rate: sourced from \`FORGE:STALL_DETECTED\` comments (requires \`/orchestrate\` Step 4B.5 to be active). N/A if stall detector is not deployed._
108
+
109
+ ## Transcript Flow Metrics
110
+
111
+ _From Phase 2N — JSONL transcript analytics ([N] pipeline sessions, [M] subagent sessions in window)_
112
+
113
+ | Metric | Value | Signal |
114
+ |--------|-------|--------|
115
+ | Pipeline sessions parsed | ? parent, ? subagent | ℹ️ |
116
+ | Total turns with timing | ? | ℹ️ |
117
+ | Avg turn duration | ?s | ℹ️ |
118
+ | Max turn duration | ?s | ℹ️ |
119
+ | Stall turns (>120s) | ? (?%) | ✅/⚠️ |
120
+ | Rate-limit indicator turns (60–120s) | ? | ℹ️ |
121
+ | Context compaction events | ? | ✅/⚠️ |
122
+ | Session flow flag | [✅ Healthy / ⚠️ High stall rate / ⚠️ Frequent compaction] | — |
123
+
124
+ **Top tools by call frequency**:
125
+ | Tool | Calls |
126
+ |------|-------|
127
+ | [tool_1] | [N] |
128
+ | [tool_2] | [N] |
129
+ | [tool_3] | [N] |
130
+
131
+ _If transcript data unavailable: "Transcript flow metrics unavailable — Phase 2M found no pipeline sessions in window (SESSION_TOTAL=0). Run `/pipeline-health` on the same machine where Claude Code sessions are stored."_
132
+
133
+ ## Aggregated Session Metrics
134
+
135
+ _From Phase 2Q — privacy-safe aggregation of [N] pipeline sessions (session IDs excluded; structural data only)_
136
+
137
+ | Metric | Value (median) | Range [P25–P75] | Context |
138
+ |--------|---------------|-----------------|---------|
139
+ | Active compute time | ?s | [?s–?s] | Agent tool-call time only — excludes human idle. Target: — (baseline) |
140
+ | Context compaction events | ? | [?–?] | Per session. >2 median = prompts/diffs may be oversized |
141
+ | Sonnet / Opus split | ?% / ?% | — | Opus% = rate-limit fallback pressure |
142
+
143
+ **Tool call distribution** (top 5 tools, all sessions combined):
144
+ | Tool | Total Calls |
145
+ |------|-------------|
146
+ | [tool_1] | [N] |
147
+ | [tool_2] | [N] |
148
+ | [tool_3] | [N] |
149
+ | [tool_4] | [N] |
150
+ | [tool_5] | [N] |
151
+
152
+ **Active time by command type** (median):
153
+ | Command | Median duration | Range [P25–P75] | Sessions |
154
+ |---------|-----------------|-----------------|----------|
155
+ | [command_1] | ?s | [?s–?s] | ? |
156
+ | [command_2] | ?s | [?s–?s] | ? |
157
+
158
+ **Interpretation guardrails** (sourced from investigation #347):
159
+
160
+ > ⚠️ **Guard 1**: Duration shown is *agent compute time*, not wall-clock. Wall-clock varies 2–10x due to human idle. "Sessions are long" ≠ prompts are bad. Compare against the command-type median, not a global average.
161
+
162
+ > ⚠️ **Guard 2**: Tool call count is normalized per task type. A 15-file feature legitimately requires 200+ calls; a 1-file fix needs 30–50. Flag only if count per files-changed is ≥3× the command-type median.
163
+
164
+ > ⚠️ **Guard 3**: Skill invocation count reflects which pipeline commands ran — not whether they ran correctly. High skill count without checking workflow:* label progression is a false signal.
165
+
166
+ > ⚠️ **Guard 4**: Opus% is rate-limit pressure proxy — high opus% means fallback occurred, not that better models were chosen. Remedy: spread sessions across time or reduce prompt token usage.
167
+
168
+ > ⚠️ **Guard 5**: Compaction events indicate large context windows, not inefficiency. Flag only if median compaction_count > 2 AND correlated with review-finding quality degradation.
169
+
170
+ _If aggregated metrics unavailable: "Phase 2Q did not produce data — TRANSCRIPT_DATA_AVAILABLE=false or PER_SESSION_METRICS_RAW was empty. Run `/pipeline-health` on the machine where Claude Code sessions are stored."_
171
+
172
+ ## Post-Deploy Failure Analysis
173
+
174
+ _From Phase 2L — \`audit-finding\` issues in the Forge repo ([N] findings in window)_
175
+
176
+ | Metric | Value | Target |
177
+ |--------|-------|--------|
178
+ | Post-deploy failure rate | ?% | < 5% |
179
+ | Review escape rate | ?% | < 2% |
180
+ | Mean time to detect | ? days | < 7 days |
181
+
182
+ **Failure point distribution** ([N] total audit findings):
183
+ | Failure Point | Count | % | Meaning |
184
+ |---------------|-------|---|---------|
185
+ | REVIEW_FALSE_NEG | ? | ?% | Review agent saw area but approved defect |
186
+ | IMPLEMENTATION | ? | ?% | Code written incorrectly |
187
+ | INVESTIGATION | ? | ?% | Wrong verdict or missed scope |
188
+ | DEPLOY_GATE | ? | ?% | Deploy-info missed risk signal |
189
+ | [other] | ? | ?% | — |
190
+
191
+ _If no audit findings in window: "No \`audit-finding\` issues in window — post-deploy failure rate = 0%."_
192
+
193
+ ## Defect Category Breakdown
194
+
195
+ _Pre-merge review findings by agent prefix (from Phase 3A-I). Trends computed vs prior report #$PRIOR_NUMBER (or "—" if baseline run)._
196
+
197
+ | Category | Count | % of Total | Trend vs Prior Period |
198
+ |----------|-------|------------|---------------------|
199
+ | SEC | $COUNT_SEC | $(_pct $COUNT_SEC)% | $TREND_SEC |
200
+ | AUTH | $COUNT_AUTH | $(_pct $COUNT_AUTH)% | $TREND_AUTH |
201
+ | BILL | $COUNT_BILL | $(_pct $COUNT_BILL)% | $TREND_BILL |
202
+ | DB | $COUNT_DB | $(_pct $COUNT_DB)% | $TREND_DB |
203
+ | FE | $COUNT_FE | $(_pct $COUNT_FE)% | $TREND_FE |
204
+ | INFRA | $COUNT_INFRA | $(_pct $COUNT_INFRA)% | $TREND_INFRA |
205
+ | API | $COUNT_API | $(_pct $COUNT_API)% | $TREND_API |
206
+ | CONC | $COUNT_CONC | $(_pct $COUNT_CONC)% | $TREND_CONC |
207
+ | SCRP | $COUNT_SCRP | $(_pct $COUNT_SCRP)% | $TREND_SCRP |
208
+ | ISSUE_SPEC | $COUNT_ISSUE_SPEC | $(_pct $COUNT_ISSUE_SPEC)% | $TREND_ISSUE_SPEC |
209
+
210
+ _Post-deploy audit findings by failure point — see Phase 3A-II table above._
211
+
212
+ ## Prompt Change Impact
213
+
214
+ [Analysis from Phase 3B]
215
+
216
+ ## Top 3 Improvement Proposals
217
+
218
+ ### 1. [Category] — [Proposal title]
219
+ **File**: `commands/[file].md`
220
+ **Change**: [Description]
221
+ **Expected impact**: [Metric] should improve by ~[X]%
222
+ **Risk**: [Low/Medium/High]
223
+
224
+ ### 2. ...
225
+
226
+ ### 3. ...
227
+
228
+ ## Forge Commits in Window
229
+
230
+ [Git log from Phase 2A]
231
+ EOF
232
+ )"
233
+ ```
234
+
235
+ ### 5B: Create improvement issues in Forge
236
+
237
+ For each improvement proposal, create a trackable issue using the `/issue` structure.
238
+
239
+ **Before creating**: Read the target file (`commands/[file].md`) and verify that the section reference in the issue body is accurate — confirm the section heading and line range exist.
240
+
241
+ **Title format**: Use conventional commit prefix based on proposal type:
242
+ - Proposed fix for a broken behaviour → `fix([command]): [description]`
243
+ - New capability or enhancement → `feat([command]): [description]`
244
+ - Restructuring without behaviour change → `refactor([command]): [description]`
245
+
246
+ **Priority label**: Assign based on how far the metric deviates from its target:
247
+ - Metric ≥ 20% below target → `P1`
248
+ - Metric 10–20% below target → `P2`
249
+ - Metric < 10% below target → `P3`
250
+
251
+ ```bash
252
+ gh issue create -R $FORGE_REPO \
253
+ --title "fix([command]): [description]" \
254
+ --label "[bug|enhancement|feature],[P1|P2|P3]" \
255
+ --body "## Problem
256
+
257
+ [1–3 sentences describing what the pipeline health metric reveals. Include the current value and target value.]
258
+
259
+ **Source**: Health report #[REPORT_NUMBER] — [metric]: [current value] (target: [target value])
260
+
261
+ ## Root Cause (if known)
262
+
263
+ \`commands/[file].md\` [section] — [what the section currently does that causes the metric to suffer]
264
+
265
+ ## Affected Files
266
+
267
+ Files that need changes:
268
+
269
+ 1. \`commands/[file].md\` — [what needs to change in this file]
270
+
271
+ ## Expected Behavior
272
+
273
+ After the fix, [metric] should reach [target value]. [Describe the concrete behaviour change in the command.]
274
+
275
+ ## Acceptance Criteria
276
+
277
+ - [ ] [Specific, testable criterion tied to the metric]
278
+ - [ ] [Specific, testable criterion tied to the command behaviour]
279
+ - [ ] No regression in other pipeline-health metrics
280
+ "
281
+ ```
282
+
283
+ ---
284
+
@@ -0,0 +1,52 @@
1
+ ---
2
+ install: extras
3
+ ---
4
+ <!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
5
+ <!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
6
+
7
+ # /pipeline-health — Phase 6: Summary
8
+
9
+ ## Phase 6: Summary
10
+
11
+ Print to the user:
12
+
13
+ ```
14
+ Forge Pipeline Health — [REPO]
15
+ Score: [SCORE]/100 ([CATEGORY]) $SCORE_TREND
16
+
17
+ Pre-merge quality:
18
+ Build pass rate: [X]% (target 95%)
19
+ Findings per PR: [X] (target < 0.5)
20
+ False positive rate: [X]% (target < 10%)
21
+ Manual fix-up rate: [X]% (target < 15%)
22
+ Self-correction rate: [X]% (target < 15%)
23
+
24
+ Post-deploy quality:
25
+ Post-deploy failure rate: [X]% (target < 5%) — [N] audit findings
26
+ Review escape rate: [X]% (target < 2%) — [N] REVIEW_FALSE_NEG
27
+ Mean time to detect: [X] days (target < 7 days)
28
+ Top failure points: [FP1] ([N]), [FP2] ([N]), [FP3] ([N])
29
+
30
+ Pipeline health signals:
31
+ Issue quality score: [X]/100 (target > 80)
32
+ Invalidation rate: [X]% (target < 15%)
33
+ ISSUE_SPEC findings: [X] (target 0)
34
+ Re-investigations: [X] (target 0)
35
+ Structure compliance: [X]% (target > 80%)
36
+ Investigation accuracy: [X]% (target > 85%) — [N] issues with trajectory data
37
+ CONFIRMED: [N] | PARTIAL: [N] | INVALID: [N]
38
+ Anomalies flagged: [N] issues
39
+ Task type distribution: Bug Fix: [N], Feature: [N], Refactor: [N], Maintenance: [N]
40
+ Orchestration efficiency: [X]/100 (target > 70) — [N] sessions, [M] agents
41
+ Avg idle%: [X]% (target < 30%)
42
+ Avg resume cycles: [X] (target < 1)
43
+ Clean agent rate: [X]% (target > 60%)
44
+ Top stall boundary: [boundary] ([N] occurrences)
45
+ Original work ratio: [X]% (target > 70%)
46
+ Milestone merge rate: [X]% (target 80%)
47
+
48
+ Top defect categories: [CAT1] ([N]), [CAT2] ([N]), [CAT3] ([N])
49
+
50
+ Proposed improvements: [N] issues created in $FORGE_REPO
51
+ Health report: [ISSUE_URL]
52
+ ```