baldart 3.15.0 → 3.16.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,39 @@ All notable changes to BALDART will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.16.0] - 2026-05-23
9
+
10
+ The `/new` orchestrator becomes specialist-aware: it now reads `owner_agent` from each card YAML and dispatches the right implementation agent — `coder` for backend/logic, `ui-expert` for UI cards, with `plan`/`visual-designer`/`motion-expert` reserved as stubs that fall back to `coder` with a WARN. UI cards (`owner_agent: ui-expert`) receive a dedicated mission briefing that enforces the registry-first BLOCKING cascade (read `${paths.design_system}/INDEX.md` + `tokens-reference.md` + per-component specs BEFORE coding), the implementation-only constraint (no mockup redesign — STOP and ask on registry conflicts), and the Post-Intervention Coherence Check (reconcile INDEX + components + tokens in the same commit). The PRD side enforces the contract end-to-end: `owner_agent` is now a mandatory enum on every child card, UI cards have UI-only scope (logic moves to a sibling `coder` card), and the validation phase blocks commit on enum violations + warns on mixed-scope UI cards.
11
+
12
+ Until now, every card from `/new` was spawned to the generic `coder` agent regardless of `owner_agent`, and mockups arrived as a textual "match this reference" hint without triggering the registry/tokens/specs cascade that `ui-expert` mandates. The symptom reported by users: graphical code generated from mockups was "not quite right" — wrong shadows, off-scale font sizes, off-palette colors. Root cause: the right specialist existed and PRD cards declared it (`owner_agent: ui-expert`), but the dispatcher never read the field.
13
+
14
+ ### Added — Agent router + UI specialist briefing
15
+
16
+ - **§ Agent Routing section in [framework/.claude/skills/new/SKILL.md](framework/.claude/skills/new/SKILL.md)** between Pre-flight and Per-card pipeline. Documents the `owner_agent` → spawn-target mapping in a single table (coder | ui-expert | plan | visual-designer | motion-expert → resolved agent + briefing variant) with a cross-reference list of the 5 layers that must stay in lockstep (template, prd.md enum, prd-card-writer rule, validation-phase check, REGISTRY.md decision tree).
17
+ - **Step 6b "Agent dispatch (router)" in Phase 2** of [framework/.claude/skills/new/SKILL.md](framework/.claude/skills/new/SKILL.md). Reads `card.owner_agent`, resolves the spawn target via a switch with explicit fallbacks: `coder` → coder briefing; `ui-expert` → ui-expert briefing; `plan`/`visual-designer`/`motion-expert` → coder briefing + WARN ("specialized briefing not yet implemented"); empty/`claude`/missing → coder briefing + WARN; unknown value → HALT and ask the user. The resolved spawn + briefing pair is logged in the tracker as the audit trail.
18
+ - **`[UI-ONLY]` mission briefing sections** in Phase 2 step 7 of [framework/.claude/skills/new/SKILL.md](framework/.claude/skills/new/SKILL.md). Three new sections inserted between "Design Reference" and "File Permissions", included ONLY when the router resolves `briefing = "ui-expert"`:
19
+ - **Registry-first BLOCKING pre-work** — reproduces verbatim the cascade defined in [framework/.claude/agents/ui-expert.md](framework/.claude/agents/ui-expert.md) § "Registry-first pre-work (BLOCKING)": read `INDEX.md` + `tokens-reference.md` + `components/<Name>.md` for every primitive in scope, declare which Authority Matrix rows govern the card in the first response. Orchestrator rejects the implementation if the declaration is missing.
20
+ - **Implementation-only constraint** — explicit DO NOTs: don't redesign the mockup, don't silently adapt registry-conflicting details (STOP + `[DS-DRIFT] mockup-vs-registry` log + ask the user), don't extend scope into business logic / API / state / validation (split-into-sibling-card is upstream PRD concern).
21
+ - **Post-Intervention Coherence Check** — citation of [framework/agents/design-system-protocol.md](framework/agents/design-system-protocol.md) § "Post-Intervention Coherence Check": reconcile `INDEX.md` (drift code `DS_INDEX_DRIFT`) + `components/<Name>.md` (`DS_COMPONENT_STALE`) + `tokens-reference.md` (`DS_TOKENS_DRIFT`) in the same commit. The completion report MUST include a `design_system_coherence:` block enumerating the artifacts updated.
22
+ - **`[UI-ONLY]` design-system conformance step in Phase 2.5** of [framework/.claude/skills/new/SKILL.md](framework/.claude/skills/new/SKILL.md). New row in the Completeness Check verification depth, runs only when `briefing = "ui-expert"` AND `features.has_design_system: true`. Greps changed files for hardcoded design values that bypass the registry (hex colors, `rgb(`, inline `box-shadow:` offsets, raw px/rem `border-radius:`/`font-size:`/spacing); verifies the `design_system_coherence:` block in the completion report; verifies new primitives ship their `components/<Name>.md` spec in the same commit; verifies new tokens land in `tokens-reference.md`. Each gap classified Partial → fix-coder sub-loop.
23
+
24
+ ### Added — PRD-side enforcement (split-scope + mandatory enum)
25
+
26
+ - **§ MANDATORY Card Rules (Rule A + Rule B)** in [framework/.claude/skills/prd/references/backlog-phase.md](framework/.claude/skills/prd/references/backlog-phase.md). New section between MANDATORY Card Structure and Specialist Audits. **Rule A**: every child card MUST declare `owner_agent` with one of the five enum values; missing/empty/placeholder/non-enum BLOCKS commit. **Rule B**: cards with `owner_agent: ui-expert` MUST be UI-only — components, layout, styling, motion, accessibility — and MUST NOT bundle business logic, API integration, state management, validation logic, or backend changes; mixed steps split into a `ui-expert` card (visual, consumes mocked contract) + a `coder` card (logic, API, state) wired via `depends_on:`/`blocks:`. Ships a canonical Login feature split example (bad: single mixed card; good: `FEAT-XXXX-02` UI + `FEAT-XXXX-01` logic).
27
+ - **§ Agent Specialization Rules in [framework/.claude/agents/prd-card-writer.md](framework/.claude/agents/prd-card-writer.md)** before Card Atomicity Rules. The same Rule A + Rule B formulated from the agent writer's POV (which value to pick per work type, what NOT to bundle, when not to assign `ui-expert` to a tight-knit mixed card). Cross-references the backlog-phase split example for canonical guidance.
28
+ - **§ Step 6 Agent Specialization Audit (new step 0)** in [framework/.claude/skills/prd/references/validation-phase.md](framework/.claude/skills/prd/references/validation-phase.md). Runs FIRST, before the Field Name Audit. Step 0a: `owner_agent` enum check (BLOCKING) — halts the audit on missing/empty/placeholder/non-enum with an actionable message. Step 0b: UI-only scope heuristic (WARN, soft gate) — for each `ui-expert` card, greps `scope.summary` + `requirements` + `acceptance_criteria` for logic markers (`api call`, `endpoint`, `route handler`, `state machine`, `validation logic`, `business rule`, `database`, `migration`, `prisma`, `auth flow`, `token storage`, `webhook`, `cron`) and emits `[UI-SCOPE-WARN]` lines for human review. Intentionally soft: legitimate UI references to mocked contracts ("consumes `useAuth()` mock") don't trip the WARN thanks to the consume/mock/contract-reference exception.
29
+ - **§ Card-template fields updated** in [framework/.claude/skills/prd/assets/card-template.yml](framework/.claude/skills/prd/assets/card-template.yml). The placeholder `owner_agent: claude` is replaced with `owner_agent: <REQUIRED — coder | ui-expert | plan | visual-designer | motion-expert>` so a card left at the placeholder fails validation. A leading comment block documents each enum value (one line each) and a comment under `scope:` reminds the writer of the UI-only constraint for `ui-expert` cards.
30
+ - **§ Epic-template aligned to the tracker-only contract** in [framework/.claude/skills/prd/assets/epic-template.yml](framework/.claude/skills/prd/assets/epic-template.yml). `owner_agent` changes from the legacy `claude` placeholder to `""` (empty string) with an inline comment clarifying that epics are tracker-only — the dispatcher skips them and the validation-phase enum-check exempts them — so the empty value is the correct signal that no specialist is assigned to an epic. Prevents the false-positive of writing a child enum value (e.g. `coder`) on an epic and implying it carries implementation work.
31
+
32
+ ### Notes
33
+
34
+ - **No new `baldart.config.yml` keys** — the schema-change propagation rule does not apply to this release. The router consumes an existing field (`owner_agent`) already present in the PRD card schema.
35
+ - **Backwards compatibility for cards written before v3.16.0.** The dispatcher accepts `owner_agent: ""` / missing / legacy `claude` value via the WARN-and-fallback-to-coder branch, so existing backlogs keep working — the WARN surfaces the gap on first use without blocking. New PRD sessions on v3.16.0+ produce enum-compliant cards from the start; the validation phase's enum BLOCKER applies only to NEW cards generated under v3.16.0+.
36
+ - **Specialist briefings for `plan` / `visual-designer` / `motion-expert` are stubs** in this release — they fall back to the coder briefing with a WARN. Specialized briefings will follow in future iterations without further schema changes (the router structure is already in place).
37
+ - **`ui-expert` in `/new` is implementation-only by design** — refinement of the mockup remains a PRD-phase responsibility (the `ui-design-phase` skill handles design decisions). If the implementation step finds a mockup-vs-registry conflict, `ui-expert` STOPs and asks the user; it does not auto-adapt the mockup. This boundary is documented in the `[UI-ONLY] Implementation-only constraint` briefing section.
38
+ - **REGISTRY.md decision tree** in [framework/.claude/agents/REGISTRY.md](framework/.claude/agents/REGISTRY.md) gains a header note clarifying that `/new` dispatches by `owner_agent` (not by re-running the decision tree) — the tree remains authoritative for ad-hoc spawns and for `prd-card-writer`'s writing decisions, with a lockstep-with-skill warning to keep the 5 layers in sync.
39
+ - **Verification is manual** (no test suite — `npm test` remains a no-op stub). Dogfood scenarios to run after install: (1) `/new <CARD-ID>` on a card with `owner_agent: coder` → identical behavior to v3.15.x (no regression); (2) `/new <CARD-ID>` on a card with `owner_agent: ui-expert` + valorized `links.design` → `ui-expert` is spawned (not coder), the briefing contains the BLOCKING cascade verbatim, the implementation reads `INDEX.md` + `tokens-reference.md` + `components/<Name>.md` BEFORE coding, the completion report ships the `design_system_coherence:` block, the commit reconciles the three design-system sources; (3) `/new` on a legacy card with `owner_agent: claude` or missing field → fallback to coder + WARN line in tracker; (4) `/prd` on a feature involving login (UI + logic) → produces TWO cards (`UI-LOGIN-*` ui-expert + `LOGIC-LOGIN-*` coder) wired via `depends_on:` rather than one mixed coder card; (5) PRD validation phase on a card with `owner_agent: ""` → enum BLOCKER, commit refused.
40
+
8
41
  ## [3.15.0] - 2026-05-23
9
42
 
10
43
  Two changes ship together. **(1) PRD becomes mockup-aware** — formal intake of existing mockups between Kickoff and Discovery, with a per-screen decision tree in Step 3 that skips generation for screens already covered. **(2) Framework becomes stack-aware** — four new `stack.*` cardinal scalars (`database`, `auth_provider`, `framework`, `deployment`) drive vocabulary, gate sections, anti-pattern checklists, and deploy commands across `/prd`, `coder`, `api-perf-cost-auditor`, `/new`, `code-reviewer`, `security-reviewer`, `bug`. Project-identity assumptions previously hard-coded (mayo personas, real test credentials, Italian merchant business names) are removed from the framework and now resolved from `identity.audience_segments[]` + `.baldart/overlays/prd.md`. Sanitization sweep removed all PII (phone numbers, real usernames, real passwords, real store names) from the published payload.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 3.15.0
1
+ 3.16.0
@@ -37,6 +37,16 @@ Quick-reference for all custom agents. Use this to route tasks to the right spec
37
37
 
38
38
  ## Decision Tree
39
39
 
40
+ > **Note**: when invoked from the `/new` skill, agent assignment is NOT taken
41
+ > from this tree — `/new` reads `owner_agent` directly from each card YAML
42
+ > (enum: `coder | ui-expert | plan | visual-designer | motion-expert`, set
43
+ > by `prd-card-writer`). This tree is the source for HUMAN routing (when
44
+ > spawning an agent ad-hoc) and for prd-card-writer's WRITING decisions.
45
+ > If you change agent capabilities here, keep the enum in
46
+ > `framework/.claude/agents/prd.md:538` and the router in
47
+ > `framework/.claude/skills/new/SKILL.md` § Agent Routing in lockstep —
48
+ > drift between layers silently mis-routes cards.
49
+
40
50
  ```
41
51
  Need to understand existing code? --> codebase-architect (MANDATORY)
42
52
  Have a plan to review? --> plan-auditor
@@ -56,6 +56,69 @@ You produce:
56
56
  4. **Scan existing backlog** — `backlog/*.yml` to find the highest `FEAT-XXXX` number. Use Glob to list files, then Grep for `^id:` lines to extract IDs.
57
57
  5. **Read existing card conventions** — sample 2-3 recent cards from `backlog/` to match style.
58
58
 
59
+ ## Agent Specialization Rules (HARD RULE — zero tolerance)
60
+
61
+ These two rules govern HOW you assign work to specialist agents. They are
62
+ enforced by the validation phase of `/prd` (Step 6) and by the `/new`
63
+ dispatcher — getting them wrong silently routes work to the wrong agent.
64
+
65
+ ### Rule A — Set `owner_agent` on every child card (enum, no default)
66
+
67
+ Every child card you produce MUST set `owner_agent` to exactly one of:
68
+
69
+ ```
70
+ coder | ui-expert | plan | visual-designer | motion-expert
71
+ ```
72
+
73
+ `claude` is NOT a valid value (it is a legacy placeholder kept only for
74
+ backward compatibility in the dispatcher's fallback). Missing, empty, or
75
+ out-of-enum values fail validation.
76
+
77
+ **How to choose:**
78
+
79
+ - `coder` — backend, business logic, state management, data layer, API
80
+ handlers, scripts, CLI, hooks, anything that writes/reads persistence.
81
+ - `ui-expert` — UI implementation from an existing mockup (`links.design`):
82
+ components, layout, styling, motion, accessibility, registry-first
83
+ discipline (reads `${paths.design_system}/INDEX.md` + tokens-reference
84
+ + per-component specs BEFORE coding, runs Post-Intervention Coherence
85
+ Check after).
86
+ - `plan` — planning-only deliverables (no code edits): RFC, ADR draft,
87
+ research synopsis, sequencing doc.
88
+ - `visual-designer` — static visual asset generation (illustrations, icons,
89
+ hero images) via the visual-designer agent.
90
+ - `motion-expert` — motion specs (timing tables, easing curves,
91
+ micro-interaction storyboards) — NOT motion code implementation, which
92
+ is `ui-expert` work.
93
+
94
+ **Epic cards** use `owner_agent: ""` (empty string) because they are
95
+ trackers, not implementation. The dispatcher skips them.
96
+
97
+ ### Rule B — UI cards (`ui-expert`) have UI-ONLY scope
98
+
99
+ When you assign `owner_agent: ui-expert` to a card, its scope MUST cover
100
+ ONLY graphical concerns. The card MUST NOT bundle:
101
+
102
+ - business logic, domain rules, calculation
103
+ - API calls, data fetching, mutations
104
+ - state management beyond local UI state (`useState` for open/closed,
105
+ hover, focus — fine; global app state, cache invalidation, sync — not)
106
+ - validation LOGIC (rendering validation states is UI work; the rules and
107
+ side-effects are coder work)
108
+ - backend changes (routes, handlers, DB schema, migrations, indexes)
109
+
110
+ **If a step requires both UI and logic, you MUST split it into two cards**
111
+ and wire them via `depends_on:` / `blocks:` — a `ui-expert` card that
112
+ consumes a mocked or contract-stable interface, plus a `coder` card that
113
+ owns the logic side. Canonical example: see § "Split example — Login
114
+ feature" in `framework/.claude/skills/prd/references/backlog-phase.md`.
115
+
116
+ If you cannot reasonably split (e.g. because the UI and logic share <3
117
+ files and one file would be torn between two cards), prefer a single
118
+ `coder` card with UI work as one of its acceptance criteria — do NOT
119
+ assign `ui-expert` to a mixed card. The dispatcher's specialist routing
120
+ breaks down when scope is mixed.
121
+
59
122
  ## Card Atomicity Rules
60
123
 
61
124
  Cards MUST be as atomic as possible to enable parallel execution:
@@ -225,6 +225,38 @@ Before Phase 3.5, determine the QA profile for each card by reading its YAML met
225
225
 
226
226
  ---
227
227
 
228
+ ## Agent Routing (Phase 2 dispatcher)
229
+
230
+ Phase 2 reads the card's `owner_agent` field and dispatches to the matching
231
+ specialist. The enum is defined by the PRD card writer
232
+ (`framework/.claude/agents/prd.md:538` + `prd-card-writer.md § Agent
233
+ Specialization Rules`) and validated by the PRD validation phase
234
+ (`framework/.claude/skills/prd/references/validation-phase.md` Step 6 → 0).
235
+
236
+ | `owner_agent` | Dispatcher action in Phase 2 step 7 | Briefing variant |
237
+ |---|---|---|
238
+ | `coder` | Spawn `coder` | Standard coder briefing (default body below) |
239
+ | `ui-expert` | Spawn `ui-expert` | UI briefing — adds BLOCKING registry-first cascade + Post-Intervention Coherence Check (see step 7 § UI branch) |
240
+ | `plan` | Fallback to `coder` + WARN | Standard coder briefing + log `"[ROUTER] plan-only briefing not yet implemented — using coder"` |
241
+ | `visual-designer` | Fallback to `coder` + WARN | Standard coder briefing + same WARN format |
242
+ | `motion-expert` | Fallback to `coder` + WARN | Standard coder briefing + same WARN format |
243
+ | missing / `claude` / unknown | Fallback to `coder` + WARN | Standard coder briefing; for unknown value also log the literal value |
244
+
245
+ The three `plan` / `visual-designer` / `motion-expert` stubs exist so the
246
+ router never blocks a card; specialized briefings are tracked as a follow-up.
247
+
248
+ If you change which values are valid here, also update:
249
+
250
+ - `framework/.claude/agents/prd.md:538` (the canonical enum comment),
251
+ - `framework/.claude/skills/prd/assets/card-template.yml` (the placeholder),
252
+ - `framework/.claude/agents/prd-card-writer.md § Agent Specialization Rules`,
253
+ - `framework/.claude/skills/prd/references/validation-phase.md` Step 6 → 0a,
254
+ - `framework/.claude/agents/REGISTRY.md` decision-tree.
255
+
256
+ Keep them in lockstep — drift between any two layers silently mis-routes cards.
257
+
258
+ ---
259
+
228
260
  ## Per-card pipeline
229
261
 
230
262
  For each card, execute these phases in order:
@@ -262,7 +294,28 @@ For each card, execute these phases in order:
262
294
 
263
295
  ### Phase 2 — Implement (self-healing, up to 3 retries)
264
296
  6. **Update tracker**: phase = "2-implement".
265
- 7. Spawn the **coder** agent (or appropriate specialist from `.claude/agents/REGISTRY.md`) using this **standardized mission briefing** fill in each section from the card YAML, tracker, and codebase-architect findings:
297
+ 6b. **Agent dispatch (router)** read `owner_agent` from the card YAML and resolve the spawn target per the table in § Agent Routing above:
298
+
299
+ ```
300
+ Let raw = card.owner_agent (string, may be missing).
301
+ Switch on raw:
302
+ - "coder" → spawn = "coder", briefing = "coder"
303
+ - "ui-expert" → spawn = "ui-expert", briefing = "ui-expert"
304
+ - "plan" → spawn = "coder", briefing = "coder"
305
+ + log: "[ROUTER] plan-only briefing not yet implemented — using coder"
306
+ - "visual-designer" → spawn = "coder", briefing = "coder"
307
+ + log: "[ROUTER] visual-designer briefing not yet implemented — using coder"
308
+ - "motion-expert" → spawn = "coder", briefing = "coder"
309
+ + log: "[ROUTER] motion-expert briefing not yet implemented — using coder"
310
+ - "" | missing | "claude"
311
+ → spawn = "coder", briefing = "coder"
312
+ + log: "[ROUTER] card <ID> has no valid owner_agent (got '<raw>'); defaulting to coder"
313
+ - anything else → HALT. Log: "[ROUTER] card <ID> has unknown owner_agent '<raw>' — not in {coder, ui-expert, plan, visual-designer, motion-expert}. Ask the user how to proceed."
314
+ ```
315
+
316
+ Log the resolved `spawn` and `briefing` in the tracker (1 line: `"router: owner_agent=<raw> → spawn=<agent>, briefing=<variant>"`). This is the audit trail for which specialist actually handled the card.
317
+
318
+ 7. Spawn the **resolved agent** (from step 6b) using this **standardized mission briefing** — fill in each section from the card YAML, tracker, and codebase-architect findings. When `briefing = "ui-expert"`, ALSO include the additional UI sections marked **[UI-ONLY]** below:
266
319
 
267
320
  ```
268
321
  ## MISSION BRIEFING — <CARD-ID>
@@ -294,6 +347,70 @@ For each card, execute these phases in order:
294
347
  Read the design.html file and use it as the visual reference for your implementation.
295
348
  The design was approved by the user — your implementation MUST match it.
296
349
 
350
+ ### [UI-ONLY] Registry-first BLOCKING pre-work (include ONLY when briefing = "ui-expert")
351
+ You are spawned as `ui-expert`. Before writing any UI code, you MUST complete
352
+ the registry-first cascade defined in
353
+ `framework/.claude/agents/ui-expert.md` § "Authoritative Style Reference —
354
+ Registry-First Protocol" (the SSOT lives in
355
+ `framework/agents/design-system-protocol.md`). Reproduce its 5 steps
356
+ verbatim, do NOT paraphrase or skip:
357
+
358
+ 1. Read `${paths.design_system}/INDEX.md` (component index + Canonical
359
+ Authority Matrix).
360
+ 2. Read `${paths.ui_guidelines}` (visual language, typography,
361
+ accessibility, brand voice).
362
+ 3. Read `${paths.design_system}/tokens-reference.md` (token contract —
363
+ SSOT for every color / spacing / shadow / radius / motion value).
364
+ 4. For EACH primitive in scope on this card, read
365
+ `${paths.design_system}/components/<Name>.md`. "In scope" = any
366
+ component named in the mockup, the requirements, or `files_likely_touched`.
367
+ 5. For EACH pattern in scope, read the relevant
368
+ `${paths.design_system}/patterns/<topic>.md`.
369
+
370
+ State, in your first response, which Authority Matrix rows govern this
371
+ card, which component specs you read (step 4), and which patterns you
372
+ read (step 5). Skipping this declaration = the orchestrator will reject
373
+ the implementation and re-spawn.
374
+
375
+ The `features.has_design_system: true` flag in `baldart.config.yml` is
376
+ the precondition for the full cascade. When `features.has_design_system:
377
+ false`, only step 2 applies — log the gap, recommend `/design-system-init`
378
+ if drift is visible, and proceed with coder-level diligence (no cascade
379
+ enforced).
380
+
381
+ ### [UI-ONLY] Implementation-only constraint (include ONLY when briefing = "ui-expert")
382
+ This `/new` invocation gives you the role of IMPLEMENTER, not designer:
383
+
384
+ - DO NOT redesign the mockup. The mockup at `links.design` is the
385
+ user-approved visual contract for this card.
386
+ - DO NOT silently adapt a mockup detail that conflicts with the registry
387
+ (e.g. a custom shadow not in `tokens-reference.md`, a font size off the
388
+ type scale, a color outside the palette). If you find such a conflict:
389
+ STOP, log it in the tracker as `[DS-DRIFT] mockup-vs-registry`, and ask
390
+ the user which side to honor.
391
+ - DO NOT extend scope into business logic, API calls, state management, or
392
+ validation rules. Those belong to a sibling `coder` card (see
393
+ `backlog-phase.md § Rule B`). If a requirement appears to need logic,
394
+ STOP and ask — do not implement it.
395
+
396
+ ### [UI-ONLY] Post-Intervention Coherence Check (include ONLY when briefing = "ui-expert")
397
+ Before declaring the card done, you MUST reconcile the three design-system
398
+ sources in the SAME commit as your UI change, per
399
+ `framework/agents/design-system-protocol.md § Post-Intervention Coherence Check`:
400
+
401
+ - `${paths.design_system}/INDEX.md` — add / update entries for any primitive
402
+ introduced or modified. Drift code: `DS_INDEX_DRIFT`.
403
+ - `${paths.design_system}/components/<Name>.md` — ship the per-component
404
+ spec for any new primitive; update the spec when a primitive's API or
405
+ visual changes. Drift code: `DS_COMPONENT_STALE`.
406
+ - `${paths.design_system}/tokens-reference.md` — add / update token entries
407
+ when introducing new semantic tokens. Drift code: `DS_TOKENS_DRIFT`.
408
+
409
+ The four conditions defined in `design-system-protocol.md` are the SSOT —
410
+ reproduce them in your completion report under a `design_system_coherence:`
411
+ block listing which conditions applied and which artifacts you updated.
412
+ Omitting the block = the orchestrator treats the card as not done.
413
+
297
414
  ### File Permissions (ENFORCED — no exceptions)
298
415
  MAY EDIT — your files for this card:
299
416
  [list from ownership map for this card]
@@ -545,6 +662,27 @@ Before triggering any review, you MUST verify that the coder agent implemented *
545
662
  If the completion report has `items_skipped` that is not "none", immediately flag those
546
663
  items as Missing regardless of the agent's justification.
547
664
 
665
+ - **[UI-ONLY] Design-system conformance** → run ONLY when `briefing = "ui-expert"` from step 6b
666
+ AND `features.has_design_system: true` in `baldart.config.yml`:
667
+ - Grep the changed files for hardcoded design values that bypass the registry:
668
+ hex colors (`#[0-9a-fA-F]{3,8}`), `rgb(`/`rgba(`, `box-shadow:` with inline
669
+ offsets/blurs, `border-radius:` with px/rem literals, `font-size:` with raw
670
+ px/rem (outside the type scale), `padding`/`margin` with raw px (outside the
671
+ spacing scale). Each hit on a NEW or MODIFIED line = Partial — the value
672
+ should come from a token, not a literal.
673
+ - Verify the completion report includes the `design_system_coherence:` block
674
+ required by the UI-ONLY briefing. Missing block = Missing (orchestrator
675
+ cannot confirm Post-Intervention Coherence Check ran).
676
+ - For each new primitive declared by the report (or detected via Grep for new
677
+ components in `${paths.components_primitives}`), verify the matching
678
+ `${paths.design_system}/components/<Name>.md` spec was created in the same
679
+ commit. Missing spec = Partial — fix by re-spawning `ui-expert` with the
680
+ narrow instruction "ship the component spec for <Name> per
681
+ design-system-protocol.md".
682
+ - For each token change declared by the report, verify the entry exists in
683
+ `${paths.design_system}/tokens-reference.md`. Missing entry = Partial.
684
+ - If `features.has_design_system: false`, log "DS conformance skipped — flag is false" and continue.
685
+
548
686
  5. Classify each item:
549
687
  - **Done** — code exists AND satisfies the FULL scope of the requirement (not just partial).
550
688
  - **Partial** — some code exists but the criterion is not fully satisfied (e.g., UI renders but no error state, endpoint exists but wrong response shape).
@@ -6,7 +6,16 @@ id: {{FEAT-ID}}
6
6
  title: "{{Full descriptive title}}"
7
7
  status: TODO
8
8
  priority: {{HIGH|MEDIUM|LOW}}
9
- owner_agent: claude
9
+
10
+ # owner_agent — REQUIRED, no implicit default. One of:
11
+ # coder → backend / logic / state / data layer / scripts
12
+ # ui-expert → UI implementation (mockup → code, registry-first); UI-ONLY scope
13
+ # plan → planning-only card (no code edits)
14
+ # visual-designer → static visual assets (illustrations, icons, hero images)
15
+ # motion-expert → animation specs (timing, easing, micro-interactions)
16
+ # The /new orchestrator dispatches by this field (see new/SKILL.md § Agent Routing).
17
+ # Validation phase BLOCKS commit if value is missing or outside this enum.
18
+ owner_agent: <REQUIRED — coder | ui-expert | plan | visual-designer | motion-expert>
10
19
  execution_mode: local
11
20
 
12
21
  group:
@@ -29,6 +38,12 @@ business_rationale: |
29
38
  Aiuta gli agenti implementatori a comprendere l'intento strategico.}}
30
39
 
31
40
  scope:
41
+ # UI-only constraint (when owner_agent: ui-expert):
42
+ # The scope MUST cover ONLY graphical concerns — components, layout, styling,
43
+ # token usage, motion, accessibility. It MUST NOT bundle business logic, API
44
+ # integration, data fetching, state management, form validation, or backend
45
+ # changes. If the step involves both UI and logic, split into two cards
46
+ # (ui-expert + coder) and wire them via `depends_on:` / `blocks:`.
32
47
  summary: |
33
48
  {{What this card delivers in 2-3 lines.}}
34
49
  # Drawn from identity.audience_segments[] in baldart.config.yml.
@@ -26,7 +26,14 @@ id: {{FEAT-XXXX-00}}
26
26
  title: "Epic: {{Feature Name}} — {{short tagline}}"
27
27
  status: TODO
28
28
  priority: {{HIGH|MEDIUM|LOW}}
29
- owner_agent: claude
29
+
30
+ # Epics are tracker-only — no implementation work, no dispatcher routing.
31
+ # The /new orchestrator skips epics (it only operates on child cards) and the
32
+ # PRD validation-phase enum-check skips them too. Keep this as an empty
33
+ # string to signal "no specialist assigned"; do NOT use one of the child
34
+ # enum values (coder | ui-expert | plan | visual-designer | motion-expert)
35
+ # on an epic — that would falsely imply the epic carries implementation work.
36
+ owner_agent: ""
30
37
  execution_mode: cloud
31
38
 
32
39
  # Epic's group.parent is the PRD slug (string), NOT a FEAT-ID.
@@ -4,6 +4,87 @@
4
4
 
5
5
  Mark task 4 as `in_progress`.
6
6
 
7
+ ## MANDATORY Card Rules (zero tolerance — read first)
8
+
9
+ These two rules apply to EVERY child card (epics use `owner_agent: ""`). The
10
+ `prd-card-writer` agent enforces them; the skill MUST verify post-generation
11
+ and HALT if violated.
12
+
13
+ ### Rule A — `owner_agent` is mandatory and enum-validated
14
+
15
+ Every child card MUST declare `owner_agent` with one of the five values:
16
+
17
+ ```
18
+ coder | ui-expert | plan | visual-designer | motion-expert
19
+ ```
20
+
21
+ There is no implicit default and `claude` is NOT a valid value. Cards with
22
+ missing, empty, placeholder, or non-enum values fail Step 6 (validation-phase)
23
+ and BLOCK the commit. The `/new` orchestrator dispatches implementation
24
+ agent by this field (see `framework/.claude/skills/new/SKILL.md` § Agent
25
+ Routing), so a wrong value silently routes the card to the wrong specialist.
26
+
27
+ ### Rule B — UI cards have UI-only scope (no mixed scope)
28
+
29
+ A card with `owner_agent: ui-expert` MUST be scoped EXCLUSIVELY to graphical
30
+ concerns: components, layout, styling, token usage, motion, accessibility.
31
+ It MUST NOT bundle:
32
+
33
+ - business logic / domain rules
34
+ - API integration or data fetching
35
+ - state management beyond local UI state
36
+ - form validation logic (rendering validation states is UI; the rules are not)
37
+ - backend changes (routes, handlers, DB schema)
38
+
39
+ If a feature step involves BOTH UI and logic, the writer MUST split it into:
40
+
41
+ - one `owner_agent: ui-expert` card — visual implementation, consumes mocked
42
+ or contract-stable data
43
+ - one `owner_agent: coder` card — logic, API call, state, persistence
44
+
45
+ The two cards are wired via `depends_on:` / `blocks:`. A common ordering is
46
+ `coder → ui-expert` (contract ready before UI), but the reverse is acceptable
47
+ when the UI card consumes a hand-written mock.
48
+
49
+ #### Split example — Login feature
50
+
51
+ **Bad** (single mixed card):
52
+
53
+ ```yaml
54
+ id: FEAT-XXXX-01
55
+ owner_agent: coder
56
+ scope:
57
+ summary: |
58
+ Implement the login page: form layout, validation states, call to
59
+ POST /api/auth/login, token storage, redirect to dashboard.
60
+ ```
61
+
62
+ **Good** (split into UI + logic):
63
+
64
+ ```yaml
65
+ # UI card — visual only, consumes a mocked auth contract
66
+ id: FEAT-XXXX-02
67
+ owner_agent: ui-expert
68
+ depends_on: [FEAT-XXXX-01]
69
+ scope:
70
+ summary: |
71
+ Login form layout (email/password fields, primary CTA, link to recovery),
72
+ visual states (idle / loading / error / success), a11y (focus order,
73
+ aria-live for inline errors), responsive breakpoints. Consumes the
74
+ `useAuth()` mock provided by FEAT-XXXX-01.
75
+ ```
76
+
77
+ ```yaml
78
+ # Logic card — API call + state + redirect
79
+ id: FEAT-XXXX-01
80
+ owner_agent: coder
81
+ blocks: [FEAT-XXXX-02]
82
+ scope:
83
+ summary: |
84
+ POST /api/auth/login handler, token storage in httpOnly cookie, redirect
85
+ on success, `useAuth()` hook exposing { status, error, signIn }.
86
+ ```
87
+
7
88
  ## MANDATORY Card Structure (zero tolerance — read first)
8
89
 
9
90
  Every PRD generates **1 epic card + N children**, regardless of N. The
@@ -6,6 +6,26 @@
6
6
 
7
7
  Mark task 5 as `in_progress`.
8
8
 
9
+ 0. **Agent Specialization Audit (runs FIRST — blocks if any failure)** — for each generated child card (epics are skipped):
10
+
11
+ a. **`owner_agent` enum check (BLOCKING)** — read the `owner_agent` field. It MUST equal one of:
12
+ ```
13
+ coder | ui-expert | plan | visual-designer | motion-expert
14
+ ```
15
+ Empty string, missing field, `claude`, or any other value = **BLOCKER**.
16
+ Message to the user: `"Card <ID> has owner_agent: '<value>' — must be one of {coder, ui-expert, plan, visual-designer, motion-expert}. Fix the card YAML before commit."`
17
+ Halt the audit. No subsequent checks run on a card that fails this gate.
18
+
19
+ b. **UI-only scope heuristic (WARN — soft gate, not blocking)** — for each card with `owner_agent: ui-expert`:
20
+ - Concatenate `scope.summary`, `requirements[]`, and `acceptance_criteria[]` into one lowercase string.
21
+ - Grep for logic-marker substrings: `api call`, `endpoint`, `route handler`, `state machine`, `validation logic`, `business rule`, `database`, `migration`, `prisma`, `firestore.collection`, `auth flow`, `token storage`, `webhook`, `cron`.
22
+ - For each marker hit, log a WARN line in the audit output:
23
+ `"[UI-SCOPE-WARN] Card <ID> (ui-expert) mentions '<marker>' — review whether logic belongs in a sibling coder card. See backlog-phase.md § Rule B."`
24
+ - The check is intentionally a soft gate: substrings like "API contract per il mock" or "consumes the auth state from `useAuth()`" are legitimate UI references. The WARN exists to prompt human review, not to block.
25
+ - Exception (no WARN): the marker appears INSIDE a quoted string that explicitly says "consume", "mock", "contract reference", or "exposed by sibling card" — those are UI cards reading an upstream contract, which is expected.
26
+
27
+ **Gate**: every card has `owner_agent` in the enum. WARN entries from check (b) are noted in the audit log; user may accept them after review.
28
+
9
29
  1. **Field Name Audit (runs BEFORE audit agents)** — for each generated card:
10
30
 
11
31
  a. Verify every `data_fields` entry has `ts_verified: true` OR `status: new` with `schema_ref`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baldart",
3
- "version": "3.15.0",
3
+ "version": "3.16.0",
4
4
  "description": "Claude Agent Framework - Reusable framework for coordinating AI agents and humans in software projects",
5
5
  "bin": {
6
6
  "baldart": "./bin/baldart.js"