dflow-sdd-ddd 0.9.0 → 0.11.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 (57) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.en.md +73 -48
  3. package/README.md +46 -36
  4. package/TEMPLATE-COVERAGE.md +0 -1
  5. package/TEMPLATE-LANGUAGE-GLOSSARY.md +1 -0
  6. package/bin/dflow.js +7 -11
  7. package/docs/evaluating-dflow.en.md +11 -7
  8. package/docs/evaluating-dflow.md +9 -4
  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/docs/why-dflow.en.md +72 -0
  16. package/docs/why-dflow.md +72 -0
  17. package/lib/init.js +867 -214
  18. package/package.json +2 -2
  19. package/templates/brownfield/references/drift-verification.md +41 -10
  20. package/templates/brownfield/references/finish-feature-flow.md +3 -2
  21. package/templates/brownfield/references/git-integration.md +0 -1
  22. package/templates/brownfield/references/init-project-flow.md +31 -17
  23. package/templates/brownfield/references/modify-existing-flow.md +44 -38
  24. package/templates/brownfield/references/new-feature-flow.md +41 -11
  25. package/templates/brownfield/references/new-phase-flow.md +9 -2
  26. package/templates/brownfield/references/pr-review-checklist.md +7 -1
  27. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +258 -29
  28. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +5 -8
  29. package/templates/brownfield/scaffolding/_conventions.md +10 -9
  30. package/templates/brownfield/templates/_index.md +1 -1
  31. package/templates/brownfield/templates/context-map.md +12 -4
  32. package/templates/brownfield/templates/lightweight-spec.md +1 -1
  33. package/templates/brownfield/templates/phase-spec.md +1 -1
  34. package/templates/common/references/ddd-modeling-guide.md +643 -0
  35. package/templates/common/skill/SKILL.md +9 -6
  36. package/templates/greenfield/references/drift-verification.md +60 -15
  37. package/templates/greenfield/references/finish-feature-flow.md +3 -2
  38. package/templates/greenfield/references/git-integration.md +0 -1
  39. package/templates/greenfield/references/init-project-flow.md +31 -17
  40. package/templates/greenfield/references/modify-existing-flow.md +5 -7
  41. package/templates/greenfield/references/new-feature-flow.md +49 -19
  42. package/templates/greenfield/references/new-phase-flow.md +5 -2
  43. package/templates/greenfield/references/pr-review-checklist.md +9 -1
  44. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +221 -29
  45. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +10 -15
  46. package/templates/greenfield/scaffolding/Git-principles-trunk.md +1 -1
  47. package/templates/greenfield/scaffolding/_conventions.md +9 -8
  48. package/templates/greenfield/templates/_index.md +1 -1
  49. package/templates/greenfield/templates/aggregate-design.md +6 -0
  50. package/templates/greenfield/templates/context-map.md +13 -4
  51. package/templates/greenfield/templates/events.md +4 -1
  52. package/templates/greenfield/templates/lightweight-spec.md +1 -1
  53. package/templates/greenfield/templates/phase-spec.md +1 -1
  54. package/docs/migrating-to-dflow-v1.md +0 -230
  55. package/templates/brownfield/templates/CLAUDE.md +0 -165
  56. package/templates/greenfield/references/ddd-modeling-guide.md +0 -351
  57. package/templates/greenfield/templates/CLAUDE.md +0 -172
@@ -31,13 +31,16 @@ Dflow 是 Markdown-based 的 workflow 材料加上一個 scaffolding CLI。它
31
31
  各 `/dflow:*` workflow 的可執行步驟定義(step gates、completion checklists、模板)。
32
32
  這個 bundle 在 init 時從 npm 套件投影進專案,因此 workflow 步驟是 self-contained
33
33
  且可達的,任何 clone 都不需要 Dflow source 或 package 在本機安裝。
34
- - 你所選工具的可合併 AI 指示檔(例如 `CLAUDE.md`、`AGENTS.md`、`.github/copilot-instructions.md`)。
35
- 每個都是指向 canonical 指南與 workflow bundle 的薄 shim。
34
+ - 你所選工具的 AI 指示檔或既有檔案中的 marked Dflow block(例如 `CLAUDE.md`、`AGENTS.md`、`.github/copilot-instructions.md`)。
35
+ 每個都把工具指向 canonical 指南與 workflow bundle。
36
36
 
37
37
  `init` **不會**:
38
38
 
39
39
  - 檢查、重構、或遷移你的應用程式碼。
40
- - 覆寫既有的 AI 指示檔;若檔案已存在,Dflow 改在 `dflow/specs/shared/` 下寫入 merge snippet。
40
+ - 覆寫既有 AI 指示檔中的自訂內容;若檔案已存在,Dflow 會刷新
41
+ Dflow-generated shim,已指向 guide 的檔案則保持原樣,其他情況預設在確認
42
+ preview 顯示並附加 marked Dflow block,只有 marker conflict 才寫 fallback
43
+ merge snippet。
41
44
  - 修改你的建構系統、套件管理工具、或相依套件。
42
45
  - 傳送任何資料到外部;它是本機的 scaffolding 指令。
43
46
 
@@ -136,7 +139,9 @@ Dflow 的設計讓試用成本低、退出成本也低:
136
139
 
137
140
  - `init` 完成後,你的專案不依賴已安裝的 `dflow-sdd-ddd` CLI。
138
141
  - 產生的檔案都是純 Markdown;用 `rm -rf dflow/` 加上刪除你不再需要的 AI 指示 shim 檔案,即可從專案中移除 Dflow。
139
- - 既有的專案指示檔(例如原本就存在的 `CLAUDE.md`)不會被 Dflow 修改,因此復原很直接。
142
+ - 既有的專案指示檔(例如原本就存在的 `CLAUDE.md`)若被加入 marked Dflow
143
+ block,刪除該 block 即可復原;但之後再跑 `init` / `configure-agents`
144
+ 會再附加它。
140
145
 
141
146
  這表示評估一輪後,若你決定不採用,不會留下任何永久痕跡。
142
147
 
@@ -45,18 +45,18 @@ selecting Claude Code as a target tool creates a thin shim at the project root:
45
45
 
46
46
  This project uses Dflow for spec-first AI-assisted development.
47
47
 
48
- Before planning or editing code, read and follow:
48
+ For spec-impacting work — a new feature, a change to product, user-facing, or
49
+ domain behavior, a new requirement, or a bug-fix workflow — read and follow:
49
50
 
50
- - `dflow/specs/shared/AI-AGENT-GUIDE.md`
51
+ - `dflow/specs/shared/AI-AGENT-GUIDE.md` — command registry, routing rules, and project context.
52
+ - `dflow/specs/shared/dflow-workflows/` — vendored workflow bundle with executable step definitions.
51
53
 
52
- Keep tool-specific instruction files small. The Dflow guide above is the
53
- single source of truth for project workflow rules, slash-command behavior,
54
- spec locations, and SDD/DDD constraints.
55
-
56
- If your tool supports Markdown imports, the canonical guide is imported
57
- below:
54
+ For routine work (refactors, renames, chores, formatting, dependency bumps, or
55
+ general code questions), proceed normally; you need not read the guide first.
58
56
 
59
- @dflow/specs/shared/AI-AGENT-GUIDE.md
57
+ Keep tool-specific instruction files small. The guide and workflow bundle are
58
+ the authoritative sources for Dflow workflow rules, slash-command behavior,
59
+ spec locations, and SDD/DDD constraints.
60
60
  ```
61
61
 
62
62
  Two things happen when Claude Code starts in this project:
@@ -64,9 +64,11 @@ Two things happen when Claude Code starts in this project:
64
64
  1. Claude Code automatically loads `CLAUDE.md` from the project root into
65
65
  its context. This is Claude Code's standard project instructions
66
66
  mechanism.
67
- 2. The trailing `@dflow/specs/shared/AI-AGENT-GUIDE.md` line uses Claude
68
- Code's Markdown import syntax to inline the canonical Dflow guide. So
69
- Claude Code effectively reads both files as one set of instructions.
67
+ 2. `CLAUDE.md` is a thin pointer: it names the canonical guide but does not
68
+ inline it. The guide is loaded on demand — the `dflow` skill pulls it in
69
+ when relevant work auto-triggers the skill, or the agent follows the
70
+ pointer for spec-impacting work. This keeps the guide out of every
71
+ session's context (progressive disclosure) instead of force-loading it.
70
72
 
71
73
  The canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) is the
72
74
  **command registry and router**: project context (track, tech stack, prose
@@ -79,9 +81,14 @@ checked into your repo, so they travel with the project when cloned. The
79
81
  without Claude-Code-specific edits.
80
82
 
81
83
  If a `CLAUDE.md` already existed in the project, `init` does not overwrite
82
- it. Instead it writes a merge snippet under `dflow/specs/shared/` that you
83
- can paste into your existing `CLAUDE.md` manually. This avoids destroying
84
- custom project instructions you already had.
84
+ custom content. A Dflow-generated shim is refreshed in place; another file
85
+ that already points to `dflow/specs/shared/AI-AGENT-GUIDE.md` is skipped
86
+ without adding a second pointer. Otherwise Dflow shows the change in the
87
+ confirmation preview and appends a marked
88
+ `<!-- dflow-generated: agent-shim START/END -->` block at the end of the file;
89
+ re-running refreshes that same block in place without duplicating it. Dflow
90
+ writes the fallback merge snippet `dflow/specs/shared/CLAUDE-md-snippet.md` only
91
+ when the file contains conflicting or malformed Dflow markers.
85
92
 
86
93
  ## Using Dflow Slash Commands in Claude Code
87
94
 
@@ -225,6 +232,12 @@ This skill does not copy workflow steps; its body points to the canonical
225
232
  `dflow/specs/shared/AI-AGENT-GUIDE.md` (command registry and routing rules) and
226
233
  `dflow/specs/shared/dflow-workflows/` (vendored bundle with executable step
227
234
  definitions).
235
+
236
+ The same edition-neutral skill source is now also projected by `--skills` as a
237
+ project-level skill for Codex (`.agents/skills/dflow/SKILL.md`) and GitHub Copilot
238
+ (`.github/skills/dflow/SKILL.md`); all three follow the same cross-tool
239
+ agentskills.io standard.
240
+
228
241
  Its behavior:
229
242
 
230
243
  - **Auto-triggers on** feature / bug-fix workflows, product/domain behavior
@@ -275,7 +288,7 @@ across tools. Only the root-level shim differs:
275
288
 
276
289
  | Tool | Generated shim | Loads canonical guide via |
277
290
  |---|---|---|
278
- | Claude Code | `CLAUDE.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
291
+ | Claude Code | `CLAUDE.md` | Reads file content directly when starting |
279
292
  | Codex / Copilot coding agent | `AGENTS.md` | Reads file content directly when starting |
280
293
  | GitHub Copilot | `.github/copilot-instructions.md` | Reads file content directly |
281
294
 
@@ -315,16 +328,20 @@ their own approval gates (e.g., "I drafted the spec — do you want me to
315
328
  proceed to implementation?"). Both can fire on the same action; this is
316
329
  expected and not a sign of misconfiguration.
317
330
 
318
- **The `@` import is not recursive.** `CLAUDE.md` imports
319
- `AI-AGENT-GUIDE.md`, but if `AI-AGENT-GUIDE.md` references other files
320
- (e.g., feature specs), those are not auto-loaded — Claude Code reads them
321
- on demand when entering the relevant workflow. This keeps context usage
331
+ **Guide references are not all loaded at once.** `CLAUDE.md` points to
332
+ `AI-AGENT-GUIDE.md`, and the other files `AI-AGENT-GUIDE.md` references
333
+ (e.g., feature specs) are also read on demand — Claude Code reads them
334
+ when entering the relevant workflow. This keeps context usage
322
335
  proportional to active work.
323
336
 
324
337
  **A pre-existing `CLAUDE.md` is preserved.** `init` will not overwrite your
325
- existing project instructions. Look under `dflow/specs/shared/` for the
326
- merge snippet `init` wrote and paste the relevant sections into your
327
- existing `CLAUDE.md` manually.
338
+ custom project instructions. Dflow-generated shims are refreshed in place; it
339
+ skips other files that already point to `AI-AGENT-GUIDE.md`. Otherwise it shows
340
+ the marked Dflow block in the confirmation preview, then refreshes that same
341
+ block in place on later runs.
342
+ If you delete the block, the next `init` / `configure-agents` run appends it
343
+ again. Look under `dflow/specs/shared/` for a fallback merge snippet only when
344
+ there is a marker conflict to resolve manually.
328
345
 
329
346
  **Cross-machine projects work.** `dflow/specs/` is plain Markdown checked
330
347
  into your repo. Anyone cloning the repo and using Claude Code in it will
@@ -40,27 +40,28 @@ commands 是如何被識別的,以及幾個值得了解的 Claude Code 專屬
40
40
 
41
41
  This project uses Dflow for spec-first AI-assisted development.
42
42
 
43
- Before planning or editing code, read and follow:
43
+ For spec-impacting work — a new feature, a change to product, user-facing, or
44
+ domain behavior, a new requirement, or a bug-fix workflow — read and follow:
44
45
 
45
- - `dflow/specs/shared/AI-AGENT-GUIDE.md`
46
+ - `dflow/specs/shared/AI-AGENT-GUIDE.md` — command registry, routing rules, and project context.
47
+ - `dflow/specs/shared/dflow-workflows/` — vendored workflow bundle with executable step definitions.
46
48
 
47
- Keep tool-specific instruction files small. The Dflow guide above is the
48
- single source of truth for project workflow rules, slash-command behavior,
49
- spec locations, and SDD/DDD constraints.
50
-
51
- If your tool supports Markdown imports, the canonical guide is imported
52
- below:
49
+ For routine work (refactors, renames, chores, formatting, dependency bumps, or
50
+ general code questions), proceed normally; you need not read the guide first.
53
51
 
54
- @dflow/specs/shared/AI-AGENT-GUIDE.md
52
+ Keep tool-specific instruction files small. The guide and workflow bundle are
53
+ the authoritative sources for Dflow workflow rules, slash-command behavior,
54
+ spec locations, and SDD/DDD constraints.
55
55
  ```
56
56
 
57
57
  Claude Code 在這個專案中啟動時,會發生兩件事:
58
58
 
59
59
  1. Claude Code 自動從專案根目錄載入 `CLAUDE.md` 到它的 context 中。
60
60
  這是 Claude Code 的標準專案指示機制。
61
- 2. 末尾的 `@dflow/specs/shared/AI-AGENT-GUIDE.md` 這行使用 Claude Code 的
62
- Markdown import 語法,將 canonical Dflow 指南 inline 嵌入。因此 Claude Code
63
- 等效於把兩個檔案當成一組指示來讀取。
61
+ 2. `CLAUDE.md` 是一份薄指標,只指向 canonical 指南、不把它 inline 進來。
62
+ 指南改為按需載入——`dflow` skill 在相關工作自動觸發時把它讀進來,或由
63
+ AI 在做 spec-impacting 工作時跟著指標讀取。指南因此不會被塞進每個 session 的
64
+ context(progressive disclosure),而非每次強制載入。
64
65
 
65
66
  canonical 指南(`dflow/specs/shared/AI-AGENT-GUIDE.md`)是**命令登錄表與路由器**:
66
67
  專案上下文(track、技術棧、文章語言)、`/dflow:*` workflow 表、source-of-truth
@@ -71,9 +72,12 @@ completion checklists)則放在 `init` 投影進專案的 **vendored workflow
71
72
  `CLAUDE.md` shim 刻意保持精簡,這樣 canonical 指南就能在不需要 Claude Code
72
73
  專屬修改的情況下持續演進。
73
74
 
74
- 如果專案中已有 `CLAUDE.md`,`init` 不會覆蓋它。它改為在
75
- `dflow/specs/shared/` 下寫入 merge snippet,讓你手動貼入現有的 `CLAUDE.md`。
76
- 這樣可以避免破壞你已有的自訂專案指示。
75
+ 如果專案中已有 `CLAUDE.md`,`init` 不會覆蓋自訂內容。已是 Dflow-generated shim
76
+ 的檔案會原地刷新;其他已指向 `dflow/specs/shared/AI-AGENT-GUIDE.md` 的檔案會
77
+ 略過,不會新增第二個指標。否則 Dflow 會在確認 preview 顯示並於檔案末尾附加帶有
78
+ `<!-- dflow-generated: agent-shim START/END -->` markers 的 Dflow block;重跑
79
+ 會原地更新同一段,不會重複。只有遇到衝突或 malformed Dflow markers 時,
80
+ 才會改寫 `dflow/specs/shared/CLAUDE-md-snippet.md` fallback merge snippet 讓你手動處理。
77
81
 
78
82
  ## 在 Claude Code 中使用 Dflow Slash Commands
79
83
 
@@ -199,6 +203,11 @@ dflow configure-agents --skills
199
203
  這份 skill 不複製 workflow 步驟,body 指向 canonical
200
204
  `dflow/specs/shared/AI-AGENT-GUIDE.md`(命令登錄表與路由規則)以及
201
205
  `dflow/specs/shared/dflow-workflows/`(含可執行步驟定義的 vendored bundle)。
206
+
207
+ 同一份 edition-neutral skill source,現在也會由 `--skills` 為 Codex
208
+ (`.agents/skills/dflow/SKILL.md`)與 GitHub Copilot(`.github/skills/dflow/SKILL.md`)
209
+ 投影 project-level skill,三家沿用相同的跨工具 agentskills.io 標準。
210
+
202
211
  它的行為:
203
212
 
204
213
  - **自動觸發於** feature / bug-fix workflow、product/domain behavior 變更、新需求、
@@ -239,7 +248,7 @@ canonical 指南(`dflow/specs/shared/AI-AGENT-GUIDE.md`)在各工具之間
239
248
 
240
249
  | 工具 | 產生的 shim | 載入 canonical 指南的方式 |
241
250
  |---|---|---|
242
- | Claude Code | `CLAUDE.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
251
+ | Claude Code | `CLAUDE.md` | 啟動時直接讀取檔案內容 |
243
252
  | Codex / Copilot coding agent | `AGENTS.md` | 啟動時直接讀取檔案內容 |
244
253
  | GitHub Copilot | `.github/copilot-instructions.md` | 直接讀取檔案內容 |
245
254
 
@@ -274,14 +283,16 @@ adapter wrapper 必須保持薄指標,不應複製 workflow 語義。
274
283
  「我已起草 spec —— 你要我繼續進入實作嗎?」)。兩者可能在同一個動作上同時觸發;
275
284
  這是預期行為,不代表設定有誤。
276
285
 
277
- **`@` import 不是遞迴的。** `CLAUDE.md` import 了 `AI-AGENT-GUIDE.md`,但如果
278
- `AI-AGENT-GUIDE.md` 引用了其他檔案(例如 feature spec),那些檔案不會被自動
279
- 載入 —— Claude Code 會在進入對應 workflow 時按需讀取它們。這樣可以讓 context
280
- 用量與正在進行的工作保持比例。
286
+ **指南的引用不會被一次全部載入。** `CLAUDE.md` 指向 `AI-AGENT-GUIDE.md`;而
287
+ `AI-AGENT-GUIDE.md` 引用的其他檔案(例如 feature spec)也是按需載入 —— Claude
288
+ Code 會在進入對應 workflow 時才讀取它們。這樣可以讓 context 用量與正在進行的
289
+ 工作保持比例。
281
290
 
282
- **既有的 `CLAUDE.md` 會被保留。** `init` 不會覆蓋你現有的專案指示。請到
283
- `dflow/specs/shared/` 下找 `init` 寫入的 merge snippet,並手動將相關段落貼入
284
- 你現有的 `CLAUDE.md`。
291
+ **既有的 `CLAUDE.md` 會被保留。** `init` 不會覆蓋你現有的自訂專案指示;已是
292
+ Dflow-generated shim 會原地刷新,其他已指向 `AI-AGENT-GUIDE.md` 的檔案會略過,
293
+ 否則會在確認 preview 顯示要附加的 marked Dflow block,寫入後重跑會原地更新同一段。
294
+ 若你刪除該 block,下一次 `init` / `configure-agents` 會再附加它;只有 marker
295
+ conflict 時才需要到 `dflow/specs/shared/` 找 fallback merge snippet 手動處理。
285
296
 
286
297
  **跨機器專案可正常運作。** `dflow/specs/` 是純 Markdown,已 check in 到你的
287
298
  repo。任何人 clone 該 repo 並在其中使用 Claude Code,都會透過已 commit 的
@@ -48,12 +48,17 @@ a thin shim at the project root:
48
48
 
49
49
  This project uses Dflow for spec-first AI-assisted development.
50
50
 
51
- Before planning or editing code, read and follow:
51
+ For spec-impacting work — a new feature, a change to product, user-facing, or
52
+ domain behavior, a new requirement, or a bug-fix workflow — read and follow:
52
53
 
53
- - `dflow/specs/shared/AI-AGENT-GUIDE.md`
54
+ - `dflow/specs/shared/AI-AGENT-GUIDE.md` — command registry, routing rules, and project context.
55
+ - `dflow/specs/shared/dflow-workflows/` — vendored workflow bundle with executable step definitions.
54
56
 
55
- Keep tool-specific instruction files small. The Dflow guide above is the
56
- single source of truth for project workflow rules, slash-command behavior,
57
+ For routine work (refactors, renames, chores, formatting, dependency bumps, or
58
+ general code questions), proceed normally; you need not read the guide first.
59
+
60
+ Keep tool-specific instruction files small. The guide and workflow bundle are
61
+ the authoritative sources for Dflow workflow rules, slash-command behavior,
57
62
  spec locations, and SDD/DDD constraints.
58
63
  ```
59
64
 
@@ -61,13 +66,14 @@ Two things matter when Codex starts in this project:
61
66
 
62
67
  1. Codex CLI reads `AGENTS.md` as project instructions. This is Codex's
63
68
  standard repository-instruction mechanism.
64
- 2. The Dflow shim does not include a Markdown import line. Unlike the
65
- Claude Code shim, generated `AGENTS.md` does not contain
66
- `@dflow/specs/shared/AI-AGENT-GUIDE.md`.
69
+ 2. The Dflow shim is a thin pointer and does not inline the guide. Generated
70
+ `AGENTS.md` points to `dflow/specs/shared/AI-AGENT-GUIDE.md` with a plain
71
+ Markdown bullet.
67
72
 
68
73
  That means Codex sees the pointer immediately, but the canonical Dflow guide
69
- is not auto-inlined by the shim. Before planning or editing, Codex should
70
- follow the pointer and read `dflow/specs/shared/AI-AGENT-GUIDE.md`. If Codex
74
+ is not auto-inlined by the shim. For spec-impacting work (a feature, a
75
+ behavior change, or a bug fix), Codex should follow the pointer and read
76
+ `dflow/specs/shared/AI-AGENT-GUIDE.md`. If Codex
71
77
  starts answering a Dflow request without mentioning that file, steer it
72
78
  explicitly: "Before continuing, read and follow
73
79
  `dflow/specs/shared/AI-AGENT-GUIDE.md`."
@@ -79,13 +85,25 @@ stays small so the same canonical guide can serve Codex CLI, Claude Code,
79
85
  GitHub Copilot, and other tools.
80
86
 
81
87
  If an `AGENTS.md` already existed in the project, `init` does not overwrite
82
- it. If the existing file does not already point to
83
- `dflow/specs/shared/AI-AGENT-GUIDE.md`, `init` writes a merge snippet under
84
- `dflow/specs/shared/AGENTS-md-snippet.md` that you can merge manually. This
85
- avoids destroying custom project instructions you already had.
86
-
87
- In the `dflow configure-agents --command-adapters` case, the corresponding
88
- snippet path is `dflow/specs/shared/AGENTS-md-command-adapters-snippet.md`.
88
+ custom content. A Dflow-generated shim is refreshed in place; another file
89
+ that already points to `dflow/specs/shared/AI-AGENT-GUIDE.md` is skipped
90
+ without adding a second pointer. Otherwise Dflow shows the change in the
91
+ confirmation preview and appends a marked
92
+ `<!-- dflow-generated: agent-shim START/END -->` block at the end of the file;
93
+ re-running refreshes that same block in place. Dflow writes the fallback merge
94
+ snippet
95
+ `dflow/specs/shared/AGENTS-md-snippet.md` only when the file contains
96
+ conflicting or malformed Dflow markers.
97
+
98
+ With `dflow configure-agents --command-adapters`, the marker-conflict fallback
99
+ splits into two files depending on which markers are broken: when only the
100
+ trigger markers are malformed but the file still points to the canonical guide,
101
+ Dflow writes the trigger-only
102
+ `dflow/specs/shared/AGENTS-md-command-adapters-snippet.md`; any other marker
103
+ conflict (the agent-shim markers are malformed, or the two marked regions overlap
104
+ or straddle) takes the full-shim `dflow/specs/shared/AGENTS-md-snippet.md`. Both
105
+ appear only on a marker conflict;
106
+ see *Codex Behavior With Optional Command Adapters* below.
89
107
 
90
108
  ## Using Dflow Workflow Commands in Codex CLI
91
109
 
@@ -157,9 +175,12 @@ workflows.
157
175
  ### Codex Behavior With Optional Command Adapters
158
176
 
159
177
  For Codex, `dflow configure-agents --command-adapters` strengthens text
160
- triggers only. It does not create Codex command files and it does not add
161
- `.agents/skills/dflow/SKILL.md`. Codex v1 has no Dflow command-file adapter
162
- equivalent to Claude `.claude/commands` or Copilot `.github/prompts`.
178
+ triggers only. It does not create Codex command files. Codex v1 has no Dflow
179
+ command-file adapter equivalent to Claude `.claude/commands` or Copilot
180
+ `.github/prompts`.
181
+
182
+ **Auto-trigger skills come from `--skills`, not `--command-adapters`.** See
183
+ "Codex Behavior With Optional Skills" below.
163
184
 
164
185
  When you select `AGENTS.md - Codex / Copilot coding agent` in
165
186
  `--command-adapters` mode, Dflow writes a trigger list generated from the
@@ -177,21 +198,76 @@ in markers, with zero manual merge. Re-running re-projects that same section in
177
198
  place instead of appending a duplicate.
178
199
 
179
200
  If `AGENTS.md` was edited after Dflow generated it, or is your own custom file,
180
- Dflow leaves it untouched and instead writes the trigger section to a merge
181
- snippet for you to merge manually. In that case the Codex-target merge snippet
182
- filename is `dflow/specs/shared/AGENTS-md-command-adapters-snippet.md`.
201
+ Dflow still preserves the existing content and appends (or refreshes in place)
202
+ the trigger section as an adjacent marked block in `AGENTS.md` through the same
203
+ mechanism. The confirmation preview shows that block first. Dflow falls back to a
204
+ manual-merge snippet only when existing Dflow markers are too broken to edit in
205
+ place safely, and which snippet it writes depends on which markers are broken:
206
+
207
+ - **Only the trigger markers are malformed, while the agent-shim markers and their
208
+ region are otherwise intact (no overlap or straddle), and the file already points
209
+ to the canonical guide.** The guide pointer is already in place, so the snippet
210
+ carries just the trigger section:
211
+ `dflow/specs/shared/AGENTS-md-command-adapters-snippet.md`.
212
+ - **Any other marker conflict** — for example the agent-shim markers themselves
213
+ are malformed, or the agent-shim and trigger marked regions overlap or straddle
214
+ each other. The snippet then carries the full shim (title, guide pointers, and,
215
+ under `--command-adapters`, the trigger section):
216
+ `dflow/specs/shared/AGENTS-md-snippet.md`.
217
+
218
+ Both snippets appear only on a marker conflict. A clean custom `AGENTS.md` with
219
+ no conflicting markers does not produce a snippet at all — Dflow just appends the
220
+ adjacent marked block in place.
221
+
222
+ ### Codex Behavior With Optional Skills (Auto-Trigger)
223
+
224
+ `dflow configure-agents --skills` projects a thin, tool-neutral skill to
225
+ `.agents/skills/dflow/SKILL.md` — Codex's project-level skill path. This gives
226
+ Codex **natural-language auto-trigger on par with Claude Code**: when you
227
+ describe intent like "help me start a new feature", Codex can judge relevance
228
+ from the skill's `description`, suggest the matching `dflow:<id>` workflow, and
229
+ no longer require you to remember a command every time.
230
+
231
+ The skill body and frontmatter (`name` / `description`) are plain text that
232
+ only point to the canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) and
233
+ the vendored workflow bundle. It is the **same source** Claude projects
234
+ (`templates/common/skill/SKILL.md`) — no per-tool content fork. When
235
+ auto-triggered, the skill's contract is to judge intent, suggest the matching
236
+ `dflow:<id>`, and wait for your confirmation before entering a workflow rather
237
+ than running one directly.
238
+
239
+ Re-running `--skills` rewrites the same marker-stamped skill in place
240
+ (idempotent). If a **non**-Dflow file already exists at that path (no
241
+ `<!-- dflow-generated: skill-adapter -->` marker), Dflow does not overwrite it —
242
+ it warns and leaves your file untouched.
243
+
244
+ > GitHub Copilot is supported too: selecting Copilot under `--skills` projects
245
+ > `.github/skills/dflow/SKILL.md` (the same thin skill). Copilot also cross-reads
246
+ > the `.claude`/`.agents` paths; Dflow-generated copies are byte-identical, but a
247
+ > pre-existing non-Dflow `dflow` skill at one of those paths is left untouched and
248
+ > could differ — remove or rename it to avoid a same-name duplicate.
183
249
 
184
250
  ### Version-Control Policy for Generated Artifacts (Codex)
185
251
 
186
252
  Codex does not generate command files, so there is **no derived adapter to
187
- gitignore**. On the Codex side, what you version-control is the `AGENTS.md`
188
- shim and `dflow/` (the canonical guide and specs); the merge helper
189
- `dflow/specs/shared/AGENTS-md-command-adapters-snippet.md` is part of `dflow/`
190
- and is **version-controlled along with `dflow/`**. `--command-adapters` only
191
- strengthens the text triggers in `AGENTS.md` for Codex; it adds no `.claude/`,
192
- `.github/`, or `.agents/` command files, so the Claude / Copilot
193
- "version-control the generated adapter or not" trade-off does not apply on the
194
- Codex side. The adapter version-control policy for other tools is covered in
253
+ gitignore** on the `--command-adapters` side. On the Codex side, what you
254
+ version-control is the `AGENTS.md` shim / marked blocks and `dflow/` (the
255
+ canonical guide and specs). The fallback merge helpers
256
+ (`dflow/specs/shared/AGENTS-md-command-adapters-snippet.md` or
257
+ `dflow/specs/shared/AGENTS-md-snippet.md`) are created only on a marker conflict;
258
+ if one appears, it is part of `dflow/` and is **version-controlled along with
259
+ `dflow/`**. `--command-adapters` only strengthens
260
+ the text triggers in `AGENTS.md` for Codex; it adds no `.claude/`, `.github/`,
261
+ or `.agents/` command files.
262
+
263
+ The one Codex derived artifact comes from `--skills`:
264
+ `.agents/skills/dflow/SKILL.md`. Like Claude's `.claude/skills/dflow/SKILL.md`,
265
+ it is regenerable from the canonical guide and follows the same **recommended
266
+ default** (do not version-control; regenerate after clone with
267
+ `configure-agents --skills`; version-controlling it is also reasonable if your
268
+ team wants auto-trigger immediately after clone — the rule is one consistent
269
+ policy across tools in a project). The adapter / skill version-control policy
270
+ for other tools is covered in
195
271
  [README "Files Created by Init"](../README.en.md#files-created-by-init) and the
196
272
  per-tool guides.
197
273
 
@@ -202,7 +278,7 @@ across tools. Only the root-level shim differs:
202
278
 
203
279
  | Tool | Generated shim | Loads canonical guide via |
204
280
  |---|---|---|
205
- | Claude Code | `CLAUDE.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
281
+ | Claude Code | `CLAUDE.md` | Project instructions load the shim; follow the pointer to read the guide |
206
282
  | Codex / Copilot coding agent | `AGENTS.md` | Project instructions load the shim; Codex must follow the pointer and read the guide |
207
283
  | GitHub Copilot | `.github/copilot-instructions.md` | Reads repository instructions directly |
208
284
 
@@ -220,7 +296,7 @@ root, and keep the Dflow pointer in the nearest relevant `AGENTS.md`.
220
296
 
221
297
  If your team uses both Claude Code and Codex CLI on the same project, no
222
298
  extra Dflow coordination is needed. Both tools use the same canonical guide;
223
- only the shim file and loading mechanism differ.
299
+ only the shim file differs.
224
300
 
225
301
  ## Common Patterns and Gotchas
226
302
 
@@ -230,9 +306,9 @@ locations, or SDD constraints to `AGENTS.md`, those belong in
230
306
  other tools' shims do not drift away from it.
231
307
 
232
308
  **Codex does not inline the Dflow guide from `AGENTS.md`.** The generated
233
- Codex shim has a normal Markdown bullet pointing to the canonical guide, not
234
- an `@...` import. Ask Codex to read `AI-AGENT-GUIDE.md` if it appears to be
235
- working from the shim alone.
309
+ Codex shim has a normal Markdown bullet pointing to the canonical guide. Ask
310
+ Codex to read `AI-AGENT-GUIDE.md` if it appears to be working from the shim
311
+ alone.
236
312
 
237
313
  **`/dflow:*` is not a Codex CLI built-in slash command.** Codex slash commands
238
314
  control the Codex session itself. When raw slash input is intercepted or
@@ -241,9 +317,12 @@ rejected, use the no-slash text form `dflow:<id>`, for example
241
317
  workflow by reading `AI-AGENT-GUIDE.md`.
242
318
 
243
319
  **Codex does not generate command files.** Even with `--command-adapters`,
244
- Codex only strengthens text-trigger guidance in `AGENTS.md` / merge
245
- snippets. Do not expect Codex-specific files under `.claude/commands`,
246
- `.github/prompts`, or `.agents/skills/dflow/SKILL.md`.
320
+ Codex only strengthens text-trigger guidance in marked blocks inside
321
+ `AGENTS.md`; fallback merge snippets are created only on marker conflicts. Do
322
+ not expect Codex-specific **command** files under `.claude/commands` or
323
+ `.github/prompts`. (Auto-trigger **skills** are separate: `--skills` projects
324
+ one to `.agents/skills/dflow/SKILL.md`, see "Codex Behavior With Optional
325
+ Skills" above.)
247
326
 
248
327
  **Do not confuse Codex `/init` with Dflow `init`.** Codex `/init` creates a
249
328
  generic `AGENTS.md` scaffold for Codex. Dflow setup is `dflow init` (or
@@ -262,10 +341,14 @@ approvals.** In current Codex CLI terminology this is
262
341
  Codex can work inside the project and asks before going beyond the sandbox,
263
342
  such as writing outside the workspace or accessing network.
264
343
 
265
- **Existing `AGENTS.md` files are preserved.** If Dflow cannot safely write
266
- the root shim because the file already exists, look under
267
- `dflow/specs/shared/` for the merge snippet and merge the Dflow pointer into
268
- your existing project instructions manually.
344
+ **Existing `AGENTS.md` files are preserved.** Dflow does not overwrite your
345
+ custom project instructions. The base pointer is refreshed in place for a
346
+ Dflow-generated shim; other files that already point to `AI-AGENT-GUIDE.md` are
347
+ skipped. Otherwise Dflow shows and appends a marked Dflow block, then refreshes
348
+ that block in place on later runs. `--command-adapters` can still add or refresh
349
+ the adjacent trigger block. If you delete a block, later `init` /
350
+ `configure-agents` runs append it again. Look under `dflow/specs/shared/` for a
351
+ fallback merge snippet only when there is a marker conflict to resolve manually.
269
352
 
270
353
  **Nested `AGENTS.md` files can change what Codex sees.** Codex layers project
271
354
  instructions along the path to the current working directory. If a subfolder