Skip to content

PACT

PACT is a semantic compression format that beats ZIP by 40% on codebases and replaces Claude Code's /compact with an 18.4x lossless compaction engine.

Core trick

Compresses project files into one brotli solid stream and extracts structure without API calls for context compaction.

Tags

Description

PACT is a semantic compression format that beats ZIP by 40% on codebases and replaces Claude Code's /compact with an 18.4x lossless compaction engine. Three things in one tool: 1. File compression — brotli solid archive that concatenates all files into one compression stream. Cross-file pattern deduplication that ZIP physically cannot do. 40% smaller on a 79-file real project. Semantic inspection shows every function, import, and class without decompressing. 2. Claude Code compaction plugin — one command (pact install --global) hooks into every session. Heuristic structural extraction at 50% context, zero API calls. 18.4x compression vs /compact's 4.0x, with 92% information retention vs 68%. The AI keeps structured state instead of lossy prose summaries. 3. Native OS integration — right-click any file on macOS, Windows, or Linux to pack/unpack. Native Swift progress UI on macOS. One command setup: npx pact-cc setup. BARUTU SNAKE: PACT compressed the Claude Code session that built PACT. 179 turns, 1.6M tokens → 46K tokens, 34.3x lossless. Reproducible: node benchmarks/run.mjs --tasks 012-barutu-snake. 150 tests passing. Built in 5 days. pact.zip
aidenhecker/PACT★ 10 forksTypeScriptNOASSERTIONCreated Apr 19, 2026 · last push Apr 27, 2026

README excerpt

# PACT

**Semantic compression that beats ZIP by 40% on codebases.**

[**pact.zip**](https://pact.zip) · [Demo video](./PACT_demo.mp4) · [Explainer](./pact-explainer.mp4)

https://github.com/hmatrades/PACT/raw/main/PACT_demo.mp4

---

```bash
npx pact-cc setup     # one command. right-click + Claude Code compaction. done.
```

## Quick start

```bash
pact pack myproject/          # 88 KB → 21 KB (4.2x)
pact inspect myproject.pact   # see functions, imports, types — no decompression
pact unpack myproject.pact    # restores myproject (1)/
```

## Install

```bash
npx pact-cc setup
```

One command. Detects your OS. Installs everything:

- **macOS** — Finder Quick Actions (right-click → Pack with PACT) + native Swift progress UI
- **Windows** — right-click context menu via registry
- **Linux** — Nautilus, Dolphin, Nemo, Thunar scripts
- **All platforms** — Claude Code auto-compaction at 50% context

## Why not ZIP?

ZIP compresses each file in isolation using 1993-era deflate. PACT:

- **Solid brotli archive** — all files compressed as one stream. Cross-file patterns compound the ratio.
- **Semantic inspection** — see functions, classes, imports without decompressing.
- **40% smaller** than ZIP on real codebases.

```
ZIP:   362 KB
PACT:  221 KB — 40% smaller (79 files, measured)
```

## Claude Code compaction

```bash
pact install --global     # auto-compresses every session at 50% context
```

| | PACT | /compact |
|---|---:|---:|
| Compression | **18.4x** | 4.0x |
| Retention

Team