Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Run automatically on Claude Code events. Claude doesn't decide.
No risk signals detected
Nothing flagged in this plugin's hooks, MCP servers or commands. Other components are not analyzed.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
tools, compact, deduplication, transcript, context, tokens, optimization
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Automatically remove duplicate file reads, script outputs, and grep results from Claude Code session transcripts. Uses deterministic deduplication (not LLM-based) to reduce token waste and lower hallucination risk when resuming sessions.
During typical Claude Code sessions, you naturally read the same files multiple times:
Each read creates a session transcript entry. When you /resume, Claude reconstructs the entire conversation from the transcript—expensive reconstruction that includes all those duplicate reads. The plugin removes exact duplicates while keeping intervening messages intact, resulting in a smaller transcript that costs fewer tokens to reconstruct on resume.
Example:
Session 1: Read config.json (57 bytes)
[Edit config.json]
Read config.json again (57 bytes, same content)
[Chat with Claude]
Read config.json once more (57 bytes, same content)
Plugin removes: 2 duplicate reads = 114 bytes (~28 tokens)
Result: Next /resume pays ~28 fewer tokens to reconstruct
The plugin uses deterministic content matching (comparing file hashes), never making LLM-based decisions. It's safe, reversible, and preserves all context except exact content duplicates.
The plugin intelligently removes three types of duplicate operations:
Identical file content across multiple Read operations is deduplicated. The latest read is always kept (represents current state).
Read 1: config.json → {"debug": false}
[... edits and messages ...]
Read 2: config.json → {"debug": false} (DUPLICATE - marked)
[... more work ...]
Read 3: config.json → {"debug": true} (DIFFERENT - kept)
Identical bash script execution outputs are deduplicated (python, npm, node, dotnet, ruby, java, go, and bash-wrapped variants).
Run 1: npm test → "PASS: 42 tests"
Run 2: npm test → "PASS: 42 tests" (DUPLICATE - marked)
Run 3: npm test → "FAIL: 1 test" (DIFFERENT - kept)
When grep output appears before a later file read with no edits touching the grep-matched lines, the grep is safely deduplicated.
When you edit a file and then grep it, the plugin checks if the edit actually touched the grep-matched lines. Only exact line overlaps prevent dedup—edits to different lines don't block deduplication.
Most beneficial for:
/resume workflows - each resume costs fewer tokensStill helps with:
Requirements: Python 3.X (developed with 3.13)
The plugin automatically registers and runs on session end (cleans transcript) and pre-prompt (validates staleness). No configuration required—works with defaults.
The plugin is configurable via environment variables in ~/.claude/settings.json. All settings are optional; defaults are balanced for typical workflows.
Add to your ~/.claude/settings.json to customize deduplication aggressiveness:
{
"env": {
"SMART_COMPACT_DEDUP_MIN_BYTES": "1",
"SMART_COMPACT_MULTILINE_CONTEXT_LINES": "1",
"SMART_COMPACT_SINGLELINE_CONTEXT_CHARS": "10"
}
}
SMART_COMPACT_DEDUP_MIN_BYTES - Minimum bytes to replace with marker (default: 1)
1: Replace all duplicates (maximum compression)100: Only replace if > 100 bytes1000: Only replace large blocksSMART_COMPACT_MULTILINE_CONTEXT_LINES - Context lines around changes in multiline files (default: 1)
0: Only keep changed lines (most aggressive)1: ±1 line context (balanced, default)3: ±3 line context (preserves more surrounding code)SMART_COMPACT_SINGLELINE_CONTEXT_CHARS - Context characters around changes in single-line files (default: 10)
0: Only keep changed chars (most aggressive)10: ±10 char context (balanced, default)20: ±20 char context (preserves more structure)Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub thoeltig/claude-code-toolkit --plugin smart-compactPlugins from other owners that cover similar ground