@open-agent-toolkit/cli 0.0.53 → 0.0.54

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.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: oat-project-design
3
- version: 1.2.0
4
- description: Use when discovery and specification are complete and implementation-ready decisions are needed. Produces detailed technical design artifacts, including architecture and interfaces.
3
+ version: 2.1.0
4
+ description: Use when discovery is complete and implementation-ready decisions are needed. Runs a collaborative, selective collaborative, or draft-and-review design flow, confirms requirements and produces both `spec.md` and `design.md`, and commits artifacts before the user-review gate.
5
5
  disable-model-invocation: true
6
6
  user-invocable: true
7
7
  allowed-tools: Read, Write, Bash(git:*), Glob, Grep, AskUserQuestion
@@ -13,7 +13,13 @@ Transform specification requirements into a detailed technical design with archi
13
13
 
14
14
  ## Prerequisites
15
15
 
16
- **Required:** Complete specification document. If missing, run the `oat-project-spec` skill first.
16
+ **Required:** Completed discovery (`discovery.md` with `oat_status: complete`). Specification is optional — this skill folds requirements confirmation into its flow and produces `spec.md` as a byproduct (see Step 2). If the user already ran `oat-project-spec` standalone, that spec is reused.
17
+
18
+ ## Principles
19
+
20
+ - **YAGNI ruthlessly** — remove unnecessary features from all designs.
21
+ If a section drafts a capability the spec doesn't require, cut it.
22
+ If a component boundary is there "in case we need it later", cut it.
17
23
 
18
24
  ## Progress Indicators (User-Facing)
19
25
 
@@ -58,46 +64,127 @@ PROJECTS_ROOT="${PROJECTS_ROOT%/}"
58
64
 
59
65
  ### Step 1: Check Specification Complete
60
66
 
67
+ Specification is OPTIONAL in the default workflow. This skill folds requirements confirmation into Step 2 below and produces `spec.md` as a byproduct.
68
+
69
+ If `"$PROJECT_PATH/spec.md"` already exists (e.g., the user ran the standalone `oat-project-spec` skill first), validate it and reuse it:
70
+
61
71
  ```bash
62
- cat "$PROJECT_PATH/spec.md" | head -10 | grep "oat_status:"
72
+ if [ -f "$PROJECT_PATH/spec.md" ]; then
73
+ cat "$PROJECT_PATH/spec.md" | head -10 | grep "oat_status:"
74
+ fi
63
75
  ```
64
76
 
65
- **Required frontmatter:**
77
+ **If `spec.md` exists, required frontmatter:**
66
78
 
67
79
  - `oat_status: complete`
68
80
  - `oat_ready_for: oat-project-design`
69
81
 
70
- **If not complete:** Block and ask user to finish specification first.
82
+ **If `spec.md` exists but is incomplete:** Block and ask user to finish the standalone spec skill first, OR delete the draft and let this skill regenerate it from discovery.
71
83
 
72
- ### Step 2: Read Specification Document
84
+ **If `spec.md` does not exist:** That is the default path. Skip to Step 1.5 (mode resolution); Step 2 (Requirements Confirmation) will produce it from `discovery.md`.
73
85
 
74
- Read `"$PROJECT_PATH/spec.md"` completely to understand:
86
+ ### Step 1.5: Resolve Interaction Mode
75
87
 
76
- - Problem statement and goals
77
- - All functional requirements (FR)
78
- - All non-functional requirements (NFR)
79
- - Constraints and dependencies
80
- - High-level design proposal
81
- - Success metrics
88
+ Resolve whether to run the design phase in Collaborative (section-by-section), Selective Collaborative (section-by-section only for sections that need eyes), or Draft-and-review (full draft up front) mode. Argument precedes env var. An **explicit** non-interactive signal forces draft. Persisted config preference is consulted before prompting the user.
82
89
 
83
- ### Step 3: Read Knowledge Base for Design Context
90
+ > **Tool availability is not the same as interactivity.** If the structured `AskUserQuestion` tool is unavailable but the assistant can still exchange normal chat messages with the user, run Collaborative mode using plain chat prompts. Use Draft-and-review only for explicit non-interactive execution (`OAT_NON_INTERACTIVE=1`) or when no user-response channel exists at all (e.g., a CI job with stdin fully redirected from `/dev/null` and no agent-side user turn).
84
91
 
85
- Read for architectural context and conventions:
92
+ ```bash
93
+ # 1. Check for explicit override (argument wins over env var — FR1)
94
+ DESIGN_MODE="${ARG_MODE:-${OAT_DESIGN_MODE:-}}"
95
+
96
+ # 2. If no override, check for EXPLICIT non-interactive signals only.
97
+ # Lack of a structured question tool (e.g., AskUserQuestion unavailable)
98
+ # is NOT a non-interactive signal by itself — if normal chat with the
99
+ # user is available, the session is still interactive.
100
+ if [ -z "$DESIGN_MODE" ]; then
101
+ if [ "${OAT_NON_INTERACTIVE:-}" = "1" ] || no_user_response_channel_exists; then
102
+ DESIGN_MODE="draft"
103
+ echo "Non-interactive context detected. Falling back to draft-and-review mode."
104
+ else
105
+ # 3. Consult persisted preference (FR15 / Component 14) before prompting
106
+ CONFIG_MODE=$(oat config get workflow.designMode 2>/dev/null || echo "")
107
+ if [ "$CONFIG_MODE" = "collaborative" ] || [ "$CONFIG_MODE" = "selective" ] || [ "$CONFIG_MODE" = "draft" ]; then
108
+ DESIGN_MODE="$CONFIG_MODE"
109
+ echo "Using workflow.designMode = ${DESIGN_MODE} from config."
110
+ else
111
+ # 4. Interactive: run the selective preflight, then prompt the user.
112
+ # The preflight uses references/selective-review-pass.md to classify
113
+ # sections and determine whether Selective Collaborative is
114
+ # recommended, available, available-not-recommended, or unavailable.
115
+ # Default recommendation is Collaborative when in doubt; Draft is
116
+ # never the default recommendation from the picker.
117
+ #
118
+ # - Prefer AskUserQuestion for structured multi-choice when it is
119
+ # available.
120
+ # - If AskUserQuestion is unavailable, ask the same question as a
121
+ # plain chat message and wait for the user's reply. Do NOT switch
122
+ # to draft mode just because the structured tool is missing.
123
+ #
124
+ # Question: "How would you like to work through the design?
125
+ # 1. Collaborative — section-by-section, every section confirmed
126
+ # 2. Selective collaborative — agent drafts routine sections silently
127
+ # and walks you through high-risk sections live; before drafting,
128
+ # you'll see which sections will be presented and why
129
+ # 3. Draft-and-review — full draft up front, you review the committed file"
130
+ # Mark exactly one option "(recommended for this design)". Hide or
131
+ # label Selective unavailable when grounding is broadly absent:
132
+ # - Recommended: "Selective collaborative (recommended for this design)"
133
+ # - Available: "Selective collaborative (available)"
134
+ # - Available-not-recommended: "Selective collaborative (available, not recommended)"
135
+ # - Unavailable: "Selective collaborative (unavailable — insufficient grounding context)"
136
+ # If Selective is recommended, add one sentence explaining the section
137
+ # count and adequate grounding.
138
+ #
139
+ # Result populates DESIGN_MODE
140
+ :
141
+ fi
142
+ fi
143
+ fi
144
+
145
+ echo "Running in ${DESIGN_MODE} mode."
146
+ ```
86
147
 
87
- - `.oat/repo/knowledge/project-index.md` - Overview
88
- - `.oat/repo/knowledge/architecture.md` - Existing patterns
89
- - `.oat/repo/knowledge/stack.md` - Technologies available
90
- - `.oat/repo/knowledge/conventions.md` - Code patterns to follow
91
- - `.oat/repo/knowledge/integrations.md` - External services
92
- - `.oat/repo/knowledge/concerns.md` - Issues to avoid
148
+ **Resolution order (FR1 + FR15):**
93
149
 
94
- **Purpose:** Ensure design aligns with existing architecture and follows established patterns.
150
+ 1. `--mode` argument (`ARG_MODE`)
151
+ 2. `OAT_DESIGN_MODE` env var
152
+ 3. **Explicit** non-interactive signal (`OAT_NON_INTERACTIVE=1`, or the runtime truly cannot pause for any user response) → forces `draft`
153
+ 4. `workflow.designMode` from effective config
154
+ 5. Interactive prompt (default: Collaborative)
155
+
156
+ Runtime/context signals always outrank persisted preferences. **Missing `AskUserQuestion` is not a non-interactive signal** — fall through to the plain-chat prompt path instead.
157
+
158
+ **Selective recommendation states:** `recommended` when grounding is adequate and at least 3 sections (or about 30-40% of sections) classify as routine; `available` when it can run but Collaborative is safer; `available-not-recommended` when savings are marginal; `unavailable` when grounding is broadly absent. Do not offer Selective Collaborative from quick-start — this mode is only for full `oat-project-design`.
159
+
160
+ **Recovery — draft mode entered by mistake:** If the agent drafted and committed the full design in draft mode because `AskUserQuestion` was unavailable but normal chat was available, do **not** mark the design complete. Treat the committed draft as a starting point and walk it section by section with the user via plain chat — present each section, ask for confirmation or changes, revise and commit on feedback, then move to the next section. Only after the section-by-section pass approves the full artifact should Step 6's user-review gate be considered satisfied.
95
161
 
96
- ### Step 4: Initialize Design Document
162
+ ### Step 2: Requirements Confirmation (folded spec authoring)
97
163
 
98
- Copy template: `.oat/templates/design.md` → `"$PROJECT_PATH/design.md"`
164
+ <!--
165
+ Requirements-confirmation sub-step.
166
+ The authoring logic below duplicates oat-project-spec Steps 6-16.
167
+ When updating the requirements-authoring prose, update BOTH files.
168
+ -->
99
169
 
100
- Update frontmatter:
170
+ **If `spec.md` already exists with `oat_status: complete`** (produced by the optional standalone `oat-project-spec` skill): read it to understand Problem Statement, FRs/NFRs, Constraints, Dependencies, High-Level Design, Success Metrics, Requirement Index. Then skip to Step 2.5 (Approach Reaffirmation).
171
+
172
+ **Otherwise** (default path — no `spec.md` yet): author `spec.md` inline by formalizing requirements from `discovery.md`, following the steps below (ported from `oat-project-spec` Steps 6-16).
173
+
174
+ **Step 2a: Read discovery**
175
+
176
+ Read `"$PROJECT_PATH/discovery.md"` and extract:
177
+
178
+ - **Initial Request** → Core problem
179
+ - **Clarifying Questions** → Context and nuances
180
+ - **Key Decisions** → Scope boundaries, FR seeds
181
+ - **Success Criteria** → Goals and NFR seeds
182
+ - **Constraints** → Constraints section
183
+ - **Out of Scope** → Non-Goals
184
+
185
+ **Step 2b: Initialize spec.md from template**
186
+
187
+ Copy `.oat/templates/spec.md` → `"$PROJECT_PATH/spec.md"`. Update frontmatter:
101
188
 
102
189
  ```yaml
103
190
  ---
@@ -110,271 +197,435 @@ oat_template: false
110
197
  ---
111
198
  ```
112
199
 
113
- ### Step 5: Draft Architecture Overview
200
+ **Step 2c: Draft Problem Statement**
114
201
 
115
- Based on spec's high-level design + knowledge base architecture:
202
+ Transform from discovery: Initial Request → Core problem; Clarifying Questions → Context; Key Decisions → Scope boundaries. Write 2-4 paragraphs clearly describing the problem being solved.
116
203
 
117
- **System Context:**
204
+ **Step 2d: Define Goals and Non-Goals**
118
205
 
119
- - How this fits into existing architecture
120
- - What components it interacts with
121
- - Boundaries of this change
206
+ **Primary Goals:** Must-have outcomes (from Key Decisions + Success Criteria).
207
+ **Secondary Goals:** Nice-to-have outcomes (Success Criteria marked optional).
208
+ **Non-Goals:** Copy from discovery "Out of Scope", adding explicit boundaries and related work intentionally excluded.
122
209
 
123
- **Key Components:**
210
+ **Step 2e: Draft Requirements**
124
211
 
125
- - List main components needed
126
- - Define responsibilities
127
- - Show relationships
212
+ Transform Key Decisions and Success Criteria into structured requirements.
128
213
 
129
- **Data Flow:**
214
+ **Functional Requirements (FR):**
130
215
 
131
- - How data moves through the system
132
- - Entry points and exit points
133
- - Transformation steps
216
+ ```markdown
217
+ **FR1: {Requirement Name}**
134
218
 
135
- Update design.md Architecture section.
219
+ - **Description:** {What the system must do}
220
+ - **Acceptance Criteria:**
221
+ - {Testable criterion 1}
222
+ - {Testable criterion 2}
223
+ - **Priority:** P0 / P1 / P2
224
+ ```
136
225
 
137
- ### Step 6: Design Components
226
+ **Non-Functional Requirements (NFR):**
138
227
 
139
- For each component identified:
228
+ ```markdown
229
+ **NFR1: {Requirement Name}**
140
230
 
141
- **Component Details:**
231
+ - **Description:** {Performance, security, usability requirement}
232
+ - **Acceptance Criteria:**
233
+ - {Measurable criterion}
234
+ - **Priority:** P0 / P1 / P2
235
+ ```
142
236
 
143
- ```markdown
144
- ### {Component Name}
237
+ **Priorities:**
145
238
 
146
- **Purpose:** {Single responsibility}
239
+ - **P0:** Must have — blocks launch
240
+ - **P1:** Should have — important but not blocking
241
+ - **P2:** Nice to have — future enhancement
147
242
 
148
- **Responsibilities:**
243
+ **Step 2f: Iterate with user (collaborative and selective modes only)**
149
244
 
150
- - {Specific task 1}
151
- - {Specific task 2}
245
+ ```
246
+ IF DESIGN_MODE == "collaborative" || DESIGN_MODE == "selective":
247
+ Present draft requirements list to user.
248
+ Ask (AskUserQuestion): "Are these requirements complete? Anything missing or unclear?"
249
+ Update spec.md with refinements; update oat_last_updated.
250
+ Repeat until user confirms completeness.
251
+
252
+ IF DESIGN_MODE == "draft":
253
+ Commit the drafted requirements as part of the one-pass draft.
254
+ The user reviews them holistically at the user-review gate (Step 6).
255
+ ```
152
256
 
153
- **Interfaces:**
154
- {Code signatures following conventions.md patterns}
257
+ **Focus areas:** Acceptance criteria testable; priorities clear; edge cases covered; dependencies identified.
155
258
 
156
- **Dependencies:**
259
+ **Step 2g: Document Constraints and Dependencies**
157
260
 
158
- - {What it depends on}
261
+ Copy from discovery "Constraints" and enrich with technical constraints from knowledge base (architecture.md, concerns.md), business/timeline/resource constraints. Identify dependencies: external systems (integrations.md), existing components (architecture.md), third-party libraries, infrastructure.
159
262
 
160
- **Design Decisions:**
263
+ **Step 2h: Draft High-Level Design in spec.md**
161
264
 
162
- - {Why this approach}
163
- ```
265
+ Transform discovery "Options Considered" into design proposal:
164
266
 
165
- Follow patterns from conventions.md. Use stack.md technologies.
267
+ ```markdown
268
+ ## High-Level Design (Proposed)
166
269
 
167
- ### Step 7: Define Data Models
270
+ {2-3 paragraph overview of chosen approach}
168
271
 
169
- For each entity/model needed:
272
+ **Key Components:**
170
273
 
171
- **Model Schema:**
274
+ - {Component 1} — {Brief description}
172
275
 
173
- - Define fields and types
174
- - Validation rules
175
- - Storage approach (from architecture.md patterns)
276
+ **Alternatives Considered:**
176
277
 
177
- **Considerations:**
278
+ - {Alternative 1} — {Why rejected}
178
279
 
179
- - Align with existing models (from architecture.md)
180
- - Follow naming conventions (from conventions.md)
181
- - Address NFR requirements (performance, security)
280
+ **Open Questions:**
182
281
 
183
- ### Step 8: Design APIs
282
+ - {Question needing resolution}
283
+ ```
184
284
 
185
- For each API endpoint or interface:
285
+ Keep high-level detailed design comes in `design.md` below.
186
286
 
187
- **Specification:**
287
+ **Guardrail:** Do not name specific scripts/files/functions here. Describe components and responsibilities only.
188
288
 
189
- - Method and path
190
- - Request/response schemas
191
- - Error handling approach
192
- - Authorization requirements
289
+ **Step 2i: Define Success Metrics**
193
290
 
194
- **Considerations:**
291
+ Transform "Success Criteria" into measurable metrics (performance, quality, user, business).
195
292
 
196
- - Follow API patterns from architecture.md
197
- - Align with integrations.md external API patterns
198
- - Address security NFRs
293
+ **Step 2j: Populate Requirement Index**
199
294
 
200
- ### Step 9: Address Security Considerations
295
+ Create traceability matrix in spec.md "Requirement Index" section:
201
296
 
202
- Based on NFRs + concerns.md:
297
+ | Column | Content |
298
+ | ------------- | --------------------------------------------- |
299
+ | ID | FR1, FR2, NFR1, etc. (sequential) |
300
+ | Description | Brief 1-sentence summary |
301
+ | Priority | P0/P1/P2 from requirement |
302
+ | Verification | `method: pointer` — how this will be verified |
303
+ | Planned Tasks | Leave as "TBD - see plan.md" |
203
304
 
204
- **Required sections:**
305
+ **Verification column format:** `method: pointer` — method is `unit` / `integration` / `e2e` / `manual` / `perf`; pointer is a brief scope hint (e.g., `unit: auth token validation`).
205
306
 
206
- - Authentication approach
207
- - Authorization model
208
- - Data protection (encryption, PII)
209
- - Input validation strategy
210
- - Threat mitigation
307
+ **Step 2k: Quality Gate (merged into Step 5 self-review)**
211
308
 
212
- Reference security patterns from conventions.md and concerns.md.
309
+ The prior standalone-spec quality gate (completeness / quality / boundary checks) now merges into Step 5 (Design Self-Review) — those checks run once against both `spec.md` and `design.md` together rather than twice.
213
310
 
214
- ### Step 10: Address Performance Considerations
311
+ **Step 2l: Mark spec.md complete and commit**
215
312
 
216
- Based on NFRs + concerns.md:
313
+ Update spec.md frontmatter:
217
314
 
218
- **Required sections:**
315
+ ```yaml
316
+ oat_status: complete
317
+ oat_ready_for: oat-project-design
318
+ oat_last_updated: { today }
319
+ ```
219
320
 
220
- - Scalability approach
221
- - Caching strategy
222
- - Database optimization
223
- - Resource limits
321
+ Commit separately (keeps history clean; lets reviewers fetch spec independently):
224
322
 
225
- Reference performance patterns from concerns.md.
323
+ ```bash
324
+ git add "$PROJECT_PATH/spec.md"
325
+ git commit -m "docs: confirm requirements for {project-name}"
326
+ ```
226
327
 
227
- ### Step 11: Define Error Handling
328
+ ### Step 2.5: Approach Reaffirmation (one divergent moment)
228
329
 
229
- **Error Strategy:**
330
+ This is the sole divergent-thinking moment in the skill. After requirements are confirmed and before drafting begins, reaffirm the approach-level direction. Do this exactly once per run.
230
331
 
231
- - Error categories and handling
232
- - Retry logic
233
- - Logging approach (follow conventions.md patterns)
332
+ ```
333
+ Read "$PROJECT_PATH/discovery.md" — look for "## Solution Space" section
334
+ with a "### Chosen Direction" sub-section.
234
335
 
235
- ### Step 12: Define Testing Strategy
336
+ IF Chosen Direction exists:
337
+ Present to user:
338
+ "Based on discovery, we're designing around [Approach N — one-line summary].
339
+ Confirming this is still the right direction before I draft the design?"
340
+ Use AskUserQuestion:
341
+ 1. Yes — proceed with this approach
342
+ 2. Revisit — I want to explore alternatives again
343
+ If "Revisit": invoke the 2-3-approaches block below.
236
344
 
237
- Based on spec success metrics + testing.md:
345
+ IF no Chosen Direction (or Solution Space section absent):
346
+ Invoke the 2-3-approaches pattern inline:
238
347
 
239
- **Step 12a: Create Requirement-to-Test Mapping**
348
+ > Propose 2-3 different approaches with trade-offs.
349
+ > Present options conversationally with your recommendation and reasoning.
350
+ > Lead with your recommended option and explain why.
240
351
 
241
- Pull from spec.md Requirement Index and expand:
352
+ Ask user to choose. Document the chosen approach in design.md's
353
+ Overview section before section drafting begins.
242
354
 
243
- | ID | Verification | Key Scenarios |
244
- | ----------- | ------------------ | ---------------------------------------- |
245
- | {from spec} | {method from spec} | {scenarios seeded from pointer + design} |
355
+ Record confirmed approach in design.md §Overview before Step 4 (section iterator).
356
+ ```
246
357
 
247
- For each requirement:
358
+ **Key points:**
248
359
 
249
- 1. Copy the ID from spec.md
250
- 2. Copy the **method** (left side of `method: pointer`) into Verification
251
- 3. Use the **pointer** (right side) to seed Key Scenarios
252
- 4. Expand scenarios based on component design decisions
253
- 5. Note if multiple test levels apply (e.g., "unit + integration")
360
+ - One divergent moment per run — not per section. Section-level divergence happens organically when the user pushes back on a drafted section (see Step 4).
361
+ - Reaffirmation, not re-derivation: if discovery already chose a direction, confirm and move on.
362
+ - The 2-3-approaches block handles the case where discovery skipped solution-space exploration (well-understood request).
254
363
 
255
- **Step 12b: Define Test Levels**
364
+ ### Step 3: Read Knowledge Base for Design Context
256
365
 
257
- - Unit tests: scope and coverage target
258
- - Integration tests: key scenarios and test environment
259
- - E2E tests: critical user paths
366
+ Read for architectural context and conventions:
260
367
 
261
- Follow testing patterns from testing.md.
368
+ - `.oat/repo/knowledge/project-index.md` - Overview
369
+ - `.oat/repo/knowledge/architecture.md` - Existing patterns
370
+ - `.oat/repo/knowledge/stack.md` - Technologies available
371
+ - `.oat/repo/knowledge/conventions.md` - Code patterns to follow
372
+ - `.oat/repo/knowledge/integrations.md` - External services
373
+ - `.oat/repo/knowledge/concerns.md` - Issues to avoid
262
374
 
263
- **Why mapping matters:**
375
+ **Purpose:** Ensure design aligns with existing architecture and follows established patterns.
264
376
 
265
- - Ensures every requirement has a verification plan
266
- - Feeds directly into `oat-project-plan` task breakdown
267
- - Prevents "untested requirements" gaps
377
+ ### Step 4: Section Iterator
268
378
 
269
- ### Step 13: Plan Deployment
379
+ Draft `design.md` section-by-section (Collaborative mode) or in a single pass (Draft-and-review mode). The section list and per-section templates are shared between both branches.
270
380
 
271
- **Deployment Strategy:**
381
+ **Shared section list (in order):**
272
382
 
273
- - Build process (from stack.md)
274
- - Deployment steps
275
- - Rollback plan
276
- - Configuration approach
277
- - Monitoring and alerts
383
+ 1. **Overview + Architecture** — System context (how this fits into existing architecture, components it interacts with, boundaries of this change); Key Components (main components, responsibilities, relationships); Data Flow (how data moves through the system, entry/exit points, transformation steps).
384
+ 2. **Component Design** — For each component: Purpose (single responsibility), Responsibilities (specific tasks), Interfaces (code signatures following `conventions.md`), Dependencies, Design Decisions (why this approach). Follow patterns from `conventions.md`; use `stack.md` technologies.
385
+ 3. **Data Models** — For each entity/model: Schema (fields, types, validation, storage from `architecture.md`); Considerations (align with existing models; follow naming from `conventions.md`; address NFRs).
386
+ 4. **API Design** — For each API/interface: Method and path, Request/response schemas, Error handling, Authorization; Considerations (follow API patterns from `architecture.md`; align with `integrations.md`; address security NFRs).
387
+ 5. **Security Considerations** — Authentication, Authorization, Data protection (encryption, PII), Input validation, Threat mitigation. Reference `conventions.md` and `concerns.md`.
388
+ 6. **Performance Considerations** — Scalability, Caching, Database optimization, Resource limits. Reference `concerns.md`.
389
+ 7. **Error Handling** — Error categories and handling, Retry logic, Logging approach (follow `conventions.md`).
390
+ 8. **Testing Strategy (with Requirement-to-Test Mapping)** —
391
+ - **Step a (Requirement-to-Test Mapping):** Pull from spec.md Requirement Index and expand into a table with `ID | Verification | Key Scenarios`. For each requirement: copy the ID, copy the **method** (left side of `method: pointer`) into Verification, use the **pointer** (right side) to seed Key Scenarios, expand scenarios based on component design decisions, note if multiple test levels apply.
392
+ - **Step b (Test Levels):** Unit tests (scope and coverage target), Integration tests (key scenarios and test environment), E2E tests (critical user paths). Follow `testing.md`.
393
+ - **Why mapping matters:** Every requirement gets a verification plan; feeds `oat-project-plan` task breakdown; prevents untested-requirement gaps.
394
+ 9. **Deployment Strategy** — Build process (from `stack.md`), Deployment steps, Rollback plan, Configuration, Monitoring and alerts.
395
+ 10. **Migration Plan** — Database migrations, Data migrations, Breaking changes handling, Rollback strategy. If not applicable, state as a single sentence.
396
+ 11. **Implementation Phases** — Break work into manageable phases (1-3 days each). Per-phase structure: Goal, Tasks (high-level), Verification.
397
+ 12. **Risks and Mitigation** — For each significant risk: Probability | Impact; Mitigation; Contingency.
278
398
 
279
- ### Step 14: Plan Migrations
399
+ ### Step 4a: Selective Review Pass
280
400
 
281
- If changes require migrations:
401
+ If `DESIGN_MODE == "selective"`, classify every section before drafting and present the Section Review Plan to the user. Use `.agents/skills/oat-project-design/references/selective-review-pass.md` for the full signal set, grounding rules, edge cases, and dogfood notes.
282
402
 
283
- **Migration Plan:**
403
+ The pass returns a table with `Section | Classification | Reason | Signals hit`. Classifications are `routine` or `needs-eyes`. Bias is conservative: any one needs-eyes signal marks the section `needs-eyes`. `Overview + Architecture`, `Security Considerations`, `Performance Considerations`, `Error Handling`, and `Migration Plan` are high-risk-by-default and always `needs-eyes`; if no section is marked `needs-eyes`, force `Overview + Architecture` to `needs-eyes` so the user sees the framing.
284
404
 
285
- - Database migrations
286
- - Data migrations
287
- - Breaking changes handling
288
- - Rollback strategy
405
+ Before drafting, print `## Section Review Plan` followed by `Section | Classification | Reason | Signals hit`.
289
406
 
290
- ### Step 15: Identify Implementation Phases
407
+ Then ask: "Proceed with this section review plan, or elevate any routine sections to needs-eyes?" If the user elevates sections, update the plan. If every section is `needs-eyes`, say "All sections flagged for review — running as full collaborative" and use the Collaborative branch.
291
408
 
292
- Break work into phases:
409
+ **YAGNI check per section:** If the section would draft a capability `spec.md` doesn't require, cut it. If a component boundary is speculative ("in case we need it later"), cut it.
293
410
 
294
- **Phase Structure:**
411
+ **Collaborative branch:**
295
412
 
296
- ```markdown
297
- ### Phase 1: {Phase Name}
413
+ ```
414
+ IF DESIGN_MODE == "collaborative":
415
+ Read spec.md for requirements context; read knowledge base.
416
+
417
+ Do NOT create or write to design.md yet — sections are drafted in
418
+ context and shown to the user inline. design.md is assembled and
419
+ written to disk only after all sections are approved (see end of
420
+ this branch). Writing per-section to file is wrong in collaborative
421
+ mode; it bypasses the per-section review and produces a committed
422
+ artifact the user never read.
423
+
424
+ For SECTION in [
425
+ "Overview + Architecture",
426
+ "Component Design",
427
+ "Data Models",
428
+ "API Design",
429
+ "Security Considerations",
430
+ "Performance Considerations",
431
+ "Error Handling",
432
+ "Testing Strategy (with Requirement-to-Test Mapping)",
433
+ "Deployment Strategy",
434
+ "Migration Plan",
435
+ "Implementation Phases",
436
+ "Risks and Mitigation"
437
+ ]:
438
+ Draft section content from spec.md + knowledge base. Scale each
439
+ section to its complexity: a few sentences if straightforward,
440
+ up to 200-300 words if nuanced.
441
+ Not-applicable sections: state as a single sentence, not empty
442
+ (e.g., "No database migrations required.").
443
+
444
+ STEP A — emit the section content as a plain assistant message.
445
+ Show the full drafted text, not a summary. Do NOT put the section
446
+ content inside an AskUserQuestion prompt — the question widget is
447
+ for the confirmation choices only.
448
+
449
+ STEP B — ask for approval (separate message, via AskUserQuestion
450
+ when available, or as a plain chat message when it is not; do
451
+ not downgrade to draft mode just because AskUserQuestion is
452
+ missing):
453
+ "Does this look right, or should we adjust before continuing?"
454
+
455
+ On feedback: revise the draft in context. Re-emit the revised
456
+ section if the change is substantive. Only the final approved
457
+ text gets written to design.md.
458
+ Mark section approved. Move to next.
459
+
460
+ Track which sections have been approved so re-runs don't redo
461
+ finalized sections. Divergent thinking during sections happens
462
+ organically in response to user feedback — there is no scripted
463
+ per-section "present 2-3 options" step (that happened once at
464
+ Step 2.5 Approach Reaffirmation).
465
+
466
+ Once ALL sections are approved:
467
+ Copy `.oat/templates/design.md` → `"$PROJECT_PATH/design.md"`.
468
+ Write each approved section into the corresponding template
469
+ section. Update frontmatter:
470
+ oat_status: in_progress
471
+ oat_ready_for: null
472
+ oat_blockers: []
473
+ oat_last_updated: {today}
474
+ oat_generated: false
475
+ oat_template: false
476
+ Continue to Step 5 (Self-Review) and Step 6 (User-Review Gate).
477
+ ```
298
478
 
299
- **Goal:** {What this achieves}
479
+ **Selective Collaborative branch:**
300
480
 
301
- **Tasks:**
481
+ ```
482
+ IF DESIGN_MODE == "selective":
483
+ Read spec.md for requirements context; read knowledge base.
484
+ Run Step 4a if not already run during the picker.
485
+
486
+ Do NOT create or write to design.md yet. Draft routine sections
487
+ silently in memory; present needs-eyes sections inline using the
488
+ Collaborative approval mechanics.
489
+
490
+ For SECTION in shared section list:
491
+ Draft section content from spec.md + knowledge base.
492
+ Apply the same YAGNI and not-applicable rules as Collaborative mode.
493
+
494
+ IF SECTION classification == "routine":
495
+ Store the drafted section in the approved-section buffer.
496
+ Track SECTION in SILENT_SECTIONS for Step 6.
497
+
498
+ IF SECTION classification == "needs-eyes":
499
+ Emit the full section content as a plain assistant message.
500
+ Ask: "Does this look right, should we adjust, or should I walk
501
+ through every remaining section?"
502
+ If user chooses walk-through: mark every remaining section
503
+ needs-eyes and continue like Collaborative mode.
504
+ On feedback: revise in context; only final approved text gets
505
+ written to design.md.
506
+
507
+ Once ALL sections are approved or silently accepted:
508
+ Copy `.oat/templates/design.md` → `"$PROJECT_PATH/design.md"`.
509
+ Write each section into the corresponding template section.
510
+ Update frontmatter as in Collaborative mode.
511
+ Continue to Step 5 (Self-Review) and Step 6 (User-Review Gate).
512
+ ```
302
513
 
303
- - {High-level task 1}
304
- - {High-level task 2}
514
+ **Draft-and-review branch:**
305
515
 
306
- **Verification:** {How to verify completion}
516
+ ```
517
+ IF DESIGN_MODE == "draft":
518
+ Read spec.md for requirements context; read knowledge base.
519
+
520
+ Initialize design.md now (draft-and-review writes first, user
521
+ reviews the committed file):
522
+ Copy `.oat/templates/design.md` → `"$PROJECT_PATH/design.md"`.
523
+ Update frontmatter:
524
+ oat_status: in_progress
525
+ oat_ready_for: null
526
+ oat_blockers: []
527
+ oat_last_updated: {today}
528
+ oat_generated: false
529
+ oat_template: false
530
+
531
+ Draft all applicable sections in one pass using the same section
532
+ list above. Apply the same "scale each section to its complexity"
533
+ principle. Not-applicable sections get a single-sentence statement.
534
+ Do NOT fire per-section validation prompts — this is a one-pass draft.
535
+ Append a banner to design.md when non-interactive:
536
+ "Ran in draft-and-review mode — no interactive user present.
537
+ Review manually before plan generation." (FR9 — applies when the
538
+ mode was selected via non-interactive fallback, not when the user
539
+ explicitly chose draft mode interactively.)
540
+ Write the complete design.md.
541
+ Continue to Step 5 (Self-Review) and Step 6 (User-Review Gate).
542
+ The user-review gate is the sole point of user interaction in draft mode.
307
543
  ```
308
544
 
309
- Keep phases manageable (1-3 days of work each).
545
+ ### Step 5: Design Self-Review
310
546
 
311
- ### Step 16: Document Open Questions
547
+ Silent agent-side quality pass no user prompt fires here. After all sections are drafted (in either mode), look at `design.md` and `spec.md` with fresh eyes and run four named checks. Fix issues inline; do not recurse on self-review.
312
548
 
313
- Track unresolved design questions:
549
+ 1. **Placeholder scan** — Search `design.md` and `spec.md` for `TBD`, `TODO`, `FIXME`, `...`, and placeholder sections that just say "Not applicable" without elaboration. Fix inline.
550
+ 2. **Internal consistency** — Does the architecture description match the component design? Do the API request/response shapes match the data models? Does the testing strategy cover the requirements? Fix inline.
551
+ 3. **Scope check** — Did the design grow beyond what discovery scoped? If out-of-scope items crept in, move them to discovery.md "Deferred Ideas". If genuine multi-subsystem scope surfaces, escalate to the user — they may want to split into multiple projects (follow-up split-escape-hatch work, not this skill's responsibility).
552
+ 4. **Ambiguity check** — Could any requirement or design statement be interpreted two ways? Pick one and make it explicit.
314
553
 
315
- - Decisions needing user input
316
- - Technical uncertainties
317
- - Performance unknowns
554
+ Apply fixes inline. Do not re-run self-review. Continue to Step 6 (User-Review Gate).
318
555
 
319
- ### Step 17: Assess Risks
556
+ ### Step 6: User-Review Gate (commit-first ordering)
320
557
 
321
- For each significant risk:
558
+ By the time Step 6 runs, `design.md` already exists on disk regardless of mode:
322
559
 
323
- **Risk Assessment:**
560
+ - **Collaborative**: written at the end of the Step 4 approval loop, after all sections were confirmed in chat.
561
+ - **Selective Collaborative**: written at the end of the Step 4 selective loop, after `needs-eyes` sections were confirmed and `routine` sections were silently accepted.
562
+ - **Draft-and-review**: written in Step 4 as the one-pass draft.
324
563
 
325
- ```markdown
326
- - **{Risk Name}:** {Probability} | {Impact}
327
- - **Mitigation:** {How to reduce}
328
- - **Contingency:** {Backup plan}
329
- ```
564
+ Step 6 commits the file and then (if a HiLL gate is configured) presents the user-review prompt. This keeps the "written and committed" prompt wording literally accurate.
330
565
 
331
- ### Step 18: Review Design with User
566
+ **Step 6a: Commit drafted artifacts (before user-review gate)**
332
567
 
333
- **Review Points:**
568
+ Even when no HiLL checkpoint is configured, the artifact is committed — consistent behavior across HiLL-on / HiLL-off configurations. "Committed" no longer means "approved" — it means "written to disk and tracked."
334
569
 
335
- 1. Architecture aligns with requirements
336
- 2. Component responsibilities clear
337
- 3. Data models cover all entities
338
- 4. APIs meet functional requirements
339
- 5. Security addresses NFRs
340
- 6. Performance addresses NFRs
341
- 7. Testing strategy adequate
342
- 8. Implementation phases reasonable
570
+ ```bash
571
+ # Update design.md frontmatter for the draft commit:
572
+ # oat_status: in_progress
573
+ # oat_ready_for: null
574
+ # oat_last_updated: {today}
343
575
 
344
- **Iterate:** Make refinements based on feedback, update `oat_last_updated`.
576
+ git add "$PROJECT_PATH/spec.md" "$PROJECT_PATH/design.md" "$PROJECT_PATH/state.md"
577
+ git diff --cached --quiet || git commit -m "docs: draft design for {project-name} (awaiting review)"
578
+ ```
345
579
 
346
- ### Step 19: Human-in-the-Loop Lifecycle (HiLL) Gate (If Configured)
580
+ **Step 6b: Read state.md frontmatter**
347
581
 
348
- Read `"$PROJECT_PATH/state.md"` frontmatter:
582
+ Read `"$PROJECT_PATH/state.md"`:
349
583
 
350
584
  - `oat_hill_checkpoints`
351
585
  - `oat_hill_completed`
352
586
 
353
- If `"design"` is in `oat_hill_checkpoints`, require explicit user approval before advancing.
587
+ **Step 6c: If no HiLL gate configured, skip prompt (artifact still committed)**
354
588
 
355
- **Approval prompt (required):**
589
+ If neither `"design"` nor `"spec"` is in `oat_hill_checkpoints`: no user-review prompt fires; artifact is committed. Skip to Step 7.
356
590
 
357
- - "Design artifact is ready. Approve design and unlock `oat-project-plan`?"
591
+ **Step 6d: If HiLL gate configured, present the user-review prompt**
358
592
 
359
- **Optional independent review path:**
593
+ If `"design"` is in `oat_hill_checkpoints` (or `"spec"` is in `oat_hill_checkpoints` and was not already completed via the standalone `oat-project-spec` skill):
360
594
 
361
- - If user wants fresh-context artifact review first, run:
362
- - `oat-project-review-provide artifact design`
363
-
364
- **If user does not approve yet:**
595
+ ```
596
+ Prompt (required wording):
597
+
598
+ > "Design written and committed to {design.md path}.
599
+ > spec.md (with confirmed requirements) is at {spec.md path}.
600
+ > Please review them and let me know if you want to make any changes
601
+ > before we move to planning.
602
+ >
603
+ > Optional: run `oat-project-review-provide artifact design` for an
604
+ > independent reviewer pass first."
605
+
606
+ If `DESIGN_MODE == "selective"` and `SILENT_SECTIONS` is non-empty, append: "Drafted without live confirmation: {SILENT_SECTIONS}. Please review those sections especially carefully in the committed file."
607
+
608
+ Wait for user response:
609
+
610
+ - Approval → continue to Step 7.
611
+ - Change requests → revise the relevant section(s), re-run Step 5
612
+ (Self-Review), then MAKE A NEW COMMIT:
613
+ git add "$PROJECT_PATH/spec.md" "$PROJECT_PATH/design.md"
614
+ git commit -m "docs: revise design after user review feedback"
615
+ Re-present this prompt.
616
+ - If user does not approve yet (wants to pause without explicit change
617
+ requests): keep design frontmatter as oat_status: in_progress /
618
+ oat_ready_for: null; do not append "design" to oat_hill_completed;
619
+ stop and report: "Design draft committed; awaiting HiLL approval."
620
+ ```
365
621
 
366
- - Keep design frontmatter as:
367
- - `oat_status: in_progress`
368
- - `oat_ready_for: null`
369
- - Keep project state as in-progress for design.
370
- - Do **not** append `"design"` to `oat_hill_completed`.
371
- - Stop and report: "Design draft saved; awaiting HiLL approval."
622
+ ### Step 7: Approval — Mark Design Complete and Update HiLL State
372
623
 
373
- If design is not configured as a HiLL checkpoint, or user explicitly approves, continue to Step 20.
624
+ On approval (either explicit user approval when HiLL gate fired, or automatic when no HiLL gate is configured):
374
625
 
375
- ### Step 20: Mark Design Complete
626
+ **Step 7a: Mark design.md complete**
376
627
 
377
- Update frontmatter:
628
+ Update `design.md` frontmatter:
378
629
 
379
630
  ```yaml
380
631
  ---
@@ -385,19 +636,20 @@ oat_last_updated: { today }
385
636
  ---
386
637
  ```
387
638
 
388
- ### Step 21: Update Project State
639
+ **Step 7b: Update project state.md**
389
640
 
390
641
  Update `"$PROJECT_PATH/state.md"`:
391
642
 
392
643
  **Frontmatter updates:**
393
644
 
394
645
  - `oat_current_task: null`
395
- - `oat_last_commit: {commit_sha_from_step_22}`
646
+ - `oat_last_commit: {commit_sha_from_step_6a_or_revision}`
396
647
  - `oat_blockers: []`
397
648
  - `oat_phase: design`
398
649
  - `oat_phase_status: complete`
399
650
  - `oat_project_state_updated: "{ISO 8601 UTC timestamp}"`
400
- - **If** `"design"` is in `oat_hill_checkpoints`: append `"design"` to `oat_hill_completed` array
651
+ - **If** `"design"` is in `oat_hill_checkpoints`: append `"design"` to `oat_hill_completed` array.
652
+ - **If** `"spec"` is in `oat_hill_checkpoints` and not previously completed via the standalone spec skill: append `"spec"` too (folded HiLL — a single approval covers both).
401
653
 
402
654
  **Note:** Only append to `oat_hill_completed` when the phase is configured as a HiLL gate.
403
655
 
@@ -411,32 +663,19 @@ Design - Ready for implementation planning
411
663
  ## Progress
412
664
 
413
665
  - ✓ Discovery complete
414
- - ✓ Specification complete
666
+ - ✓ Specification complete (folded into design)
415
667
  - ✓ Design complete
416
668
  - ⧗ Awaiting implementation plan
417
669
  ```
418
670
 
419
- ### Step 22: Commit Design
420
-
421
- **Note:** This shows what users will do when USING oat-project-design.
422
- During implementation of OAT itself, use standard commit format.
671
+ **Step 7c: Commit the approval-side metadata**
423
672
 
424
673
  ```bash
425
- git add "$PROJECT_PATH/"
426
- git commit -m "docs: complete design for {project-name}
427
-
428
- Architecture:
429
- - {N} components
430
- - {Key architectural decision}
431
-
432
- Implementation:
433
- - {N} phases planned
434
- - {Estimated complexity}
435
-
436
- Ready for implementation planning"
674
+ git add "$PROJECT_PATH/design.md" "$PROJECT_PATH/state.md"
675
+ git diff --cached --quiet || git commit -m "chore(oat): mark design complete for {project-name}"
437
676
  ```
438
677
 
439
- ### Step 23: Output Summary
678
+ ### Step 8: Output Summary
440
679
 
441
680
  ```
442
681
  Design phase complete for {project-name}.