Files
pm-template/openwebui/pipelines/bmad_factory_pipeline.py
Max Mayfield df667e0db8 v2: Forge Console + Open WebUI artifacts + Docker
- web/: Local chat UI (Express + WS → Codex bridge)
- openwebui/: Preset, pipelines, knowledge manifest
- Dockerfile + docker-compose.yml
- Updated README with 3 frontend options
- CLI-agnostic: works with Codex, Claude Code, Kiro, Gemini
2026-02-27 06:56:34 +00:00

118 lines
4.9 KiB
Python

"""
title: BMad & Factory Pipeline
author: PM Factory
version: 0.1.0
description: Brainstorm with BMad Creative Suite and validate against Transparent Factory tenets.
requirements: subprocess
"""
import subprocess
import json
import os
from typing import Optional
BMAD_PATH = os.environ.get("BMAD_PATH", "bmad")
FACTORY_PATH = os.environ.get("FACTORY_PATH", ".standards/factory/content")
class Tools:
def __init__(self):
self.valves = self.Valves()
class Valves:
BMAD_PATH: str = BMAD_PATH
FACTORY_PATH: str = FACTORY_PATH
def bmad_list_agents(self, __user__: dict = {}) -> str:
"""
List available BMad Creative Intelligence Suite agents and their capabilities.
:return: List of agents with descriptions
"""
agents = {
"Carson (Brainstorming Coach)": {
"command": "/cis-brainstorm",
"capabilities": "36 ideation techniques, group dynamics, 'Yes, and...' methodology"
},
"Maya (Design Thinking Coach)": {
"command": "/cis-design-thinking",
"capabilities": "Five-phase design thinking, empathy mapping, rapid prototyping"
},
"Victor (Innovation Strategist)": {
"command": "/cis-innovation-strategy",
"capabilities": "Jobs-to-be-Done, Blue Ocean Strategy, Business Model Canvas"
},
"Dr. Quinn (Creative Problem Solver)": {
"command": "/cis-problem-solve",
"capabilities": "Root cause analysis, systematic diagnosis, solution frameworks"
},
"Storyteller": {
"command": "/cis-story",
"capabilities": "PR/FAQ drafting, narrative structure, stakeholder communication"
}
}
return json.dumps(agents, indent=2)
def bmad_brainstorm(self, topic: str, technique: str = "auto", __user__: dict = {}) -> str:
"""
Run a brainstorming session using BMad's Carson agent.
:param topic: The topic or problem to brainstorm about
:param technique: Brainstorming technique (auto, scamper, reverse, starbursting, six-hats, etc). Default: auto
:return: Brainstorming session output
"""
prompt = f"""You are Carson, the Brainstorming Coach from the BMad Creative Intelligence Suite.
Run a brainstorming session on this topic: {topic}
Technique: {technique if technique != 'auto' else 'Choose the best technique for this topic.'}
Generate:
1. 8-12 diverse ideas using the selected technique
2. For each idea: one sentence description + feasibility rating (1-5)
3. Top 3 recommendations with brief rationale
4. One wild/moonshot idea that breaks assumptions
Use "Yes, and..." methodology. Celebrate bold ideas."""
return prompt
def factory_check(self, spec_text: str, __user__: dict = {}) -> str:
"""
Validate a specification or epic against the Transparent Factory tenets.
:param spec_text: The spec, epic, or requirement text to validate
:return: Compliance report with pass/fail per tenet and recommendations
"""
tenets = {
"Atomic Flagging": {
"rule": "All new features must be behind feature flags with 14-day TTL. Must use OpenFeature SDK.",
"check": "Does the spec mention feature flags? Is there a TTL or rollout plan?"
},
"Elastic Schema": {
"rule": "Schema changes must be additive-only. Breaking changes require sync dual-write with 30-day migration SLA.",
"check": "Does the spec propose schema changes? Are they additive? Is there a migration plan?"
},
"Cognitive Durability": {
"rule": "All architectural decisions must have ADR logs. Code must be readable in 60 seconds.",
"check": "Does the spec reference ADRs? Is the proposed design simple enough to explain quickly?"
},
"Semantic Observability": {
"rule": "AI reasoning must emit structured telemetry spans. Decisions must be traceable.",
"check": "Does the spec include observability requirements? Are reasoning spans defined?"
},
"Configurable Autonomy": {
"rule": "AI agent actions must have governance guardrails. Human-in-the-loop for destructive operations.",
"check": "Does the spec define autonomy boundaries? Are there approval gates?"
}
}
report = "# Transparent Factory Compliance Check\n\n"
report += f"**Input:** {spec_text[:200]}{'...' if len(spec_text) > 200 else ''}\n\n"
report += "| Tenet | Rule | Question |\n|-------|------|----------|\n"
for name, t in tenets.items():
report += f"| {name} | {t['rule']} | {t['check']} |\n"
report += "\n*Review each tenet against the spec and flag violations.*"
return report