pi-rtk-optimizer
An extension for the Pi coding agent that rewrites bash commands to their faster rtk equivalents and compacts noisy tool output from commands such as bash, read and grep, to reduce how much context window a session consumes.
pi-rtk-optimizer delegates the decision of how to rewrite a bash command to an installed rtk rewrite command, so rtk stays the single source of truth for which commands it supports, how it parses the shell, and compound-command behavior; it offers both automatic rewriting and a suggestion-only mode, with a runtime guard that lets raw commands run unchanged if the rtk binary is not available.
Its output compaction pipeline runs in stages: stripping ANSI color codes, summarizing test runner output into pass and fail counts, extracting errors and warnings from build output, condensing git status, log and diff output, summarizing linter output, grouping grep or ripgrep matches by file, filtering source code comments and whitespace at configurable levels, and finally applying smart or hard truncation that preserves file boundaries and, for anchored read output, keeps complete edit anchors intact. A tabbed settings interface opened with a slash command lets a user change these settings without restarting, and it tracks compaction savings per tool type.