Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Identify unused Claude Code skills, subagents, and MCP servers and disable them to reduce system-prompt context bloat. Use when the user asks to clean up / slim / 瘦身 their installed skills, subagents, or MCP servers, audit which are unused, or recover context budget.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-06 | ✗→✓ | ▲ Improved | -35% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -4% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -21% | 0% |
| case-11 | ✗→✓ | ▲ Improved | -25% | 0% |
| case-12 | ✗→✓ | ▲ Improved | -24% | 0% |
When the user wants to slim Codex skills or MCP servers, follow the same flow: enumerate → suggest → confirm → disable. The CLI exposes parallel skills and mcp command trees on Codex (subagents are Claude Code-only).
Prefer ${AGENT_CLEANER_CLI} if set. Otherwise locate the newest installed bundle:
bashfind "${CODEX_HOME:-$HOME/.codex}/plugins/cache/local/agent-cleaner" -path '*/lib/agent-cleaner.mjs' -type f 2>/dev/null | sort | tail -1
If that finds nothing, check the current repository path:
bashtest -f plugins/codex/lib/agent-cleaner.mjs && pwd
Always invoke via node <abs-path> and always pass --host=codex.
bashnode "<abs-path>/agent-cleaner.mjs" --host=codex skills suggest --json
The output is a JSON array of suggestions, each with id, name, source, reason (never-used | stale), confidence (high | medium | low), details.
If the user wants to see all skills, use skills list --json.
Show the suggestion list as a compact table with id, reason, and confidence. Never disable without explicit user confirmation.
If the user wants to adjust the staleness threshold, mention --unused-for=60d (or 2w, 3m, 1y) or persist a default in ~/.agent-cleaner/config.json:
json{ "unusedForDays": 60 }
Either pass specific ids:
bashnode "<abs-path>/agent-cleaner.mjs" --host=codex skills disable user:codex:lark-mail plugin:gmail@openai-curated:gmail --yes
Or apply all current suggestions in one shot:
bashnode "<abs-path>/agent-cleaner.mjs" --host=codex skills disable --all-suggested --yes
After disable succeeds, tell the user: "Disabled N skills. Restart Codex or start a new Codex session for the change to take effect."
skills enable <id...> — undo a disable.skills status [--json] — list currently-disabled skills and detect/auto-reapply any that an upstream plugin or skill update may have restored.skills list --json — full inventory with lastUsed and callCount.The same verbs apply with mcp instead of skills. Codex MCP servers live as [mcp_servers.NAME] blocks in ~/.codex/config.toml:
bashnode "<abs-path>/agent-cleaner.mjs" --host=codex mcp suggest --json node "<abs-path>/agent-cleaner.mjs" --host=codex mcp disable mcp:user:codex:linear --yes node "<abs-path>/agent-cleaner.mjs" --host=codex mcp disable --all-suggested --yes
Usage is detected from mcp__<server>__<tool> tool calls in Codex session transcripts under ~/.codex/sessions/.
~/.codex/skills/.system cannot be disabled.mv SKILL.md SKILL.md.agent-cleaner-disabled. MCP disable:the [mcp_servers.NAME] block is spliced out of config.toml and the original lines are stashed in state. enable reverses both.
~/.agent-cleaner/state-codex.json.Other measured skills in the registry, with their headline benchmark lift.