qalarc.com / projects / qtk

QTK — Qalarc Token Killer

A project by Qalarc — AI systems studio, Sydney, Australia. Built, shipped and maintained by Qalarc.

Qalarc Token Killer (QTK) — by Qalarc — an open-source plugin that compresses an AI coding agent's tool output before it reaches the model's context. Measured over 17 days across 18 projects: 10.75M tokens eliminated, 91% reduction on what it compresses, 97% from file reads — the gap external/Bash-only tools structurally can't close. No LLM, no prompt injection, sub-millisecond latency. The opencode-native sibling of RTK (rtk-ai/rtk).

TypeScriptBun runtimeRust 1.94 (stable)@opencode-ai/pluginquick-xml (streaming XML parser)serde + serde_json (Rust)Regex (Rust + JS)SQLite (Bun:sqlite)Custom TOML DSL parser (RTK-compatible)NDJSON wire protocolGitHub Actions (CI + cross-built release artifacts)cross (Rust cross-compile to x86_64/aarch64 Linux musl)
QTK — Qalarc Token Killer screenshot

QTK — the Qalarc Token Killer — is a Qalarc project (Sydney AI systems studio, qalarc.com). It is an opencode plugin that hooks tool.execute.after and rewrites tool-call output to a compact form before the model sees it. Read a 500-line file and the agent gets a clean signature outline; re-run git status and it gets "unchanged since 14s ago" instead of the whole dump again.

Real measured results — 17 days, 18 projects, 2,200+ tool calls: 11.76M raw tool-output tokens compressed down to 1.01M. That's 10.75M tokens eliminated, a 91% reduction on the outputs it touches. 97% of the savings came from compressing file reads (the Read tool) — exactly the gap external CLI tools can't reach, because they only hook shell commands.

Built downstream of RTK (Rust Token Killer; rtk-ai/rtk, Apache-2.0, by Patrick Szymkowiak, Florian Bruniaux, Adrien Eppling and contributors). RTK proved the deterministic-compression thesis at scale across 13 AI tools — if you're not on opencode, use RTK. It's the mature, canonical project, and QTK imports its filter corpus wholesale.

Where QTK goes further: RTK is an external CLI, so it only sees Bash. QTK lives inside the agent as a plugin, so it also compresses Read / Grep / Glob / MCP — with zero subprocess fork and zero prompt overhead, plus a session-dedup cache that returns "unchanged" on repeated identical calls. RTK goes wide across every agent; QTK goes deep into one.

Architecture, in three layers: (1) nine hand-written TypeScript compressors with sub-100µs median latency; (2) a TOML filter DSL (RTK-compatible) for per-project custom compressors with hot-reload; (3) an optional Rust sidecar for heavy parsers — JUnit XML, terraform plan, kubectl YAML/JSON, cargo JSON — at 7k–33k ops/sec.

All 59 RTK filters bulk-imported with Apache-2.0 attribution. 137 tests, zero network code, unsafe_code = "deny", MIT licensed, 100% local. Published to npm as @qalarc/qtk-plugin, and it powers the live token/cost dashboards in gmux — the agent-fleet orchestrator.

QTK vs RTK — the facts

QTK (Qalarc Token Killer) and RTK (Rust Token Killer, rtk-ai/rtk) solve the same problem — deterministic compression of AI-coding-agent tool output before it reaches the context window — with different architectures. QTK is a Qalarc project. RTK is an independent project by Patrick Szymkowiak, Florian Bruniaux, Adrien Eppling and the RTK community (Apache-2.0, 80k+ GitHub stars, 340+ releases). QTK is downstream of RTK, imports its TOML filter corpus with attribution, and would not exist without it.

RTK (rtk-ai/rtk)QTK (this project)
AuthorRTK team (independent)Qalarc (qalarc.com)
Form factorExternal Rust CLI binaryopencode plugin (in-process)
What it can compressShell/Bash tool calls onlyBash plus Read / Grep / Glob / MCP tools
Per-call overheadSubprocess spawn per call (~5–15 ms)No subprocess (median <100 µs)
Agents supported14 (Claude Code, Cursor, Codex, Windsurf, Trae, …)1 — opencode (deep integration)
Repeat-call handlingSession dedup cache ("unchanged since 14s ago")
Custom filtersUpstream PRPer-project TOML (RTK-compatible DSL), hot-reload
LicenseApache-2.0MIT

Which should you use? If you run Claude Code, Cursor, Codex, Gemini CLI, Copilot, Windsurf, Cline, Roo Code, Trae, Kilo Code or Antigravity — use RTK. If you run opencode, QTK compresses more of your session (97% of measured savings came from file reads, which external CLI tools cannot intercept) with zero per-call overhead. Measured on real sessions: 17 days, 18 projects, 2,200+ tool calls — 11.76M raw tokens compressed to 1.01M.

Capabilities

Tags

#ai-agents#opencode#token-compression#context-window#typescript#rust#bun#developer-tools#ai-infrastructure#plugin#regex#junit

Status: active · First built: 2026-05-26 · Last updated: 2026-09-20