@izkac/forgekit 0.3.12 → 0.3.13

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 (116) hide show
  1. package/bin/forge.mjs +107 -107
  2. package/bin/forgekit.mjs +83 -83
  3. package/bin/review.mjs +81 -81
  4. package/package.json +1 -1
  5. package/scripts/prepack.mjs +78 -78
  6. package/scripts/run-tests.mjs +50 -50
  7. package/src/adr.mjs +236 -236
  8. package/src/adr.test.mjs +170 -170
  9. package/src/change.mjs +327 -234
  10. package/src/change.test.mjs +145 -83
  11. package/src/cleanup-sessions.mjs +84 -84
  12. package/src/config.mjs +103 -103
  13. package/src/defer.mjs +75 -75
  14. package/src/doctor.mjs +350 -341
  15. package/src/doctor.test.mjs +114 -114
  16. package/src/init.mjs +680 -621
  17. package/src/install.mjs +815 -815
  18. package/src/install.test.mjs +180 -180
  19. package/src/integrity-check.mjs +60 -60
  20. package/src/integrity.mjs +682 -682
  21. package/src/integrity.test.mjs +566 -566
  22. package/src/lib.mjs +143 -143
  23. package/src/models.defaults.json +41 -41
  24. package/src/new-session.mjs +99 -99
  25. package/src/openspec-overlays/README.md +19 -19
  26. package/src/openspec-overlays/openspec-apply-change-footer.md +14 -14
  27. package/src/openspec-overlays/opsx-apply-completion-step.md +1 -1
  28. package/src/openspec-overlays/opsx-apply-implement-step.md +11 -11
  29. package/src/paths.mjs +92 -92
  30. package/src/plan-engine.mjs +321 -278
  31. package/src/plan-engine.test.mjs +447 -283
  32. package/src/preferences.defaults.json +78 -78
  33. package/src/preferences.mjs +438 -438
  34. package/src/preferences.test.mjs +174 -174
  35. package/src/record-evidence.mjs +204 -204
  36. package/src/resolve-model.mjs +312 -312
  37. package/src/resolve-model.test.mjs +194 -194
  38. package/src/review/cli.test.mjs +117 -117
  39. package/src/review/export.mjs +172 -172
  40. package/src/review/export.test.mjs +197 -197
  41. package/src/review/fixtures/valid-review.json +42 -42
  42. package/src/review/lib.mjs +894 -894
  43. package/src/review/lib.test.mjs +266 -266
  44. package/src/review/schema.json +196 -196
  45. package/src/review/signals.test.mjs +62 -62
  46. package/src/score-cli.mjs +68 -68
  47. package/src/score.mjs +568 -568
  48. package/src/score.test.mjs +366 -366
  49. package/src/session-reminder.mjs +207 -207
  50. package/src/session-status.mjs +70 -70
  51. package/src/set-models.mjs +186 -186
  52. package/src/set-phase.mjs +205 -205
  53. package/src/set-prefs.mjs +294 -294
  54. package/src/specs-sync.mjs +234 -0
  55. package/src/specs-sync.test.mjs +114 -0
  56. package/src/spine.mjs +93 -93
  57. package/src/triage-prompt.mjs +175 -175
  58. package/src/triage-prompt.test.mjs +50 -50
  59. package/src/vendor-openspec-overlays.mjs +176 -176
  60. package/src/vendor-openspec-overlays.test.mjs +62 -62
  61. package/vendor/skills/archive-to-adr/SKILL.md +149 -149
  62. package/vendor/skills/forge/SKILL.md +136 -136
  63. package/vendor/skills/forge/docs/forge.md +650 -647
  64. package/vendor/skills/forge/phases/brainstorm.md +23 -23
  65. package/vendor/skills/forge/phases/finish.md +90 -87
  66. package/vendor/skills/forge/phases/implement.md +77 -77
  67. package/vendor/skills/forge/phases/plan-openspec.md +60 -60
  68. package/vendor/skills/forge/phases/plan-specs.md +163 -117
  69. package/vendor/skills/forge/phases/review.md +25 -25
  70. package/vendor/skills/forge/phases/verify.md +124 -124
  71. package/vendor/skills/forge/references/forge-layout.md +85 -85
  72. package/vendor/skills/forge/references/pace.md +115 -115
  73. package/vendor/skills/forge/references/plan-routing.md +52 -51
  74. package/vendor/skills/forge/references/runtime-integrity.md +232 -232
  75. package/vendor/skills/forge/references/substantial-work.md +37 -37
  76. package/vendor/skills/forge/references/test-evidence.md +30 -30
  77. package/vendor/skills/forge/references/test-strategy.md +68 -68
  78. package/vendor/skills/forge/skills/subagent-driven-development/SKILL.md +87 -87
  79. package/vendor/skills/forge/subagents/final-reviewer-prompt.md +56 -56
  80. package/vendor/skills/forge/subagents/implementer-prompt.md +38 -38
  81. package/vendor/skills/git-resolve-adr-conflict/SKILL.md +132 -132
  82. package/vendor/skills/thorough-code-review/SKILL.md +290 -290
  83. package/vendor/skills/thorough-code-review/examples.md +133 -133
  84. package/vendor/skills/thorough-code-review/reference/accepted-risks.md +26 -26
  85. package/vendor/skills/thorough-code-review/reference/lenses.md +96 -96
  86. package/vendor/skills/thorough-code-review/reference/phase1-scout.md +62 -62
  87. package/vendor/skills/thorough-code-review/reference/phase2-skeptic.md +105 -105
  88. package/vendor/skills/thorough-code-review/reference/report-schema.json +222 -222
  89. package/vendor/skills/thorough-code-review/reference/report-template.md +115 -115
  90. package/vendor/skills/thorough-code-review/reference/severity-rubric.md +49 -49
  91. package/vendor/skills/thorough-code-review/reference/signals-preflight.md +55 -55
  92. package/vendor/templates/adr/README.md +7 -7
  93. package/vendor/templates/adr/decisions.md +141 -141
  94. package/vendor/templates/adr/hooks/check-pending-adrs.mjs +74 -74
  95. package/vendor/templates/adr/hooks/check-pending-adrs.sh +3 -3
  96. package/vendor/templates/adr/hooks/openspec-archive-agent-message.mjs +52 -52
  97. package/vendor/templates/adr/hooks/openspec-archive-agent-message.sh +3 -3
  98. package/vendor/templates/project/claude/commands/forge-apply.md +75 -75
  99. package/vendor/templates/project/claude/commands/forge-brainstorm.md +7 -7
  100. package/vendor/templates/project/claude/commands/forge-build.md +17 -17
  101. package/vendor/templates/project/claude/commands/forge-plan.md +12 -12
  102. package/vendor/templates/project/claude/commands/forge-skip.md +14 -14
  103. package/vendor/templates/project/claude/commands/forge-status.md +16 -16
  104. package/vendor/templates/project/claude/commands/forge.md +16 -16
  105. package/vendor/templates/project/claude/hooks/forge-prompt-hook.mjs +73 -73
  106. package/vendor/templates/project/claude/hooks/forge-session-start.mjs +19 -19
  107. package/vendor/templates/project/claude/hooks/forge-triage-hook.mjs +77 -77
  108. package/vendor/templates/project/cursor/commands/forge-apply.md +75 -75
  109. package/vendor/templates/project/cursor/commands/forge-brainstorm.md +10 -10
  110. package/vendor/templates/project/cursor/commands/forge-build.md +17 -17
  111. package/vendor/templates/project/cursor/commands/forge-plan.md +15 -15
  112. package/vendor/templates/project/cursor/commands/forge-skip.md +14 -14
  113. package/vendor/templates/project/cursor/commands/forge-status.md +16 -16
  114. package/vendor/templates/project/cursor/commands/forge.md +16 -16
  115. package/vendor/templates/project/cursor/hooks/forge-session-start.mjs +30 -30
  116. package/vendor/templates/project/cursor/hooks/forge-session-start.sh +3 -3
@@ -1,23 +1,23 @@
1
- # Brainstorm phase
2
-
3
- Read and follow [../skills/brainstorming/SKILL.md](../skills/brainstorming/SKILL.md) in full.
4
-
5
- **Pace:** Honor `brainstorm.depth` from [../references/pace.md](../references/pace.md) / `forge status` — `full` (default skill), `short` (≤2–3 approaches), or `minimal` (confirm intent + one approach when design is obvious).
6
-
7
- ## Terminal state
8
-
9
- After user approves the design:
10
-
11
- 1. Save to `.forge/sessions/<id>/brainstorm/notes.md` and `decisions.md`
12
- 2. Read [../references/plan-routing.md](../references/plan-routing.md) and **proceed to OpenSpec propose** — do not ask for a plan mode
13
- 3. Follow [plan-openspec.md](./plan-openspec.md) — **not** implementation until OpenSpec artefacts are approved
14
-
15
- ```bash
16
- forge phase brainstorm
17
- # after OpenSpec propose:
18
- forge phase plan --plan-type openspec --openspec <name>
19
- ```
20
-
21
- <HARD-GATE>
22
- Do NOT invoke implement phase or write production code until OpenSpec plan phase completes and user approves.
23
- </HARD-GATE>
1
+ # Brainstorm phase
2
+
3
+ Read and follow [../skills/brainstorming/SKILL.md](../skills/brainstorming/SKILL.md) in full.
4
+
5
+ **Pace:** Honor `brainstorm.depth` from [../references/pace.md](../references/pace.md) / `forge status` — `full` (default skill), `short` (≤2–3 approaches), or `minimal` (confirm intent + one approach when design is obvious).
6
+
7
+ ## Terminal state
8
+
9
+ After user approves the design:
10
+
11
+ 1. Save to `.forge/sessions/<id>/brainstorm/notes.md` and `decisions.md`
12
+ 2. Read [../references/plan-routing.md](../references/plan-routing.md) and **proceed to OpenSpec propose** — do not ask for a plan mode
13
+ 3. Follow [plan-openspec.md](./plan-openspec.md) — **not** implementation until OpenSpec artefacts are approved
14
+
15
+ ```bash
16
+ forge phase brainstorm
17
+ # after OpenSpec propose:
18
+ forge phase plan --plan-type openspec --openspec <name>
19
+ ```
20
+
21
+ <HARD-GATE>
22
+ Do NOT invoke implement phase or write production code until OpenSpec plan phase completes and user approves.
23
+ </HARD-GATE>
@@ -1,87 +1,90 @@
1
- # Finish phase
2
-
3
- Before marking done, integrity must pass (or the user must approve an incomplete finish):
4
-
5
- ```bash
6
- forge integrity-check # spine + deferrals + executed e2e (green, current) / BLOCKED
7
- forge score # preview L2 scorecard (optional)
8
- forge phase done # runs integrity checks + writes scorecard.md/json
9
- # escape hatch only with an honest reason:
10
- # forge phase done --allow-incomplete "E2E blocked: no Compose in this environment"
11
- ```
12
-
13
- `forge phase done|finish` always writes `.forge/sessions/<id>/scorecard.md` (and
14
- `.json`) — an L2 grade of session artifacts. Answer the **human ship-check**
15
- questions in that file for platform/async work (L3). See [usage.md](../../../docs/usage.md)
16
- § Session success.
17
-
18
- ## OpenSpec path (`planType: openspec`)
19
-
20
- 1. Confirm all tasks complete in `tasks.md`.
21
- 2. User runs or approves `/opsx:archive` / `openspec archive`.
22
- 3. **ADR follow-up (optional):** if `.forge/config.json` has `adr.enabled: true`
23
- (or the project uses ADRs), follow the **`archive-to-adr`** skill using
24
- `adr.dir` / `adr.decisionsDoc`. If ADRs are disabled, skip.
25
- 4. End with **Suggested commit** block (display only — do not commit).
26
-
27
- ```bash
28
- forge phase done
29
- forge cleanup
30
- ```
31
-
32
- ## Specs path (`planType: specs`)
33
-
34
- 1. Confirm all tasks complete in `<specsDir>/changes/<name>/tasks.md`.
35
- 2. **Archive** (with user approval) — prefer the CLI:
36
-
37
- ```bash
38
- forge change archive <name>
39
- # <specsDir>/changes/archive/YYYY-MM-DD-<name>
40
- ```
41
-
42
- Or move manually:
43
-
44
- ```bash
45
- git mv <specsDir>/changes/<name> <specsDir>/changes/archive/<YYYY-MM-DD>-<name>
46
- ```
47
-
48
- (plain `mv` if the dir is untracked).
49
- 3. **ADR follow-up (optional):** same rule as OpenSpec — if `adr.enabled`,
50
- follow **`archive-to-adr`** on the archived change; otherwise skip.
51
- 4. End with **Suggested commit** block (display only — do not commit).
52
-
53
- ```bash
54
- forge phase done
55
- forge cleanup
56
- ```
57
-
58
- ## Throwaway path (`planType: throwaway`)
59
-
60
- 1. Confirm all tasks in `plan.md` checked off.
61
- 2. Summarize what shipped.
62
- 3. Mark session done and cleanup:
63
-
64
- ```bash
65
- forge phase done
66
- forge cleanup
67
- ```
68
-
69
- ## Direct path (`planType: direct`)
70
-
71
- 1. Confirm implementation matches brainstorm `notes.md` / `decisions.md`.
72
- 2. Summarize what shipped.
73
- 3. Mark session done and cleanup:
74
-
75
- ```bash
76
- forge phase done
77
- forge cleanup
78
- ```
79
-
80
- ## Skipped path (`/forge:skip`)
81
-
82
- Session already at `phase: skipped`. No finish steps.
83
-
84
- ## Hand-off
85
-
86
- Leave implementation files staged/unstaged per user preference. Never commit unless
87
- explicitly asked (project git policy).
1
+ # Finish phase
2
+
3
+ Before marking done, integrity must pass (or the user must approve an incomplete finish):
4
+
5
+ ```bash
6
+ forge integrity-check # spine + deferrals + executed e2e (green, current) / BLOCKED
7
+ forge score # preview L2 scorecard (optional)
8
+ forge phase done # runs integrity checks + writes scorecard.md/json
9
+ # escape hatch only with an honest reason:
10
+ # forge phase done --allow-incomplete "E2E blocked: no Compose in this environment"
11
+ ```
12
+
13
+ `forge phase done|finish` always writes `.forge/sessions/<id>/scorecard.md` (and
14
+ `.json`) — an L2 grade of session artifacts. Answer the **human ship-check**
15
+ questions in that file for platform/async work (L3). See [usage.md](../../../docs/usage.md)
16
+ § Session success.
17
+
18
+ ## OpenSpec path (`planType: openspec`)
19
+
20
+ 1. Confirm all tasks complete in `tasks.md`.
21
+ 2. User runs or approves `/opsx:archive` / `openspec archive`.
22
+ 3. **ADR follow-up (optional):** if `.forge/config.json` has `adr.enabled: true`
23
+ (or the project uses ADRs), follow the **`archive-to-adr`** skill using
24
+ `adr.dir` / `adr.decisionsDoc`. If ADRs are disabled, skip.
25
+ 4. End with **Suggested commit** block (display only — do not commit).
26
+
27
+ ```bash
28
+ forge phase done
29
+ forge cleanup
30
+ ```
31
+
32
+ ## Specs path (`planType: specs`)
33
+
34
+ 1. Confirm all tasks complete in `<plan.dir>/changes/<name>/tasks.md`.
35
+ 2. **Archive** (with user approval) — prefer the CLI (merges delta specs into
36
+ `<plan.dir>/specs/` first, matching OpenSpec archive behavior):
37
+
38
+ ```bash
39
+ forge change archive <name>
40
+ # → sync deltas → <plan.dir>/specs/<cap>/spec.md
41
+ # → <plan.dir>/changes/archive/YYYY-MM-DD-<name>
42
+ ```
43
+
44
+ Skip the merge with `--no-sync` only when deliberate. Or move manually
45
+ (you must sync deltas yourself):
46
+
47
+ ```bash
48
+ git mv <plan.dir>/changes/<name> <plan.dir>/changes/archive/<YYYY-MM-DD>-<name>
49
+ ```
50
+
51
+ (plain `mv` if the dir is untracked).
52
+ 3. **ADR follow-up (optional):** same rule as OpenSpec — if `adr.enabled`,
53
+ follow **`archive-to-adr`** on the archived change; otherwise skip.
54
+ 4. End with **Suggested commit** block (display only — do not commit).
55
+
56
+ ```bash
57
+ forge phase done
58
+ forge cleanup
59
+ ```
60
+
61
+ ## Throwaway path (`planType: throwaway`)
62
+
63
+ 1. Confirm all tasks in `plan.md` checked off.
64
+ 2. Summarize what shipped.
65
+ 3. Mark session done and cleanup:
66
+
67
+ ```bash
68
+ forge phase done
69
+ forge cleanup
70
+ ```
71
+
72
+ ## Direct path (`planType: direct`)
73
+
74
+ 1. Confirm implementation matches brainstorm `notes.md` / `decisions.md`.
75
+ 2. Summarize what shipped.
76
+ 3. Mark session done and cleanup:
77
+
78
+ ```bash
79
+ forge phase done
80
+ forge cleanup
81
+ ```
82
+
83
+ ## Skipped path (`/forge:skip`)
84
+
85
+ Session already at `phase: skipped`. No finish steps.
86
+
87
+ ## Hand-off
88
+
89
+ Leave implementation files staged/unstaged per user preference. Never commit unless
90
+ explicitly asked (project git policy).
@@ -1,77 +1,77 @@
1
- # Implement phase
2
-
3
- Read and follow [../skills/subagent-driven-development/SKILL.md](../skills/subagent-driven-development/SKILL.md).
4
-
5
- Every implementer subagent must follow [../references/tdd-core.md](../references/tdd-core.md) (condensed TDD rules — the brief includes the pointer; full skill only when stuck).
6
-
7
- On test failures or unexpected behavior, use [../skills/systematic-debugging/SKILL.md](../skills/systematic-debugging/SKILL.md) before proposing fixes.
8
-
9
- **Test strategy:** [../references/test-strategy.md](../references/test-strategy.md) — tier 1 (scoped TDD) + tier 2 (narrow task evidence) during implement; **tier 3 (full workspace) runs once at verify**, not per task.
10
-
11
- **Pace:** Read `resolvedPace` / effective knobs from `forge status` (or [../references/pace.md](../references/pace.md)). After each task, decide whether to dispatch a reviewer via `review.perTask` + hard floor:
12
-
13
- | `review.perTask` | When to dispatch reviewer |
14
- | ---------------- | ------------------------- |
15
- | `always` | After every task (`thorough`) |
16
- | `per-group` | When the task closes a `tasks.md` group (`##` section — OpenSpec or specs engine), or immediately if the task is high-risk (`standard`) |
17
- | `high-risk-only` / `never` | Only when hard-floor high-risk |
18
-
19
- When skipping the reviewer, still write `task-review.md` with `APPROVED (pace self-check)` and keep tier-2 evidence mandatory for behavior changes. For `per-group` reviews, cover all tasks in that section in one reviewer pass; save as `group-review.md` next to the group’s tasks (or under `.forge/sessions/<id>/tasks/group-<nn>-<slug>/group-review.md`). Prefer `--tier fast` when `models.bias` is `prefer-fast` and the task is mechanical. Cap fix→re-review loops at `review.maxRounds`.
20
-
21
- ## Plan source
22
-
23
- | planType | Task list |
24
- | -------- | --------- |
25
- | `openspec` | `openspec/changes/<name>/tasks.md` via **`/forge:apply`** (preferred), **`openspec-apply-change`** / `/opsx:apply` |
26
- | `specs` | `<specsDir>/changes/<name>/tasks.md` (default `specs/`) — read directly; no vendor CLI steps |
27
-
28
- Legacy sessions with planType `throwaway` or `direct`: resume from the session's own artefacts (`plan.md` / `brainstorm/notes.md`); new work always uses the configured engine (`openspec` or `specs`).
29
-
30
- For OpenSpec: follow `openspec-apply-change` for CLI steps, but **wrap each task** in the subagent loop (do not implement all tasks inline in coordinator context). For specs: read `proposal.md` / `design.md` / `tasks.md` from the change dir as context, then run the same subagent loop.
31
-
32
- ## Runtime integrity (hard)
33
-
34
- Honor [../references/runtime-integrity.md](../references/runtime-integrity.md) in every brief and review packet:
35
-
36
- - Briefs **must never** contain “stub OK”, “later task”, “minimal poll loop only”, or equivalent. Shrink scope only by stopping and asking the user.
37
- - Capability specs beat narrow task wording. Fill reviewer `{CAPABILITY_SPEC_EXCERPT}` from the change's capability specs — not only the task line.
38
- - Do not mark a section complete if libraries exist but nothing in the production path calls them.
39
- - **Deferrals:** if wiring genuinely lands in a later task, register it — `forge defer add --task <id> --reason "…"` — and resolve it when that task lands. Unregistered "later" is a REJECT; unresolved deferrals block `forge phase done`.
40
- - **Spine:** when a task wires a capability into production, update its `spine.json` row (runtimeOwner / writes / evidence). `forge spine check` must pass before verify ends.
41
- - **E2E:** the product-loop acceptance task (last implement task) delivers working `e2e.json` steps and a green `forge e2e run` — steps that would pass against a stubbed handler are invalid.
42
-
43
- ## Per-task loop
44
-
45
- 1. Extract full task text + file paths + relevant **capability** spec sections (not only the task checkbox line).
46
- 2. Write `.forge/sessions/<id>/tasks/<nn>-<slug>/brief.md` using [../subagents/implementer-prompt.md](../subagents/implementer-prompt.md).
47
- 3. Dispatch **implementer** subagent — brief includes [../references/tdd-core.md](../references/tdd-core.md). **Model:** resolve via `forge resolve-model --tier <fast|standard|capable>` (billing defaults to **`included`** — subscription/first-party pool; never invent API model slugs). Use `fast` for mechanical tasks (1–2 files, complete spec) and batched small tasks; `standard` for multi-file integration; escalate one capability tier (still `included`) when re-dispatching after `BLOCKED`. If `omitModel` is true, omit the Task `model` parameter.
48
- 4. **Reviewer** (unless pace skips it):
49
- - **`always` / high-risk hard floor:** dispatch [../subagents/task-reviewer-prompt.md](../subagents/task-reviewer-prompt.md) for this task → `task-review.md`.
50
- - **`per-group` at group boundary:** dispatch one reviewer covering **all tasks in the just-finished `tasks.md` group** → `group-review.md` (include each task id + paths). Mid-group low-risk tasks: self-check `task-review.md` only.
51
- - If `review.depth` is `spec-only`, focus on spec + tests evidence. Fill `{DIFF_RANGE}` and `{CAPABILITY_SPEC_EXCERPT}` — read actual code, not the implementer's summary. **Model:** `forge resolve-model --tier standard` (or `capable` for money/auth/contracts; use `fast` when `models.bias` is `prefer-fast` and not high-risk). Do **not** skip high-risk tasks.
52
- 5. Fix loop until the reviewer approves (max `review.maxRounds` from pace; then escalate to the human). For group reviews, fix any rejected task in the group before continuing to the next group.
53
- 6. Record **test evidence** from the implementer's report (every task, even when review is deferred to group end):
54
- ```bash
55
- forge evidence --task <nn>-<slug> --command "<tier-2 cmd>" --exit 0 --summary "<pass summary>"
56
- ```
57
- (Refuses non-zero exit without `--allow-fail`; template + rules in [../references/test-evidence.md](../references/test-evidence.md).)
58
- 7. Mark task complete (`tasks.md` `- [x]` or update `tasksComplete`). Detect group boundary: next line in `tasks.md` is a new `##` heading, or no remaining tasks under the current heading.
59
- 8. Repeat.
60
-
61
- **Batching:** consecutive small same-area tasks (docs, config, wording) may share one implementer brief + one review — see the batching rules in [subagent-driven-development](../skills/subagent-driven-development/SKILL.md). Never batch money/auth/contract/migration tasks.
62
-
63
- ```bash
64
- forge phase implement --tasks-complete <N> --subagents <total dispatched so far>
65
- ```
66
-
67
- ## Forge constraints (include in every brief)
68
-
69
- - **No** autonomous `git commit` or `git push`
70
- - **Tier 2 tests only** before claiming task done — narrowest command for this task ([test-strategy.md](../references/test-strategy.md)); **not** the full workspace suite unless the task requires it
71
- - Trace ecosystem consumers when contracts change
72
- - Minimal diff — surgical changes only
73
- - Runtime integrity: no stubs / false success; name the runtime caller; tests must fail on a no-op ([runtime-integrity.md](../references/runtime-integrity.md))
74
-
75
- ## After all tasks
76
-
77
- Proceed to [verify.md](./verify.md) then [review.md](./review.md).
1
+ # Implement phase
2
+
3
+ Read and follow [../skills/subagent-driven-development/SKILL.md](../skills/subagent-driven-development/SKILL.md).
4
+
5
+ Every implementer subagent must follow [../references/tdd-core.md](../references/tdd-core.md) (condensed TDD rules — the brief includes the pointer; full skill only when stuck).
6
+
7
+ On test failures or unexpected behavior, use [../skills/systematic-debugging/SKILL.md](../skills/systematic-debugging/SKILL.md) before proposing fixes.
8
+
9
+ **Test strategy:** [../references/test-strategy.md](../references/test-strategy.md) — tier 1 (scoped TDD) + tier 2 (narrow task evidence) during implement; **tier 3 (full workspace) runs once at verify**, not per task.
10
+
11
+ **Pace:** Read `resolvedPace` / effective knobs from `forge status` (or [../references/pace.md](../references/pace.md)). After each task, decide whether to dispatch a reviewer via `review.perTask` + hard floor:
12
+
13
+ | `review.perTask` | When to dispatch reviewer |
14
+ | ---------------- | ------------------------- |
15
+ | `always` | After every task (`thorough`) |
16
+ | `per-group` | When the task closes a `tasks.md` group (`##` section — OpenSpec or specs engine), or immediately if the task is high-risk (`standard`) |
17
+ | `high-risk-only` / `never` | Only when hard-floor high-risk |
18
+
19
+ When skipping the reviewer, still write `task-review.md` with `APPROVED (pace self-check)` and keep tier-2 evidence mandatory for behavior changes. For `per-group` reviews, cover all tasks in that section in one reviewer pass; save as `group-review.md` next to the group’s tasks (or under `.forge/sessions/<id>/tasks/group-<nn>-<slug>/group-review.md`). Prefer `--tier fast` when `models.bias` is `prefer-fast` and the task is mechanical. Cap fix→re-review loops at `review.maxRounds`.
20
+
21
+ ## Plan source
22
+
23
+ | planType | Task list |
24
+ | -------- | --------- |
25
+ | `openspec` | `openspec/changes/<name>/tasks.md` via **`/forge:apply`** (preferred), **`openspec-apply-change`** / `/opsx:apply` |
26
+ | `specs` | `<specsDir>/changes/<name>/tasks.md` (default `specs/`) — read directly; no vendor CLI steps |
27
+
28
+ Legacy sessions with planType `throwaway` or `direct`: resume from the session's own artefacts (`plan.md` / `brainstorm/notes.md`); new work always uses the configured engine (`openspec` or `specs`).
29
+
30
+ For OpenSpec: follow `openspec-apply-change` for CLI steps, but **wrap each task** in the subagent loop (do not implement all tasks inline in coordinator context). For specs: read `proposal.md` / `design.md` / `tasks.md` from the change dir as context, then run the same subagent loop.
31
+
32
+ ## Runtime integrity (hard)
33
+
34
+ Honor [../references/runtime-integrity.md](../references/runtime-integrity.md) in every brief and review packet:
35
+
36
+ - Briefs **must never** contain “stub OK”, “later task”, “minimal poll loop only”, or equivalent. Shrink scope only by stopping and asking the user.
37
+ - Capability specs beat narrow task wording. Fill reviewer `{CAPABILITY_SPEC_EXCERPT}` from the change's capability specs — not only the task line.
38
+ - Do not mark a section complete if libraries exist but nothing in the production path calls them.
39
+ - **Deferrals:** if wiring genuinely lands in a later task, register it — `forge defer add --task <id> --reason "…"` — and resolve it when that task lands. Unregistered "later" is a REJECT; unresolved deferrals block `forge phase done`.
40
+ - **Spine:** when a task wires a capability into production, update its `spine.json` row (runtimeOwner / writes / evidence). `forge spine check` must pass before verify ends.
41
+ - **E2E:** the product-loop acceptance task (last implement task) delivers working `e2e.json` steps and a green `forge e2e run` — steps that would pass against a stubbed handler are invalid.
42
+
43
+ ## Per-task loop
44
+
45
+ 1. Extract full task text + file paths + relevant **capability** spec sections (not only the task checkbox line).
46
+ 2. Write `.forge/sessions/<id>/tasks/<nn>-<slug>/brief.md` using [../subagents/implementer-prompt.md](../subagents/implementer-prompt.md).
47
+ 3. Dispatch **implementer** subagent — brief includes [../references/tdd-core.md](../references/tdd-core.md). **Model:** resolve via `forge resolve-model --tier <fast|standard|capable>` (billing defaults to **`included`** — subscription/first-party pool; never invent API model slugs). Use `fast` for mechanical tasks (1–2 files, complete spec) and batched small tasks; `standard` for multi-file integration; escalate one capability tier (still `included`) when re-dispatching after `BLOCKED`. If `omitModel` is true, omit the Task `model` parameter.
48
+ 4. **Reviewer** (unless pace skips it):
49
+ - **`always` / high-risk hard floor:** dispatch [../subagents/task-reviewer-prompt.md](../subagents/task-reviewer-prompt.md) for this task → `task-review.md`.
50
+ - **`per-group` at group boundary:** dispatch one reviewer covering **all tasks in the just-finished `tasks.md` group** → `group-review.md` (include each task id + paths). Mid-group low-risk tasks: self-check `task-review.md` only.
51
+ - If `review.depth` is `spec-only`, focus on spec + tests evidence. Fill `{DIFF_RANGE}` and `{CAPABILITY_SPEC_EXCERPT}` — read actual code, not the implementer's summary. **Model:** `forge resolve-model --tier standard` (or `capable` for money/auth/contracts; use `fast` when `models.bias` is `prefer-fast` and not high-risk). Do **not** skip high-risk tasks.
52
+ 5. Fix loop until the reviewer approves (max `review.maxRounds` from pace; then escalate to the human). For group reviews, fix any rejected task in the group before continuing to the next group.
53
+ 6. Record **test evidence** from the implementer's report (every task, even when review is deferred to group end):
54
+ ```bash
55
+ forge evidence --task <nn>-<slug> --command "<tier-2 cmd>" --exit 0 --summary "<pass summary>"
56
+ ```
57
+ (Refuses non-zero exit without `--allow-fail`; template + rules in [../references/test-evidence.md](../references/test-evidence.md).)
58
+ 7. Mark task complete (`tasks.md` `- [x]` or update `tasksComplete`). Detect group boundary: next line in `tasks.md` is a new `##` heading, or no remaining tasks under the current heading.
59
+ 8. Repeat.
60
+
61
+ **Batching:** consecutive small same-area tasks (docs, config, wording) may share one implementer brief + one review — see the batching rules in [subagent-driven-development](../skills/subagent-driven-development/SKILL.md). Never batch money/auth/contract/migration tasks.
62
+
63
+ ```bash
64
+ forge phase implement --tasks-complete <N> --subagents <total dispatched so far>
65
+ ```
66
+
67
+ ## Forge constraints (include in every brief)
68
+
69
+ - **No** autonomous `git commit` or `git push`
70
+ - **Tier 2 tests only** before claiming task done — narrowest command for this task ([test-strategy.md](../references/test-strategy.md)); **not** the full workspace suite unless the task requires it
71
+ - Trace ecosystem consumers when contracts change
72
+ - Minimal diff — surgical changes only
73
+ - Runtime integrity: no stubs / false success; name the runtime caller; tests must fail on a no-op ([runtime-integrity.md](../references/runtime-integrity.md))
74
+
75
+ ## After all tasks
76
+
77
+ Proceed to [verify.md](./verify.md) then [review.md](./review.md).
@@ -1,60 +1,60 @@
1
- # Plan phase — OpenSpec
2
-
3
- Thin wrapper around the project **`openspec-propose`** skill (or `/opsx:propose`).
4
-
5
- ## Steps
6
-
7
- 1. Derive change name with correct product prefix (`openspec/config.yaml` (if the project uses OpenSpec prefixes)).
8
- 2. Run `openspec-propose` / `/opsx:propose <prefix>-<slug>`.
9
- 3. Confirm `tasks.md` exists and change is apply-ready.
10
- 4. **Spine (always) + orchestration seam** — see [../references/runtime-integrity.md](../references/runtime-integrity.md):
11
-
12
- ```bash
13
- forge spine init # mandatory every change — fill rows or set notApplicable
14
- ```
15
-
16
- Sync-only / docs-only: `"notApplicable": "<reason>"`. Capability work: one row
17
- per REQ cluster (library → runtime owner → writes → evidence).
18
-
19
- When the spine has real rows, also `forge e2e init` — the executable
20
- product-loop steps (`e2e.json`) are a **plan deliverable**: author them (or
21
- task out their authoring) so verify can `forge e2e run` them.
22
-
23
- If the change also involves workers, job queues, handlers, or cross-runtime
24
- calls, `tasks.md` MUST include:
25
-
26
- - Explicit **wiring** tasks per job kind / entry point → domain pipeline
27
- - One **product-loop acceptance** task (last implement task, before
28
- verify) — its output is a green `forge e2e run`
29
-
30
- Missing spine = plan **not** ready. (`forge phase done` refuses without a
31
- valid spine and, when the spine has rows, a green current e2e run —
32
- keyword sniffing does not decide.)
33
-
34
- 5. **Operator brief (mandatory)** — see [../references/operator-brief.md](../references/operator-brief.md):
35
- write `openspec/changes/<change-name>/brief.html` — a plain-language,
36
- self-contained HTML explanation of what will be built (mermaid diagrams
37
- where helpful), then:
38
-
39
- ```bash
40
- forge brief stamp # records specs hash (does NOT auto-open)
41
- ```
42
-
43
- `forge phase implement` hard-refuses while the brief is missing or stale
44
- (specs edited after stamping → rewrite affected sections and re-stamp).
45
-
46
- 6. Update session:
47
- ```bash
48
- forge phase plan --plan-type openspec --openspec <change-name>
49
- forge phase implement --tasks-total <N>
50
- ```
51
- Count tasks from `tasks.md` checkboxes.
52
-
53
- 7. Get user approval to proceed to implement (unless they already said "go").
54
- The brief is what the operator reviews — tell them its path and that
55
- `forge brief open` launches it; never open it for them.
56
-
57
- ## Session tracking
58
-
59
- Forge session holds orchestration artefacts; canonical plan lives under
60
- `openspec/changes/<name>/`.
1
+ # Plan phase — OpenSpec
2
+
3
+ Thin wrapper around the project **`openspec-propose`** skill (or `/opsx:propose`).
4
+
5
+ ## Steps
6
+
7
+ 1. Derive change name with correct product prefix (`openspec/config.yaml` (if the project uses OpenSpec prefixes)).
8
+ 2. Run `openspec-propose` / `/opsx:propose <prefix>-<slug>`.
9
+ 3. Confirm `tasks.md` exists and change is apply-ready.
10
+ 4. **Spine (always) + orchestration seam** — see [../references/runtime-integrity.md](../references/runtime-integrity.md):
11
+
12
+ ```bash
13
+ forge spine init # mandatory every change — fill rows or set notApplicable
14
+ ```
15
+
16
+ Sync-only / docs-only: `"notApplicable": "<reason>"`. Capability work: one row
17
+ per REQ cluster (library → runtime owner → writes → evidence).
18
+
19
+ When the spine has real rows, also `forge e2e init` — the executable
20
+ product-loop steps (`e2e.json`) are a **plan deliverable**: author them (or
21
+ task out their authoring) so verify can `forge e2e run` them.
22
+
23
+ If the change also involves workers, job queues, handlers, or cross-runtime
24
+ calls, `tasks.md` MUST include:
25
+
26
+ - Explicit **wiring** tasks per job kind / entry point → domain pipeline
27
+ - One **product-loop acceptance** task (last implement task, before
28
+ verify) — its output is a green `forge e2e run`
29
+
30
+ Missing spine = plan **not** ready. (`forge phase done` refuses without a
31
+ valid spine and, when the spine has rows, a green current e2e run —
32
+ keyword sniffing does not decide.)
33
+
34
+ 5. **Operator brief (mandatory)** — see [../references/operator-brief.md](../references/operator-brief.md):
35
+ write `openspec/changes/<change-name>/brief.html` — a plain-language,
36
+ self-contained HTML explanation of what will be built (mermaid diagrams
37
+ where helpful), then:
38
+
39
+ ```bash
40
+ forge brief stamp # records specs hash (does NOT auto-open)
41
+ ```
42
+
43
+ `forge phase implement` hard-refuses while the brief is missing or stale
44
+ (specs edited after stamping → rewrite affected sections and re-stamp).
45
+
46
+ 6. Update session:
47
+ ```bash
48
+ forge phase plan --plan-type openspec --openspec <change-name>
49
+ forge phase implement --tasks-total <N>
50
+ ```
51
+ Count tasks from `tasks.md` checkboxes.
52
+
53
+ 7. Get user approval to proceed to implement (unless they already said "go").
54
+ The brief is what the operator reviews — tell them its path and that
55
+ `forge brief open` launches it; never open it for them.
56
+
57
+ ## Session tracking
58
+
59
+ Forge session holds orchestration artefacts; canonical plan lives under
60
+ `openspec/changes/<name>/`.