dflow-sdd-ddd 0.8.0 → 0.9.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 (29) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/LICENSE +679 -21
  3. package/README.en.md +5 -4
  4. package/README.md +3 -3
  5. package/bin/dflow.js +3 -2
  6. package/docs/using-with-codex.en.md +12 -8
  7. package/docs/using-with-codex.md +8 -6
  8. package/lib/init.js +217 -35
  9. package/package.json +2 -2
  10. package/templates/brownfield/references/dflow-feedback-flow.md +135 -63
  11. package/templates/brownfield/references/finish-feature-flow.md +56 -21
  12. package/templates/brownfield/references/git-integration.md +65 -6
  13. package/templates/brownfield/references/init-project-flow.md +36 -19
  14. package/templates/brownfield/references/modify-existing-flow.md +4 -0
  15. package/templates/brownfield/references/new-feature-flow.md +15 -0
  16. package/templates/brownfield/references/new-phase-flow.md +15 -0
  17. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +13 -12
  18. package/templates/brownfield/scaffolding/Git-principles-trunk.md +13 -16
  19. package/templates/brownfield/templates/_index.md +20 -2
  20. package/templates/greenfield/references/dflow-feedback-flow.md +135 -63
  21. package/templates/greenfield/references/finish-feature-flow.md +55 -21
  22. package/templates/greenfield/references/git-integration.md +65 -6
  23. package/templates/greenfield/references/init-project-flow.md +36 -19
  24. package/templates/greenfield/references/modify-existing-flow.md +4 -0
  25. package/templates/greenfield/references/new-feature-flow.md +15 -0
  26. package/templates/greenfield/references/new-phase-flow.md +15 -0
  27. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +13 -12
  28. package/templates/greenfield/scaffolding/Git-principles-trunk.md +13 -17
  29. package/templates/greenfield/templates/_index.md +20 -2
@@ -64,6 +64,17 @@ AI must locate the target feature and load its current state:
64
64
  left off (its Business Rules and Delta-from-prior-phases sections in
65
65
  particular)
66
66
 
67
+ 4. **Branch gate — ensure you are on this feature's branch (before any commit)**
68
+
69
+ This phase's commits must land on the active feature's
70
+ `feature/{SPEC-ID}-{slug}` branch. If you are not already on it (you
71
+ identified the feature by name, or are on a base / unrelated branch),
72
+ switch to the existing branch — or override and record it in the
73
+ `_index.md` Checkpoint Log. **Never create a new feature branch here:**
74
+ `new-phase` extends an existing active feature, it does not start one. See
75
+ `references/git-integration.md` § Commit Checkpoints, Branch Gate & AI
76
+ Commits.
77
+
67
78
  Share what you found:
68
79
 
69
80
  > "OK — `{SPEC-ID}-{slug}` has {N} prior phases. The most recent
@@ -158,6 +169,8 @@ Announce to developer:
158
169
  > Ready to refresh `_index.md` (add Phase Specs row, regenerate Current BR
159
170
  > Snapshot from the Delta)? `/dflow:next` to proceed."
160
171
 
172
+ > Commit checkpoint (per `references/git-integration.md` § Commit Checkpoints, Branch Gate & AI Commits): with the Step 1 branch gate satisfied (you are on the feature's branch), offer to commit the phase-spec baseline and record the result in the `_index.md` Checkpoint Log.
173
+
161
174
  Wait for confirmation before entering Step 5.
162
175
 
163
176
  ## Step 5: Refresh `_index.md`
@@ -227,6 +240,8 @@ Announce to developer:
227
240
  > Ready to mark this phase completed and update `_index.md`? `/dflow:next`
228
241
  > to proceed."
229
242
 
243
+ > Commit checkpoint (per `references/git-integration.md` § Commit Checkpoints, Branch Gate & AI Commits): offer to commit the phase implementation, then record the result in the `_index.md` Checkpoint Log.
244
+
230
245
  Wait for confirmation before entering Step 7.
231
246
 
232
247
  ## Step 7: Complete the Phase
@@ -124,8 +124,6 @@ Commits must tie back to a SPEC-ID:
124
124
  [{SPEC-ID}] {short description}
125
125
 
126
126
  {optional detailed body}
127
-
128
- Co-Authored-By: Claude <noreply@anthropic.com> ← suggested, not mandatory
129
127
  ```
130
128
 
131
129
  ### Type prefix (recommended)
@@ -299,19 +297,22 @@ Three categories:
299
297
  | `git stash` (local-only) |
300
298
  | `git branch` (listing only) |
301
299
 
302
- ### AI commit authorship (suggested, not enforced)
300
+ ### AI commit authorship
303
301
 
304
- When an AI assists in producing a commit, appending a `Co-Authored-By`
305
- line is **suggested** but not mandatory. The canonical form for
306
- Claude is:
302
+ How AI-made commits are marked is chosen once at `dflow init` and recorded in
303
+ `dflow/specs/shared/_conventions.md` § AI Commit Policy:
307
304
 
308
- ```
309
- Co-Authored-By: Claude <noreply@anthropic.com>
310
- ```
305
+ - `none` — AI commits carry no extra marker.
306
+ - `co-authored-by` — a `Co-Authored-By: dflow-ai <noreply@dflow.local>` trailer
307
+ (teams may customize the name / email).
308
+ - `prefix` — an `[ai-assisted]` commit-subject prefix.
311
309
 
312
- For other AI assistants, use the vendor-documented author line (or omit
313
- it). This is a project-level transparency convention, not a Dflow
314
- requirement.
310
+ This recorded setting is authoritative and the runtime does not re-ask. The AI
311
+ offers commits at lifecycle checkpoints (see `references/git-integration.md`
312
+ § Commit Checkpoints, Branch Gate & AI Commits) using your Git identity, and you
313
+ can always decline. If your team also wants vendor attribution, appending the
314
+ assistant's documented line (e.g. `Co-Authored-By: Claude
315
+ <noreply@anthropic.com>`) is an independent, optional convention on top.
315
316
 
316
317
  ---
317
318
 
@@ -72,8 +72,6 @@ Commits must tie back to a SPEC-ID:
72
72
  [{SPEC-ID}] {short description}
73
73
 
74
74
  {optional detailed body}
75
-
76
- Co-Authored-By: Claude <noreply@anthropic.com> ← suggested, not mandatory
77
75
  ```
78
76
 
79
77
  ### Conventional Commits style (recommended, optional)
@@ -170,8 +168,6 @@ Related BR-IDs:
170
168
  - REMOVED: (none)
171
169
 
172
170
  Related SPEC-IDs: {SPEC-ID}{, follow-up SPEC-IDs if any}
173
-
174
- Co-Authored-By: Claude <noreply@anthropic.com>
175
171
  ```
176
172
 
177
173
  Example:
@@ -191,8 +187,6 @@ Related BR-IDs:
191
187
  - MODIFIED: BR-03
192
188
 
193
189
  Related SPEC-IDs: SPEC-20260421-001
194
-
195
- Co-Authored-By: Claude <noreply@anthropic.com>
196
190
  ```
197
191
 
198
192
  ### 4.2 Rebase + merge (preserve feature commits on `main`)
@@ -281,19 +275,22 @@ Three categories:
281
275
  | `git branch` (listing only) |
282
276
  | `git rebase` on a private (not-yet-pushed) branch |
283
277
 
284
- ### AI commit authorship (suggested, not enforced)
278
+ ### AI commit authorship
285
279
 
286
- When an AI assists in producing a commit, appending a `Co-Authored-By`
287
- line is **suggested** but not mandatory. The canonical form for
288
- Claude is:
280
+ How AI-made commits are marked is chosen once at `dflow init` and recorded in
281
+ `dflow/specs/shared/_conventions.md` § AI Commit Policy:
289
282
 
290
- ```
291
- Co-Authored-By: Claude <noreply@anthropic.com>
292
- ```
283
+ - `none` — AI commits carry no extra marker.
284
+ - `co-authored-by` — a `Co-Authored-By: dflow-ai <noreply@dflow.local>` trailer
285
+ (teams may customize the name / email).
286
+ - `prefix` — an `[ai-assisted]` commit-subject prefix.
293
287
 
294
- For other AI assistants, use the vendor-documented author line (or omit
295
- it). This is a project-level transparency convention, not a Dflow
296
- requirement.
288
+ This recorded setting is authoritative and the runtime does not re-ask. The AI
289
+ offers commits at lifecycle checkpoints (see `references/git-integration.md`
290
+ § Commit Checkpoints, Branch Gate & AI Commits) using your Git identity, and you
291
+ can always decline. If your team also wants vendor attribution, appending the
292
+ assistant's documented line (e.g. `Co-Authored-By: Claude
293
+ <noreply@anthropic.com>`) is an independent, optional convention on top.
297
294
 
298
295
  ---
299
296
 
@@ -12,13 +12,14 @@ Template note (for AI):
12
12
  This is the **feature-level dashboard** (`_index.md`) for a feature
13
13
  directory. Place at `dflow/specs/features/active/{SPEC-ID}-{slug}/_index.md`.
14
14
 
15
- Six required sections (see below):
15
+ Seven required sections (see below):
16
16
  1. Metadata (YAML front matter above)
17
17
  2. Goals & Scope (prose)
18
18
  3. Phase Specs (T1 list)
19
19
  4. Current BR Snapshot (feature-level cumulative state)
20
20
  5. Lightweight Changes (T2 outbound link + T3 inline)
21
- 6. Resume Pointer
21
+ 6. Checkpoint Log (commit / skip timeline)
22
+ 7. Resume Pointer
22
23
 
23
24
  Optional section (append at end if applicable):
24
25
  - Follow-up Tracking (when this feature has follow-up features derived)
@@ -87,6 +88,23 @@ Template note (for AI):
87
88
  | {YYYY-MM-DD} | T2 | bug fix XYZ — 見 [`lightweight-{date}-{slug}.md`](./lightweight-{date}-{slug}.md) | {hash} |
88
89
  | {YYYY-MM-DD} | T3 | 按鈕顏色從藍改綠 `[cosmetic]` | {hash} |
89
90
 
91
+ <!-- dflow:section checkpoint-log -->
92
+ ## Checkpoint Log
93
+
94
+ > 生命週期 checkpoint 的 commit / skip 時間線(讓三週後回溯不必手動重建)。
95
+ > 每個 checkpoint 無論 commit 或 skip 都記一列。Tier 決定 checkpoint 數:
96
+ > T1 三點(spec 完 / impl 完 / closeout)、T2 兩點(spec+impl 合併 / closeout)、
97
+ > T3 單一 commit。
98
+ >
99
+ > commit hash 只在 commit 實際成功後填入;pre-commit hook reject 或 commit
100
+ > 失敗記 `failed`、不寫假 hash。
101
+
102
+ | Timestamp | Checkpoint | Result |
103
+ |---|---|---|
104
+ | {YYYY-MM-DD HH:MM} | spec-baseline | committed ({hash}) / skipped / failed |
105
+ | {YYYY-MM-DD HH:MM} | implementation | committed ({hash}) / skipped / failed |
106
+ | {YYYY-MM-DD HH:MM} | closeout | committed ({hash}) / skipped / failed |
107
+
90
108
  ## Resume Pointer
91
109
 
92
110
  > 一句話:目前進展到哪?下一個動作是什麼?
@@ -2,7 +2,8 @@
2
2
 
3
3
  `/dflow:report-dflow-feedback` helps the developer turn a Dflow problem or
4
4
  improvement observed during real project work into a high-quality upstream
5
- feedback draft.
5
+ feedback draft. The draft is rendered **field by field to match the upstream
6
+ GitHub issue form**, so the developer pastes each field with no reformatting.
6
7
 
7
8
  This flow is **not** a project feature workflow and does not change the
8
9
  application being built. It is a standalone governance/support flow for Dflow
@@ -48,13 +49,16 @@ turn it into a PR, or discard it.
48
49
 
49
50
  ## Step 1: Classify the Feedback
50
51
 
51
- Classify the feedback as one of:
52
+ Classify the feedback as one of the following. Each maps to one upstream issue
53
+ form (see "Upstream Issue Forms" below):
52
54
 
53
- - Bug report
54
- - Workflow change request
55
- - Documentation feedback
56
- - Question / unclear usage
57
- - Maintainer release/process feedback
55
+ | Classification | Upstream issue form | Title prefix |
56
+ |---|---|---|
57
+ | Bug report | Bug report | `[Bug]: ` |
58
+ | Workflow change request | Workflow change request | `[Workflow]: ` |
59
+ | Documentation feedback | Documentation feedback | `[Docs]: ` |
60
+ | Question / unclear usage | Question | `[Question]: ` |
61
+ | Maintainer release/process feedback | Workflow change request (closest form; the upstream repo disables blank issues) | `[Workflow]: ` |
58
62
 
59
63
  Capture:
60
64
 
@@ -88,92 +92,160 @@ Avoid:
88
92
 
89
93
  ## Step 3: Redaction Pass
90
94
 
91
- Before writing the issue body section, perform a redaction check and include it
92
- in the draft:
95
+ Before writing any field content, run a redaction check and use it as your own
96
+ gate. Confirm there are:
93
97
 
94
- ```markdown
95
- ## Redaction Checklist
98
+ - No secrets, tokens, credentials, or auth headers
99
+ - No customer, tenant, or private organization names
100
+ - No proprietary business rules beyond a sanitized paraphrase
101
+ - No private repository URLs or internal hostnames
102
+ - No long proprietary source snippets
96
103
 
97
- - [ ] No secrets, tokens, credentials, or auth headers
98
- - [ ] No customer, tenant, or private organization names
99
- - [ ] No proprietary business rules beyond sanitized paraphrase
100
- - [ ] No private repository URLs or internal hostnames
101
- - [ ] No long proprietary source snippets
102
- - [ ] Developer reviewed before submission
103
- ```
104
+ The draft ends with a short submitter self-check (Step 5); leave its items
105
+ unchecked unless the developer explicitly confirms them.
106
+
107
+ ## Step 4: Resolve the Target Issue Form
104
108
 
105
- Leave the final "Developer reviewed before submission" unchecked unless the
106
- developer explicitly confirms it.
109
+ Submit upstream at: **https://github.com/weilung/dflow-sdd-ddd/issues/new/choose**
107
110
 
108
- ## Step 4: Write the Feedback Draft
111
+ Resolve the field schema for the chosen form using this priority chain (it
112
+ avoids any network dependency at draft time):
109
113
 
110
- Use this structure:
114
+ 1. **Live upstream schema** — if you can read the target repo's
115
+ `.github/ISSUE_TEMPLATE/*.yml` (for example you are working inside a
116
+ `dflow-sdd-ddd` checkout), use that file; it is authoritative.
117
+ 2. **Bundled field map** — otherwise use the field map in "Upstream Issue
118
+ Forms" below. It is a snapshot of the upstream forms shipped with Dflow.
119
+ 3. **Generic fallback** — only if the feedback matches none of the forms, use
120
+ Step 6.
111
121
 
112
- ```markdown
113
- # Dflow Feedback Draft: {short-title}
122
+ ## Step 5: Render the Draft Field by Field
114
123
 
115
- ## Summary
124
+ Write the draft as one block per upstream field, in the form's field order, so
125
+ the developer copies each block straight into the matching field.
116
126
 
117
- {One or two sentences.}
127
+ Per field-type rules:
118
128
 
119
- ## Type
129
+ | Field type | How to render |
130
+ |---|---|
131
+ | `input` | One short line inside a fenced block. |
132
+ | `textarea` | Multi-line content inside a fenced block. If the field sets a non-empty `render:` attribute, do **not** add an extra fence (the form already code-blocks it). |
133
+ | `dropdown` | State the **recommended option** plus a one-line reason. If `multiple: true`, list the chosen options. |
134
+ | `checkboxes` | List every option as `- [x]` / `- [ ]`; mark any option whose schema sets `required: true`. |
135
+ | `markdown` | Display-only text in the form — produce **no** field block for it. |
136
+ | upload / attachment | Emit a manual step ("drag the relevant screenshot / log into the issue editor"); do not try to handle the file. |
120
137
 
121
- {Bug report | Workflow change request | Documentation feedback | Question | Maintainer process feedback}
138
+ Always start with a **Title** block: the form's title prefix plus a concise
139
+ one-line summary. GitHub pre-fills the prefix in the title box; the developer
140
+ can paste the full line over it.
122
141
 
123
- ## Observed While Using
142
+ Attribute handling: bring `value` / `default` in as starting content; surface
143
+ `placeholder` as a hint; append "(required)" to the block heading when the
144
+ field sets `required: true`.
124
145
 
125
- - Dflow version: {version-or-unknown}
126
- - Command / flow: {command-or-flow}
127
- - Track: {Greenfield | Brownfield | both | unknown}
128
- - Project context: {sanitized generic context}
146
+ **Fence escaping (dynamic).** Wrap each field's content in a backtick fence
147
+ whose length is *(longest backtick run in the content) + 1*, minimum 3. The
148
+ fence is only a local wrapper so the content survives in the draft file — when
149
+ pasting into the issue form, the developer copies the **inner** content, not
150
+ the fence. State this in the draft.
129
151
 
130
- ## Affected Dflow Area
152
+ Draft skeleton:
131
153
 
132
- - {CLI | template | scaffolding | skill reference | tutorial | docs | governance}
133
- - Files or concepts: {sanitized list}
154
+ ````markdown
155
+ # {Issue form name} — {short title}
134
156
 
135
- ## Problem
157
+ ## Where to submit
136
158
 
137
- {What happened, why it is confusing or harmful, and who is affected.}
159
+ https://github.com/weilung/dflow-sdd-ddd/issues/new/choose → choose
160
+ **"{Issue form name}"**. (A GitHub account is all you need; the title is
161
+ auto-prefixed with `{prefix}`.)
138
162
 
139
- ## Expected Behavior or Improvement
163
+ ## Title
164
+
165
+ ```
166
+ {prefix}{concise one-line summary}
167
+ ```
140
168
 
141
- {What Dflow should do or explain instead.}
169
+ ## {Field label} (required)
142
170
 
143
- ## Evidence
171
+ ```
172
+ {field content; copy the inner text only, not this fence}
173
+ ```
144
174
 
145
- {Minimal sanitized observations.}
175
+ ... one block per field, in form order ...
146
176
 
147
- ## Compatibility / Breaking-Change Risk
177
+ ## Before you submit (submitter self-check)
148
178
 
149
- {None | low | medium | high}, with reasoning.
179
+ - [ ] Any real file names / customer names / internal project code names to redact?
180
+ - [ ] If you attach screenshots, do they show sensitive content (internal systems, tokens, passwords)?
181
+ - [ ] Is opening a public issue within what your organization allows?
182
+ ````
150
183
 
151
- ## Suggested GitHub Issue Body
184
+ Keep the draft **submitter-facing only**: no maintainer tracking notes, no
185
+ internal references, no "for your friend / for yourself" audience switches.
152
186
 
153
- {Copy-ready issue body matching the closest issue template.}
187
+ ## Upstream Issue Forms (bundled field map)
154
188
 
155
- ## Optional PR Plan
189
+ > Snapshot of the `weilung/dflow-sdd-ddd` issue forms. If the live `.yml` is
190
+ > reachable (Step 4 priority 1), prefer it. Resync this map when the upstream
191
+ > forms change.
156
192
 
157
- {Only include if the change is small and concrete. Otherwise write "Not recommended yet; start with an issue."}
193
+ ### Bug report — title `[Bug]: `
158
194
 
159
- ## Redaction Checklist
195
+ | Field | Type | Required | Notes |
196
+ |---|---|---|---|
197
+ | Dflow version | input | yes | placeholder `0.2.0` |
198
+ | Node.js version | input | yes | from `node --version` |
199
+ | Project track | dropdown | yes | Greenfield / Brownfield / Not sure |
200
+ | Command or workflow | textarea | yes | the command or `/dflow:*` workflow used |
201
+ | Expected behavior | textarea | yes | |
202
+ | Actual behavior | textarea | yes | include relevant output |
203
+ | Reproduction steps | textarea | yes | smallest steps that reproduce |
204
+ | Additional context | textarea | no | screenshots / snippets / environment |
160
205
 
161
- - [ ] No secrets, tokens, credentials, or auth headers
162
- - [ ] No customer, tenant, or private organization names
163
- - [ ] No proprietary business rules beyond sanitized paraphrase
164
- - [ ] No private repository URLs or internal hostnames
165
- - [ ] No long proprietary source snippets
166
- - [ ] Developer reviewed before submission
167
- ```
206
+ ### Workflow change request — title `[Workflow]: `
207
+
208
+ | Field | Type | Required | Notes |
209
+ |---|---|---|---|
210
+ | Problem | textarea | yes | |
211
+ | Proposed change | textarea | yes | |
212
+ | Affected track | dropdown | yes | Greenfield / Brownfield / Both / Not sure |
213
+ | Affected area | checkboxes | no | CLI command / Generated template / Generated scaffolding / Skill workflow guidance / Tutorial or examples / Documentation only |
214
+ | Compatibility risk | textarea | yes | |
215
+ | Alternatives considered | textarea | no | |
216
+
217
+ ### Documentation feedback — title `[Docs]: `
218
+
219
+ | Field | Type | Required | Notes |
220
+ |---|---|---|---|
221
+ | Affected page or file | input | yes | placeholder `README.md` |
222
+ | Reader goal | textarea | yes | what you were trying to understand or do |
223
+ | What was confusing? | textarea | yes | the missing, unclear, or misleading part |
224
+ | Suggested improvement | textarea | no | optional wording or structure |
225
+
226
+ ### Question — title `[Question]: `
227
+
228
+ | Field | Type | Required | Notes |
229
+ |---|---|---|---|
230
+ | Project type | dropdown | yes | New project / Existing project / Not sure |
231
+ | Dflow track you are considering | dropdown | yes | Greenfield / Brownfield / Not sure |
232
+ | What are you trying to do? | textarea | yes | the workflow or decision you need help with |
233
+ | Project context | textarea | no | framework, team workflow, AI agent, constraints |
234
+
235
+ ## Step 6: Generic Fallback
236
+
237
+ Use this only when the feedback matches none of the forms above. The upstream
238
+ repo disables blank issues, so direct the developer to pick the closest form at
239
+ `https://github.com/weilung/dflow-sdd-ddd/issues/new/choose` and adapt. Emit
240
+ two paste-ready blocks — a `Title` and a `Body` — plus the URL. Do **not** fall
241
+ back to a generic `## Problem` / `## Evidence` Markdown draft.
168
242
 
169
- ## Step 5: Present Submission Options
243
+ ## Step 7: Present Submission Options
170
244
 
171
- After writing the draft, summarize the options:
245
+ After writing the draft, name the draft file path and whether any submitter
246
+ self-check items remain unchecked, then summarize the options:
172
247
 
173
- - Copy the suggested issue body manually into GitHub.
174
- - Use the optional PR plan as implementation guidance in a Dflow source
175
- checkout.
248
+ - Open the chosen issue form and paste each field block.
176
249
  - Discard the draft if it was only a local observation.
177
250
 
178
- Do not submit anything automatically. End by naming the draft file path and
179
- whether any redaction checklist items remain unchecked.
251
+ Do not submit anything automatically.
@@ -11,10 +11,18 @@ state, archives the feature directory, and emits a Git-strategy-neutral
11
11
  **Integration Summary** for the developer's PR / merge / push step.
12
12
 
13
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.
14
+ - This command **does not auto-merge** and never pushes or opens a PR on its
15
+ own. Merge strategy follows the team's selected Git policy (`gitflow` /
16
+ `trunk`, recorded in `dflow/specs/shared/_conventions.md` § Git Policy).
17
+ - Closeout is split into two gates so it works offline: a **Local-closeout
18
+ gate** (Steps 1–4: validation, status flip, BC sync, archive + an optional
19
+ commit checkpoint — all doable with no network) and an **Integration / PR
20
+ gate** (Step 5: push / merge / PR — needs network; the AI only runs
21
+ `git push` / `gh pr create` when you explicitly ask).
22
+ - At the archive checkpoint the AI may offer to commit using your Git identity;
23
+ you can always decline. The commit marker mode is read from `_conventions.md`
24
+ § AI Commit Policy. This replaces Dflow's earlier "the AI never commits"
25
+ stance — the AI helps at natural checkpoints, you keep the final say.
18
26
  - The BC-layer sync in Step 3 **reuses the existing Step 5.3 mechanism**
19
27
  from `new-feature-flow` (Step 8.3) and `modify-existing-flow` (Step
20
28
  5.3) — it does not introduce a new sync flow. Treat it as "lift Step
@@ -42,8 +50,8 @@ AI runs mechanical checks first. Report `✓` / `✗` for every item; if any
42
50
  proceeding (do not flip status, do not archive, do not emit summary).
43
51
 
44
52
  - [ ] 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)
53
+ - [ ] `_index.md` exists and parses (YAML front matter intact, seven required
54
+ sections present, including the Checkpoint Log)
47
55
  - [ ] Every row in `_index.md` Phase Specs table has Status = `completed`
48
56
  - [ ] Every phase-spec file referenced in the Phase Specs table exists at
49
57
  the path the table claims
@@ -89,7 +97,7 @@ Also update the **Resume Pointer** to reflect closeout:
89
97
 
90
98
  ```
91
99
  **Current Progress**: feature completed ({date}); all phase-specs status = completed.
92
- **Next Action**: merge / push (per project Git-principles).
100
+ **Next Action**: integration — push / merge / PR per the selected Git policy.
93
101
  ```
94
102
 
95
103
  **→ Transition (step-internal)**: Step 2 complete. Announce "Step 2 complete (status flipped). Entering Step 3: Sync BR Snapshot to BC layer." and continue.
@@ -187,11 +195,34 @@ the full rule set.
187
195
  After the move, also `git add` any modified files from Step 3 (the
188
196
  updated `rules.md`, `behavior.md`, `events.md`, `context-map.md`,
189
197
  `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
198
 
194
- **→ Transition (step-internal)**: Step 4 complete. Announce "Step 4 complete (feature archived to completed/). Entering Step 5: Emit Integration Summary." and continue.
199
+ **Closeout commit checkpoint** (completes the offline Local-closeout gate):
200
+
201
+ ```
202
+ ✓ Feature archived to completed/ and closeout files staged
203
+ Commit this closeout now?
204
+ [Y] Yes — the AI commits with your Git identity (marker per _conventions.md § AI Commit Policy)
205
+ [N] No — skip; you commit yourself
206
+ ```
207
+
208
+ Whether you choose Y or N, record one row in the feature `_index.md`
209
+ Checkpoint Log (`closeout | committed ({hash})` or `closeout | skipped`). Only
210
+ write a hash after the commit actually succeeds; if a pre-commit hook rejects it
211
+ or the commit fails, record `failed` and surface the error — never write a fake
212
+ hash.
213
+
214
+ The Local-closeout gate is satisfied **only when the closeout is committed**:
215
+ closeout complete, Checkpoint Log updated, and the working tree clean (no
216
+ uncommitted changes). If you declined the commit (chose N) or it failed,
217
+ Local-closeout is **not** satisfied yet — commit the staged closeout yourself
218
+ before continuing; do not enter the Integration / PR gate with uncommitted
219
+ changes. Once committed, the gate stands on its own offline; integration happens
220
+ in Step 5 when you have network.
221
+
222
+ **→ Transition (step-internal)**: Step 4 complete. Branch on whether the closeout commit landed:
223
+
224
+ - **Closeout commit landed (working tree clean)** → announce "Step 4 complete (feature archived; Local-closeout gate satisfied). Entering Step 5: Integration / PR gate." and continue.
225
+ - **Closeout commit was declined (N) or failed** → **stop here.** Announce "Step 4 complete (feature archived), but the Local-closeout gate is not satisfied yet — the closeout is staged but uncommitted. Commit those changes (or address the failure), then resume to Step 5." Do **not** enter Step 5 with uncommitted closeout changes.
195
226
 
196
227
  ## Step 5: Emit Integration Summary (Git-strategy-neutral)
197
228
 
@@ -200,10 +231,10 @@ Produce a plain-text summary of what this feature did. The summary is
200
231
  developer adapts to whichever merge strategy their project uses
201
232
  (merge commit, squash, rebase, fast-forward — Dflow stays neutral).
202
233
 
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.
234
+ The selected Git policy's `Git-principles-{gitflow|trunk}.md` (seeded at init
235
+ under `dflow/specs/shared/`) explains, in its "Integration Commit Message
236
+ Conventions" section, how to format the actual commit / merge message from this
237
+ summary.
207
238
 
208
239
  Format:
209
240
 
@@ -233,10 +264,11 @@ Phase List:
233
264
  - phase-2 ({date}): {phase-slug} — {1 line}
234
265
  - ...
235
266
 
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
267
+ Next Steps (developer) — Integration / PR gate (needs network):
268
+ - Per the selected Git policy (`gitflow` / `trunk` in `_conventions.md`), choose
269
+ a merge strategy (merge commit / squash / rebase / fast-forward) and execute
270
+ - Push to remote / open a PR — the AI can run `git push` / `gh pr create` for
271
+ you, but only when you explicitly ask; it never pushes on its own
240
272
  ```
241
273
 
242
274
  Print the summary to the conversation; do not write it to a file (it is
@@ -254,7 +286,9 @@ the developer:
254
286
  If no `follow-up-of` field, skip Step 6 and announce closeout complete:
255
287
  > "`/dflow:finish-feature` complete for `{SPEC-ID}-{slug}`. Feature
256
288
  > directory is now at `dflow/specs/features/completed/{SPEC-ID}-{slug}/`.
257
- > Stage is set; commit / merge / push at your discretion."
289
+ > If you skipped the closeout commit, commit the staged changes first to
290
+ > finish the Local-closeout gate. Then integration — merge / push / PR —
291
+ > follows the selected Git policy, at your discretion."
258
292
 
259
293
  ## Step 6: Reverse-Update Follow-up Tracking (only if follow-up)
260
294
 
@@ -267,7 +301,7 @@ Follow-up Tracking table.
267
301
  3. Flip Status → `completed`
268
302
 
269
303
  ```bash
270
- # AI does the edit; commits stay with the developer
304
+ # The AI makes the edit and may offer to commit it (Y / N), per the AI commit policy
271
305
  ```
272
306
 
273
307
  After the update: