baldart 3.41.0 → 4.0.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 (49) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/VERSION +1 -1
  3. package/framework/.claude/agents/REGISTRY.md +72 -24
  4. package/framework/.claude/agents/api-perf-cost-auditor.md +12 -5
  5. package/framework/.claude/agents/code-reviewer.md +30 -23
  6. package/framework/.claude/agents/codebase-architect.md +47 -43
  7. package/framework/.claude/agents/coder.md +29 -18
  8. package/framework/.claude/agents/doc-reviewer.md +55 -28
  9. package/framework/.claude/agents/plan-auditor.md +77 -12
  10. package/framework/.claude/agents/prd-card-writer.md +43 -13
  11. package/framework/.claude/agents/prd.md +22 -3
  12. package/framework/.claude/agents/qa-sentinel.md +33 -15
  13. package/framework/.claude/agents/security-reviewer.md +65 -10
  14. package/framework/.claude/agents/senior-researcher.md +8 -1
  15. package/framework/.claude/agents/ui-expert.md +22 -7
  16. package/framework/.claude/commands/check.md +31 -11
  17. package/framework/.claude/commands/codexreview.md +48 -29
  18. package/framework/.claude/commands/new.md +29 -330
  19. package/framework/.claude/commands/qa.md +57 -37
  20. package/framework/.claude/skills/context-primer/SKILL.md +29 -8
  21. package/framework/.claude/skills/doc-writing-for-rag/SKILL.md +36 -36
  22. package/framework/.claude/skills/frontend-design/SKILL.md +10 -8
  23. package/framework/.claude/skills/new/SKILL.md +409 -302
  24. package/framework/.claude/skills/prd/SKILL.md +67 -38
  25. package/framework/.claude/skills/prd/assets/card-template.yml +22 -26
  26. package/framework/.claude/skills/prd/assets/epic-template.yml +5 -5
  27. package/framework/.claude/skills/prd/assets/state-template.md +25 -3
  28. package/framework/.claude/skills/prd/references/api-perf-gate.md +143 -33
  29. package/framework/.claude/skills/prd/references/audit-phase.md +48 -34
  30. package/framework/.claude/skills/prd/references/backlog-phase.md +38 -11
  31. package/framework/.claude/skills/prd/references/discovery-phase.md +121 -44
  32. package/framework/.claude/skills/prd/references/impact-analysis.md +127 -23
  33. package/framework/.claude/skills/prd/references/prd-add-phase.md +18 -214
  34. package/framework/.claude/skills/prd/references/prd-writing-phase.md +52 -42
  35. package/framework/.claude/skills/prd/references/research-phase.md +105 -19
  36. package/framework/.claude/skills/prd/references/ui-design-phase.md +20 -8
  37. package/framework/.claude/skills/prd/references/validation-phase.md +97 -72
  38. package/framework/.claude/skills/prd-add/SKILL.md +70 -20
  39. package/framework/.claude/skills/simplify/SKILL.md +22 -12
  40. package/framework/.claude/skills/ui-design/SKILL.md +26 -7
  41. package/framework/.claude/skills/webapp-testing/SKILL.md +6 -4
  42. package/framework/.claude/skills/worktree-manager/SKILL.md +206 -143
  43. package/framework/agents/coding-standards.md +85 -0
  44. package/framework/agents/skills-mapping.md +85 -82
  45. package/framework/agents/testing.md +6 -4
  46. package/framework/templates/baldart.config.template.yml +29 -7
  47. package/package.json +1 -1
  48. package/src/commands/configure.js +43 -9
  49. package/framework/.claude/skills/prd-add/references/impact-analysis.md +0 -233
@@ -10,7 +10,7 @@ cards. Anti-drift by design — rigid step sequence, persistent state, visible p
10
10
 
11
11
  ## Project Context
12
12
 
13
- **Reads from `baldart.config.yml`:** `paths.prd_dir`, `paths.backlog_dir`, `paths.references_dir`, `paths.design_system`, `paths.ui_guidelines`, `identity.audience_segments`, `identity.language`.
13
+ **Reads from `baldart.config.yml`:** `paths.prd_dir`, `paths.backlog_dir`, `paths.references_dir`, `paths.design_system`, `paths.ui_guidelines`, `paths.metrics` (default `docs/metrics`), `git.trunk_branch`, `git.merge_strategy`, `identity.audience_segments`, `identity.language`.
14
14
  **Gated by features:** `features.has_prd_workflow` (skill REFUSES to run when `false`), `features.has_backlog` (Step 5 BLOCKING when `true`), `features.has_design_system` (Step 3 BLOCKING reads), `features.has_adrs` (architectural decisions get logged as ADRs in `paths.adrs_dir`).
15
15
  **Overlay:** loads `.baldart/overlays/prd.md` if present — project-specific terminology, card layout overrides, segment names, mandated review gates.
16
16
  **On missing/empty keys:** ask the user; do not assume defaults. See `framework/agents/project-context.md` § 3.
@@ -30,12 +30,12 @@ message. You ask questions, wait for answers, and iterate.
30
30
  | 1 | Kickoff | [discovery-phase.md](references/discovery-phase.md) |
31
31
  | 1.6 | Mockup Intake | [discovery-phase.md](references/discovery-phase.md) |
32
32
  | 2 | Discovery Question Loop | [discovery-phase.md](references/discovery-phase.md) |
33
- | 2→CR | Change Request (auto/manual) | [prd-add-phase.md](references/prd-add-phase.md) |
33
+ | 2→CR | Change Request (auto/manual) | the canonical **`prd-add` skill** ([../prd-add/SKILL.md](../prd-add/SKILL.md)) — worktree-aware (`references/prd-add-phase.md` is a redirect stub, not the implementation) |
34
34
  | 2.5 | Research (opzionale) | [research-phase.md](references/research-phase.md) |
35
35
  | 3 | UI Design (3a-3d) | [ui-design-phase.md](references/ui-design-phase.md) |
36
36
  | 4 | Write PRD | [prd-writing-phase.md](references/prd-writing-phase.md) |
37
37
  | 4.5 | API Performance Gate | [api-perf-gate.md](references/api-perf-gate.md) |
38
- | 4b | Confirm Specs | [prd-writing-phase.md](references/prd-writing-phase.md) |
38
+ | 4b | Confirm Specs (§ "Present and Confirm") | [prd-writing-phase.md](references/prd-writing-phase.md) |
39
39
  | 5 | Backlog Cards | [backlog-phase.md](references/backlog-phase.md) |
40
40
  | 6 | Quality Audit | [validation-phase.md](references/validation-phase.md) |
41
41
  | 7 | Resolution, Commit & Merge | [validation-phase.md](references/validation-phase.md) |
@@ -70,7 +70,8 @@ message. You ask questions, wait for answers, and iterate.
70
70
  produces backlog cards MUST organize them as **1 epic + N children**, regardless of N:
71
71
  - **Epic**: `${paths.backlog_dir}/FEAT-XXXX-00-<slug>-epic.yml`. Tracker only — no implementation
72
72
  work. Contains AC-EPIC list, Definition of Done, business_rationale, scope,
73
- scope_boundaries, `execution_strategy` (with parallel_groups computed from the
73
+ scope_boundaries, `execution_strategy` (with `groups:` each carrying `level:`
74
+ and `cards:` — computed from the
74
75
  dependency graph), and `documentation_impact` map with `owner_card` per doc.
75
76
  `group.parent` = the PRD slug string (NOT a FEAT-ID). `group.sequence: 0`.
76
77
  `parallel_group: 0`. `depends_on: []`, `blocks: []`.
@@ -123,8 +124,8 @@ message. You ask questions, wait for answers, and iterate.
123
124
  programmatic docs mode — never on the consumer's main checkout. The worktree
124
125
  isolates PRD artefacts from other parallel Claude sessions: `git status` on
125
126
  the main repo stays clean, accidental stashes / commits / push from sibling
126
- `/new` runs cannot pick up PRD files, and the merge back into `develop`
127
- becomes a single atomic operation.
127
+ `/new` runs cannot pick up PRD files, and the merge back into the trunk branch
128
+ (`git.trunk_branch`) becomes a single atomic operation.
128
129
 
129
130
  **Why this exists.** Without the worktree, every PRD pollutes the main
130
131
  checkout with `${paths.prd_dir}/<slug>/PRD.md`, `${paths.prd_dir}/sessions/...`,
@@ -133,18 +134,25 @@ message. You ask questions, wait for answers, and iterate.
133
134
 
134
135
  **Lifecycle (deterministic, no opt-in):**
135
136
  - **Step 1 (Kickoff)** — after computing `<slug>`, before writing ANY file,
137
+ capture the main-repo root: run `git rev-parse --show-toplevel` **from the
138
+ main checkout (before any `cd` into the worktree)** and save the absolute
139
+ result as `$MAIN` in the state file under `## Worktree` (`main_path`). Then
136
140
  call `worktree-manager` programmatic `nw-docs` with `{ slug: <slug> }`.
137
- Save the returned `path` as `$WORKTREE_PATH` in the state file under
138
- `## Worktree` (path, branch, kind: "docs"). Then `cd "$WORKTREE_PATH"`
141
+ Save the returned `path` as `$WORKTREE_PATH` in the same `## Worktree`
142
+ section (path, branch, kind: "docs", main_path). Then `cd "$WORKTREE_PATH"`
139
143
  and run `pwd` to verify. From this moment, EVERY file write happens inside
140
- the worktree. See [discovery-phase.md](references/discovery-phase.md) § Step 1.
144
+ the worktree. Both `$MAIN` and `$WORKTREE_PATH` MUST be persisted now so they
145
+ survive context compaction; the Step 7.5 finalization gate begins with a
146
+ presence-and-non-empty guard on `$MAIN` and HALTS with a clear message if the
147
+ field is absent (never operates on an undefined `$MAIN`). See
148
+ [discovery-phase.md](references/discovery-phase.md) § Step 1.
141
149
  - **Step 0 (Context Recovery)** — when resuming a `/prd` or running
142
150
  `/prd-add`, scan `.worktrees/registry.json` for entries with
143
151
  `kind: "docs"` matching the slug; if found, `cd` into that worktree
144
152
  before scanning for state files. See [discovery-phase.md](references/discovery-phase.md) § Step 0.
145
153
  - **Step 7 (Commit & Merge)** — commit happens inside the worktree, then
146
154
  `worktree-manager` programmatic `mw-docs` is invoked immediately to
147
- rebase onto `origin/develop` and land the PRD via the configured
155
+ rebase onto `origin/<git.trunk_branch>` and land the PRD via the configured
148
156
  `git.merge_strategy`. Seamless by default, no confirmation gate (the
149
157
  user opted into the full pipeline when they ran `/prd`). If the user
150
158
  explicitly says "non mergiare" / "lascia il worktree", honor the
@@ -192,7 +200,7 @@ message. You ask questions, wait for answers, and iterate.
192
200
  - `git checkout` / `git switch` / `git branch` on the main repo (worktree-manager Safety Rules).
193
201
  - `git stash` anywhere (shared `refs/stash` across worktrees — see Safety Rules in worktree-manager).
194
202
  - Writing to the main repo's `${paths.prd_dir}`, `${paths.backlog_dir}`,
195
- or `${paths.references_dir}` directly. Only the merge in Step 7 touches `develop`.
203
+ or `${paths.references_dir}` directly. Only the merge in Step 7 touches the trunk branch (`git.trunk_branch`).
196
204
 
197
205
  **Exception — when the worktree cannot be created.** If `git worktree add`
198
206
  fails (e.g., `.worktrees/` not in `.gitignore`, disk full, repo not a git
@@ -246,18 +254,18 @@ At the END of every message (after all text, before stopping), display:
246
254
 
247
255
  | # | Fase | Stato |
248
256
  |---|------|-------|
249
- | 1 | Discovery & comprensione | ⬜/🔄/✅ |
250
257
  | 1.6 | Mockup intake | ⬜/🔄/✅/⏭️ |
251
- | 1.5 | Ricerca best practice | ⬜/🔄/✅/⏭️ |
252
- | 2 | Design UI & approvazione | ⬜/🔄/✅/⏭️ |
253
- | 3 | Conferma specifiche | ⬜/🔄/✅ |
254
- | 4 | Creazione backlog cards | ⬜/🔄/✅ |
255
- | 5 | Validazione, commit & merge | ⬜/🔄/✅ |
258
+ | 2 | Discovery & comprensione | ⬜/🔄/✅ |
259
+ | 2.5 | Ricerca best practice | ⬜/🔄/✅/⏭️ |
260
+ | 3 | Design UI & approvazione | ⬜/🔄/✅/⏭️ |
261
+ | 4 | Conferma specifiche | ⬜/🔄/✅ |
262
+ | 5 | Creazione backlog cards | ⬜/🔄/✅ |
263
+ | 6-7 | Validazione, commit & merge | ⬜/🔄/✅ |
256
264
 
257
265
  Comprensione: X% (N/M dimensioni coperte) — ISA: N punti identificati
258
266
  Mockup: ⬜ non chiesto / 🔄 in attesa / ✅ N mockup / ⏭️ nessuno
259
267
  Ricerca: ⬜ non valutata / 🔍 in corso (background) / ✅ completata / ⏭️ non necessaria
260
- Step 3 mode: full / hybrid / skipped (impostato dopo Step 1.6 e refinementato a Step 3)
268
+ Step 3 mode: full / hybrid / mockup-only / skipped (impostato dopo Step 1.6 e refinementato a Step 3)
261
269
  Prossimo passo: <what happens next>
262
270
  ```
263
271
 
@@ -292,7 +300,14 @@ discovery dimensions — avoiding redundant per-dimension agent launches.
292
300
 
293
301
  ## QUICK REFERENCE — COMPREHENSION DIMENSIONS
294
302
 
295
- The 11 dimensions to cover during discovery:
303
+ **`COMPREHENSION_DIMENSION_COUNT = 11`** (dimensions 0–10) named constant, SSOT
304
+ defined here. Dimension 10 (Test strategy) is the single test dimension, so
305
+ **non-test = 10** (dimensions 0–9). The research-launch `~75%` trigger references
306
+ this constant by name (`8/10 non-test dimensions covered`) so it fires at a stable
307
+ point — see [research-phase.md](references/research-phase.md) § Trigger Evaluation.
308
+ If you add or remove a dimension below, update the constant in BOTH places.
309
+
310
+ The 11 dimensions (= `COMPREHENSION_DIMENSION_COUNT`) to cover during discovery:
296
311
 
297
312
  0. **Business rationale** — why this feature, why now? (business motivation, market signal, expected impact, strategic alignment). Can be resolved from user's initial description or by explicit question (ALWAYS first in discovery loop).
298
313
  1. **Target users** — who uses this feature?
@@ -331,33 +346,34 @@ Dimension 10 uses a built-in evaluation tree (see discovery-phase.md).
331
346
 
332
347
  | # | Fase | Stato |
333
348
  |---|------|-------|
334
- | 1 | Discovery & comprensione | ✅ |
335
349
  | 1.6 | Mockup intake | ✅/⏭️ |
336
- | 1.5 | Ricerca best practice | ✅/⏭️ |
337
- | 2 | Design UI & approvazione | ✅/⏭️ |
338
- | 3 | Conferma specifiche | |
339
- | 4 | Creazione backlog cards | ✅ |
340
- | 5 | Validazione, commit & merge | ✅ |
350
+ | 2 | Discovery & comprensione | |
351
+ | 2.5 | Ricerca best practice | ✅/⏭️ |
352
+ | 3 | Design UI & approvazione | ✅/⏭️ |
353
+ | 4 | Conferma specifiche | ✅ |
354
+ | 5 | Creazione backlog cards | ✅ |
355
+ | 6-7 | Validazione, commit & merge | ✅ |
341
356
 
342
357
  Comprensione: 100%
343
358
  Mockup: ✅ N mockup analizzati / ⏭️ nessuno fornito
344
359
  Ricerca: ✅ completata / ⏭️ non necessaria
345
- Step 3 mode: full / hybrid / skipped
360
+ Step 3 mode: full / hybrid / mockup-only / skipped
346
361
  **Pronto per l'implementazione.**
347
362
  ```
348
363
 
349
364
  ---
350
365
 
351
- ## Metrics Log (MANDATORY — runs inside Step 7, BEFORE the commit)
366
+ ## Metrics Log (MONITORING SIGNAL non-blocking; runs inside Step 7, BEFORE the commit)
352
367
 
353
- After cards are created and audited (Steps 5-6) and BEFORE the explicit stage in
354
- validation-phase.md Step 7 point 5, log this PRD run to the skill-runs file.
368
+ After cards are created and audited (Steps 5-6) and BEFORE the explicit stage list in
369
+ validation-phase.md Step 7 point 6 (point 5 is the invocation of this very Metrics Log
370
+ step), log this PRD run to the skill-runs file.
355
371
 
356
372
  **Location (HARD RULE 17 applies):**
357
- `$WORKTREE_PATH/docs/metrics/skill-runs.jsonl`
373
+ `$WORKTREE_PATH/${paths.metrics}/skill-runs.jsonl` (`paths.metrics` default: `docs/metrics`)
358
374
 
359
375
  The file is committed together with the rest of the PRD artefacts in Step 7,
360
- so it flows into `develop` via `mw-docs` atomically with the PRD.
376
+ so it flows into the trunk branch (`git.trunk_branch`) via `mw-docs` atomically with the PRD.
361
377
 
362
378
  **Conflict resilience.** JSONL is line-oriented and additive: when two parallel
363
379
  PRDs both append a line and one rebases onto the other, the doc-friendly conflict
@@ -367,7 +383,15 @@ exactly the correct semantics). No special handling needed.
367
383
 
368
384
  **Steps:**
369
385
 
370
- 1. Count from the created backlog YAML files:
386
+ > **Telemetry instrument-at-source (W4).** Every field below has a NAMED producer that
387
+ > computes it at this phase — never reconstruct a field by post-hoc LLM parsing of prose,
388
+ > and never add a field with no producer. The record is **assembled fully in memory
389
+ > (including the optional `cost` object) and appended exactly ONCE** — there is no
390
+ > append-then-rewrite of an already-written line.
391
+
392
+ 1. **Assemble the record in memory** (do NOT write to disk yet). The orchestrator at this
393
+ Step-7 phase is the producer for each field — count them from the created backlog YAML
394
+ files:
371
395
  - `cards_created`: total cards created in this PRD run
372
396
  - `ac_coverage_ratio`: total acceptance_criteria count / total user_stories count across all cards
373
397
  - `isa_count`: number of ISA items identified (from the progress bar "ISA: N punti")
@@ -375,22 +399,27 @@ exactly the correct semantics). No special handling needed.
375
399
  - `has_db_indexes_pct`: % of cards that have a `db_indexes` field (covers any persistence layer; legacy `firestore_indexes` cards count too)
376
400
  - `discovery_iterations`: approximate number of Q&A rounds with the user (count AskUserQuestion calls in this session, default 1 if unknown)
377
401
 
378
- 2. Append ONE JSON line to `$WORKTREE_PATH/docs/metrics/skill-runs.jsonl`
379
- (create the file + parent directory if absent):
402
+ Base shape (the `cost` key is filled by step 2, then the whole object is appended in step 3):
380
403
 
381
404
  ```json
382
405
  {"ts":"<ISO-8601-UTC>","skill":"prd","run_id":"prd-<slug>","prd_slug":"<slug>","cards_created":0,"ac_coverage_ratio":0.0,"isa_count":0,"has_test_plan_pct":0.0,"has_db_indexes_pct":0.0,"discovery_iterations":1,"prd_path":"${paths.prd_dir}/<slug>/PRD.md"}
383
406
  ```
384
407
 
385
- 3. **Session token telemetry (ONLY when `stats_enabled: true` in the state file)** — measure REAL per-role token + wall-clock cost by post-processing the session transcripts (zero model-token cost — runs in Bash). Invoke:
408
+ 2. **Session token telemetry — producer for the `cost` field (ONLY when `stats_enabled: true` in the state file)** — measure REAL per-role token + wall-clock cost by post-processing the session transcripts (zero model-token cost — runs in Bash). Invoke:
386
409
 
387
410
  ```bash
388
411
  node .framework/framework/scripts/analyze-session-tokens.js \
389
- --skill prd --run-id "prd-<slug>" --out-dir "$WORKTREE_PATH/docs/metrics"
412
+ --skill prd --run-id "prd-<slug>" --out-dir "$WORKTREE_PATH/${paths.metrics}"
390
413
  ```
391
414
 
392
- The script reads `$CLAUDE_CODE_SESSION_ID` and derives the transcript paths itself (do NOT pass `--session` / `--project-dir` — test-only overrides). It writes `$WORKTREE_PATH/docs/metrics/sessions/prd-<slug>.md` and prints a summary plus a final `TELEMETRY_JSON=<json>` line. Parse that line and add its object under a `"cost"` key on the same JSONL row from step 2; on `stats: SKIPPED (...)` add `"cost":{"skipped":"<reason>"}`. Echo the summary to the user. Add the new `sessions/prd-<slug>.md` file to the explicit stage list too (point 4 below).
415
+ The script reads `$CLAUDE_CODE_SESSION_ID` and derives the transcript paths itself (do NOT pass `--session` / `--project-dir` — test-only overrides). It writes `$WORKTREE_PATH/${paths.metrics}/sessions/prd-<slug>.md` and prints a summary plus a final `TELEMETRY_JSON=<json>` line. Parse that line and **fold its object into the in-memory record under a `"cost"` key** (do NOT touch the `.jsonl` file it has not been written yet). On `stats: SKIPPED (...)` set `"cost":{"skipped":"<reason>"}`; when `stats_enabled: false`, omit the `cost` key entirely. Echo the summary to the user. The new `sessions/prd-<slug>.md` file is added to the explicit stage list in step 4.
416
+
417
+ 3. **Append the assembled record ONCE** — write a single JSON line (the fully-built object
418
+ from steps 1–2) to `$WORKTREE_PATH/${paths.metrics}/skill-runs.jsonl`, creating the file +
419
+ parent directory if absent. This is a single atomic append — never re-open the line to
420
+ mutate it afterward. (If a future field needs late enrichment, emit a SEPARATE record
421
+ keyed by the same `run_id` rather than rewriting this line.)
393
422
 
394
- 4. Add the file(s) to the explicit stage list in validation-phase.md Step 7 point 6 (the stage list is at point 6; point 5 is the invocation of this very Metrics Log step).
423
+ 4. Add the file(s) (the `.jsonl` plus, when written, `sessions/prd-<slug>.md`) to the explicit stage list in validation-phase.md Step 7 point 6 (the stage list is at point 6; point 5 is the invocation of this very Metrics Log step).
395
424
 
396
425
  **This step is NON-BLOCKING** — if it fails, do not abort. Log "Metrics Log: SKIPPED" in the progress bar. The PRD merge proceeds regardless. The `-stats` script is itself fail-safe (always exits 0).
@@ -7,15 +7,12 @@ title: "{{Full descriptive title}}"
7
7
  status: TODO
8
8
  priority: {{HIGH|MEDIUM|LOW}}
9
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)
10
+ # owner_agent — REQUIRED, no implicit default.
11
+ # Valid values: see the `owner_agent enum` in framework/.claude/agents/REGISTRY.md (the SSOT).
12
+ # Do not maintain a local copy of the enum here — consult REGISTRY.md to avoid drift.
16
13
  # 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>
14
+ # Validation phase BLOCKS commit if value is missing or outside the REGISTRY enum.
15
+ owner_agent: <REQUIRED — see owner_agent enum in REGISTRY.md>
19
16
  execution_mode: local
20
17
 
21
18
  group:
@@ -24,8 +21,8 @@ group:
24
21
 
25
22
  git_strategy:
26
23
  branch: "feat/{{FEAT-EPIC-ID}}-{{slug}}"
27
- base: "develop"
28
- target: "develop"
24
+ base: "{{git.trunk_branch}}" # resolved from baldart.config.yml git.trunk_branch
25
+ target: "{{git.trunk_branch}}" # resolved from baldart.config.yml git.trunk_branch
29
26
 
30
27
  context: |
31
28
  {{Background and motivation. Reference PRD sections.}}
@@ -67,7 +64,7 @@ requirements:
67
64
 
68
65
  # --- Existing Patterns (OPTIONAL — include when card modifies existing code) ---
69
66
  # File:line references to code the agent should replicate or extend.
70
- # "Clear patterns to replicate" is the #1 driver of agent implementation quality (Devin 2025).
67
+ # [DESIGN-CHOICE: explicit patterns to replicate are the highest-signal field for agent implementation quality]
71
68
  # Omit for greenfield cards where all files are NEW.
72
69
  existing_patterns:
73
70
  - description: "{{what pattern to replicate or extend}}"
@@ -111,20 +108,17 @@ estimated_complexity: {{LOW|MEDIUM|HIGH}}
111
108
  # review_profile — REQUIRED. Decides the per-card review DEPTH deterministically,
112
109
  # at PRD authoring time, so /new READS it instead of re-deriving it at runtime.
113
110
  # One field drives BOTH QA depth (Phase 3.5) and the Codex profile (Phase 3.7).
114
- # skip → docs/chore/config or pure-cosmetic cards; no QA/Codex depth needed
115
- # light → bugfix/refactor, ≤3 files, no high-risk areas (NEVER for feature/enhancement)
116
- # balanced default for feature/enhancement, or bugfix/refactor with breadth/risk
117
- # deep → api+data, auth/payment/permission/schema/migration, ≥3 new/modified
118
- # data_fields, db_indexes, AC count > 5, or HIGH estimated_complexity
119
- # Auto-computed by prd-card-writer (§ Review Profile Rules — the SSOT). You MAY
120
- # override it by hand to force a deeper/shallower review on a specific card.
111
+ # Decision criteria (how skip/light/balanced/deep is chosen) live ONLY in
112
+ # prd-card-writer.md § Rule C that is the SSOT; do NOT duplicate the criteria here.
113
+ # Auto-computed by prd-card-writer (Rule C). You MAY override by hand to force a
114
+ # deeper/shallower review on a specific card.
121
115
  # /new maps skip|light → Codex `light`, balanced|deep → Codex `full` (Phase 3.7);
122
116
  # a high-risk path in the actual diff can only ESCALATE the Codex profile, never lower it.
123
117
  review_profile: {{skip|light|balanced|deep}}
124
118
 
125
119
  # Parallelization metadata (auto-computed by /prd backlog phase)
126
- parallel_group: {{N}} # Layer di esecuzione: 0 = prima, 1 = dopo layer 0, etc.
127
- # Card nello stesso gruppo possono girare in parallelo
120
+ parallel_group: {{N}} # Execution layer: 0 = first, 1 = after layer 0, etc.
121
+ # Cards in the same group can run in parallel
128
122
 
129
123
  files_likely_touched:
130
124
  - {{path}} ({{NEW|MODIFY}})
@@ -180,7 +174,8 @@ integration_points:
180
174
  risk: "{{HIGH|MEDIUM|LOW}}"
181
175
 
182
176
  # --- Input/Output Examples (OPTIONAL — include for API or data transformation cards) ---
183
- # Concrete examples disambiguate specs. SWE-bench: 38% of issues are underspecified.
177
+ # Concrete examples disambiguate specs and reduce implementation misinterpretation.
178
+ # [DESIGN-CHOICE: structured input/output prevents agents from inventing contract shapes]
184
179
  # Omit for pure UI or documentation-only cards.
185
180
  input_output_examples:
186
181
  - scenario: "{{scenario name}}"
@@ -226,9 +221,9 @@ data_sources:
226
221
  # format: "{{JSONL|YAML|JSON|markdown|binary}}" # include for file type only
227
222
  # note: "{{optional: data shape, why this source}}"
228
223
 
229
- # --- Environment Variables (MANDATORY se la card introduce/modifica env vars — altrimenti []) ---
230
- # Lista di variabili d'ambiente create, modificate o rimosse da questa card.
231
- # Il coder usa questo campo per compilare l'entry in ${paths.references_dir}/env-vars.md.
224
+ # --- Environment Variables (MANDATORY if this card introduces/modifies env vars — otherwise []) ---
225
+ # List of environment variables created, modified, or removed by this card.
226
+ # The coder uses this field to populate the entry in ${paths.references_dir}/env-vars.md.
232
227
  env_vars:
233
228
  - name: "{{VAR_NAME}}"
234
229
  action: "{{new|modified|removed}}"
@@ -274,8 +269,9 @@ db_indexes:
274
269
  # accepts either name; the writer should prefer db_indexes for new cards.
275
270
  firestore_indexes: [] # DEPRECATED in v3.15.0 — use db_indexes instead
276
271
 
277
- documentation_impact:
278
- - "{{doc path}} — {{what to update}}"
272
+ documentation_impact: # same structured shape as the epic's map (children may omit owner_card)
273
+ - file: "{{doc path}}"
274
+ action: "{{create | update | delete}} — {{what to update}}"
279
275
 
280
276
  assumptions:
281
277
  - "{{assumption}}"
@@ -17,7 +17,7 @@
17
17
  #
18
18
  # What the epic OWNS:
19
19
  # - AC-EPIC roll-up of PRD acceptance criteria
20
- # - execution_strategy with parallel_groups and file_conflicts
20
+ # - execution_strategy with groups/level and file_conflicts
21
21
  # - documentation_impact map with owner_card per doc
22
22
  # - Strategic business_rationale (full context, not just 2-3 lines)
23
23
  # =============================================================================
@@ -44,8 +44,8 @@ group:
44
44
 
45
45
  git_strategy:
46
46
  branch: "feat/{{FEAT-XXXX-00}}-{{slug}}-epic"
47
- base: "develop"
48
- target: "develop"
47
+ base: "{{git.trunk_branch}}" # resolved from baldart.config.yml git.trunk_branch
48
+ target: "{{git.trunk_branch}}" # resolved from baldart.config.yml git.trunk_branch
49
49
 
50
50
  context: |
51
51
  Epic tracker per la feature "{{Feature Name}}".
@@ -86,7 +86,7 @@ scope_boundaries:
86
86
 
87
87
  requirements:
88
88
  - >
89
- Tutte le {{N}} sub-card chiuse con AC verificati e merge in develop.
89
+ Tutte le {{N}} sub-card chiuse con AC verificati e merge in {{git.trunk_branch}}.
90
90
  - >
91
91
  Documentation Impact tutte aggiornate (vedi documentation_impact[] sotto).
92
92
  - >
@@ -104,7 +104,7 @@ acceptance_criteria:
104
104
  - "[ ] [AC-EPIC-5] Entry '{{Feature Name}}' in ${paths.references_dir}/ssot-registry.md."
105
105
 
106
106
  definition_of_done:
107
- - "Tutte le sub-card DONE e mergiate in develop"
107
+ - "Tutte le sub-card DONE e mergiate in {{git.trunk_branch}}"
108
108
  - "PRD §13 test scenarios eseguiti con esito atteso"
109
109
  - "Documentation Impact eseguita (vedi documentation_impact[] sotto)"
110
110
  - "{{Altri DoD epic-level}}"
@@ -1,10 +1,12 @@
1
1
  # PRD Session: {{slug}}
2
2
  Created: {{YYYY-MM-DD HH:MM}}
3
- Status: discovery
3
+ Status: discovery # discovery | mockups-pending-input | research-in-progress | pending-external-handoff | ui-design | writing | specs-confirmed | backlog | audit | validation | committing | completed | done
4
4
  stats_enabled: {{true if invoked with -stats/--stats, else false}}
5
5
 
6
6
  ## Worktree
7
7
  - path: {{absolute worktree path returned by worktree-manager nw-docs}}
8
+ - main_path: {{absolute path of the MAIN repo checkout ($MAIN) — persisted at Step 1 so finalization (validation-phase Step 7.5) never references an undefined var}}
9
+ - trunk_branch: {{resolved git.trunk_branch (default develop)}}
8
10
  - branch: prd/{{slug}}
9
11
  - kind: docs
10
12
  - created_at: {{ISO-8601 UTC}}
@@ -49,11 +51,17 @@ Comprehension: 0% (0/11)
49
51
 
50
52
  ## Discovery Log
51
53
 
54
+ ## Discovery Cursor
55
+
56
+ <!-- Scope-expansion position for resume (see discovery-phase.md Step 0 resume table). -->
57
+ cursor: 0 # index of the last-processed discovery dimension/sub-feature
58
+ comprehension: 0.0 # last computed comprehension fraction (0.0–1.0)
59
+
52
60
  ## Research
53
61
 
54
62
  Confidence: pending
55
63
  Signals: pending
56
- Status: pending
64
+ Status: pending # pending | research-in-progress | done | failed | timed-out
57
65
  Topics: pending
58
66
 
59
67
  ## Research Findings
@@ -93,13 +101,27 @@ mockup_analysis.design_system_alignment:
93
101
  status: pending # aligned | violations | not-applicable
94
102
  violations: []
95
103
 
96
- step_3_mode: pending # full | hybrid | skipped
104
+ step_3_mode: pending # full | hybrid | skipped | mockup-only
97
105
  design.html_path: pending # path | n/a (mockup-only)
98
106
 
99
107
  screens_in_scope: [] # [{ name, covered_by_mockups: bool, generated_in_step_3b: bool }]
100
108
 
101
109
  ui_inventory: [] # populated by Step 3d
102
110
 
111
+ ## API Performance Gate
112
+
113
+ <!-- Populated by api-perf-gate.md (Step 4.5) / api-perf-cost-auditor. Machine-readable
114
+ so the card-level audit (audit-phase Step 6) can read prior gate verdicts. -->
115
+ status: pending # pending | pass | warn | block
116
+ findings: [] # [{ gate, severity, summary, resolved: bool }]
117
+
118
+ ## Semantic Overrides
119
+
120
+ <!-- Populated by ICIAS impact-analysis (impact-analysis.md) when a semantic override
121
+ adjusts a cascade-derived dimension impact. Each entry records the precedence
122
+ decision so it is auditable rather than silently applied. -->
123
+ overrides: [] # [{ dimension, cascade_value, override_value, rationale }]
124
+
103
125
  ## Confirmed Specs
104
126
 
105
127
  ## Backlog Cards