From 8abb6369cf35b7ea9ecb80a008d0020235eafb74 Mon Sep 17 00:00:00 2001 From: Shane Daniel <135388+simshanith@users.noreply.github.com> Date: Sun, 21 Jun 2026 20:26:10 -0700 Subject: [PATCH 1/2] feat: add rtk to mise baseline + document Claude wiring rtk (token-optimizing Claude Code proxy) now installs fleet-wide via the committed mise baseline instead of machine-local config.toml, so a fresh checkout gets it. Document the one-time `rtk init -g` step in 2026_REFRESH.md; left manual since it writes to ~/.claude/ (unmanaged by chezmoi). --- 2026_REFRESH.md | 15 +++++++++++++++ dot_config/mise/conf.d/fresh.toml | 1 + 2 files changed, 16 insertions(+) diff --git a/2026_REFRESH.md b/2026_REFRESH.md index ecf68fe..b81d8da 100644 --- a/2026_REFRESH.md +++ b/2026_REFRESH.md @@ -61,6 +61,7 @@ Old bash-specific files removed (git history preserved). | ripgrep (rg) | Better grep | | fzf | Fuzzy finder | | git-delta | Better git diff | +| rtk | Token-optimizing CLI proxy for Claude Code (one-time `rtk init -g`, see below) | ### Brewfile Pared Down @@ -114,6 +115,20 @@ cd ~/.dotfiles exec zsh ``` +### Post-install: wire rtk into Claude Code (one-time, per machine) + +`rtk` (the token-optimizing Claude Code proxy) installs fleet-wide via the mise +baseline, but its Claude integration writes to `~/.claude/` — which chezmoi does +not manage — so it needs a single manual step after install: + +```bash +rtk init -g # hook + RTK.md + @RTK.md in ~/.claude/CLAUDE.md + settings.json +rtk init --show # verify: all rows [ok] +``` + +Idempotent — safe to re-run. Skips automation in the dotfiles repo on purpose so +chezmoi never fights rtk over `~/.claude/CLAUDE.md` and `settings.json`. + ## Verification ```bash diff --git a/dot_config/mise/conf.d/fresh.toml b/dot_config/mise/conf.d/fresh.toml index c98374c..73723e9 100644 --- a/dot_config/mise/conf.d/fresh.toml +++ b/dot_config/mise/conf.d/fresh.toml @@ -45,6 +45,7 @@ starship = "latest" # AI coding agents codex = "latest" # openai/codex opencode = "latest" # anomalyco/opencode +rtk = "latest" # aqua:rtk-ai/rtk — token-optimizing CLI proxy for Claude Code. # Dotfiles management — must be in the committed baseline so a fresh machine's # install.sh (mise install -> chezmoi init) can bootstrap. (Previously chezmoi From 27333d05045b015cb33e9ad67b53b85f7c9fe5e1 Mon Sep 17 00:00:00 2001 From: Shane Daniel <135388+simshanith@users.noreply.github.com> Date: Mon, 6 Jul 2026 15:14:56 -0700 Subject: [PATCH 2/2] feat(rtk): chezmoi-manage rtk config with dialed-back hook filters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One shared template (.chezmoitemplates/rtk-config.toml) rendered to ~/.config/rtk/ on linux and ~/Library/Application Support/rtk/ on darwin (rtk ignores XDG there); the unused path is suppressed per-OS in .chezmoiignore. Entries are .tmpl so symlink mode writes real files — sandboxed rtk must read its own config (same lesson as ~/.gitattributes). The config itself dials the hook back to where filtering pays off: - exclude rg/grep/curl/diff: rtk grep backends to BSD grep and swallows its errors with exit 0 (silent empty results); grep was 254/287 of all parse failures; curl saved 2 tokens on 138K input; diff failed to parse 28 of 36 calls and strips hunk context - git restricted to commit/fetch (88%/66% avg savings) via transparent_prefixes: compact filters stripped needed output, e.g. git stash SHAs, forcing follow-up rev-parse calls --- .chezmoiignore | 4 + .chezmoitemplates/rtk-config.toml | 87 +++++++++++++++++++ 2026_REFRESH.md | 8 ++ dot_config/rtk/config.toml.tmpl | 1 + .../rtk/config.toml.tmpl | 1 + 5 files changed, 101 insertions(+) create mode 100644 .chezmoitemplates/rtk-config.toml create mode 100644 dot_config/rtk/config.toml.tmpl create mode 100644 private_Library/private_Application Support/rtk/config.toml.tmpl diff --git a/.chezmoiignore b/.chezmoiignore index c168d5e..21e4dcc 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -32,3 +32,7 @@ iterm2-preferences # (.chezmoiignore is itself templated; stat is re-evaluated every apply, so this # self-corrects after `brew bundle` installs the app, or if it's removed). {{ if or (ne .chezmoi.os "darwin") (not (stat "/Applications/Sublime Text.app")) }}bin/subl{{ end }} + +# rtk config: one shared template, two OS-specific targets. rtk hard-wires +# ~/Library/Application Support on darwin (ignores XDG) and ~/.config elsewhere. +{{ if ne .chezmoi.os "darwin" }}Library{{ else }}.config/rtk{{ end }} diff --git a/.chezmoitemplates/rtk-config.toml b/.chezmoitemplates/rtk-config.toml new file mode 100644 index 0000000..03e46d4 --- /dev/null +++ b/.chezmoitemplates/rtk-config.toml @@ -0,0 +1,87 @@ +[tracking] +enabled = true +history_days = 90 + +[display] +colors = true +emoji = true +max_width = 120 + +[filters] +ignore_dirs = [ + ".git", + "node_modules", + "target", + "__pycache__", + ".venv", + "vendor", +] +ignore_files = [ + "*.lock", + "*.min.js", + "*.min.css", +] + +[tee] +enabled = true +mode = "failures" +max_files = 20 +max_file_size = 1048576 + +[telemetry] +enabled = false +consent_given = false +consent_date = "2026-06-21T06:05:58.603291+00:00" + +[hooks] +exclude_commands = [ + "rg", # rtk grep backend is BSD grep on macOS; rg flags break silently (exit 0) + "grep", # 254/287 parse failures; 6.1K lifetime savings vs silent zero-match risk + "curl", # 2 tokens saved on 138K input; schema-compaction risks mangling API responses + "diff", # 28 parse failures vs 8 filtered runs; condensing strips hunk context +] +# git restricted to commit/fetch: compact filters strip output the model needs (e.g. stash SHA) +transparent_prefixes = [ + "git stash", + "git status", + "git log", + "git diff", + "git add", + "git push", + "git pull", + "git branch", + "git show", + "git worktree", + "git checkout", + "git switch", + "git restore", + "git reset", + "git merge", + "git rebase", + "git remote", + "git rev-parse", + "git tag", + "git blame", + "git ls-files", + "git ls-remote", + "git reflog", + "git cherry-pick", + "git describe", + "git config", + "git check-attr", + "git submodule", + "git clean", + "git rm", + "git mv", + "git init", + "git clone", + "git apply", + "git bisect", +] + +[limits] +grep_max_results = 200 +grep_max_per_file = 25 +status_max_files = 15 +status_max_untracked = 10 +passthrough_max_chars = 2000 diff --git a/2026_REFRESH.md b/2026_REFRESH.md index b81d8da..7920898 100644 --- a/2026_REFRESH.md +++ b/2026_REFRESH.md @@ -129,6 +129,14 @@ rtk init --show # verify: all rows [ok] Idempotent — safe to re-run. Skips automation in the dotfiles repo on purpose so chezmoi never fights rtk over `~/.claude/CLAUDE.md` and `settings.json`. +rtk's own config *is* chezmoi-managed (`.chezmoitemplates/rtk-config.toml`, one +template → `~/.config/rtk/` on linux, `~/Library/Application Support/rtk/` on +darwin). It dials the hook back to where filtering measurably pays off: `rg`, +`grep`, `curl`, `diff` excluded (silent-failure risk or ~zero savings) and git +restricted to `commit`/`fetch` via `transparent_prefixes` (compact filters +stripped output the model needed, e.g. `git stash` SHAs). Verify a rewrite +decision anytime with `rtk hook check ""`. + ## Verification ```bash diff --git a/dot_config/rtk/config.toml.tmpl b/dot_config/rtk/config.toml.tmpl new file mode 100644 index 0000000..2738a49 --- /dev/null +++ b/dot_config/rtk/config.toml.tmpl @@ -0,0 +1 @@ +{{- template "rtk-config.toml" . -}} diff --git a/private_Library/private_Application Support/rtk/config.toml.tmpl b/private_Library/private_Application Support/rtk/config.toml.tmpl new file mode 100644 index 0000000..2738a49 --- /dev/null +++ b/private_Library/private_Application Support/rtk/config.toml.tmpl @@ -0,0 +1 @@ +{{- template "rtk-config.toml" . -}}