forgedock 1.2.0 → 1.3.0

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 (53) hide show
  1. package/README.md +8 -2
  2. package/bin/engine/phases.mjs +178 -28
  3. package/bin/engine/state.mjs +39 -7
  4. package/bin/engine-cli.mjs +63 -2
  5. package/bin/engine.mjs +25 -4
  6. package/bin/forgedock.mjs +235 -4
  7. package/bin/hooks/pre-tool-use.mjs +26 -12
  8. package/bin/journey.mjs +103 -11
  9. package/commands/forge-stats.md +5 -4
  10. package/commands/issue.md +5 -1
  11. package/commands/orchestrate/phase-4-execution.md +2 -0
  12. package/commands/qa-sweep.md +17 -0
  13. package/commands/replay.md +16 -2
  14. package/commands/review-pr-agents/spec-cli.md +179 -0
  15. package/commands/review-pr.md +49 -0
  16. package/commands/upgrade-deps.md +518 -0
  17. package/commands/work-on/build/validate.md +61 -1
  18. package/commands/work-on/build.md +9 -1
  19. package/commands/work-on/decompose.md +8 -1
  20. package/docs/AIDER.md +264 -0
  21. package/docs/AUTOPILOT-CRON.md +130 -0
  22. package/docs/CONFIG.md +36 -0
  23. package/docs/CURSOR.md +135 -0
  24. package/docs/OPENCODE.md +312 -0
  25. package/docs/demo.gif +0 -0
  26. package/docs/eval/README.md +4 -4
  27. package/docs/launch/show-hn.md +3 -3
  28. package/docs/site/architecture.md +180 -0
  29. package/docs/site/command-reference.md +17 -0
  30. package/docs/site/configuration.md +243 -0
  31. package/docs/site/for-companies.md +4 -4
  32. package/docs/site/forge-annotation-protocol.md +1 -1
  33. package/docs/site/github-is-the-memory.md +2 -2
  34. package/docs/site/how-it-works.md +1 -1
  35. package/docs/site/public/llms-full.txt +380 -0
  36. package/docs/site/public/llms.txt +35 -0
  37. package/docs/spec-graph-schema.md +3 -3
  38. package/package.json +2 -2
  39. package/packages/protocol/README.md +75 -0
  40. package/packages/protocol/src/card.js +114 -0
  41. package/packages/protocol/src/cli.js +4 -77
  42. package/packages/protocol/src/emit.js +14 -3
  43. package/packages/protocol/src/index.js +2 -1
  44. package/packages/protocol/src/parse.js +17 -8
  45. package/packages/protocol/src/types.js +1 -1
  46. package/packages/protocol/src/validate.js +11 -0
  47. package/scripts/check-command-side-effects.sh +261 -0
  48. package/scripts/check-spec-markers.sh +273 -0
  49. package/scripts/classify-lane.sh +29 -7
  50. package/scripts/forge-run.sh +322 -0
  51. package/templates/cross-repo-trigger.yml +282 -0
  52. package/templates/cursor/forge.mdc +148 -0
  53. package/templates/github-actions/forgedock-autopilot.yml +113 -0
@@ -0,0 +1,312 @@
1
+ # OpenCode Support
2
+
3
+ ForgeDock has an OpenCode adapter that lets OpenCode run the ForgeDock pipeline
4
+ using its native bash tool and the `gh` CLI.
5
+
6
+ ## Architecture
7
+
8
+ Shared source:
9
+ - `commands/**/*.md` remains the workflow spec for all runtimes
10
+
11
+ Claude Code wrapper:
12
+ - `install.sh` (or `npx forgedock`) symlinks command files into `~/.claude/commands/`
13
+
14
+ Codex wrapper:
15
+ - `install-codex.sh` generates namespaced skills in `~/.codex/skills/`
16
+
17
+ Aider wrapper:
18
+ - `install-aider.sh` writes `~/.aider-forge.md` loaded via `--read`
19
+
20
+ **OpenCode wrapper** (this document):
21
+ - `install-opencode.sh` writes `~/.opencode-forge.md` — a conventions file
22
+ OpenCode loads via the `instructions` field in `opencode.json`
23
+ - `install-opencode.sh` also patches `~/.config/opencode/opencode.json` to
24
+ register ForgeDock pipeline commands as native OpenCode slash commands
25
+ (`/work-on`, `/review-pr`, `/quality-gate`, `/orchestrate`)
26
+
27
+ This is a conventions-file + command-registration architecture. The shared
28
+ `commands/` directory remains the single source of truth — the adapter
29
+ registers entry points that read from it.
30
+
31
+ ## Feasibility
32
+
33
+ OpenCode is the **highest-fidelity** non-Claude Code adapter because:
34
+
35
+ | Capability | Requirement | OpenCode support |
36
+ |-----------|-------------|-----------------|
37
+ | Load instruction files | `instructions` field in `opencode.json` | Native |
38
+ | Execute shell commands | `gh`, `git`, standard tools | Native `Bash` tool |
39
+ | Read/write files | File editing | Native `Read`/`Write`/`Edit` tools |
40
+ | GitHub API | `gh` CLI | Via `Bash("gh ...")` |
41
+ | Multi-step workflows | Follow sequential instructions | Supported |
42
+ | Compaction resilience | Re-read GitHub state at phase start | Supported (via `Bash("gh ...")`) |
43
+ | Native slash commands | `/work-on 967` in TUI | Via `command` config |
44
+ | Tool name parity | Same tool names as Claude Code | Direct — no translation needed |
45
+
46
+ **Key advantage over Aider and Cursor**: OpenCode shares Claude Code's tool
47
+ names (`Bash`, `Read`, `Write`, `Edit`, `Glob`, `Grep`, `WebFetch`) — no
48
+ translation table required for most operations. Pipeline command specs run
49
+ nearly unmodified.
50
+
51
+ ## Install
52
+
53
+ ### Option A — standalone bash installer
54
+
55
+ ```bash
56
+ cd /path/to/forgedock
57
+ ./install-opencode.sh
58
+ ```
59
+
60
+ This writes `~/.opencode-forge.md` with ForgeDock conventions and patches
61
+ `~/.config/opencode/opencode.json` with:
62
+ - `instructions`: adds `~/.opencode-forge.md` to OpenCode's system prompt
63
+ - `command`: registers `/work-on`, `/review-pr`, `/quality-gate`, `/orchestrate`
64
+
65
+ ### Option B — via npx forgedock
66
+
67
+ When `opencode` is detected on your PATH, `npx forgedock` writes
68
+ `~/.opencode-forge.md` and patches `opencode.json` as an additional install
69
+ step. No existing Claude Code files are affected.
70
+
71
+ ```bash
72
+ npx forgedock
73
+ ```
74
+
75
+ ## Usage
76
+
77
+ ### Native slash commands (recommended)
78
+
79
+ After running `install-opencode.sh`, use ForgeDock commands in the OpenCode
80
+ TUI:
81
+
82
+ ```
83
+ /work-on 967
84
+ /review-pr 123
85
+ /quality-gate
86
+ ```
87
+
88
+ Or headlessly via `opencode run`:
89
+
90
+ ```bash
91
+ opencode run --command work-on "967"
92
+ opencode run --command review-pr "123"
93
+ ```
94
+
95
+ ### Manual pipeline loading
96
+
97
+ Read a pipeline command spec directly and follow it:
98
+
99
+ ```
100
+ Read the file /path/to/forgedock/commands/work-on.md and run the pipeline for issue 967.
101
+ ```
102
+
103
+ OpenCode will load the spec and execute each phase using its native tools.
104
+
105
+ ### Phase routing with forge-run.sh
106
+
107
+ `forge-run.sh` emits JSON phase state for the current issue without invoking
108
+ an LLM. Use it to determine the current pipeline phase:
109
+
110
+ ```bash
111
+ Bash("/path/to/forgedock/scripts/forge-run.sh work-on 967 -R OWNER/REPO")
112
+ ```
113
+
114
+ Output (NDJSON):
115
+ ```json
116
+ {"event":"phase_detected","command":"work-on","issue":967,"phase":"no-comments","ts":"..."}
117
+ {"event":"phase_detail","phase":"no-comments","lane":"feature","branch":"milestone/dev-exp","labels":[]}
118
+ {"event":"action_required","phase":"no-comments","action":"No pipeline activity detected. Invoke /work-on 967 to start investigation.","ts":"..."}
119
+ ```
120
+
121
+ ## Tool Translation
122
+
123
+ OpenCode and Claude Code share the same tool names. Most pipeline operations
124
+ run without modification:
125
+
126
+ | Claude Code | OpenCode | Notes |
127
+ |-------------|----------|-------|
128
+ | `Bash("git status")` | `Bash("git status")` | Direct |
129
+ | `Read("path/to/file")` | `Read("path/to/file")` | Direct |
130
+ | `Write("path", content)` | `Write("path", content)` | Direct |
131
+ | `Edit("path", ...)` | `Edit("path", ...)` | Direct |
132
+ | `Glob("**/*.md")` | `Glob("**/*.md")` | Direct |
133
+ | `Grep(pattern, path)` | `Grep(pattern, path)` | Direct |
134
+ | `WebFetch(url)` | `WebFetch(url)` | Direct |
135
+ | `Skill("work-on", args="123")` | Read `commands/work-on.md` | No skill loader — read spec directly |
136
+ | `Skill("review-pr", args="456")` | Read `commands/review-pr.md` | No skill loader — read spec directly |
137
+ | `Agent(...)` / `Task(...)` | Continue the sub-task inline | No sub-agent model; inline it |
138
+
139
+ ### Nested Skill references
140
+
141
+ When a command spec calls `Skill("x")` or references another command, read
142
+ the referenced command spec directly:
143
+
144
+ ```
145
+ # Load the referenced command spec:
146
+ Read("/path/to/forgedock/commands/quality-gate.md")
147
+ ```
148
+
149
+ Map command names to file paths:
150
+ - `Skill("work-on")` → `commands/work-on.md`
151
+ - `Skill("review-pr")` → `commands/review-pr.md`
152
+ - `Skill("quality-gate")` → `commands/quality-gate.md`
153
+ - `Skill("orchestrate")` → `commands/orchestrate.md`
154
+
155
+ ## GitHub Operations
156
+
157
+ All FORGE annotations are written to GitHub issue/PR comments via the `gh`
158
+ CLI. Use `Bash()` for every GitHub operation.
159
+
160
+ ### Label management
161
+
162
+ ```bash
163
+ Bash("gh issue edit 123 -R OWNER/REPO --add-label 'workflow:investigating'")
164
+ Bash("gh issue edit 123 -R OWNER/REPO --remove-label 'workflow:investigating'")
165
+ ```
166
+
167
+ ### Reading existing annotations
168
+
169
+ ```bash
170
+ Bash("gh api repos/OWNER/REPO/issues/123/comments \
171
+ --jq '.[] | select(.body | contains(\"FORGE:INVESTIGATOR\")) | .body'")
172
+ ```
173
+
174
+ ### Writing a FORGE annotation comment
175
+
176
+ For multi-line comment bodies, write the content to a temp file first:
177
+
178
+ ```bash
179
+ # Write comment body to temp file (avoids shell quoting issues)
180
+ Write("/tmp/forge_comment.md", """<!-- FORGE:INVESTIGATOR -->
181
+ ## Investigation Report
182
+
183
+ **Verdict**: CONFIRMED
184
+ ...
185
+ <!-- INVESTIGATION:COMPLETE -->""")
186
+
187
+ Bash("gh issue comment 123 -R OWNER/REPO --body \"$(cat /tmp/forge_comment.md)\"")
188
+ ```
189
+
190
+ ### Creating a PR
191
+
192
+ ```bash
193
+ Write("/tmp/pr_body.md", """## Summary
194
+ ...
195
+
196
+ Closes #967""")
197
+
198
+ Bash("gh pr create -R OWNER/REPO \
199
+ --base milestone/developer-experience-distribution \
200
+ --head feat/opencode-adapter-967 \
201
+ --title 'feat: OpenCode adapter (#967)' \
202
+ --body \"$(cat /tmp/pr_body.md)\"")
203
+ ```
204
+
205
+ ## Worktrees
206
+
207
+ ForgeDock uses git worktrees to isolate branch work. Create one with:
208
+
209
+ ```bash
210
+ Bash("git fetch origin")
211
+ Bash("git worktree add .claude/worktrees/feat-my-feature-123 \
212
+ -b feat/my-feature-123 origin/staging")
213
+ ```
214
+
215
+ Work inside the worktree for all file edits and commits:
216
+
217
+ ```bash
218
+ Read("/path/to/repo/.claude/worktrees/feat-my-feature-123/file.py")
219
+ Edit("/path/to/repo/.claude/worktrees/feat-my-feature-123/file.py", ...)
220
+ Bash("git -C /path/to/repo/.claude/worktrees/feat-my-feature-123 status")
221
+ ```
222
+
223
+ ## FORGE Annotation Protocol
224
+
225
+ Every pipeline stage writes a structured annotation to GitHub. Key rules:
226
+
227
+ 1. **Idempotency**: Check for existing annotations BEFORE starting a phase.
228
+ Do not re-run a completed phase.
229
+ 2. **Compaction resilience**: Write annotations AFTER completing each
230
+ significant step. GitHub is the persistent state layer.
231
+ 3. **Restart partial annotations**: If an annotation exists without its
232
+ `:COMPLETE` sentinel, delete it and restart the phase.
233
+ 4. **Respect label state**: Labels track workflow state. Read and set them
234
+ at each phase boundary.
235
+
236
+ ### Label state machine
237
+
238
+ ```
239
+ workflow:investigating
240
+ → workflow:ready-to-build (investigation complete)
241
+ → workflow:building (build started)
242
+ → workflow:in-review (PR created)
243
+ → workflow:merged (PR merged) [TERMINAL]
244
+
245
+ workflow:invalid [TERMINAL]
246
+ workflow:decomposed [TERMINAL]
247
+ needs-human [TERMINAL]
248
+ ```
249
+
250
+ Stop the pipeline when any terminal label is set.
251
+
252
+ ## Limitations
253
+
254
+ | Capability | Claude Code | OpenCode (this adapter) |
255
+ |------------|-------------|------------------------|
256
+ | Skill loading | Dynamic (`~/.claude/commands/`) | Read `commands/*.md` directly |
257
+ | Native slash commands | `/work-on 967` | `/work-on 967` (via `command` config) |
258
+ | Tool name parity | Native | Direct (same names) |
259
+ | Sub-agent invocation | `Skill("review-pr")` | Read `commands/review-pr.md` directly |
260
+ | Session continuity | Native compaction resilience | Re-read GitHub state each session |
261
+ | Multi-phase pipeline | Automatic (single continuous session) | Supported (GitHub state is persistent) |
262
+
263
+ **Sub-skill invocation**: When a command spec calls `Skill("x")`, OpenCode
264
+ has no native skill loader. Read the referenced command spec file directly
265
+ instead.
266
+
267
+ **Parallel tasks**: When a command spec calls `Agent(...)` or `Task(...)` for
268
+ parallelism (e.g., multi-agent review in `review-pr-agents.md`), execute the
269
+ sub-tasks sequentially. OpenCode runs one agent context at a time.
270
+
271
+ ## Configuration
272
+
273
+ `install-opencode.sh` patches `~/.config/opencode/opencode.json`. Example
274
+ of what is added:
275
+
276
+ ```json
277
+ {
278
+ "instructions": [
279
+ "~/.opencode-forge.md"
280
+ ],
281
+ "command": {
282
+ "work-on": {
283
+ "description": "Run the ForgeDock full issue pipeline (investigate → build → review → merge)",
284
+ "template": "Read /path/to/forgedock/commands/work-on.md and execute the pipeline for issue {{args}}."
285
+ },
286
+ "review-pr": {
287
+ "description": "Run the ForgeDock PR review pipeline",
288
+ "template": "Read /path/to/forgedock/commands/review-pr.md and execute the PR review for PR {{args}}."
289
+ },
290
+ "quality-gate": {
291
+ "description": "Run ForgeDock pre-commit quality checks",
292
+ "template": "Read /path/to/forgedock/commands/quality-gate.md and run all quality gate checks."
293
+ },
294
+ "orchestrate": {
295
+ "description": "Run ForgeDock parallel multi-issue orchestration",
296
+ "template": "Read /path/to/forgedock/commands/orchestrate.md and orchestrate the issues: {{args}}."
297
+ }
298
+ }
299
+ }
300
+ ```
301
+
302
+ Existing config keys (provider, model, etc.) are preserved. ForgeDock only
303
+ adds to the `instructions` array and `command` object — never overwrites.
304
+
305
+ ## Reference
306
+
307
+ - [FORGE Protocol spec](FORGE-PROTOCOL.md) — annotation format, label state machine
308
+ - [Aider adapter](AIDER.md) — parallel adapter reference (Aider uses `/run` translation)
309
+ - [Codex adapter](CODEX.md) — parallel adapter reference (Codex skill model)
310
+ - [Pipeline commands](../commands/) — shared workflow specs (authoritative for all runtimes)
311
+ - [`install-opencode.sh`](../install-opencode.sh) — installer script
312
+ - [`scripts/forge-run.sh`](../scripts/forge-run.sh) — universal shell phase router
package/docs/demo.gif CHANGED
Binary file
@@ -8,8 +8,8 @@ Per-release pipeline evaluation results for ForgeDock. Every scorecard here was
8
8
 
9
9
  | Field | Value |
10
10
  |-------|-------|
11
- | Scorecard | [claude-sonnet-5-2026-07-04.json](published/claude-sonnet-5-2026-07-04.json) |
12
- | Model | claude-sonnet-5 |
11
+ | Scorecard | [claude-sonnet-4-6-2026-07-04.json](published/claude-sonnet-4-6-2026-07-04.json) |
12
+ | Model | claude-sonnet-4-6 |
13
13
  | Corpus | seed-v1 |
14
14
  | Run date | 2026-07-04 |
15
15
  | One-shot success rate | — (pending harness) |
@@ -17,7 +17,7 @@ Per-release pipeline evaluation results for ForgeDock. Every scorecard here was
17
17
 
18
18
  > **Note**: The baseline above is a format placeholder. The harness (#1285) and CI gate (#1286) must be operational before real scorecard values can be populated. When the first real run completes, update this table and remove this note.
19
19
  >
20
- > **Model upgrade**: Default model was updated from `claude-sonnet-4-5` to `claude-sonnet-5` in PR #1441 (issue #1248, committed 2026-07-04). The `--model` flag and `FORGEDOCK_MODEL` env var override the default at runtime.
20
+ > **Model upgrade**: Default model was updated from `claude-sonnet-4-5` to `claude-sonnet-5` in PR #1441 (issue #1248, committed 2026-07-04). The `--model` flag and `FORGEDOCK_MODEL` env var override the default at runtime. No `claude-sonnet-5` scorecard has been published yet — see the Published results table below.
21
21
 
22
22
  ---
23
23
 
@@ -25,7 +25,7 @@ Per-release pipeline evaluation results for ForgeDock. Every scorecard here was
25
25
 
26
26
  | Run ID | Model | Corpus | Date | One-shot success | Human interventions/issue | Scorecard |
27
27
  |--------|-------|--------|------|-----------------|--------------------------|-----------|
28
- | claude-sonnet-5-2026-07-04 | claude-sonnet-5 | seed-v1 | 2026-07-04 | pending | pending | [scorecard](published/claude-sonnet-5-2026-07-04.json) |
28
+ | claude-sonnet-5-2026-07-04 | claude-sonnet-5 | seed-v1 | 2026-07-04 | pending | pending | not yet published |
29
29
  | claude-sonnet-4-6-2026-07-04 | claude-sonnet-4-6 | seed-v1 | 2026-07-04 | pending | pending | [scorecard](published/claude-sonnet-4-6-2026-07-04.json) |
30
30
 
31
31
  ---
@@ -25,9 +25,9 @@ The fix isn't a bigger context window. It's structured memory that survives conv
25
25
 
26
26
  ForgeDock treats GitHub as that memory layer. Every pipeline stage writes machine-readable HTML annotations to issues and PRs — FORGE:INVESTIGATOR traces root cause to a specific commit, FORGE:ARCHITECT produces a typed implementation plan, FORGE:CONTEXT surfaces known pitfalls from closed issues in the same module. The next agent reads these before doing anything. The gh CLI is the query interface; no external store, no embeddings.
27
27
 
28
- The pipeline: /work-on #42 → investigate (reads git blame, closed issues, review findings) → architect (traces all call sites, orders changes by dependency) → build → quality gate (14+ check domains) → 9-agent review → PR. Each stage writes what it found so the next stage doesn't repeat the work. After 20,000+ issues processed across real production codebases, patterns accumulate: the context phase now flags known pitfalls in a module before the builder touches it.
28
+ The pipeline: /work-on #42 → investigate (reads git blame, closed issues, review findings) → architect (traces all call sites, orders changes by dependency) → build → quality gate (14+ check domains) → 9-agent review → PR. Each stage writes what it found so the next stage doesn't repeat the work. ForgeDock builds itself with this pipeline — in its first 30 days, 693 issues filed and 603 PRs merged across the repo — and patterns accumulate: the context phase now flags known pitfalls in a module before the builder touches it.
29
29
 
30
- It's 25 markdown command specs installed via npx forgedock, no runtime server. Would love to hear what the HN community thinks about using GitHub's existing graph structure — commits, blame, cross-references — as agent memory.
30
+ It's a set of markdown command specs installed via npx forgedock, no runtime server. Would love to hear what the HN community thinks about using GitHub's existing graph structure — commits, blame, cross-references — as agent memory.
31
31
  ```
32
32
 
33
33
  **Character count**: ~1,380 characters (well within 4,000 limit)
@@ -71,7 +71,7 @@ It's 25 markdown command specs installed via npx forgedock, no runtime server. W
71
71
 
72
72
  ### "Why HTML comments for annotations?"
73
73
 
74
- > GitHub renders HTML comments invisibly to humans — the issue stays readable without noise. Agents grep for `<!-- FORGE:INVESTIGATOR -->` to find structured context fast. It's a zero-dependency protocol: no API, no schema registry, no additional auth. Any tool with `gh` CLI access can read and write annotations. The downside is parsing cost (tokens to extract fields from markdown); the [Vision section of the README](https://github.com/RapierCraftStudios/ForgeDock#vision) describes replacing this with a purpose-built graph store once the protocol is proven.
74
+ > GitHub renders HTML comments invisibly to humans — the issue stays readable without noise. Agents grep for `<!-- FORGE:INVESTIGATOR -->` to find structured context fast. It's a zero-dependency protocol: no API, no schema registry, no additional auth. Any tool with `gh` CLI access can read and write annotations. The downside is parsing cost (tokens to extract fields from markdown); the [Where it's going section of the README](https://github.com/RapierCraftStudios/ForgeDock#where-its-going) describes replacing this with a purpose-built graph store once the protocol is proven.
75
75
 
76
76
  ---
77
77
 
@@ -0,0 +1,180 @@
1
+ ---
2
+ title: "ForgeDock Architecture"
3
+ description: "How ForgeDock's autonomous pipeline works. Phase-by-phase breakdown, FORGE annotation relay, worktree isolation, and how agents reconstruct context after compaction."
4
+ ---
5
+
6
+ # ForgeDock Architecture
7
+
8
+ ForgeDock is **not an application** — it's a set of markdown command specs that get symlinked into `~/.claude/commands/` and invoked as slash commands in Claude Code. There is no runtime process. Every pipeline operation runs inside Claude Code, using GitHub as the persistence layer.
9
+
10
+ ---
11
+
12
+ ## Repository Structure
13
+
14
+ ```
15
+ commands/ # Authoritative workflow specs
16
+ work-on.md # Main orchestrator: investigate → build → review → merge
17
+ work-on/ # Sub-phases: investigate, build, review, close
18
+ build/ # Sub-sub-phases: context, architect, implement, validate
19
+ review-pr.md # PR review orchestrator
20
+ review-pr-agents.md # 9-agent review catalog
21
+ orchestrate.md # Parallel multi-issue execution
22
+ quality-gate.md # Pre-commit checks (14+ domains)
23
+ autopilot.md # Self-improvement cycle
24
+ ... # 25+ more commands
25
+
26
+ bin/ # npm installer
27
+ forgedock.mjs # npx forgedock — symlinks commands into ~/.claude/commands/
28
+
29
+ docs/ # Reference docs and this site
30
+ scripts/ # Verification scripts used by quality-gate
31
+ .agents/ # Codex adapter layer (repo-local skill overrides)
32
+ ```
33
+
34
+ ---
35
+
36
+ ## The Pipeline Relay
37
+
38
+ The core innovation is **structured context passing via GitHub annotations**. Every pipeline phase writes a `FORGE:` annotation as a GitHub issue comment. Every downstream phase reads prior annotations before acting.
39
+
40
+ ```
41
+ Issue opened
42
+ │
43
+ ▼
44
+ FORGE:INVESTIGATOR — root cause, affected files, recommendation
45
+ │
46
+ ▼
47
+ FORGE:CONTRACT — what will be built, deliverables table, acceptance criteria
48
+ │
49
+ ▼
50
+ FORGE:CONTEXT — past review findings, historical bugs, related code paths
51
+ │
52
+ ▼
53
+ FORGE:ARCHITECT — implementation plan, ordered file changes, risk assessment
54
+ │
55
+ ▼
56
+ FORGE:BUILDER — branch, commits, files changed, acceptance criteria status
57
+ │
58
+ ▼
59
+ FORGE:REVIEW — domain agent findings, severity ratings
60
+ │
61
+ ▼
62
+ FORGE:TRAJECTORY — audit trail, pipeline phase results, anomalies
63
+ ```
64
+
65
+ This relay means:
66
+ - A new session can pick up exactly where a previous one left off by reading GitHub state
67
+ - Context compaction does not lose work — the next agent re-reads annotations and continues
68
+ - The audit trail is human-readable and queryable with the `gh` CLI
69
+
70
+ ---
71
+
72
+ ## Pipeline Phases
73
+
74
+ ### Phase 0: Context Load
75
+
76
+ Reads issue number, labels, milestone, existing annotations. Determines which phase to resume from. Classifies lane (fast vs. feature) based on milestone presence.
77
+
78
+ **Fast lane**: Issues without a milestone → PR targets `staging`.
79
+ **Feature lane**: Issues with a milestone → PR targets `milestone/{slug}`.
80
+
81
+ ### Phase 1: Investigation
82
+
83
+ Validates whether the issue is real. Reads domain files, traces execution paths, git blame. Posts `FORGE:INVESTIGATOR` with verdict (CONFIRMED / PARTIAL / INVALID), root cause, affected files, and decomposition assessment.
84
+
85
+ ### Phase 2: Decomposition (conditional)
86
+
87
+ If 2+ services, 6+ files across directories, or multiple task types: creates sub-issues with dependency order. Parent issue gets `workflow:decomposed`. Each sub-issue runs its own `/work-on`.
88
+
89
+ ### Phase 3: Build
90
+
91
+ Sub-phases in order:
92
+
93
+ | Sub-phase | What Happens |
94
+ |-----------|-------------|
95
+ | 3C: Contract | Builder posts deliverables table, acceptance criteria, quality considerations |
96
+ | 3C.5: Context | Surfaces institutional memory — past review findings, historical bugs, related code paths |
97
+ | 3C.6: Architect | Traces ALL affected code paths, sequences implementation order, assesses risk |
98
+ | 3F: Implement | Writes code in isolated git worktree per the architect plan |
99
+ | 3G: Quality Gate | 14-category pre-commit check (runs up to 3 iterations) |
100
+ | 3H: Format | Language-specific formatting and type checking |
101
+ | 3K: Commit | Conventional commit with issue reference |
102
+ | 3M: Builder comment | Posts `FORGE:BUILDER` with branch, commits, acceptance criteria status |
103
+
104
+ ### Phase 4: PR Creation
105
+
106
+ Pushes branch, creates PR targeting the correct base branch. Updates issue to `workflow:in-review`.
107
+
108
+ ### Phase 5: Auto-Review
109
+
110
+ Invokes `/review-pr --auto-merge`. 9 domain agents (security, billing, database, concurrency, auth, frontend, API, performance, infrastructure) review the PR. Critical/HIGH findings become separate GitHub issues. PR merges if no blocking findings.
111
+
112
+ ### Phase 6: Close & Cleanup
113
+
114
+ Closes the issue, sets `workflow:merged`, removes worktree and local branch. If issue is a sub-issue, checks off the item in the parent tracker.
115
+
116
+ ### Phase 7: Trajectory Log
117
+
118
+ Posts `FORGE:TRAJECTORY` with phase-by-phase results table for pipeline health monitoring.
119
+
120
+ ---
121
+
122
+ ## Git Worktree Isolation
123
+
124
+ Every build phase creates an isolated git worktree:
125
+
126
+ ```bash
127
+ git worktree add .claude/worktrees/feat-my-feature-42 \
128
+ -b feat/my-feature-42 origin/staging
129
+ ```
130
+
131
+ Benefits:
132
+ - Build operations never dirty the main working tree
133
+ - Multiple issues can be built in parallel without branch conflicts
134
+ - Worktree is removed in Phase 6 after merge
135
+
136
+ ---
137
+
138
+ ## Quality Gate
139
+
140
+ The quality gate checks code before commit across 14+ domains:
141
+
142
+ - **Logic**: null checks, off-by-one errors, unreachable code
143
+ - **Auth**: auth guards on all state-changing routes
144
+ - **Database**: N+1 queries, missing indexes, raw SQL injection surface
145
+ - **Security**: hardcoded credentials, injection vectors, CSRF exposure
146
+ - **Frontend**: proxy wiring, missing error boundaries, a11y regressions
147
+ - **Infrastructure**: Docker ownership, port binding, env var sync
148
+ - **API contracts**: response shape changes, SDK literal sync
149
+ - **Tests**: coverage gaps, missing edge cases
150
+
151
+ Each finding is rated HIGH / MEDIUM / LOW. HIGH findings are blocking. The gate runs up to 3 iterations.
152
+
153
+ ---
154
+
155
+ ## Compaction Resilience
156
+
157
+ Claude Code compacts context mid-session. ForgeDock is designed to survive this:
158
+
159
+ 1. **Write to GitHub after every significant step** — annotations are the durable state
160
+ 2. **Re-read GitHub at the start of each phase** — never assume in-memory context
161
+ 3. **Universal dispatcher** — any session can re-read issue labels and comments and determine exactly which phase to resume
162
+
163
+ A new `/work-on 42` invocation after compaction reads the existing `FORGE:INVESTIGATOR`, `FORGE:CONTRACT`, `FORGE:ARCHITECT`, and `FORGE:BUILDER` comments and jumps straight to Phase 4 (PR creation) or Phase 5 (review) without re-running earlier phases.
164
+
165
+ ---
166
+
167
+ ## Command Specs Are Prompts
168
+
169
+ The `.md` files in `commands/` are detailed prompt engineering documents — some exceed 50KB. They constrain LLM behavior at every step:
170
+
171
+ - **Phase boundaries** are explicit with entry conditions and exit actions
172
+ - **Universal continuation rule** prevents premature stopping after intermediate results
173
+ - **Structured output requirements** (e.g., `<!-- INVESTIGATION:COMPLETE -->` marker) are machine-readable gates that downstream phases check before proceeding
174
+ - **Domain-specific rules** (INFRA footguns, type invariant verification, sibling pattern sweeps) encode institutional memory directly into the prompt
175
+
176
+ ---
177
+
178
+ ## Contributing
179
+
180
+ The pipeline dogfoods itself. Bug reports, improvements, and new command specs all flow through `/work-on`. See [CONTRIBUTING.md](https://github.com/RapierCraftStudios/ForgeDock/blob/main/CONTRIBUTING.md) and [devdocs/project/architecture.md](https://github.com/RapierCraftStudios/ForgeDock/blob/main/devdocs/project/architecture.md) for the full strategic context.
@@ -453,6 +453,23 @@ Measures pipeline performance, correlates with prompt changes, and proposes impr
453
453
 
454
454
  ---
455
455
 
456
+ ### `/upgrade-deps`
457
+
458
+ **Autonomous dependency upgrade pipeline.**
459
+
460
+ Detects outdated packages, triages them by semver risk, creates GitHub issues for eligible upgrades, and runs each through `/work-on` — so every upgrade gets investigation, compatibility verification, quality gate, review, and merge rather than a blind version bump. Major upgrades are flagged for human review unless `--allow-major` is passed.
461
+
462
+ ```bash
463
+ /upgrade-deps # Detect + triage + report only
464
+ /upgrade-deps --dry-run # All phases, but create nothing
465
+ /upgrade-deps --ecosystem npm # Limit to one ecosystem (npm|pip|cargo)
466
+ /upgrade-deps --allow-major # Include major upgrades in issue creation
467
+ /upgrade-deps --limit 5 # Cap issue creation (default: 10)
468
+ /upgrade-deps --batch # Group patch upgrades into one issue
469
+ ```
470
+
471
+ ---
472
+
456
473
  ## Investigation & Validation
457
474
 
458
475
  ---