RepoJanitor: The AI Maintainer That Cleans Your Repository
Discover RepoJanitor, an open-source AI maintainer tool that combines deterministic analysis and open-weight models like Gemma 2 to clean codebases safely.

Stock photo for illustration only, not from the actual event
- RepoJanitor acts as an AI repository maintainer to handle routine code cleanup.
- It integrates deterministic code analysis with open-weight models like Gemma 2 and Ollama.
- A strict SafetyGate sits between the AI and filesystem to prevent unverified modifications.
- Developers retain full control through interactive reviews, test validations, and PR generation.
Every software repository begins in a pristine state, but over time, minor clutter accumulates. Eventually, the codebase becomes a chore that everyone acknowledges needs cleaning yet nobody wants to spend an afternoon tackling, leading to postponed technical debt.
RepoJanitor is designed precisely to eliminate this tedious maintenance work that developers continually put off. Available as an open-source project, it steps in to handle repository upkeep efficiently by combining rigorous code analysis with artificial intelligence reasoning.

Stock photo for illustration only, not from the actual event
The workflow begins when a developer provides a public GitHub repository or a local codebase path. The system first inspects the repository structure using deterministic tools, identifies maintenance issues, and then forwards the structured findings to an open-weight AI model for logical evaluation.
The architectural genius of RepoJanitor lies in withholding unrestricted system access from the AI. By utilizing deterministic tools like AST analysis and file hashing for reliable tasks—such as duplicate and TODO detection—the system avoids unnecessary LLM calls and ensures predictable behavior.
A critical component of this architecture is the SafetyGate, which categorizes proposed actions into safe execution, required review, or blocked operations, ensuring that the AI functions strictly as a reasoning assistant rather than an autonomous execution engine.
Key features and checks handled by RepoJanitor include:
- Identifying missing environment variable documentation and dead code
- Calculating an overall repository health score for quick assessment
- Classifying risk levels into SAFE, REVIEW, or BLOCKED actions
- Running test validations and presenting an interactive Git diff
Furthermore, the system supports both cloud-based open-weight models like Google's Gemma 2 and local execution through Ollama. This ensures developers can analyze repositories locally without transmitting sensitive code to closed APIs, while strictly avoiding direct modifications to main or master branches.
Source: Dev.to
Found something wrong in this article? Report an issue with this article
Comments
Leave a Comment