diff --git a/src/modules/bmm/module.yaml b/src/modules/bmm/module.yaml index 9ac9f606..2c7fe026 100644 --- a/src/modules/bmm/module.yaml +++ b/src/modules/bmm/module.yaml @@ -53,34 +53,22 @@ tea_use_playwright_utils: default: false result: "{value}" -# External Code Review Agents Configuration -# These are auto-detected at runtime, but user can set preference here +# External Code Review Agent Selection +# Allows delegating code reviews to an external AI agent CLI for independent, unbiased reviews # Useful when using a different AI as primary IDE agent (e.g., Codex/Gemini users can use Claude for reviews) -external_review_agents: - codex_available: - prompt: false # Auto-detected at runtime - default: false - result: "{value}" - gemini_available: - prompt: false # Auto-detected at runtime - default: false - result: "{value}" - claude_available: - prompt: false # Auto-detected at runtime - default: false - result: "{value}" - preferred_agent: - prompt: "Which external code review agent do you prefer (if multiple are available)?" - default: "codex" - result: "{value}" - single-select: - - value: "codex" - label: "Codex (OpenAI) - Fast code review with OpenAI models" - - value: "gemini" - label: "Gemini (Google) - Code review with Google models" - - value: "claude" - label: "Claude (Anthropic) - Code review with Claude models (good for Codex/Gemini users)" - last_checked: - prompt: false # System-managed timestamp - default: null - result: "{value}" +external_review_agent: + prompt: + - "Which external agent should perform code reviews?" + - "External agents provide independent, unbiased reviews separate from your primary IDE agent." + - "The selected CLI must be installed and configured on your system." + default: "none" + result: "{value}" + single-select: + - value: "codex" + label: "Codex (OpenAI) - Code review using OpenAI Codex CLI" + - value: "gemini" + label: "Gemini (Google) - Code review using Google Gemini CLI" + - value: "claude" + label: "Claude Code (Anthropic) - Code review using Claude Code CLI" + - value: "none" + label: "None - Use built-in review (no external agent)" diff --git a/src/modules/bmm/workflows/4-implementation/code-review/external-agent-prompt.md b/src/modules/bmm/workflows/4-implementation/code-review/external-agent-prompt.md new file mode 100644 index 00000000..1e3ace7e --- /dev/null +++ b/src/modules/bmm/workflows/4-implementation/code-review/external-agent-prompt.md @@ -0,0 +1,35 @@ +You are an ADVERSARIAL code reviewer. Your job is to find problems, not approve code. + +VERY IMPORTANT! + +- This is a READ ONLY operation. You are not to change anything in this code. +- You are FORBIDDEN to write to any files. +- You are FORBIDDEN to change any files. +- You are FORBIDDEN to delete any files. + +REQUIREMENTS: + +- Find 3-10 specific issues minimum - no lazy looks good reviews +- Categorize as HIGH (must fix), MEDIUM (should fix), LOW (nice to fix) +- For each issue: specify file:line, describe problem, suggest fix +- Check: Security vulnerabilities, performance issues, error handling, test quality +- Verify: Tasks marked [x] are actually done, ACs are actually implemented + +STORY CONTEXT: {{story_path}} +FILES TO REVIEW: {{comprehensive_file_list}} +ACCEPTANCE CRITERIA: {{acceptance_criteria_list}} +TASKS: {{task_list}} + +OUTPUT FORMAT: + +## HIGH SEVERITY + +- [file:line] Issue description | Suggested fix + +## MEDIUM SEVERITY + +- [file:line] Issue description | Suggested fix + +## LOW SEVERITY + +- [file:line] Issue description | Suggested fix diff --git a/src/modules/bmm/workflows/4-implementation/code-review/instructions.xml b/src/modules/bmm/workflows/4-implementation/code-review/instructions.xml index a3d624a4..09834e73 100644 --- a/src/modules/bmm/workflows/4-implementation/code-review/instructions.xml +++ b/src/modules/bmm/workflows/4-implementation/code-review/instructions.xml @@ -67,21 +67,16 @@ - + - - - - - - - 📋 Using cached agent detection from config.yaml - Codex: {{codex_available}}, Gemini: {{gemini_available}}, Claude: {{claude_available}} + + + 📋 External agent disabled in config - will use built-in adversarial review - - - 🔍 No cached detection found - detecting available agents... + + + 🔍 Detecting external agent availability... @@ -104,66 +99,43 @@ ✓ Claude CLI detected - - + + + + + + + + + + + -external_review_agents: - codex_available: {{codex_available}} - gemini_available: {{gemini_available}} - claude_available: {{claude_available}} - preferred_agent: codex - last_checked: {{date}} -EOF -fi -echo 'Config updated' -" /> - 📝 Config updated with detection results - + + + + + ⚠️ Preferred agent ({{preferred_agent}}) not available, falling back to Codex + + + + + ⚠️ Preferred agent ({{preferred_agent}}) not available, falling back to Gemini + + + + + ⚠️ Preferred agent ({{preferred_agent}}) not available, falling back to Claude + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 🤖 External agent selected: {{external_agent_cmd}} - will delegate code review - - - 📋 No external agent available - will use built-in adversarial review + + 🤖 External agent selected: {{external_agent_cmd}} - will delegate code review + + + 📋 No external agent available - will use built-in adversarial review + @@ -208,83 +180,21 @@ echo 'Config updated' Copy the invoke-bash cmd attribute EXACTLY as written below. DO NOT remove flags, reorder arguments, or "improve" the command. + + + Load {{external_prompt_file}} content into {{external_prompt}} + - CODEX: Use codex exec --full-auto with inline prompt - + CODEX: Use codex exec with read-only sandbox and full-auto + - GEMINI: Use gemini -p with inline prompt and --yolo - + GEMINI: Use gemini -p with prompt from file and --yolo + - CLAUDE: Use claude -p with inline prompt - + CLAUDE: Use claude -p with prompt from file + diff --git a/src/modules/bmm/workflows/4-implementation/code-review/workflow.yaml b/src/modules/bmm/workflows/4-implementation/code-review/workflow.yaml index 522b7f39..8cdc0fe1 100644 --- a/src/modules/bmm/workflows/4-implementation/code-review/workflow.yaml +++ b/src/modules/bmm/workflows/4-implementation/code-review/workflow.yaml @@ -18,6 +18,7 @@ sprint_status: "{sprint_artifacts}/sprint-status.yaml || {output_folder}/sprint- installed_path: "{project-root}/.bmad/bmm/workflows/4-implementation/code-review" instructions: "{installed_path}/instructions.xml" validation: "{installed_path}/checklist.md" +external_agent_prompt: "{installed_path}/external-agent-prompt.md" template: false variables: @@ -25,11 +26,10 @@ variables: project_context: "**/project-context.md" story_dir: "{sprint_artifacts}" - # External code review agents configuration - # Note: codex_available and gemini_available are auto-detected at runtime via invoke-bash - # The workflow uses runtime variables {{codex_available}}, {{gemini_available}}, {{use_external_agent}}, {{external_agent_cmd}} - external_review_agents: - preferred_agent: "{config_source}:external_review_agents.preferred_agent || 'codex'" + # External code review agent configuration + # User selects preferred agent during install; detection verifies availability at runtime + # Supported values: codex, gemini, claude, none + external_review_agent: "{config_source}:external_review_agent || 'none'" # Smart input file references - handles both whole docs and sharded docs # Priority: Whole document first, then sharded version