Feature: Built-in session/environment management TUI (or: cc-janitor as reference)
Problem
After a few weeks of daily Claude Code usage, the local environment accumulates cruft:
- Sessions: hundreds of session files in
~/.claude/, no way to browse/filter/prune except manualls+rm - Permissions:
settings.jsonallowlist grows organically, no overview of what's allowed and why - Hooks: configured in JSON, no validation, no way to test a hook without triggering the real event
- Context:
CLAUDE.md+ memory files spread across projects, no single view of what Claude "knows" - MCP servers:
claude mcp listshows status but no management (restart, reconfigure, health history)
Power users (5+ sessions/day, multiple projects, hooks, custom MCP servers) spend non-trivial time on environment hygiene instead of building.
What I built (working, MIT-licensed)
cc-janitor — a CLI/TUI for managing the Claude Code environment.
Two ways to use it:
1. Standalone TUI (separate terminal):
pip install cc-janitor
cc-janitor
2. From inside a running Claude Code session (the main use case):
> clean up my old sessions
> show me what permissions I have
> which hooks are configured and are they working?
> how much disk are my claude sessions using?
Claude Code sees cc-janitor as an installed CLI tool — it can invoke cc-janitor --json sessions list or read its output directly. No context switching, no second terminal. You describe what you want in natural language, Claude runs the right cc-janitor command, interprets the output, and acts on it.
This means Claude manages its own environment — it can audit its own permissions, prune its own stale sessions, check its own hooks. The operator just says what they want.
What cc-janitor covers:
- Sessions: browse all sessions, filter by project/date, see token counts, prune old ones
- Permissions: visualize the allowlist, add/remove rules, see which rules are project-level vs global
- Hooks: list all configured hooks, see last execution status, dry-run test
- Context: unified view of CLAUDE.md + memory files across all projects
- Schedule: view and manage
/scheduleroutines
Read-heavy by design — most operations are non-destructive (view, filter, export). Destructive ops (prune, delete) require confirmation.
Why this could be built-in
Claude Code already has /config for simple settings. But there's no way to:
- See what you have — how many sessions, how much disk, which projects have stale memory
- Clean up safely — "delete sessions older than 30 days except ones with commits" is a common need with no safe path today
- Audit permissions — "why is
Bash(*)in my global allowlist?" requires reading raw JSON - Debug hooks — "my PostToolUse hook isn't firing" requires manual
echodebugging
A /manage or /dashboard built-in command could cover the 80% case. cc-janitor covers the 100% case as an external tool.
Links
- Repo (MIT): https://github.com/CreatmanCEO/cc-janitor
- 113 tests, Textual TUI, works on macOS/Linux/Windows
Environment
- Claude Code on Windows 11
- Max plan (5x)
- Daily usage across 30+ projects
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗