claude-code - 💡(How to fix) Fix Feature: Built-in session/environment management TUI (or: cc-janitor as reference)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

pip install cc-janitor
cc-janitor

---

> 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?
RAW_BUFFERClick to expand / collapse

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 manual ls + rm
  • Permissions: settings.json allowlist 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 list shows 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 /schedule routines

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:

  1. See what you have — how many sessions, how much disk, which projects have stale memory
  2. Clean up safely — "delete sessions older than 30 days except ones with commits" is a common need with no safe path today
  3. Audit permissions — "why is Bash(*) in my global allowlist?" requires reading raw JSON
  4. Debug hooks — "my PostToolUse hook isn't firing" requires manual echo debugging

A /manage or /dashboard built-in command could cover the 80% case. cc-janitor covers the 100% case as an external tool.

Links

Environment

  • Claude Code on Windows 11
  • Max plan (5x)
  • Daily usage across 30+ projects

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Feature: Built-in session/environment management TUI (or: cc-janitor as reference)