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
.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.contextzip compact --dry-run across existing repositories to analyze historical token waste and estimate percentage savings before applying structural compaction.--all-sessions flag to clean and compress stale session artifacts, freeing disk space and reducing context reload overhead.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.
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 | bashPATH, 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.bash # Preview compaction on existing sessions contextzip compact --dry-run # Compact all session histories across projects contextzip compact --all-sessionsPart of CLI Coding Agents
Categories: AI Coding Agents, Code Assistants, Developer Tools