Agent-Janitor
Installs Windsurf/Cascade workspace rules (.windsurfrules) to prevent unprompted TODO investigations and scope creep.
Cross-references GitHub issue state via the GitHub CLI to classify TODO references as closed/dead-end or open scope-creep traps.
Provides a CI/presubmit check and ready-to-use GitHub Actions workflow that blocks PRs introducing references to closed issues.
Installs workspace instructions (.github/copilot-instructions.md) to keep GitHub Copilot within prompt scope and ignore stale inline TODOs.
Provides a Google Antigravity plugin and anti-distraction skill/rule, and connects the audit and cleaning MCP tools to Antigravity sessions.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
β‘ The Problem: "The Agent Distraction Tax"
"What is easy for humans to skim past in code, agents see as a call to action."
β Sam Saccone & Madhuri Garikapati, Google Developers
Across millions of agent coding sessions at Google:
1 in 7 sessions (13%) expose AI coding agents to inline
TODO(bug/...)references.83% of agent reactions are unpromptedβthe developer never asked for the bug.
41% chase closed dead-ends, wasting tokens on fixed/obsolete bugs.
57% trigger scope creep, editing code unrelated to the user's prompt.
The Tax: +70% more steps, +77% more tokens, and +105% more wait time.
Without Agent Janitor (Default Agents) | With Agent Janitor (Protected Repo) |
β Agent stumbles on old | β Agent ignores stale comments; treats them as passive history |
β Spends 10+ tool steps researching closed tickets | β -41% fewer steps per session |
β Blows token limits exploring dead ends | β -44% fewer tokens consumed |
β Unprompted refactors that break review PRs | β Zero scope-creep; PRs strictly match developer prompt |
β Double developer wait latency (~3 minutes) | β Fast turnaround (~90 seconds) |
Related MCP server: modelroute
π‘οΈ The 3-Layer Defense System
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. Behavioral Guardrail (rules/agent-focus.md) β
β Instructs LLMs to treat TODOs as passive history β
βββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 2. Agent Janitor CLI (Scanner & Cleaner) β
β β’ Audits repos for Dead-End & Scope-Creep traps β
β β’ Cross-references GitHub / Issue Tracker state β
β β’ Prunes obsolete comments or neutralizes verbs β
βββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 3. CI / Presubmit Gate (.github/workflows) β
β Blocks PRs introducing references to closed issues β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββπ Multi-App Plugins, Skills & Integrations
agent-janitor works natively across all major AI coding platforms:
β‘ One-Click Auto-Setup
Install guardrails and skills into any repository for all your AI coding assistants at once:
# Install for all apps (Claude Code, Cursor, Windsurf, Copilot, Antigravity):
agent-janitor init . --all
# Or install for a specific assistant:
agent-janitor init . --claude
agent-janitor init . --cursor
agent-janitor init . --windsurf
agent-janitor init . --copilot
agent-janitor init . --antigravity1. π€ Google Antigravity Plugin & Skill
The Agent Janitor Plugin is installed directly in ~/.gemini/config/plugins/agent-janitor:
Bundled Skill:
anti-distraction(teaches Antigravity how to audit, prune dead-ends, and mask triggers).Bundled Rule:
rules/AGENTS.md(active anti-distraction guardrail for all sessions).Bundled MCP Server: Automatically connects the audit and cleaning tools to Antigravity sessions.
2. π§ Claude Code (Anthropic)
CLAUDE.md: Directs Claude Code to adhere strictly to prompt scope and ignore inline TODOs.Custom Slash Command (
/janitor): Installed to.claude/commands/janitor.mdso you can type/janitorinside Claude Code to audit or clean the repo.MCP Integration: Connect directly by running:
claude mcp add agent-janitor python -m agent_janitor.mcp_server
3. π― Cursor
.cursor/rules/anti-distraction.mdc: Cursor's modern Markdown Component rule format withalwaysApply: true..cursorrules: Classic Cursor scope guardrail.MCP Server: Add to Cursor Settings > Features > MCP:
Type:
commandCommand:
python -m agent_janitor.mcp_server
4. π Windsurf (Codeium)
.windsurfrules: Injected into Cascade's workspace memory to prevent unprompted TODO investigations.
5. π GitHub Copilot
.github/copilot-instructions.md: Active workspace instructions for GitHub Copilot Workspace, Copilot Edits, and Copilot Chat.
6. π Universal MCP (Model Context Protocol) Server
The built-in MCP server runs on stdio without third-party dependencies:
python -m agent_janitor.mcp_serverExposed MCP Tools:
audit_codebase(path, mock_status_file, github_repo, fossil_days): Audits for dead-ends (41%), scope-creep (57%), and fossilized debt.clean_dead_ends(path, apply, mock_status_file): Prunes obsolete comments referencing closed issues.mask_triggers(path, apply): Converts activeTODO/FIXMEaction verbs into passive developer notes.
π Quick Start
1. Install
Clone or install locally:
pip install .2. Audit Your Codebase
Scan your codebase to detect agent traps:
agent-janitor audit . --output audit_report.mdOutput example:
============================================================
AGENT DISTRACTION AUDIT REPORT
============================================================
Total Comment References Scanned: 42
Risk Breakdown (vs Google Empirical Benchmarks):
π Dead-End Traps (Closed/Won't Fix) : 8 (41% blog benchmark)
β οΈ Scope-Creep Traps (Open Tickets) : 14 (57% blog benchmark)
β³ Fossilized Debt (> 1 year old) : 6
βΉοΈ Other / Unverified : 14
------------------------------------------------------------3. Automatically Prune Dead-Ends
Prune references to tickets that are already closed, resolved, or won't fix:
# Preview diffs (dry-run):
agent-janitor clean .
# Apply cleanups directly to files:
agent-janitor clean . --apply4. Neutralize Action Triggers (Masking)
Convert active imperative verbs (TODO(b/123): ... or FIXME: ...) into passive developer notes (Note(b/123): ...), preventing LLMs from seeing them as active goals:
agent-janitor mask . --apply5. Enforce in CI / Presubmit
Add agent-janitor check to your CI pipeline. It exits with code 1 if any closed-bug references exist in the code:
agent-janitor check .π Project Structure
scanner.py: Multi-language source scanner detecting TODOs, FIXMEs, bug IDs (#123,b/456, JiraPROJ-789, URLs).git_utils.py: Inspectsgit blameporcelain data to extract commit age, author, and timestamp.classifier.py: Maps findings into Dead-End Traps, Scope-Creep Risks, or Fossilized Debt.cleaner.py: Safe AST/line-level comment pruning and trigger neutralization.reporter.py: Generates terminal summaries and Markdown audit reports.trackers/: Live issue tracker integrations (GitHub CLIgh, mock JSON for offline audits).
rules/agent-focus.md: Drop-in agent instruction rule for Antigravity, Cursor (.cursorrules), Copilot, or Claude..github/workflows/anti-distraction.yml: Ready-to-use GitHub Actions workflow.
π Behavioral Agent Rule: rules/agent-focus.md
You can directly copy rules/agent-focus.md into your .cursorrules, .gemini/rules/, or agent system prompt:
# Agent Focus Directive
- Treat inline TODOs, FIXMEs, and bug IDs strictly as passive commentary.
- DO NOT initiate tool searches or codebase queries for referenced bug IDs unless explicitly commanded in the user's prompt.
- DO NOT expand scope or attempt to resolve unprompted TODOs found during research.π References & Background
Original Research: Agent Distraction
Authors: Sam Saccone (Senior Staff Software Engineer) & Madhuri Garikapati (Senior Staff Data Scientist) at Google
Published: November 6, 2026 on the Google Developers Blog
Key Findings: Based on traces across hundreds of millions of agent steps, unprompted inline TODO interactions account for 83% of detour sessions, causing +70% more steps, +77% more tokens, and +105% more developer wait time.
This server cannot be deployed
Maintenance
Related MCP Connectors
Enforces architectural invariants and code quality rules inside your AI agent's edit loop.
Scores your code across 12 areas, with findings, fix prompts, and re-assessment in your AI agent
Lints + auto-fixes how AI coding agents discover any new product. 24 rules, 6 tools, score 0-100.
Research-backed lint + generation for agent context files (CLAUDE.md, AGENTS.md) + prompt enhancer.
Related MCP Servers
- AlicenseAqualityDmaintenanceDetects and automatically removes AI-generated code slop patterns like redundant comments, verbose logging, and unnecessary error handling across multiple programming languages.31MIT

modelrouteofficial
FlicenseNot gradedqualityDmaintenanceEnables AI agents to scan code for TODO, FIXME, XXX issues via MCP, providing prioritized findings in table, JSON, or SARIF format.-- FlicenseNot gradedqualityDmaintenanceEnables AI agents to scan codebases for TODO/FIXME/XXX patterns and get prioritized results over MCP, supporting CI gates and multiple output formats.-
- AlicenseAqualityDmaintenanceScans codebases for TODO comments and exposes them as structured data to LLMs, enabling AI assistants to inspect, prioritize, and propose fixes.55 npmISC