Supercompact

From The Hei Canon

supercompact is the fleet's conversation-compaction tool for AI coding agents — harder better faster stronger compacting for your AI agent. Public repo.

Takes Claude Code (or Codex CLI) session transcripts (JSONL) and compacts them to fit a token budget while preserving the entities the agent needs to keep working — file paths, error messages, function names, commands, URLs.

Unlike Claude Code's built-in /compact (LLM summarization), supercompact uses score-and-select: every assistant turn is scored by relevance, then greedily selected under budget. Originals are preserved verbatim — nothing paraphrased, nothing lost.

Stack: Python 3.11+. License: MIT. Public.

Why

Built-in /compact:

  • Slow (~30s+ per compaction).
  • Loses exact technical details (file paths paraphrased, errors summarized).
  • Costs API tokens for the summarization call itself.

EITF runs in <1 second on any hardware — no GPU, no API calls — and preserves ~2x more entities than LLM summarization at the same budget.

Methods

Method Scoring Best for
eitf Entity-frequency Inverse Turn Frequency. Extracts structured entities, scores by weighted importance × rarity, BM25-style length normalization. General use, fast, good entity preservation.
setcover EITF + exclusivity bonus (+20% for entities only in 1-2 turns). Slightly better coverage.
dedup Remove exact-duplicate assistant turns. Cheapest pass.
embed Local PyTorch scorer. When you have a GPU.
llama-embed / llama-rerank Score via a llama.cpp server. When you have a running llama.cpp.

Plugins

  • Claude Code: ./plugins/claude-code/install.sh. Both /compact and auto-compact use EITF automatically.
  • Codex CLI: ./plugins/codex-cli/install.sh. codex-compact on-demand or codex-compact-watch daemon.

Sources

See also

  • unleash — the CLI runner supercompact plugs into.