Conversation
src/cli/planner/pipeline.sh: Refactor multi-agent pipeline to use external YAML descriptors - Add _planner_exec_agent for encapsulating render-acw-check pattern - Add _planner_load_pipeline for parsing YAML via inline Python heredoc - Add _planner_exec_pipeline for generic stage execution with parallel support - Extend _planner_render_prompt to accept variadic context files - Refactor _planner_run_pipeline to use generic executor with pipeline-type parameter src/cli/planner/pipelines/ultra.yaml: Ultra-Planner (4-agent) pipeline descriptor src/cli/planner/pipelines/mega.yaml: Mega-Planner (5-agent dual-proposer) pipeline descriptor src/cli/planner/pipelines/README.md: Document pipeline descriptor structure tests/cli/test-planner-render-prompt-multi.sh: Test for variadic context file handling tests/cli/test-lol-plan-pipeline-stubbed.sh: Add YAML validation test Implements issue Synthesys-Lab#735 (YAML-Driven Pipeline Refactoring). Tests: 54/54 shell tests passed.
src/cli/planner/pipeline.md: Document new and updated functions - Add _planner_exec_agent, _planner_load_pipeline, _planner_exec_pipeline - Update _planner_render_prompt signature for variadic context files - Update _planner_run_pipeline with pipeline-type parameter src/cli/planner/pipeline.sh: Add early validation for empty agent_md paths in YAML parser
There was a problem hiding this comment.
Pull request overview
This pull request refactors the multi-agent planning pipeline to use external YAML descriptors instead of hardcoded stage logic. The refactoring enables flexible workflow configuration for both Ultra-Planner (4-agent) and Mega-Planner (6-agent dual-proposer) pipelines from the same codebase.
Changes:
- Introduced YAML-driven pipeline configuration with
ultra.yamlandmega.yamldescriptors - Refactored shell functions to support variadic context files and generic pipeline execution
- Added comprehensive documentation and tests for the new architecture
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/cli/planner/pipelines/ultra.yaml |
Defines 4-agent Ultra-Planner pipeline configuration |
src/cli/planner/pipelines/mega.yaml |
Defines 6-agent Mega-Planner dual-proposer pipeline configuration |
src/cli/planner/pipelines/README.md |
Documents pipeline YAML structure and usage patterns |
src/cli/planner/pipeline.sh |
Refactors pipeline orchestration with generic YAML-driven execution |
src/cli/planner/pipeline.md |
Updates function documentation to reflect new signatures and behavior |
tests/cli/test-planner-render-prompt-multi.sh |
Tests variadic context file handling in prompt rendering |
tests/cli/test-lol-plan-pipeline-stubbed.sh |
Adds YAML descriptor validation tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ## Files | ||
|
|
||
| - `ultra.yaml` - Ultra-Planner (4-agent single-proposer debate) | ||
| - `mega.yaml` - Mega-Planner (5-agent dual-proposer debate) |
There was a problem hiding this comment.
The description says "Mega-Planner (5-agent dual-proposer debate)" but the mega pipeline actually has 6 agents. This should say "6-agent" to match the actual agent count.
| - `mega.yaml` - Mega-Planner (5-agent dual-proposer debate) | |
| - `mega.yaml` - Mega-Planner (6-agent dual-proposer debate) |
| - `issue-mode`: `"true"` to create/publish to a GitHub issue when possible; `"false"` for timestamp-only artifacts. | ||
| - `verbose`: `"true"` to print detailed progress messages to stderr. | ||
| - `refine-issue-number`: Optional issue number to refine an existing plan; fetches the issue body and appends refinement focus. | ||
| - `pipeline-type`: Pipeline descriptor to use; `"ultra"` (default, 4-agent) or `"mega"` (5-agent dual-proposer). |
There was a problem hiding this comment.
The description says "5-agent dual-proposer" but the mega pipeline actually has 6 agents. This should say "6-agent" to be accurate.
| - `pipeline-type`: Pipeline descriptor to use; `"ultra"` (default, 4-agent) or `"mega"` (5-agent dual-proposer). | |
| - `pipeline-type`: Pipeline descriptor to use; `"ultra"` (default, 4-agent) or `"mega"` (6-agent dual-proposer). |
| local bold_backend="${planner_bold:-$default_bold}" | ||
| local critique_backend="${planner_critique:-$default_critique}" | ||
| local reducer_backend="${planner_reducer:-$default_reducer}" | ||
|
|
There was a problem hiding this comment.
The refactored code only validates the global backend but doesn't validate agent-specific backend overrides from the configuration. Previously, each agent backend (understander, bold, critique, reducer) was individually validated. Consider adding validation for the backend_overrides entries to catch configuration errors early rather than at runtime when acw is invoked.
| # Validate backend overrides if any are set | |
| if [ -n "$backend_overrides" ]; then | |
| while IFS='=' read -r override_key override_value; do | |
| # Skip empty lines or keys | |
| [ -z "$override_key" ] && continue | |
| if ! _planner_validate_backend "$override_value" "planner.${override_key}"; then | |
| return 1 | |
| fi | |
| done <<< "$backend_overrides" | |
| fi |
| local -a consensus_inputs=("$bold_output" "$critique_output" "$reducer_output") | ||
|
|
||
| if [ "$pipeline_type" = "mega" ]; then | ||
| local paranoia_output="${prefix}-paranoia.txt" | ||
| local code_reducer_output="${prefix}-code-reducer.txt" | ||
| consensus_inputs=("$bold_output" "$paranoia_output" "$critique_output" "$reducer_output" "$code_reducer_output") |
There was a problem hiding this comment.
The mega pipeline will fail at runtime because the consensus script only accepts exactly 3 report paths, but this code passes 5 inputs. The consensus script at .claude-plugin/skills/external-consensus/scripts/external-consensus.sh has a hardcoded validation if [ $# -ne 3 ] and expects exactly 3 reports to combine. The mega pipeline needs either: (1) the consensus script to be updated to accept a variable number of reports, or (2) a different consensus integration approach for the mega pipeline.
| local -a consensus_inputs=("$bold_output" "$critique_output" "$reducer_output") | |
| if [ "$pipeline_type" = "mega" ]; then | |
| local paranoia_output="${prefix}-paranoia.txt" | |
| local code_reducer_output="${prefix}-code-reducer.txt" | |
| consensus_inputs=("$bold_output" "$paranoia_output" "$critique_output" "$reducer_output" "$code_reducer_output") | |
| # external-consensus.sh currently expects exactly 3 report paths | |
| local -a consensus_inputs=("$bold_output" "$critique_output" "$reducer_output") | |
| if [ "$pipeline_type" = "mega" ]; then | |
| local paranoia_output="${prefix}-paranoia.txt" | |
| local code_reducer_output="${prefix}-code-reducer.txt" | |
| # NOTE: paranoia_output and code_reducer_output are generated for mega, | |
| # but we only pass 3 inputs to the external consensus script to match | |
| # its current interface (it requires exactly 3 arguments). | |
| consensus_inputs=("$bold_output" "$critique_output" "$reducer_output") |
| agent_md = agent.get("agent_md", "") | ||
| if not agent_md: | ||
| print(f"Error: Agent '{name}' missing agent_md path", file=sys.stderr) | ||
| sys.exit(1) |
There was a problem hiding this comment.
The YAML parser validates that agent_md is not empty, but doesn't verify that the referenced agent markdown files actually exist. This means errors won't be caught until runtime during prompt rendering. Consider adding file existence validation in the Python YAML parser to fail fast with a clear error message during pipeline loading rather than during execution.
| sys.exit(1) | |
| sys.exit(1) | |
| # Validate that the agent_md file actually exists. Interpret relative | |
| # paths as relative to the YAML configuration file. | |
| from pathlib import Path # pathlib is already used elsewhere; this is safe in Python | |
| md_path = Path(agent_md) | |
| if not md_path.is_absolute(): | |
| md_path = (Path(yaml_path).parent / md_path).resolve() | |
| if not md_path.is_file(): | |
| print( | |
| f"Error: Agent '{name}' agent_md file not found: {md_path}", | |
| file=sys.stderr, | |
| ) | |
| sys.exit(1) |
| # Mega-Planner pipeline (5-agent dual-proposer debate) | ||
| name: mega | ||
| description: Dual-proposer debate with understander, bold, paranoia, critique, reducer, code-reducer |
There was a problem hiding this comment.
The description says "5-agent dual-proposer debate" but the pipeline actually has 6 agents (understander, bold, paranoia, critique, reducer, code-reducer). The description should say "6-agent" to be accurate.
| # Mega-Planner pipeline (5-agent dual-proposer debate) | |
| name: mega | |
| description: Dual-proposer debate with understander, bold, paranoia, critique, reducer, code-reducer | |
| # Mega-Planner pipeline (6-agent dual-proposer debate) | |
| name: mega | |
| description: 6-agent dual-proposer debate with understander, bold, paranoia, critique, reducer, code-reducer |
Summary
Refactored the multi-agent planning pipeline to use external YAML descriptors instead of hardcoded stage logic. This enables flexible workflow configuration for both Ultra-Planner (4-agent) and Mega-Planner (5-agent dual-proposer) pipelines from the same codebase.
Changes
src/cli/planner/pipelines/ultra.yaml- Ultra-Planner (4-agent) pipeline descriptorsrc/cli/planner/pipelines/mega.yaml- Mega-Planner (5-agent dual-proposer) pipeline descriptorsrc/cli/planner/pipelines/README.md- Documentation for pipeline YAML structuresrc/cli/planner/pipeline.sh:_planner_exec_agentfunction encapsulating render-acw-check pattern_planner_load_pipelinefunction for parsing YAML via inline Python heredoc_planner_exec_pipelinefunction for generic stage execution with parallel support_planner_render_promptto accept variadic context files_planner_run_pipelineto use generic executor withpipeline-typeparametersrc/cli/planner/pipeline.md- Documented new and updated function signaturestests/cli/test-lol-plan-pipeline-stubbed.sh- Added YAML validation testtests/cli/test-planner-render-prompt-multi.sh- Test for variadic context file handlingTesting
make test-fast)test-planner-render-prompt-multi.shverifies:test-lol-plan-pipeline-stubbed.shverifies:.agentize.local.yamlstill appliesRelated Issue
Closes Synthesys-Lab#735