Contextzip

Contextzip is an open-source command-line optimization harness and utility developed by jee599, built in Rust to manage and compress context usage in terminal coding agents. Forked originally from RTK, the tool targets token inefficiency in developer agent workflows by stripping unnecessary tool history, ANSI decorations, and command execution overhead before it exhausts LLM context windows. Contextzip operates at the CLI level and integrates into agent sessions—specifically optimized for environments like Claude Code. It functions as an orchestration layer and session history compactor, running background hooks or standalone CLI commands to filter terminal noise and streamline conversational context. Rather than acting as a standalone LLM itself, it optimizes token consumption regardless of the backend model driving the coding agent. What differentiates Contextzip is its focus on structural token reduction within session history and terminal output rather than prompt modification alone. By processing JSONL session histories (such as those stored in Claude Code project directories) and generating optimized sidecar contexts, it directly combats context window bloat caused by verbose tool executions and terminal formatting. Contextzip is fully open-source and free to use under its GitHub repository. It compiles into a native binary via Cargo or can be installed via npm and Homebrew formulas.

Tags: cli, coding agent, developer tools, OpenSource, terminal

Visit Contextzip

Key features

  • Session History Compaction — Scans agent session logs (like .jsonl files) to compact tool outputs and reduce token bloat. - Dry-Run Mode — Allows developers to preview context token savings with --dry-run without modifying or generating sidecar files. - Batch Compaction — Optimizes all past project sessions at once using the --all-sessions flag across local cache directories. - ANSI and Noise Filtering — Strips ANSI terminal escape sequences and repetitive terminal decorations to minimize wasted tokens. - Claude Code Native Integration — Provides specialized hooks and workflows designed to sit directly alongside Anthropic's Claude Code CLI. - Rust-Powered Execution — Built as a fast, native binary for minimal overhead during hook execution and log parsing.

Use cases

Use Case: Compacting Claude Code Agent Sessions A developer running prolonged Claude Code coding sessions runs Contextzip to prune repetitive tool execution outputs from local JSONL histories, preventing the agent from quickly exhausting its context window on complex refactoring tasks.

Use Case: Benchmarking Token Savings An engineer evaluating context management runs contextzip compact --dry-run across existing repositories to analyze historical token waste and estimate percentage savings before applying structural compaction.

Use Case: Batch Optimization of Project Contexts A developer maintaining multiple active agent-assisted repositories uses the --all-sessions flag to clean and compress stale session artifacts, freeing disk space and reducing context reload overhead.

Who it is for

Contextzip is intended for developers and teams actively using terminal AI coding agents—particularly Claude Code—who encounter token limits or high costs due to long session histories. It is not suitable for developers seeking a standalone chat UI or those not utilizing terminal-based agent harnesses.

Install guide

Installation Contextzip can be built from source using Cargo or installed via its install script: bash # Build from source git clone https://github.com/jee599/contextzip.git cd contextzip cargo build --release # Or run the install script (if using published release) curl -fsSL https://raw.githubusercontent.com/jee599/contextzip/main/install.sh | bash

First Run Ensure the binary is in your system PATH, and verify the installation: bash contextzip --version No proprietary API key is required for Contextzip itself, as it operates directly on local agent session data and terminal outputs.

Example Session To preview token savings on your current Claude Code project session without modifying files, run: bash # Preview compaction on existing sessions contextzip compact --dry-run # Compact all session histories across projects contextzip compact --all-sessions

Part of CLI Coding Agents

Categories: AI Coding Agents, Code Assistants, Developer Tools

Related CLI agents

  • postmortemthis — postmortemthis is an open-source command-line agent harness and orchestration tool developed by Softeria. It orchestrates specialized CLI coding agents and…
  • claude-cmd — claude-cmd is an open-source command-line interface and workflow harness for Anthropic's Claude, developed by independent open-source developer kiliczsh. The tool…
  • Fireconnect — Fireconnect is an open-source CLI orchestration tool developed by Fireworks AI (fw-ai) designed to route various AI coding agents and…
  • Claude Code Tools — Claude Code Tools (cctools) is an open-source orchestration harness and plugin distribution toolkit developed by Prasad Chalasani (pchalasani). It is…
  • agenttrace — Agenttrace is an open-source agent harness and tracing orchestrator developed by luoyuctl on GitHub. It is designed to capture, monitor,…
  • Agent Deck — Agent Deck is an open-source agent harness and terminal-based fleet orchestrator created by Ashesh Goplani. Implemented in Go, it provides…
  • AI Tools
  • Categories
  • Industries
  • CLI Coding Agents
  • MCP Servers
  • MCP Categories