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
@@ -13,6 +13,42 @@ This project uses Dflow for spec-first AI-assisted development.
13
13
  | Migration / legacy context | {migration-context} |
14
14
  | Prose language | {prose-language} |
15
15
 
16
+ ## Why This Matters
17
+
18
+ This project has business logic embedded in delivery/entrypoint code
19
+ (presentation/UI layer, controllers, handlers, jobs, message consumers, data
20
+ pipelines, or stored procedures), direct SQL in entrypoints, and duplicated
21
+ calculations across multiple flows. Every feature developed without specs makes
22
+ the target architecture harder to reach; every spec written and every domain
23
+ concept extracted makes it easier to reach.
24
+
25
+ Your role is not to lecture — it's to ask the right questions at the right time
26
+ so developers naturally produce three assets with every change:
27
+
28
+ 1. **Spec documents** — future requirements documentation
29
+ 2. **Domain layer code** — portable to a cleaner future architecture
30
+ 3. **Tech debt records** — migration guide entries
31
+
32
+ ## Scope: When Brownfield Applies
33
+
34
+ Dflow Brownfield is designed for existing systems where:
35
+
36
+ - **Business rules and domain concepts** can be extracted and re-expressed as
37
+ portable code (entities, value objects, services, repository interfaces)
38
+ - **Business logic is currently embedded in delivery/entrypoint code** —
39
+ presentation/UI layer, controllers, handlers, jobs, message consumers, data
40
+ pipelines, or stored procedures — making changes risky and slow
41
+ - The team wants to **gradually move toward a cleaner architecture** without a
42
+ full rewrite
43
+
44
+ It is **not** a fit for:
45
+
46
+ - Pure infrastructure scripts (deployment, monitoring) without a stable domain
47
+ model
48
+ - Data pipelines or batch jobs that are purely transformational with no
49
+ business-rule complexity
50
+ - Greenfield projects (use the Greenfield track instead)
51
+
16
52
  ## Before Editing Code
17
53
 
18
54
  Do not jump from a request directly to code. First identify the matching
@@ -28,7 +64,7 @@ are not available in the current AI tool:
28
64
  | `/dflow:bug-fix` | A defect can be described with expected vs actual behavior. |
29
65
  | `/dflow:new-phase` | An active feature needs another implementation slice. |
30
66
  | `/dflow:finish-feature` | Implementation is complete and needs drift closure. |
31
- | `/dflow:verify` | Specs, domain docs, implementation, and tests need consistency checks. |
67
+ | `/dflow:verify` | A bounded context's domain docs (`rules.md` ↔ `behavior.md`) need a consistency / drift check. |
32
68
  | `/dflow:pr-review` | A change is ready for SDD/DDD review. |
33
69
  | `/dflow:report-dflow-feedback` | You found a Dflow issue or improvement and want a sanitized upstream feedback draft. |
34
70
  | `/dflow:status` | You need the current workflow state, current step, completed work, in-progress work, remaining work, pending decision, and next valid action. |
@@ -45,7 +81,7 @@ Machine-readable source for rendering tool-specific thin wrappers:
45
81
  | bug-fix | /dflow:bug-fix | Investigate a defect described by expected vs actual behavior. | expected vs actual | workflow |
46
82
  | new-phase | /dflow:new-phase | Add another implementation slice to an active feature. | feature id or phase goal | workflow |
47
83
  | finish-feature | /dflow:finish-feature | Close implementation with drift checks and archived feature state. | feature id | workflow |
48
- | verify | /dflow:verify | Check specs, domain docs, implementation, and tests for consistency. | area or feature id | workflow |
84
+ | verify | /dflow:verify | Check a bounded context's domain docs (`rules.md` ↔ `behavior.md`) for consistency. | bounded context or all | workflow |
49
85
  | pr-review | /dflow:pr-review | Review a ready change for SDD/DDD alignment. | change or branch | workflow |
50
86
  | report-dflow-feedback | /dflow:report-dflow-feedback | Draft sanitized upstream feedback about Dflow. | issue or improvement | workflow |
51
87
  | status | /dflow:status | Report current workflow state and next valid action. | - | control |
@@ -53,6 +89,27 @@ Machine-readable source for rendering tool-specific thin wrappers:
53
89
  | cancel | /dflow:cancel | Abort the active workflow and return to free conversation. | - | control |
54
90
  <!-- dflow-command-registry:end -->
55
91
 
92
+ ## Routing Non-Command Input
93
+
94
+ Not every developer message maps to a `/dflow:*` workflow. Route non-command
95
+ input like this (supporting files live in the workflow bundle at
96
+ `dflow/specs/shared/dflow-workflows/`):
97
+
98
+ - **"Quick question about..." / "How does X work?"** → check
99
+ `dflow/specs/domain/` first and answer from the documented domain knowledge.
100
+ If no spec exists yet, suggest documenting the answer as domain knowledge.
101
+ - **"What should I work on next?" / sprint planning** → review
102
+ `dflow/specs/features/backlog/` and suggest work based on migration value.
103
+ - **"I'm creating a branch"** → read `references/git-integration.md`; verify
104
+ branch naming and ensure a spec exists before coding starts.
105
+ - **"Dflow seems wrong" / "this template is confusing"** (or you notice Dflow
106
+ guidance drift) → suggest `/dflow:report-dflow-feedback`; never submit
107
+ anything upstream automatically.
108
+ - **Anything else code-related** → assess whether it touches business logic. If
109
+ it does, use the auto-trigger safety net (suggest the matching `/dflow:*`
110
+ command and wait for confirmation — see § Workflow Transparency); if not, help
111
+ directly with no ceremony.
112
+
56
113
  ## Status / Control Commands
57
114
 
58
115
  `/dflow:status` reports active workflow state. Include these fields: workflow,
@@ -71,6 +128,67 @@ workflow was cancelled.
71
128
  When no workflow is active, `/dflow:next` and `/dflow:cancel` must report that
72
129
  there is no active workflow to advance or cancel.
73
130
 
131
+ ## Workflow Transparency
132
+
133
+ Dflow uses a hybrid interaction design: `/dflow:*` commands are the primary
134
+ entry, natural-language auto-trigger is a safety net, and tiered transparency
135
+ keeps the developer aware of where they are in a workflow.
136
+
137
+ ### Auto-Trigger Safety Net
138
+
139
+ When natural language implies a development task, detect the intent — but do
140
+ **not** auto-enter a workflow. Instead:
141
+
142
+ 1. State your judgment clearly:
143
+ > "I think this is a new-feature task."
144
+ 2. Offer the developer three options:
145
+ - Type `/dflow:new-feature` to start explicitly
146
+ - Reply "OK" / "繼續" to confirm this workflow
147
+ - Or correct the workflow (e.g., "no, this is a bug fix")
148
+ 3. Wait for confirmation before entering any workflow.
149
+
150
+ This addresses three failure modes of pure auto-trigger: missed triggers, wrong
151
+ workflow selection, and invisible state.
152
+
153
+ ### Three-Tier Transparency
154
+
155
+ During an active workflow, communicate at three levels — no more, no less:
156
+
157
+ | Level | Trigger point | AI behavior |
158
+ |---|---|---|
159
+ | **Flow entry (must confirm)** | After judging the workflow from NL | Stop and wait for confirmation (command, "OK", or implicit) |
160
+ | **Step gate (notify + optional confirm)** | Before major milestones | Announce the transition; if the developer provides next-step input, treat it as implicit confirmation |
161
+ | **Step-internal (notify only)** | Step N → Step N+1 | Announce "Step N complete, entering Step N+1" — do not wait |
162
+
163
+ The specific step-gate positions for each workflow live in that flow's own file
164
+ (`dflow/specs/shared/dflow-workflows/references/<flow>.md`), which is the source
165
+ of truth for its gate sequence.
166
+
167
+ ### Confirmation Signals (NL ↔ Command Equivalence)
168
+
169
+ Any of these count as "proceed to next step" — accept whichever the developer
170
+ uses:
171
+
172
+ - **Command**: `/dflow:next`
173
+ - **Verbal (English)**: OK / yes / continue / go ahead / sounds good / proceed
174
+ - **Verbal (Chinese)**: 好 / 對 / 繼續 / 可以 / 沒問題
175
+ - **Implicit**: the developer provides the information needed for the next step
176
+ (e.g., the AI asks "Which Bounded Context?" and the developer answers with the
177
+ Bounded Context name → implicit confirmation)
178
+
179
+ The implicit-confirmation rule matters — do not turn every transition into a
180
+ ceremony where the developer must say "OK" before every sentence.
181
+
182
+ ### Completion Checklist Skip Guard
183
+
184
+ Completion checklists and their step ordering live in the flow files and run at
185
+ the gate each flow specifies (the feature-level completion gate in
186
+ `new-feature-flow` / `modify-existing-flow`, the phase-level gate in
187
+ `new-phase-flow`). Do not run a checklist opportunistically. But if the
188
+ developer skips the gate and commits directly, use the auto-trigger safety net
189
+ to prompt — "It looks like you're wrapping up — should I run the Step N
190
+ completion checklist?" — before giving commit guidance.
191
+
74
192
  ## Source of Truth
75
193
 
76
194
  Dflow-owned project documents live under `dflow/specs/`.
@@ -85,6 +203,38 @@ Dflow-owned project documents live under `dflow/specs/`.
85
203
  | Completed feature snapshots | `dflow/specs/features/completed/` |
86
204
  | Technical debt | `dflow/specs/architecture/tech-debt.md` or `dflow/specs/migration/tech-debt.md` |
87
205
 
206
+ ### Project Structure
207
+
208
+ The `dflow/specs/` layout Dflow seeds and maintains (Brownfield track):
209
+
210
+ ```
211
+ dflow/specs/
212
+ ├── shared/ # Project-level governance docs (seeded by npx dflow-sdd-ddd init)
213
+ │ ├── _overview.md # System status & migration strategy
214
+ │ └── _conventions.md # Spec writing conventions
215
+ ├── domain/ # Domain knowledge (DDD preparation)
216
+ │ ├── glossary.md # Ubiquitous Language
217
+ │ └── {bounded-context}/ # e.g., expense/, hr/, leave/
218
+ │ ├── context.md # Context boundary & responsibilities
219
+ │ ├── models.md # Entity, VO, Aggregate definitions
220
+ │ ├── rules.md # Business rules index (BR-ID + one-line)
221
+ │ └── behavior.md # Consolidated behavior (Given/When/Then)
222
+ ├── features/
223
+ │ ├── active/ # Currently in development
224
+ │ │ └── {SPEC-ID}-{slug}/ # One feature = one directory
225
+ │ │ ├── _index.md # Feature dashboard + BR Snapshot + Resume Pointer
226
+ │ │ ├── phase-spec-YYYY-MM-DD-{slug}.md # T1: 0..N phase specs
227
+ │ │ └── lightweight-YYYY-MM-DD-{slug}.md # T2: 0..N lightweight specs
228
+ │ │ # (or BUG-{NUMBER}-{slug}.md)
229
+ │ ├── completed/ # Done (whole feature directory archived here)
230
+ │ └── backlog/ # Planned
231
+ │ #
232
+ │ # SPEC-ID format: SPEC-YYYYMMDD-NNN; slug follows discussion language (中文 / 英文 both OK).
233
+ │ # T3 trivial changes have NO independent file — just a row in _index.md Lightweight Changes.
234
+ └── migration/
235
+ └── tech-debt.md # Issues to fix in the target system
236
+ ```
237
+
88
238
  ## Core Rules
89
239
 
90
240
  1. Spec before code: meaningful behavior changes need a spec or lightweight bug spec before implementation.
@@ -93,6 +243,107 @@ Dflow-owned project documents live under `dflow/specs/`.
93
243
  4. Check drift before calling work complete.
94
244
  5. Follow `dflow/specs/shared/_conventions.md`, especially `## Prose Language`.
95
245
 
246
+ ## Ceremony Scaling
247
+
248
+ Not everything needs full ceremony — match effort to impact. Dflow uses three
249
+ tiers — **T1 Heavy / T2 Light / T3 Trivial** — chosen by the AI per change.
250
+ `/dflow:new-feature` and `/dflow:new-phase` always default to T1 (no judgement
251
+ needed). The criteria below apply when `/dflow:modify-existing` or
252
+ `/dflow:bug-fix` decides which tier fits a modification.
253
+
254
+ | Tier | Scenario | Output | Command / Trigger |
255
+ |---|---|---|---|
256
+ | **T1 Heavy** | New feature, new phase, architectural change, new BR | Independent `phase-spec-YYYY-MM-DD-{slug}.md` placed in the feature directory + `_index.md` Phase Specs row + refresh BR Snapshot | `/dflow:new-feature` / `/dflow:new-phase` |
257
+ | **T2 Light** | Bug fix, UI input validation tweak, flow branch change — has BR Delta | Independent `lightweight-{YYYY-MM-DD}-{slug}.md` (or `BUG-{NUMBER}-{slug}.md`) inside the feature directory + `_index.md` Lightweight Changes row (outbound link) + refresh BR Snapshot | `/dflow:bug-fix` or `/dflow:modify-existing` (lightweight branch) |
258
+ | **T3 Trivial** | Button colour, copy/text fix, typo, formatting, pure comments — **no BR change, no Domain concept change, no data structure change** | **Inline row in `_index.md` Lightweight Changes only** (no independent spec file) | `/dflow:modify-existing` (`_index-only` branch) |
259
+
260
+ **T3 criteria** (the AI must satisfy **all four** before classifying T3):
261
+
262
+ 1. No BR-ID change (no ADDED / MODIFIED / REMOVED / RENAMED business rule)
263
+ 2. No Domain concept added or changed (Aggregate / Entity / VO / Event)
264
+ 3. No data structure change (table, column, relation, index)
265
+ 4. Only changes UI surface (colour, text, layout), pure comments, or pure formatting
266
+
267
+ If any criterion fails → drop to T2; if Domain / BR / data structure is touched → escalate to T1.
268
+
269
+ **Below T3 — Dflow doesn't track at all**: pure typo fixes, commit-message
270
+ typos, pure formatting commits (e.g. `prettier` / `dotnet format` auto-runs).
271
+ You can `git commit` directly without writing even a T3 inline row.
272
+
273
+ **Lightweight spec** = Problem + Expected behavior + 1–2 Given/When/Then. The
274
+ instantiated file is placed inside the feature directory (see
275
+ `templates/lightweight-spec.md`).
276
+
277
+ ## Behavior Source of Truth (rules.md + behavior.md)
278
+
279
+ Each Bounded Context has two complementary files that together describe the
280
+ system's current behavior:
281
+
282
+ - **`rules.md`** — declarative index: lists each BR-ID with a one-line summary.
283
+ Quick lookup, easy to scan.
284
+ - **`behavior.md`** — scenario-level detail: the full Given/When/Then scenarios
285
+ for each BR-ID. This is the consolidated source of truth for "what does the
286
+ system actually do right now?"
287
+
288
+ `dflow/specs/features/completed/` is a historical archive (individual change
289
+ records). `behavior.md` is the **merged current state** — when a feature is
290
+ completed, the AI merges its scenarios into `behavior.md`; when behavior is
291
+ modified, the AI updates the corresponding section to reflect the new behavior
292
+ (git preserves history). See the `behavior.md` template in the workflow bundle
293
+ at `dflow/specs/shared/dflow-workflows/templates/behavior.md`.
294
+
295
+ ## Guiding Questions by Activity
296
+
297
+ SDD has five conceptual activities (Understanding / Domain Analysis / Spec
298
+ Writing / Implementation Planning / Tech Debt Awareness) that the AI walks the
299
+ developer through inside a workflow. They cut across workflow steps — Activity 2
300
+ (Domain Analysis) might span Step 2 and Step 3 of new-feature-flow, for example.
301
+
302
+ When a developer starts working, guide them with these questions in order. Don't
303
+ dump all questions at once — ask naturally as the conversation progresses.
304
+
305
+ **Activity markers in the phase-spec template**: each section in
306
+ `templates/phase-spec.md` carries an HTML comment (e.g.,
307
+ `<!-- Fill timing: Activity 2: Domain Analysis -->`) indicating the activity in
308
+ which that section should be filled. These markers align with the activities
309
+ below and are used by `/dflow:status` and the completion checklist to track
310
+ progress. When guiding a developer, fill sections in activity order; do not jump
311
+ ahead to Activity 4 (Implementation Planning) before Activity 3 (Spec Writing)
312
+ is agreed. The `Implementation Tasks` section at the end of the template is
313
+ produced by the AI at the end of Activity 4 — see new-feature-flow.md Step 5 /
314
+ new-phase-flow.md Step 4 / modify-existing-flow.md Step 4.
315
+
316
+ Note: the phase-spec template HTML comments cover Activity 1–4; Activity 5 (Tech
317
+ Debt Awareness) is a closeout-time concern handled when updating `tech-debt.md`
318
+ during the completion checklist, not via template section markers.
319
+
320
+ ### Activity 1: Understanding (What & Why)
321
+ - What problem does this solve? Who asked for it?
322
+ - What's the expected behavior from the user's perspective?
323
+ - Are there existing specs or domain docs related to this?
324
+
325
+ ### Activity 2: Domain Analysis (Where does it live?)
326
+ - Which Bounded Context does this belong to? (Check dflow/specs/domain/)
327
+ - What domain concepts are involved? (Entities, Value Objects, Services)
328
+ - Are there new terms? → Update glossary.md
329
+ - Are there new or changed business rules? → Document in rules.md
330
+
331
+ ### Activity 3: Spec Writing (Document before coding)
332
+ - Write the spec using the template (see `templates/phase-spec.md`)
333
+ - Define Given/When/Then scenarios for key behaviors
334
+ - Identify edge cases and business rule interactions
335
+
336
+ ### Activity 4: Implementation Planning (How to build it)
337
+ - Can the business logic live in `src/Domain/` as framework-pure code?
338
+ - What interfaces are needed? (Repository, external services)
339
+ - How thin can the delivery/entrypoint code be? (Ideally: parse input → call Domain → return or display result)
340
+
341
+ ### Activity 5: Tech Debt Awareness (What did we find?)
342
+ - Did we discover scattered business logic? → Record in tech-debt.md
343
+ - Are there duplicated calculations? → Record
344
+ - Direct SQL in delivery/entrypoint code? → Record
345
+ - Magic numbers or undocumented statuses? → Record and add to glossary
346
+
96
347
  ## Pre-V1 Artifacts Detection
97
348
 
98
349
  When working in a project that adopted Dflow before `dflow-sdd-ddd@0.1.0`,
@@ -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
@@ -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
 
@@ -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.
@@ -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)
@@ -80,13 +81,30 @@ Template note (for AI):
80
81
  > T3 行:inline 完整描述一句話 + 標籤(如 `[cosmetic]` / `[text]` /
81
82
  > `[format]`);T3 不產獨立 spec 檔
82
83
  >
83
- > Tier 判準見 SKILL.md § Ceremony Scaling 三層表。
84
+ > Tier 判準見 AI-AGENT-GUIDE.md § Ceremony Scaling 三層表。
84
85
 
85
86
  | Date | Tier | Description | Commit |
86
87
  |---|---|---|---|
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
  > 一句話:目前進展到哪?下一個動作是什麼?
@@ -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 -->