headroom
/headroom
SmartCrusher + CCR context compression — crunch large JSON arrays, tool outputs, and search results to save tokens. Use when context is bloated or approaching token limits.
- Author
- momori777 ↗
- Repository
- artemis ↗
- Licence
- Apache-2.0
- Last repository change
- 25.10.2026
Assessment and security
- Files in this package
- 4
- Scripts
- 1
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
- 1 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: __init__.py
What it does and when to use it
SmartCrusher + CCR context compression — crunch large JSON arrays, tool outputs, and search results to save tokens. Use when context is bloated or approaching token limits.
Original author description
SmartCrusher + CCR context compression — crunch large JSON arrays, tool outputs, and search results to save tokens. Use when context is bloated or approaching token limits.
How it works
- When to Use
- Quick Start
- SmartCrusher — 5-Dimensional Scoring
- CCR Store — Compress-Cache-Retrieve
- Token Estimation
- Integration Notes
SKILL.md preview
---
name: headroom
description: SmartCrusher + CCR context compression — crunch large JSON arrays, tool outputs, and search results to save tokens. Use when context is bloated or approaching token limits.
license: MIT
homepage: https://github.com/chopratejas/headroom
---
# Headroom — Context Compression Layer
SmartCrusher + CCR (Compress-Cache-Retrieve) for token-saving context compression.
Portable Python module — no external dependencies beyond stdlib.
## When to Use
- Large tool output (grep results, JSON arrays, file listings) approaching context limit
- Before sending a long context to a model with token cap
- Need to preserve essential items while dropping noise
## Quick Start
```python
from skills.headroom import SmartCrusher, CCRStore
# Compress a JSON array (keep most important items)
crusher = SmartCrusher()
result = crusher.crush(large_json, query="relevant keywords")
# result.compressed → compressed JSON string
# result.items_kept / items_total → retention ratio
# result.compression_ratio → e.g. 0.3 means 70% tokens saved
```
## SmartCrusher — 5-Dimensional Scoring
Keeps items by:
1. **First/Last items** — pagination context + latest data (30% head + 15% tail)
2. **Error items** — 100% preserved
3. **Statistical outliers** — > 2 std from mean
4. **Query-relevant** — BM25 match against user query
5. **Change points** — significant transitions in data
Config overrides:
```python
crusher = SmartCrusher(config={
"max_items_after_crush": 15,
"first_fraction": 0.3,
"variance_threshold": 2.0,
})
```
## CCR Store — Compress-Cache-Retrieve
```python
store = CCRStore(max_entries=1000, ttl_seconds=3600)
# Cache original when crushing
store.put(hash_key, original_text)
# Retrieve if LLM needs more detail
full_text = store.get(hash_key)
```
## Token Estimation
```python
from skills.headroom import estimate_tokens
tokens = estimate_tokens("some text — CJK-aware counting")
```
## Integration Notes
- This module is already imported by `skills/shared/context_trimming.py` (SmartCrusher layer)
- CCR background worker in `skills/sakura/app/agent/memory_curator.py` writes to Qdrant
- For roleplay context trimming: the context_trimming module wraps SmartCrusher with 24msg/40K char cap
Files in this package (4)
- PROXY.md 3 KB
- README.md 4 KB
- SKILL.md 2 KB
- __init__.py 22 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · momori777/artemis | 100 | Apache-2.0 |
| TerminalSkills/skills | 100 | Apache-2.0 |
| tuan2304/my-company | 100 | MIT |
| udaysharmadev/Skills | 100 | MIT |
| akillness/jeo-skills | 95 | MIT |
| roman-ryzenadvanced/headroom-skill | 95 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version 06b5412a80cf (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90ccr-run
Use when the user asks to run a task on a specific model, compare model outputs, or says 'run this on GPT/Gemini/Sonnet'. Routes tasks to any model via claude-code-router. Usage: /ccr-run [model] <task> - 100honey-ccr
Compress-Cache-Retrieve for huge, repetitive array tool output (logs, scan results, time series, event streams) before it enters context. Keeps an informative sample — endpoints, anomalies/change-points, head/tail — drops the redundant rest to a local cache, and leaves a… - 90supercompress
Always-on context compression for coding agents. Use whenever tool output, file reads, logs, diffs, search results, or pasted docs get large (~2K+ tokens): compress them with compress_context, never the user's request. Also check rate-limit runway before large work. - 100supercompress
Always-on context compression for coding agents. Use whenever tool output, file reads, logs, diffs, search results, or pasted docs get large (~2K+ tokens): compress them with compress_context, never the user's request. Also check rate-limit runway before large work. - 100kmg-session-wrap
Prompt for session summary when user indicates they are stopping work or approaching context limits - 100cc-context-budgeting
Manage Claude Code's context window — token arithmetic, /compact strategy, anchor preservation, progressive loading, session analytics. Use this skill whenever a session gets long, context approaches limits, after /compact, when deciding what to load into CLAUDE.md vs leave in…