forgedock 1.1.1 → 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 (171) hide show
  1. package/README.md +53 -8
  2. package/bin/batch-runner.mjs +339 -0
  3. package/bin/demo.mjs +92 -7
  4. package/bin/engine/phases.mjs +20 -0
  5. package/bin/engine/state.mjs +8 -3
  6. package/bin/engine-cli.mjs +177 -5
  7. package/bin/forgedock.mjs +409 -26
  8. package/bin/hooks/interactive-engine.mjs +509 -0
  9. package/bin/hooks/pre-tool-use.mjs +498 -0
  10. package/bin/hooks/subagent-stop-enforce.mjs +197 -0
  11. package/bin/journey.mjs +72 -14
  12. package/bin/registry.mjs +139 -0
  13. package/bin/report.mjs +447 -0
  14. package/bin/runner.mjs +68 -19
  15. package/bin/settings-hook.mjs +235 -1
  16. package/commands/adopt.md +4 -1
  17. package/commands/analytics.md +4 -1
  18. package/commands/audit-agents.md +110 -27
  19. package/commands/audit.md +20 -1
  20. package/commands/autopilot.md +80 -8
  21. package/commands/changelog.md +2 -1
  22. package/commands/ci-audit.md +2 -1
  23. package/commands/cleanup.md +161 -1
  24. package/commands/compat-audit.md +2 -1
  25. package/commands/deploy-info.md +58 -1
  26. package/commands/design-bench.md +5 -1
  27. package/commands/design-render-critique-loop.md +1 -1
  28. package/commands/diagnose.md +2 -1
  29. package/commands/explain.md +2 -1
  30. package/commands/forge-stats.md +121 -2
  31. package/commands/forgedock-init.md +1 -1
  32. package/commands/geo-audit.md +3 -0
  33. package/commands/incident-response.md +2 -1
  34. package/commands/issue.md +23 -2
  35. package/commands/milestone.md +77 -12
  36. package/commands/optimize.md +2 -1
  37. package/commands/orchestrate/config.md +67 -0
  38. package/commands/orchestrate/phase-1-resolve.md +159 -0
  39. package/commands/orchestrate/phase-2-triage.md +126 -0
  40. package/commands/orchestrate/phase-2.5-synthesis.md +156 -0
  41. package/commands/orchestrate/phase-3-dependency.md +591 -0
  42. package/commands/orchestrate/phase-4-execution.md +962 -0
  43. package/commands/orchestrate/phase-5-cleanup.md +47 -0
  44. package/commands/orchestrate/phase-6-report.md +198 -0
  45. package/commands/orchestrate/safety.md +62 -0
  46. package/commands/orchestrate.md +25 -2045
  47. package/commands/pipeline-health/config.md +34 -0
  48. package/commands/pipeline-health/phase-1-context.md +180 -0
  49. package/commands/pipeline-health/phase-2-metrics.md +1729 -0
  50. package/commands/pipeline-health/phase-3-analyze.md +204 -0
  51. package/commands/pipeline-health/phase-4-proposals.md +117 -0
  52. package/commands/pipeline-health/phase-5-report.md +284 -0
  53. package/commands/pipeline-health/phase-6-summary.md +52 -0
  54. package/commands/pipeline-health.md +25 -2401
  55. package/commands/pipeline-resume.md +24 -1
  56. package/commands/pipeline-status.md +65 -0
  57. package/commands/qa-sweep.md +4 -1
  58. package/commands/quality-gate.md +248 -10
  59. package/commands/replay.md +2 -1
  60. package/commands/review-pr-agents/api.md +135 -0
  61. package/commands/review-pr-agents/auth.md +137 -0
  62. package/commands/review-pr-agents/billing.md +101 -0
  63. package/commands/review-pr-agents/concurrency.md +145 -0
  64. package/commands/review-pr-agents/database.md +103 -0
  65. package/commands/review-pr-agents/frontend.md +89 -0
  66. package/commands/review-pr-agents/infra.md +385 -0
  67. package/commands/review-pr-agents/protocols.md +185 -0
  68. package/commands/review-pr-agents/scraper.md +185 -0
  69. package/commands/review-pr-agents/security.md +406 -0
  70. package/commands/review-pr-agents.md +45 -1722
  71. package/commands/review-pr-staging.md +196 -40
  72. package/commands/review-pr.md +591 -52
  73. package/commands/rollback.md +2 -1
  74. package/commands/scope.md +2 -1
  75. package/commands/security-audit.md +2 -1
  76. package/commands/signal-planner.md +623 -0
  77. package/commands/sync-ecosystem.md +1 -0
  78. package/commands/test-gate.md +17 -1
  79. package/commands/validate.md +2 -1
  80. package/commands/work-on/build/architect.md +28 -0
  81. package/commands/work-on/build/context.md +2 -0
  82. package/commands/work-on/build/implement.md +3 -1
  83. package/commands/work-on/build/validate.md +26 -7
  84. package/commands/work-on/build.md +163 -24
  85. package/commands/work-on/close.md +130 -3
  86. package/commands/work-on/decompose.md +19 -1
  87. package/commands/work-on/investigate.md +117 -2
  88. package/commands/work-on/review.md +24 -4
  89. package/commands/work-on-monolithic.md +7 -2
  90. package/commands/work-on.md +202 -4
  91. package/docs/BRAND.md +14 -7
  92. package/docs/CI.md +2 -2
  93. package/docs/CODEX.md +36 -1
  94. package/docs/CONFIG.md +5 -8
  95. package/docs/FORGE-PROTOCOL.md +15 -1064
  96. package/docs/anthropic-devrel-outreach.md +2 -2
  97. package/docs/articles/command-decomposition-token-savings.md +214 -0
  98. package/docs/articles/model-release-playbook.md +131 -0
  99. package/docs/articles/per-repo-adaptive-scripts-token-savings.md +27 -25
  100. package/docs/claude-breakpoints.json +75 -5
  101. package/docs/design/abc-benchmark.md +1 -1
  102. package/docs/design/design-spec-schema.md +1 -1
  103. package/docs/design/divergent-generation.md +1 -1
  104. package/docs/design/eval-gate-runbook.md +178 -0
  105. package/docs/design/show-hn-draft.md +26 -1
  106. package/docs/design/token-cost-baseline-1298.md +59 -0
  107. package/docs/eval/README.md +117 -0
  108. package/docs/eval/corpus/seed-v1.json +6 -0
  109. package/docs/eval/published/claude-sonnet-4-6-2026-07-04.json +33 -0
  110. package/docs/site/annotations-explained.md +24 -0
  111. package/docs/site/command-learning-path.md +51 -14
  112. package/docs/site/command-reference.md +339 -113
  113. package/docs/site/for-companies.md +95 -0
  114. package/docs/site/forge-annotation-protocol.md +12 -256
  115. package/docs/site/getting-started.md +43 -4
  116. package/docs/site/github-is-the-memory.md +113 -0
  117. package/docs/site/how-it-works.md +3 -13
  118. package/docs/site/index.md +9 -1
  119. package/docs/spec/eval-run-result.md +147 -0
  120. package/docs/spec/forge-protocol-v1.md +441 -18
  121. package/docs/spec/label-state-machine.md +55 -0
  122. package/docs/spec/review-protocol.md +158 -0
  123. package/docs/spec-graph-schema.md +28 -0
  124. package/docs/superpowers/specs/2026-07-04-economic-self-governance-design.md +181 -0
  125. package/docs/superpowers/specs/2026-07-04-provenance-trail-design.md +189 -0
  126. package/examples/forgedock-demo/README.md +41 -22
  127. package/examples/forgedock-demo/issues/06-bug-tags-type-validation.md +43 -0
  128. package/examples/forgedock-demo/issues/07-bug-negative-offset-pagination.md +42 -0
  129. package/examples/forgedock-demo/issues/08-bug-patch-mass-assignment.md +49 -0
  130. package/examples/forgedock-demo/issues/09-bug-count-injection.md +47 -0
  131. package/examples/forgedock-demo/issues/10-feature-sort-param.md +39 -0
  132. package/examples/forgedock-demo/issues/11-feature-patch-tags.md +37 -0
  133. package/examples/forgedock-demo/issues/12-feature-bulk-create.md +42 -0
  134. package/examples/forgedock-demo/issues/13-feature-archive-notes.md +46 -0
  135. package/examples/forgedock-demo/issues/14-refactor-extract-title-validation.md +41 -0
  136. package/examples/forgedock-demo/issues/15-refactor-protected-route-flag.md +43 -0
  137. package/examples/forgedock-demo/issues/16-refactor-extract-store.md +45 -0
  138. package/examples/forgedock-demo/issues/17-perf-tags-dedup-set.md +35 -0
  139. package/examples/forgedock-demo/issues/18-perf-remove-redundant-sort.md +37 -0
  140. package/examples/forgedock-demo/issues/19-docs-api-reference-full.md +53 -0
  141. package/examples/forgedock-demo/issues/20-docs-intentional-flaw-convention.md +46 -0
  142. package/examples/forgedock-demo/scripts/smoke.js +18 -1
  143. package/examples/forgedock-demo/src/db.js +36 -11
  144. package/examples/forgedock-demo/src/routes/notes.js +106 -9
  145. package/examples/forgedock-demo/src/server.js +4 -1
  146. package/package.json +3 -1
  147. package/packages/protocol/LICENSE +21 -0
  148. package/packages/protocol/src/cli.js +135 -0
  149. package/packages/protocol/src/emit.js +146 -0
  150. package/packages/protocol/src/index.js +43 -0
  151. package/packages/protocol/src/parse.js +229 -0
  152. package/packages/protocol/src/types.js +171 -0
  153. package/packages/protocol/src/validate.js +122 -0
  154. package/scripts/bench-topology-cost.mjs +372 -0
  155. package/scripts/check-command-docs-drift.sh +198 -0
  156. package/scripts/check-protocol-restatements.sh +176 -0
  157. package/scripts/check-registry/README.md +72 -0
  158. package/scripts/check-registry/manifest.json +6 -0
  159. package/scripts/code-index.sh +454 -0
  160. package/scripts/conformance-check.mjs +168 -0
  161. package/scripts/doctor-pipeline-state.sh +484 -0
  162. package/scripts/eval-gate-baseline.json +17 -0
  163. package/scripts/eval-gate-scorecard.mjs +242 -0
  164. package/scripts/eval-scorecard-aggregator.mjs +252 -0
  165. package/scripts/flaky-quarantine.sh +241 -0
  166. package/scripts/forge-annotation.sh +567 -0
  167. package/scripts/issue-dedup.sh +236 -0
  168. package/scripts/validate-annotation-node.mjs +233 -0
  169. package/scripts/worktree-lifecycle.sh +3 -3
  170. package/templates/devdocs/agent/using-forgedock.md +14 -0
  171. package/docs/site/.vitepress/config.mjs +0 -85
@@ -1,1064 +1,15 @@
1
- # FORGE Annotation Protocol
2
-
3
- **Version**: 1.0
4
- **Status**: Draft
5
- **License**: AGPL-3.0
6
-
7
- ---
8
-
9
- ## Overview
10
-
11
- The FORGE Annotation Protocol defines a machine-readable communication standard for AI development pipeline agents operating on GitHub. Agents write structured annotations as HTML comments inside GitHub issue and PR comments. Downstream agents read those annotations to reconstruct context — without relying on conversation history, shared memory, or a centralized server.
12
-
13
- **Key properties**:
14
- - **Transport**: Standard GitHub issue/PR comment API
15
- - **Encoding**: HTML comment tags (`<!-- FORGE:TYPE -->`) containing Markdown body
16
- - **Persistence**: GitHub issues/PRs are append-only — annotations survive compaction and session restarts
17
- - **Query interface**: `gh` CLI with `--jq` filters on `.body | contains("FORGE:TYPE")`
18
- - **Authoring agents**: Any AI agent that can write to the GitHub API
19
- - **Reader agents**: Any AI agent that can read the GitHub API
20
-
21
- The goal is interoperability: a pipeline agent from any tool (ForgeDock, Codex, aider, sweep, or a custom integration) should be able to produce and consume FORGE annotations, enabling chained multi-agent workflows where each agent picks up where the previous one left off.
22
-
23
- ---
24
-
25
- ## Syntax
26
-
27
- Every annotation begins with an opening HTML comment tag on its own line:
28
-
29
- ```
30
- <!-- FORGE:{TYPE} -->
31
- ```
32
-
33
- The annotation body follows in Markdown. An annotation ends when the next `<!-- FORGE:` tag appears, or at the end of the comment. Completion sentinels use a `{TYPE}:COMPLETE` suffix:
34
-
35
- ```
36
- <!-- INVESTIGATION:COMPLETE -->
37
- <!-- FORGE:CONTEXT:COMPLETE -->
38
- <!-- FORGE:ARCHITECT:COMPLETE -->
39
- <!-- FORGE:BUILDER:COMPLETE -->
40
- <!-- FORGE:DECOMPOSED:COMPLETE -->
41
- ```
42
-
43
- **Partial annotations** (interrupted before completion) use `:PARTIAL`:
44
-
45
- ```
46
- <!-- FORGE:CONTEXT:PARTIAL -->
47
- <!-- FORGE:ARCHITECT:PARTIAL -->
48
- ```
49
-
50
- An annotation comment without its completion sentinel indicates an interrupted run. Implementations SHOULD delete and restart partial annotations.
51
-
52
- ---
53
-
54
- ## Annotation Types
55
-
56
- ### Issue Pipeline Annotations
57
-
58
- These annotations are posted as GitHub **issue comments** and form the primary context chain for a pipeline run.
59
-
60
- ---
61
-
62
- #### `FORGE:INVESTIGATOR`
63
-
64
- **Phase**: Investigation (Phase 1)
65
- **Written by**: Investigator agent
66
- **Read by**: Builder agent, Architect agent, Decomposer agent
67
- **Completion sentinel**: `<!-- INVESTIGATION:COMPLETE -->`
68
-
69
- Captures the outcome of investigating whether an issue is valid, what the root cause is, and what should be built.
70
-
71
- **Schema**:
72
-
73
- ```
74
- <!-- FORGE:INVESTIGATOR -->
75
- ## Investigation Report
76
-
77
- **Verdict**: {CONFIRMED|PARTIAL|INVALID}
78
- **Confidence**: {HIGH|MEDIUM|LOW}
79
- **Severity**: {CRITICAL|HIGH|MEDIUM|LOW}
80
- **Task Type**: {Bug Fix|Feature|Refactor|Maintenance|Investigation}
81
-
82
- ### What Was Claimed
83
- {Summary of what the issue describes}
84
-
85
- ### What We Found
86
- {What the code actually shows — specific evidence}
87
-
88
- ### Root Cause
89
- {Specific root cause with file:line references where applicable}
90
-
91
- ### Affected Files
92
- {Numbered list of files that need changes}
93
-
94
- ### Evidence
95
- {Specific findings — function names, line numbers, behavior observed}
96
-
97
- ### Recommendation
98
- {What to build or fix, concrete and actionable}
99
-
100
- ### Related Issues
101
- {Related issues found via domain context discovery, max 5}
102
-
103
- ### Decomposition Assessment
104
- **{YES|NO}** — {reason}
105
- {If YES: proposed sub-issues with titles and dependencies}
106
-
107
- <!-- INVESTIGATION:COMPLETE -->
108
- ```
109
-
110
- **Field semantics**:
111
-
112
- | Field | Values | Required |
113
- |-------|--------|----------|
114
- | `Verdict` | `CONFIRMED` / `PARTIAL` / `INVALID` | Yes |
115
- | `Confidence` | `HIGH` / `MEDIUM` / `LOW` | Yes |
116
- | `Severity` | `CRITICAL` / `HIGH` / `MEDIUM` / `LOW` | Yes |
117
- | `Task Type` | `Bug Fix` / `Feature` / `Refactor` / `Maintenance` / `Investigation` | Yes |
118
- | `Decomposition Assessment` | `YES` or `NO` followed by reason | Yes |
119
-
120
- **Routing rules**:
121
- - `CONFIRMED` or `PARTIAL` with Decomposition = NO → proceed to build
122
- - `CONFIRMED` or `PARTIAL` with Decomposition = YES → proceed to decomposition
123
- - `INVALID` → close issue with explanation
124
-
125
- **Detection query**:
126
- ```bash
127
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
128
- --jq '.[] | select(.body | contains("FORGE:INVESTIGATOR")) | .body'
129
- ```
130
-
131
- ---
132
-
133
- #### `FORGE:DECOMPOSED`
134
-
135
- **Phase**: Decomposition (Phase 2)
136
- **Written by**: Decomposer agent
137
- **Read by**: Orchestrator agent, parent issue tracker
138
- **Completion sentinel**: `<!-- FORGE:DECOMPOSED:COMPLETE -->`
139
-
140
- Posted on the parent issue after sub-issues are created. Signals that the issue has been decomposed and each sub-issue now runs its own pipeline.
141
-
142
- **Schema**:
143
-
144
- ```
145
- <!-- FORGE:DECOMPOSED -->
146
- ## Decomposition Complete
147
-
148
- ### Sub-Issues Created
149
- - #{NUMBER}: {TITLE}
150
-
151
- ### Decomposition Rationale
152
- {Brief summary explaining why decomposition was needed}
153
-
154
- <!-- FORGE:DECOMPOSED:COMPLETE -->
155
- ```
156
-
157
- **Detection query**:
158
- ```bash
159
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
160
- --jq '.[] | select(.body | contains("FORGE:DECOMPOSED")) | .body'
161
- ```
162
-
163
- ---
164
-
165
- #### `FORGE:CONTRACT`
166
-
167
- **Phase**: Build — Contract (Phase 3C)
168
- **Written by**: Builder agent
169
- **Read by**: Builder agent (implementation phase), Review agents
170
-
171
- Defines the scope of a build task before implementation begins. Acts as a binding agreement between the investigator's findings and what will actually be built.
172
-
173
- **Schema**:
174
-
175
- ```
176
- <!-- FORGE:CONTRACT -->
177
- ## Builder Contract
178
-
179
- **Task type**: {TASK_TYPE}
180
-
181
- ### Proposed Approach
182
- {Brief description of the implementation approach}
183
-
184
- ### Deliverables
185
- | File | Change | Why |
186
- |------|--------|-----|
187
- | {filepath} | {what changes} | {why this change is needed} |
188
-
189
- ### Acceptance Criteria
190
- - [ ] {Specific, testable criterion}
191
-
192
- ### Quality Considerations
193
- {Auth model, new env vars, SQL safety, security surface, migration risk}
194
-
195
- ### Out of Scope
196
- {Items explicitly excluded from this PR}
197
- ```
198
-
199
- **Detection query**:
200
- ```bash
201
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
202
- --jq '.[] | select(.body | contains("FORGE:CONTRACT")) | .body'
203
- ```
204
-
205
- ---
206
-
207
- #### `FORGE:CONTEXT`
208
-
209
- **Phase**: Build — Context Gathering (Phase 3C.5)
210
- **Written by**: Context agent
211
- **Read by**: Builder agent (implementation phase)
212
- **Completion sentinels**: `<!-- FORGE:CONTEXT:COMPLETE -->` (full), `<!-- FORGE:CONTEXT:PARTIAL -->` (time-limited)
213
-
214
- Surfaces institutional memory before implementation begins. Aggregates past review findings, historical bugs, related code paths, and successful patterns from similar implementations.
215
-
216
- **Schema**:
217
-
218
- ```
219
- <!-- FORGE:CONTEXT -->
220
- ## Implementation Context for #{NUMBER}
221
-
222
- ### Known Pitfalls for This Area
223
- {Prevention rules from past review-findings on these files}
224
-
225
- ### Historical Findings on These Files
226
- {Past review-finding issues with pattern and prevention details}
227
-
228
- ### Past Bugs in This Module
229
- {Closed bug issues found via git log mining}
230
-
231
- ### Related Code Paths (must stay consistent)
232
- {Files that import or call the functions being changed}
233
-
234
- ### Patterns That Cause Bugs Here
235
- {Recurring bug types synthesized from historical findings}
236
-
237
- ### Successful Similar Implementations
238
- {Positive patterns from merged PRs in the same domain}
239
-
240
- <!-- FORGE:CONTEXT:COMPLETE -->
241
- ```
242
-
243
- **Detection query**:
244
- ```bash
245
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
246
- --jq '.[] | select(.body | contains("FORGE:CONTEXT")) | .body'
247
- ```
248
-
249
- ---
250
-
251
- #### `FORGE:ARCHITECT`
252
-
253
- **Phase**: Build — Architecture Plan (Phase 3C.6)
254
- **Written by**: Architect agent
255
- **Read by**: Builder agent (implementation phase — primary input)
256
- **Completion sentinels**: `<!-- FORGE:ARCHITECT:COMPLETE -->` (full), `<!-- FORGE:ARCHITECT:PARTIAL -->` (time-limited)
257
-
258
- Contains the ordered implementation plan. The builder agent follows this plan exactly when present. It traces all affected code paths, establishes consistency rules, sequences changes, and assesses risks.
259
-
260
- **Schema**:
261
-
262
- ```
263
- <!-- FORGE:ARCHITECT -->
264
- ## Implementation Plan for #{NUMBER}
265
-
266
- ### Affected Paths (ALL must be updated)
267
- | # | File | Function/Class | Change Required | Why |
268
- |---|------|----------------|-----------------|-----|
269
- | 1 | {filepath} | {function or class} | {what to change} | {reason} |
270
-
271
- ### Implementation Order
272
- 1. {First change} — {why first}
273
- 2. {Second change} — {why second}
274
-
275
- ### Consistency Checks
276
- - [ ] {Invariant that all paths must satisfy}
277
-
278
- ### Risk Assessment
279
- | Risk | Severity | Mitigation |
280
- |------|----------|------------|
281
- | {risk description} | HIGH/MEDIUM/LOW | {mitigation} |
282
-
283
- ### Files to Read Before Coding
284
- - `{filepath}` — {why to read it}
285
-
286
- <!-- FORGE:ARCHITECT:COMPLETE -->
287
- ```
288
-
289
- **Detection query**:
290
- ```bash
291
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
292
- --jq '.[] | select(.body | contains("FORGE:ARCHITECT")) | .body'
293
- ```
294
-
295
- ---
296
-
297
- #### `FORGE:BUILDER`
298
-
299
- **Phase**: Build — Implementation Complete (Phase 3M)
300
- **Written by**: Builder agent
301
- **Read by**: Review agents, Close phase agent
302
- **Completion sentinel**: `<!-- FORGE:BUILDER:COMPLETE -->`
303
-
304
- Posted after all implementation work is done and committed. Captures the branch, commits, files changed, and testing checklist. This is the primary handoff annotation to the review phase.
305
-
306
- **Schema**:
307
-
308
- ```
309
- <!-- FORGE:BUILDER -->
310
- ## Implementation Complete
311
-
312
- **Branch**: `{branch-name}`
313
- **Commits**: {commit SHA(s)}
314
- **Files changed**: {count}
315
-
316
- ### Approach
317
- {What was built, key decisions made}
318
-
319
- ### Changes
320
- - `{filepath}` — {what changed}
321
-
322
- ### Acceptance Criteria Status
323
- - [x] {criterion} — PASS
324
- - [ ] {criterion} — FAIL (reason)
325
-
326
- ### Testing Checklist
327
- - [ ] {test scenario}
328
-
329
- <!-- FORGE:BUILDER:COMPLETE -->
330
- ```
331
-
332
- **Detection query**:
333
- ```bash
334
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
335
- --jq '.[] | select(.body | contains("FORGE:BUILDER")) | .body'
336
- ```
337
-
338
- ---
339
-
340
- #### `FORGE:REVIEW_STARTED`
341
-
342
- **Phase**: Review (Phase 5B)
343
- **Written by**: Orchestrator agent
344
-
345
- Signals that the review phase has been invoked. Posted on the issue immediately before calling the review agent. Used to detect whether a review was initiated after compaction.
346
-
347
- **Schema**:
348
-
349
- ```
350
- ## Submitting for Review
351
-
352
- PR #{PR_NUMBER} created targeting `{base-branch}`. Invoking /review-pr with --auto-merge.
353
-
354
- <!-- FORGE:REVIEW_STARTED -->
355
- ```
356
-
357
- **Detection query**:
358
- ```bash
359
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
360
- --jq '.[] | select(.body | contains("FORGE:REVIEW_STARTED")) | .body'
361
- ```
362
-
363
- ---
364
-
365
- #### `FORGE:TRAJECTORY`
366
-
367
- **Phase**: Summary (Phase 7)
368
- **Written by**: Orchestrator agent
369
-
370
- Records the complete pipeline run as an audit trail. One `FORGE:TRAJECTORY` comment per issue lifecycle. Includes phase-by-phase results, decisions, and anomalies.
371
-
372
- **Schema**:
373
-
374
- ```
375
- <!-- FORGE:TRAJECTORY -->
376
- ## Pipeline Trajectory — #{NUMBER}
377
-
378
- | Phase | Result | Notes |
379
- |-------|--------|-------|
380
- | Phase 0: Context Load | ✅ Complete | {lane} → `{base-branch}` |
381
- | Phase 1: Investigation | ✅ {VERDICT} ({CONFIDENCE}) | Task type: {TASK_TYPE} |
382
- | Phase 2: Decomposition | ⏭ Skipped | {reason} |
383
- | Phase 3: Build | ✅ Complete | Branch: `{branch}` |
384
- | Phase 3G: Quality Gate | ✅ Gate passed | {N} iterations |
385
- | Phase 4–5: Review + PR | ✅ Merged | PR #{PR_NUMBER} → `{base-branch}` |
386
- | Phase 6: Close | ✅ Complete | Issue closed |
387
-
388
- **Decisions**: {key decisions made during the run}
389
- **Anomalies**: {anomalies or None}
390
- **Pipeline completed**: {ISO 8601 timestamp}
391
- ```
392
-
393
- **Detection query**:
394
- ```bash
395
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
396
- --jq '.[] | select(.body | contains("FORGE:TRAJECTORY")) | .body'
397
- ```
398
-
399
- ---
400
-
401
- ### Design Pipeline Annotations
402
-
403
- These annotations drive the UI Taste Harness — the design-generation pipeline that produces a landing page from a design-blind product brief. They carry design intent across the architect → generate → critique → close stages, exactly as the issue-pipeline annotations carry code-context across investigate → build → review.
404
-
405
- ---
406
-
407
- #### `FORGE:DESIGN_CONTEXT`
408
-
409
- **Phase**: Design — Investigate (`/design` stage 1, #888) — the first `FORGE:DESIGN_*` annotation in the chain
410
- **Written by**: `/design` design-investigate stage
411
- **Read by**: Design-architect stage (grounds the rationale), Close phase (audit trail)
412
- **Location**: Issue comment
413
-
414
- The design analog of `FORGE:CONTEXT`: the parsed brief (message / audience / single objection), the grammar pulled
415
- from the [reference corpus](design/reference-corpus.md) (#880), and the recent signature moves / archetypes / palettes
416
- pulled from [design-memory](design/design-memory.md) (#887) that this design must **diverge** from. Opens the
417
- `FORGE:DESIGN_*` chain that `FORGE:DESIGN_RATIONALE` → `FORGE:DESIGN_CANDIDATES` → `FORGE:DESIGN_SPEC` → `FORGE:CRITIQUE`
418
- → `FORGE:DESIGN_SHIPPED` continues. See [`commands/design.md`](../commands/design.md).
419
-
420
- **Schema**:
421
-
422
- ```markdown
423
- <!-- FORGE:DESIGN_CONTEXT -->
424
- ## Design Context — {product}
425
-
426
- **Message:** {one thing the page must say}
427
- **Audience / objection:** {who} — must overcome: {objection}
428
- **Corpus grammar:** {relevant traits / archetype priors from #880}
429
- **Diverge from (memory):** {recent signature moves / archetypes / palettes to avoid — #887}
430
- <!-- FORGE:DESIGN_CONTEXT:COMPLETE -->
431
- ```
432
-
433
- **Detection query**:
434
- ```bash
435
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
436
- --jq '.[] | select(.body | contains("FORGE:DESIGN_CONTEXT")) | .body'
437
- ```
438
-
439
- ---
440
-
441
- #### `FORGE:DESIGN_RATIONALE`
442
-
443
- **Phase**: Design — Architecture (design-architect, #886) — emitted *before* `FORGE:DESIGN_SPEC`
444
- **Written by**: Design-architect agent
445
- **Read by**: Generate agent (the spec it produces), render → vision-critique loop (#882), and a non-designer reviewer (the reasoning is reviewable without judging pixels)
446
- **Location**: Issue comment
447
-
448
- The designer's diary — the reasoning-before-generation step. Captures the seven-element chain of thought (intent/feeling, audience/objection, communication hierarchy, direction + rejected alternatives, signature move, what's being tried this time, non-goals) and **produces** the `FORGE:DESIGN_SPEC` rather than letting the spec appear from nowhere. The format is the structured contract: it MUST carry at least one explicitly **rejected alternative**, a named **signature move**, and a **produces-DESIGN_SPEC link**. See [`docs/design/design-architect-rationale.md`](design/design-architect-rationale.md) for the full doctrine.
449
-
450
- **Schema**:
451
-
452
- ```markdown
453
- <!-- FORGE:DESIGN_RATIONALE -->
454
- ## Design Rationale — {product}
455
-
456
- **Intent / feeling:** {one message} · {one feeling}
457
- **Audience / objection:** {who} — must overcome: {objection}
458
- **Communication hierarchy:** 1) {…} 2) {…} 3) {…}
459
- **Direction:** {archetype} — because {reasoning}
460
- - Considered & rejected: {alt A} (because {…}); {alt B} (because {…})
461
- **Signature move:** {the one non-obvious idea}
462
- **Trying this time:** {technique/learning} (from memory: avoiding {prior move})
463
- **Non-goals:** {what this won't do}
464
-
465
- → Produces DESIGN_SPEC: {link}
466
- ```
467
-
468
- **Detection query**:
469
- ```bash
470
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
471
- --jq '.[] | select(.body | contains("FORGE:DESIGN_RATIONALE")) | .body'
472
- ```
473
-
474
- ---
475
-
476
- #### `FORGE:DESIGN_CANDIDATES`
477
-
478
- **Phase**: Design — Divergent generation (#883) — emitted *after* `FORGE:DESIGN_RATIONALE`, *before* `FORGE:DESIGN_SPEC`
479
- **Written by**: Generate agent (divergent-generation step)
480
- **Read by**: Taste-judge (selects the winner), Close phase (audit trail), design-memory (#887, to diverge from past winners)
481
- **Location**: Issue comment
482
-
483
- The variance lever's audit record: the one **committed archetype** (one of the five corpus ids — #880, never blended),
484
- the **N distinct directions** generated within it, and the **independent taste-judge's** scores + selection. The
485
- winner hands off into `FORGE:DESIGN_SPEC`. The selection judge is deliberately distinct from the critique loop (#882)
486
- and the benchmark judge (#878) — anti-Goodhart. See [`docs/design/divergent-generation.md`](design/divergent-generation.md).
487
-
488
- **Schema**:
489
-
490
- ```markdown
491
- <!-- FORGE:DESIGN_CANDIDATES -->
492
- ## Design Candidates — {product}
493
-
494
- **Archetype (committed):** {one of the 5 corpus ids}
495
- **Directions:**
496
- 1. {concept} — signature: {move} — {distinguishing grammar/tokens}
497
- 2. {concept} — signature: {move} — {…}
498
- **Judge scores:** 1) {score} 2) {score} …
499
- **Selected:** #{n} — because {reason}
500
-
501
- → Winner produces DESIGN_SPEC: {link}
502
- ```
503
-
504
- **Detection query**:
505
- ```bash
506
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
507
- --jq '.[] | select(.body | contains("FORGE:DESIGN_CANDIDATES")) | .body'
508
- ```
509
-
510
- ---
511
-
512
- #### `FORGE:DESIGN_SPEC`
513
-
514
- **Phase**: Design — Architecture (design-architect, #886)
515
- **Written by**: Design-architect agent
516
- **Read by**: Generate agent (constrains output), deterministic anti-slop linter (#884), render → vision-critique loop (#882), Close phase agent (persists realized spec to design-memory, #887)
517
-
518
- A structured, **machine-checkable** representation of one page's design language. Carried across design-pipeline stages as a `FORGE:DESIGN_SPEC` annotation so taste decisions **persist** instead of being re-rolled per generation, and so a deterministic linter and a vision critic both check the rendered output against the *same* committed intent.
519
-
520
- Critically, the spec is **produced by** a `FORGE:DESIGN_RATIONALE` (the reasoning) — not authored from nowhere. The flow is rationale → spec → page.
521
-
522
- The full field-by-field schema (JSON shape, the per-field slop-tell defense table, and the lifecycle) lives in [`design/design-spec-schema.md`](design/design-spec-schema.md). The annotation body embeds that schema as a fenced `jsonc` block.
523
-
524
- **Schema** (annotation envelope):
525
-
526
- ````
527
- <!-- FORGE:DESIGN_SPEC -->
528
- ## Design Spec — {product}
529
-
530
- ```jsonc
531
- {
532
- "meta": { "product": "…", "archetype": "…", "corpus_version": "…", "rationale_ref": "…" },
533
- "typography": { "display_family": "…", "body_family": "…", "scale_ratio": …, "weights": […] },
534
- "color": { "mode": "…", "background": "#…", "foreground": "#…", "accent": "#…",
535
- "rules": ["no-default-tailwind-palette", "contrast>=4.5"] },
536
- "spacing": { "base_unit_px": …, "scale": […] },
537
- "radius": { "scale": […] },
538
- "shadow": { "tokens": […] },
539
- "motion": { "vocabulary": […], "reduced_motion": "required" },
540
- "layout_grammar":{ "sections": [ { "id": "…", "purpose": "…", "density": "…" } ], "rhythm": "…" },
541
- "effects_plan": { "per_section": [ … ], "budget": { … }, "never": [ … ] }, // doctrine: docs/design/effects-appropriateness.md (#885)
542
- "negatives": [ … ],
543
- "acceptance": { "perf_budget": { … }, "a11y": { … }, "divergence_ref": "…" }
544
- }
545
- ```
546
-
547
- → Produced by FORGE:DESIGN_RATIONALE: {link}
548
- ````
549
-
550
- **Field reference**: see [`design/design-spec-schema.md`](design/design-spec-schema.md) for the complete schema, the "How each field defends against slop" table, and the lifecycle.
551
-
552
- **Detection query**:
553
- ```bash
554
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
555
- --jq '.[] | select(.body | contains("FORGE:DESIGN_SPEC")) | .body'
556
- ```
557
-
558
- ---
559
-
560
- #### `FORGE:CRITIQUE`
561
-
562
- **Phase**: Design — Render → vision-critique loop (`/design-render-critique-loop`, #882) — after `FORGE:DESIGN_SPEC`
563
- **Written by**: Vision-critique loop (one per iteration)
564
- **Read by**: The iterate step (consumes its own findings), Close phase (improvement trajectory audit), `/design` (#888)
565
- **Location**: Issue comment
566
-
567
- One annotation per render→critique iteration — the page's improvement trajectory as an auditable trail. Records the
568
- deterministic lint floor result (#884), the desktop+mobile render, the perceptual findings (N3, N8–N12 — the negatives
569
- the linter declares out of scope), and the verdict (`PASS` | `ITERATE` | `BUDGET-EXHAUSTED`). The critic is strictly
570
- independent from the ABC benchmark judge (#878) — anti-Goodhart. See
571
- [`docs/design/render-critique-loop.md`](design/render-critique-loop.md).
572
-
573
- **Schema**:
574
-
575
- ```markdown
576
- <!-- FORGE:CRITIQUE -->
577
- ## Critique — {product} · iteration {i}/{max}
578
-
579
- **Lint floor:** {PASS | fixed N hard findings}
580
- **Render:** desktop + mobile captured
581
- **Perceptual findings:**
582
- - N{n}: {what was observed in the render} → {correction}
583
- **Verdict:** {PASS | ITERATE | BUDGET-EXHAUSTED}
584
- <!-- FORGE:CRITIQUE:COMPLETE -->
585
- ```
586
-
587
- **Detection query**:
588
- ```bash
589
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
590
- --jq '.[] | select(.body | contains("FORGE:CRITIQUE")) | .body'
591
- ```
592
-
593
- ---
594
-
595
- #### `FORGE:USER_FEEDBACK`
596
-
597
- <!-- Added: forge#1044 — user-feedback loop -->
598
-
599
- **Phase**: Design — User-feedback loop (`/design` stage 4.5, #1044) — after `FORGE:CRITIQUE`, before `FORGE:DESIGN_SHIPPED`
600
- **Written by**: `/design` user-feedback stage (Stage 4.5) — records structured user input after the automated critique loop
601
- **Read by**: Surgical re-generation step (same stage 4.5, consumes `section_target` + `modification`), Close phase (audit trail of user-driven changes)
602
- **Location**: Issue comment
603
-
604
- The structured record of one user-feedback round in Stage 4.5 of the `/design` pipeline. Posted once per feedback
605
- exchange — there may be multiple `FORGE:USER_FEEDBACK` annotations on a single issue if the user iterates several
606
- times. Each annotation carries a `section_target` (the section ID from `layout_grammar.sections` to re-generate), the
607
- `feedback_type` (asset / emotion / direction / freeform), any asset URL, the structured modification derived from the
608
- feedback, and a `satisfied` flag indicating whether the user is done iterating.
609
-
610
- The annotation is **not produced** in automated (benchmark) runs — Stage 4.5 is bypassed when no user is present.
611
- See [`docs/design/design-spec-schema.md`](design/design-spec-schema.md) for the section modularity contract that
612
- governs surgical re-generation. See [`commands/design.md`](../commands/design.md) for the full Stage 4.5 procedure.
613
-
614
- **Constraint**: `FORGE:USER_FEEDBACK` may modify a section's visual execution but MUST NOT change the committed
615
- `meta.archetype` or the signature move from `FORGE:DESIGN_RATIONALE` — those choices are locked once the spec is
616
- committed in Stage 2.
617
-
618
- **Schema**:
619
-
620
- ````markdown
621
- <!-- FORGE:USER_FEEDBACK -->
622
- ## User Feedback — {product} · round {n}
623
-
624
- **Section target:** {section ID from layout_grammar.sections, e.g. "hero" | "all" for page-wide feedback}
625
- **Feedback type:** {asset | emotion | direction | freeform}
626
- **Asset URL:** {URL or "none"}
627
- **Modification:** {structured description of what to change — derived from user's natural-language input}
628
- **Emotion target:** {trust | speed | power | craft | play | unchanged} — maps to motion vocabulary
629
- **Satisfied:** {yes | no — "no" loops back to 4.5 after re-generation}
630
- **Freeform notes:** {verbatim user input not captured in the structured fields above}
631
- <!-- FORGE:USER_FEEDBACK:COMPLETE -->
632
- ````
633
-
634
- **Field notes**:
635
- - `section_target`: must match an `id` in the committed `FORGE:DESIGN_SPEC → layout_grammar.sections`. Use `"all"` only for page-wide color/typography changes that cannot be scoped to one section.
636
- - `feedback_type`: `asset` = user provided a URL (video/logo/image/colors); `emotion` = user described a feeling to change; `direction` = user described a layout or composition change; `freeform` = catch-all for input that doesn't fit the above.
637
- - `modification`: the parsed, actionable version of the user's words — e.g., user says "make the hero feel more urgent" → modification: `"increase motion intensity in hero scroll-reveal; tighten headline tracking"`.
638
- - `satisfied: yes` means no further feedback iteration — proceed to Stage 5 (design-close).
639
-
640
- **Detection query**:
641
- ```bash
642
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
643
- --jq '[.[] | select(.body | contains("FORGE:USER_FEEDBACK"))] | last | .body'
644
- ```
645
-
646
- ---
647
-
648
- #### `FORGE:BENCH_SCORECARD`
649
-
650
- **Phase**: Design — Benchmark (`/design-bench`, #878)
651
- **Written by**: Benchmark rig (`/design-bench` command)
652
- **Read by**: Harness developers (the fitness signal — "did arm A's win-rate vs C go up?"), milestone tracker, pipeline-health
653
-
654
- The result of one ABC benchmark run. Arm A is the ForgeDock harness output, arm B is a raw one-shot model, and arm C is the real reference page (gold standard). The annotation carries the **win-rate of each arm against C**, the **A-vs-B harness delta**, rubric **distributions** (mean + stdev) across n runs, mean slop counts, and the **judge-calibration check** (C must beat A and B; otherwise the judge is miscalibrated and the result is suspect).
655
-
656
- The scorecard is the fitness function for the UI Taste Harness milestone — it is built before the harness so each lever the harness adds is a measurable hypothesis. The methodology (three arms, same-model rule, three-layer judging, n>=3) lives in [`design/abc-benchmark.md`](design/abc-benchmark.md); the deterministic aggregator is [`../scripts/bench-scorecard.mjs`](../scripts/bench-scorecard.mjs).
657
-
658
- Two invariants this annotation encodes: **n>=3** (taste output is high-variance — distributions, never a single number) and **judge independence** from the harness critique loop (#882) (anti-Goodhart).
659
-
660
- **Schema** (annotation envelope):
661
-
662
- ````
663
- <!-- FORGE:BENCH_SCORECARD -->
664
- ## ABC Benchmark Scorecard
665
-
666
- **Corpus version**: {ver} · **Generation model (A & B)**: {model} · **Judge model**: {independent judge}
667
- **Products**: {n_products} · **Runs/product**: {n}
668
-
669
- | Arm | Win-rate vs C | A-vs-B | Mean slop |
670
- |-----|---------------|--------|-----------|
671
- | A | {wr} | {a_vs_b} | {slop_A} |
672
- | B | {wr} | — | {slop_B} |
673
-
674
- **Judge calibration**: {ok | MISCALIBRATED — N runs where C lost (suspect)}
675
-
676
- ```json
677
- {scorecard.json from bench-scorecard.mjs}
678
- ```
679
-
680
- <!-- FORGE:BENCH_SCORECARD:COMPLETE -->
681
- ````
682
-
683
- **Detection query**:
684
- ```bash
685
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
686
- --jq '.[] | select(.body | contains("FORGE:BENCH_SCORECARD")) | .body'
687
- ```
688
-
689
- ---
690
-
691
- #### `FORGE:DESIGN_SHIPPED`
692
-
693
- **Phase**: Design — Close (`/design` stage 5, #888) — the terminal `FORGE:DESIGN_*` annotation
694
- **Written by**: `/design` design-close stage
695
- **Read by**: [design-memory](design/design-memory.md) (#887, persists the realized outcome), milestone tracker, pipeline-health
696
- **Location**: Issue comment
697
-
698
- Closes the design pipeline. Posted only when the design passes the full definition of done — critique-rubric threshold,
699
- perf budget (#875), a11y check, and the divergence check (#887). Records the final scorecard and the realized outcome
700
- (archetype, signature move, palette/type/effects, learnings) that is written to design-memory so the *next* design can
701
- diverge from it. The design analog of closing a code issue at `workflow:merged`; its label is `design:shipped` (the
702
- rejected counterpart is `design:rejected`, set without this annotation). See [`commands/design.md`](../commands/design.md).
703
-
704
- **Schema**:
705
-
706
- ```markdown
707
- <!-- FORGE:DESIGN_SHIPPED -->
708
- ## Design Shipped — {product}
709
-
710
- **Archetype:** {committed id} · **Signature move:** {the hook}
711
- **Gates:** rubric {pass} · perf {pass} · a11y {pass} · divergence {distinct from prior — #887}
712
- **Critique iterations:** {n}
713
- **Written to memory:** {palette/type/effects/learnings summary}
714
- <!-- FORGE:DESIGN_SHIPPED:COMPLETE -->
715
- ```
716
-
717
- **Detection query**:
718
- ```bash
719
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
720
- --jq '.[] | select(.body | contains("FORGE:DESIGN_SHIPPED")) | .body'
721
- ```
722
-
723
- ---
724
-
725
- ### Orchestration / Milestone Annotations
726
-
727
- These annotations transfer investigation context across issue boundaries in decomposed or multi-issue milestone workflows.
728
-
729
- ---
730
-
731
- #### `FORGE:KNOWLEDGE_GIST`
732
-
733
- **Phase**: Investigation — Knowledge Persistence (Phase 1C.5)
734
- **Written by**: Investigator agent
735
- **Read by**: Decomposer agent, Builder agent (via `FORGE:PRIOR_GIST`)
736
- **Location**: Issue comment
737
-
738
- Posted after investigation completes. Contains a URL to a GitHub Gist that holds the full investigation findings as a stable, linkable artifact. Downstream sub-issues embed the Gist URL as `FORGE:PRIOR_GIST` annotations so builders can fetch prior context.
739
-
740
- **Schema**:
741
-
742
- ```
743
- <!-- FORGE:KNOWLEDGE_GIST: {https://gist.github.com/...} -->
744
- ## Knowledge Gist Created
745
-
746
- Investigation findings persisted as a linkable artifact.
747
-
748
- **Gist**: {URL}
749
- **Filename**: `{repo}_{issue_number}_{slug}.md`
750
-
751
- _This Gist can be referenced by downstream issues for context transfer._
752
- ```
753
-
754
- **Gist content schema** (YAML frontmatter + Markdown body):
755
-
756
- ```yaml
757
- ---
758
- issue: {NUMBER}
759
- repo: {OWNER}/{REPO}
760
- milestone: {MILESTONE_TITLE}
761
- verdict: {CONFIRMED|PARTIAL|INVALID}
762
- task_type: {TASK_TYPE}
763
- confidence: {HIGH|MEDIUM|LOW}
764
- severity: {CRITICAL|HIGH|MEDIUM|LOW}
765
- created: {ISO 8601 timestamp}
766
- source: FORGE:INVESTIGATOR
767
- ---
768
- ```
769
-
770
- **Detection query**:
771
- ```bash
772
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
773
- --jq '[.[] | select(.body | test("<!-- FORGE:KNOWLEDGE_GIST: https://")) |
774
- .body | capture("<!-- FORGE:KNOWLEDGE_GIST: (?<url>https://[^ ]+) -->").url] |
775
- unique | .[]'
776
- ```
777
-
778
- ---
779
-
780
- #### `FORGE:MILESTONE_INDEX`
781
-
782
- **Phase**: Investigation — Milestone Index (Phase 1C.6)
783
- **Written by**: Investigator agent
784
- **Read by**: Builder agent (via milestone description lookup)
785
- **Location**: GitHub Milestone description field (not issue comment)
786
-
787
- A URL embedded in the milestone description pointing to an index Gist. The index aggregates all `FORGE:KNOWLEDGE_GIST` URLs for a milestone, giving any agent working on any milestone issue access to all prior investigations in one fetch.
788
-
789
- **Syntax** (in milestone description):
790
-
791
- ```
792
- <!-- FORGE:MILESTONE_INDEX: {https://gist.github.com/...} -->
793
- ```
794
-
795
- **Detection query**:
796
- ```bash
797
- gh api repos/{OWNER}/{REPO}/milestones/{MILESTONE_NUMBER} \
798
- --jq '.description' | \
799
- grep -oP '(?<=<!-- FORGE:MILESTONE_INDEX: )https://[^ ]+(?= -->)'
800
- ```
801
-
802
- ---
803
-
804
- #### `FORGE:PRIOR_GIST`
805
-
806
- **Phase**: Decomposition (Phase 2C)
807
- **Written by**: Decomposer agent
808
- **Read by**: Builder agent (context phase)
809
- **Location**: Sub-issue body
810
-
811
- Embedded in sub-issue bodies by the decomposer. Points to the parent issue's Knowledge Gist. Allows the builder working on a sub-issue to fetch upstream investigation context without navigating the parent issue.
812
-
813
- **Syntax** (in sub-issue body):
814
-
815
- ```
816
- <!-- FORGE:PRIOR_GIST: {https://gist.github.com/...} -->
817
- ```
818
-
819
- **Detection query** (from sub-issue body):
820
- ```bash
821
- gh issue view {NUMBER} -R {OWNER}/{REPO} --json body --jq '.body' | \
822
- grep -oP '(?<=<!-- FORGE:PRIOR_GIST: )https://[^ ]+(?= -->)'
823
- ```
824
-
825
- ---
826
-
827
- ### Pipeline Control Markers
828
-
829
- These annotations appear inside command specification files (not issue comments) to mark phase boundaries and error states.
830
-
831
- ---
832
-
833
- #### `FORGE:DISPATCHER`
834
-
835
- **Location**: Pipeline command spec (e.g., `work-on.md`)
836
- **Purpose**: Marks the Universal Phase Dispatcher — the single source of truth for phase transitions and routing logic.
837
-
838
- ```
839
- <!-- FORGE:DISPATCHER — {description} -->
840
- ```
841
-
842
- ---
843
-
844
- #### `FORGE:PHASE_COMPLETE`
845
-
846
- **Location**: Pipeline command spec
847
- **Purpose**: Inter-phase boundary annotation. Documents that a phase has completed and identifies the next phase. Used to prevent agents from misinterpreting intermediate results as terminal states.
848
-
849
- ```
850
- <!-- FORGE:PHASE_COMPLETE — {description of what completed}. See Universal Phase Dispatcher: next phase is {NEXT_PHASE}. Not terminal — continue immediately. -->
851
- ```
852
-
853
- ---
854
-
855
- #### Error State Markers
856
-
857
- Posted to issue comments when pipeline operations fail hard. Signal that human intervention is needed.
858
-
859
- | Annotation | Trigger |
860
- |-----------|---------|
861
- | `<!-- FORGE:ANCESTRY_FAILED -->` | Post-commit ancestry audit found merge commits in the branch |
862
- | `<!-- FORGE:GATE_FAILED -->` | Quality gate failed after maximum retry iterations |
863
- | `<!-- FORGE:PUSH_BLOCKED -->` | Branch push blocked (e.g., protected branch policy) |
864
- | `<!-- FORGE:PUSH_FAILED -->` | Branch push failed after `--force-with-lease` retry |
865
-
866
- ---
867
-
868
- ### Audit Annotations
869
-
870
- ---
871
-
872
- #### `FORGE:AUDIT`
873
-
874
- **Written by**: Audit command agents
875
- **Location**: Issue or PR comment
876
-
877
- Posted by `/audit` and `/audit-agents` commands after running structured code audits.
878
-
879
- ---
880
-
881
- #### `FORGE:SECURITY_AUDIT`
882
-
883
- **Written by**: Security audit command
884
- **Location**: Issue comment
885
-
886
- Posted by `/security-audit` after completing a 4-phase security posture audit.
887
-
888
- ---
889
-
890
- ## Context-Passing Chain
891
-
892
- The annotations form an ordered context chain. Each phase reads the outputs of all preceding phases:
893
-
894
- ```
895
- Issue body
896
- ↓
897
- FORGE:INVESTIGATOR (Phase 1 → written to issue)
898
- ↓
899
- FORGE:DECOMPOSED (Phase 2 → written to issue, if decomposed)
900
- ↓
901
- FORGE:CONTRACT (Phase 3C → written to issue)
902
- ↓
903
- FORGE:CONTEXT (Phase 3C.5 → written to issue)
904
- ↓
905
- FORGE:ARCHITECT (Phase 3C.6 → written to issue)
906
- ↓
907
- FORGE:BUILDER (Phase 3M → written to issue)
908
- ↓
909
- FORGE:REVIEW_STARTED (Phase 5B → written to issue)
910
- ↓
911
- FORGE:TRAJECTORY (Phase 7 → written to issue)
912
- ```
913
-
914
- **Cross-issue context** (milestone / decomposed workflows):
915
-
916
- ```
917
- Parent: FORGE:INVESTIGATOR → FORGE:KNOWLEDGE_GIST (Gist URL)
918
- ↓
919
- Milestone description: FORGE:MILESTONE_INDEX (index Gist URL)
920
- ↓
921
- Sub-issue body: FORGE:PRIOR_GIST (URL from parent's Knowledge Gist)
922
- ↓
923
- Sub-issue: FORGE:CONTEXT reads FORGE:PRIOR_GIST to fetch upstream context
924
- ```
925
-
926
- ---
927
-
928
- ## Label State Machine
929
-
930
- In addition to annotations, FORGE-compliant pipelines track state via GitHub labels. Labels allow agents to determine the current phase without reading all comment history.
931
-
932
- | Label | Meaning | Set by |
933
- |-------|---------|--------|
934
- | `workflow:investigating` | Investigation phase active | Investigator agent |
935
- | `workflow:ready-to-build` | Investigation complete, build not started | Investigator agent |
936
- | `workflow:building` | Build phase active | Builder agent |
937
- | `workflow:in-review` | PR created, review active | Orchestrator agent |
938
- | `workflow:merged` | PR merged, issue closed | Close phase agent |
939
- | `workflow:invalid` | Issue closed as invalid | Investigator agent |
940
- | `workflow:decomposed` | Issue decomposed into sub-issues | Decomposer agent |
941
- | `needs-human` | Pipeline blocked, human intervention required | Any agent on error |
942
-
943
- **Terminal labels** (pipeline stops when these are set):
944
-
945
- - `workflow:merged`
946
- - `workflow:invalid`
947
- - `needs-human`
948
- - `workflow:decomposed`
949
-
950
- ---
951
-
952
- ## Conformance
953
-
954
- A conformant FORGE implementation:
955
-
956
- 1. **Writes** annotations with the exact `<!-- FORGE:{TYPE} -->` opening tag
957
- 2. **Reads** annotations using `.body | contains("FORGE:{TYPE}")` filtering
958
- 3. **Honors** completion sentinels — does not proceed as if an annotation is complete when its sentinel is absent
959
- 4. **Deletes and restarts** interrupted partial annotations before continuing a phase
960
- 5. **Skips** phases that have a complete annotation already present (idempotent)
961
- 6. **Writes** state to GitHub after every significant step (compaction resilience)
962
- 7. **Re-reads** GitHub state at the start of each phase (does not rely on in-memory context)
963
-
964
- ### Conformance Test: Annotation Presence
965
-
966
- To verify that a pipeline run wrote all expected annotations for a completed issue:
967
-
968
- ```bash
969
- OWNER="your-org"
970
- REPO="your-repo"
971
- NUMBER=42
972
-
973
- # Required annotations for a complete non-decomposed run
974
- REQUIRED=("FORGE:INVESTIGATOR" "FORGE:CONTRACT" "FORGE:CONTEXT" "FORGE:ARCHITECT" "FORGE:BUILDER" "FORGE:TRAJECTORY")
975
-
976
- for annotation in "${REQUIRED[@]}"; do
977
- COUNT=$(gh api repos/${OWNER}/${REPO}/issues/${NUMBER}/comments \
978
- --jq "[.[] | select(.body | contains(\"${annotation}\"))] | length")
979
- if [ "$COUNT" -gt 0 ]; then
980
- echo "✅ ${annotation} — present (${COUNT} comment(s))"
981
- else
982
- echo "❌ ${annotation} — MISSING"
983
- fi
984
- done
985
- ```
986
-
987
- ### Conformance Test: Completion Sentinels
988
-
989
- ```bash
990
- # Check that FORGE:INVESTIGATOR has INVESTIGATION:COMPLETE sentinel
991
- BODY=$(gh api repos/${OWNER}/${REPO}/issues/${NUMBER}/comments \
992
- --jq '.[] | select(.body | contains("FORGE:INVESTIGATOR")) | .body' | head -1)
993
-
994
- if echo "$BODY" | grep -q "INVESTIGATION:COMPLETE"; then
995
- echo "✅ FORGE:INVESTIGATOR — complete"
996
- else
997
- echo "❌ FORGE:INVESTIGATOR — incomplete (missing sentinel)"
998
- fi
999
- ```
1000
-
1001
- ### Conformance Test: Label State
1002
-
1003
- ```bash
1004
- # Verify terminal state was reached
1005
- LABELS=$(gh issue view ${NUMBER} -R ${OWNER}/${REPO} --json labels \
1006
- --jq '[.labels[].name | select(startswith("workflow:"))]')
1007
-
1008
- TERMINAL=("workflow:merged" "workflow:invalid" "workflow:decomposed")
1009
- for label in "${TERMINAL[@]}"; do
1010
- if echo "$LABELS" | grep -q "$label"; then
1011
- echo "✅ Terminal label: ${label}"
1012
- exit 0
1013
- fi
1014
- done
1015
- echo "⚠ No terminal label found — pipeline may be incomplete"
1016
- ```
1017
-
1018
- ---
1019
-
1020
- ## Implementing FORGE in Your Tool
1021
-
1022
- To make your AI coding tool FORGE-compatible:
1023
-
1024
- 1. **Read existing annotations** before starting work on an issue:
1025
- ```bash
1026
- gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
1027
- --jq '.[] | {id: .id, body: .body}' | \
1028
- grep -A 999 "FORGE:"
1029
- ```
1030
-
1031
- 2. **Write annotations** in the correct format after completing each phase. Use the schemas in this document.
1032
-
1033
- 3. **Check for existing annotations** before writing (idempotency):
1034
- ```bash
1035
- # Don't write FORGE:INVESTIGATOR if one already exists with INVESTIGATION:COMPLETE
1036
- EXISTING=$(gh api repos/{OWNER}/{REPO}/issues/{NUMBER}/comments \
1037
- --jq '.[] | select(.body | contains("FORGE:INVESTIGATOR") and contains("INVESTIGATION:COMPLETE")) | .id')
1038
- if [ -n "$EXISTING" ]; then echo "Already investigated — skip"; fi
1039
- ```
1040
-
1041
- 4. **Respect label state** — check `workflow:*` labels to determine where the pipeline is and whether it's in a terminal state.
1042
-
1043
- 5. **Use the `gh` CLI** as the primary query interface. All FORGE implementations can assume `gh` is available.
1044
-
1045
- ---
1046
-
1047
- ## Versioning
1048
-
1049
- This document describes FORGE Protocol **version 1.0**. Future revisions will:
1050
-
1051
- - Increment the minor version for backward-compatible additions (new annotation types, new optional fields)
1052
- - Increment the major version for breaking changes (renamed annotations, removed required fields)
1053
-
1054
- Annotations do not carry an explicit version field. Conformant readers MUST tolerate unknown annotation types gracefully (skip, don't fail).
1055
-
1056
- ---
1057
-
1058
- ## Reference
1059
-
1060
- - [ForgeDock repository](https://github.com/RapierCraftStudios/ForgeDock)
1061
- - [ForgeDock commands](https://github.com/RapierCraftStudios/ForgeDock/tree/main/commands)
1062
- - [`work-on.md`](../commands/work-on.md) — Full pipeline implementation reference
1063
- - [`review-pr.md`](../commands/review-pr.md) — Review phase implementation reference
1064
- - [`autopilot.md`](../commands/autopilot.md) — Orchestration and milestone index implementation
1
+ # FORGE Annotation Protocol — Deprecated
2
+
3
+ > **This document is no longer the authoritative reference.**
4
+ >
5
+ > The formal, published specification is:
6
+ > **[`docs/spec/forge-protocol-v1.md`](spec/forge-protocol-v1.md)**
7
+ >
8
+ > The spec in `docs/spec/forge-protocol-v1.md` is the complete, current document.
9
+ > It supersedes this file entirely. Please update any bookmarks or links.
10
+ >
11
+ > **License note**: The authoritative spec is licensed under
12
+ > [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) — freely shareable
13
+ > and usable in any product with attribution. This older draft was mistakenly
14
+ > marked AGPL-3.0; the protocol description itself has always been intended for
15
+ > open, license-compatible adoption.