Loading repository data…
Loading repository data…
MikkoParkkola / repository
Lossless, on-device token-cost reduction for Claude Code and LLM coding agents. Free plugin: compresses tool-result output, dedups context, compacts the system prompt — stacks on Anthropic prompt caching. Rust hot path, Python fallback, fail-open. PolyForm Noncommercial.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Glyphdown is a Claude Code plugin that lowers token cost across a session without changing what the agent can see. It compacts tool-result output, removes repeated content, and steers compaction toward a dense form — all lossless by meaning, fail-open (any error passes the original through untouched), and fast (a prebuilt native binary on the hot path, Python as the portable fallback).
It is dogfooded in production daily — the author runs it on their own Claude Code traffic — and only recently open-sourced. Lossless-by-meaning and fail-open are not aspirations; they are how it has had to behave to stay on every session.
It is free for noncommercial use (PolyForm Noncommercial 1.0.0); commercial use needs a paid license — see COMMERCIAL.md.
Your agent's tool output is mostly noise — ANSI codes, repeated reads, machine chatter, verbose compaction summaries. Glyphdown strips it losslessly, on-device, before it bills — and stacks on top of Anthropic's prompt cache.
| Measured | Reduction | On |
|---|---|---|
| Tool-heavy session corpus (52 real fixtures) | −31.7% | total tokens 85,405 → 58,347 (chars/4 proxy) |
Large Bash dumps | −71.1% | the noisiest payloads |
| Instruction prose in the GLYPHDOWN-L1 dialect | −44.6% | every cached system-prompt call (Claude Opus tokens) |
| Network calls · API keys · data leaving your machine | 0 | 100% local, fail-open |
Char reduction is general; exact token % is model-specific — see General vs model-specific savings. Figures are measured, not asserted; the codec is fully open (glyphdown-core/) so the lossless behavior is verifiable, and the project does not publish numbers it has not measured.
Glyphdown hooks the request lifecycle at six points; every one fails open ( on any error — it can never block your input):
{"continue": true}flowchart LR
U([Your prompt]) --> UPS[UserPromptSubmit<br/>mode detector]
UPS --> PRE[PreToolUse<br/>history dedup]
PRE --> TOOL[(Tool runs)]
TOOL --> POST[PostToolUse<br/>codec + session dedup]
POST --> Q{compaction?}
Q -- yes --> PC[PreCompact<br/>dense-form mandate]
Q -- no --> R([Reply — never compressed])
PC --> R
It does not fight Anthropic's cache — it works on a different token bucket. Native caching discounts what is already cached; Glyphdown shrinks the turn-to-turn traffic that changes every call and therefore never caches, plus the dense form of what does get cached. The two stack:
flowchart TB
subgraph B[What you are billed per call]
P[Stable prefix<br/>system prompt + tools]
T[Turn-to-turn traffic<br/>tool results, history, compaction]
end
P -->|Anthropic cache: up to −90%| C[cheap]
P -->|Glyphdown dialect: −44.6% of what caches| C
T -->|Glyphdown codec: −31.7% corpus| S[shrunk every call]
C --> L([Lower total])
S --> L
The hot path is a prebuilt native binary; Python is the portable fallback:
flowchart LR
H[PostToolUse hook] --> Qb{native binary<br/>available?}
Qb -- yes --> Rb[Rust codec ~5 ms]
Qb -- "no / GLYPHDOWN_RUST=0" --> Py[Python codec ~170 ms]
Rb --> O([compacted output<br/>identical, fail-open])
Py --> O
Glyphdown is named for its CoS — the symbolic notation it started as. GLYPHDOWN-L1
is a lossless prose↔dense transcoder: it rewrites verbose, repetitive
instruction-style prose (system prompts, CLAUDE.md, skill and agent files) into a
compact symbolic dialect the same model decodes natively, then expands it back
byte-for-byte.
expand(compress(x)) == x # byte-identical for dialect content;
# unrecognized text passes through untouched
Why it matters: the system prompt ships on every request, and dense instructions
cost far fewer tokens while the model reads them just as well — so this is the only
always-on, every-call saving. Measured −44.6% token reduction on dialect content
(opus-dialect-validate-2026-05-31). It is the language behind the PreCompact
dense-form mandate and the compress-config command — and it is where the whole
project began. Every other mechanism (tool-result codec, dedup, the state-aware
gate) stacks on top of it.
Model-specific dialects. Tokenizers differ per model, so the dialect is a data
file the binary loads at runtime (GLYPHDOWN_DIALECT) — tune or ship a dialect for
your model with no rebuild (lossless self-check on load). glyphdown-core dialect-export dumps the default to edit; glyphdown-core compress / expand run it
directly; compress-config applies it to your config files (dry-run + backup + lossless gate).
claude plugin marketplace add MikkoParkkola/claude-marketplace
claude plugin install glyphdown
glyphdown-stats — it reads the append-only audit
log and prints per-tool savings (so the effect is measured, not asserted).glyphdown-set-level if you want more or less.echo "<dense prose>" | glyphdown-core compress | glyphdown-core expand round-trips byte-for-byte.Nothing leaves your machine; if anything errors, the original output passes
through untouched. To pause, set GLYPHDOWN_DISABLE=1.
Token reduction is a crowded, genuinely diverse space. Glyphdown is a lossless, in-process, agent-tool-result compressor that stacks on native caching — it is not trying to be a learned compressor or a hosted proxy. The honest landscape (★ = GitHub stars, a maturity signal, not a quality verdict):
| Approach | Examples | Reversible? | Where it runs | Best at |
|---|---|---|---|---|
| Lossless in-process codec (this) | Glyphdown | yes (by meaning) | your machine, no hop | agent tool-results + dense compaction, stacked on cache |
| Lossless reversible pipeline | claw-compactor (2.2k★) | yes | varies | multi-stage general-text compression |
| Drop-in prompt compression | leanctx (300★+) | varies | library | production-app prompt text |
| Learned / lossy compression | LLMLingua / LLMLingua-2 (6k★) | no (drops tokens) | local model | aggressive prompt-text reduction where some loss is acceptable |
| Tool-call interceptor | Crucible | varies | in-process | nearest architecture to Glyphdown |
| Hosted edge proxy | Edgee, rtk-based | partial | network hop | one layer across multiple agents / clients |
| Output brevity ("caveman") | caveman, eridani-speak | no | varies | shrinking the model's output register |
| Spend visibility (not compression) | claude-usage (1.7k★), ai-token-monitor | n/a | dashboard | seeing cost, not reducing it |
| Task offload | houtini-lm | n/a | local LLM | delegating bounded subtasks off the paid model |
Two honest notes:
Be precise about what is universal and what depends on the model:
opus-dialect-validate-2026-05-31); −31.7% corpus uses a tokenizer-free
chars/4 proxy. Your model's real saving will differ — sometimes higher,
sometimes lower.calibration/ snapshot fits per-model
tokens-per-char so the keep-vs-compact decision matches the actual
tokenizer rather than a fixed 4-char assumption — and it is refreshed as model
tokenizers move (they can change silently on a model update).Glyphdown is a token-cost-reduction system for LLM coding agents. The pieces have distinct roles:
glyphdown-verify) — an MIT tool so savings can be verified
independently, without trusting the provider.The plugin is free and complete on its own; the rest is optional.
See Quickstart above — two commands, then restart
your session. glyphdown-stats shows savings; glyphdown-set-level tunes aggressiveness.
Glyphdown registers six hook points; every one fails open.
| Hook | What it does |
|---|---|
| PostToolUse — codec | Compacts each tool result: ANSI strip, JSON minify, blank-collapse, shape-aware compaction (JSON / YAML / TOML / code / filesystem path-lists), oversize truncation, schema-tag. Runs as the native binary, Python fallback. |
| PostToolUse — session dedup | A repeated Read/Grep/Glob/Monitor result is replaced with a short reference to its earlier occurrence in the session. |
| PreToolUse — history dedup | Collapses duplicate context already carried in earlier turns before a tool runs. |
| PreCompact — summary-form mandate | When Claude Code compacts, Glyphdown injects an instruction to summarize in a dense, structured form. |
| UserPromptSubmit — mode detector + stats | Detects the active aggressiveness level and serves the glyphdown-stats view. |
| SessionStart — skill loader | Loads the Glyphdown mode skill so the agent understands the dense conventions. |
Two guards make this safe:
file:line, error code, identifier, that made the output useful is automatically
reverted. Truncation is the only lossy step, and it is anchor-guarded.The same binary speaks the Model Context Protocol over stdio, so any MCP client (Cursor, Cline, Zed, Continue, claude.ai connectors) can call the codec on demand — the codec is text→text and language-agnostic, so this, not a per-language SDK, is the portable reach surface.
The plugin registers it automatically (mcpServers in plugin.json). To wire it
into another client, point that client's MCP config at the launcher:
{
"mcpServers": {
"glyphdown": { "command": "sh", "args": ["<plugin>/bin/glyphdown-mcp.sh"] }
}
}
Five tools, m