Skip to content

TokenCut v0.2.0: Zero-Bloat Context Optimization & MCP Companion

Pre-release
Pre-release

Choose a tag to compare

@00200200 00200200 released this 22 Sep 06:05
· 40 commits to main since this release

TokenCut v0.2.0: Zero-Bloat Context Optimization & MCP Companion

We are excited to announce TokenCut v0.2.0, bringing unified autonomous context optimization, multi-language AST code skeletonization, specialized test-runner compaction, and a native macOS companion to AI coding assistants (Claude Code, Cursor, Codex, Gemini CLI).

🚀 What's New in v0.2.0

1. Autonomous Context Optimizer (tokencut optimize & MCP tokencut_optimize)

  • Multi-stage deterministic prompt optimization:
    • Automatically folds JSON arrays into ultra-compact TOON or markdown tables (saving 60–80%).
    • Compacts unified git diffs (```diff) and masks noisy lockfiles.
    • Slices stack traces and folds runtime noise while preserving root causes.
    • Aligns prompt cache boundaries for Anthropic, OpenAI, and Gemini prompt caching.

2. Multi-Language AST Code Skeletonization

  • Powered by native ast-grep Tree-Sitter bindings:
    • Supports TypeScript (.ts, .tsx), JavaScript (.js, .jsx), Go (.go), Rust (.rs), Java (.java), and C/C++ (.c, .h, .cpp, .hpp).
    • Replaces function, method, and constructor implementation bodies with { ... } atomically while preserving all type signatures, interfaces, struct definitions, generics, and docstrings.
    • Available via tokencut cat --skeleton <file> and tokencut pack --skeleton.

3. Zero-Loss Test Runner Compaction

  • Specialized smart filters for the most popular developer test runners:
    • cargo test: Collapses contiguous runs of passing tests; 85–98% token reduction.
    • go test: Collapses === RUN / --- PASS: pairs into progress counts; retains package summaries.
    • vitest / jest / npm test: Collapses passing checkmarks and suites.
    • pytest: Collapses session progress lines while retaining full summaries.
    • Strict Safety Guarantee: The instant any failure (FAILED, --- FAIL:, ✕, panic:, AssertionError) occurs, all diagnostics, backtraces, and code frames are emitted 100% verbatim.

4. Git Log & Diff Payload Preservation

  • Enhanced stateful parsing for git log -p and git log --stat:
    • Diff bodies are routed to slim_git_diff, trimming unchanged context while preserving changed lines.
    • Commit messages are never mangled by diff context lines.
    • Stat summary blocks are preserved intact.

5. Native macOS Desktop Companion (TokenCut.app)

  • Lightweight, draggable desktop pet and menu-bar HUD built with native SwiftUI.
  • Prepare for Chat: Paste messy terminal logs or transcripts to compare side-by-side and copy the compacted version into web chats or IDEs.
  • Live Allowance Monitors: Track 5-hour rate limit windows for Claude and Codex locally without model calls.

6. Community Share Command & README Badges

  • Run tokencut share or tokencut share --badge to generate Markdown badges for your open source repositories:
    [![TokenCut Context](https://img.shields.io/badge/tokencut-context%20optimized-b3f5cd)](https://github.com/00200200/tokencut)

📦 Installation

# Install with uv (recommended)
uv tool install 'git+https://github.com/00200200/tokencut.git'

# Verify installation (runs locally, zero model calls)
tokencut demo

🔌 Connect Your Agent

# Claude Code
claude mcp add --scope user tokencut -- tokencut mcp --profile coding

# Codex
codex mcp add tokencut -- tokencut mcp --profile coding

🍏 Download Native macOS Companion

Download TokenCut-v0.2.0-macos.zip attached below, unzip, and drag TokenCut.app to your /Applications folder.

What's Changed

  • Use TokenCut-only optimization and fix Claude source diagnostics by @00200200 in #2
  • docs: showcase 3D desktop pet companion in README and add Windsurf MCP integration by @00200200 in #3
  • fix: report invalid MCP configuration and conflicting shell aliases by @00200200 in #4
  • feat: preserve task context across native compaction by @00200200 in #5
  • feat: Native Zero-LSP Code Intelligence, Guarded Symbol Editing, and Animated Desktop Pet HUD by @00200200 in #6
  • feat: in-chat clipboard compactor, AI context packager, and Zero-LSP callers/references by @00200200 in #7
  • feat: in-chat conversation distiller, TOON table compressor, and prompt cache aligner by @00200200 in #8
  • Show TokenCut in a focused README and reduce MCP schema overhead by @00200200 in #9
  • Prepare chat input on macOS and show the real app in README by @00200200 in #10
  • Fix Claude quota reads and show percentage windows in the pet by @00200200 in #11
  • feat: unified autonomous context optimizer (intra-fence compaction, TOON, distill, cache align) by @00200200 in #12
  • feat: multi-language AST code skeletonization and autonomous chat preparation by @00200200 in #15
  • fix(specialized): keep git log -p/--stat payloads out of the commit message and in the output by @kulchankas in #13
  • feat(specialized): collapse passing cargo test records by @kulchankas in #14

New Contributors

Full Changelog: v0.1.0...v0.2.0