Skip to content
GitHub Agentic Workflows

Meet the Workflows: Code Quality & Refactoring

Peli de Halleux

Ah, what marvelous timing! Come, come, let me show you the next wonder in Peli’s Agent Factory!

In our previous post, we explored how triage and summarization workflows help us stay on top of incoming activity - automatically labeling issues, creating digestible summaries, and narrating the day’s events. These workflows taught us that tone matters and even simple automation dramatically reduces cognitive load.

Now let’s turn to the agents that continuously improve code quality. Code quality and refactoring workflows work quietly in the background, never taking a day off - they analyze console output styling, spot semantic duplication, identify structural improvements, and find patterns humans miss because they can hold entire codebases in context. These workflows embody the principle that good enough can always become better, and that incremental improvements compound over time. Let’s meet the perfectionist agents.

These agents make our codebase cleaner and our developer experience better:

Code quality workflows represent a new paradigm in software engineering: autonomous cleanup agents that trail behind human developers, constantly sweeping, polishing, and improving. While developers race ahead implementing features and fixing bugs, these agents work tirelessly in the background - simplifying overcomplicated code, detecting semantic duplication that humans miss, and ensuring consistent patterns across the entire codebase. They’re the Marie Kondos of code repositories, asking “does this function spark joy?” and “could this be simpler?”

What makes these workflows particularly powerful is their tirelessness. The Terminal Stylist literally reads every line of console output code, suggesting improvements to make our CLI prettier (yes, it understands Lipgloss and modern terminal styling conventions). The Semantic Function Refactor finds duplicated logic that’s not quite identical enough for traditional duplicate detection - the kind of semantic similarity that humans recognize but struggle to systematically address. The Duplicate Code Detector goes further, using Serena’s semantic analysis to understand code meaning rather than just textual similarity, catching patterns that copy-paste detection misses entirely.

The Go-specific workflows demonstrate how deep these agents can go. Go Pattern Detector ensures consistency in idioms and best practices, Typist analyzes type usage patterns to improve type safety, and Go Fan reviews module dependencies to catch bloat and suggest better alternatives. Together, they embody institutional knowledge that would take years for a developer to accumulate, applied consistently across every file, every day.

Perhaps most intriguingly, these agents excel at cleaning up AI-generated code. As developers write more code with AI, this is over-more important. These workflows trail behind the development team, refactoring their output to match project standards, simplifying overly verbose AI suggestions, and ensuring the AI-human collaboration produces not just working code, but beautiful code. The Code Simplifier analyzes recently modified code (whether written by humans or AI) and creates pull requests with improvements, while the Repository Quality Improver takes a holistic view - identifying structural improvements and documentation gaps that emerge from rapid development.

This is the future of AI-enriched software engineering: developers at the frontier pushing forward, AI assistants helping them write code faster, and autonomous cleanup agents ensuring that speed doesn’t sacrifice quality. The repository stays clean, patterns stay consistent, and technical debt gets addressed proactively rather than accumulating into crisis. These workflows never get bored, never skip the boring parts.

Next Up: Documentation & Content Workflows

Section titled “Next Up: Documentation & Content Workflows”

Beyond code quality, we need to keep documentation accurate and up-to-date as code evolves. How do we maintain docs that stay current?

Continue reading: Documentation & Content Workflows →


This is part 2 of a 16-part series exploring the workflows in Peli’s Agent Factory.