Skip to content

horilla/claudectx-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

claudectx-py

Python wrapper for claudectx — reduce Claude Code token usage by up to 80%.

Install

pip install claudectx-py

This installs the claudectx command into your Python environment's PATH. The wrapper delegates to the underlying npm package, which must be installed separately:

npm install -g claudectx
# or
brew tap Horilla/claudectx && brew install claudectx

Usage

Once both are installed, use claudectx exactly as you would from npm:

claudectx analyze                    # Token breakdown per context component
claudectx optimize --apply           # Auto-fix all token waste
claudectx report                     # 7-day usage analytics
claudectx watch                      # Live token dashboard
claudectx budget "src/**/*.py"       # Estimate cost before a big task
claudectx warmup                     # Pre-warm the Anthropic prompt cache
claudectx drift                      # Find stale CLAUDE.md references
claudectx compress                   # Compress session into MEMORY.md
claudectx teams export               # Export usage for team cost reporting

Why a Python wrapper?

If your team uses Python-based tooling (pyenv, pip, Poetry, uv), this lets you add claudectx as a project dependency in pyproject.toml alongside your other dev tools — no separate npm install step in your CI.

[tool.poetry.dev-dependencies]
claudectx-py = "^1.1.2"

The wrapper is intentionally thin: it locates the claudectx binary on PATH and delegates all arguments to it. No logic is duplicated.

Requirements

  • Python 3.8+
  • Node.js 18+ with claudectx installed globally (npm install -g claudectx)

License

MIT — see claudectx LICENSE

About

Python wrapper for claudectx — install via pip, run Claude Code token optimizer

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages