baldart 4.0.4 → 4.1.1

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 (44) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/VERSION +1 -1
  3. package/framework/.claude/agents/REGISTRY.md +5 -5
  4. package/framework/.claude/agents/api-perf-cost-auditor.md +4 -4
  5. package/framework/.claude/agents/code-reviewer.md +2 -2
  6. package/framework/.claude/agents/codebase-architect.md +24 -24
  7. package/framework/.claude/agents/coder.md +6 -6
  8. package/framework/.claude/agents/doc-reviewer.md +16 -16
  9. package/framework/.claude/agents/hybrid-ml-architect.md +1 -1
  10. package/framework/.claude/agents/legal-counsel-gdpr.md +1 -1
  11. package/framework/.claude/agents/motion-expert.md +3 -3
  12. package/framework/.claude/agents/plan-auditor.md +4 -4
  13. package/framework/.claude/agents/prd-card-writer.md +14 -14
  14. package/framework/.claude/agents/prd.md +17 -17
  15. package/framework/.claude/agents/security-reviewer.md +1 -1
  16. package/framework/.claude/agents/senior-researcher.md +1 -1
  17. package/framework/.claude/agents/skill-improver.md +1 -1
  18. package/framework/.claude/agents/visual-designer.md +6 -6
  19. package/framework/.claude/agents/wiki-curator.md +6 -6
  20. package/framework/.claude/commands/check.md +1 -1
  21. package/framework/.claude/commands/codexreview.md +2 -2
  22. package/framework/.claude/commands/qa.md +1 -1
  23. package/framework/.claude/skills/bug/SKILL.md +2 -2
  24. package/framework/.claude/skills/doc-writing-for-rag/references/line-count-targets.md +2 -0
  25. package/framework/.claude/skills/doc-writing-for-rag/references/schemas-and-errors.md +2 -0
  26. package/framework/.claude/skills/new/SKILL.md +7 -7
  27. package/framework/.claude/skills/prd/assets/card-template.yml +3 -3
  28. package/framework/.claude/skills/prd/assets/epic-template.yml +6 -6
  29. package/framework/.claude/skills/prd/assets/prd-template.md +2 -2
  30. package/framework/.claude/skills/prd/assets/state-template.md +1 -1
  31. package/framework/.claude/skills/prd/references/audit-phase.md +1 -1
  32. package/framework/.claude/skills/prd/references/backlog-phase.md +3 -3
  33. package/framework/.claude/skills/prd/references/discovery-phase.md +11 -6
  34. package/framework/.claude/skills/prd/references/prd-writing-phase.md +2 -2
  35. package/framework/.claude/skills/worktree-manager/SKILL.md +37 -8
  36. package/framework/agents/project-context.md +1 -0
  37. package/framework/docs/PROJECT-CONFIGURATION.md +1 -0
  38. package/framework/routines/ds-drift.routine.yml +6 -6
  39. package/framework/routines/wiki-review.routine.yml +4 -4
  40. package/framework/templates/baldart.config.template.yml +1 -0
  41. package/framework/templates/overlays/commands/codexreview.example.md +2 -0
  42. package/package.json +1 -1
  43. package/src/commands/configure.js +2 -0
  44. package/src/commands/update.js +5 -0
@@ -49,12 +49,12 @@ When the feature being planned is for **Customers** (B2C users), you MUST invoke
49
49
  - The Implementation Plan - add gamification-specific validation steps
50
50
 
51
51
  **Repository Scan** (always perform):
52
- - Read AGENTS.md, agents/index.md, and docs/references/project-status.md
53
- - Examine docs/references/data-model.md for schema understanding
54
- - Review docs/references/api/index.md for API surface
55
- - Check docs/references/ui/index.md for UI structure
56
- - Scan backlog/*.yml for existing cards and naming conventions
57
- - Review docs/decisions/*.md for architectural decisions
52
+ - Read AGENTS.md, agents/index.md, and ${paths.references_dir}/project-status.md
53
+ - Examine ${paths.references_dir}/data-model.md for schema understanding
54
+ - Review ${paths.references_dir}/api/index.md for API surface
55
+ - Check ${paths.references_dir}/ui/index.md for UI structure
56
+ - Scan ${paths.backlog_dir}/*.yml for existing cards and naming conventions
57
+ - Review ${paths.adrs_dir}/*.md for architectural decisions
58
58
  - Check src/ structure for code organization
59
59
  - Look at package.json for dependencies and scripts
60
60
 
@@ -473,7 +473,7 @@ This means cards 04 and 05 run in parallel, card 06 depends on both.
473
473
 
474
474
  Every implementation plan MUST include these cards (as the last steps):
475
475
 
476
- 1. **Documentation card** (owner: `doc-reviewer`) — update `docs/references/*` to reflect the new feature
476
+ 1. **Documentation card** (owner: `doc-reviewer`) — update `${paths.references_dir}/*` to reflect the new feature
477
477
  2. **Code review card** (owner: `code-reviewer`) — review all implementation cards before marking DONE
478
478
 
479
479
  These can be a single combined card for small features.
@@ -498,7 +498,7 @@ Create protocol-compliant backlog cards for every actionable step. Cards MUST fo
498
498
 
499
499
  #### 4.1 — NAMING CONVENTIONS
500
500
 
501
- Before creating cards, scan `backlog/*.yml` to determine the next available number. File naming rules:
501
+ Before creating cards, scan `${paths.backlog_dir}/*.yml` to determine the next available number. File naming rules:
502
502
 
503
503
  | Prefix | When to use | Example |
504
504
  |--------|-------------|---------|
@@ -516,7 +516,7 @@ When a feature requires multiple cards, create a **parent card** (epic) and **ch
516
516
 
517
517
  **Parent card** (epic): Contains the full feature overview, PRD link, and lists all child cards.
518
518
  ```yaml
519
- # File: backlog/FEAT-NNNN-feature-name.yml (parent/epic)
519
+ # File: ${paths.backlog_dir}/FEAT-NNNN-feature-name.yml (parent/epic)
520
520
  id: FEAT-NNNN
521
521
  title: "[Feature Name] — Epic"
522
522
  status: TODO
@@ -535,7 +535,7 @@ child_cards:
535
535
  - FEAT-NNNN-03 # [Brief description]
536
536
 
537
537
  links:
538
- prd: docs/prd/FEAT-NNNN-feature-name.md
538
+ prd: ${paths.prd_dir}/FEAT-NNNN-feature-name.md
539
539
 
540
540
  notes: |
541
541
  Parent epic. See child cards for implementation.
@@ -543,7 +543,7 @@ notes: |
543
543
 
544
544
  **Child card**: References parent, declares dependencies on sibling cards.
545
545
  ```yaml
546
- # File: backlog/FEAT-NNNN-NN-child-slug.yml
546
+ # File: ${paths.backlog_dir}/FEAT-NNNN-NN-child-slug.yml
547
547
  id: FEAT-NNNN-NN
548
548
  title: "[Imperative title for this piece]"
549
549
  status: TODO # TODO | READY | IN_PROGRESS | BLOCKED | DONE
@@ -563,7 +563,7 @@ git_strategy: # OBJECT (per card-template.yml SSOT), neve
563
563
  #### 4.3 — CARD TEMPLATE (FEATURE CARDS)
564
564
 
565
565
  ```yaml
566
- # File: backlog/FEAT-NNNN-NN-slug.yml
566
+ # File: ${paths.backlog_dir}/FEAT-NNNN-NN-slug.yml
567
567
  id: FEAT-NNNN-NN
568
568
  title: "[Imperative title]"
569
569
  status: TODO # TODO | READY | IN_PROGRESS | BLOCKED | DONE
@@ -582,7 +582,7 @@ git_strategy: # OBJECT (per card-template.yml SSOT), neve
582
582
  context: |
583
583
  [Background, motivation, and links to PRD requirement IDs: FR-001, NFR-002]
584
584
  PRD Reference: [FR-XXX to FR-YYY]
585
- Epic: backlog/FEAT-NNNN-feature-name.yml
585
+ Epic: ${paths.backlog_dir}/FEAT-NNNN-feature-name.yml
586
586
 
587
587
  scope:
588
588
  summary: "[1-2 sentence description]"
@@ -607,7 +607,7 @@ files_likely_touched:
607
607
  definition_of_done:
608
608
  - "[ ] Code implemented and reviewed"
609
609
  - "[ ] CI checks pass on PR"
610
- - "[ ] docs/references/* updated (api-surface, data-model, ui-pages, project-status)"
610
+ - "[ ] ${paths.references_dir}/* updated (api-surface, data-model, ui-pages, project-status)"
611
611
  - "[ ] No build errors"
612
612
 
613
613
  test_plan: |
@@ -624,7 +624,7 @@ assumptions:
624
624
  - "[A-1] Assumption made — mark ASSUMED with rationale per AGENTS.md"
625
625
 
626
626
  links:
627
- prd: docs/prd/FEAT-NNNN-feature-name.md
627
+ prd: ${paths.prd_dir}/FEAT-NNNN-feature-name.md
628
628
  related_features: []
629
629
 
630
630
  notes: ""
@@ -639,7 +639,7 @@ metadata:
639
639
  Bug cards have additional mandatory fields per AGENTS.md (mandatory clarity analysis):
640
640
 
641
641
  ```yaml
642
- # File: backlog/BUG-NNNN-issue-NNN-slug.yml
642
+ # File: ${paths.backlog_dir}/BUG-NNNN-issue-NNN-slug.yml
643
643
  id: BUG-NNNN
644
644
  title: "[Fix: imperative description]"
645
645
  status: TODO
@@ -694,7 +694,7 @@ Record `git_strategy` as an OBJECT in every card — `{ branch: "feat/FEAT-NNNN-
694
694
 
695
695
  - One card per atomic deliverable (no mega-cards)
696
696
  - **Break large cards into smaller scoped tasks** — each card should be completable in a single agent session with a clean build/test/lint cycle. If a card touches more than 5-7 files or spans multiple concerns (e.g., API + UI + docs), split it.
697
- - Scan `backlog/*.yml` to determine the next available number in the sequence
697
+ - Scan `${paths.backlog_dir}/*.yml` to determine the next available number in the sequence
698
698
  - Each card must be independently testable
699
699
  - Each card's acceptance criteria MUST include build/lint/test passing
700
700
  - Link to PRD requirement IDs (FR-###, NFR-###) in the `context` field
@@ -269,7 +269,7 @@ When you need to examine code, use Glob/Grep to find actual file paths before re
269
269
 
270
270
  - Respect `AGENTS.md` as authoritative.
271
271
  - Use `codebase-architect` for architecture discovery before broad security recommendations that depend on current structure.
272
- - Treat `docs/references/project-status.md` as transient coordination context, not canonical feature truth.
272
+ - Treat `${paths.references_dir}/project-status.md` as transient coordination context, not canonical feature truth.
273
273
  - When you find a security issue that implies doc or ADR drift, flag the required follow-up explicitly.
274
274
 
275
275
  **Update your agent memory** as you discover security patterns, recurring vulnerabilities, authorization model details, trust boundaries, secrets handling patterns, and attack surface characteristics in this codebase. This builds institutional security knowledge across reviews.
@@ -18,7 +18,7 @@ You are **Senior Researcher**, a web-native research specialist with 20+ years o
18
18
  Before external web searches, check if the answer exists in the project's documentation:
19
19
 
20
20
  1. Use `search_docs` MCP tool (if available) with `mode: "hybrid"` to query the project's Obsidian-first LightRAG index semantically. Treat Obsidian hits as primary knowledge and verify implementation/stateful claims against repo docs/code before relying on them.
21
- 2. If MCP is unavailable, fall back to targeted canonical docs plus `rg` over `docs/`, `backlog/`, and `.claude/agents/`.
21
+ 2. If MCP is unavailable, fall back to targeted canonical docs plus `rg` over `${paths.docs_dir}/`, `${paths.backlog_dir}/`, and `.claude/agents/`.
22
22
  3. Internal findings should be cited alongside external research.
23
23
 
24
24
  ## MISSION
@@ -19,7 +19,7 @@ findings and automatically improve the skill/agent instructions to prevent recur
19
19
 
20
20
  **MUST NOT MODIFY:**
21
21
  - Any file under `src/` — no application code
22
- - `backlog/`, `docs/prd/`, `docs/decisions/` — no product docs
22
+ - `${paths.backlog_dir}/`, `${paths.prd_dir}/`, `${paths.adrs_dir}/` — no product docs
23
23
  - `.claude/settings.json` — no infra config changes
24
24
 
25
25
  ## Weekly Analysis Process
@@ -15,16 +15,16 @@ You are the Visual Designer, an expert in visual design and API-driven image gen
15
15
 
16
16
  ## Authoritative Style Reference
17
17
 
18
- **MUST read `docs/references/ui-guidelines.md` before any design work.** This is the single source of truth for ALL visual style decisions: brand identity, color palette, design system rules, component patterns, SVG illustration standards, image format requirements, and text embedding policy.
18
+ **MUST read `${paths.references_dir}/ui-guidelines.md` before any design work.** This is the single source of truth for ALL visual style decisions: brand identity, color palette, design system rules, component patterns, SVG illustration standards, image format requirements, and text embedding policy.
19
19
 
20
20
  **Never hard-code style rules in your reasoning.** Always derive visual decisions (colors, strokes, shadows, shapes, DO/DON'T rules) from the guidelines document. If the guidelines don't cover a case, flag it and propose an addition.
21
21
 
22
22
  ## YOUR ROLE & BOUNDARIES
23
23
 
24
- You design and generate visual assets according to the style defined in `docs/references/ui-guidelines.md`. You directly call the configured image generation API to generate images, poll for completion, download results, and prepare both original and WebP-optimized versions.
24
+ You design and generate visual assets according to the style defined in `${paths.references_dir}/ui-guidelines.md`. You directly call the configured image generation API to generate images, poll for completion, download results, and prepare both original and WebP-optimized versions.
25
25
 
26
26
  **You DO:**
27
- - Create visual style guides derived from `docs/references/ui-guidelines.md`
27
+ - Create visual style guides derived from `${paths.references_dir}/ui-guidelines.md`
28
28
  - Design asset inventories for pages and sections
29
29
  - Write and execute image generation API requests
30
30
  - Poll for task completion and download results
@@ -41,7 +41,7 @@ You design and generate visual assets according to the style defined in `docs/re
41
41
  Before generating assets, you need:
42
42
  1. Messaging framework (ICP, value prop, proof, tone)
43
43
  2. UI page structure + section list (from ui-expert agent)
44
- 3. Brand constraints (read from `docs/references/ui-guidelines.md`, plus any brand-specific overrides)
44
+ 3. Brand constraints (read from `${paths.references_dir}/ui-guidelines.md`, plus any brand-specific overrides)
45
45
 
46
46
  If any of these are missing, ask at most 5 targeted questions, then proceed with clearly labeled [ASSUMPTION] tags.
47
47
 
@@ -50,7 +50,7 @@ If any of these are missing, ask at most 5 targeted questions, then proceed with
50
50
  You MUST produce these deliverables in this exact order:
51
51
 
52
52
  ### 1) VISUAL_STYLE_GUIDE
53
- - Style interpretation for the specific brand/context, derived from `docs/references/ui-guidelines.md`
53
+ - Style interpretation for the specific brand/context, derived from `${paths.references_dir}/ui-guidelines.md`
54
54
  - Primary and accent color definitions with hex codes (from guidelines palette)
55
55
  - Composition rules (grid, alignment, spacing)
56
56
  - Illustration rules (stroke weight, fill style, shadow treatment)
@@ -164,7 +164,7 @@ When generation produces weak results:
164
164
  ## QUALITY CONTROL
165
165
 
166
166
  Before finalizing any asset:
167
- 1. Verify style compliance against `docs/references/ui-guidelines.md`
167
+ 1. Verify style compliance against `${paths.references_dir}/ui-guidelines.md`
168
168
  2. **Verify transparent background** — all illustrations MUST have no background. If the generated image has a solid/colored background, regenerate with stronger transparency instructions
169
169
  3. Check contrast ratios for accessibility
170
170
  4. Confirm no text is embedded in image
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: wiki-curator
3
- description: "Maintain the derived LLM wiki surface under docs/wiki/. Use when the team needs compiled concept pages, synthesis pages, dashboards, or reading guides that sit on top of canonical SSOT docs (and optionally an Obsidian vault + RAG layer) without becoming canonical themselves."
3
+ description: "Maintain the derived LLM wiki surface under ${paths.wiki_dir}/. Use when the team needs compiled concept pages, synthesis pages, dashboards, or reading guides that sit on top of canonical SSOT docs (and optionally an Obsidian vault + RAG layer) without becoming canonical themselves."
4
4
  model: sonnet
5
5
  color: blue
6
6
  ---
@@ -14,7 +14,7 @@ Maintain the derived wiki overlay without weakening SSOT discipline.
14
14
  ## Responsibilities
15
15
 
16
16
  - Read canonical repo docs and approved Obsidian notes.
17
- - Create or update derived wiki pages under `docs/wiki/`.
17
+ - Create or update derived wiki pages under `${paths.wiki_dir}/`.
18
18
  - Prefer compact synthesis over duplication.
19
19
  - Preserve explicit provenance and canonical references on every page.
20
20
  - Keep pages small enough to recompile quickly.
@@ -35,7 +35,7 @@ the project's `search_docs` (or equivalent) MUST pass an invoker tag so
35
35
  telemetry attributes wiki-curation queries to this agent. After each call,
36
36
  inspect the telemetry verdict: if it is `weak`, `empty`, or `fallback_degraded`,
37
37
  append one entry to a log file under your wiki overlay (typically
38
- `docs/wiki/log.md`) via the project's log helper (e.g. `tools/<rag-impl>/wiki_log.py`).
38
+ `${paths.wiki_dir}/log.md`) via the project's log helper (e.g. `tools/<rag-impl>/wiki_log.py`).
39
39
 
40
40
  Example call shape:
41
41
 
@@ -71,8 +71,8 @@ During nightly wiki-review, scan recent ADRs and PRDs (last 14 days):
71
71
 
72
72
  - For ADRs with significant architectural impact (touches >3 modules, marked as architectural pivot, or under categories: provider swap / DB schema / auth / API contract) → propose a synthesis page candidate.
73
73
  - For PRD-led multi-card epics (≥4 cards in same parent epic) → propose an overview synthesis.
74
- - For RAG queries with `verdict=weak|empty` repeated ≥3 times in `docs/wiki/log.md` → the topic is a documentation gap, propose synthesis.
75
- - Output candidates by appending to `docs/wiki/log.md` with `entry_type: synthesis_candidate` and including: title, source refs, expected scope, agent who triggered.
74
+ - For RAG queries with `verdict=weak|empty` repeated ≥3 times in `${paths.wiki_dir}/log.md` → the topic is a documentation gap, propose synthesis.
75
+ - Output candidates by appending to `${paths.wiki_dir}/log.md` with `entry_type: synthesis_candidate` and including: title, source refs, expected scope, agent who triggered.
76
76
 
77
77
  ## Frontmatter Discipline
78
78
 
@@ -128,7 +128,7 @@ Telemetry parity: pass `invoker_agent: "wiki-curator"` on every call; the
128
128
  existing `wiki_log` weak-verdict instrumentation applies unchanged.
129
129
 
130
130
  The community detector also appends `entry_type: graph_community_candidate`
131
- entries to `docs/wiki/log.md` for newly-detected clusters (≥10 entities) that
131
+ entries to `${paths.wiki_dir}/log.md` for newly-detected clusters (≥10 entities) that
132
132
  do not yet have a synthesis page. These are first-class candidates for the
133
133
  next nightly wiki-review.
134
134
 
@@ -15,7 +15,7 @@ Look for backlog cards with status `TODO` or `READY` that need pre-development v
15
15
  - If cards are identifiable from the conversation context → use those.
16
16
  - If not → ask the user which card IDs to check (accept same formats as `/new`: space-separated, comma-separated, or hyphen-range).
17
17
 
18
- Read each card from `/backlog/*.yml` to understand scope, requirements, acceptance criteria, and planned changes.
18
+ Read each card from `${paths.backlog_dir}/*.yml` to understand scope, requirements, acceptance criteria, and planned changes.
19
19
 
20
20
  ## Step 2 — Choose Audit Profile
21
21
 
@@ -18,7 +18,7 @@ If card IDs are provided as arguments, use them directly and skip this step.
18
18
  If `/codexreview` is invoked **without card IDs**, infer them from context in this order:
19
19
 
20
20
  1. **Recent git commits on current branch**: run `git log --oneline -10` and extract card IDs from commit messages matching patterns `[FEAT-\d+]`, `[BUG-\d+]`, `[TECH-\d+]`, `[UI-\d+]` (and any other project-specific prefixes — adapt to your taxonomy).
21
- 2. **In-progress backlog cards**: run `grep -rl "status: IN_PROGRESS" /backlog/*.yml` and read their `id` fields.
21
+ 2. **In-progress backlog cards**: run `grep -rl "status: IN_PROGRESS" ${paths.backlog_dir}/*.yml` and read their `id` fields.
22
22
  3. **Current branch name**: parse the branch name (e.g. `feat/FEAT-0123-slug` → `FEAT-0123`).
23
23
 
24
24
  The patterns above (`FEAT-`, `BUG-`, `TECH-`, `UI-`) are BALDART's default taxonomy; consumer
@@ -81,7 +81,7 @@ inherits a stale lean contract from a prior `/new` run. Record the resolved mode
81
81
 
82
82
  For each provided card ID:
83
83
 
84
- 1. Resolve the card file with Glob in `/backlog/*.yml`.
84
+ 1. Resolve the card file with Glob in `${paths.backlog_dir}/*.yml`.
85
85
  2. Read the card YAML and extract at minimum:
86
86
  - `id`, `title`, `status`
87
87
  - `acceptance_criteria`
@@ -20,7 +20,7 @@ You are the **QA Orchestrator**. When the user invokes `/qa [profile] [--card FE
20
20
  **Auto-detect card** (in order, stop at first match):
21
21
  1. Extract from current branch: `git rev-parse --abbrev-ref HEAD` → pattern `feat/FEAT-XXXX-*` or `codex/FEAT-XXXX-*` or `claude/FEAT-XXXX-*` → capture ID.
22
22
  2. Extract from latest commit: `git log -1 --pretty=%s` → pattern `[FEAT-XXXX]` or `[DIO-XXXX]` → capture ID.
23
- 3. Scan `/backlog/*.yml` for a card with `status: IN_PROGRESS` assigned to current work context.
23
+ 3. Scan `${paths.backlog_dir}/*.yml` for a card with `status: IN_PROGRESS` assigned to current work context.
24
24
  4. Fallback: use timestamp session ID `session-YYYYMMDD-HHMM` (compute from current date/time).
25
25
 
26
26
  ---
@@ -16,7 +16,7 @@ Argument: optional bug description (e.g., `/bug feature X is not saving`).
16
16
 
17
17
  ## Project Context
18
18
 
19
- **Reads from `baldart.config.yml`:** `paths.design_system`, `paths.references_dir`.
19
+ **Reads from `baldart.config.yml`:** `paths.design_system`, `paths.references_dir`, `paths.wiki_dir` (Phase 0 doc-rag `rg` fallback target).
20
20
  **Gated by features:** `features.has_design_system` (when `true`, Phase 4's design-system reads become BLOCKING for UI-touching bugs).
21
21
  **Overlay:** loads `.baldart/overlays/bug.md` if present — project-specific debug entry points (e.g. SWR debug switches, env summary helpers, error-code modules). The base skill stays generic; project-specific code paths live in the overlay.
22
22
  **On missing/empty keys:** ask the user; do not assume defaults. See `framework/agents/project-context.md` § 3.
@@ -29,7 +29,7 @@ See [framework/docs/MCP-INTEGRATION.md](../../../docs/MCP-INTEGRATION.md) for th
29
29
  - `mcp__playwright__browser_*` (`browser_navigate`, `browser_take_screenshot`, `browser_console_messages`, `browser_network_requests`, `browser_evaluate`) — Phase 1 reproduction for **UI/Client** bugs. Without it the skill cannot capture deterministic state and Phase 1 degrades to "ask the user to reproduce manually and paste console logs". Phase 2's client-side `window.fetch` interception is impossible without `browser_evaluate`.
30
30
 
31
31
  **Optional** (the skill benefits if present, has a documented fallback):
32
- - `mcp__doc-rag__search_docs` — Phase 0 lookup for known patterns and error codes. Fallback: targeted `rg` over the project's error-code module (path listed in `.baldart/overlays/bug.md`) and `docs/wiki/`.
32
+ - `mcp__doc-rag__search_docs` — Phase 0 lookup for known patterns and error codes. Fallback: targeted `rg` over the project's error-code module (path listed in `.baldart/overlays/bug.md`) and `${paths.wiki_dir}/`.
33
33
  - `mcp__plugin_firebase_firebase__firestore_*` (or the project's DB MCP, when `stack.database.primary` is set) — Phase 1 inspection of runtime data state for **Data** bugs. Fallback: ask the user for a document export, or read the relevant code path and infer.
34
34
  - `codebase-architect` agent (always available, listed for completeness) — Phase 0 code-path mapping. Not an MCP per se but is treated as a required dependency by this skill.
35
35
 
@@ -1,5 +1,7 @@
1
1
  # Line Count Targets — Dense Documentation Sizing
2
2
 
3
+ <!-- contamination-scan: skip — file is 100% illustrative sample-domain examples (fenced split-strategy snippets, bash commands); the docs/references/api/ literals are intentional teaching, not portable contamination. See the disclaimer blockquote below. -->
4
+
3
5
  Soglie validate su 45 file riscritti. Obiettivo: mantenere chunks LightRAG gestibili e signal/noise alto.
4
6
 
5
7
  > File path examples below (`docs/references/api/booking.md`, ecc.) are taken
@@ -1,5 +1,7 @@
1
1
  # Schemas & Errors — Central Reference Files
2
2
 
3
+ <!-- contamination-scan: skip — illustrative SAMPLE-domain reference (see disclaimer below); every docs/references/ literal is a worked example or a documented default of the already-tokenized ${paths.api_schemas}/${paths.api_errors}, not portable contamination. -->
4
+
3
5
  > **Illustrative sample domain.** Error codes, routes, and entity names in the
4
6
  > examples below are a SAMPLE domain — substitute your own. Only the protocol
5
7
  > (central schema/error files, anchor cross-referencing) is normative.
@@ -16,7 +16,7 @@ description: >
16
16
 
17
17
  ## Project Context
18
18
 
19
- **Reads from `baldart.config.yml`:** `paths.backlog_dir`, `paths.references_dir`, `git.trunk_branch` (integration trunk; default `develop`), `git.merge_strategy`, `paths.high_risk_modules` (risk-detector path list), `paths.metrics` (default `docs/metrics`), `stack.language` / `stack.database` / `stack.deployment` (gate guards), and `features.has_e2e_review` / `features.has_design_system` / `features.has_lsp_layer`.
19
+ **Reads from `baldart.config.yml`:** `paths.backlog_dir`, `paths.references_dir`, `git.trunk_branch` (integration trunk; autodetected from `origin/HEAD` when the key is absent — see Phase 0 step 0), `git.merge_strategy`, `paths.high_risk_modules` (risk-detector path list), `paths.metrics` (default `docs/metrics`), `stack.language` / `stack.database` / `stack.deployment` (gate guards), and `features.has_e2e_review` / `features.has_design_system` / `features.has_lsp_layer`.
20
20
  **Gated by features:** `features.has_backlog` (skill REFUSES to run when `false` — this orchestrator operates on backlog cards by definition).
21
21
  **Overlay:** loads `.baldart/overlays/new.md` if present — project-specific canonical-docs registry (e.g. ssot-registry, linking-protocol guides), tooling paths (e.g. validation scripts).
22
22
  **On missing/empty keys:** ask the user; do not assume defaults. See `framework/agents/project-context.md` § 3.
@@ -130,7 +130,7 @@ Trunk branch: [resolved git.trunk_branch — Phase 0 step 0 populates]
130
130
 
131
131
  0. **Feature gate + config resolution (BLOCKING)** — before anything else:
132
132
  - Read `features.has_backlog` from `baldart.config.yml`. If it is `false` (or the key is absent and the user confirms there is no backlog), this skill REFUSES to run: print "`/new` operates on backlog cards and requires `features.has_backlog: true` — run `npx baldart configure` to enable." and HALT. Do NOT proceed to step 1.
133
- - Resolve `$TRUNK` = `git.trunk_branch` from `baldart.config.yml` (default `develop` only when the key is absent). Persist it as `Trunk branch:` in the tracker `## Worktree` section. **Every later Phase 0 / Phase 6c bash snippet that references the integration trunk MUST use `$TRUNK`, never a baked-in `develop`.** Begin every later consumer with a guard: if `$TRUNK` is empty → HALT with "Trunk branch unresolved — re-read `git.trunk_branch` from config".
133
+ - Resolve `$TRUNK` = `git.trunk_branch` from `baldart.config.yml`. **When the key is absent** (consumer updated to ≥4.0.0 without re-running `configure`), do NOT hard-assume `develop` — autodetect the repo's real default branch exactly as worktree-manager does, so `/new` and `nw` agree on the base: `git -C "$MAIN" symbolic-ref --quiet refs/remotes/origin/HEAD` (strip `refs/remotes/origin/`), else the first existing local branch among `develop` / `main` / `master`. A `main`-trunk repo defaulted to `develop` here would diverge from the worktree base `nw` picks and break every `git diff "$TRUNK...HEAD"` gate. Only HALT ("Trunk branch unresolved — run `npx baldart configure`") if nothing resolves. Persist the resolved value as `Trunk branch:` in the tracker `## Worktree` section. **Every later Phase 0 / Phase 6c bash snippet that references the integration trunk MUST use `$TRUNK`, never a baked-in `develop`.** Begin every later consumer with a guard: if `$TRUNK` is empty → HALT with "Trunk branch unresolved — re-read `git.trunk_branch` from the tracker".
134
134
 
135
135
  1. **Resolve `$MAIN`** — the absolute path of the main repo (not a worktree). If `/new` was invoked from inside a worktree, walk up to the parent repo via `git rev-parse --show-superproject-working-tree` or `git worktree list` until you find the non-worktree root. Persist as `Main repo:` in the tracker `## Worktree` section. **Write `$MAIN` to the tracker the moment it is computed** — every later consumer (Phase 6c, Phase 6b) MUST re-read it from the tracker and HALT with "`$MAIN` absent from tracker" if the field is missing or empty, never silently use an undefined `$MAIN` (it does not survive context compaction).
136
136
 
@@ -279,7 +279,7 @@ Trunk branch: [resolved git.trunk_branch — Phase 0 step 0 populates]
279
279
  ```
280
280
 
281
281
  **Variable interpolation**:
282
- - `${CARD_PATHS}`: newline-separated list of all `- backlog/FEAT-XXXX-*.yml` paths in the batch
282
+ - `${CARD_PATHS}`: newline-separated list of all `- ${paths.backlog_dir}/FEAT-XXXX-*.yml` paths in the batch
283
283
  - `${FILE_OWNERSHIP_MAP}`: the file-ownership map built in step 3b
284
284
 
285
285
  > `<SESSION-ID>` is the current session id (e.g. `$CLAUDE_CODE_SESSION_ID`, or a run UUID if unset). The task-scoped unique name prevents two concurrent `/new` sessions on the same day from clobbering each other's findings (a date-only name silently collides). Record the exact `$AUDIT_FILE` path in the tracker under `## Cross-Card Conflicts (Codex)` so the result-handling step reads the SAME path — never re-derive it by wildcard/timestamp.
@@ -1280,7 +1280,7 @@ skill's Phase 1 falls back to deriving Gherkin scenarios from
1280
1280
 
1281
1281
  Run this exact bash block in the worktree. It is deterministic (grep + path match), not LLM-discretionary.
1282
1282
 
1283
- `$TRUNK` is the trunk branch resolved in Phase 0 (`git.trunk_branch`, default `develop`). `$HIGH_RISK_RE` is an alternation built from `paths.high_risk_modules` in `baldart.config.yml` (e.g. `path1|path2|withAuth`). **If `paths.high_risk_modules` is absent, the path-based triggers (#1) emit a one-line diagnostic and match nothing — no hardcoded project path is baked in.**
1283
+ `$TRUNK` is the trunk branch resolved in Phase 0 (`git.trunk_branch`, autodetected when the key is absent — see Phase 0 step 0). `$HIGH_RISK_RE` is an alternation built from `paths.high_risk_modules` in `baldart.config.yml` (e.g. `path1|path2|withAuth`). **If `paths.high_risk_modules` is absent, the path-based triggers (#1) emit a one-line diagnostic and match nothing — no hardcoded project path is baked in.**
1284
1284
 
1285
1285
  ```bash
1286
1286
  cd <worktree-path>
@@ -1460,7 +1460,7 @@ The detector (Step A) is bash + grep — guaranteed to run, no LLM skip. The dow
1460
1460
  28. **Mark card DONE (MANDATORY — do NOT skip)**:
1461
1461
  a. Edit the backlog YAML (`${paths.backlog_dir}/<CARD-ID>.yml`): set `status: DONE`, add `completed_date: <today>`.
1462
1462
  b. Add implementation notes summarizing what was built.
1463
- c. **Update `${paths.references_dir}/ssot-registry.md`** — add/update the entry for this card's feature area. The pre-commit doc-freshness hook BLOCKS commits that touch `backlog/` without a corresponding ssot-registry update. Always include ssot-registry.md in the same commit as the backlog YAML.
1463
+ c. **Update `${paths.references_dir}/ssot-registry.md`** — add/update the entry for this card's feature area. The pre-commit doc-freshness hook BLOCKS commits that touch `${paths.backlog_dir}/` without a corresponding ssot-registry update. Always include ssot-registry.md in the same commit as the backlog YAML.
1464
1464
  d. **Verify the write**: re-read the YAML file and confirm `status: DONE` is present. If not, retry the edit.
1465
1465
  e. Stage BOTH the updated YAML AND ssot-registry.md, then commit (or as an immediate follow-up commit if the Phase 4 implementation commit already happened). When this produces a SECOND commit for the card, record BOTH hashes in the tracker (`commit: <impl-hash> + <done-hash>`) so traceability/bisect is unambiguous.
1466
1466
  29. **Update tracker**: move card to `## Completed Cards` with commit hash(es), summary, flags, **and `card_status: DONE (verified)`**.
@@ -1800,9 +1800,9 @@ The most common failure mode is leaving cards IN_PROGRESS after merge. This crea
1800
1800
  b. **Stage backlog YAMLs AND related docs** (pre-commit hook requires doc updates):
1801
1801
  ```bash
1802
1802
  # Stage only the force-updated backlog YAMLs
1803
- git add backlog/CARD-001.yml backlog/CARD-002.yml
1803
+ git add ${paths.backlog_dir}/CARD-001.yml ${paths.backlog_dir}/CARD-002.yml
1804
1804
  # If ssot-registry.md was modified during the batch, stage it too
1805
- # (doc-freshness hook blocks commits that touch backlog/ without ssot-registry.md)
1805
+ # (doc-freshness hook blocks commits that touch ${paths.backlog_dir}/ without ssot-registry.md)
1806
1806
  git diff --name-only ${paths.references_dir}/ssot-registry.md && git add ${paths.references_dir}/ssot-registry.md || true
1807
1807
  ```
1808
1808
  c. **Commit with explicit file list**:
@@ -27,7 +27,7 @@ git_strategy:
27
27
  context: |
28
28
  {{Background and motivation. Reference PRD sections.}}
29
29
 
30
- PRD: docs/prd/{{slug}}/PRD.md ({{FR/NFR refs}})
30
+ PRD: ${paths.prd_dir}/{{slug}}/PRD.md ({{FR/NFR refs}})
31
31
 
32
32
  business_rationale: |
33
33
  {{2-3 righe che spiegano PERCHÉ questa feature esiste: motivazione di business +
@@ -124,8 +124,8 @@ files_likely_touched:
124
124
  - {{path}} ({{NEW|MODIFY}})
125
125
 
126
126
  links:
127
- prd: "docs/prd/{{slug}}/PRD.md"
128
- design: "docs/prd/{{slug}}/design.html" # REQUIRED for UI cards, omit for API-only cards
127
+ prd: "${paths.prd_dir}/{{slug}}/PRD.md"
128
+ design: "${paths.prd_dir}/{{slug}}/design.html" # REQUIRED for UI cards, omit for API-only cards
129
129
 
130
130
  # --- Canonical Docs (REQUIRED for cards generated from a PRD) ---
131
131
  # Traces which SSOT documents informed this card's requirements.
@@ -56,8 +56,8 @@ context: |
56
56
  - come è strutturato lo storage / data model ad alto livello (1 paragrafo)
57
57
  }}
58
58
 
59
- PRD: docs/prd/{{slug}}/PRD.md
60
- Design: docs/prd/{{slug}}/design.html
59
+ PRD: ${paths.prd_dir}/{{slug}}/PRD.md
60
+ Design: ${paths.prd_dir}/{{slug}}/design.html
61
61
  Cards: {{FEAT-XXXX-01}} .. {{FEAT-XXXX-NN}} ({{N}} sub-card, {{K}} livelli di esecuzione)
62
62
 
63
63
  business_rationale: |
@@ -148,9 +148,9 @@ execution_strategy:
148
148
  # =============================================================================
149
149
 
150
150
  canonical_docs:
151
- prd_ref: docs/prd/{{slug}}/PRD.md
152
- design_ref: docs/prd/{{slug}}/design.html
153
- traceability_ref: docs/prd/{{slug}}/traceability.md
151
+ prd_ref: ${paths.prd_dir}/{{slug}}/PRD.md
152
+ design_ref: ${paths.prd_dir}/{{slug}}/design.html
153
+ traceability_ref: ${paths.prd_dir}/{{slug}}/traceability.md
154
154
  ssot_registry_entry: "{{Feature Name as registered/to-register in ssot-registry.md}}"
155
155
  data_model_refs:
156
156
  - ${paths.references_dir}/collections/{{collection}}.md
@@ -181,7 +181,7 @@ documentation_impact:
181
181
  action: "{{component registration}}"
182
182
  owner_card: {{FEAT-XXXX-NN}}
183
183
  - file: ${paths.references_dir}/ssot-registry.md
184
- action: "Aggiungi riga '{{Feature Name}}' → docs/prd/{{slug}}/PRD.md"
184
+ action: "Aggiungi riga '{{Feature Name}}' → ${paths.prd_dir}/{{slug}}/PRD.md"
185
185
  owner_card: {{FEAT-XXXX-NN-last}} # tipicamente l'ultima card (E2E o docs-sync)
186
186
 
187
187
  # =============================================================================
@@ -10,7 +10,7 @@ freshness_status: fresh
10
10
  # {{Feature Name}} PRD
11
11
 
12
12
  **Version**: 1.0
13
- **Owner**: Antonio Baldassarre
13
+ **Owner**: {{Owner}}
14
14
  **Date**: {{YYYY-MM-DD}}
15
15
  **Status**: Draft
16
16
  **Feature ID**: {{FEAT-ID}}
@@ -51,7 +51,7 @@ Backlog cards to be created after PRD approval.
51
51
 
52
52
  **Mockup status:** {{provided | partial | none | n/a}}
53
53
  **Step 3 mode:** {{full | hybrid | skipped}}
54
- **Design entry point:** {{`docs/prd/<slug>/design.html` | `docs/prd/<slug>/mockups/` | both}}
54
+ **Design entry point:** {{`${paths.prd_dir}/<slug>/design.html` | `${paths.prd_dir}/<slug>/mockups/` | both}}
55
55
 
56
56
  ### Screen inventory
57
57
 
@@ -6,7 +6,7 @@ stats_enabled: {{true if invoked with -stats/--stats, else false}}
6
6
  ## Worktree
7
7
  - path: {{absolute worktree path returned by worktree-manager nw-docs}}
8
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)}}
9
+ - trunk_branch: {{resolved git.trunk_branch (autodetected from origin/HEAD when the config key is absent)}}
10
10
  - branch: prd/{{slug}}
11
11
  - kind: docs
12
12
  - created_at: {{ISO-8601 UTC}}
@@ -226,7 +226,7 @@ Suppress findings where the strongest false-positive argument is convincing.
226
226
  ```
227
227
 
228
228
  **Variable interpolation** (build the command string before execution; read all values from the session tracker written at Phase 0 — never guess):
229
- - `${CARD_PATHS}`: newline-separated list of `- backlog/FEAT-XXXX-*.yml` paths from Step 5
229
+ - `${CARD_PATHS}`: newline-separated list of `- ${paths.backlog_dir}/FEAT-XXXX-*.yml` paths from Step 5
230
230
  - `${PRD_PATH}`: the PRD file path from the session state
231
231
  - `${ADJACENT_CARD_PATHS}`: newline-separated list from Step 6.4
232
232
  - `${CARD_ID_SLUG}`: hyphen-separated list of card IDs being audited (e.g. `FEAT-0042-FEAT-0043`) — written to session tracker at Phase 0
@@ -89,13 +89,13 @@ Every PRD generates **1 epic card + N children**, regardless of N. The
89
89
  `prd-card-writer` agent enforces this; the skill MUST verify it post-generation
90
90
  and HALT if violated.
91
91
 
92
- - **Epic**: `backlog/FEAT-XXXX-00-<slug>-epic.yml` — tracker only (no code work);
92
+ - **Epic**: `${paths.backlog_dir}/FEAT-XXXX-00-<slug>-epic.yml` — tracker only (no code work);
93
93
  contains AC-EPIC, execution_strategy with parallel groups, documentation_impact
94
94
  map.
95
- - **Children**: `backlog/FEAT-XXXX-NN-<sub-slug>.yml` for N=1..M — atomic
95
+ - **Children**: `${paths.backlog_dir}/FEAT-XXXX-NN-<sub-slug>.yml` for N=1..M — atomic
96
96
  implementation cards. `group.parent: FEAT-XXXX-00`, `group.sequence: N`.
97
97
 
98
- **Forbidden** (post-write verification: skill MUST `ls backlog/FEAT-XXXX-*.yml`
98
+ **Forbidden** (post-write verification: skill MUST `ls ${paths.backlog_dir}/FEAT-XXXX-*.yml`
99
99
  and confirm a `-00-...-epic.yml` exists, plus at least one `-NN-` child):
100
100
 
101
101
  - Flat cards `FEAT-XXXX-<slug>.yml` (no `-NN-` segment).
@@ -149,12 +149,17 @@ la feature prima di scrivere qualsiasi documento.
149
149
  <Progress Bar>
150
150
  ```
151
151
 
152
- **MONITORING SIGNAL (non-blocking):** docs worktree created (registry entry with
153
- `kind: "docs"` present) AND state file exists on disk inside the worktree AND
154
- all tasks created AND context loaded. These are logged for observability; they
155
- do not halt execution. Precondition failures that would surface as a STOP are
156
- already handled by the BLOCKING gates in points 3 and 4 above — this note is
157
- a post-completion consistency reminder only, not an additional gate.
152
+ **Gate (BLOCKING).** Before leaving Step 1 you MUST verify, on disk, that the
153
+ docs worktree actually exists: `pwd` prints the absolute worktree path AND its
154
+ registry entry (`kind: "docs"`) is present AND the state file exists inside the
155
+ worktree AND all tasks were created AND context loaded. If the worktree was NOT
156
+ created e.g. `nw-docs` aborted because no trunk branch could be resolved, or
157
+ `.worktrees/` is not in `.gitignore` **HALT and surface the `nw-docs` error
158
+ verbatim**. Do NOT show the "Ho creato la sessione PRD … in un worktree
159
+ dedicato" message and do NOT proceed to Discovery: writing PRD artefacts on the
160
+ main checkout breaks HARD RULE 17 and pollutes every parallel session. This is a
161
+ hard gate, not an observability note — the kickoff output above is emitted only
162
+ after this gate passes.
158
163
 
159
164
  **Immediately proceed to Step 1.6** — do NOT stop here. Show the kickoff message
160
165
  and ask the mockup intake question in the same turn.
@@ -6,7 +6,7 @@ Mark task 3 as `in_progress`.
6
6
 
7
7
  ## Write PRD
8
8
 
9
- 1. Create directory `docs/prd/<slug>/` if it doesn't exist.
9
+ 1. Create directory `${paths.prd_dir}/<slug>/` if it doesn't exist.
10
10
  2. **Obsidian spec note (if present):** if the state file contains `## Obsidian Spec Note`,
11
11
  add a row to the Canonical Sources table in the PRD:
12
12
  `| Obsidian spec | [[Note Name]] |`
@@ -93,7 +93,7 @@ Mark task 3 as `in_progress`.
93
93
  - If regulatory findings exist: add a dedicated "Compliance Requirements" section.
94
94
  - Include a "Research-Informed Decisions" subsection listing decisions influenced
95
95
  by research, with brief rationale and source reference.
96
- 5. Write `docs/prd/<slug>/PRD.md` using the template from `assets/prd-template.md`.
96
+ 5. Write `${paths.prd_dir}/<slug>/PRD.md` using the template from `assets/prd-template.md`.
97
97
 
98
98
  ### PRD sections checklist
99
99