[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1732":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":12,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":9,"pushedAt":9,"updatedAt":22,"readmeContent":23,"aiSummary":24,"trendingCount":15,"starSnapshotCount":15,"syncStatus":25,"lastSyncTime":26,"discoverSource":27},1732,"ztk","codejunkie99\u002Fztk","codejunkie99","CLI proxy that reduces LLM token consumption by 78%+. Single Zig binary under 260KB. Zero dependencies.",null,"Zig",193,19,168,1,0,3,3.9,false,"master",true,[],"2026-06-12 02:00:32","\u003Cp align=\"center\">\n  \u003Ch1 align=\"center\">⚡ ztk\u003C\u002Fh1>\n  \u003Cp align=\"center\">\u003Cstrong>Stop wasting tokens on raw command output.\u003C\u002Fstrong>\u003C\u002Fp>\n  \u003Cp align=\"center\">\n    \u003Ca href=\"#installation\">Install\u003C\u002Fa> · \u003Ca href=\"#quick-start\">Quick Start\u003C\u002Fa> · \u003Ca href=\"#how-it-works\">How It Works\u003C\u002Fa> · \u003Ca href=\"#supported-commands\">Commands\u003C\u002Fa>\n  \u003C\u002Fp>\n\u003C\u002Fp>\n\n---\n\nEvery time an AI coding agent runs `git diff`, `ls`, or `cargo test`, it dumps thousands of raw tokens into the context window. Most of that is noise. Metadata, whitespace, passing tests, file permissions nobody asked for.\n\n**ztk sits between your AI agent and the shell.** It supports automatic interception for **Claude Code**, **Cursor Agent**, and **Gemini CLI** — each through their native hook mechanisms. You can also run any command manually through `ztk run`.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"assets\u002Fstats-screenshot.svg\" alt=\"ztk stats, 256 commands, 5.8M saved, 90.6% reduction\" width=\"700\">\n\u003C\u002Fp>\n\n## The numbers\n\nFrom a real 256-command development session:\n\n| | Before ztk | After ztk |\n|---|---|---|\n| `git diff HEAD~5` (92KB) | 92,000 tokens | **18,000 tokens** |\n| `ls -la src\u002F` (2KB) | 2,000 tokens | **53 tokens** |\n| `grep -rn \"fn\" src\u002F` (14KB) | 14,000 tokens | **400 tokens** |\n| `cargo test` (all pass) | 397 tokens | **21 tokens** |\n| `find src -name \"*.zig\"` (2KB) | 2,000 tokens | **96 tokens** |\n| `cat main.zig` (5.8KB) | 5,800 tokens | **1,252 tokens** |\n\n**90.6% overall reduction.** 5.8 million tokens saved across 256 commands.\n\n## Installation\n\n```bash\nbrew install codejunkie99\u002Fztk\u002Fztk\n```\n\nOr install a prebuilt binary from the latest release (no Zig required):\n\n```bash\ncase \"$(uname -m)-$(uname -s)\" in\n  arm64-Darwin) asset=ztk-aarch64-macos.tar.gz ;;\n  x86_64-Darwin) asset=ztk-x86_64-macos.tar.gz ;;\n  aarch64-Linux) asset=ztk-aarch64-linux-musl.tar.gz ;;\n  x86_64-Linux) asset=ztk-x86_64-linux-musl.tar.gz ;;\n  *) echo \"unsupported platform\" >&2; exit 1 ;;\nesac\ncurl -fsSL \"https:\u002F\u002Fgithub.com\u002Fcodejunkie99\u002Fztk\u002Freleases\u002Flatest\u002Fdownload\u002F$asset\" | tar -xz\ninstall -m 755 ztk ~\u002F.local\u002Fbin\u002Fztk\n```\n\nYou can also build from source (requires Zig 0.16+):\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fcodejunkie99\u002Fztk\ncd ztk && zig build -Doptimize=ReleaseSmall\ncp zig-out\u002Fbin\u002Fztk ~\u002F.local\u002Fbin\u002F\n```\n\nThe binary is **260KB**. No dependencies. No runtime. Just a single executable.\n\n## Quick Start\n\n```bash\n# Set up all detected agents (Claude Code, Cursor, Gemini CLI)\nztk init -g\n\n# ztk detects which agent config directories exist (.claude\u002F, .cursor\u002F,\n# .gemini\u002F) and installs hooks only for those agents.\n\n# Try it manually:\nztk run git diff HEAD~5\nztk run ls -la src\u002F\nztk run cargo test\nztk run --raw ls -la src\u002F  # exact output when names\u002Fdetails matter\n\n# If Claude Code auto-mode should not prompt on every rewrite:\nztk init -g --skip-permissions\n\n# See your savings:\nztk stats\n\n# Update a local source install:\nztk update\n```\n\nFor Homebrew installs, use `brew upgrade codejunkie99\u002Fztk\u002Fztk`; `ztk update` will not overwrite a Homebrew-managed binary.\n\n## Claude Code Permissions\n\nClaude Code users who run in Auto mode should install the hook with:\n\n```bash\nztk init -g --skip-permissions\n```\n\nThat makes the ztk hook return `allow` for commands it rewrites, so Claude Code does not stop on every `ztk run ...` wrapper. Your `permissions.deny` and `permissions.ask` rules still apply to the rewritten command, so keep explicit rules for dangerous actions:\n\n```json\n{\n  \"permissions\": {\n    \"deny\": [\"Bash(rm -rf*)\", \"Bash(git push --force*)\"],\n    \"ask\": [\"Bash(npm publish*)\"]\n  }\n}\n```\n\nIf you already installed `ztk rewrite` without the flag, remove the old ztk `PreToolUse` hook entry from `.claude\u002Fsettings.json`, then run `ztk init -g --skip-permissions` again.\n\n## How It Works\n\n```\n  Before:                              After:\n\n  AI  ── git diff ──>  shell           AI  ── git diff ──>  ztk  ──>  shell\n  ^                       |            ^                     |           |\n  |    92,000 tokens      |            |    18,000 tokens    |  filter   |\n  +───────────────────────+            +─────────────────────+───────────+\n```\n\nztk runs the command normally, captures the output, compresses it through a six-stage pipeline, and hands back the compressed version. The AI gets the same information in a fraction of the space.\n\nThe hook matcher also recognizes path-qualified executables such as `\u002Fbin\u002Fls`, `\u002Fusr\u002Fbin\u002Ffind`, and `\u002Fopt\u002Fhomebrew\u002Fbin\u002Fgit status`, so agents do not bypass compression by spelling the same tool with an absolute path.\n\nFile-listing filters preserve useful payloads. `ls` keeps filenames for bounded listings, and `find` keeps the first set of matching paths before truncating. ztk should remove command-output noise, not hide the names or paths the agent asked for.\n\n**What gets compressed:**\n- Diff metadata and excess context lines → just the changes\n- Test runner noise → just failures and a summary\n- Directory listings → counts and structure plus useful names, not every permission bit\n- Log files → deduplicated with counts\n- Code files → signatures and declarations, not function bodies\n\n**What never gets touched:**\n- Error messages (you need those)\n- Exit codes (always preserved)\n- Small outputs under 80 bytes (not worth compressing)\n- Data formats like JSON, YAML, TOML (no comment stripping)\n\n## Supported Commands\n\n### Built-in filters across every category\n\n**Git**: status, diff, log, add, commit, push\n**Test runners**: cargo test, cargo nextest, pytest, go test, npm test, npm run test, pnpm test, yarn test, jest, vitest, npx jest, npx vitest, Playwright\n**File ops**: ls, cat, find, grep, rg, wc, head, tail, tree\n**Build tools**: cargo build, cargo check, go build, tsc, zig build\n**Linters**: eslint, ruff, mypy, clippy, golangci-lint\n**Infrastructure**: docker, docker compose, kubectl, curl, env\n**Utilities**: json, gh, gh checks, python tracebacks, log deduplication\n\nPlus **25 regex-based filters** for make, terraform, helm, brew, pip, pnpm, bundle, gradle, mvn, dotnet, wget, prettier, rspec, rubocop, rake, psql, aws, and more.\n\nCommands ztk doesn't recognize pass through untouched. It never makes things worse.\n\n## Session Memory\n\nztk remembers what it showed you.\n\nIf you run `git status` three times and nothing changed, the second and third responses say so in a single line instead of repeating the full output. This is powered by an mmap'd cache with per-command TTLs:\n\n- Fast-changing commands (git status, ls): 30 second cache\n- Medium commands (test runners): 2 minute cache\n- Slow-changing commands (git log): 5 minute cache\n\nMutation commands like `git add` automatically invalidate related caches.\n\n## What Makes It Different\n\n**260KB binary.** Not 5MB, not 50MB. A quarter megabyte. Starts in under 1ms.\n\n**Zero dependencies.** No package manager, no runtime, no shared libraries. Built entirely on Zig's standard library. Cross-compiles to macOS, Linux, and Windows from any platform.\n\n**Thompson NFA regex engine.** The runtime filter system uses a custom regex engine built from scratch. Linear time guaranteed. No catastrophic backtracking, ever. ~400 lines of Zig.\n\n**SIMD text processing.** Line splitting and ANSI escape stripping use `@Vector(16, u8)` for hardware-accelerated processing on both ARM NEON and x86 SSE2.\n\n**270+ tests.** Every filter, every edge case, every state machine. The regex engine alone has 11 tests covering catastrophic backtracking prevention.\n\n## Supported Agents\n\n| Agent | Hook mechanism | Init |\n|---|---|---|\n| **Claude Code** | `PreToolUse` hook in `.claude\u002Fsettings.json` | `ztk init -g` |\n| **Cursor Agent** | `PreToolUse` hook in `.cursor\u002Fhooks.json` | `ztk init -g` |\n| **Gemini CLI** | `BeforeTool` hook in `.gemini\u002Fsettings.json` | `ztk init -g` |\n\n`ztk init` detects which agents are present and installs hooks for all of them. The compression pipeline is agent-agnostic — `ztk run \u003Ccommand>` works as a standalone wrapper regardless of which agent invokes it.\n\n## Development\n\n```bash\nzig build              # Build\nzig build test         # Run unit tests\nzig build run -- stats # Run with args\nzig build cross        # Cross-compile release binaries\n```\n\n## License\n\nMIT\n\n## Acknowledgments\n\nInspired by and thankful to the creators of [RTK](https:\u002F\u002Fgithub.com\u002Frtk-ai\u002Frtk) for pioneering LLM token compression proxies and proving the idea works.\n\nWritten by [Minimax M2.7](https:\u002F\u002Fwww.minimaxi.com).\n","ztk 是一个命令行接口代理工具，旨在通过减少大语言模型（LLM）的 token 消耗来提高效率。其核心功能是自动拦截并优化常见的 shell 命令输出，如 `git diff`、`ls` 和 `cargo test`，从而大幅降低无用信息对 LLM 上下文窗口的影响。根据项目文档显示，使用 ztk 可以将这些命令产生的 token 数量减少 78% 以上。该工具支持 Claude Code、Cursor Agent 和 Gemini CLI 等 AI 编程助手，并且无需任何依赖项，仅需一个小于 260KB 的 Zig 二进制文件即可运行。ztk 特别适合需要频繁与代码库交互的开发者或团队，在提高开发效率的同时显著节省计算资源。",2,"2026-06-11 02:45:41","CREATED_QUERY"]