Skip to content

refactor: outcome-driven overhaul of builder and quality analysis pipeline#43

Merged
bmadcode merged 1 commit intomainfrom
fix-quality-optimizer
Mar 27, 2026
Merged

refactor: outcome-driven overhaul of builder and quality analysis pipeline#43
bmadcode merged 1 commit intomainfrom
fix-quality-optimizer

Conversation

@bmadcode
Copy link
Copy Markdown
Contributor

@bmadcode bmadcode commented Mar 27, 2026

Summary

Comprehensive overhaul of both the workflow builder and agent builder, driven by a real-world failure: the builder produced a massively over-specified party-mode skill (scoring algorithms, calibration tables, 3 adapter files, prompt templates) and the quality optimizer didn't catch any of it.

Root causes identified and fixed:

  • Builder treated existing skill input as spec to replicate — now treats it as reference material, enforces discovery loop with outcome-focused questions
  • Outcome-driven philosophy was buried 3 layers deep — now established as core identity in SKILL.md Overview, informing every phase
  • References were bloated — Phase 5 build load reduced from ~11,900 to ~6,660 tokens (44% reduction)
  • Quality scanners used rigid JSON output — now write free-form analysis, saving ~15k tokens across 6 scanners
  • Report was overwhelming — redesigned around theme synthesis (root causes that group findings across scanners) instead of scanner-by-scanner listing

Changes across both builders:

Builder Core:

  • Outcome-driven as foundational principle in SKILL.md
  • 3-way routing for existing skills: Analyze / Edit / Rebuild
  • Pruning check gate in Phase 4
  • Pruning concept + effectiveness > efficiency guardrail in prompt-craft scanner
  • Expanded over-specification structural check in integrity scanner

Quality Analysis Pipeline (renamed from "Quality Optimizer"):

  • Scanners write free-form analysis instead of rigid JSON
  • Report creator does genuine theme synthesis — identifies root causes, groups findings, produces narrative + structured data
  • HTML report redesigned: BMad Method branding, opportunity themes with "Fix This Theme" prompt generation, expandable detailed analysis
  • Agent builder adds agent portrait and capability dashboard
  • Deleted: universal-scan-schema.md, quality-report-template.md, quality-optimizer.md

Reference Optimization (workflow-builder):

  • script-opportunities-reference.md: 3,727 → 956 tokens (74% reduction)
  • complex-workflow-patterns.md: 3,760 → 1,110 tokens (70% reduction)
  • quality-dimensions.md: added outcome-driven as dimension 1

Stats

  • 33 files changed
  • +2,009 / -4,984 lines (net -2,975)

Test plan

  • Run workflow builder quality analysis on an existing skill — verify HTML opens with themes, strengths render correctly, recommendations have action text
  • Run agent builder quality analysis on an existing agent — verify agent portrait appears, capability dashboard renders, per-capability findings expand
  • Build a new skill from scratch — verify outcome-driven discovery questions appear
  • Build from existing skill input — verify 3-way Analyze/Edit/Rebuild question appears and discovery loop is enforced for Rebuild
  • Verify "Fix This Theme" button generates coherent prompt addressing root cause

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

Refactor

  • Renamed Quality Optimizer to Quality Analysis across agent and workflow builders for clearer intent
  • Updated quality report generation to use unified markdown documents and structured data output
  • Redesigned HTML quality report interface with improved organization for opportunities, broken items, and recommendations
  • Reoriented quality assessment workflows toward outcome-driven design and efficiency analysis

… and quality analysis pipeline

Builder Core (both workflow-builder and agent-builder):

- Establish outcome-driven design as the core philosophy in SKILL.md Overview,
  framing the builder's identity around helping users articulate outcomes rather
  than prescribe procedures

- Rewrite build-process.md Phase 1: existing skill input treated as reference
  material (not spec to replicate), discovery loop enforced with outcome-focused
  questions even when given existing input, 3-way routing for existing skills
  (Analyze/Edit/Rebuild)

- Add pruning check in Phase 4: "would the LLM do this correctly without being
  told? If yes, cut it"

- Remove redundant Phase 5 loading of script-opportunities-reference.md (was
  loaded twice — Phase 3 and Phase 5)

Reference Optimization (workflow-builder):

- script-opportunities-reference.md: 3,727 → 956 tokens (74% reduction) by
  compressing the 12-entry catalog to a compact table while preserving the
  determinism test principles

- complex-workflow-patterns.md: 3,760 → 1,110 tokens (70% reduction) by
  removing duplicated {project-root} section, cutting worked skeleton example,
  trimming compaction examples to one brief illustration

- quality-dimensions.md: add outcome-driven design as dimension 1 with pruning
  test and effectiveness > efficiency principle

- Net Phase 5 build load: 11,900 → 6,660 tokens (44% reduction)

Scanner Improvements (both builders):

- Add pruning concept to prompt-craft scanner with anti-pattern table (scoring
  algorithms, calibration tables, adapter files, per-platform instructions)
  and elevate over-specification severity from MEDIUM to HIGH

- Expand workflow-integrity scanner's single "no over-specification" line into
  a full structural check with specific patterns and severity guidance

- Add per-capability assessment guidance to agent builder's prompt-craft and
  cohesion scanners

Quality Analysis Pipeline Redesign (both builders):

- Rename "Quality Optimizer" → "Quality Analysis" throughout (the tool analyzes,
  the user optimizes)

- LLM scanners: remove rigid JSON output format sections and universal schema
  references (~2,500 tokens saved per scanner, ~15k total across 6 scanners).
  Scanners now write free-form analysis documents — natural output focused on
  insight, not form-filling

- Report creator: complete rewrite from template-filling to theme synthesis.
  Reads all scanner output (mixed formats), identifies root causes that group
  findings across scanners, produces both quality-report.md (narrative) and
  report-data.json (structured data for HTML). JSON schema is explicit and
  non-negotiable with self-check checklist

- HTML generator: complete rewrite to read report-data.json instead of raw
  scanner JSONs. Renders opportunities/themes with "Fix This Theme" prompt
  generation, BMad Method branding, expandable detailed analysis. Removes
  ~300 lines of backward-compat field name normalization. Adds normalize()
  safety net for common LLM field name drift

- Agent builder HTML: adds agent portrait (icon, name, title, synthesized
  personality description) and capability dashboard with expandable
  per-capability findings

Deleted Files:

- quality-optimizer.md (replaced by quality-analysis.md in both builders)
- assets/quality-report-template.md (report creator writes narrative, not
  fill-in-the-blanks)
- references/universal-scan-schema.md (scanners write free-form analysis,
  only report-data.json needs a schema)
@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Mar 27, 2026

This pull request is too large for Augment to review. The PR exceeds the maximum size limit of 100000 tokens (approximately 400000 characters) for automated code review. Please consider breaking this PR into smaller, more focused changes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5402d120-0a77-4f3f-ab48-de4d95e53340

📥 Commits

Reviewing files that changed from the base of the PR and between dcffcee and 5f578fd.

📒 Files selected for processing (33)
  • skills/bmad-agent-builder/SKILL.md
  • skills/bmad-agent-builder/assets/quality-report-template.md
  • skills/bmad-agent-builder/build-process.md
  • skills/bmad-agent-builder/quality-analysis.md
  • skills/bmad-agent-builder/quality-optimizer.md
  • skills/bmad-agent-builder/quality-scan-agent-cohesion.md
  • skills/bmad-agent-builder/quality-scan-enhancement-opportunities.md
  • skills/bmad-agent-builder/quality-scan-execution-efficiency.md
  • skills/bmad-agent-builder/quality-scan-prompt-craft.md
  • skills/bmad-agent-builder/quality-scan-script-opportunities.md
  • skills/bmad-agent-builder/quality-scan-structure.md
  • skills/bmad-agent-builder/references/quality-dimensions.md
  • skills/bmad-agent-builder/references/script-opportunities-reference.md
  • skills/bmad-agent-builder/references/universal-scan-schema.md
  • skills/bmad-agent-builder/report-quality-scan-creator.md
  • skills/bmad-agent-builder/scripts/generate-html-report.py
  • skills/bmad-workflow-builder/SKILL.md
  • skills/bmad-workflow-builder/assets/quality-report-template.md
  • skills/bmad-workflow-builder/build-process.md
  • skills/bmad-workflow-builder/quality-analysis.md
  • skills/bmad-workflow-builder/quality-optimizer.md
  • skills/bmad-workflow-builder/quality-scan-enhancement-opportunities.md
  • skills/bmad-workflow-builder/quality-scan-execution-efficiency.md
  • skills/bmad-workflow-builder/quality-scan-prompt-craft.md
  • skills/bmad-workflow-builder/quality-scan-script-opportunities.md
  • skills/bmad-workflow-builder/quality-scan-skill-cohesion.md
  • skills/bmad-workflow-builder/quality-scan-workflow-integrity.md
  • skills/bmad-workflow-builder/references/complex-workflow-patterns.md
  • skills/bmad-workflow-builder/references/quality-dimensions.md
  • skills/bmad-workflow-builder/references/script-opportunities-reference.md
  • skills/bmad-workflow-builder/references/universal-scan-schema.md
  • skills/bmad-workflow-builder/report-quality-scan-creator.md
  • skills/bmad-workflow-builder/scripts/generate-html-report.py

Walkthrough

This PR redesigns the BMad quality assessment workflow from "Quality Optimizer" (iterative refinement) to "Quality Analysis" (structural assessment), converting quality scanners from structured JSON output to natural-language markdown reports, reframing design philosophy toward outcome-driven capability definitions, and updating the report generation pipeline to consume a single report-data.json file rather than multiple temp JSON outputs.

Changes

Cohort / File(s) Summary
SKILL.md & Skill Routing
skills/bmad-agent-builder/SKILL.md, skills/bmad-workflow-builder/SKILL.md
Renamed "Quality Optimizer" section to "Quality Analysis", updated routing to include 3-way decision (Analyze/Edit/Rebuild), changed downstream references from quality-optimizer.md to quality-analysis.md, simplified headless-mode guidance.
Workflow Orchestration
skills/bmad-agent-builder/quality-optimizer.mdquality-analysis.md, skills/bmad-workflow-builder/quality-optimizer.mdquality-analysis.md, skills/bmad-agent-builder/build-process.md, skills/bmad-workflow-builder/build-process.md
Replaced "Quality Optimizer" orchestration (temp JSON collection + synthesis) with "Quality Analysis" workflow; reframed build process from architect-guide to outcome-driven design with mandatory discovery questions, explicit pruning checks, and new Analyze/Edit/Rebuild branching for existing agents.
Quality Scanner Output Format
skills/bmad-agent-builder/quality-scan-*.md (8 files: structure, prompt-craft, execution-efficiency, agent-cohesion, enhancement-opportunities, script-opportunities), skills/bmad-workflow-builder/quality-scan-*.md (7 files: structure, prompt-craft, execution-efficiency, skill-cohesion, enhancement-opportunities, script-opportunities, workflow-integrity)
Converted all quality scanners from universal JSON schema output ({quality-report-dir}/*-temp.json) to natural-language markdown analysis documents ({quality-report-dir}/*-analysis.md), removed fixed field requirements and validation, added new judgment criteria (e.g., pruning instructions, over-specification), and updated completion behavior to return filename only.
Report Generation & Synthesis
skills/bmad-agent-builder/report-quality-scan-creator.md, skills/bmad-workflow-builder/report-quality-scan-creator.md, skills/bmad-agent-builder/scripts/generate-html-report.py, skills/bmad-workflow-builder/scripts/generate-html-report.py
Reframed report creator from template-driven aggregation to theme-based synthesis, replaced report_file/summary/by_category JSON schema with new meta/agent_profile/broken/opportunities/strengths/detailed_analysis/recommendations structure; refactored Python scripts to load single report-data.json instead of scanning multiple temp files, replaced severity-filter UI with theme-based opportunities and broken-items sections.
Quality Dimensions & References
skills/bmad-agent-builder/references/quality-dimensions.md, skills/bmad-workflow-builder/references/quality-dimensions.md, skills/bmad-agent-builder/references/script-opportunities-reference.md, skills/bmad-workflow-builder/references/script-opportunities-reference.md
Updated dimensions from six to seven, added "Outcome-Driven Design" as Dimension 1 (replacing "Informed Autonomy"), added "Effectiveness over efficiency" directive forbidding token reduction that harms correctness, renamed "Quality Optimizer" references to "Quality Analysis" throughout, simplified script-opportunities catalog and condensed verb-to-opportunity guidance.
Reference & Template Removals
skills/bmad-agent-builder/references/universal-scan-schema.md, skills/bmad-workflow-builder/references/universal-scan-schema.md, skills/bmad-agent-builder/assets/quality-report-template.md, skills/bmad-workflow-builder/assets/quality-report-template.md
Removed universal JSON output schema definition (fields, severity enums, validation rules) and markdown quality-report template, as output contract has shifted to scanner-specific markdown analysis and report-creator synthesis.
Complex Workflow Patterns
skills/bmad-workflow-builder/references/complex-workflow-patterns.md
Simplified workflow persona, config documentation, and pattern guidance; removed detailed {project_root} portable-paths section, condensed progressive disclosure and document-cache recovery examples, tightened checklists and process rules.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant QA as Quality Analysis<br/>(quality-analysis.md)
    participant Lint as Lint/<br/>Pre-Pass Scripts
    participant Scanners as LLM<br/>Scanners (6)
    participant Creator as Report<br/>Creator
    participant HTML as HTML<br/>Generator

    User->>QA: Analyze agent/skill
    QA->>Lint: Run deterministic<br/>scripts in parallel
    Lint-->>QA: JSON metrics<br/>(pre-pass.json)
    QA->>Scanners: Spawn 6 scanners<br/>with path ± JSON
    Scanners->>Scanners: Read agent,<br/>write *-analysis.md
    Scanners-->>QA: Filename
    QA->>Creator: Invoke with all<br/>analysis outputs
    Creator->>Creator: Read SKILL.md,<br/>synthesize themes,<br/>group findings
    Creator-->>QA: report-data.json<br/>+ quality-report.md
    QA->>HTML: Generate with<br/>report-data.json
    HTML-->>QA: report.html
    QA-->>User: Grade + narrative<br/>+ opportunities<br/>+ HTML link
Loading
sequenceDiagram
    participant Builder as Build Process
    participant User
    participant AgentQA as Analyze/Edit/<br/>Rebuild Decision

    Builder->>Builder: Phase 1: Handle<br/>existing agent
    Builder->>AgentQA: Existing agent<br/>provided?
    AgentQA->>User: Analyze / Edit /<br/>Rebuild?
    User-->>AgentQA: Choice
    alt Analyze
        AgentQA-->>Builder: Route to<br/>quality-analysis.md
    else Edit or Rebuild
        AgentQA-->>Builder: Route to<br/>build-process.md<br/>with intent
        Builder->>Builder: Phase 2–6:<br/>Outcome-driven<br/>design flow
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

Poem

🐰 Hop along, dear reader, as quality evolves—
No more JSON schemas to puzzle and solve!
From optimizer's rigor to analyst's art,
Outcome-driven wisdom becomes the start.
Themes now group findings in markdown's embrace,
Clearer, kinder, with more breathing space. 📄

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-quality-optimizer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@bmadcode bmadcode merged commit efe7931 into main Mar 27, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant