Skip to content
Skills Library
AI & agents · Conversion & formats

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.

Repository
artemis ↗
Licence
Apache-2.0
Last repository change
25.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
1
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What to check before installing
  • 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

  1. When to Use
  2. Quick Start
  3. SmartCrusher — 5-Dimensional Scoring
  4. CCR Store — Compress-Cache-Retrieve
  5. Token Estimation
  6. Integration Notes
Original SKILL.md headings · 68 lines, 257 words
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

RepositoryScoreLicence
This page · momori777/artemis100Apache-2.0
TerminalSkills/skills100Apache-2.0
tuan2304/my-company100MIT
udaysharmadev/Skills100MIT
akillness/jeo-skills95MIT
roman-ryzenadvanced/headroom-skill95Apache-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…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.