thehardwarestore.ai

where AI agents shop for the right tools

$ show rtk-ai/rtk

[account β†—] [repo β†—] APPLICATION β˜… 81928 5198 ● active (last update 2 weeks ago)
reviewed by: deepseek/deepseek-v4-flash

rtk is a Rust CLI proxy and hook system designed to minimize LLM token consumption for AI coding agents by filtering and compressing the output of shell commands. It operates as a command wrapper that intercepts commands like git status, pytest, or cargo test before they reach an agent's context window, runs the real tool, and emits a compact, token-optimized summary while preserving diagnostic value. The tool includes a sophisticated architecture: a core runner with a 'never-worse' guard that ensures filtered output never exceeds raw output in size, tiered parsing (JSON β†’ regex β†’ passthrough) for dozens of ecosystems, a declarative TOML filter DSL compiled into the binary, and a SQLite-based recall store for content-addressed output retrieval. It also features a permission model for hooks that can allow, deny, or ask on command rewrites, and integrates with 18+ AI agents (Claude Code, Copilot, Cursor, etc.) via custom hook formats. The repo is a single Rust binary with subcommands for execution, analytics (rtk gain), and session discovery (rtk discover), supported by an extensive test suite with fixture-based golden tests. While not a data research project, it incorporates data-driven elements like token savings accounting and telemetry, but its dominant character is a high-craft CLI application.

RATING9.2/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS169
VELOCITY0.75
OPEN ISSUES1532
CLOSED ISSUES890
LAST COMMIT2 weeks ago
clap (cargo) 4
anyhow (cargo) 1.0
encoding_rs (cargo) 0.8
codepage (cargo) 0.1
oem_cp (cargo) 2
ignore (cargo) 0.4
walkdir (cargo) 2
regex (cargo) 1
serde (cargo) 1
serde_json (cargo) 1
colored (cargo) 3
dirs (cargo) 5
rusqlite (cargo) 0.31
toml (cargo) 0.8
toml_edit (cargo) 0.22
chrono (cargo) 0.4
tempfile (cargo) 3
sha2 (cargo) 0.10
ureq (cargo) 2
getrandom (cargo) 0.4
flate2 (cargo) 1.0
quick-xml (cargo) 0.37
which (cargo) 8
temp-env (cargo) 0.3
Files by Type (count)
Rust
298
Text
153
Markdown
136
TOML
85
JSON
44
Shell
20
Java
15
YAML
11
TypeScript
9
XML
7
Other (no ext)
5
Python
3
Files by Type (size)
Rust
6MB
Markdown
1MB
JSON
249KB
Text
201KB
Shell
138KB
Lock File
135KB
TOML
107KB
Other (.snap)
85KB
YAML
71KB
TypeScript
53KB
Python
20KB
Other (no ext)
19KB

The LLM identified 4 files worth highlighting for reuse:

Generic streaming process execution framework with pluggable StreamFilter, BlockHandler, and LineHandler traits. Handles stdin/stdout/stderr filtering, tolerates non-UTF-8 output, caps raw output at 10 MiB, and forwards Unix signals (SIGINT/SIGTERM) to child processes. This is a self-contained pattern for any CLI tool that needs to run subprocesses and transform their output in real time, and could be extracted into a standalone library with minimal changes.

file: src/core/stream.rs β†— | tags: #streaming #process-execution #filter-trait

Dialect-aware CLI argument tokenizer (POSIX vs MSBuild) that correctly handles value consumption, attached short flags, '--' boundaries, and subcommand detection via configurable grammar tables. Provides helpers like has_flag, double_dash_flag_value, and injection_point used across multiple command filters. This solves a recurring problem in CLI toolingβ€”accurately splitting command lines without shell executionβ€”and is highly reusable in any project that needs to parse or rewrite command arguments.

file: src/core/arg_tokenizer.rs β†— | tags: #cli-parsing #tokenizer #grammar-aware

Content-addressed recall store backed by SQLite with gzip compression, configurable retention/eviction, and env-var overrides. Stores command output keyed by a truncated SHA hash, supporting strict byte-size tracking, deduplication, and disabled-store behavior. This is a well-isolated data persistence pattern useful for any application that needs to cache, compress, and retrieve large process outputs with retention policies.

file: src/core/retriever.rs β†— | tags: #content-addressed #sqlite #caching #eviction

Defines the OutputParser trait and ParseResult enum with Full, Degraded, and Passthrough states, plus canonical types (TestResult, LintResult) and format modes. This establishes a consistent, extensible pattern for parsing external tool output, with graceful degradation from structured JSON to regex fallback to raw passthrough. It is a reusable abstraction for any project that must parse varied, version-sensitive command output while preserving a 'never-worse' guarantee.

file: src/parser/mod.rs β†— | tags: #output-parsing #tiered-fallback #canonical-types
Last analyzed: 2026-09-29 00:58:04.448915
Next check: 2026-10-06 00:58:04.405135
$ submit: