dflow-sdd-ddd 0.2.0 → 0.4.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 (41) hide show
  1. package/CHANGELOG.md +971 -0
  2. package/README.en.md +345 -0
  3. package/README.md +213 -159
  4. package/docs/evaluating-dflow.en.md +238 -0
  5. package/docs/evaluating-dflow.md +94 -151
  6. package/docs/examples-by-stack.md +516 -0
  7. package/docs/migrating-to-dflow-v1.md +28 -10
  8. package/docs/release-versioning-policy.md +13 -0
  9. package/docs/using-with-claude-code.en.md +210 -0
  10. package/docs/using-with-claude-code.md +108 -124
  11. package/docs/using-with-codex.en.md +248 -0
  12. package/docs/using-with-codex.md +137 -157
  13. package/docs/using-with-gemini-cli.en.md +200 -0
  14. package/docs/using-with-gemini-cli.md +184 -0
  15. package/docs/using-with-github-copilot.en.md +136 -0
  16. package/docs/using-with-github-copilot.md +177 -0
  17. package/docs/why-ddd-for-ai.en.md +37 -0
  18. package/docs/why-ddd-for-ai.md +19 -17
  19. package/lib/init.js +187 -24
  20. package/package.json +1 -1
  21. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +2 -1
  22. package/templates/brownfield/scaffolding/CLAUDE-md-snippet.md +32 -22
  23. package/templates/brownfield/scaffolding/Git-principles-gitflow.md +1 -1
  24. package/templates/brownfield/scaffolding/Git-principles-trunk.md +1 -1
  25. package/templates/brownfield/scaffolding/_conventions.md +1 -1
  26. package/templates/brownfield/scaffolding/_overview.md +40 -29
  27. package/templates/brownfield/templates/CLAUDE.md +26 -18
  28. package/templates/brownfield/templates/context-definition.md +4 -4
  29. package/templates/brownfield/templates/context-map.md +1 -1
  30. package/templates/brownfield/templates/lightweight-spec.md +3 -1
  31. package/templates/brownfield/templates/models.md +1 -1
  32. package/templates/brownfield/templates/phase-spec.md +33 -28
  33. package/templates/brownfield/templates/tech-debt.md +2 -2
  34. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +2 -1
  35. package/templates/greenfield/scaffolding/CLAUDE-md-snippet.md +14 -13
  36. package/templates/greenfield/scaffolding/Git-principles-gitflow.md +2 -2
  37. package/templates/greenfield/scaffolding/Git-principles-trunk.md +2 -2
  38. package/templates/greenfield/scaffolding/_conventions.md +1 -1
  39. package/templates/greenfield/scaffolding/_overview.md +29 -11
  40. package/templates/greenfield/templates/CLAUDE.md +6 -6
  41. package/templates/greenfield/templates/phase-spec.md +24 -21
@@ -0,0 +1,248 @@
1
+ # Using Dflow with Codex CLI
2
+
3
+ > [繁體中文](using-with-codex.md) | **English**
4
+
5
+ A walk-through of what Dflow looks like when your AI coding agent is
6
+ [Codex CLI](https://developers.openai.com/codex/cli). About 10 minutes to
7
+ read.
8
+
9
+ This guide focuses on the Codex CLI experience specifically. For the
10
+ tool-neutral evaluation flow, see
11
+ [`docs/evaluating-dflow.en.md`](evaluating-dflow.en.md). For the full Get Started
12
+ and feature list, see [`README.md`](../README.en.md).
13
+
14
+ ## Who This Guide Is For
15
+
16
+ You are using or evaluating Dflow with Codex CLI as your AI coding agent.
17
+ This guide covers what Codex sees after `init`, how the `AGENTS.md` shim
18
+ points to the canonical Dflow guide, and the Codex-specific command and
19
+ permission patterns worth knowing.
20
+
21
+ You do not need to read this before running `init`. It is most useful after
22
+ you have run `init` once and want to understand what Codex CLI is actually
23
+ loading.
24
+
25
+ ## Prerequisites
26
+
27
+ - Codex CLI installed and authenticated (see
28
+ [developers.openai.com/codex/cli](https://developers.openai.com/codex/cli)).
29
+ - Node.js / npm available (Dflow ships through npm). Install globally with
30
+ `npm install -g dflow-sdd-ddd`, or use `npx dflow-sdd-ddd` for the no-install path.
31
+ - A project directory you are comfortable initializing in. A branch or a
32
+ disposable sample project is recommended for first contact; see the
33
+ [evaluator guide playbook](evaluating-dflow.en.md#a-30-minute-evaluation-playbook).
34
+ - Codex started from the initialized project root, or with `codex --cd` set
35
+ to that root, so Codex's `AGENTS.md` discovery includes the Dflow shim.
36
+
37
+ Running Dflow workflows does not require a separate Dflow service or API key.
38
+ The workflows are Markdown-based instructions and project files.
39
+
40
+ ## What Codex CLI Sees After `init`
41
+
42
+ Running `dflow init` (or `npx dflow-sdd-ddd init` on the no-install path) and
43
+ selecting `AGENTS.md - Codex / Copilot coding agent` as a target tool creates
44
+ a thin shim at the project root:
45
+
46
+ ```markdown
47
+ # AGENTS.md - Dflow Project Instructions
48
+
49
+ This project uses Dflow for spec-first AI-assisted development.
50
+
51
+ Before planning or editing code, read and follow:
52
+
53
+ - `dflow/specs/shared/AI-AGENT-GUIDE.md`
54
+
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
+ spec locations, and SDD/DDD constraints.
58
+ ```
59
+
60
+ Two things matter when Codex starts in this project:
61
+
62
+ 1. Codex CLI reads `AGENTS.md` as project instructions. This is Codex's
63
+ standard repository-instruction mechanism.
64
+ 2. The Dflow shim does not include a Markdown import line. Unlike the
65
+ Claude Code and Gemini shims, generated `AGENTS.md` does not contain
66
+ `@dflow/specs/shared/AI-AGENT-GUIDE.md`.
67
+
68
+ 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
71
+ starts answering a Dflow request without mentioning that file, steer it
72
+ explicitly: "Before continuing, read and follow
73
+ `dflow/specs/shared/AI-AGENT-GUIDE.md`."
74
+
75
+ The canonical guide is where the real workflow rules live: project context
76
+ (track, tech stack, prose language), the Dflow workflow table,
77
+ source-of-truth file paths, and core SDD/DDD rules. The `AGENTS.md` shim
78
+ stays small so the same canonical guide can serve Codex CLI, Claude Code,
79
+ Gemini CLI, GitHub Copilot, and other tools.
80
+
81
+ 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
+ ## Using Dflow Workflow Commands in Codex CLI
88
+
89
+ Codex CLI has its own built-in slash command layer for controlling the CLI
90
+ session. Commands such as `/permissions`, `/model`, `/status`, `/diff`,
91
+ `/review`, and `/init` are Codex CLI controls, not Dflow workflows.
92
+
93
+ Dflow's `/dflow:*` entries are workflow names recognized by the AI through
94
+ `AI-AGENT-GUIDE.md`, not registered Codex CLI commands. Raw
95
+ `/dflow:new-feature` passthrough behavior in Codex CLI should be verified
96
+ with the maintainer for the supported Codex version. The reliable form is to
97
+ name the workflow as a plain chat instruction:
98
+
99
+ ```text
100
+ Run the Dflow /dflow:new-feature workflow.
101
+ ```
102
+
103
+ If your Codex CLI version passes unknown slash-prefixed input through to the
104
+ model, this shorter form may also work (verify with maintainer):
105
+
106
+ ```text
107
+ /dflow:new-feature
108
+ ```
109
+
110
+ If Codex reports an unknown slash command, re-send the request in prose:
111
+
112
+ ```text
113
+ Treat /dflow:new-feature as a Dflow workflow name, not as a Codex CLI
114
+ command. Read dflow/specs/shared/AI-AGENT-GUIDE.md and start that workflow.
115
+ ```
116
+
117
+ A typical conversation looks like:
118
+
119
+ ```text
120
+ You: Run the Dflow /dflow:new-feature workflow.
121
+
122
+ Codex CLI: I'll read dflow/specs/shared/AI-AGENT-GUIDE.md first, then use the
123
+ new-feature workflow. Please describe the user-visible capability or business
124
+ behavior you want to add.
125
+
126
+ You: Allow expense submitters to attach a receipt image when filing an
127
+ expense.
128
+
129
+ Codex CLI: I'll start by drafting a feature spec under
130
+ dflow/specs/features/active/. Before I do, I have a few clarifying questions.
131
+ ```
132
+
133
+ The workflow then walks you through spec drafting, behavior examples,
134
+ implementation planning, and finish-feature drift checks. The exact
135
+ sequence depends on which workflow you entered (`/dflow:new-feature`,
136
+ `/dflow:modify-existing`, `/dflow:bug-fix`, etc.).
137
+
138
+ Available workflow entry points:
139
+
140
+ | Workflow | Use when |
141
+ |---|---|
142
+ | `/dflow:new-feature` | A new user-visible capability or business behavior is requested. |
143
+ | `/dflow:modify-existing` | Existing behavior needs to change. |
144
+ | `/dflow:bug-fix` | A defect can be described with expected vs actual behavior. |
145
+ | `/dflow:new-phase` | An active feature needs another implementation slice. |
146
+ | `/dflow:finish-feature` | Implementation is complete and needs drift closure. |
147
+ | `/dflow:verify` | Specs, domain docs, implementation, and tests need consistency checks. |
148
+ | `/dflow:pr-review` | A change is ready for SDD/DDD review. |
149
+ | `/dflow:report-dflow-feedback` | You found a Dflow issue or improvement and want a sanitized upstream feedback draft. |
150
+
151
+ If you forget a workflow name, ask Codex to read
152
+ `dflow/specs/shared/AI-AGENT-GUIDE.md` and list the available Dflow
153
+ workflows.
154
+
155
+ ## Differences vs Other AI Tools
156
+
157
+ The canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) is identical
158
+ across tools. Only the root-level shim differs:
159
+
160
+ | Tool | Generated shim | Loads canonical guide via |
161
+ |---|---|---|
162
+ | Claude Code | `CLAUDE.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
163
+ | Codex / Copilot coding agent | `AGENTS.md` | Project instructions load the shim; Codex must follow the pointer and read the guide |
164
+ | Gemini CLI | `GEMINI.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
165
+ | GitHub Copilot | `.github/copilot-instructions.md` | Reads repository instructions directly |
166
+
167
+ You can run `dflow configure-agents` later to add another tool's shim
168
+ without re-running `init`. Multiple tools can be active in the same project
169
+ and stay synchronized via the canonical guide.
170
+
171
+ Codex also has its own project-instruction layering. It can read global
172
+ instructions from Codex home and project instructions from `AGENTS.md` files
173
+ between the project root and the current working directory. For Dflow, the
174
+ important practical rule is simple: start Codex at the initialized project
175
+ root, and keep the Dflow pointer in the nearest relevant `AGENTS.md`.
176
+
177
+ If your team uses both Claude Code and Codex CLI on the same project, no
178
+ extra Dflow coordination is needed. Both tools use the same canonical guide;
179
+ only the shim file and loading mechanism differ.
180
+
181
+ ## Common Patterns and Gotchas
182
+
183
+ **Keep `AGENTS.md` thin.** If you find yourself adding workflow rules, spec
184
+ locations, or SDD constraints to `AGENTS.md`, those belong in
185
+ `dflow/specs/shared/AI-AGENT-GUIDE.md` instead. The shim stays small so that
186
+ other tools' shims do not drift away from it.
187
+
188
+ **Codex does not inline the Dflow guide from `AGENTS.md`.** The generated
189
+ Codex shim has a normal Markdown bullet pointing to the canonical guide, not
190
+ an `@...` import. Ask Codex to read `AI-AGENT-GUIDE.md` if it appears to be
191
+ working from the shim alone.
192
+
193
+ **`/dflow:*` is not a Codex CLI built-in slash command.** Codex slash
194
+ commands control the Codex session itself. Use Dflow workflow names as plain
195
+ chat instructions when raw slash input is intercepted or rejected. Raw
196
+ `/dflow:*` passthrough behavior should be verified with the maintainer for
197
+ the supported Codex version.
198
+
199
+ **Do not confuse Codex `/init` with Dflow `init`.** Codex `/init` creates a
200
+ generic `AGENTS.md` scaffold for Codex. Dflow setup is `dflow init` (or
201
+ `npx dflow-sdd-ddd init` on the no-install path), and adding later tool shims
202
+ is `dflow configure-agents`.
203
+
204
+ **Permission gates and Dflow workflow gates are separate.** Codex may ask
205
+ permission to run a command, edit outside the workspace, or access network
206
+ depending on its sandbox and approval settings. Dflow workflows have their
207
+ own approval gates, such as confirming a spec before implementation. Both
208
+ can appear in the same session; this is expected.
209
+
210
+ **The common Codex local-work preset is workspace write plus on-request
211
+ approvals.** In current Codex CLI terminology this is
212
+ `--sandbox workspace-write --ask-for-approval on-request`. In that mode,
213
+ Codex can work inside the project and asks before going beyond the sandbox,
214
+ such as writing outside the workspace or accessing network.
215
+
216
+ **Existing `AGENTS.md` files are preserved.** If Dflow cannot safely write
217
+ the root shim because the file already exists, look under
218
+ `dflow/specs/shared/` for the merge snippet and merge the Dflow pointer into
219
+ your existing project instructions manually.
220
+
221
+ **Nested `AGENTS.md` files can change what Codex sees.** Codex layers project
222
+ instructions along the path to the current working directory. If a subfolder
223
+ has its own `AGENTS.md` or `AGENTS.override.md`, make sure it does not hide
224
+ or contradict the Dflow pointer you expect Codex to follow.
225
+
226
+ ## Where to Go Next
227
+
228
+ If you have not run `init` yet:
229
+
230
+ - Follow the [evaluator guide playbook](evaluating-dflow.en.md#a-30-minute-evaluation-playbook)
231
+ to try it on a disposable sample project.
232
+
233
+ If you have run `init` and want to see end-to-end workflow examples:
234
+
235
+ - Read [`tutorial/01-greenfield/`](../tutorial/01-greenfield/walkthrough-00-setup.md) or
236
+ [`tutorial/02-brownfield/`](../tutorial/02-brownfield/walkthrough-00-setup.md). The
237
+ tutorial walk-throughs show conversation flows and the resulting
238
+ `dflow/specs/` outputs.
239
+
240
+ If you want to understand the design rationale:
241
+
242
+ - Read [`docs/why-ddd-for-ai.en.md`](why-ddd-for-ai.en.md).
243
+
244
+ If something does not work as described:
245
+
246
+ - File a docs feedback issue (see [`CONTRIBUTING.md`](../CONTRIBUTING.md)).
247
+ Per-tool documentation is new and feedback specifically about Codex CLI
248
+ behavior is valuable.
@@ -1,44 +1,42 @@
1
- # Using Dflow with Codex CLI
1
+ # 在 Codex CLI 中使用 Dflow
2
2
 
3
- A walk-through of what Dflow looks like when your AI coding agent is
4
- [Codex CLI](https://developers.openai.com/codex/cli). About 10 minutes to
5
- read.
3
+ > **繁體中文** | [English](using-with-codex.en.md)
6
4
 
7
- This guide focuses on the Codex CLI experience specifically. For the
8
- tool-neutral evaluation flow, see
9
- [`docs/evaluating-dflow.md`](evaluating-dflow.md). For the full Get Started
10
- and feature list, see [`README.md`](../README.md).
5
+ 當你的 AI 程式設計助理是 [Codex CLI](https://developers.openai.com/codex/cli) 時,Dflow 的使用體驗 walk-through。閱讀約需 10 分鐘。
11
6
 
12
- ## Who This Guide Is For
7
+ 本指南專注於 Codex CLI 的具體使用體驗。工具中立的評估流程請見
8
+ [`docs/evaluating-dflow.md`](evaluating-dflow.md)。完整的 Get Started
9
+ 與功能列表請見 [`README.md`](../README.md)。
13
10
 
14
- You are using or evaluating Dflow with Codex CLI as your AI coding agent.
15
- This guide covers what Codex sees after `init`, how the `AGENTS.md` shim
16
- points to the canonical Dflow guide, and the Codex-specific command and
17
- permission patterns worth knowing.
11
+ ## 本指南的適用對象
18
12
 
19
- You do not need to read this before running `init`. It is most useful after
20
- you have run `init` once and want to understand what Codex CLI is actually
21
- loading.
13
+ 你正在使用或評估以 Codex CLI 作為 AI 程式設計助理的 Dflow。
14
+ 本指南說明 `init` 之後 Codex 看到了什麼、`AGENTS.md` 薄 shim 是如何指向
15
+ canonical Dflow 指南的,以及幾個值得了解的 Codex 專屬指令與權限模式。
22
16
 
23
- ## Prerequisites
17
+ 你不需要在執行 `init` 之前先讀本指南。它最適合在你執行過一次 `init` 之後、
18
+ 想了解 Codex CLI 實際載入什麼內容時閱讀。
24
19
 
25
- - Codex CLI installed and authenticated (see
26
- [developers.openai.com/codex/cli](https://developers.openai.com/codex/cli)).
27
- - Node.js / npx available (Dflow ships through npm).
28
- - A project directory you are comfortable initializing in. A branch or a
29
- disposable sample project is recommended for first contact; see the
30
- [evaluator guide playbook](evaluating-dflow.md#a-30-minute-evaluation-playbook).
31
- - Codex started from the initialized project root, or with `codex --cd` set
32
- to that root, so Codex's `AGENTS.md` discovery includes the Dflow shim.
20
+ ## 前置條件
33
21
 
34
- Running Dflow workflows does not require a separate Dflow service or API key.
35
- The workflows are Markdown-based instructions and project files.
22
+ - 已安裝並完成認證的 Codex CLI(見
23
+ [developers.openai.com/codex/cli](https://developers.openai.com/codex/cli))。
24
+ - 已具備 Node.js / npm 環境(Dflow 透過 npm 發佈)。以
25
+ `npm install -g dflow-sdd-ddd` 全域安裝,或用 `npx dflow-sdd-ddd` 走免安裝路徑。
26
+ - 有一個你願意在其中執行 init 的專案目錄。首次嘗試建議先用 branch 或
27
+ 可拋棄的範例專案;見
28
+ [評估者指南 Playbook](evaluating-dflow.md#30-分鐘評估-playbook)。
29
+ - Codex 從已初始化的專案根目錄啟動,或以 `codex --cd` 指向該根目錄,
30
+ 確保 Codex 的 `AGENTS.md` 探索範圍包含 Dflow shim。
36
31
 
37
- ## What Codex CLI Sees After `init`
32
+ 執行 Dflow workflow 不需要獨立的 Dflow 服務或 API 金鑰。
33
+ 這些 workflow 是 Markdown-based 的指示與專案檔案。
38
34
 
39
- Running `npx dflow-sdd-ddd init` and selecting
40
- `AGENTS.md - Codex / Copilot coding agent` as a target tool creates a thin
41
- shim at the project root:
35
+ ## `init` 之後 Codex CLI 看到了什麼
36
+
37
+ 執行 `dflow init`(或免安裝路徑的 `npx dflow-sdd-ddd init`)並選擇
38
+ `AGENTS.md - Codex / Copilot coding agent` 作為目標工具後,會在專案根目錄
39
+ 建立一個薄 shim:
42
40
 
43
41
  ```markdown
44
42
  # AGENTS.md - Dflow Project Instructions
@@ -54,64 +52,58 @@ single source of truth for project workflow rules, slash-command behavior,
54
52
  spec locations, and SDD/DDD constraints.
55
53
  ```
56
54
 
57
- Two things matter when Codex starts in this project:
58
-
59
- 1. Codex CLI reads `AGENTS.md` as project instructions. This is Codex's
60
- standard repository-instruction mechanism.
61
- 2. The Dflow shim does not include a Markdown import line. Unlike the
62
- Claude Code and Gemini shims, generated `AGENTS.md` does not contain
63
- `@dflow/specs/shared/AI-AGENT-GUIDE.md`.
64
-
65
- That means Codex sees the pointer immediately, but the canonical Dflow guide
66
- is not auto-inlined by the shim. Before planning or editing, Codex should
67
- follow the pointer and read `dflow/specs/shared/AI-AGENT-GUIDE.md`. If Codex
68
- starts answering a Dflow request without mentioning that file, steer it
69
- explicitly: "Before continuing, read and follow
70
- `dflow/specs/shared/AI-AGENT-GUIDE.md`."
71
-
72
- The canonical guide is where the real workflow rules live: project context
73
- (track, tech stack, prose language), the Dflow workflow table,
74
- source-of-truth file paths, and core SDD/DDD rules. The `AGENTS.md` shim
75
- stays small so the same canonical guide can serve Codex CLI, Claude Code,
76
- Gemini CLI, GitHub Copilot, and other tools.
77
-
78
- If an `AGENTS.md` already existed in the project, `init` does not overwrite
79
- it. If the existing file does not already point to
80
- `dflow/specs/shared/AI-AGENT-GUIDE.md`, `init` writes a merge snippet under
81
- `dflow/specs/shared/AGENTS-md-snippet.md` that you can merge manually. This
82
- avoids destroying custom project instructions you already had.
83
-
84
- ## Using Dflow Workflow Commands in Codex CLI
85
-
86
- Codex CLI has its own built-in slash command layer for controlling the CLI
87
- session. Commands such as `/permissions`, `/model`, `/status`, `/diff`,
88
- `/review`, and `/init` are Codex CLI controls, not Dflow workflows.
89
-
90
- Dflow's `/dflow:*` entries are workflow names recognized by the AI through
91
- `AI-AGENT-GUIDE.md`, not registered Codex CLI commands. Raw
92
- `/dflow:new-feature` passthrough behavior in Codex CLI should be verified
93
- with the maintainer for the supported Codex version. The reliable form is to
94
- name the workflow as a plain chat instruction:
55
+ Codex 在這個專案中啟動時,有兩件事值得注意:
56
+
57
+ 1. Codex CLI 將 `AGENTS.md` 作為專案指示讀取。這是 Codex 的
58
+ 標準 repository 指示機制。
59
+ 2. Dflow shim 不含 Markdown import 那一行。與 Claude Code 和 Gemini 的
60
+ shim 不同,產生的 `AGENTS.md` 不含 `@dflow/specs/shared/AI-AGENT-GUIDE.md`。
61
+
62
+ 這意味著 Codex 能立即看到指標,但 canonical Dflow 指南不會由 shim 自動 inline 嵌入。
63
+ 在規劃或編輯之前,Codex 應跟著指標讀取 `dflow/specs/shared/AI-AGENT-GUIDE.md`。
64
+ 若 Codex 在回應 Dflow 請求時沒有提到該檔案,請明確引導它:「Before continuing,
65
+ read and follow `dflow/specs/shared/AI-AGENT-GUIDE.md`.」
66
+
67
+ canonical 指南是實際 workflow 規則的所在:專案上下文(track、技術棧、
68
+ 文章語言)、Dflow workflow 表、source-of-truth 檔案路徑,以及核心 SDD/DDD 規則。
69
+ `AGENTS.md` shim 刻意保持精簡,這樣 canonical 指南就能同時服務 Codex CLI、
70
+ Claude Code、Gemini CLI、GitHub Copilot 與其他工具。
71
+
72
+ 如果專案中已有 `AGENTS.md`,`init` 不會覆蓋它。若既有檔案尚未指向
73
+ `dflow/specs/shared/AI-AGENT-GUIDE.md`,`init` 會在
74
+ `dflow/specs/shared/AGENTS-md-snippet.md` 下寫入 merge snippet,
75
+ 讓你手動合併。這樣可以避免破壞你已有的自訂專案指示。
76
+
77
+ ## 在 Codex CLI 中使用 Dflow Workflow 指令
78
+
79
+ Codex CLI 有自己的內建 slash command 層,用來控制 CLI session。
80
+ `/permissions`、`/model`、`/status`、`/diff`、`/review`、`/init` 等指令
81
+ 都是 Codex CLI 控制項,不是 Dflow workflow。
82
+
83
+ Dflow 的 `/dflow:*` 項目是 AI 透過 `AI-AGENT-GUIDE.md` 識別的 workflow
84
+ 名稱,不是已註冊的 Codex CLI 指令。`/dflow:new-feature` 在 Codex CLI 中
85
+ 能否直接傳遞到模型,需依所用的 Codex 版本向 maintainer 確認。
86
+ 最可靠的方式是以普通對話指示輸入 workflow 名稱:
95
87
 
96
88
  ```text
97
89
  Run the Dflow /dflow:new-feature workflow.
98
90
  ```
99
91
 
100
- If your Codex CLI version passes unknown slash-prefixed input through to the
101
- model, this shorter form may also work (verify with maintainer):
92
+ 若你的 Codex CLI 版本會將未知的 slash 前綴輸入傳遞到模型,也可嘗試以下
93
+ 較短形式(請先向 maintainer 確認):
102
94
 
103
95
  ```text
104
96
  /dflow:new-feature
105
97
  ```
106
98
 
107
- If Codex reports an unknown slash command, re-send the request in prose:
99
+ 若 Codex 回報未知 slash command,改以純文字重新送出:
108
100
 
109
101
  ```text
110
102
  Treat /dflow:new-feature as a Dflow workflow name, not as a Codex CLI
111
103
  command. Read dflow/specs/shared/AI-AGENT-GUIDE.md and start that workflow.
112
104
  ```
113
105
 
114
- A typical conversation looks like:
106
+ 典型的對話如下:
115
107
 
116
108
  ```text
117
109
  You: Run the Dflow /dflow:new-feature workflow.
@@ -127,118 +119,106 @@ Codex CLI: I'll start by drafting a feature spec under
127
119
  dflow/specs/features/active/. Before I do, I have a few clarifying questions.
128
120
  ```
129
121
 
130
- The workflow then walks you through spec drafting, behavior examples,
131
- implementation planning, and finish-feature drift checks. The exact
132
- sequence depends on which workflow you entered (`/dflow:new-feature`,
133
- `/dflow:modify-existing`, `/dflow:bug-fix`, etc.).
122
+ 接著這個 workflow 會引導你完成 spec 起草、行為範例、實作計畫,以及
123
+ finish-feature 漂移(drift)檢查。確切的流程取決於你進入的是哪個 workflow
124
+ (`/dflow:new-feature`、`/dflow:modify-existing`、`/dflow:bug-fix` 等)。
134
125
 
135
- Available workflow entry points:
126
+ 可用的 workflow 入口:
136
127
 
137
- | Workflow | Use when |
128
+ | 指令 | 適用情境 |
138
129
  |---|---|
139
- | `/dflow:new-feature` | A new user-visible capability or business behavior is requested. |
140
- | `/dflow:modify-existing` | Existing behavior needs to change. |
141
- | `/dflow:bug-fix` | A defect can be described with expected vs actual behavior. |
142
- | `/dflow:new-phase` | An active feature needs another implementation slice. |
143
- | `/dflow:finish-feature` | Implementation is complete and needs drift closure. |
144
- | `/dflow:verify` | Specs, domain docs, implementation, and tests need consistency checks. |
145
- | `/dflow:pr-review` | A change is ready for SDD/DDD review. |
146
- | `/dflow:report-dflow-feedback` | You found a Dflow issue or improvement and want a sanitized upstream feedback draft. |
130
+ | `/dflow:new-feature` | 需要新增一個使用者可見的功能或業務行為。 |
131
+ | `/dflow:modify-existing` | 需要修改現有行為。 |
132
+ | `/dflow:bug-fix` | 可以用預期行為 vs 實際行為描述的缺陷。 |
133
+ | `/dflow:new-phase` | 進行中的 feature 需要另一個實作 slice。 |
134
+ | `/dflow:finish-feature` | 實作完成後需要進行漂移(drift)收尾。 |
135
+ | `/dflow:verify` | 需要對 spec、領域文件、實作與測試進行一致性檢查。 |
136
+ | `/dflow:pr-review` | 變更已準備好進行 SDD/DDD review。 |
137
+ | `/dflow:report-dflow-feedback` | 你發現了 Dflow 的問題或改進點,想要一份清理過的上游回饋草稿。 |
147
138
 
148
- If you forget a workflow name, ask Codex to read
149
- `dflow/specs/shared/AI-AGENT-GUIDE.md` and list the available Dflow
150
- workflows.
139
+ 如果你忘了 workflow 名稱,請 Codex 讀取 `dflow/specs/shared/AI-AGENT-GUIDE.md`
140
+ 並列出可用的 Dflow workflow 即可。
151
141
 
152
- ## Differences vs Other AI Tools
142
+ ## 與其他 AI 工具的差異
153
143
 
154
- The canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) is identical
155
- across tools. Only the root-level shim differs:
144
+ canonical 指南(`dflow/specs/shared/AI-AGENT-GUIDE.md`)在各工具之間是相同的。
145
+ 只有根目錄層的 shim 有所不同:
156
146
 
157
- | Tool | Generated shim | Loads canonical guide via |
147
+ | 工具 | 產生的 shim | 載入 canonical 指南的方式 |
158
148
  |---|---|---|
159
149
  | Claude Code | `CLAUDE.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
160
- | Codex / Copilot coding agent | `AGENTS.md` | Project instructions load the shim; Codex must follow the pointer and read the guide |
150
+ | Codex / Copilot coding agent | `AGENTS.md` | 專案指示載入 shim;Codex 須跟著指標讀取指南 |
161
151
  | Gemini CLI | `GEMINI.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
162
- | GitHub Copilot | `.github/copilot-instructions.md` | Reads repository instructions directly |
152
+ | GitHub Copilot | `.github/copilot-instructions.md` | 直接讀取 repository 指示 |
163
153
 
164
- You can run `dflow configure-agents` later to add another tool's shim
165
- without re-running `init`. Multiple tools can be active in the same project
166
- and stay synchronized via the canonical guide.
154
+ 你可以之後執行 `dflow configure-agents` 來新增另一個工具的 shim,而不需要重跑
155
+ `init`。同一個專案可以同時啟用多個工具,並透過 canonical 指南保持同步。
167
156
 
168
- Codex also has its own project-instruction layering. It can read global
169
- instructions from Codex home and project instructions from `AGENTS.md` files
170
- between the project root and the current working directory. For Dflow, the
171
- important practical rule is simple: start Codex at the initialized project
172
- root, and keep the Dflow pointer in the nearest relevant `AGENTS.md`.
157
+ Codex 也有自己的專案指示分層機制。它可以從 Codex home 讀取全域指示、
158
+ 從專案根目錄到當前工作目錄之間的 `AGENTS.md` 檔案讀取專案指示。
159
+ 對 Dflow 而言,關鍵的實務規則很簡單:從已初始化的專案根目錄啟動 Codex,
160
+ 並將 Dflow 指標保留在最近一層相關的 `AGENTS.md` 中。
173
161
 
174
- If your team uses both Claude Code and Codex CLI on the same project, no
175
- extra Dflow coordination is needed. Both tools use the same canonical guide;
176
- only the shim file and loading mechanism differ.
162
+ 如果你的團隊在同一個專案中同時使用 Claude Code 和 Codex CLI,
163
+ 不需要額外的 Dflow 協調。兩個工具都讀取相同的 canonical 指南;
164
+ 只有 shim 檔案與載入機制不同。
177
165
 
178
- ## Common Patterns and Gotchas
166
+ ## 常見模式與注意事項
179
167
 
180
- **Keep `AGENTS.md` thin.** If you find yourself adding workflow rules, spec
181
- locations, or SDD constraints to `AGENTS.md`, those belong in
182
- `dflow/specs/shared/AI-AGENT-GUIDE.md` instead. The shim stays small so that
183
- other tools' shims do not drift away from it.
168
+ **保持 `AGENTS.md` 精簡。** 如果你發現自己在把 workflow 規則、spec 路徑或
169
+ SDD 約束加入 `AGENTS.md`,這些內容應該放到
170
+ `dflow/specs/shared/AI-AGENT-GUIDE.md`。shim 保持精簡,其他工具的 shim 才不會
171
+ 與它產生漂移(drift)。
184
172
 
185
- **Codex does not inline the Dflow guide from `AGENTS.md`.** The generated
186
- Codex shim has a normal Markdown bullet pointing to the canonical guide, not
187
- an `@...` import. Ask Codex to read `AI-AGENT-GUIDE.md` if it appears to be
188
- working from the shim alone.
173
+ **Codex 不會從 `AGENTS.md` inline 嵌入 Dflow 指南。** 產生的 Codex shim
174
+ 是以普通的 Markdown bullet 指向 canonical 指南,而非 `@...` import。
175
+ 若 Codex 看起來只從 shim 工作,請要求它讀取 `AI-AGENT-GUIDE.md`。
189
176
 
190
- **`/dflow:*` is not a Codex CLI built-in slash command.** Codex slash
191
- commands control the Codex session itself. Use Dflow workflow names as plain
192
- chat instructions when raw slash input is intercepted or rejected. Raw
193
- `/dflow:*` passthrough behavior should be verified with the maintainer for
194
- the supported Codex version.
177
+ **`/dflow:*` 不是 Codex CLI 的內建 slash command。** Codex slash command 控制
178
+ 的是 Codex session 本身。當 slash 輸入被攔截或拒絕時,改用普通對話指示
179
+ 輸入 Dflow workflow 名稱。`/dflow:*` 的直通行為需依所用的 Codex 版本向
180
+ maintainer 確認。
195
181
 
196
- **Do not confuse Codex `/init` with Dflow `init`.** Codex `/init` creates a
197
- generic `AGENTS.md` scaffold for Codex. Dflow setup is `npx dflow-sdd-ddd
198
- init`, and adding later tool shims is `dflow configure-agents`.
182
+ **不要混淆 Codex `/init` 與 Dflow `init`。** Codex `/init` 為 Codex 建立
183
+ 通用的 `AGENTS.md` scaffold。Dflow 的設定是 `dflow init`(或免安裝路徑的
184
+ `npx dflow-sdd-ddd init`),之後新增工具 shim 則是 `dflow configure-agents`。
199
185
 
200
- **Permission gates and Dflow workflow gates are separate.** Codex may ask
201
- permission to run a command, edit outside the workspace, or access network
202
- depending on its sandbox and approval settings. Dflow workflows have their
203
- own approval gates, such as confirming a spec before implementation. Both
204
- can appear in the same session; this is expected.
186
+ **Permission gates 與 Dflow workflow gates 是分開的。** Codex 可能會依其
187
+ sandbox 與 approvals 設定,詢問執行指令、workspace 外編輯或存取網路的權限。
188
+ Dflow workflow 有自己的審核關卡,例如在實作前確認 spec。兩者可能在同一個
189
+ session 中同時出現;這是預期行為。
205
190
 
206
- **The common Codex local-work preset is workspace write plus on-request
207
- approvals.** In current Codex CLI terminology this is
208
- `--sandbox workspace-write --ask-for-approval on-request`. In that mode,
209
- Codex can work inside the project and asks before going beyond the sandbox,
210
- such as writing outside the workspace or accessing network.
191
+ **Codex 本機工作的常見預設是 workspace write 加上 on-request approvals。**
192
+ 以目前 Codex CLI 的術語為 `--sandbox workspace-write --ask-for-approval on-request`。
193
+ 在這個模式下,Codex 可在專案內工作,並在超出 sandbox 範圍(例如 workspace
194
+ 外寫入或存取網路)前先詢問。
211
195
 
212
- **Existing `AGENTS.md` files are preserved.** If Dflow cannot safely write
213
- the root shim because the file already exists, look under
214
- `dflow/specs/shared/` for the merge snippet and merge the Dflow pointer into
215
- your existing project instructions manually.
196
+ **既有的 `AGENTS.md` 會被保留。** 若 Dflow 因檔案已存在而無法安全寫入
197
+ 根目錄 shim,請到 `dflow/specs/shared/` 下找 merge snippet,
198
+ 手動將 Dflow 指標合併進你現有的專案指示。
216
199
 
217
- **Nested `AGENTS.md` files can change what Codex sees.** Codex layers project
218
- instructions along the path to the current working directory. If a subfolder
219
- has its own `AGENTS.md` or `AGENTS.override.md`, make sure it does not hide
220
- or contradict the Dflow pointer you expect Codex to follow.
200
+ **巢狀 `AGENTS.md` 可能改變 Codex 看到的內容。** Codex 沿著到當前工作目錄
201
+ 的路徑分層讀取專案指示。若某個子目錄有自己的 `AGENTS.md` 或
202
+ `AGENTS.override.md`,請確認它不會遮蓋或矛盾你預期 Codex 遵循的 Dflow 指標。
221
203
 
222
- ## Where to Go Next
204
+ ## 下一步
223
205
 
224
- If you have not run `init` yet:
206
+ 如果你還沒有執行 `init`:
225
207
 
226
- - Follow the [evaluator guide playbook](evaluating-dflow.md#a-30-minute-evaluation-playbook)
227
- to try it on a disposable sample project.
208
+ - 按照[評估者指南 Playbook](evaluating-dflow.md#30-分鐘評估-playbook)
209
+ 在可拋棄的範例專案中試用。
228
210
 
229
- If you have run `init` and want to see end-to-end workflow examples:
211
+ 如果你已執行 `init` 且想查看端到端的 workflow 範例:
230
212
 
231
- - Read [`tutorial/01-greenfield/`](../tutorial/01-greenfield/00-setup.md) or
232
- [`tutorial/02-brownfield/`](../tutorial/02-brownfield/00-setup.md). The
233
- tutorial walk-throughs show conversation flows and the resulting
234
- `dflow/specs/` outputs.
213
+ - 閱讀 [`tutorial/01-greenfield/`](../tutorial/01-greenfield/walkthrough-00-setup.md) 或
214
+ [`tutorial/02-brownfield/`](../tutorial/02-brownfield/walkthrough-00-setup.md)。
215
+ tutorial walk-through 展示了對話流程與產生的 `dflow/specs/` 輸出。
235
216
 
236
- If you want to understand the design rationale:
217
+ 如果你想了解設計理念:
237
218
 
238
- - Read [`docs/why-ddd-for-ai.md`](why-ddd-for-ai.md).
219
+ - 閱讀[為什麼 AI 時代 DDD 更重要](why-ddd-for-ai.md)。
239
220
 
240
- If something does not work as described:
221
+ 如果有任何行為與描述不符:
241
222
 
242
- - File a docs feedback issue (see [`CONTRIBUTING.md`](../CONTRIBUTING.md)).
243
- Per-tool documentation is new and feedback specifically about Codex CLI
244
- behavior is valuable.
223
+ - 開一個 docs feedback issue(見 [`CONTRIBUTING.md`](../CONTRIBUTING.md))。
224
+ Per-tool 文件是新內容,有關 Codex CLI 行為的具體回饋非常有價值。