Context
From the Scout analysis of issue #25311, this workflow addresses Problem 2: Lack of Continuous Refactoring.
"If you're using AI to generate code at industrial scale, you have to refactor constantly and continuously. If you don't, things immediately get out of hand."
AI's ability to generate code at high velocity accelerates technical debt accumulation. Without a forcing function, refactoring gets deferred indefinitely.
Objective
Create a new gh-aw agentic workflow called refactoring-cadence that tracks repository code health over time and automatically opens issues when the health score drops.
Workflow Prompt
Create an agentic GitHub Actions workflow called "refactoring-cadence" that:
1. Tracks a "code health score" for the repository over time using metrics like:
- Average file length
- Average cyclomatic complexity per function
- Number of files that have grown >20% since last baseline
- Number of TODO/FIXME/HACK comments added vs. resolved
2. Runs after every 10 commits (or configurable interval) on main, using a
commit counter stored in a workflow artifact or GitHub variable
3. When the health score drops below a configurable threshold, automatically
opens a GitHub Issue titled "🔧 Refactoring Required: Code Health Alert"
that includes:
- The specific files and functions that degraded
- An AI-generated refactoring plan with prioritized action items
- A checklist of concrete refactoring tasks for a human to approve and assign
4. Labels the issue with "refactoring" and "ai-generated"
5. Blocks merging new feature PRs until the open refactoring issue is closed
(enforced via a branch protection rule check)
Use radon for Python complexity analysis, cargo-clippy for Rust.
Store baseline metrics as a JSON artifact per workflow run.
Files to Create
.github/workflows/refactoring-cadence.md — the workflow markdown file
Acceptance Criteria
Generated by Plan Command for issue #25311 · ● 394.6K · ◷
Context
From the Scout analysis of issue #25311, this workflow addresses Problem 2: Lack of Continuous Refactoring.
AI's ability to generate code at high velocity accelerates technical debt accumulation. Without a forcing function, refactoring gets deferred indefinitely.
Objective
Create a new gh-aw agentic workflow called
refactoring-cadencethat tracks repository code health over time and automatically opens issues when the health score drops.Workflow Prompt
Files to Create
.github/workflows/refactoring-cadence.md— the workflow markdown fileAcceptance Criteria
refactoringandai-generated.lock.ymlgenerated viamake recompileRelated to Blog analysis #25311