Token-level context compression for LLM and agent workflows.
Project description
ContextCrumb
Shake the crumbs out of bloated context.
Before / After - Playground - Install - Quick Start - CLI - Agent + MCP - Model
LLM context gets messy fast: meeting notes, logs, issue threads, docs, transcripts, and tool descriptions all pile up until the useful signal is buried under filler.
ContextCrumb is a token-level compressor for LLM and agent workflows. It looks at text word by word and removes low-signal tokens while keeping the surviving text in the original order.
That is the idea behind the name: the context is still there, but the loose crumbs are shaken off before they reach your model. Less bloat in the prompt. More room for the parts that matter.
No install needed. Paste text, compare the kept context, and see what gets shaken off.
Before / After
ContextCrumb is not a summarizer. It does not rewrite your document into a new explanation. It keeps the source sequence and deletes expendable words.
Original
ContextCrumb is designed for coding agents, MCP tools, and prompt pipelines that need to read a large local text file before sending it to an LLM. It prints only the compressed text by default, so an agent can capture stdout and use it as shortened context.
Compressed
ContextCrumb designed coding agents, MCP tools, prompt pipelines need read large local text file before sending LLM. Prints compressed text default, agent capture stdout use shortened context.
Same order. Less padding. More room for the next file.
Why ContextCrumb?
| Use case | What changes |
|---|---|
| Agent file loading | Read long notes, docs, transcripts, and logs before they hit the context window. |
| Prompt pipelines | Shrink natural-language inputs without hand-writing summarizers. |
| MCP catalogs | Compress verbose tool/resource descriptions while preserving names and schemas. |
| Local workflows | Run ONNX inference by default, with cached model files after first download. |
| Trust-building | Use diff and inspect to see what was kept, deleted, and saved. |
Best fit: docs, notes, transcripts, issue threads, logs, research context, and other natural-language files. For source code where exact syntax matters, prefer raw file loading or use a conservative keep ratio.
Install
pip install contextcrumb
Optional extras:
pip install "contextcrumb[mcp]"
pip install "contextcrumb[serve]"
pip install "contextcrumb[torch]"
ContextCrumb uses the ONNX backend by default, so normal users do not need PyTorch or Transformers installed. Model files are cached locally after the first download.
Quick Start
from contextcrumb import ContextCompressor
compressor = ContextCompressor()
result = compressor.compress(
"ContextCrumb deletes low-value words while preserving useful context.",
)
print(result.text)
print(result.stats)
Read and compress a file:
from contextcrumb import ContextCompressor
compressor = ContextCompressor()
result = compressor.compress_file("notes.txt")
print(result.text)
print(result.stats["token_keep_ratio"])
CLI
The main agent-friendly command is load:
contextcrumb load notes.txt
It prints only compressed text by default, which makes it easy for agents, hooks, shell scripts, and prompt pipelines to capture stdout and move on.
Useful commands:
contextcrumb load notes.txt --json
contextcrumb diff notes.txt
contextcrumb inspect notes.txt
contextcrumb stats
diff marks deleted tokens like this:
kept words [-deleted words-] kept words
Agent + MCP
ContextCrumb includes an optional MCP stdio adapter for agent clients that can run Python tools through uvx.
pip install "contextcrumb[mcp]"
Published-package MCP config:
{
"mcpServers": {
"contextcrumb": {
"command": "uvx",
"args": [
"--from",
"contextcrumb[mcp]",
"contextcrumb-mcp"
]
}
}
}
The MCP server exposes:
compress_text
compress_file
ContextCrumb also ships contextcrumb-shrink, an MCP proxy that compresses verbose catalog descriptions before an agent sees them while forwarding tool names, schemas, calls, results, and resource contents unchanged.
Model
Model weights and a hosted demo are public on Hugging Face:
- Model: ymao20/contextcrumb-32m
- Playground: contextcrumb-32m-demo
Roadmap
Planned for later:
- Public docs for advanced compression modes and service deployment.
- JavaScript or TypeScript client.
- Hosted API experiments.
- npm publishing.
Development
uv pip install --python .\.venv\Scripts\python.exe -e ".[dev,mcp]"
.\.venv\Scripts\python.exe -m pytest
.\.venv\Scripts\python.exe -m build
Release notes are tracked in CHANGELOG.md.
License
Apache-2.0. 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 contextcrumb-0.1.0.tar.gz.
File metadata
- Download URL: contextcrumb-0.1.0.tar.gz
- Upload date:
- Size: 48.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c181e394c3470e5fa6987b687dc51e003e4a1e441e58a1ce64f60566fd4bd597
|
|
| MD5 |
2093ebe28e35bb0f8a6b6c0dd5cb8fbc
|
|
| BLAKE2b-256 |
7015c890836537ffab151392a10c39d821a5b0b5ab83cce19067b6915f8f12dc
|
Provenance
The following attestation bundles were made for contextcrumb-0.1.0.tar.gz:
Publisher:
publish.yml on Yuchen20/Context-Crumb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextcrumb-0.1.0.tar.gz -
Subject digest:
c181e394c3470e5fa6987b687dc51e003e4a1e441e58a1ce64f60566fd4bd597 - Sigstore transparency entry: 1630957596
- Sigstore integration time:
-
Permalink:
Yuchen20/Context-Crumb@a8221eb5d6e4b4b0c210d3e7215d190b180a9da6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Yuchen20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a8221eb5d6e4b4b0c210d3e7215d190b180a9da6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file contextcrumb-0.1.0-py3-none-any.whl.
File metadata
- Download URL: contextcrumb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 40.5 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 |
19910308279c33a0010ac4b659408a25be42a1b7c7451c02d099985a3e7f1919
|
|
| MD5 |
eebd6ccf0bf8e12c7d72a90a5d7c9166
|
|
| BLAKE2b-256 |
a8bd8a5f73e416d14d28a8e6df2ced092328600f9f937400be015d30599d0f40
|
Provenance
The following attestation bundles were made for contextcrumb-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Yuchen20/Context-Crumb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextcrumb-0.1.0-py3-none-any.whl -
Subject digest:
19910308279c33a0010ac4b659408a25be42a1b7c7451c02d099985a3e7f1919 - Sigstore transparency entry: 1630957608
- Sigstore integration time:
-
Permalink:
Yuchen20/Context-Crumb@a8221eb5d6e4b4b0c210d3e7215d190b180a9da6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Yuchen20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a8221eb5d6e4b4b0c210d3e7215d190b180a9da6 -
Trigger Event:
release
-
Statement type: