feat(skills): port bmad-product-brief to TOML workflow customization

Completes the customization surface rollout by giving the product-brief
workflow the same override model as the six BMad agents, under the
[workflow] namespace instead of [agent].

## customize.toml

Mirrors the agent shape under [workflow] with:
- activation_steps_prepend / activation_steps_append (harmonized across
  agents and workflows — same field names, same append semantics)
- persistent_facts with the file: convention, seeded with
  file:{project-root}/**/project-context.md
- on_complete scalar (renamed from PR #2282's skill_end for clarity —
  reads cleaner as "what runs when the workflow completes")

## SKILL.md

7-step workflow activation:
  1. Resolve workflow block
  2. Execute prepend steps
  3. Load persistent facts (file: or literal)
  4. Load config
  5. Greet if not already
  6. Execute append steps
  7. Stage 1 — Understand Intent

python3 + stdlib tomllib invocation; no uv required.

## Prompt file changes

- Path normalization: ../agents/ → agents/, ../resources/ → resources/,
  bare foo.md → prompts/foo.md. All references now resolve from the
  skill root (matches the convention documented in SKILL.md).
- Paths: meta-line added to each of the 4 prompt files that reference
  other files, reinforcing "bare paths resolve from skill root" so the
  LLM doesn't lose the convention when operating two hops into a
  prompt chain.
- finalize.md terminal stage now calls the resolver for
  workflow.on_complete — non-empty values run as the final step.

## Validation

- Resolver output verified: 4 workflow fields returned cleanly.
- validate-file-refs.js: 254 files scanned, 139 refs checked, 0 broken.
- test:refs: passing.
This commit is contained in:
Brian Madison 2026-04-19 13:50:15 -05:00
parent 1f488c956a
commit 6e5b49bed7
6 changed files with 101 additions and 23 deletions

View File

@ -13,6 +13,13 @@ The user is the domain expert. You bring structured thinking, facilitation, mark
**Design rationale:** We always understand intent before scanning artifacts — without knowing what the brief is about, scanning documents is noise, not signal. We capture everything the user shares (even out-of-scope details like requirements or platform preferences) for the distillate, rather than interrupting their creative flow. **Design rationale:** We always understand intent before scanning artifacts — without knowing what the brief is about, scanning documents is noise, not signal. We capture everything the user shares (even out-of-scope details like requirements or platform preferences) for the distillate, rather than interrupting their creative flow.
## Conventions
- Bare paths (e.g. `prompts/finalize.md`) resolve from the skill root.
- `{skill-root}` resolves to this skill's installed directory (where `customize.toml` lives).
- `{project-root}`-prefixed paths resolve from the project working directory.
- `{skill-name}` resolves to the skill directory's basename.
## Activation Mode Detection ## Activation Mode Detection
Check activation context immediately: Check activation context immediately:
@ -30,16 +37,40 @@ Check activation context immediately:
## On Activation ## On Activation
1. Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve:: ### Step 1: Resolve the Workflow Block
Run: `python3 {project-root}/_bmad/scripts/resolve_customization.py --skill {skill-root} --key workflow`
**If the script fails**, resolve the `workflow` block yourself from `customize.toml`, with `{project-root}/_bmad/custom/{skill-name}.toml` overriding, and `{skill-name}.user.toml` overriding both (any missing file is skipped).
### Step 2: Execute Prepend Steps
Execute each entry in `{workflow.activation_steps_prepend}` in order before proceeding.
### Step 3: Load Persistent Facts
Treat every entry in `{workflow.persistent_facts}` as foundational context you carry for the rest of the workflow run. Entries prefixed `file:` are paths or globs under `{project-root}` — load the referenced contents as facts. All other entries are facts verbatim.
### Step 4: Load Config
Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve:
- Use `{user_name}` for greeting - Use `{user_name}` for greeting
- Use `{communication_language}` for all communications - Use `{communication_language}` for all communications
- Use `{document_output_language}` for output documents - Use `{document_output_language}` for output documents
- Use `{planning_artifacts}` for output location and artifact scanning - Use `{planning_artifacts}` for output location and artifact scanning
- Use `{project_knowledge}` for additional context scanning - Use `{project_knowledge}` for additional context scanning
2. **Greet user** as `{user_name}`, speaking in `{communication_language}`. ### Step 5: Greet the User
3. **Stage 1: Understand Intent** (handled here in SKILL.md) Greet `{user_name}` if you have not already, speaking in `{communication_language}`.
### Step 6: Execute Append Steps
Execute each entry in `{workflow.activation_steps_append}` in order.
### Step 7: Stage 1 — Understand Intent
Proceed to Stage 1 below.
### Stage 1: Understand Intent ### Stage 1: Understand Intent

View File

@ -0,0 +1,41 @@
# DO NOT EDIT -- overwritten on every update.
#
# Workflow customization surface for bmad-product-brief. Mirrors the
# agent customization shape under the [workflow] namespace.
[workflow]
# --- Configurable below. Overrides merge per BMad structural rules: ---
# scalars: override wins • arrays (persistent_facts, activation_steps_*): append
# arrays-of-tables with `code`/`id`: replace matching items, append new ones.
# Steps to run before the standard activation (config load, greet).
# Overrides append. Use for pre-flight loads, compliance checks, etc.
activation_steps_prepend = []
# Steps to run after greet but before Stage 1 of the workflow.
# Overrides append. Use for context-heavy setup that should happen
# once the user has been acknowledged.
activation_steps_append = []
# Persistent facts the workflow keeps in mind for the whole run
# (standards, compliance constraints, stylistic guardrails).
# Distinct from the runtime memory sidecar — these are static context
# loaded on activation. Overrides append.
#
# Each entry is either:
# - a literal sentence, e.g. "All briefs must include a regulatory-risk section."
# - a file reference prefixed with `file:`, e.g. "file:{project-root}/docs/standards.md"
# (glob patterns are supported; the file's contents are loaded and treated as facts).
persistent_facts = [
"file:{project-root}/**/project-context.md",
]
# Scalar: executed when the workflow reaches its terminal stage, after
# the main output has been delivered. Override wins. Leave empty for
# no post-completion behavior.
on_complete = ""

View File

@ -1,6 +1,7 @@
**Language:** Use `{communication_language}` for all output. **Language:** Use `{communication_language}` for all output.
**Output Language:** Use `{document_output_language}` for documents. **Output Language:** Use `{document_output_language}` for documents.
**Output Location:** `{planning_artifacts}` **Output Location:** `{planning_artifacts}`
**Paths:** Bare paths (e.g. `agents/foo.md`) resolve from the skill root.
# Stage 2: Contextual Discovery # Stage 2: Contextual Discovery
@ -12,9 +13,9 @@ Now that you know what the brief is about, fan out subagents in parallel to gath
**Launch in parallel:** **Launch in parallel:**
1. **Artifact Analyzer** (`../agents/artifact-analyzer.md`) — Scans `{planning_artifacts}` and `{project_knowledge}` for relevant documents. Also scans any specific paths the user provided. Returns structured synthesis of what it found. 1. **Artifact Analyzer** (`agents/artifact-analyzer.md`) — Scans `{planning_artifacts}` and `{project_knowledge}` for relevant documents. Also scans any specific paths the user provided. Returns structured synthesis of what it found.
2. **Web Researcher** (`../agents/web-researcher.md`) — Searches for competitive landscape, market context, trends, and relevant industry data. Returns structured findings scoped to the product domain. 2. **Web Researcher** (`agents/web-researcher.md`) — Searches for competitive landscape, market context, trends, and relevant industry data. Returns structured findings scoped to the product domain.
### Graceful Degradation ### Graceful Degradation
@ -38,20 +39,20 @@ Once subagent results return (or inline scanning completes):
- Highlight anything surprising or worth discussing - Highlight anything surprising or worth discussing
- Share the gaps you've identified - Share the gaps you've identified
- Ask: "Anything else you'd like to add, or shall we move on to filling in the details?" - Ask: "Anything else you'd like to add, or shall we move on to filling in the details?"
- Route to `guided-elicitation.md` - Route to `prompts/guided-elicitation.md`
**Yolo mode:** **Yolo mode:**
- Absorb all findings silently - Absorb all findings silently
- Skip directly to `draft-and-review.md` — you have enough to draft - Skip directly to `prompts/draft-and-review.md` — you have enough to draft
- The user will refine later - The user will refine later
**Headless mode:** **Headless mode:**
- Absorb all findings - Absorb all findings
- Skip directly to `draft-and-review.md` - Skip directly to `prompts/draft-and-review.md`
- No interaction - No interaction
## Stage Complete ## Stage Complete
This stage is complete when subagent results (or inline scanning fallback) have returned and findings are merged with user context. Route per mode: This stage is complete when subagent results (or inline scanning fallback) have returned and findings are merged with user context. Route per mode:
- **Guided**`guided-elicitation.md` - **Guided**`prompts/guided-elicitation.md`
- **Yolo / Headless**`draft-and-review.md` - **Yolo / Headless**`prompts/draft-and-review.md`

View File

@ -1,6 +1,7 @@
**Language:** Use `{communication_language}` for all output. **Language:** Use `{communication_language}` for all output.
**Output Language:** Use `{document_output_language}` for documents. **Output Language:** Use `{document_output_language}` for documents.
**Output Location:** `{planning_artifacts}` **Output Location:** `{planning_artifacts}`
**Paths:** Bare paths (e.g. `agents/foo.md`) resolve from the skill root.
# Stage 4: Draft & Review # Stage 4: Draft & Review
@ -8,7 +9,7 @@
## Step 1: Draft the Executive Brief ## Step 1: Draft the Executive Brief
Use `../resources/brief-template.md` as a guide — adapt structure to fit the product's story. Use `resources/brief-template.md` as a guide — adapt structure to fit the product's story.
**Writing principles:** **Writing principles:**
- **Executive audience** — persuasive, clear, concise. 1-2 pages. - **Executive audience** — persuasive, clear, concise. 1-2 pages.
@ -36,9 +37,9 @@ Before showing the draft to the user, run it through multiple review lenses in p
**Launch in parallel:** **Launch in parallel:**
1. **Skeptic Reviewer** (`../agents/skeptic-reviewer.md`) — "What's missing? What assumptions are untested? What could go wrong? Where is the brief vague or hand-wavy?" 1. **Skeptic Reviewer** (`agents/skeptic-reviewer.md`) — "What's missing? What assumptions are untested? What could go wrong? Where is the brief vague or hand-wavy?"
2. **Opportunity Reviewer** (`../agents/opportunity-reviewer.md`) — "What adjacent value propositions are being missed? What market angles or partnerships could strengthen this? What's underemphasized?" 2. **Opportunity Reviewer** (`agents/opportunity-reviewer.md`) — "What adjacent value propositions are being missed? What market angles or partnerships could strengthen this? What's underemphasized?"
3. **Contextual Reviewer** — You (the main agent) pick the most useful third lens based on THIS specific product. Choose the lens that addresses the SINGLE BIGGEST RISK that the skeptic and opportunity reviewers won't naturally catch. Examples: 3. **Contextual Reviewer** — You (the main agent) pick the most useful third lens based on THIS specific product. Choose the lens that addresses the SINGLE BIGGEST RISK that the skeptic and opportunity reviewers won't naturally catch. Examples:
- For healthtech: "Regulatory and compliance risk reviewer" - For healthtech: "Regulatory and compliance risk reviewer"
@ -65,7 +66,7 @@ After all reviews complete:
## Step 4: Present to User ## Step 4: Present to User
**Headless mode:** Skip to `finalize.md` — no user interaction. Save the improved draft directly. **Headless mode:** Skip to `prompts/finalize.md` — no user interaction. Save the improved draft directly.
**Yolo and Guided modes:** **Yolo and Guided modes:**
@ -83,4 +84,4 @@ Present reviewer findings with brief rationale, then offer: "Want me to dig into
## Stage Complete ## Stage Complete
This stage is complete when: (a) the draft has been reviewed by all three lenses and improvements integrated, AND either (autonomous) save and route directly, or (guided/yolo) the user is satisfied. Route to `finalize.md`. This stage is complete when: (a) the draft has been reviewed by all three lenses and improvements integrated, AND either (autonomous) save and route directly, or (guided/yolo) the user is satisfied. Route to `prompts/finalize.md`.

View File

@ -1,6 +1,7 @@
**Language:** Use `{communication_language}` for all output. **Language:** Use `{communication_language}` for all output.
**Output Language:** Use `{document_output_language}` for documents. **Output Language:** Use `{document_output_language}` for documents.
**Output Location:** `{planning_artifacts}` **Output Location:** `{planning_artifacts}`
**Paths:** Bare paths (e.g. `prompts/foo.md`) resolve from the skill root.
# Stage 5: Finalize # Stage 5: Finalize
@ -72,4 +73,6 @@ purpose: "Token-efficient context for downstream PRD creation"
## Stage Complete ## Stage Complete
This is the terminal stage. After delivering the completion message and file paths, the workflow is done. If the user requests further revisions, loop back to `draft-and-review.md`. Otherwise, exit. Run: `python3 {project-root}/_bmad/scripts/resolve_customization.py --skill {skill-root} --key workflow.on_complete`
If the resolved `workflow.on_complete` is non-empty, follow it as the final terminal instruction before exiting. After delivering the completion message and file paths, the workflow is done. If the user requests further revisions, loop back to `prompts/draft-and-review.md`. Otherwise, exit.

View File

@ -1,11 +1,12 @@
**Language:** Use `{communication_language}` for all output. **Language:** Use `{communication_language}` for all output.
**Output Language:** Use `{document_output_language}` for documents. **Output Language:** Use `{document_output_language}` for documents.
**Paths:** Bare paths (e.g. `prompts/foo.md`) resolve from the skill root.
# Stage 3: Guided Elicitation # Stage 3: Guided Elicitation
**Goal:** Fill the gaps in what you know. By now you have the user's brain dump, artifact analysis, and web research. This stage is about smart, targeted questioning — not rote section-by-section interrogation. **Goal:** Fill the gaps in what you know. By now you have the user's brain dump, artifact analysis, and web research. This stage is about smart, targeted questioning — not rote section-by-section interrogation.
**Skip this stage entirely in Yolo and Autonomous modes** — go directly to `draft-and-review.md`. **Skip this stage entirely in Yolo and Autonomous modes** — go directly to `prompts/draft-and-review.md`.
## Approach ## Approach
@ -67,4 +68,4 @@ If the user is providing complete, confident answers and you have solid coverage
## Stage Complete ## Stage Complete
This stage is complete when sufficient substance exists to draft a compelling brief and the user confirms readiness. Route to `draft-and-review.md`. This stage is complete when sufficient substance exists to draft a compelling brief and the user confirms readiness. Route to `prompts/draft-and-review.md`.