Metadata-Version: 2.4
Name: context-hygiene
Version: 0.2.1
Summary: Context window hygiene analyzer for LLM conversations
Author: AreteDriver
License-Expression: MIT
Project-URL: Homepage, https://github.com/AreteDriver/context-hygiene
Project-URL: Repository, https://github.com/AreteDriver/context-hygiene
Keywords: llm,context-window,hygiene,analyzer,ai
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: typer>=0.9.0
Requires-Dist: rich>=13.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: httpx>=0.27.0
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.40.0; extra == "anthropic"
Provides-Extra: watch
Requires-Dist: watchdog>=4.0.0; extra == "watch"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: ruff>=0.8.0; extra == "dev"
Requires-Dist: respx>=0.22.0; extra == "dev"

# context-hygiene

Context window hygiene analyzer for LLM conversations. Detect staleness, contradictions, deadweight, and compression opportunities in CLAUDE.md files, prompt chains, and agent configs.

## Install

```bash
pip install context-hygiene
```

Optional extras:

```bash
pip install "context-hygiene[anthropic]"  # AI-powered deep analysis
pip install "context-hygiene[watch]"      # Live file monitoring
```

## Quick Start

```bash
# Audit a CLAUDE.md file
ctx-hygiene audit CLAUDE.md

# Score staleness heuristically (no LLM needed)
ctx-hygiene score CLAUDE.md

# Auto-clean deadweight and stale segments
ctx-hygiene clean CLAUDE.md

# View audit history
ctx-hygiene history

# Check license and config
ctx-hygiene status
```

## Free vs Pro

| Feature | Free | Pro ($8/mo) |
|---------|------|-------------|
| `audit` (fast mode) | 10/month | Unlimited |
| `score` | Unlimited | Unlimited |
| `clean` | Unlimited | Unlimited |
| `history` | Unlimited | Unlimited |
| `status` / `stats` | Unlimited | Unlimited |
| `audit --deep` (AI analysis) | - | Yes |
| `watch` (live monitoring) | - | Yes |

**[Subscribe Monthly ($8/mo)](https://buy.stripe.com/bJebJ11OHeBl3925kbgrS08)** | **[Subscribe Yearly ($69/yr)](https://buy.stripe.com/3cI6oH0KDal59xq5kbgrS09)**

After purchase, you'll receive a license key via email. Activate it:

```bash
export CONTEXT_HYGIENE_LICENSE="CTHG-XXXX-XXXX-XXXX"
```

Or save to `~/.config/context-hygiene/license`.

## How It Works

context-hygiene parses structured context files (CLAUDE.md, YAML configs, prompt chains) into segments and runs four analysis passes:

1. **Staleness** — Detects outdated references, stale version numbers, dead links
2. **Contradictions** — Finds conflicting instructions or redundant rules
3. **Deadweight** — Identifies low-signal boilerplate, excessive examples, noise
4. **Compression** — Suggests where content can be condensed without information loss

Fast mode uses heuristics. Deep mode (`--deep`, Pro) uses an LLM for semantic analysis.

## License

MIT
