dflow-sdd-ddd 0.8.0 → 0.10.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 (52) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/LICENSE +679 -21
  3. package/README.en.md +24 -12
  4. package/README.md +15 -8
  5. package/TEMPLATE-COVERAGE.md +0 -1
  6. package/bin/dflow.js +4 -3
  7. package/docs/evaluating-dflow.en.md +11 -7
  8. package/docs/evaluating-dflow.md +9 -4
  9. package/docs/migrating-to-dflow-v1.md +7 -3
  10. package/docs/using-with-claude-code.en.md +40 -23
  11. package/docs/using-with-claude-code.md +34 -23
  12. package/docs/using-with-codex.en.md +135 -48
  13. package/docs/using-with-codex.md +99 -38
  14. package/docs/using-with-github-copilot.en.md +135 -34
  15. package/docs/using-with-github-copilot.md +120 -43
  16. package/lib/init.js +943 -145
  17. package/package.json +3 -3
  18. package/templates/brownfield/references/dflow-feedback-flow.md +135 -63
  19. package/templates/brownfield/references/drift-verification.md +1 -4
  20. package/templates/brownfield/references/finish-feature-flow.md +59 -23
  21. package/templates/brownfield/references/git-integration.md +65 -7
  22. package/templates/brownfield/references/init-project-flow.md +67 -36
  23. package/templates/brownfield/references/modify-existing-flow.md +10 -38
  24. package/templates/brownfield/references/new-feature-flow.md +28 -11
  25. package/templates/brownfield/references/new-phase-flow.md +16 -1
  26. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +253 -2
  27. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +5 -8
  28. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +13 -12
  29. package/templates/brownfield/scaffolding/Git-principles-trunk.md +13 -16
  30. package/templates/brownfield/scaffolding/_conventions.md +10 -9
  31. package/templates/brownfield/templates/_index.md +21 -3
  32. package/templates/brownfield/templates/lightweight-spec.md +1 -1
  33. package/templates/brownfield/templates/phase-spec.md +1 -1
  34. package/templates/common/skill/SKILL.md +9 -6
  35. package/templates/greenfield/references/dflow-feedback-flow.md +135 -63
  36. package/templates/greenfield/references/drift-verification.md +1 -4
  37. package/templates/greenfield/references/finish-feature-flow.md +58 -23
  38. package/templates/greenfield/references/git-integration.md +65 -7
  39. package/templates/greenfield/references/init-project-flow.md +67 -36
  40. package/templates/greenfield/references/modify-existing-flow.md +9 -7
  41. package/templates/greenfield/references/new-feature-flow.md +29 -12
  42. package/templates/greenfield/references/new-phase-flow.md +16 -1
  43. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +222 -2
  44. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +10 -15
  45. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +13 -12
  46. package/templates/greenfield/scaffolding/Git-principles-trunk.md +14 -18
  47. package/templates/greenfield/scaffolding/_conventions.md +9 -8
  48. package/templates/greenfield/templates/_index.md +21 -3
  49. package/templates/greenfield/templates/lightweight-spec.md +1 -1
  50. package/templates/greenfield/templates/phase-spec.md +1 -1
  51. package/templates/brownfield/templates/CLAUDE.md +0 -165
  52. package/templates/greenfield/templates/CLAUDE.md +0 -172
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dflow-sdd-ddd",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Spec-first SDD/DDD workflow kit for AI-assisted development",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -39,9 +39,9 @@
39
39
  },
40
40
  "homepage": "https://github.com/weilung/dflow-sdd-ddd#readme",
41
41
  "scripts": {
42
- "test": "node test/smoke.mjs"
42
+ "test": "node test/smoke.mjs && node test/registry-parity.mjs && node test/agent-inject.mjs"
43
43
  },
44
- "license": "MIT",
44
+ "license": "AGPL-3.0-or-later",
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  }
@@ -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.
@@ -168,10 +168,7 @@ Recommended trigger points (not enforced — developer's judgment):
168
168
  This command operates entirely within `dflow/specs/domain/{context}/` files
169
169
  (`rules.md` and `behavior.md`). It does **not** read from
170
170
  `dflow/specs/features/active/{SPEC-ID}-{slug}/` directories — the feature
171
- directory layout is not part of verify's input. The only effect of feature directory layout on this command is
172
- ensuring `last-updated` dates in `behavior.md` are bumped at
173
- `/dflow:finish-feature` time (so verify's mechanical drift guard stays
174
- useful).
171
+ directory layout is not part of verify's input.
175
172
 
176
173
  ## Interaction with Other Commands
177
174
 
@@ -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 8.3 mechanism**
19
27
  from `new-feature-flow` — it does not introduce a new sync flow. Treat
20
28
  it as "lift Step 8.3 out of the per-phase checklist and run it once at
@@ -26,7 +34,7 @@ state, archives the feature directory, and emits a Git-strategy-neutral
26
34
  - Step 5 → Step 6 (Integration Summary emitted → optional follow-up reverse-link)
27
35
 
28
36
  All other step transitions are **step-internal**: announce "Step N complete,
29
- entering Step N+1" and proceed without waiting. See SKILL.md § Workflow
37
+ entering Step N+1" and proceed without waiting. See AI-AGENT-GUIDE.md § Workflow
30
38
  Transparency for the full transparency protocol and confirmation signals.
31
39
 
32
40
  ## Step 1: Validate Phase Specs and `_index.md`
@@ -41,8 +49,8 @@ AI runs mechanical checks first. Report `✓` / `✗` for every item; if any
41
49
  proceeding (do not flip status, do not archive, do not emit summary).
42
50
 
43
51
  - [ ] Locate the feature directory at `dflow/specs/features/active/{SPEC-ID}-{slug}/`
44
- - [ ] `_index.md` exists and parses (YAML front matter intact, six required
45
- sections present)
52
+ - [ ] `_index.md` exists and parses (YAML front matter intact, seven required
53
+ sections present, including the Checkpoint Log)
46
54
  - [ ] Every row in `_index.md` Phase Specs table has Status = `completed`
47
55
  - [ ] Every phase-spec file referenced in the Phase Specs table exists at
48
56
  the path the table claims
@@ -88,7 +96,7 @@ Also update the **Resume Pointer** to reflect closeout:
88
96
 
89
97
  ```
90
98
  **Current Progress**: feature completed ({date}); all phase-specs status = completed.
91
- **Next Action**: merge / push (per project Git-principles).
99
+ **Next Action**: integration — push / merge / PR per the selected Git policy.
92
100
  ```
93
101
 
94
102
  **→ Transition (step-internal)**: Step 2 complete. Announce "Step 2 complete (status flipped). Entering Step 3: Sync BR Snapshot to BC layer." and continue.
@@ -116,6 +124,8 @@ For each row in Current BR Snapshot where Status = `active`:
116
124
  `rules.md` (REMOVED rule)
117
125
  - For any RENAMED BR-ID → rename the BR-ID in `rules.md` and update
118
126
  `glossary.md` if the term itself changed
127
+ - For every BR-ID added, modified, or renamed above, set its `Last updated`
128
+ date in `rules.md`'s Rule Index to today
119
129
 
120
130
  For `behavior.md`:
121
131
 
@@ -124,7 +134,6 @@ For `behavior.md`:
124
134
  matching the BR-ID
125
135
  - For REMOVED BR-IDs, delete the corresponding scenario section from
126
136
  `behavior.md`
127
- - Update the BR-ID anchor's `last-updated` date in `behavior.md` to today
128
137
 
129
138
  This is the **mechanical input that `/dflow:verify` later uses** for the
130
139
  rules.md ↔ behavior.md drift check (see `references/drift-verification.md`).
@@ -172,11 +181,35 @@ the full rule set.
172
181
 
173
182
  After the move, also `git add` any modified files from Step 3 (the
174
183
  updated `rules.md`, `behavior.md`, `glossary.md`, `tech-debt.md`, etc.)
175
- into the same stage. AI **does not commit** — the developer commits in
176
- their own preferred manner (and the project's Git-principles decide
177
- whether one commit or several).
184
+ into the same stage.
178
185
 
179
- **→ Transition (step-internal)**: Step 4 complete. Announce "Step 4 complete (feature archived to completed/). Entering Step 5: Emit Integration Summary." and continue.
186
+ **Closeout commit checkpoint** (completes the offline Local-closeout gate):
187
+
188
+ ```
189
+ ✓ Feature archived to completed/ and closeout files staged
190
+ Commit this closeout now?
191
+ [Y] Yes — the AI commits with your Git identity (marker per _conventions.md § AI Commit Policy)
192
+ [N] No — skip; you commit yourself
193
+ ```
194
+
195
+ Whether you choose Y or N, record one row in the feature `_index.md`
196
+ Checkpoint Log (`closeout | committed ({hash})` or `closeout | skipped`). Only
197
+ write a hash after the commit actually succeeds; if a pre-commit hook rejects it
198
+ or the commit fails, record `failed` and surface the error — never write a fake
199
+ hash.
200
+
201
+ The Local-closeout gate is satisfied **only when the closeout is committed**:
202
+ closeout complete, Checkpoint Log updated, and the working tree clean (no
203
+ uncommitted changes). If you declined the commit (chose N) or it failed,
204
+ Local-closeout is **not** satisfied yet — commit the staged closeout yourself
205
+ before continuing; do not enter the Integration / PR gate with uncommitted
206
+ changes. Once committed, the gate stands on its own offline; integration happens
207
+ in Step 5 when you have network.
208
+
209
+ **→ Transition (step-internal)**: Step 4 complete. Branch on whether the closeout commit landed:
210
+
211
+ - **Closeout commit landed (working tree clean)** → announce "Step 4 complete (feature archived; Local-closeout gate satisfied). Entering Step 5: Integration / PR gate." and continue.
212
+ - **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.
180
213
 
181
214
  ## Step 5: Emit Integration Summary (Git-strategy-neutral)
182
215
 
@@ -185,10 +218,10 @@ Produce a plain-text summary of what this feature did. The summary is
185
218
  developer adapts to whichever merge strategy their project uses
186
219
  (merge commit, squash, rebase, fast-forward — Dflow stays neutral).
187
220
 
188
- For projects that adopted the optional Dflow Git-principles scaffolding, the
189
- applicable `scaffolding/Git-principles-{gitflow|trunk}.md` "Integration
190
- Commit Message Conventions" section explains how to format the actual commit
191
- message from this summary.
221
+ The selected Git policy's `Git-principles-{gitflow|trunk}.md` (seeded at init
222
+ under `dflow/specs/shared/`) explains, in its "Integration Commit Message
223
+ Conventions" section, how to format the actual commit / merge message from this
224
+ summary.
192
225
 
193
226
  Format:
194
227
 
@@ -212,10 +245,11 @@ Phase List:
212
245
  - phase-2 ({date}): {phase-slug} — {1 line}
213
246
  - ...
214
247
 
215
- Next Steps (developer):
216
- - Per the project's Git-principles, choose a merge strategy (merge commit /
217
- squash / rebase / fast-forward) and execute
218
- - Push to remote / open a PR
248
+ Next Steps (developer) — Integration / PR gate (needs network):
249
+ - Per the selected Git policy (`gitflow` / `trunk` in `_conventions.md`), choose
250
+ a merge strategy (merge commit / squash / rebase / fast-forward) and execute
251
+ - Push to remote / open a PR — the AI can run `git push` / `gh pr create` for
252
+ you, but only when you explicitly ask; it never pushes on its own
219
253
  ```
220
254
 
221
255
  Print the summary to the conversation; do not write it to a file (it is
@@ -233,7 +267,9 @@ the developer:
233
267
  If no `follow-up-of` field, skip Step 6 and announce closeout complete:
234
268
  > "`/dflow:finish-feature` complete for `{SPEC-ID}-{slug}`. Feature
235
269
  > directory is now at `dflow/specs/features/completed/{SPEC-ID}-{slug}/`.
236
- > Stage is set; commit / merge / push at your discretion."
270
+ > If you skipped the closeout commit, commit the staged changes first to
271
+ > finish the Local-closeout gate. Then integration — merge / push / PR —
272
+ > follows the selected Git policy, at your discretion."
237
273
 
238
274
  ## Step 6: Reverse-Update Follow-up Tracking (only if follow-up)
239
275
 
@@ -246,7 +282,7 @@ Follow-up Tracking table.
246
282
  3. Flip Status → `completed`
247
283
 
248
284
  ```bash
249
- # AI does the edit; commits stay with the developer
285
+ # The AI makes the edit and may offer to commit it (Y / N), per the AI commit policy
250
286
  ```
251
287
 
252
288
  After the update:
@@ -6,9 +6,10 @@ agnostic about which Git *branching strategy* your project adopts (Git Flow,
6
6
  GitHub Flow, trunk-based, single-`main`, etc.) — it only prescribes the
7
7
  feature-branch-per-feature convention that SDD traceability depends on.
8
8
 
9
- > If your project adopts Git Flow specifically, see the optional
10
- > optional `scaffolding/Git-principles-gitflow.md` template
11
- > for Git-Flow-specific conventions.
9
+ > Dflow does not pick `gitflow` vs `trunk` for you, but it now requires you to
10
+ > record one at `dflow init` so the runtime branch gate and finish-stage merge
11
+ > guidance can adapt. The selected policy's `Git-principles-{gitflow|trunk}.md`
12
+ > is seeded under `dflow/specs/shared/`.
12
13
 
13
14
  ## Branch-to-Workflow Mapping
14
15
 
@@ -103,6 +104,64 @@ This requirement is independent of the branching strategy — whether you
103
104
  branch off `develop`, `main`, or something else, the feature-per-branch
104
105
  convention stays.
105
106
 
107
+ ## Commit Checkpoints, Branch Gate & AI Commits
108
+
109
+ Dflow actively helps keep the Git trace aligned with the workflow — the AI
110
+ reminds, can do the work, and leaves policy to the team.
111
+
112
+ ### Branch gate
113
+
114
+ Before implementation starts (and before the first commit), the AI checks
115
+ whether the current branch is the feature / bugfix branch this work belongs to.
116
+ Both Git policies (`gitflow` / `trunk`, per `dflow/specs/shared/_conventions.md`
117
+ § Git Policy) use a feature branch, so:
118
+
119
+ - **Already on the matching `feature/{SPEC-ID}-{slug}` (or
120
+ `bugfix/{BUG-ID}-{slug}`) branch** — e.g. continuing an active feature with
121
+ `new-phase`, `modify-existing`, or `bug-fix` — the gate is satisfied; nothing
122
+ is created or switched.
123
+ - **Not on this work's feature / bugfix branch** (you are on the base branch the
124
+ project cuts features from — `main` / `develop` / `trunk`, or whatever your
125
+ policy uses — or on an unrelated branch) — the AI offers to create and switch
126
+ to the correct branch, switch to an existing matching one, or override and
127
+ stay (recorded in the feature `_index.md` Checkpoint Log; three consecutive
128
+ overrides → the AI suggests re-running `dflow init`, never changing the
129
+ setting on its own).
130
+
131
+ Dflow does not need to identify your base branch to evaluate the gate — it only
132
+ checks whether you are on the right feature branch. The base branch matters only
133
+ when a new branch is actually created, and which base to cut from is your
134
+ project's decision (GitFlow → `develop`, Trunk / GitHub Flow → `main`).
135
+
136
+ ### Commit checkpoints
137
+
138
+ At lifecycle milestones the AI offers a commit checkpoint, folded into the
139
+ existing Step Gate prompt (it does not add a separate question):
140
+
141
+ ```
142
+ ✓ {milestone} complete
143
+ Commit here?
144
+ [Y] Yes — the AI commits with your Git identity (marker per _conventions.md § AI Commit Policy)
145
+ [N] No — skip this checkpoint
146
+ ```
147
+
148
+ Tier sets how many checkpoints a change has: T1 three (spec / implementation /
149
+ closeout), T2 two (spec+implementation merged / closeout), T3 a single commit.
150
+ Whether you choose Y or N, the AI records one row in the feature `_index.md`
151
+ Checkpoint Log. A commit hash is written only after the commit succeeds; a hook
152
+ rejection or failed commit is recorded as `failed` (never a fake hash). After
153
+ several consecutive skips in a project the AI mentions you can turn checkpoints
154
+ off in config — it does not turn them off for you.
155
+
156
+ ### AI commits
157
+
158
+ The AI may commit at these checkpoints using your Git identity; you can always
159
+ decline. How AI commits are marked is the `## AI Commit Policy` setting in
160
+ `_conventions.md` (`none` / `co-authored-by` / `prefix`), chosen once at init.
161
+ This is a deliberate reversal of Dflow's earlier "the AI never commits" stance:
162
+ the AI helps at natural break points, while merge / push / PR still follow the
163
+ team's policy and your explicit go-ahead.
164
+
106
165
  ## Directory Moves Must Use `git mv`
107
166
 
108
167
  When you rename or move a directory or file that is tracked in Dflow
@@ -122,7 +181,6 @@ diff. That breaks:
122
181
  - `git blame` on lines that crossed the rename boundary
123
182
  - PR diff quality (reviewers see two unrelated big-blob changes
124
183
  instead of one rename + small content diff)
125
- - `/dflow:verify` and other tools that walk feature history
126
184
 
127
185
  This is a known weakness of OpenSpec's directory-rename pattern; Dflow
128
186
  deliberately avoids it by mandating `git mv`.
@@ -255,9 +313,9 @@ AI should verify:
255
313
  - [ ] If business logic was touched, evaluate Domain extraction
256
314
 
257
315
  > The exact merge strategy (merge commit, squash, rebase, fast-forward)
258
- > is a project-level decision and sits outside Dflow's scope. See your
259
- > project's Git-principles document (e.g. the optional
260
- > Git-principles scaffolding) for integration commit conventions.
316
+ > follows the team's selected Git policy. See the seeded
317
+ > `Git-principles-{gitflow|trunk}.md` under `dflow/specs/shared/` for that
318
+ > policy's integration commit conventions.
261
319
 
262
320
  ## Commit Message Convention
263
321