dflow-sdd-ddd 0.7.0 → 0.8.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 (51) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/docs/evaluating-dflow.en.md +14 -5
  3. package/docs/evaluating-dflow.md +14 -5
  4. package/docs/using-with-claude-code.en.md +17 -9
  5. package/docs/using-with-claude-code.md +15 -8
  6. package/lib/init.js +263 -52
  7. package/package.json +1 -1
  8. package/templates/brownfield/references/dflow-feedback-flow.md +179 -0
  9. package/templates/brownfield/references/drift-verification.md +183 -0
  10. package/templates/brownfield/references/finish-feature-flow.md +259 -0
  11. package/templates/brownfield/references/git-integration.md +312 -0
  12. package/templates/brownfield/references/init-project-flow.md +413 -0
  13. package/templates/brownfield/references/modify-existing-flow.md +444 -0
  14. package/templates/brownfield/references/new-feature-flow.md +367 -0
  15. package/templates/brownfield/references/new-phase-flow.md +259 -0
  16. package/templates/brownfield/references/pr-review-checklist.md +179 -0
  17. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +31 -4
  18. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +12 -8
  19. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +1 -1
  20. package/templates/brownfield/scaffolding/Git-principles-trunk.md +1 -1
  21. package/templates/brownfield/scaffolding/_conventions.md +1 -1
  22. package/templates/brownfield/scaffolding/_overview.md +3 -3
  23. package/templates/brownfield/templates/context-map.md +1 -1
  24. package/templates/brownfield/templates/glossary.md +1 -1
  25. package/templates/brownfield/templates/models.md +1 -1
  26. package/templates/brownfield/templates/rules.md +1 -1
  27. package/templates/brownfield/templates/tech-debt.md +1 -1
  28. package/templates/common/skill/SKILL.md +35 -0
  29. package/templates/greenfield/references/ddd-modeling-guide.md +351 -0
  30. package/templates/greenfield/references/dflow-feedback-flow.md +179 -0
  31. package/templates/greenfield/references/drift-verification.md +195 -0
  32. package/templates/greenfield/references/finish-feature-flow.md +280 -0
  33. package/templates/greenfield/references/git-integration.md +285 -0
  34. package/templates/greenfield/references/init-project-flow.md +447 -0
  35. package/templates/greenfield/references/modify-existing-flow.md +362 -0
  36. package/templates/greenfield/references/new-feature-flow.md +397 -0
  37. package/templates/greenfield/references/new-phase-flow.md +273 -0
  38. package/templates/greenfield/references/pr-review-checklist.md +130 -0
  39. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +31 -4
  40. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +15 -13
  41. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +1 -1
  42. package/templates/greenfield/scaffolding/Git-principles-trunk.md +1 -1
  43. package/templates/greenfield/scaffolding/_conventions.md +1 -1
  44. package/templates/greenfield/scaffolding/_overview.md +5 -3
  45. package/templates/greenfield/scaffolding/architecture-decisions-README.md +1 -1
  46. package/templates/greenfield/templates/context-map.md +1 -1
  47. package/templates/greenfield/templates/events.md +1 -1
  48. package/templates/greenfield/templates/glossary.md +1 -1
  49. package/templates/greenfield/templates/models.md +1 -1
  50. package/templates/greenfield/templates/rules.md +1 -1
  51. package/templates/greenfield/templates/tech-debt.md +1 -1
@@ -0,0 +1,195 @@
1
+ # Drift Verification — rules.md ↔ behavior.md Consistency Check
2
+
3
+ Triggered by `/dflow:verify` or `/dflow:verify <bounded-context>`.
4
+
5
+ ## Purpose
6
+
7
+ The A+C structure (`rules.md` as index + `behavior.md` as scenario content) introduces a drift risk — the two files can fall out of sync. This command provides a mechanical verification safety net that developers can run at key moments: before a PR, after a refactor, or when onboarding to an unfamiliar Bounded Context.
8
+
9
+ ## Scope
10
+
11
+ ### This command does (mechanical layer)
12
+
13
+ Three string-matching checks that AI can perform deterministically:
14
+
15
+ 1. **BR-ID forward check**: Every `BR-*` declared in `rules.md` has a corresponding section in `behavior.md`
16
+ 2. **Anchor validity**: If `rules.md` links to `behavior.md#section`, that anchor exists
17
+ 3. **BR-ID reverse check**: Every `BR-*` referenced in `behavior.md` is declared in `rules.md`
18
+
19
+ ### This command does NOT do (semantic layer — explicitly excluded)
20
+
21
+ Semantic verification (LLM reads the one-line summary in `rules.md` vs the Given/When/Then in `behavior.md` and judges whether they contradict) is **out of scope**. Reasons:
22
+ - Mechanical checks already catch most drift (missing IDs, broken links)
23
+ - Semantic judgment costs tokens and requires human review of LLM conclusions
24
+ - Deferred to Wave D — revisit after 10+ verify runs show the type distribution of actual drift
25
+
26
+ ### This command does NOT do (feature-directory aggregation — explicitly excluded)
27
+
28
+ Given the feature directory layout
29
+ (`dflow/specs/features/active/{SPEC-ID}-{slug}/` containing `_index.md` plus
30
+ 0..N `phase-spec-*.md` and 0..N `lightweight-*.md`), a tempting but
31
+ **out-of-scope** extension would be: "make `/dflow:verify` aggregate BR
32
+ state across all phase-spec files in a feature, then cross-check against
33
+ `rules.md`." Don't do that here.
34
+
35
+ Reasons:
36
+ - Feature-level BR aggregation is already maintained by `_index.md`
37
+ Current BR Snapshot, refreshed by `/dflow:new-phase` Step 5, reconciled
38
+ by `/dflow:new-phase` Step 7, and promoted by `/dflow:finish-feature`
39
+ Step 3
40
+ - BC-level current state is already maintained by `rules.md` /
41
+ `behavior.md` / `events.md`, written by the same
42
+ `/dflow:finish-feature` Step 3
43
+ - `/dflow:verify` keeps a small, mechanical scope: just the
44
+ `rules.md` ↔ `behavior.md` correspondence inside one BC, plus the
45
+ events.md bonus check below
46
+ - Cross-feature / cross-phase aggregation would mix `/dflow:verify`'s
47
+ job with `/dflow:finish-feature`'s job and produce false positives
48
+ during in-progress features
49
+
50
+ If a future need arises to add an `_index.md` Current BR Snapshot ↔
51
+ `rules.md` cross-check, that belongs in a future extension,
52
+ not in this command's current scope.
53
+
54
+ ### Anchor coexistence with `dflow:section`
55
+
56
+ `dflow:section` HTML comment anchors and markdown heading anchors serve different purposes:
57
+
58
+ - Markdown heading anchors (e.g., `behavior.md#br-001-rule-name`) remain the primary link target for BR-ID verification.
59
+ - `<!-- dflow:section ... -->` anchors are helper markers for AI/tool section positioning only.
60
+ - `dflow:section` does **not** replace BR-ID markdown anchors, and does **not** change the drift-verification algorithm.
61
+
62
+ So this command still uses BR-ID + markdown auto-id anchors as its primary index; `dflow:section` is auxiliary metadata.
63
+
64
+ ## Usage
65
+
66
+ ```
67
+ /dflow:verify # Verify all Bounded Contexts
68
+ /dflow:verify Expense # Verify a single BC (recommended default)
69
+ ```
70
+
71
+ When verifying all BCs, run each context independently and report per-context results.
72
+
73
+ ## Verification Steps
74
+
75
+ For each Bounded Context:
76
+
77
+ ### Step 1: Locate files
78
+
79
+ - Find `dflow/specs/domain/{context}/rules.md`
80
+ - Find `dflow/specs/domain/{context}/behavior.md`
81
+ - If either is missing, report and stop for that context:
82
+ ```
83
+ ✗ Expense: rules.md exists but behavior.md is missing
84
+ → Create the missing file using the matching template:
85
+ - rules.md → templates/rules.md
86
+ - behavior.md → templates/behavior.md
87
+ Or run the completion flow to populate it from existing completed specs
88
+ ```
89
+
90
+ ### Step 2: Extract BR-IDs from rules.md
91
+
92
+ Scan `rules.md` for all `BR-*` identifiers. Record each ID and any anchor link to `behavior.md`.
93
+
94
+ ### Step 3: Extract BR-IDs from behavior.md
95
+
96
+ Build two sets:
97
+
98
+ - **Primary set (scenario-bound)**: BR-IDs that appear in section headings
99
+ (e.g. `## Amount Validation (BR-001)`) or in the formal `(BR-NNN)` marker
100
+ inside a Given/When/Then scenario block. These represent BR-IDs that have
101
+ a dedicated scenario section.
102
+ - **Supplementary set (body-text mentions)**: BR-IDs that appear only in
103
+ prose / discussion text, outside any Given/When/Then block. These are
104
+ informational references, not equivalent to a scenario section.
105
+
106
+ ### Step 4: Cross-reference
107
+
108
+ Run the three checks using the primary set from Step 3 as the main comparison basis:
109
+
110
+ | Check | Pass condition | Fail message |
111
+ |---|---|---|
112
+ | Forward | Every BR-ID in rules.md has a corresponding scenario section in behavior.md (primary set) | `✗ BR-NNN declared in rules.md but has no scenario section in behavior.md` |
113
+ | Anchor | Every `behavior.md#anchor` in rules.md resolves to an existing heading | `✗ BR-NNN links to behavior.md#section but anchor not found` |
114
+ | Reverse | Every BR-ID formally referenced in behavior.md (primary set) is declared in rules.md | `✗ BR-NNN referenced in behavior.md scenario but not declared in rules.md` |
115
+
116
+ Body-text mentions (supplementary set) do **not** satisfy forward / reverse
117
+ pass conditions on their own. They are reported separately as informational
118
+ signals (see Step 5).
119
+
120
+ ### Step 5: Report
121
+
122
+ Output format:
123
+
124
+ ```
125
+ Verifying {Context} — rules.md ↔ behavior.md consistency
126
+
127
+ ✓ BR-001 → scenario section exists and references BR-001
128
+ ✓ BR-002 → scenario section exists and references BR-002
129
+ ✗ BR-003 → behavior.md has no scenario section for BR-003
130
+ (note: BR-003 appears in body text of another section,
131
+ but that does not satisfy the forward check)
132
+ ℹ BR-005 → body text reference only — no dedicated scenario section;
133
+ confirm this is intentional (e.g. cross-reference to another BR)
134
+
135
+ ✗ BR-010 → formally referenced in a behavior.md scenario but not
136
+ declared in rules.md
137
+
138
+ Summary: 3 passed, 2 issues, 1 informational
139
+
140
+ Issues:
141
+ 1. rules.md declares BR-003, but behavior.md has no corresponding
142
+ scenario section
143
+ → Possible cause: rule was implemented but behavior.md wasn't
144
+ updated in the completion flow; or a body-text mention was
145
+ mistaken for a scenario
146
+ → Action: check the implementation, then either add the scenario
147
+ to behavior.md (preferred) or remove BR-003 from rules.md if
148
+ deprecated
149
+
150
+ 2. behavior.md's {scenario section name} formally references BR-010,
151
+ but rules.md doesn't declare it
152
+ → Possible cause: scenario was added directly to behavior.md
153
+ without updating rules.md
154
+ → Action: add BR-010 to rules.md with a one-line summary, or
155
+ remove the stale scenario reference from behavior.md
156
+ ```
157
+
158
+ ## Core-Specific Notes
159
+
160
+ When verifying a Core context, also check:
161
+ - `events.md` references in `behavior.md`: if a scenario says "And {DomainEvent} is raised", confirm the event is listed in `events.md`
162
+ - This is a **bonus check**, not a blocking failure — report as a warning:
163
+ ```
164
+ ⚠ BR-001 scenario references ExpenseReportSubmitted event,
165
+ but events.md does not list it
166
+ ```
167
+
168
+ ## When to Run
169
+
170
+ Recommended trigger points (not enforced — developer's judgment):
171
+ - Before creating a PR (`/dflow:verify` as a pre-PR sanity check)
172
+ - After a refactor that touched multiple specs or domain docs
173
+ - When onboarding to an unfamiliar Bounded Context (verify before trusting the docs)
174
+ - After running `/dflow:finish-feature` — that command writes BC layer
175
+ updates from the feature's `_index.md` Current BR Snapshot; verify
176
+ catches any anchor / link drift introduced by the merge
177
+
178
+ ## Path Assumptions
179
+
180
+ This command operates entirely within `dflow/specs/domain/{context}/` files
181
+ (`rules.md`, `behavior.md`, and the `events.md` bonus check). It does
182
+ **not** read from `dflow/specs/features/active/{SPEC-ID}-{slug}/` directories
183
+ — the feature directory layout is not part of verify's input. The only effect of feature directory layout on this
184
+ command is ensuring `last-updated` dates in `behavior.md` are bumped at
185
+ `/dflow:finish-feature` time (so verify's mechanical drift guard stays
186
+ useful).
187
+
188
+ ## Interaction with Other Commands
189
+
190
+ - `/dflow:verify` is a **standalone command** — it does not require an active workflow
191
+ - It can be run mid-workflow (e.g., during Step 7 implementation to check you haven't drifted)
192
+ - It can be run after `/dflow:finish-feature` lands — that's the moment
193
+ BC-layer files get rewritten; verify catches mechanical issues from
194
+ the merge
195
+ - If issues are found, the developer decides whether to fix now or defer — the command does not block other workflows
@@ -0,0 +1,280 @@
1
+ # Finish Feature Workflow — Greenfield Clean Architecture
2
+
3
+ Step-by-step guide for when a developer triggers `/dflow:finish-feature` —
4
+ the feature closeout ceremony.
5
+
6
+ This command makes the previously-implicit closeout step (originally a
7
+ sub-step of `new-feature-flow` / `modify-existing-flow`) explicit and
8
+ directly callable. It validates that all phase-specs are completed,
9
+ syncs the feature-level BR Snapshot to the bounded context's system-level
10
+ state, archives the feature directory, and emits a Git-strategy-neutral
11
+ **Integration Summary** for the developer's PR / merge / push step.
12
+
13
+ **Important boundaries**:
14
+ - This command **does not auto-merge**. It does not push, does not open a
15
+ PR, does not run the project's merge strategy. Those decisions stay
16
+ with the developer / project's Git principles — Dflow keeps merge
17
+ strategy project-owned.
18
+ - The BC-layer sync in Step 3 **reuses the existing Step 5.3 mechanism**
19
+ from `new-feature-flow` (Step 8.3) and `modify-existing-flow` (Step
20
+ 5.3) — it does not introduce a new sync flow. Treat it as "lift Step
21
+ 5.3 / 8.3 out of the per-phase checklist and run it once at feature
22
+ closeout, with the `_index.md` Current BR Snapshot as input."
23
+
24
+ **Step Gates** in this flow (stop-and-confirm before proceeding):
25
+ - Step 1 → Step 2 (validation passed → flip status)
26
+ - Step 3 → Step 4 (BC sync done → archive)
27
+ - Step 5 → Step 6 (Integration Summary emitted → optional follow-up reverse-link)
28
+
29
+ All other step transitions are **step-internal**: announce "Step N complete,
30
+ entering Step N+1" and proceed without waiting. See SKILL.md § Workflow
31
+ Transparency for the full transparency protocol and confirmation signals.
32
+
33
+ ## Step 1: Validate Phase Specs and `_index.md`
34
+
35
+ Before producing any closeout prose or Integration Summary text, read
36
+ `dflow/specs/shared/_conventions.md` and apply the `## Prose Language`
37
+ setting. If the setting is missing or not an explicit language tag, ask the
38
+ developer to update `_conventions.md` before continuing.
39
+
40
+ AI runs mechanical checks first. Report `✓` / `✗` for every item; if any
41
+ `✗` appears, **stop here** and ask the developer to address them before
42
+ proceeding (do not flip status, do not archive, do not emit summary).
43
+
44
+ - [ ] Locate the feature directory at `dflow/specs/features/active/{SPEC-ID}-{slug}/`
45
+ - [ ] `_index.md` exists and parses (YAML front matter intact, six required
46
+ sections present)
47
+ - [ ] Every row in `_index.md` Phase Specs table has Status = `completed`
48
+ - [ ] Every phase-spec file referenced in the Phase Specs table exists at
49
+ the path the table claims
50
+ - [ ] Every phase-spec file's frontmatter has `status: completed`
51
+ - [ ] `_index.md` has no obvious open items in Resume Pointer (e.g. "phase-N
52
+ drafting" / "implementation pending" / "TODO" markers)
53
+ - [ ] Current BR Snapshot table is non-empty (or feature is intentionally
54
+ a no-BR feature — confirm with developer if uncertain)
55
+
56
+ If any check fails:
57
+ > "Cannot finish feature `{SPEC-ID}-{slug}` yet — {N} validation issues
58
+ > found:
59
+ > ✗ phase-spec-2026-04-15-foo.md status is still `in-progress`
60
+ > ✗ Phase Specs table row 3 references missing file phase-spec-...
61
+ >
62
+ > Address these (run `/dflow:new-phase` to add missing work, or fix the
63
+ > stale status manually), then re-run `/dflow:finish-feature`."
64
+
65
+ **→ Step Gate: Step 1 → Step 2**
66
+
67
+ If all checks pass:
68
+ > "All {N} phase-specs are completed and `_index.md` is internally
69
+ > consistent. Ready to flip the feature status to `completed`?
70
+ > `/dflow:next` to proceed."
71
+
72
+ Wait for confirmation before entering Step 2.
73
+
74
+ ## Step 2: Flip `_index.md` Status to `completed`
75
+
76
+ Update the feature's `_index.md` Metadata block:
77
+
78
+ ```yaml
79
+ ---
80
+ spec-id: SPEC-{YYYYMMDD}-{NNN}
81
+ slug: {slug}
82
+ status: completed # ← flipped from in-progress
83
+ created: {YYYY-MM-DD}
84
+ branch: feature/{SPEC-ID}-{slug}
85
+ ---
86
+ ```
87
+
88
+ Also update the **Resume Pointer** to reflect closeout:
89
+
90
+ ```
91
+ **Current Progress**: feature completed ({date}); all phase-specs status = completed.
92
+ **Next Action**: merge / push (per project Git-principles).
93
+ ```
94
+
95
+ **→ Transition (step-internal)**: Step 2 complete. Announce "Step 2 complete (status flipped). Entering Step 3: Sync BR Snapshot to BC layer." and continue.
96
+
97
+ ## Step 3: Sync `_index.md` Current BR Snapshot to BC Layer
98
+
99
+ This step **reuses the existing sync mechanism** from `new-feature-flow`
100
+ Step 8.3 / `modify-existing-flow` Step 5.3 (`dflow/specs/domain/{context}/rules.md`
101
+ + `behavior.md` + `events.md` + `context-map.md` updates). The input is
102
+ the feature's `_index.md` Current BR Snapshot table; the output is the
103
+ BC's `rules.md` / `behavior.md` updated to reflect the feature's net
104
+ effect.
105
+
106
+ Before syncing, ensure required BC files exist. If missing, create from templates:
107
+ - `dflow/specs/domain/{context}/rules.md` → `templates/rules.md`
108
+ - `dflow/specs/domain/{context}/behavior.md` → `templates/behavior.md`
109
+ - `dflow/specs/domain/{context}/events.md` → `templates/events.md`
110
+
111
+ For each row in Current BR Snapshot where Status = `active`:
112
+
113
+ - If the BR-ID is **not yet in `rules.md`** → add it (new ADDED rule
114
+ introduced by this feature)
115
+ - If the BR-ID is **already in `rules.md`** but the rule text differs →
116
+ update it (MODIFIED rule, reflect the new text)
117
+ - If the BR-ID was previously in `rules.md` and is now in Current BR
118
+ Snapshot with Status = `removed` → remove the corresponding section in
119
+ `rules.md` (REMOVED rule)
120
+ - For any RENAMED BR-ID → rename the BR-ID in `rules.md` and update
121
+ `glossary.md` if the term itself changed
122
+
123
+ For `behavior.md`:
124
+
125
+ - For every BR-ID still active after this feature, ensure
126
+ `dflow/specs/domain/{context}/behavior.md` has a scenario section (anchor)
127
+ matching the BR-ID; the scenario should include Aggregate state
128
+ transitions and Domain Events as appropriate
129
+ - For REMOVED BR-IDs, delete the corresponding scenario section from
130
+ `behavior.md`
131
+ - Update the BR-ID anchor's `last-updated` date in `behavior.md` to today
132
+
133
+ For `events.md`:
134
+ - Add any new Domain Events introduced by phase-specs in this feature
135
+ - Remove events that were REMOVED across the feature's net delta
136
+ - Update producers / consumers if Aggregate ownership shifted
137
+
138
+ For `context-map.md`:
139
+ - Update if any cross-context interaction was added, changed, or removed
140
+ across the feature
141
+
142
+ This is the **mechanical input that `/dflow:verify` later uses** for the
143
+ rules.md ↔ behavior.md drift check (see `references/drift-verification.md`).
144
+
145
+ Cross-reference each phase-spec's Delta-from-prior-phases section to
146
+ double-check the net result; the Snapshot is the SSOT but the per-phase
147
+ Deltas are the audit trail.
148
+
149
+ > Note: this step does NOT read individual phase-specs to re-derive the BR
150
+ > set — that work was already reconciled by `/dflow:new-phase` Step 7 each
151
+ > time a phase completed. We trust `_index.md` Current BR Snapshot as the
152
+ > feature-level truth here. If the developer finds drift between Snapshot
153
+ > and the phase-specs, fix `_index.md` first, then re-run
154
+ > `/dflow:finish-feature`.
155
+
156
+ Also update `architecture/tech-debt.md` / `models.md` / `glossary.md` as
157
+ discovered during the feature (the same items listed in
158
+ `new-feature-flow.md` Step 8.3) — these may have been touched per phase
159
+ already; this is the closeout sweep.
160
+
161
+ **→ Step Gate: Step 3 → Step 4**
162
+
163
+ > "BC `{context}` synced — `rules.md` updated ({n_added} added,
164
+ > {n_modified} modified, {n_removed} removed), `behavior.md` anchors
165
+ > updated, `events.md` reflects {n_events} new / changed events,
166
+ > `context-map.md` {updated / unchanged}, `last-updated` set to {date}.
167
+ > Ready to archive the feature directory? `/dflow:next` to proceed."
168
+
169
+ Wait for confirmation before entering Step 4.
170
+
171
+ ## Step 4: Archive — `git mv` the Feature Directory
172
+
173
+ AI runs:
174
+
175
+ ```bash
176
+ git mv dflow/specs/features/active/{SPEC-ID}-{slug} \
177
+ dflow/specs/features/completed/{SPEC-ID}-{slug}
178
+ git status # confirm rename detection
179
+ ```
180
+
181
+ `git mv` is mandatory — never use plain `mv` + `git add`. This preserves
182
+ git's directory rename detection so `git log --follow` / `git blame` /
183
+ PR diff quality stays intact across the move. See
184
+ `references/git-integration.md` § "Directory Moves Must Use git mv" for
185
+ the full rule set.
186
+
187
+ After the move, also `git add` any modified files from Step 3 (the
188
+ updated `rules.md`, `behavior.md`, `events.md`, `context-map.md`,
189
+ `glossary.md`, `architecture/tech-debt.md`, etc.) into the same stage.
190
+ AI **does not commit** — the developer commits in their own preferred
191
+ manner (and the project's Git-principles decide whether one commit or
192
+ several).
193
+
194
+ **→ Transition (step-internal)**: Step 4 complete. Announce "Step 4 complete (feature archived to completed/). Entering Step 5: Emit Integration Summary." and continue.
195
+
196
+ ## Step 5: Emit Integration Summary (Git-strategy-neutral)
197
+
198
+ Produce a plain-text summary of what this feature did. The summary is
199
+ **not** a commit message template — it is reference material the
200
+ developer adapts to whichever merge strategy their project uses
201
+ (merge commit, squash, rebase, fast-forward — Dflow stays neutral).
202
+
203
+ For projects that adopted the optional Dflow Git-principles scaffolding, the
204
+ applicable `scaffolding/Git-principles-{gitflow|trunk}.md` "Integration
205
+ Commit Message Conventions" section explains how to format the actual commit
206
+ message from this summary.
207
+
208
+ Format:
209
+
210
+ ```
211
+ == Integration Summary: {SPEC-ID}-{slug} ==
212
+
213
+ Feature Goal: {1-2 sentences from _index.md Goals & Scope}
214
+
215
+ Change Scope:
216
+ - BC: {context-name}
217
+ - Aggregates affected: {Aggregate1}, {Aggregate2}
218
+ - Phase Count: {N} (phase-spec-{date1}-{slug1} ... phase-spec-{dateN}-{slugN})
219
+ - Lightweight Changes: {n_t2} T2 lightweight specs + {n_t3} T3 inline rows
220
+
221
+ Related BR-IDs (post-closeout state):
222
+ - ADDED: BR-NN, BR-NN, ...
223
+ - MODIFIED: BR-NN, BR-NN, ...
224
+ - REMOVED: BR-NN, BR-NN, ...
225
+
226
+ Domain Events Changes:
227
+ - ADDED: {Event1}, {Event2}
228
+ - MODIFIED: {Event3}
229
+ - REMOVED: {Event4}
230
+
231
+ Phase List:
232
+ - phase-1 ({date}): {phase-slug} — {1 line}
233
+ - phase-2 ({date}): {phase-slug} — {1 line}
234
+ - ...
235
+
236
+ Next Steps (developer):
237
+ - Per the project's Git-principles, choose a merge strategy (merge commit /
238
+ squash / rebase / fast-forward) and execute
239
+ - Push to remote / open a PR
240
+ ```
241
+
242
+ Print the summary to the conversation; do not write it to a file (it is
243
+ ephemeral closeout output).
244
+
245
+ **→ Step Gate: Step 5 → Step 6**
246
+
247
+ If the feature has `follow-up-of: {原 SPEC-ID}` in its Metadata, prompt
248
+ the developer:
249
+ > "This feature is a follow-up of `{原 SPEC-ID}`. Ready to update the
250
+ > original feature's `_index.md` Follow-up Tracking row to mark this
251
+ > follow-up as `completed`? `/dflow:next` to proceed (or skip if you
252
+ > prefer to do it manually)."
253
+
254
+ If no `follow-up-of` field, skip Step 6 and announce closeout complete:
255
+ > "`/dflow:finish-feature` complete for `{SPEC-ID}-{slug}`. Feature
256
+ > directory is now at `dflow/specs/features/completed/{SPEC-ID}-{slug}/`.
257
+ > Stage is set; commit / merge / push at your discretion."
258
+
259
+ ## Step 6: Reverse-Update Follow-up Tracking (only if follow-up)
260
+
261
+ For features that were created as follow-ups of an earlier completed
262
+ feature, update the original feature's
263
+ Follow-up Tracking table.
264
+
265
+ 1. Locate `dflow/specs/features/completed/{原 SPEC-ID}-{原 slug}/_index.md`
266
+ 2. Find the Follow-up Tracking section's row for this feature's SPEC-ID
267
+ 3. Flip Status → `completed`
268
+
269
+ ```bash
270
+ # AI does the edit; commits stay with the developer
271
+ ```
272
+
273
+ After the update:
274
+ > "Follow-up Tracking row in `{原 SPEC-ID}-{原 slug}/_index.md` updated
275
+ > to Status = `completed`. Closeout complete."
276
+
277
+ The connection is bidirectional and weakly redundant: the new feature's
278
+ `follow-up-of` field is the authoritative source; the old feature's
279
+ Follow-up Tracking row is a derived index. If they ever disagree, trust
280
+ `follow-up-of`.