You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(plugin): add greenfield project detection and UI mockup generation
Detect project maturity (greenfield/early/established) via commit count
and source file heuristics to skip unnecessary scanning in new projects.
Add mandatory UI mockup step during elaboration for any intent with a
frontend component, with ascii/html format controlled by settings.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: plugin/schemas/settings.schema.json
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,12 @@
16
16
"providers": {
17
17
"$ref": "#/definitions/providersConfig",
18
18
"description": "External system providers for spec, ticketing, design, and comms"
19
+
},
20
+
"mockup_format": {
21
+
"type": "string",
22
+
"enum": ["ascii", "html"],
23
+
"default": "ascii",
24
+
"description": "Format for UI mockups generated during elaboration. 'ascii' produces text-based wireframes in markdown code blocks. 'html' produces self-contained HTML files written to .ai-dlc/{intent-slug}/mockups/."
1b. **Detect project maturity**: Read `**Project maturity:**` from the session context injected by the SessionStart hook. If not present, detect directly:
65
+
```bash
66
+
source"${CLAUDE_PLUGIN_ROOT}/lib/config.sh"
67
+
PROJECT_MATURITY=$(detect_project_maturity)
68
+
```
69
+
Values: `greenfield` (brand new, 0-3 commits or minimal source files), `early` (some code but still small), `established` (mature codebase). This value gates Phase 2.5 exploration behavior.
64
70
2. If **not cowork** (`IS_COWORK` is empty) **and in a repo** (`IN_REPO` is `true`): proceed to Phase 0 (Existing Intent Check) below.
65
71
3. If **cowork** (`IS_COWORK=1`) **or not in a repo**:
66
72
a. **Ask how to access the project**:
@@ -271,19 +277,33 @@ This ensures:
271
277
272
278
**This phase is mandatory.** Before defining success criteria or decomposing into units, you MUST deeply understand the technical landscape. Shallow understanding here causes builders to build the wrong thing.
273
279
280
+
### Greenfield Adaptation
281
+
282
+
**Gate exploration based on project maturity** (detected in Phase 0):
283
+
284
+
-**Greenfield** (`PROJECT_MATURITY=greenfield`):
285
+
-**Skip** items 2 (Existing Codebases) and 5 (Existing Implementations) below — there is no codebase to explore. Do NOT spawn Explore subagents for codebase research.
286
+
-**Keep** items 1 (APIs/Schemas), 3 (Data Sources), 4 (Domain Model — from user input + external research), 6 (External Docs/Libraries), 7 (Providers).
287
+
- Focus domain discovery on external research, API introspection, and user input rather than codebase analysis.
288
+
-**Early** (`PROJECT_MATURITY=early`):
289
+
- Use `Glob` and `Read` directly instead of Explore subagents — the codebase is small enough to read directly without subagent overhead.
290
+
- All items apply, but codebase exploration should be lightweight.
- Full exploration as described below. Use Explore subagents for deep codebase research.
293
+
274
294
### What to Explore
275
295
276
296
Based on what the user described in Phase 2, identify every relevant technical surface and explore it thoroughly. Use ALL available research tools — codebase exploration, API introspection, web searches, and documentation fetching:
277
297
278
298
1.**APIs and Schemas**: If the intent involves an API, query it. Run introspection queries. Read the actual schema. Map every type, field, query, mutation, and subscription. Don't guess what data is available — verify it.
279
299
280
-
2.**Existing Codebases**: If the intent builds on or integrates with existing code, explore it via Explore subagents. Have them find relevant files, read source code, and report back on existing patterns, conventions, and architecture.
300
+
2.**Existing Codebases***(skip for greenfield)*: If the intent builds on or integrates with existing code, explore it via Explore subagents (or `Glob`/`Read` for early-maturity projects). Have them find relevant files, read source code, and report back on existing patterns, conventions, and architecture.
281
301
282
302
3.**Data Sources**: If the intent involves data, understand where it lives. Query for real sample data. Understand what fields are populated, what's empty, what's missing. Identify gaps between what's available and what's needed.
283
303
284
304
4.**Domain Model**: From your exploration, build a domain model — the key entities, their relationships, and their lifecycle. This is not a database schema; it's a conceptual map of the problem space.
285
305
286
-
5.**Existing Implementations**: If there are related features, similar tools, or reference implementations, read them. Understand what already exists so you don't build duplicates or miss integration points.
306
+
5.**Existing Implementations***(skip for greenfield)*: If there are related features, similar tools, or reference implementations, read them. Understand what already exists so you don't build duplicates or miss integration points.
287
307
288
308
6.**External Documentation and Libraries**: Use `WebSearch` and `WebFetch` to research relevant libraries, frameworks, APIs, standards, or prior art. If the intent involves a third-party system, find its documentation and understand its capabilities. If the intent involves a design pattern or technique, research best practices and common pitfalls.
289
309
@@ -298,7 +318,7 @@ Based on what the user described in Phase 2, identify every relevant technical s
298
318
299
319
Use every research tool available. Spawn multiple explorations in parallel for independent concerns:
300
320
301
-
1.**Subagents for deep codebase/API exploration**: Use `Task` with `subagent_type: "Explore"` for multi-step research that requires reading many files, querying APIs, and synthesizing findings:
321
+
1.**Subagents for deep codebase/API exploration***(established projects only)*: Use `Task` with `subagent_type: "Explore"` for multi-step research that requires reading many files, querying APIs, and synthesizing findings. **If greenfield: do NOT spawn Explore subagents for codebase research — there is no codebase to explore.** If early: use `Glob`/`Read` directly instead of Explore subagents.
302
322
303
323
```
304
324
Task({
@@ -357,6 +377,111 @@ Spawn one subagent per design file, in parallel with codebase Explore agents. Wh
357
377
- Append to `discovery.md` under `## Design Analysis: {file name}`
358
378
- If no design MCP tools are discoverable, the subagent reports unavailability — log a warning and continue without design analysis
359
379
380
+
5.**UI Mockups**: If the intent involves user-facing interfaces (frontend, CLI, TUI, etc.), generate mockups for every distinct screen or view. This step is **mandatory** for any intent with a UI component — it serves different purposes depending on whether designs exist:
381
+
382
+
-**Designs exist** (item 4 returned design analysis): Translate the design analysis into mockups that demonstrate your understanding of the designs. This is *verification* — the user confirms that you correctly interpreted the designer's intent before builders act on it. Misunderstanding a design is expensive; catching it here is cheap.
383
+
-**No designs exist**: Generate mockups collaboratively with the user as *pre-build visual design*. This is where layout, information hierarchy, and interaction flow get decided. Without this step, builders guess — and they guess wrong. This applies regardless of whether a design provider is configured — having a Figma account doesn't mean designs exist yet. In AI-DLC workflows, design may come later as its own unit with `discipline: design`.
384
+
385
+
#### Mockup Format
386
+
387
+
Read the mockup format from settings (default: `ascii`):
-**`ascii`** (default): Text-based wireframes rendered in markdown code blocks. Inline in `discovery.md`. Works everywhere, no tooling needed, visible in any terminal or editor.
395
+
-**`html`**: Self-contained HTML files written to `.ai-dlc/{intent-slug}/mockups/{view-slug}.html`. Use semantic HTML with inline CSS — no external dependencies. Each file should be viewable by opening it directly in a browser. Reference the file path in `discovery.md` instead of inlining the mockup.
396
+
397
+
#### Per-View Mockup Process
398
+
399
+
For each distinct screen or view identified in the domain model:
400
+
- Create a mockup showing layout structure, key UI elements, and data placement
401
+
- Annotate with interaction notes (what happens on click, hover, submit, error states)
402
+
- Show which domain entities map to which UI regions
403
+
- If working from designs: note where your interpretation might diverge from the source
404
+
405
+
Present mockups to the user with `AskUserQuestion`:
406
+
```json
407
+
{
408
+
"questions": [{
409
+
"question": "Does this mockup capture the right layout and information hierarchy for {view name}?",
410
+
"header": "Mockup",
411
+
"options": [
412
+
{"label": "Looks right", "description": "Layout and information hierarchy are correct"},
413
+
{"label": "Wrong layout", "description": "The arrangement of elements needs changes"},
414
+
{"label": "Missing elements", "description": "Important UI elements are not shown"},
415
+
{"label": "Wrong data", "description": "The data shown doesn't match what I expect"}
416
+
],
417
+
"multiSelect": true
418
+
}]
419
+
}
420
+
```
421
+
422
+
Iterate on mockups until the user confirms. Then persist:
423
+
424
+
**For `ascii` format** — append to `discovery.md`:
**Skip this step only if:** the intent has no user-facing interface (pure backend, API, data pipeline, infrastructure, etc.).
484
+
360
485
**Spawn multiple research paths in parallel.** Don't serialize explorations that are independent — launch all of them at once and synthesize when results return.
361
486
362
487
If a VCS MCP is available (e.g., GitHub MCP), use it for code browsing alongside or instead of local file tools.
@@ -405,6 +530,10 @@ EOF
405
530
-`## External Research: {topic}` — For web research, library docs, prior art
406
531
-`## Data Source: {name}` — For data source exploration (what's available, what's missing)
407
532
-`## Provider Context: {type}` — For ticketing, spec, or comms provider findings
533
+
-`## UI Mockup: {view}` — ASCII mockups of user-facing views with interaction notes and data mapping
-`## Reference Implementation: {name}` — For greenfield/early projects: external reference implementations or prior art informing the design
408
537
409
538
**After appending to `discovery.md`, keep only a brief summary in your context** — the full details are safely on disk and will be available to builders. This is the key benefit: your context stays lean for continued exploration while nothing is lost.
0 commit comments