Automated AST Migration and Verification Pipeline Specification
Specify an automated multi-agent workflow chain for codebase refactoring, static analysis, and regression testing.
Use this template when establishing an automated pipeline of specialized agents tasked with transforming legacy source code and validating functional parity. It produces a comprehensive engineering specification for agent routing, static verification gates, and pull request issuance.
Role: Staff Software Quality Engineer specializing in automated developer tooling, AST code transformations, and CI/CD verification chains.
Context
- Source Repository & Language: {{source_repository}}
- Target Migration Standard: {{target_framework_version}}
- Test Verification Harness: {{verification_test_suite}}
- Agent Router Architecture: {{llm_router_config}}
- Human Review Gate: {{human_review_gate}}
- Pull Request Policy: {{pull_request_policy}}
Task
Produce an Engineering Pipeline Specification for an autonomous multi-agent refactoring workflow chain that ingests {{source_repository}}, performs syntactically valid upgrades to {{target_framework_version}}, validates output against {{verification_test_suite}}, and adheres to {{pull_request_policy}}.
Method
- Establish file discovery and partitioning logic to chunk the codebase within {{source_repository}} by dependency graph order.
- Define prompt and tool-call contracts for the Analyzer Agent to identify deprecated APIs and incompatible syntax.
- Define the Transformation Agent spec, detailing AST-aware patch generation targetting {{target_framework_version}}.
- Design the Linter and Static Analysis Agent step that executes local compile checks before test running.
- Specify the Test Runner Agent protocol that executes {{verification_test_suite}} and feeds stack traces back on failure.
- Detail an automated self-healing loop permitting a maximum of 3 localized remediation cycles on test failure.
- Define the boundary conditions where {{human_review_gate}} is triggered versus automated PR submission under {{pull_request_policy}}.
Constraints
- MUST NOT permit any transformed code to bypass {{verification_test_suite}} prior to PR generation.
- Generated code patches MUST maintain byte-level deterministic formatting matching repository lint rules.
- The self-healing loop MUST abort and trigger {{human_review_gate}} if the same test fails consecutively twice.
- All agent token budgets and execution timeouts must be bounded per file.
Output format
- Multi-Agent Pipeline Topology (Workflow diagram, step dependencies, and tool execution boundaries)
- Agent Node Specifications (Individual agent inputs, outputs, system prompt constraints, and allowed tool calls)
- Self-Correction & Feedback Loop Protocol (Stack trace parsing, prompt injection format, and backoff limits)
- Quality Gate & PR Lifecycle Policy (Criteria for mergeability, diff size limits, and {{human_review_gate}} escalation rules)
Self-review
- Ensure dependency-ordered processing prevents circular refactoring conflicts.
- Verify self-healing loop has a deterministic exit condition to prevent infinite LLM token spend.
- Check that {{target_framework_version}} and {{verification_test_suite}} constraints are strictly enforced in the quality gates.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.