dflow-sdd-ddd 0.9.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 (46) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.en.md +19 -8
  3. package/README.md +12 -5
  4. package/TEMPLATE-COVERAGE.md +0 -1
  5. package/bin/dflow.js +4 -4
  6. package/docs/evaluating-dflow.en.md +11 -7
  7. package/docs/evaluating-dflow.md +9 -4
  8. package/docs/migrating-to-dflow-v1.md +7 -3
  9. package/docs/using-with-claude-code.en.md +40 -23
  10. package/docs/using-with-claude-code.md +34 -23
  11. package/docs/using-with-codex.en.md +125 -42
  12. package/docs/using-with-codex.md +93 -34
  13. package/docs/using-with-github-copilot.en.md +135 -34
  14. package/docs/using-with-github-copilot.md +120 -43
  15. package/lib/init.js +761 -145
  16. package/package.json +2 -2
  17. package/templates/brownfield/references/drift-verification.md +1 -4
  18. package/templates/brownfield/references/finish-feature-flow.md +3 -2
  19. package/templates/brownfield/references/git-integration.md +0 -1
  20. package/templates/brownfield/references/init-project-flow.md +31 -17
  21. package/templates/brownfield/references/modify-existing-flow.md +6 -38
  22. package/templates/brownfield/references/new-feature-flow.md +13 -11
  23. package/templates/brownfield/references/new-phase-flow.md +1 -1
  24. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +253 -2
  25. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +5 -8
  26. package/templates/brownfield/scaffolding/_conventions.md +10 -9
  27. package/templates/brownfield/templates/_index.md +1 -1
  28. package/templates/brownfield/templates/lightweight-spec.md +1 -1
  29. package/templates/brownfield/templates/phase-spec.md +1 -1
  30. package/templates/common/skill/SKILL.md +9 -6
  31. package/templates/greenfield/references/drift-verification.md +1 -4
  32. package/templates/greenfield/references/finish-feature-flow.md +3 -2
  33. package/templates/greenfield/references/git-integration.md +0 -1
  34. package/templates/greenfield/references/init-project-flow.md +31 -17
  35. package/templates/greenfield/references/modify-existing-flow.md +5 -7
  36. package/templates/greenfield/references/new-feature-flow.md +14 -12
  37. package/templates/greenfield/references/new-phase-flow.md +1 -1
  38. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +222 -2
  39. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +10 -15
  40. package/templates/greenfield/scaffolding/Git-principles-trunk.md +1 -1
  41. package/templates/greenfield/scaffolding/_conventions.md +9 -8
  42. package/templates/greenfield/templates/_index.md +1 -1
  43. package/templates/greenfield/templates/lightweight-spec.md +1 -1
  44. package/templates/greenfield/templates/phase-spec.md +1 -1
  45. package/templates/brownfield/templates/CLAUDE.md +0 -165
  46. package/templates/greenfield/templates/CLAUDE.md +0 -172
@@ -11,10 +11,9 @@
11
11
  > - Use this legacy snippet only if you intentionally want the older
12
12
  > Claude-specific two-H2 layout in your project's root `CLAUDE.md`.
13
13
 
14
- The snippet follows the Dflow `templates/CLAUDE.md` H2 segmentation:
15
- **System Context** (what the system is) and **Development Workflow**
16
- (how we work). Keep those two H2 sections as the backbone when merging
17
- into an existing `CLAUDE.md`.
14
+ The snippet uses a two-H2 segmentation: **System Context** (what the
15
+ system is) and **Development Workflow** (how we work). Keep those two H2
16
+ sections as the backbone when merging into an existing `CLAUDE.md`.
18
17
 
19
18
  ---
20
19
 
@@ -159,9 +158,7 @@ AI 的完整決策樹、Workflow Transparency、Ceremony Scaling 三層判準
159
158
  When merging this snippet into an existing `CLAUDE.md`:
160
159
 
161
160
  1. **Keep the two H2 sections** (`System Context` / `Development Workflow`) as the
162
- backbone. This alignment with the Dflow skill's
163
- `templates/CLAUDE.md` is important — AI assistants navigate by
164
- these headings.
161
+ backbone — AI assistants navigate by these headings.
165
162
  2. **Under `System Context`**: merge the background paragraph and the
166
163
  directory tree. If your project already documents directory
167
164
  structure elsewhere, keep the tree pointing to `dflow/specs/` and
@@ -172,7 +169,7 @@ When merging this snippet into an existing `CLAUDE.md`:
172
169
  cross-referenced from the scaffolding `Git-principles-*.md`.
173
170
  4. **Avoid duplication**: do not re-inline the Dflow skill's decision
174
171
  tree, Workflow Transparency rules, or Ceremony Scaling criteria
175
- into `CLAUDE.md`. Let `CLAUDE.md` point to the skill, not
172
+ into `CLAUDE.md`. Let `CLAUDE.md` point to `AI-AGENT-GUIDE.md` and the workflow bundle, not
176
173
  duplicate it.
177
174
 
178
175
  If you are starting from scratch (no existing `CLAUDE.md`), the
@@ -8,16 +8,17 @@
8
8
  > Audience: engineers writing specs; AI assistants producing spec drafts.
9
9
 
10
10
  This file captures **project-level** conventions only. Template shapes
11
- and Ceremony criteria are defined by the Dflow skill; here we just
12
- record how *this* project fills them in.
11
+ and Ceremony criteria are defined by Dflow itself (the Ceremony tier criteria
12
+ live in `AI-AGENT-GUIDE.md` § Ceremony Scaling; template shapes live in the
13
+ workflow bundle); here we just record how *this* project fills them in.
13
14
 
14
15
  ---
15
16
 
16
17
  ## Where Specs Live
17
18
 
18
19
  All spec documents live under `dflow/specs/`. The feature directory pattern
19
- and file names follow Dflow (see the Dflow skill § "Project Structure
20
- Reference" for the full tree):
20
+ and file names follow Dflow (see `AI-AGENT-GUIDE.md` § Source of Truth
21
+ for the full tree):
21
22
 
22
23
  ```
23
24
  dflow/specs/features/active/{SPEC-ID}-{slug}/
@@ -98,8 +99,8 @@ Project-specific guidance when filling these templates:
98
99
 
99
100
  ## Ceremony Scaling (Project Application)
100
101
 
101
- The Dflow skill defines three tiers — **T1 Heavy / T2 Light / T3
102
- Trivial**. See the Dflow skill § "Ceremony Scaling" for the full
102
+ Dflow defines three tiers — **T1 Heavy / T2 Light / T3
103
+ Trivial**. See `AI-AGENT-GUIDE.md` § Ceremony Scaling for the full
103
104
  criteria table. We do not re-define the tier criteria here; this
104
105
  section records how *this* project applies them in borderline
105
106
  situations.
@@ -111,8 +112,8 @@ situations.
111
112
  | {e.g. UI refresh across multiple entrypoints} | T1 (project convention) | We treat multi-entrypoint UI/API refresh as T1 for this project even though Dflow default would be T2, because these changes often leak into business logic embedded in delivery/entrypoint code (presentation/UI layer, controllers, handlers, jobs, message consumers, data pipelines, or stored procedures) |
112
113
 
113
114
  If the team disagrees on tier classification for a specific change,
114
- run through the T3 four-criteria checklist (in the Dflow skill) and
115
- record the decision here the first time it arises.
115
+ run through the T3 four-criteria checklist (in `AI-AGENT-GUIDE.md` §
116
+ Ceremony Scaling) and record the decision here the first time it arises.
116
117
 
117
118
  ---
118
119
 
@@ -136,5 +137,5 @@ and `/dflow:new-phase` flows; the project-level convention is simply
136
137
  - [System overview](_overview.md)
137
138
  - [Git principles](Git-principles-{gitflow|trunk}.md)
138
139
  - [Glossary](../domain/glossary.md)
139
- - Dflow skill SKILL.md — canonical source for Ceremony Scaling, flow
140
+ - `AI-AGENT-GUIDE.md` — canonical source for Ceremony Scaling, flow
140
141
  selection, and template shapes.
@@ -81,7 +81,7 @@ Template note (for AI):
81
81
  > T3 行:inline 完整描述一句話 + 標籤(如 `[cosmetic]` / `[text]` /
82
82
  > `[format]`);T3 不產獨立 spec 檔
83
83
  >
84
- > Tier 判準見 SKILL.md § Ceremony Scaling 三層表。
84
+ > Tier 判準見 AI-AGENT-GUIDE.md § Ceremony Scaling 三層表。
85
85
 
86
86
  | Date | Tier | Description | Commit |
87
87
  |---|---|---|---|
@@ -11,7 +11,7 @@ branch: bugfix/BUG-{NUMBER}-{short-description}
11
11
  Template note (for AI):
12
12
  This is the **lightweight-spec** template — it corresponds to T2 Light
13
13
  ceremony in the three-tier Ceremony Scaling (T1 Heavy / T2 Light /
14
- T3 Trivial; see SKILL.md § Ceremony Scaling for the tier criteria).
14
+ T3 Trivial; see AI-AGENT-GUIDE.md § Ceremony Scaling for the tier criteria).
15
15
 
16
16
  - T1 Heavy → use templates/phase-spec.md instead
17
17
  - T2 Light → THIS template; produces an independent file
@@ -21,7 +21,7 @@ Template note (for AI):
21
21
 
22
22
  Each section below carries an HTML comment indicating its fill-in activity (Activity 1-4).
23
23
  These activity markers let /dflow:status and the completion checklist track progress.
24
- Activities correspond to SKILL.md § Guiding Questions by Activity:
24
+ Activities correspond to AI-AGENT-GUIDE.md § Guiding Questions by Activity:
25
25
  Activity 1: Understanding (What & Why)
26
26
  Activity 2: Domain Analysis (Where does it live?)
27
27
  Activity 3: Spec Writing (Behavior + Rules + Edge Cases)
@@ -5,12 +5,15 @@ description: >
5
5
  /dflow:* commands (/dflow:new-feature, /dflow:modify-existing, /dflow:bug-fix,
6
6
  /dflow:new-phase, /dflow:finish-feature, /dflow:pr-review, /dflow:verify,
7
7
  /dflow:report-dflow-feedback, /dflow:status, /dflow:next, /dflow:cancel).
8
- SECONDARY (auto-trigger safety net) — engage ONLY for: adding or changing
9
- product/domain behavior, new requirements, a feature or bug-fix workflow, or
10
- spec-impacting architecture/domain-model decisions. Do NOT engage for pure
11
- refactors, infrastructure chores, formatting, or general code questions.
12
- When engaged by natural language, DO NOT auto-enter a workflow: judge the
13
- intent, suggest the matching /dflow: command, and wait for confirmation.
8
+ SECONDARY — engage ONLY for adding or changing product/user-facing/domain
9
+ behavior, a new requirement, a feature or bug-fix workflow, or spec-impacting
10
+ architecture/domain-model decisions. Includes indirect phrasings, e.g. "I want
11
+ to build/add ...", "let's add the ability to ...", "we need to support ...",
12
+ "can you implement ...", "users should be able to ...", "the app should also
13
+ ...". Do NOT engage for pure refactors, renames, infra/build chores,
14
+ formatting, dep bumps, or general code questions ("how does X work", "explain
15
+ this"). When engaged by natural language, DO NOT auto-enter a workflow: judge
16
+ the intent, suggest the matching /dflow: command, and wait for confirmation.
14
17
  ---
15
18
 
16
19
  <!-- dflow-generated: skill-adapter -->
@@ -180,10 +180,7 @@ Recommended trigger points (not enforced — developer's judgment):
180
180
  This command operates entirely within `dflow/specs/domain/{context}/` files
181
181
  (`rules.md`, `behavior.md`, and the `events.md` bonus check). It does
182
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).
183
+ — the feature directory layout is not part of verify's input.
187
184
 
188
185
  ## Interaction with Other Commands
189
186
 
@@ -35,7 +35,7 @@ state, archives the feature directory, and emits a Git-strategy-neutral
35
35
  - Step 5 → Step 6 (Integration Summary emitted → optional follow-up reverse-link)
36
36
 
37
37
  All other step transitions are **step-internal**: announce "Step N complete,
38
- entering Step N+1" and proceed without waiting. See SKILL.md § Workflow
38
+ entering Step N+1" and proceed without waiting. See AI-AGENT-GUIDE.md § Workflow
39
39
  Transparency for the full transparency protocol and confirmation signals.
40
40
 
41
41
  ## Step 1: Validate Phase Specs and `_index.md`
@@ -127,6 +127,8 @@ For each row in Current BR Snapshot where Status = `active`:
127
127
  `rules.md` (REMOVED rule)
128
128
  - For any RENAMED BR-ID → rename the BR-ID in `rules.md` and update
129
129
  `glossary.md` if the term itself changed
130
+ - For every BR-ID added, modified, or renamed above, set its `Last updated`
131
+ date in `rules.md`'s Rule Index to today
130
132
 
131
133
  For `behavior.md`:
132
134
 
@@ -136,7 +138,6 @@ For `behavior.md`:
136
138
  transitions and Domain Events as appropriate
137
139
  - For REMOVED BR-IDs, delete the corresponding scenario section from
138
140
  `behavior.md`
139
- - Update the BR-ID anchor's `last-updated` date in `behavior.md` to today
140
141
 
141
142
  For `events.md`:
142
143
  - Add any new Domain Events introduced by phase-specs in this feature
@@ -182,7 +182,6 @@ diff. That breaks:
182
182
  - `git blame` on lines that crossed the rename boundary
183
183
  - PR diff quality (reviewers see two unrelated big-blob changes
184
184
  instead of one rename + small content diff)
185
- - `/dflow:verify` and other tools that walk feature history
186
185
 
187
186
  This is a known weakness of OpenSpec's directory-rename pattern; Dflow
188
187
  deliberately avoids it by mandating `git mv`.
@@ -54,8 +54,8 @@ Report findings plainly:
54
54
  > - `src/`: contains `MyApp.Domain`, `MyApp.Application`,
55
55
  > `MyApp.Infrastructure`, `MyApp.WebAPI` → Clean Architecture layout
56
56
  > detected
57
- > - `CLAUDE.md`: present → will not overwrite; I'll offer a snippet
58
- > to merge into it"
57
+ > - `CLAUDE.md`: present → I'll append a marked Dflow block (shown in
58
+ > the preview); a merge snippet only if there's a marker conflict"
59
59
 
60
60
  Or:
61
61
 
@@ -173,9 +173,10 @@ Wait for answers.
173
173
  >
174
174
  > If you select any agent, Dflow will create
175
175
  > `dflow/specs/shared/AI-AGENT-GUIDE.md` as the canonical guide. Root-level
176
- > tool files stay thin and point back to that guide. Existing tool files are
177
- > never overwritten; Dflow writes merge snippets under `dflow/specs/shared/`
178
- > instead."
176
+ > tool files stay thin and point back to that guide. Existing user content is
177
+ > never overwritten; Dflow appends a marked Dflow block (shown in the preview)
178
+ > and refreshes it in place on re-run. Merge snippets under
179
+ > `dflow/specs/shared/` are used only if Dflow markers conflict."
179
180
 
180
181
  **→ Transition (step-internal)**: Step 2 complete. Announce
181
182
  > "Step 2 complete (project information captured). Entering Step 3:
@@ -246,16 +247,17 @@ vendored workflow bundle). Compute the destination path:
246
247
  | `scaffolding/Git-principles-trunk.md` | `dflow/specs/shared/Git-principles-trunk.md` |
247
248
  | `scaffolding/AI-AGENT-GUIDE.md` | `dflow/specs/shared/AI-AGENT-GUIDE.md` when at least one AI agent is selected |
248
249
  | generated tool shim | `AGENTS.md`, `CLAUDE.md`, or `.github/copilot-instructions.md` when selected and missing |
249
- | generated merge snippet | `dflow/specs/shared/*-snippet.md` when the selected tool file already exists |
250
+ | marked Dflow block | appended to a selected existing tool file unless it already points to `AI-AGENT-GUIDE.md`; refreshed in place on re-run |
251
+ | fallback merge snippet | `dflow/specs/shared/*-snippet.md` only when the selected tool file has conflicting or malformed Dflow markers |
250
252
 
251
253
  ### 3.3 Present the preview
252
254
 
253
- Present the complete file list as two tables, separating create vs
255
+ Present the complete file list as two tables, separating create / update vs
254
256
  skip, and wait for developer confirmation:
255
257
 
256
258
  > "Based on Step 1 inventory + Step 2 answers, here is what I'll do:
257
259
  >
258
- > **Will create ({N} files):**
260
+ > **Will create / update ({N} files):**
259
261
  >
260
262
  > | Path | Source |
261
263
  > |---|---|
@@ -270,7 +272,7 @@ skip, and wait for developer confirmation:
270
272
  > | `dflow/specs/shared/_overview.md` | optional (you picked it) |
271
273
  > | `dflow/specs/shared/Git-principles-trunk.md` | mandatory (selected Git policy) |
272
274
  > | `dflow/specs/shared/AI-AGENT-GUIDE.md` | selected AI agent guide |
273
- > | `CLAUDE.md` | selected tool shim because repo has no CLAUDE.md |
275
+ > | `CLAUDE.md` | marked Dflow block appended to existing CLAUDE.md (shown in preview) |
274
276
  >
275
277
  > **Will skip ({M} files — already present):**
276
278
  >
@@ -346,11 +348,24 @@ guide.
346
348
  For each selected tool-specific file (`AGENTS.md`, `CLAUDE.md`,
347
349
  `.github/copilot-instructions.md`):
348
350
 
351
+ (checked in this order — the first matching rule wins):
352
+
349
353
  - if the target file does not exist, create a small shim at the target
350
354
  path that points to `dflow/specs/shared/AI-AGENT-GUIDE.md`
351
- - if the target file already exists, do not overwrite it; write a merge
352
- snippet under `dflow/specs/shared/` and report that the developer
353
- should merge it manually
355
+ - if the target file contains conflicting or malformed Dflow markers, do not
356
+ edit it; write a fallback merge snippet under `dflow/specs/shared/` and
357
+ report that the developer should merge it manually
358
+ - if the target file already contains a single well-formed Dflow marked block,
359
+ replace that block in place (idempotent refresh) and keep the rest of the
360
+ file unchanged
361
+ - if the target file is an existing whole-file Dflow-generated shim, refresh it
362
+ in place
363
+ - if the target file already points to the guide through the developer's own
364
+ pointer (and has no Dflow marked block), leave it untouched
365
+ - otherwise preserve the existing content and append a marked Dflow block at
366
+ the end of the file, keeping the file's dominant line ending; show that block
367
+ in the preview, and refresh that same block on re-run. If the developer later
368
+ deletes the block, a later `init` / `configure-agents` run appends it again
354
369
 
355
370
  ### 4.4 Directory-only entries
356
371
 
@@ -380,7 +395,7 @@ Summarise what actually happened and point at the next command.
380
395
  ```
381
396
  Init complete. Summary:
382
397
 
383
- Created ({N} files):
398
+ Created / Updated ({N} files):
384
399
  ✓ dflow/specs/features/active/.gitkeep
385
400
  ✓ dflow/specs/features/completed/.gitkeep
386
401
  ✓ dflow/specs/features/backlog/.gitkeep
@@ -391,7 +406,7 @@ Init complete. Summary:
391
406
  ✓ dflow/specs/architecture/decisions/README.md
392
407
  ✓ dflow/specs/shared/_overview.md
393
408
  ✓ dflow/specs/shared/Git-principles-trunk.md
394
- ✓ CLAUDE.md (seeded from scaffolding snippet)
409
+ ✓ CLAUDE.md (marked Dflow block appended)
395
410
 
396
411
  Skipped ({M} files already present):
397
412
  - (none this run)
@@ -445,10 +460,9 @@ Remind the developer to review files that have `{placeholder}` tokens
445
460
  still in them:
446
461
 
447
462
  > "A few files still have `{placeholder}` tokens that need your input:
448
- > - `dflow/specs/shared/_overview.md`: `{業務領域}`, `{團隊}`,
449
- > `{使用者規模}`
463
+ > - `dflow/specs/shared/_overview.md`: the Business Domain and Technical
464
+ > Architecture fields (e.g. primary domain, stakeholders, user scale, stack)
450
465
  > - `dflow/specs/domain/context-map.md`: context list and relationships
451
- > - `CLAUDE.md`: `{業務領域}`
452
466
  >
453
467
  > These are fine to leave for now; fill them in during your next
454
468
  > review pass."
@@ -2,14 +2,14 @@
2
2
 
3
3
  Step-by-step guide for changing or fixing existing functionality.
4
4
 
5
- Triggered by `/dflow:modify-existing` or `/dflow:bug-fix` (or natural language implying a modification task — see SKILL.md § Workflow Transparency for the auto-trigger safety net).
5
+ Triggered by `/dflow:modify-existing` or `/dflow:bug-fix` (or natural language implying a modification task — see AI-AGENT-GUIDE.md § Workflow Transparency for the auto-trigger safety net).
6
6
 
7
7
  **Step Gates** in this flow (stop-and-confirm before proceeding):
8
8
  - Step 2 → Step 3 (baseline captured → assess DDD impact)
9
9
  - Step 3 → Step 4 (DDD impact decision → implement)
10
10
  - Step 4 → Step 5 (implementation done → update documentation)
11
11
 
12
- All other step transitions are **step-internal**: announce "Step N complete, entering Step N+1" and proceed without waiting. See SKILL.md § Workflow Transparency for the full transparency protocol and confirmation signals.
12
+ All other step transitions are **step-internal**: announce "Step N complete, entering Step N+1" and proceed without waiting. See AI-AGENT-GUIDE.md § Workflow Transparency for the full transparency protocol and confirmation signals.
13
13
 
14
14
  **Note on step count**: Greenfield edition has 5 steps (Brownfield has
15
15
  6) because Clean Architecture's layered structure already separates
@@ -29,7 +29,7 @@ This step has three parallel concerns:
29
29
 
30
30
  **Part A — Determine the Ceremony Tier (T1 / T2 / T3)**
31
31
 
32
- Dflow runs three ceremony tiers (full table in SKILL.md § Ceremony Scaling).
32
+ Dflow runs three ceremony tiers (full table in AI-AGENT-GUIDE.md § Ceremony Scaling).
33
33
  For a modification, AI judges which tier fits before deciding what to
34
34
  produce:
35
35
 
@@ -147,7 +147,7 @@ add a row:
147
147
  | {新 SPEC-ID} | {新 slug} | {today} | in-progress |
148
148
  ```
149
149
 
150
- This update is **part of the same change set** (the developer commits
150
+ This update is **part of the same change set** (offer to commit
151
151
  both at once; commit message should mention "Add follow-up reference to
152
152
  `{新 SPEC-ID}`"). The reverse link is a derived index — the new
153
153
  feature's `follow-up-of` field is the authoritative source.
@@ -158,8 +158,6 @@ phase's content).
158
158
 
159
159
  ## Step 2: Check Documentation
160
160
 
161
- ## Step 2: Check Documentation
162
-
163
161
  - Spec in `dflow/specs/features/completed/`?
164
162
  - Domain model in `dflow/specs/domain/{context}/models.md`?
165
163
  - Business rules in `rules.md`?
@@ -305,7 +303,7 @@ Items marked *(post-5.3)* are re-verified after the documentation merge in 5.3 l
305
303
  - [ ] ORM / persistence mapping is kept outside Domain entities (no persistence attributes/annotations on Domain entities)
306
304
  - [ ] `Implementation Tasks` section (`phase-spec.md` or `lightweight-spec.md`): all tasks checked, or unchecked items explicitly labelled as follow-up
307
305
  - [ ] *(post-5.3)* `dflow/specs/domain/{context}/behavior.md` has a section anchor for every `BR-*` in ADDED / MODIFIED entries; REMOVED entries' anchors have been deleted (mechanical input for `/dflow:verify`)
308
- - [ ] *(post-5.3)* `dflow/specs/domain/{context}/behavior.md` `last-updated` is later than this spec's `created` date (mechanical drift guard)
306
+ - [ ] *(post-5.3)* every ADDED / MODIFIED / RENAMED BR's `Last updated` in `dflow/specs/domain/{context}/rules.md` is later than this spec's `created` date (mechanical drift guard)
309
307
 
310
308
  If any item fails, report the gap and pause — don't proceed to 5.2.
311
309
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Step-by-step guide for adding a new feature with full DDD and Clean Architecture.
4
4
 
5
- Triggered by `/dflow:new-feature` (or natural language implying a new-feature task — see SKILL.md § Workflow Transparency for the auto-trigger safety net behavior).
5
+ Triggered by `/dflow:new-feature` (or natural language implying a new-feature task — see AI-AGENT-GUIDE.md § Workflow Transparency for the auto-trigger safety net behavior).
6
6
 
7
7
  **Step Gates** in this flow (stop-and-confirm before proceeding):
8
8
  - Step 3 → Step 3.5 (Aggregate / VO / Events identified → confirm slug + directory + branch names)
@@ -10,9 +10,9 @@ Triggered by `/dflow:new-feature` (or natural language implying a new-feature ta
10
10
  - Step 6 → Step 7 (branch ready → start implementation)
11
11
  - Step 7 → Step 8 (implementation done → completion)
12
12
 
13
- All other step transitions are **step-internal**: announce "Step N complete, entering Step N+1" and proceed without waiting. See SKILL.md § Workflow Transparency for the full transparency protocol and confirmation signals.
13
+ All other step transitions are **step-internal**: announce "Step N complete, entering Step N+1" and proceed without waiting. See AI-AGENT-GUIDE.md § Workflow Transparency for the full transparency protocol and confirmation signals.
14
14
 
15
- **Ceremony**: this flow always defaults to **T1 Heavy** — the first phase of a brand-new feature is by definition a full SDD cycle. Tier judgement (T1 / T2 / T3) only applies to `/dflow:modify-existing` (see `references/modify-existing-flow.md` and SKILL.md § Ceremony Scaling).
15
+ **Ceremony**: this flow always defaults to **T1 Heavy** — the first phase of a brand-new feature is by definition a full SDD cycle. Tier judgement (T1 / T2 / T3) only applies to `/dflow:modify-existing` (see `references/modify-existing-flow.md` and AI-AGENT-GUIDE.md § Ceremony Scaling).
16
16
 
17
17
  ## Step 1: Intake — Understand the Request
18
18
 
@@ -42,7 +42,7 @@ Check `dflow/specs/domain/context-map.md`:
42
42
  [Context] bounded context. Does that match your understanding?"
43
43
  ```
44
44
 
45
- If new context needed → use context-definition template.
45
+ If a new context is needed → create `dflow/specs/domain/{new-context}/context.md` using the context-definition template (`templates/context-definition.md`).
46
46
 
47
47
  If it crosses contexts:
48
48
  ```
@@ -201,7 +201,7 @@ Scenario: Submit expense report
201
201
  Announce to developer:
202
202
  > "Spec is drafted — behavior scenarios, Aggregate state transitions, Domain Events, and CQRS split are captured. Ready to plan the layer-by-layer implementation (Domain → Application → Infrastructure → Presentation)? `/dflow:next` or reply 'OK' to continue, or tell me if the spec needs another iteration first."
203
203
 
204
- Wait for confirmation (`/dflow:next`, verbal OK, or implicit — see SKILL.md § Confirmation Signals) before entering Step 5.
204
+ Wait for confirmation (`/dflow:next`, verbal OK, or implicit — see AI-AGENT-GUIDE.md § Confirmation Signals) before entering Step 5.
205
205
 
206
206
  ## Step 5: Plan the Implementation (Layer by Layer)
207
207
 
@@ -352,7 +352,7 @@ AI reports `✓` / `✗` for every item before touching docs. Items marked *(pos
352
352
  - [ ] Aggregate invariants still hold after the change (all state changes go through methods, no public setters)
353
353
  - [ ] ORM / persistence mapping is kept outside Domain entities (no persistence attributes/annotations on Domain entities)
354
354
  - [ ] *(post-8.3)* `dflow/specs/domain/{context}/behavior.md` contains a section anchor for every `BR-*` introduced by this spec (mechanical input for `/dflow:verify`)
355
- - [ ] *(post-8.3)* `dflow/specs/domain/{context}/behavior.md` `last-updated` is later than this spec's `created` date (mechanical drift guard)
355
+ - [ ] *(post-8.3)* `dflow/specs/domain/{context}/rules.md` `last-updated` is later than this spec's `created` date (mechanical drift guard)
356
356
 
357
357
  If any item fails, report the gap and pause — don't proceed to 8.2.
358
358
 
@@ -384,12 +384,14 @@ Ask these one-by-one; do not dump all six at once.
384
384
 
385
385
  ### 8.4 Archival
386
386
 
387
- For a single-phase feature, this is the closeout point. For a multi-phase
388
- feature, the developer typically reaches this point at the end of the
389
- final phase — at which time `/dflow:finish-feature` is the recommended
390
- trigger (it bundles steps 8.1 / 8.2 verification, BC sync, and archival
391
- into one explicit ceremony). Either path is acceptable; pick the one
392
- that matches the developer's habit.
387
+ For a single-phase feature, this is the closeout point. If the feature has
388
+ later phases still ahead, this phase is complete but the feature is not —
389
+ don't archive yet; run `/dflow:new-phase` to start the next phase, not
390
+ `/dflow:finish-feature` yet. For a multi-phase feature, the developer
391
+ typically reaches this point at the end of the final phase — at which time
392
+ `/dflow:finish-feature` is the recommended trigger (it bundles steps 8.1 /
393
+ 8.2 verification, BC sync, and archival into one explicit ceremony). Either
394
+ path is acceptable; pick the one that matches the developer's habit.
393
395
 
394
396
  - [ ] `_index.md` `status` field changed to `completed`
395
397
  - [ ] All `phase-spec-*.md` files in the feature directory have `status:
@@ -20,7 +20,7 @@ adds a new phase to an in-progress feature only.
20
20
  - Step 6 → Step 7 (implementation done → complete the phase)
21
21
 
22
22
  All other step transitions are **step-internal**: announce "Step N complete,
23
- entering Step N+1" and proceed without waiting. See SKILL.md § Workflow
23
+ entering Step N+1" and proceed without waiting. See AI-AGENT-GUIDE.md § Workflow
24
24
  Transparency for the full transparency protocol and confirmation signals.
25
25
 
26
26
  ## Step 1: Read Active Feature Context