Tidy up your Claude Code environment — sessions, permissions, context, hooks, schedule.
Project description
cc-janitor
Tidy up your Claude Code environment — sessions, permissions, context, hooks.
The first unified TUI/CLI that combines session cleanup, permission pruning, CLAUDE.md/memory inspection, hook debugging (Phase 2), and scheduled maintenance (Phase 2) — all the chores no one else automates, in one tool.
Languages: English / Русский (toggle with F2 in TUI, --lang ru in CLI)
Stack
- Language: Python 3.11+
- TUI: Textual (terminal UI framework)
- CLI: Typer
- Token estimation: OpenAI
tiktoken(cl100k_base, ~5% off for Claude) - Tests: pytest + pytest-asyncio + pytest-textual-snapshot
- Distribution: PyPI via
uv tool/pipx
Features (Phase 1 MVP)
Sessions
- List, search, preview Claude Code sessions in
~/.claude/projects/ - Soft-delete to recoverable trash; restore from trash via
cc-janitor trash restore - Inspect compact-summaries and your own indexer markdown summaries
Permissions
- Discover all rules across global / project, settings.json / .local.json, and
~/.claude.jsonapprovedTools - Mark stale rules (no match in last 90 days) by scanning your transcripts
- Dedupe (subsumed/exact) and prune (stale) — with backups before write
Context inspector
- Walk CLAUDE.md hierarchy, list memory files, list enabled skills
- Compute byte/token cost per file + recurring-per-request total
- Show estimated $ at Opus input rate
Install
⚠️ v0.1.x is not yet on PyPI. Install from source until then:
# Recommended — uv tool from source
uv tool install git+https://github.com/CreatmanCEO/cc-janitor
# Or pipx from source
pipx install git+https://github.com/CreatmanCEO/cc-janitor
# From a local clone for development
git clone https://github.com/CreatmanCEO/cc-janitor && cd cc-janitor
uv sync --all-extras
uv run cc-janitor
PyPI publishing arrives once Trusted Publisher is configured on pypi.org. Track via issue #1 once filed.
Quick start
# Launch TUI
cc-janitor
# CLI: list sessions
cc-janitor session list
# Audit your permission rules
cc-janitor perms audit
# Inspect what your context costs you per request
cc-janitor context cost
# Mutating commands require explicit confirmation:
CC_JANITOR_USER_CONFIRMED=1 cc-janitor session prune --older-than 90d
Safety model
cc-janitor never silently destroys data:
CC_JANITOR_USER_CONFIRMED=1gate: every mutating command refuses to run unless this env var is set. Read-only commands (list, show, audit, cost) are always free to call.- Soft-delete: sessions deleted move to
~/.cc-janitor/.trash/<timestamp>/for 30 days. Restore viacc-janitor trash restore <id>. - Backups before write: every settings.json edit creates a timestamped backup in
~/.cc-janitor/backups/<sha-of-path>/. - Audit log: every mutating action appends a JSONL record to
~/.cc-janitor/audit.log(rotates at 10 MB).
Windows users:
cc-janitor install-hookswrites a POSIX shell snippet (test -f,&&). On native Windows without Git Bash / WSL the hook will fail silently. Cross-platform PowerShell support lands in 0.2.0 (Phase 2). Use Git Bash or WSL in the meantime.
Using from inside Claude Code
cc-janitor is designed to be invoked by both you (TUI / CLI) and Claude Code itself (CLI), but only on your explicit request. See docs/CC_USAGE.md for the reference Claude Code reads when deciding whether a subcommand is safe to call.
Roadmap
- Phase 1 (this release): sessions / permissions / context inspector / CLI / TUI / safety primitives
- Phase 2: memory editor, reinject hook, hook debugger with simulation, scheduler (cron / Task Scheduler)
- Phase 3: monorepo nested .claude/ discovery, auto-reinject watcher, stats dashboard, export/import config
Contributing
Issues and PRs welcome. See docs/architecture.md for the codebase tour.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cc_janitor-0.2.0.tar.gz.
File metadata
- Download URL: cc_janitor-0.2.0.tar.gz
- Upload date:
- Size: 184.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba6176f5b5f7e4745a8a2c1cd01b252fb4d2dcc60827b249c71e4ecbd18a7fe9
|
|
| MD5 |
ea4df8a8e83dc7f808001478dce997fc
|
|
| BLAKE2b-256 |
2b888d17a2d045cb34c435f023edba52a6befc9e9fb84aedabee0dba31fd961d
|
Provenance
The following attestation bundles were made for cc_janitor-0.2.0.tar.gz:
Publisher:
release.yml on CreatmanCEO/cc-janitor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cc_janitor-0.2.0.tar.gz -
Subject digest:
ba6176f5b5f7e4745a8a2c1cd01b252fb4d2dcc60827b249c71e4ecbd18a7fe9 - Sigstore transparency entry: 1484851956
- Sigstore integration time:
-
Permalink:
CreatmanCEO/cc-janitor@522c2dab00e1536f746a93d1de192f4c919b4efe -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/CreatmanCEO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@522c2dab00e1536f746a93d1de192f4c919b4efe -
Trigger Event:
push
-
Statement type:
File details
Details for the file cc_janitor-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cc_janitor-0.2.0-py3-none-any.whl
- Upload date:
- Size: 48.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc53778736efa8aefa565e08b3654f37d93d4866ef7263688adce4ecc3df3b56
|
|
| MD5 |
ea8f657ff3cd24dc8b26b4cd8de21937
|
|
| BLAKE2b-256 |
e3a9ec0de9257bac143c21eaebd45a5c7719e2cf37452169d962792ce098d900
|
Provenance
The following attestation bundles were made for cc_janitor-0.2.0-py3-none-any.whl:
Publisher:
release.yml on CreatmanCEO/cc-janitor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cc_janitor-0.2.0-py3-none-any.whl -
Subject digest:
fc53778736efa8aefa565e08b3654f37d93d4866ef7263688adce4ecc3df3b56 - Sigstore transparency entry: 1484851973
- Sigstore integration time:
-
Permalink:
CreatmanCEO/cc-janitor@522c2dab00e1536f746a93d1de192f4c919b4efe -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/CreatmanCEO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@522c2dab00e1536f746a93d1de192f4c919b4efe -
Trigger Event:
push
-
Statement type: