dflow-sdd-ddd 0.1.0 → 0.2.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 +1176 -0
  2. package/CONTRIBUTING.md +123 -0
  3. package/README.md +199 -157
  4. package/TEMPLATE-COVERAGE.md +46 -0
  5. package/TEMPLATE-LANGUAGE-GLOSSARY.md +52 -0
  6. package/bin/dflow.js +73 -8
  7. package/docs/evaluating-dflow.md +226 -0
  8. package/docs/migrating-to-dflow-v1.md +212 -0
  9. package/docs/npm-publish-checklist.md +93 -0
  10. package/docs/release-versioning-policy.md +99 -0
  11. package/docs/using-with-claude-code.md +207 -0
  12. package/docs/using-with-codex.md +244 -0
  13. package/docs/why-ddd-for-ai.md +35 -0
  14. package/lib/init.js +444 -66
  15. package/package.json +13 -7
  16. package/templates/brownfield/scaffolding/AI-AGENT-GUIDE.md +92 -0
  17. package/templates/{webforms → brownfield}/scaffolding/CLAUDE-md-snippet.md +8 -9
  18. package/templates/{webforms → brownfield}/scaffolding/Git-principles-gitflow.md +1 -1
  19. package/templates/{webforms → brownfield}/scaffolding/Git-principles-trunk.md +1 -1
  20. package/templates/{webforms → brownfield}/scaffolding/_conventions.md +2 -1
  21. package/templates/{webforms → brownfield}/scaffolding/_overview.md +2 -2
  22. package/templates/{webforms → brownfield}/templates/context-map.md +1 -1
  23. package/templates/{webforms → brownfield}/templates/glossary.md +1 -1
  24. package/templates/{webforms → brownfield}/templates/models.md +1 -1
  25. package/templates/{webforms → brownfield}/templates/phase-spec.md +1 -1
  26. package/templates/{webforms → brownfield}/templates/rules.md +1 -1
  27. package/templates/{webforms → brownfield}/templates/tech-debt.md +1 -1
  28. package/templates/greenfield/scaffolding/AI-AGENT-GUIDE.md +92 -0
  29. package/templates/{core → greenfield}/scaffolding/CLAUDE-md-snippet.md +15 -14
  30. package/templates/{core → greenfield}/scaffolding/Git-principles-gitflow.md +1 -1
  31. package/templates/{core → greenfield}/scaffolding/Git-principles-trunk.md +1 -1
  32. package/templates/{core → greenfield}/scaffolding/_conventions.md +2 -1
  33. package/templates/{core → greenfield}/scaffolding/_overview.md +2 -2
  34. package/templates/{core → greenfield}/scaffolding/architecture-decisions-README.md +1 -1
  35. package/templates/{core → greenfield}/templates/context-map.md +1 -1
  36. package/templates/{core → greenfield}/templates/events.md +1 -1
  37. package/templates/{core → greenfield}/templates/glossary.md +1 -1
  38. package/templates/{core → greenfield}/templates/models.md +1 -1
  39. package/templates/{core → greenfield}/templates/phase-spec.md +1 -1
  40. package/templates/{core → greenfield}/templates/rules.md +1 -1
  41. package/templates/{core → greenfield}/templates/tech-debt.md +1 -1
  42. /package/templates/{webforms → brownfield}/templates/CLAUDE.md +0 -0
  43. /package/templates/{webforms → brownfield}/templates/_index.md +0 -0
  44. /package/templates/{webforms → brownfield}/templates/behavior.md +0 -0
  45. /package/templates/{webforms → brownfield}/templates/context-definition.md +0 -0
  46. /package/templates/{webforms → brownfield}/templates/lightweight-spec.md +0 -0
  47. /package/templates/{core → greenfield}/templates/CLAUDE.md +0 -0
  48. /package/templates/{core → greenfield}/templates/_index.md +0 -0
  49. /package/templates/{core → greenfield}/templates/aggregate-design.md +0 -0
  50. /package/templates/{core → greenfield}/templates/behavior.md +0 -0
  51. /package/templates/{core → greenfield}/templates/context-definition.md +0 -0
  52. /package/templates/{core → greenfield}/templates/lightweight-spec.md +0 -0
@@ -0,0 +1,99 @@
1
+ # Release and Versioning Policy
2
+
3
+ This document defines the lightweight release policy for Dflow while the project
4
+ is in the `0.x` series. It is maintainer-facing; contributors can use it to
5
+ describe expected version impact in a PR, but only maintainers publish releases.
6
+
7
+ ## Versioning During 0.x
8
+
9
+ Dflow uses SemVer-style version numbers, with extra care in `0.x` because the
10
+ workflow contract is still evolving.
11
+
12
+ Use a patch release for:
13
+
14
+ - Bug fixes.
15
+ - Documentation corrections or clarifications.
16
+ - Non-breaking template wording changes.
17
+ - Release metadata fixes.
18
+ - Internal cleanup that does not change generated output or workflow contracts.
19
+
20
+ Use a minor release for:
21
+
22
+ - A new CLI command.
23
+ - A new generated file.
24
+ - A materially changed generated file shape.
25
+ - A new or expanded `/dflow:*` workflow contract.
26
+ - A change that affects how Greenfield or Brownfield projects are initialized.
27
+ - A migration-relevant template, scaffolding, or skill behavior change.
28
+
29
+ Major versions are reserved for `1.0` and later. Before `1.0`, breaking changes
30
+ may still appear in minor releases, but release notes must call them out clearly
31
+ and describe the expected user action.
32
+
33
+ ## What Counts as Breaking
34
+
35
+ A change is breaking when an existing Dflow user may need to adjust project
36
+ files, scripts, AI-agent instructions, or workflow habits after upgrading.
37
+
38
+ Examples:
39
+
40
+ - Renaming generated paths.
41
+ - Removing a generated file.
42
+ - Changing required init prompts.
43
+ - Changing the meaning of a template section.
44
+ - Changing command behavior in a way that invalidates existing docs.
45
+ - Replacing a workflow contract that AI agents rely on.
46
+
47
+ ## Release Ownership
48
+
49
+ Dflow currently has four release surfaces:
50
+
51
+ - Development repo: source of truth for design work, implementation, planning,
52
+ and release preparation.
53
+ - Dist repo: clean public projection of selected source files.
54
+ - npm package: executable CLI and packaged templates selected by
55
+ `package.json#files`.
56
+ - GitHub Release: public release note and tag record.
57
+
58
+ For now, npm publishing may remain a manual maintainer action. Release
59
+ automation should be introduced only after the manual dist shape and release
60
+ checklist remain stable across multiple releases.
61
+
62
+ ## Tags
63
+
64
+ Use `v<version>` tags, for example `v0.1.1`.
65
+
66
+ When both development and dist repos are maintained, tag both repos for the same
67
+ published version after verification. The tags may point to different commits
68
+ because the dist repo is a selected projection of the development repo.
69
+
70
+ ## Changelog and Release Notes
71
+
72
+ Update `CHANGELOG.md` before publishing. Each release entry should state:
73
+
74
+ - The version and date.
75
+ - User-facing changes.
76
+ - Changed files or affected areas when useful.
77
+ - Verification performed.
78
+ - Any breaking change or migration note.
79
+
80
+ GitHub Release notes may summarize the changelog entry, but they should not be
81
+ the only place where release history is recorded.
82
+
83
+ ## Greenfield and Brownfield Changes
84
+
85
+ If a change touches a common SDD flow, update both Greenfield and Brownfield
86
+ skill sources unless the release intentionally changes only one track.
87
+
88
+ Common synchronized flow files include:
89
+
90
+ - `init-project-flow.md`
91
+ - `new-feature-flow.md`
92
+ - `modify-existing-flow.md`
93
+ - `new-phase-flow.md`
94
+ - `finish-feature-flow.md`
95
+ - `drift-verification.md`
96
+ - `pr-review-checklist.md`
97
+ - `git-integration.md`
98
+
99
+ Track-specific changes should be named in the changelog and release notes.
@@ -0,0 +1,207 @@
1
+ # Using Dflow with Claude Code
2
+
3
+ A walk-through of what Dflow looks like when your AI coding agent is
4
+ [Claude Code](https://claude.com/claude-code). About 10 minutes to read.
5
+
6
+ This guide focuses on the Claude Code experience specifically. For the
7
+ tool-neutral evaluation flow, see
8
+ [`docs/evaluating-dflow.md`](evaluating-dflow.md). For the full Get Started
9
+ and feature list, see [`README.md`](../README.md).
10
+
11
+ ## Who This Guide Is For
12
+
13
+ You are using or evaluating Dflow with Claude Code as your AI coding agent.
14
+ This guide covers what Claude Code sees after `init`, how Dflow's slash
15
+ commands are recognized, and the small Claude-Code-specific patterns worth
16
+ knowing.
17
+
18
+ You do not need to read this before running `init`. It is most useful after
19
+ you have run `init` once and want to understand what Claude Code is
20
+ actually loading.
21
+
22
+ ## Prerequisites
23
+
24
+ - Claude Code CLI installed (see [claude.ai/code](https://claude.com/claude-code)).
25
+ - Node.js / npx available (Dflow ships through npm).
26
+ - A project directory you are comfortable initializing in. A branch or a
27
+ disposable sample project is recommended for first contact; see the
28
+ [evaluator guide playbook](evaluating-dflow.md#a-30-minute-evaluation-playbook).
29
+
30
+ You do not need a paid Claude Code plan to read this document. Running
31
+ `/dflow:*` workflows requires Claude Code itself; the workflows are
32
+ text-based and do not require additional API keys beyond Claude Code's own
33
+ auth.
34
+
35
+ ## What Claude Code Sees After `init`
36
+
37
+ Running `npx dflow-sdd-ddd init` and selecting Claude Code as a target tool
38
+ creates a thin shim at the project root:
39
+
40
+ ```markdown
41
+ # CLAUDE.md - Dflow Project Instructions
42
+
43
+ This project uses Dflow for spec-first AI-assisted development.
44
+
45
+ Before planning or editing code, read and follow:
46
+
47
+ - `dflow/specs/shared/AI-AGENT-GUIDE.md`
48
+
49
+ Keep tool-specific instruction files small. The Dflow guide above is the
50
+ single source of truth for project workflow rules, slash-command behavior,
51
+ spec locations, and SDD/DDD constraints.
52
+
53
+ If your tool supports Markdown imports, the canonical guide is imported
54
+ below:
55
+
56
+ @dflow/specs/shared/AI-AGENT-GUIDE.md
57
+ ```
58
+
59
+ Two things happen when Claude Code starts in this project:
60
+
61
+ 1. Claude Code automatically loads `CLAUDE.md` from the project root into
62
+ its context. This is Claude Code's standard project instructions
63
+ mechanism.
64
+ 2. The trailing `@dflow/specs/shared/AI-AGENT-GUIDE.md` line uses Claude
65
+ Code's Markdown import syntax to inline the canonical Dflow guide. So
66
+ Claude Code effectively reads both files as one set of instructions.
67
+
68
+ The canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) is where the
69
+ real workflow rules live: project context (track, tech stack, prose
70
+ language), the `/dflow:*` workflow table, source-of-truth file paths, and
71
+ core SDD/DDD rules. The `CLAUDE.md` shim stays small precisely so the
72
+ canonical guide can evolve without Claude-Code-specific edits.
73
+
74
+ If a `CLAUDE.md` already existed in the project, `init` does not overwrite
75
+ it. Instead it writes a merge snippet under `dflow/specs/shared/` that you
76
+ can paste into your existing `CLAUDE.md` manually. This avoids destroying
77
+ custom project instructions you already had.
78
+
79
+ ## Using Dflow Slash Commands in Claude Code
80
+
81
+ Dflow's `/dflow:*` slash commands are workflow names recognized by the AI
82
+ through the workflow table in `AI-AGENT-GUIDE.md`, not Claude Code's
83
+ built-in slash command system. You type them as plain chat:
84
+
85
+ ```text
86
+ /dflow:new-feature
87
+ ```
88
+
89
+ Claude Code treats this as input. Because it has the workflow table loaded
90
+ via `CLAUDE.md` import, it recognizes the prefix and enters the matching
91
+ workflow. A typical conversation looks like:
92
+
93
+ ```text
94
+ You: /dflow:new-feature
95
+
96
+ Claude Code: Entering new-feature workflow. Please describe the user-facing
97
+ capability or business behavior you want to add.
98
+
99
+ You: Allow expense submitters to attach a receipt image when filing an
100
+ expense.
101
+
102
+ Claude Code: I'll start by drafting a feature spec under
103
+ dflow/specs/features/active/. Before I do, I need a short answer on:
104
+ [clarifying questions about scope, owner, priority]
105
+ ```
106
+
107
+ The workflow then walks you through spec drafting, behavior examples,
108
+ implementation planning, and finish-feature drift checks. The exact
109
+ sequence depends on which workflow you entered (`/dflow:new-feature`,
110
+ `/dflow:modify-existing`, `/dflow:bug-fix`, etc.). All workflow definitions
111
+ live under the Dflow skill source; Claude Code follows them by reading the
112
+ skill files when needed.
113
+
114
+ Available workflow entry points:
115
+
116
+ | Command | Use when |
117
+ |---|---|
118
+ | `/dflow:new-feature` | A new user-visible capability or business behavior is requested. |
119
+ | `/dflow:modify-existing` | Existing behavior needs to change. |
120
+ | `/dflow:bug-fix` | A defect can be described with expected vs actual behavior. |
121
+ | `/dflow:new-phase` | An active feature needs another implementation slice. |
122
+ | `/dflow:finish-feature` | Implementation is complete and needs drift closure. |
123
+ | `/dflow:verify` | Specs, domain docs, implementation, and tests need consistency checks. |
124
+ | `/dflow:pr-review` | A change is ready for SDD/DDD review. |
125
+ | `/dflow:report-dflow-feedback` | You found a Dflow issue or improvement and want a sanitized upstream feedback draft. |
126
+
127
+ If you forget a command name, ask Claude Code "what dflow workflows are
128
+ available?" — the answer comes from the workflow table it already has
129
+ loaded.
130
+
131
+ ## Differences vs Other AI Tools
132
+
133
+ The canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) is identical
134
+ across tools. Only the root-level shim differs:
135
+
136
+ | Tool | Generated shim | Loads canonical guide via |
137
+ |---|---|---|
138
+ | Claude Code | `CLAUDE.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
139
+ | Codex / Copilot coding agent | `AGENTS.md` | Reads file content directly when starting |
140
+ | Gemini CLI | `GEMINI.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
141
+ | GitHub Copilot | `.github/copilot-instructions.md` | Reads file content directly |
142
+
143
+ You can run `dflow configure-agents` later to add another tool's shim
144
+ without re-running `init`. Multiple tools can be active in the same project
145
+ and stay synchronized via the canonical guide.
146
+
147
+ If your team uses both Claude Code and Codex CLI on the same project (a
148
+ common setup), no extra coordination is needed. Both tools read the same
149
+ canonical guide; only the shim file differs.
150
+
151
+ ## Common Patterns and Gotchas
152
+
153
+ **Keep `CLAUDE.md` thin.** If you find yourself adding workflow rules,
154
+ spec locations, or SDD constraints to `CLAUDE.md`, those belong in
155
+ `dflow/specs/shared/AI-AGENT-GUIDE.md` instead. The shim stays small so
156
+ that other tools' shims don't drift away from it.
157
+
158
+ **`/dflow:*` is not a Claude Code Skill installation.** `init` does not
159
+ install anything into Claude Code's skill system. The slash commands are
160
+ plain text patterns the AI recognizes from the workflow table. You can use
161
+ them immediately after `init` without any Claude Code configuration.
162
+
163
+ **Permission gates and Dflow workflow gates are separate.** Claude Code may
164
+ ask permission to run a tool (e.g., write a file). Dflow's workflows have
165
+ their own approval gates (e.g., "I drafted the spec — do you want me to
166
+ proceed to implementation?"). Both can fire on the same action; this is
167
+ expected and not a sign of misconfiguration.
168
+
169
+ **The `@` import is not recursive.** `CLAUDE.md` imports
170
+ `AI-AGENT-GUIDE.md`, but if `AI-AGENT-GUIDE.md` references other files
171
+ (e.g., feature specs), those are not auto-loaded — Claude Code reads them
172
+ on demand when entering the relevant workflow. This keeps context usage
173
+ proportional to active work.
174
+
175
+ **A pre-existing `CLAUDE.md` is preserved.** `init` will not overwrite your
176
+ existing project instructions. Look under `dflow/specs/shared/` for the
177
+ merge snippet `init` wrote and paste the relevant sections into your
178
+ existing `CLAUDE.md` manually.
179
+
180
+ **Cross-machine projects work.** `dflow/specs/` is plain Markdown checked
181
+ into your repo. Anyone cloning the repo and using Claude Code in it will
182
+ see the same Dflow setup automatically through the committed `CLAUDE.md`
183
+ shim and the canonical guide.
184
+
185
+ ## Where to Go Next
186
+
187
+ If you have not run `init` yet:
188
+
189
+ - Follow the [evaluator guide playbook](evaluating-dflow.md#a-30-minute-evaluation-playbook)
190
+ to try it on a disposable sample project.
191
+
192
+ If you have run `init` and want to see end-to-end workflow examples:
193
+
194
+ - Read [`tutorial/01-greenfield/`](../tutorial/01-greenfield/00-setup.md) or
195
+ [`tutorial/02-brownfield/`](../tutorial/02-brownfield/00-setup.md). The
196
+ tutorial walk-throughs show conversation flows and the resulting
197
+ `dflow/specs/` outputs.
198
+
199
+ If you want to understand the design rationale:
200
+
201
+ - Read [`docs/why-ddd-for-ai.md`](why-ddd-for-ai.md).
202
+
203
+ If something does not work as described:
204
+
205
+ - File a docs feedback issue (see [`CONTRIBUTING.md`](../CONTRIBUTING.md)).
206
+ Per-tool documentation is new and feedback specifically about Claude Code
207
+ behavior is valuable.
@@ -0,0 +1,244 @@
1
+ # Using Dflow with Codex CLI
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.
6
+
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).
11
+
12
+ ## Who This Guide Is For
13
+
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.
18
+
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.
22
+
23
+ ## Prerequisites
24
+
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.
33
+
34
+ Running Dflow workflows does not require a separate Dflow service or API key.
35
+ The workflows are Markdown-based instructions and project files.
36
+
37
+ ## What Codex CLI Sees After `init`
38
+
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:
42
+
43
+ ```markdown
44
+ # AGENTS.md - Dflow Project Instructions
45
+
46
+ This project uses Dflow for spec-first AI-assisted development.
47
+
48
+ Before planning or editing code, read and follow:
49
+
50
+ - `dflow/specs/shared/AI-AGENT-GUIDE.md`
51
+
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
+
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:
95
+
96
+ ```text
97
+ Run the Dflow /dflow:new-feature workflow.
98
+ ```
99
+
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):
102
+
103
+ ```text
104
+ /dflow:new-feature
105
+ ```
106
+
107
+ If Codex reports an unknown slash command, re-send the request in prose:
108
+
109
+ ```text
110
+ Treat /dflow:new-feature as a Dflow workflow name, not as a Codex CLI
111
+ command. Read dflow/specs/shared/AI-AGENT-GUIDE.md and start that workflow.
112
+ ```
113
+
114
+ A typical conversation looks like:
115
+
116
+ ```text
117
+ You: Run the Dflow /dflow:new-feature workflow.
118
+
119
+ Codex CLI: I'll read dflow/specs/shared/AI-AGENT-GUIDE.md first, then use the
120
+ new-feature workflow. Please describe the user-visible capability or business
121
+ behavior you want to add.
122
+
123
+ You: Allow expense submitters to attach a receipt image when filing an
124
+ expense.
125
+
126
+ Codex CLI: I'll start by drafting a feature spec under
127
+ dflow/specs/features/active/. Before I do, I have a few clarifying questions.
128
+ ```
129
+
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.).
134
+
135
+ Available workflow entry points:
136
+
137
+ | Workflow | Use when |
138
+ |---|---|
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. |
147
+
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.
151
+
152
+ ## Differences vs Other AI Tools
153
+
154
+ The canonical guide (`dflow/specs/shared/AI-AGENT-GUIDE.md`) is identical
155
+ across tools. Only the root-level shim differs:
156
+
157
+ | Tool | Generated shim | Loads canonical guide via |
158
+ |---|---|---|
159
+ | 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 |
161
+ | Gemini CLI | `GEMINI.md` | `@dflow/specs/shared/AI-AGENT-GUIDE.md` Markdown import |
162
+ | GitHub Copilot | `.github/copilot-instructions.md` | Reads repository instructions directly |
163
+
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.
167
+
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`.
173
+
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.
177
+
178
+ ## Common Patterns and Gotchas
179
+
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.
184
+
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.
189
+
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.
195
+
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`.
199
+
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.
205
+
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.
211
+
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.
216
+
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.
221
+
222
+ ## Where to Go Next
223
+
224
+ If you have not run `init` yet:
225
+
226
+ - Follow the [evaluator guide playbook](evaluating-dflow.md#a-30-minute-evaluation-playbook)
227
+ to try it on a disposable sample project.
228
+
229
+ If you have run `init` and want to see end-to-end workflow examples:
230
+
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.
235
+
236
+ If you want to understand the design rationale:
237
+
238
+ - Read [`docs/why-ddd-for-ai.md`](why-ddd-for-ai.md).
239
+
240
+ If something does not work as described:
241
+
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.
@@ -0,0 +1,35 @@
1
+ # Why DDD Matters More with AI
2
+
3
+ AI-assisted development changes the failure mode of software design. The team can produce more code faster, but unclear domain meaning is also amplified faster.
4
+
5
+ When a project lacks shared language and explicit boundaries, small inconsistencies spread:
6
+
7
+ - the same concept appears as `Order`, `Booking`, and `Transaction`
8
+ - APIs encode different meanings for similar actions
9
+ - business rules live in handlers, UI code, scripts, and tests
10
+ - nobody can confidently say which behavior is authoritative
11
+
12
+ An AI coding agent does not know the business domain by default. When the prompt is incomplete, it fills the missing parts with plausible logic. That logic may compile, pass superficial tests, and still be wrong. The most dangerous AI mistakes are often not syntax errors; they are reasonable-looking domain mistakes.
13
+
14
+ DDD gives the spec a semantic backbone:
15
+
16
+ | DDD idea | AI-era value |
17
+ |---|---|
18
+ | **Ubiquitous Language** | Keeps names and meanings stable across prompts, specs, code, and reviews. |
19
+ | **Bounded Context** | Defines where a term or rule is valid, and prevents accidental meaning leaks. |
20
+ | **Domain Model** | Gives behavior a clear owner instead of scattering rules across technical layers. |
21
+ | **Domain Rules** | States what is correct, allowed, forbidden, and exceptional before code generation. |
22
+
23
+ The important shift is where design lives. In older workflows, much of the real design could remain implicit in code. With AI, that is too late. The model needs constraints before it generates code.
24
+
25
+ ```text
26
+ Without DDD:
27
+ Prompt -> AI fills gaps -> Code -> Hidden domain drift
28
+
29
+ With DDD:
30
+ Domain meaning -> Structured spec -> AI implementation -> Reviewable code
31
+ ```
32
+
33
+ Code still matters, but it is no longer the first place where meaning should be discovered. For AI collaboration, specs become the pre-generation contract, and DDD supplies the language, boundaries, and rules that make the contract precise.
34
+
35
+ Dflow is built around that idea: spec first, domain meaning explicit, AI constrained before implementation, and drift checked before the work is considered done.