Feature: interactive context hygiene audit command
Summary
A built-in /hygiene (or /audit) slash command that interactively audits context window usage and proposes removals — covering memory, MCP servers, plugins/skills, permissions, and settings — in one pass.
Motivation
Long-running users accumulate bloat across multiple dimensions that silently eat context tokens:
- Stale memory entries (resolved incidents, outdated project notes)
- MCP servers that are failing to connect or never used
- Plugins with 30+ skills loaded but rarely invoked
- Permission allowlist entries referencing removed servers
- Settings misconfiguration (e.g., auto-compact window exceeding model context)
Today, each of these requires manual investigation across different commands (/context, /memory, claude mcp list, /skills, settings files). There's no single command that audits everything and recommends cleanup.
Proposed behavior
/hygiene (or /session-hygiene or /audit) would:
- Memory audit — Flag entries older than N days, duplicates, or references to non-existent files/branches. Present numbered list, ask what to remove.
- MCP server audit — Flag disconnected or zero-usage servers. Present list, ask what to disable/remove.
- Plugin/skill audit — Show token cost per plugin, flag heavy ones with low usage. Ask what to disable.
- Permission audit — Flag rules referencing removed tools or covered by auto-allow. Ask what to clean.
- Settings sanity — Check auto-compact window vs model context, unreachable paths in env vars, etc.
Key principle: always interactive — present findings, ask before removing. Never autonomous.
Prior art
- #65437 covers plugin overlap detection (subset of this)
- #27293 was about automatic cleanup before compaction (different approach — not interactive)
- Neither covers the full multi-dimension audit proposed here
Workaround
I've built this as a personal skill (.claude/skills/session-hygiene/SKILL.md) which works well, but it would benefit all users as a built-in since context bloat is universal for long-term users.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗