perf: global token compression optimizations, pnpm workspace routing, and diff performance#2042
Open
nickdesi wants to merge 14 commits into
Open
perf: global token compression optimizations, pnpm workspace routing, and diff performance#2042nickdesi wants to merge 14 commits into
nickdesi wants to merge 14 commits into
Conversation
- compact short git status output with grouped sections - reduce git diff hunk cap and add stronger token-savings coverage - apply default read truncation for large content Signed-off-by: nickdesi <nicolas.desimone@gmail.com>
- simplify copilot guidance to rtk-first usage - route copilot hook via 'rtk hook copilot' - add helper script to install copilot hooks across projects Signed-off-by: nickdesi <nicolas.desimone@gmail.com>
- hook_check.rs: split use into cfg(test)/non-test for 5 constants only used in test helper other_integration_installed() - constants.rs: add #[allow(dead_code)] on OPENCODE_PLUGIN_PATH, CURSOR_DIR, CODEX_DIR, GEMINI_DIR (pub constants for future use) - aws_cmd.rs: add #[allow(dead_code)] on run_sts_identity - next_cmd.rs, npm_cmd.rs, tsc_cmd.rs: remove redundant closures - rake_cmd.rs: map_or(false, ...) -> is_some_and(...) - registry.rs: replace manual prefix strip with strip_prefix() - main.rs: cast fn item through fn pointer before sighandler_t cast Pipeline: fmt OK, clippy -D warnings OK, 1354 tests passed
…removal, clean hook check imports
# Conflicts: # src/cmds/git/git.rs # src/cmds/system/deps.rs # src/core/utils.rs # src/hooks/init.rs
…al path from hook config
- git status -s/--short now uses compact (porcelain -b) path instead of inflationary grouping, fixing 0% savings on small working trees - grep: skip summary header for <=5 results to avoid overhead cancelling gains - git log --oneline: reduce default from -50 to -20 when no explicit -N
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Global token compression optimizations, pnpm workspace routing, and diff performance improvements. 100% backward-compatible, all 1,918 tests pass, zero-async runtime, sub-10ms startup.
Token Savings: Raw vs Standard RTK vs Forked RTK
Overall: 1,037,115 → 21,923 tokens (−97.8%) across 59 benchmark scenarios.
New Features (Fork vs Standard RTK)
pnpm typecheck --filter)tsclocallygrep -rn 'fn ' src/)L{n1},{n2}... ({count}x)formatfind . -type f)MAX_FILES=5,MAX_DIRS=10capsMAX_CHANGES_PER_FILE=10Baseline Filters (Same as Standard RTK)
git statuscat src/main.rscargo testFull Benchmark (May 22, 2026)
✅ 40 Good (≥60%) ·⚠️ 16 Warn (<60% on tiny outputs) · 🔴 3 Neg (harmless on micro-outputs) · ❌ 0 Fail
All 59 results
ls -lals -la src/ls -l src/ls -lh src/ls src/ -lls -als src/ scripts/cat src/main.rscat src/main.rs -l minimalcat src/main.rs -l aggressivecat -n src/main.rsfind . -type ffind '*.rs'find * --max 10find * --max 100git statusgit log -10git log -5git diff HEAD~1git show HEAD --statgrep -rn 'fn ' src/grep -rn 'struct ' src/grep 'fn ' src/ -l 40grep -ron 'fn ' src/ -cjsonjson -d 2depsenvenv -f PATHenv --show-allerr cargo buildtest cargo testlogsummary cargo --helpsummary rustc --helpcargo buildcargo testcargo clippycargo checksmart src/main.rswccurl jsoncurl textnpm listdocker psdocker imagesruff checkpytest -vmypyrake -TWhat Changed
pnpm typecheck --filter <pkg>resolves workspace dir via sync DFS (depth ≤ 4), runstscin-place. Skipsnode_modules,target,.git,dist,build.grep, capped directory/file listings forfind.[false; 128]Jaccard for ASCII lines (no heap).MAX_CHANGES_PER_FILE = 10throttle → 34.3% CPU speedup on large diffs.rtk hook autoauto-detects agent format (Claude Code, VS Code Copilot, Gemini CLI, Cursor) from stdin JSON.copilot_hook_json()usingcurrent_exe()instead of hardcoded path. Updated.github/hooks/rtk-rewrite.jsonto usertk hook auto.Quality Gate
cargo fmt --all --check— cleancargo clippy --all-targets -- -D warnings— 0 warningscargo test— 1,918 passed, 0 failedunwrap()in production, no async runtime,lazy_static!for all regexes