AgentJanitor

Local-first diagnostics & cleanup CLI for AI coding agents.

AgentJanitor is a local-first diagnostics and cleanup tool built for the mess your AI coding agents leave behind. It finds orphaned background processes, bloated session history, broken MCP servers, stale caches, and exposed credentials across Claude Code, OpenAI Codex, and Gemini CLI — then safely cleans them up with backups and full undo.

View on GitHub Installation

$ agentjanitor scan
$ agentjanitor fix --dry-run
$ agentjanitor fix
$ agentjanitor undo

Why AgentJanitor?

AI coding agents (Claude Code, Codex, Gemini CLI, and others) spawn background processes, MCP servers, and session/cache data that quietly accumulate — leaked helper processes eating RAM, gigabytes of stale session history, duplicated or broken MCP server definitions, and occasionally a plaintext credential that never got rotated. AgentJanitor understands agent-specific concepts (MCP servers, sessions, task workspaces, plugin caches) instead of treating your machine as a generic pile of files.

Features

Agent detection
Confidence levels with stated evidence.
Orphaned process discovery
Conservative, multi-signal classification.
Session cleanup
Archive over delete, with active-session protection.
MCP server health
Duplicate detection & static checks.
Credential hygiene
Secret scanning, values never printed.
Health score
Deterministic 0–100, every point explained.
Safe cleanup
Risk-labeled actions, dry-run, backup & undo.
Doctor
Deep, per-agent diagnostics.

Supported agents

AgentStatus
OpenAI CodexSupported
Claude CodeSupported
Gemini CLIExperimental

Install

pipx install agentjanitor
# or
uv tool install agentjanitor

Never telemetry, never cloud

No telemetry, no cloud account, no uploads, no AI API required. Runs entirely locally.