rtk · usage report

Token Savings

Live from rtk gain + rtk discover · global scope

Daily trend

By week and month

Tokens saved by command

Top 10 — a hard cap in the tool itself, not a display choice.

Missed opportunities

Parse failures

'\n cat <<'EOF'\n\nEOF\n} > \"$SP/pourtest/solo.html\"\necho \"built solo.html\"; curl -s -o /dev/null -w \"%{http_code}\\n\" http://localhost:8766/solo.html"}, {"base_command": "swiftc", "count": 1, "example": "swiftc -typecheck Shared/AppGroup.swift Shared/Formatters.swift Shared/HealthSnapshot.swift Shared/DeviceStats.swift 2>&1"}, {"base_command": "VITE_SPOTIFY_CLIENT_ID", "count": 1, "example": "SPOTIFY_CLIENT_ID=$(grep VITE_SPOTIFY_CLIENT_ID .env.local"}, {"base_command": "time", "count": 1, "example": "time ./spotify-api.sh onpinned \"spotify:track:2Eh6L0CwnGJp8cXWAN0bzG\""}, {"base_command": "docker info", "count": 1, "example": "docker info --format '{{.ServerVersion}} {{.Name}}' 2>&1"}, {"base_command": "git hash-object", "count": 1, "example": "git hash-object Widgets/WidgetsExtension/SpotifyWidgetView.swift"}, {"base_command": "tar", "count": 1, "example": "tar -xzf get-shit-done-cc-1.42.3.tgz 2>/dev/null"}, {"base_command": "-r", "count": 1, "example": "PID=$(jq -r '.id' $C)"}, {"base_command": "(git check-ignore", "count": 1, "example": "(git check-ignore -v Credentials.json"}, {"base_command": "exit 0", "count": 1, "example": "exit 0"}, {"base_command": "-a 256", "count": 1, "example": "LOCAL=$(shasum -a 256 app/index.html"}, {"base_command": "n=$(pgrep", "count": 1, "example": "n=$(pgrep -f \"Xcode-beta.app\""}, {"base_command": "open", "count": 1, "example": "open -a \"/Applications/\u00dcbersicht.app\""}, {"base_command": "date +%Z", "count": 1, "example": "date +%Z"}, {"base_command": "qlmanage", "count": 1, "example": "qlmanage -t -s 512 -o . icon.svg >/dev/null 2>&1"}, {"base_command": "for pat", "count": 1, "example": "D=/private/tmp/claude-501/-Users-jd9hall/ce1cb45b-e574-4455-b0aa-a889aba6b9fb/scratchpad/g\nfor pat in \"s/sweepMs: 6000/sweepMs: 2500/\" \"s/timeScale: 25/timeScale: 40/\" \"s/cupPerfect: 7/cupPerfect: 2/\" \"s/tiltMax: 60/tiltMax: 40/\" \"s/ladleCharge: 480/ladleCharge: 4800/\""}, {"base_command": "git", "count": 1, "example": "git -C \"$(pwd -P)\" status -sb 2>&1"}, {"base_command": "date\necho", "count": 1, "example": "date\necho"}, {"base_command": "and build", "count": 1, "example": "DESC=\"Specs and build docs for the iPhone WidgetKit widgets\""}, {"base_command": "*youtube-widget) NAME=\"youtube-widget\"", "count": 1, "example": "*youtube-widget) NAME=\"youtube-widget\""}, {"base_command": "backup.sh", "count": 1, "example": "./scripts/backup.sh"}, {"base_command": "esac\n echo", "count": 1, "example": "esac\n echo \"--- $NAME ---\"\n if git remote"}, {"base_command": "find-generic-password", "count": 1, "example": "KEY=$(security find-generic-password -s spotify-widget -a widget_key -w 2>/dev/null)"}, {"base_command": "crontab", "count": 1, "example": "crontab -l 2>&1"}, {"base_command": "resign.sh", "count": 1, "example": "./resign.sh --check"}, {"base_command": "reclaim() {", "count": 1, "example": "LOG=\"$HOME/Library/Logs/screenshot-filer.log\"\nreclaim() {\n src=\"Other/$1\""}, {"base_command": "done\nls", "count": 1, "example": "done\nls -la \"$SP/p1-desk.png\" \"$SP/p1-phone.png\""}, {"base_command": "Pages Function", "count": 1, "example": "DESC=\"Cloudflare Pages Function aggregating YouTube channel RSS for the iPhone widget\""}, {"base_command": "echo\ncd", "count": 1, "example": "echo\ncd ~/Projects/Iphone-Widgets"}, {"base_command": "before=$(df", "count": 1, "example": "before=$(df -m /System/Volumes/Data | tail -1 | awk '{print $4}')\necho \"free before: $((before/1024)) GB\"; echo\n\n# 1. Device symbol cache \u2014 regenerates on next phone connect\nrm -rf ~/Library/Developer/Xcode/iOS\\ DeviceSupport/* && echo \"\u2713 iOS DeviceSupport 6.5 GB\"\n# 2. Simulator devices \u2014 no runtimes are installed, so these are unusable shells\nrm -rf ~/Library/Developer/CoreSimulator/Devices/* && echo \"\u2713 CoreSimulator Devices 2.4 GB\"\n# 3. Build intermediates \u2014 regenerate on next build\nrm -rf ~/Library/Developer/Xcode/DerivedData/* && echo \"\u2713 DerivedData 826 MB\"\n# 4. Interrupted git repack leftovers from Jul 22\nrm -f ~/.git/objects/pack/tmp_pack_2sHuZR ~/.git/objects/pack/tmp_pack_NgwRyE && echo \"\u2713 stale git tmp packs 735 MB\"\n# 5. Docker installer leftover; Docker.app is already installed\nrm -rf ~/Library/Application\\ Support/com.docker.install/in_progress && echo \"\u2713 Docker installer temp 644 MB\"\n# 6. Just the BlueStacks installer \u2014 rest of Trash left alone\nrm -f ~/.Trash/BlueStacksInstaller_5.21.785.7533_cd849dc2c4e84a29f63feed68de40697.pkg && echo \"\u2713 BlueStacks installer 982 MB\"\n\necho\nafter=$(df -m /System/Volumes/Data | tail -1 | awk '{print $4}')\necho \"free after: $((after/1024)) GB (reclaimed $(( (after-before)/1024 )) GB)\"\ndf -h /System/Volumes/Data | tail -1"}, {"base_command": "spotify-widget\necho", "count": 1, "example": "W=~/Library/Application\\ Support/\u00dcbersicht/widgets/spotify-widget\necho \"=== spotify widget project present? ===\""}, {"base_command": "Widgets\"\n printf", "count": 1, "example": "n=\"Iphone-Widgets/Widgets\"\n printf \"%-24s \" \"$n:\"\n s=$(git -C \"$d\" status --short 2>/dev/null"}, {"base_command": "}\ncurl", "count": 1, "example": "}\ncurl -s -H \"x-widget-key: $KEY\" https://spotify-widget-api.pages.dev/api/now-playing \\"}, {"base_command": "setopt NULL_GLOB", "count": 1, "example": "setopt NULL_GLOB 2>/dev/null"}, {"base_command": "git clone", "count": 1, "example": "git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting ~/.zsh/zsh-syntax-highlighting 2>&1"}, {"base_command": "-e 'tell", "count": 1, "example": "OUT=/private/tmp/claude-501/-Users-jd9hall/31adf8b3-86b1-4885-a3a8-46a2b4817f9e/scratchpad\nWAS_RUNNING=$(osascript -e 'tell application \"System Events\" to (name of processes) contains \"Safari\"')\necho \"Safari was running: $WAS_RUNNING\"\nosascript <<'AS'\ntell application \"Safari\"\n activate\n make new document with properties {URL:\"https://justindhall.pages.dev/ai\"}\n set bounds of window 1 to {60, 60, 1500, 960}\nend tell\nAS\nsleep 6\nWID=$(osascript -e 'tell application \"Safari\" to id of window 1')\nscreencapture -x -o -l\"$WID\" \"$OUT/safari-ai.png\" 2>/dev/null || screencapture -x -D 1 \"$OUT/safari-ai.png\"\nls -la \"$OUT/safari-ai.png\""}, {"base_command": "spotify-api.sh player", "count": 1, "example": "./spotify-api.sh player"}, {"base_command": "node $GT", "count": 1, "example": "node $GT config-get workflow.use_worktrees 2>&1"}, {"base_command": "pinned.json", "count": 1, "example": "C=~/Library/Caches/spotify-widget/pinned.json"}, {"base_command": "return", "count": 1, "example": "return"}, {"base_command": "s=$(git", "count": 1, "example": "s=$(git -C \"$d\" status --short"}, {"base_command": "}\necho", "count": 1, "example": "}\necho \"size: $(du -sh \"$SRC\" | cut -f1)\"\nmv \"$SRC\" \"$DST\""}, {"base_command": "gsd-sdk.js", "count": 1, "example": "T=/Users/jd9hall/.npm/_npx/4db0de1f85c3165e/node_modules/get-shit-done-cc/bin/gsd-sdk.js"}, {"base_command": "strings", "count": 1, "example": "strings /Applications/Claude.app/Contents/Resources/app.asar 2>/dev/null"}, {"base_command": "*Iphone-Widgets) NAME=\"iphone-widgets\"", "count": 1, "example": "*Iphone-Widgets) NAME=\"iphone-widgets\""}, {"base_command": "echo \"---", "count": 1, "example": "X=~/.Trash/Xcode-beta.app\necho \"--- key paths ---\"\nfor p in \\\n \"Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc\" \\\n \"Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk\" \\\n \"Contents/Info.plist\" \\\n \"Contents/MacOS/Xcode\""}, {"base_command": "-d", "count": 1, "example": "RT=$(ls -d /Library/Developer/CoreSimulator/Volumes/*/Library/Developer/CoreSimulator/Profiles/Runtimes/*.simruntime 2>/dev/null"}, {"base_command": ".zsh_history", "count": 1, "example": "HIST=~/.zsh_history"}, {"base_command": "timeout 115", "count": 1, "example": "timeout 115 /usr/bin/log show --start '2026-09-08 11:14:00' --end '2026-09-08 11:20:30' --style compact > $S/win.log 2>&1"}, {"base_command": "gsd-tools.cjs", "count": 1, "example": "GT=~/.claude/get-shit-done/bin/gsd-tools.cjs"}, {"base_command": "*.swiftinterface", "count": 1, "example": "SDK=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk\nIF=$(ls \"$SDK\"/System/Library/Frameworks/WidgetKit.framework/Modules/WidgetKit.swiftmodule/*.swiftinterface 2>/dev/null"}, {"base_command": "strings $HIST", "count": 1, "example": "strings $HIST 2>/dev/null"}, {"base_command": "tmp", "count": 1, "example": "SP=/tmp"}, {"base_command": "sw_vers", "count": 1, "example": "sw_vers"}, {"base_command": "done\nfor", "count": 1, "example": "done\nfor h in 525603c 138a2fa 252948a 54d4859"}, {"base_command": "xcrun swiftc", "count": 1, "example": "xcrun swiftc -swift-version 5 -default-isolation MainActor \\\n -enable-upcoming-feature MemberImportVisibility \\\n Shared/NowPlaying.swift Shared/SpotifyEndpoint.swift Shared/Formatters.swift \\\n Shared/ThumbnailCache.swift Shared/AppGroup.swift \\\n WidgetsExtension/SpotifyProjection.swift $SP/proj/Entry.swift $SP/proj/main.swift \\\n -o $SP/proj/run 2>&1"}, {"base_command": "}\n}", "count": 1, "example": "}\n}\nreclaim IMG_1595.png Music_Player\nreclaim IMG_1589.png Music_Player\nreclaim IMG_1563.png Shortcuts_Automation\nreclaim IMG_1562.png Shortcuts_Automation\nreclaim IMG_1590.jpeg Home_Screen\necho \"--- verify ---\""}, {"base_command": "(kill", "count": 1, "example": "(kill -0 $(cat data/.sync.lock/pid) 2>/dev/null"}, {"base_command": "docker volume", "count": 1, "example": "docker volume ls 2>&1"}, {"base_command": "i=$(grep", "count": 1, "example": "i=$(grep -c \"TrackInfoButton\" \"$f\")"}, {"base_command": "gsd-sdk", "count": 1, "example": "gsd-sdk --version 2>&1"}, {"base_command": "fi\n perl", "count": 1, "example": "fi\n perl -e 'select undef,undef,undef,1'\ndone\necho \"=== response ===\"\ncurl -s -w \"\\nstatus %{http_code} | type %{content_type} | bytes %{size_download}\\n\" \"http://localhost:8788/api/videos\" -o /tmp/yt.json"}, {"base_command": "{ grep", "count": 1, "example": "{ grep \"^SUPABASE_DB_URL=\" ~/Projects/gmail-warehouse/.env >> .env"}, {"base_command": "project: iOS", "count": 1, "example": "DESC=\"Xcode project: iOS home screen widgets (health, device stats, newsfeed, YouTube, location)\""}, {"base_command": "git rm", "count": 1, "example": "git rm --cached -q .DS_Store"}, {"base_command": "260820-jur-add-pour-the-iron-an-autopour-themed-tim\"", "count": 1, "example": "QUICK_DIR=\".planning/quick/260820-jur-add-pour-the-iron-an-autopour-themed-tim\""}, {"base_command": "-Eo 'Quarantined", "count": 1, "example": "REPORT=reports/latest.md\nSTAGED=$(grep -Eo 'Quarantined [0-9]+ item\\(s\\), [^ ]+ [A-Z]+' \"$REPORT\""}, {"base_command": "p=$(grep", "count": 1, "example": "p=$(grep -c \"AddToPlaylistButton\" \"$f\")"}, {"base_command": "tmutil listlocalsnapshots", "count": 1, "example": "tmutil listlocalsnapshots / 2>&1"}, {"base_command": "exit 1", "count": 1, "example": "exit 1"}, {"base_command": "Comet\"", "count": 1, "example": "CHROME=\"/Applications/Comet.app/Contents/MacOS/Comet\""}, {"base_command": "uname", "count": 1, "example": "uname -m"}, {"base_command": "setopt +o", "count": 1, "example": "setopt +o nomatch 2>/dev/null"}, {"base_command": "sstest", "count": 1, "example": "T=/private/tmp/claude-501/-Users-jd9hall/4d8453b4-b995-4dce-a0a5-99a7e64850ca/scratchpad/sstest"}, {"base_command": "}\n cd", "count": 1, "example": "}\n cd \"$d\"\n br=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)\n dirty=$(git status --porcelain"}, {"base_command": "the Iron", "count": 1, "example": "DESC='Pour the Iron v2: real defect model (cold shut/short pour/runout), arrow-key pour rate, weight-based ladle, molds-per-hour dashboard'"}, {"base_command": "typecheck.sh", "count": 1, "example": "~/Projects/Iphone-Widgets/typecheck.sh"}, {"base_command": "name=${p##*:}\n echo", "count": 1, "example": "name=${p##*:}\n echo \"--- $path / $name\"\n curl -s \"$B/$path/teams\""}, {"base_command": "last reboot", "count": 1, "example": "last reboot 2>&1"}, {"base_command": "awk-buffer is", "count": 1, "example": "awk-buffer is portable to both macOS and the Linux sandbox.\nperl -0pi -e \"s/\\| sort -V \\| head -n -2/| sort -V | awk '{a[NR]=\\\\\\$0} END{for(i=1;i<=NR-2;i++) print a[i]}'/g\" weekly-cleanup.sh library-cleanup.sh\ngrep -n \"a\\[NR\\]\\|head -n -2\" weekly-cleanup.sh library-cleanup.sh"}, {"base_command": "git mv", "count": 1, "example": "git mv --force Credentials.json credentials.json 2>/dev/null"}, {"base_command": "&& python3", "count": 1, "example": "P=\".planning/quick/260914-qhv-rebuild-pour-the-iron-top-down-operator-/260914-qhv-PLAN.md\" && python3 - \"$P\" <<'PY'\nimport sys\np=sys.argv[1]\ns=open(p).read()\nold='\\n '\nnew=('\\n'\n ' Task 4: Play the shift \u2014 confirm the frame reads and the tuning lands\\n'\n ' Pause and hand the running game to the developer. Do not self-approve: there is no\\n'\n 'test framework here, and every acceptance criterion in the spec is a judgement about whether the\\n'\n 'picture reads and the game feels fair. Serve the site, walk the checks below, and wait.\\n'\n ' ')\nassert old in s\nopen(p,'w').write(s.replace(old,new,1))\nPY\ngsd-sdk query verify.plan-structure \"$P\" 2>&1 | head -8"}, {"base_command": "cp", "count": 1, "example": "D=/private/tmp/claude-501/-Users-jd9hall/ce1cb45b-e574-4455-b0aa-a889aba6b9fb/scratchpad/g\ncp $D/public/game.js $D/public/game.bak\nsed -i '' \"s/timeScale: 25/timeScale: 40/\" $D/public/game.js\n(cd $D"}, {"base_command": "[ \"$n\"", "count": 1, "example": "[ \"$n\" = \"Widgets\" ]"}, {"base_command": "[ \"$NEW\"", "count": 1, "example": "[ \"$NEW\" != \"$OLD\" ]"}, {"base_command": "(find", "count": 1, "example": "(find . -name \"*.test.*\" -not -path \"*/node_modules/*\" 2>/dev/null"}, {"base_command": "sqlite3", "count": 1, "example": "sqlite3 ~/Library/Application\\ Support/com.apple.TCC/TCC.db \"select client, auth_value, datetime(last_modified,'unixepoch','localtime') from access where service='kTCCServiceAccessibility';\" 2>&1"}, {"base_command": "git reset", "count": 1, "example": "git reset -q --soft HEAD~1 && git reset -q HEAD && rtk git add .planning/STATE.md .planning/quick/260913-a4l-publish-ai-lanes-one-pager-at-ai && rtk git commit -q -F - <<'MSG'\ndocs(quick-260913-a4l): record the orphan fix and the route flatten\n\nCo-Authored-By: Claude Opus 5 \nClaude-Session: https://claude.ai/code/session_01SADfKr8de9eWnMYxiGH7FW\nMSG\nrtk git add .planning/quick/260820-jur-add-pour-the-iron-an-autopour-themed-tim .planning/quick/260820-keb-pour-the-iron-v2-real-defect-model-cold- && rtk git commit -q -F - <<'MSG2'\ndocs: track the two Pour the Iron quick-task dirs\n\nLeft untracked by their own sessions; every other .planning/quick dir is\ncommitted. Recorded separately rather than folded into unrelated work.\n\nCo-Authored-By: Claude Opus 5 \nClaude-Session: https://claude.ai/code/session_01SADfKr8de9eWnMYxiGH7FW\nMSG2\necho \"--- final ---\"; rtk git log --oneline -6; rtk git status --short; git show --stat --oneline HEAD~1 | head -5"}, {"base_command": "fi\n mv", "count": 1, "example": "fi\n mv \"$src\" \"$dst\""}, {"base_command": "devicectl device", "count": 1, "example": "/Applications/Xcode-beta.app/Contents/Developer/usr/bin/devicectl device install app --device 00008150-001825963E10C01C /private/tmp/claude-501/-Users-jd9hall/3913647c-63cf-41f6-8083-ca6172169bd0/scratchpad/dd/Build/Products/Debug-iphoneos/Widgets.app 2>&1"}, {"base_command": "date \"+%Y-%m-%d", "count": 1, "example": "TZ=America/Chicago date \"+%Y-%m-%d %H:%M:%S %Z\""}, {"base_command": "launchctl unload", "count": 1, "example": "launchctl unload ~/Library/LaunchAgents/com.jd9hall.supabase-dashboard.plist 2>/dev/null"}, {"base_command": "\"$GIT\" status", "count": 1, "example": "\"$GIT\" status --short"}, {"base_command": "\"Pour the", "count": 1, "example": "DESCRIPTION='Add \"Pour the Iron\" \u2014 an Autopour-themed timing minigame to the personal website'"}, {"base_command": "npm test", "count": 1, "example": "npm test > /dev/null 2>&1"}, {"base_command": "python3.14", "count": 1, "example": "/Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14 -m venv --clear .venv"}, {"base_command": "ifconfig", "count": 1, "example": "ifconfig 2>/dev/null"}, {"base_command": "git count-objects", "count": 1, "example": "git count-objects -v"}, {"base_command": "continue\n echo", "count": 1, "example": "continue\n echo \"=== $q ($(du -sh \"$HOME/$q\" 2>/dev/null | cut -f1))\"\n find \"$HOME/$q\" -name MANIFEST.tsv -exec cut -f2 {} \\; 2>/dev/null"}, {"base_command": "od", "count": 1, "example": "od -c /private/tmp/claude-501/-Users-jd9hall/2697ce48-d8b1-4d26-948b-ea4c4d8b9dea/tasks/boib6oeaq.output 2>&1"}, {"base_command": "brew list", "count": 1, "example": "brew list 2>/dev/null"}, {"base_command": "memory_pressure", "count": 1, "example": "memory_pressure 2>/dev/null"}], "parse_errors": 0, "rtk_disabled_count": 0, "rtk_disabled_examples": [], "agent_status": {"cursor_hook_installed": false, "hermes_plugin_installed": false, "copilot_hook_installed": false}}, "opportunityTokens": 255537}; var REDUCED = window.matchMedia('(prefers-reduced-motion: reduce)').matches; // ---- theme toggle (manual override beats system preference either direction) ---- var STORAGE_KEY = 'rtk_dashboard_theme'; function applyTheme(t) { if (t) document.documentElement.dataset.theme = t; else delete document.documentElement.dataset.theme; } function systemDark() { return window.matchMedia('(prefers-color-scheme: dark)').matches; } var stored = localStorage.getItem(STORAGE_KEY); applyTheme(stored === 'light' || stored === 'dark' ? stored : null); function paintToggleIcon() { var dark = document.documentElement.dataset.theme ? document.documentElement.dataset.theme === 'dark' : systemDark(); document.getElementById('themeToggle').innerHTML = dark ? '' : ''; } paintToggleIcon(); document.getElementById('themeToggle').addEventListener('click', function () { var current = document.documentElement.dataset.theme || (systemDark() ? 'dark' : 'light'); var next = current === 'dark' ? 'light' : 'dark'; localStorage.setItem(STORAGE_KEY, next); applyTheme(next); paintToggleIcon(); }); var css = getComputedStyle(document.querySelector('.viz-root')); function tok(name) { return css.getPropertyValue(name).trim(); } var CATEGORY_SLOTS = { 'Git': 'cat-1', 'PackageManager': 'cat-2', 'Files': 'cat-3', 'Build': 'cat-4', 'Network': 'cat-5', 'Test': 'cat-6', 'Infrastructure': 'cat-7', 'GitHub': 'cat-8', }; function categoryColor(cat) { return tok('--' + (CATEGORY_SLOTS[cat] || 'cat-other')); } function compact(n) { // Savings crossed a million once rtk grep started dominating; without an // M step the headline read "2054.5K". if (Math.abs(n) >= 1000000) return (n / 1000000).toFixed(1) + 'M'; if (Math.abs(n) >= 1000) return (n / 1000).toFixed(1) + 'K'; return String(Math.round(n)); } // count-up on stat tiles — the immediate, no-hover-required "this is alive" signal function animateValue(el, target, opts) { opts = opts || {}; if (REDUCED) { el.textContent = opts.format ? opts.format(target) : compact(target); return; } var start = performance.now(), dur = 700; function frame(now) { var t = Math.min(1, (now - start) / dur); var eased = 1 - Math.pow(1 - t, 3); var v = target * eased; el.textContent = opts.format ? opts.format(v) : compact(v); if (t < 1) requestAnimationFrame(frame); else el.textContent = opts.format ? opts.format(target) : compact(target); } requestAnimationFrame(frame); } var tooltip = document.getElementById('tooltip'); function showTooltip(x, y, valueText, labelText) { tooltip.innerHTML = ''; var strong = document.createElement('span'); strong.className = 'tt-value'; strong.textContent = valueText; var sep = document.createTextNode(' — '); var name = document.createElement('span'); name.textContent = labelText; tooltip.appendChild(strong); tooltip.appendChild(sep); tooltip.appendChild(name); tooltip.style.left = x + 'px'; tooltip.style.top = y + 'px'; tooltip.classList.add('show'); } function hideTooltip() { tooltip.classList.remove('show'); } // ---- stat tiles (values count up on load) ---- (function renderTiles() { var s = DATA.summary; var tiles = [ { label: 'Total commands', target: s.total_commands, format: function (v) { return compact(v); } }, { label: 'Tokens saved', target: s.total_saved, format: function (v) { return compact(v); } }, { label: 'Avg savings', target: s.avg_savings_pct, format: function (v) { return v.toFixed(1) + '%'; } }, { label: 'Avg exec time', target: s.avg_time_ms / 1000, format: function (v) { return v.toFixed(1) + 's'; } }, { label: 'Tokens still on the table', target: DATA.opportunityTokens, format: function (v) { return compact(v); }, accent: true }, ]; var root = document.getElementById('tiles'); tiles.forEach(function (t) { var el = document.createElement('div'); el.className = 'tile' + (t.accent ? ' accent' : ''); var l = document.createElement('div'); l.className = 'label'; l.textContent = t.label; var v = document.createElement('div'); v.className = 'value'; v.textContent = t.format(0); el.appendChild(l); el.appendChild(v); root.appendChild(el); animateValue(v, t.target, { format: t.format }); }); }()); // ---- daily trend (line + area, animated draw-in, crosshair tooltip) ---- (function renderTrend() { var daily = DATA.daily || []; var note = document.getElementById('trendNote'); if (daily.length === 0) { note.textContent = 'No daily data yet.'; return; } // Absolute savings track how heavily rtk was used that day, so a single // heavy day flattens every other into the baseline — one 1.9M day against // days under 60K makes the line a spike and nothing else. Efficiency is // bounded and comparable day to day, so it leads; the absolute series is // one click away. var METRICS = { savings_pct: { label: 'Efficiency', fmt: function (v) { return Math.round(v) + '%'; } }, saved_tokens: { label: 'Tokens saved', fmt: compact } }; var metric = 'savings_pct'; var svg = document.getElementById('trendSvg'); var W = 600, H = 170, padL = 8, padR = 8, padT = 16, padB = 26; var n = daily.length; function draw() { var spec = METRICS[metric]; while (svg.firstChild) svg.removeChild(svg.firstChild); note.textContent = (daily.length < 7 ? 'Only ' + daily.length + ' day' + (daily.length === 1 ? '' : 's') + ' recorded so far — this fills in as more days pass. ' : '') + spec.label + ' per day, last ' + daily.length + ' days.'; var maxSaved = Math.max.apply(null, daily.map(function (d) { return d[metric]; }).concat([1])); var stepX = n > 1 ? (W - padL - padR) / (n - 1) : 0; function xAt(i) { return n > 1 ? padL + i * stepX : W / 2; } function yAt(v) { return H - padB - (v / maxSaved) * (H - padT - padB); } var ns = 'http://www.w3.org/2000/svg'; function el(tag, attrs) { var e = document.createElementNS(ns, tag); for (var k in attrs) e.setAttribute(k, attrs[k]); return e; } svg.appendChild(el('line', { x1: padL, y1: H - padB, x2: W - padR, y2: H - padB, stroke: tok('--baseline'), 'stroke-width': 1 })); if (n > 1) { var linePts = daily.map(function (d, i) { return xAt(i) + ',' + yAt(d[metric]); }).join(' '); var areaPts = 'M' + xAt(0) + ',' + (H - padB) + ' L' + linePts.split(' ').join(' L') + ' L' + xAt(n - 1) + ',' + (H - padB) + ' Z'; var area = el('path', { d: areaPts, fill: tok('--seq-450'), opacity: 0 }); svg.appendChild(area); var line = el('polyline', { points: linePts, fill: 'none', stroke: tok('--seq-450'), 'stroke-width': 2, 'stroke-linejoin': 'round', 'stroke-linecap': 'round' }); svg.appendChild(line); if (!REDUCED) { var len = line.getTotalLength ? line.getTotalLength() : 1000; line.style.strokeDasharray = len; line.style.strokeDashoffset = len; line.style.transition = 'stroke-dashoffset 0.9s cubic-bezier(.16,1,.3,1)'; area.style.transition = 'opacity 0.6s ease 0.5s'; requestAnimationFrame(function () { requestAnimationFrame(function () { line.style.strokeDashoffset = 0; area.style.opacity = 0.1; }); }); } else { area.style.opacity = 0.1; } } var hitGroup = el('g', {}); daily.forEach(function (d, i) { var cx = xAt(i), cy = yAt(d[metric]); var ring = el('circle', { cx: cx, cy: cy, r: 4, fill: tok('--seq-450'), stroke: tok('--surface-1'), 'stroke-width': 2 }); svg.appendChild(ring); var hit = el('circle', { cx: cx, cy: cy, r: 14, fill: 'transparent', style: 'cursor:pointer' }); hit.tabIndex = 0; var onEnter = function () { var box = svg.getBoundingClientRect(); var px = box.left + (cx / W) * box.width; var py = box.top + (cy / H) * box.height + window.scrollY; showTooltip(px, py, spec.fmt(d[metric]), d.date + ' · ' + d.commands + ' commands · ' + compact(d.saved_tokens) + ' saved'); var ch = document.getElementById('crosshair'); ch.style.left = px + 'px'; ch.style.opacity = 1; }; hit.addEventListener('pointerenter', onEnter); hit.addEventListener('pointermove', onEnter); hit.addEventListener('focus', onEnter); hit.addEventListener('pointerleave', function () { hideTooltip(); document.getElementById('crosshair').style.opacity = 0; }); hit.addEventListener('blur', function () { hideTooltip(); document.getElementById('crosshair').style.opacity = 0; }); hitGroup.appendChild(hit); if (i === n - 1) { var lbl = el('text', { x: cx - 2, y: cy - 12, 'text-anchor': 'end', 'font-size': 11, 'font-weight': 600, fill: tok('--text-primary') }); lbl.textContent = spec.fmt(d[metric]); svg.appendChild(lbl); } // Anchor the end ticks inward: centred on the plot edge, half the label // falls outside the viewBox and gets clipped mid-digit. var anchor = i === 0 ? 'start' : i === n - 1 ? 'end' : 'middle'; var tick = el('text', { x: cx, y: H - padB + 16, 'text-anchor': anchor, 'font-size': 10, fill: tok('--text-muted') }); tick.textContent = d.date.slice(5); svg.appendChild(tick); }); svg.appendChild(hitGroup); } draw(); var chips = document.getElementById('trendChips'); if (chips) { chips.addEventListener('click', function (e) { var btn = e.target.closest('button[data-metric]'); if (!btn || btn.dataset.metric === metric) return; metric = btn.dataset.metric; chips.querySelectorAll('button').forEach(function (b) { b.classList.toggle('active', b.dataset.metric === metric); }); draw(); }); } }()); // ---- weekly / monthly breakdown ---- // Listed as rows rather than charted: two weeks and one month exist so far, // and a one- or two-bar chart is a stat tile wearing the wrong clothes. Rows // scale as the periods accumulate, so this won't need revisiting. (function renderPeriods() { var weekly = DATA.weekly || []; var monthly = DATA.monthly || []; var card = document.getElementById('periodsCard'); var root = document.getElementById('periodsChart'); var note = document.getElementById('periodsNote'); if (!weekly.length && !monthly.length) { if (card) card.style.display = 'none'; return; } note.textContent = 'Savings grouped by period. Percent is the share of input tokens rtk removed, so it is comparable across periods; the totals are not.'; function shortDate(iso) { if (!iso) return ''; var p = iso.split('-'); return new Date(+p[0], +p[1] - 1, +p[2]).toLocaleDateString(undefined, { month: 'short', day: 'numeric' }); } function monthName(m) { var p = m.split('-'); return new Date(+p[0], +p[1] - 1, 1).toLocaleDateString(undefined, { month: 'long', year: 'numeric' }); } function section(title, rows, nameOf) { if (!rows.length) return; var h = document.createElement('div'); h.className = 'bar-label'; h.style.cssText = 'margin:10px 0 6px;font-weight:600;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.08em;font-size:10px'; h.textContent = title; root.appendChild(h); var maxVal = Math.max.apply(null, rows.map(function (r) { return r.saved_tokens; }).concat([1])); rows.forEach(function (d) { var row = document.createElement('div'); row.className = 'bar-row'; var label = document.createElement('div'); label.className = 'bar-label'; label.textContent = nameOf(d); row.appendChild(label); var track = document.createElement('div'); track.className = 'bar-track'; var fill = document.createElement('div'); fill.className = 'bar-fill'; fill.style.background = tok('--seq-450'); var w = Math.max((d.saved_tokens / maxVal) * 100, 2) + '%'; fill.dataset.targetWidth = w; fill.style.width = REDUCED ? w : '0%'; fill.tabIndex = 0; var show = function () { var r = fill.getBoundingClientRect(); showTooltip(r.left + r.width / 2 + window.scrollX, r.top + window.scrollY - 8, compact(d.saved_tokens) + ' tokens saved', nameOf(d) + ' · ' + d.commands + ' commands · ' + Math.round(d.savings_pct) + '%'); }; fill.addEventListener('pointerenter', show); fill.addEventListener('pointermove', show); fill.addEventListener('focus', show); fill.addEventListener('pointerleave', hideTooltip); fill.addEventListener('blur', hideTooltip); track.appendChild(fill); row.appendChild(track); var value = document.createElement('div'); value.className = 'bar-value'; value.textContent = compact(d.saved_tokens) + ' · ' + Math.round(d.savings_pct) + '%'; row.appendChild(value); root.appendChild(row); }); } section('By week', weekly.slice().reverse(), function (d) { return shortDate(d.week_start) + ' – ' + shortDate(d.week_end); }); section('By month', monthly.slice().reverse(), function (d) { return monthName(d.month); }); animateBars(root); }()); // ---- shared: animate a set of bar rows in with a slight stagger ---- function animateBars(container) { if (REDUCED) return; var fills = container.querySelectorAll('.bar-fill'); fills.forEach(function (f, i) { var target = f.dataset.targetWidth; f.style.width = '0%'; setTimeout(function () { f.style.width = target; }, 30 + i * 35); }); } // ---- command breakdown (sortable bar list) ---- (function renderCommands() { var container = document.getElementById('commandChart'); var chips = document.querySelectorAll('#sortChips .sort-chip'); var sortKey = 'saved'; function draw() { var rows = DATA.commands.slice().sort(function (a, b) { return b[sortKey] - a[sortKey]; }); var maxVal = Math.max.apply(null, rows.map(function (r) { return r[sortKey]; }).concat([1])); container.innerHTML = ''; rows.forEach(function (d) { var row = document.createElement('div'); row.className = 'bar-row'; var label = document.createElement('div'); label.className = 'bar-label'; label.textContent = d.command; row.appendChild(label); var track = document.createElement('div'); track.className = 'bar-track'; var fill = document.createElement('div'); fill.className = 'bar-fill'; fill.style.background = tok('--seq-450'); var w = Math.max((d[sortKey] / maxVal) * 100, 2) + '%'; fill.dataset.targetWidth = w; fill.style.width = REDUCED ? w : '0%'; fill.tabIndex = 0; track.appendChild(fill); row.appendChild(track); var value = document.createElement('div'); value.className = 'bar-value'; value.textContent = sortKey === 'saved' ? compact(d.saved) : sortKey === 'pct' ? d.pct + '%' : d.ms + 'ms'; row.appendChild(value); var show = function (e) { var r = fill.getBoundingClientRect(); showTooltip(r.left + r.width / 2 + window.scrollX, r.top + window.scrollY - 8, compact(d.saved) + ' tokens saved', d.command + ' ×' + d.count + ' (' + d.pct + '%)'); }; fill.addEventListener('pointerenter', show); fill.addEventListener('pointermove', show); fill.addEventListener('focus', show); fill.addEventListener('pointerleave', hideTooltip); fill.addEventListener('blur', hideTooltip); container.appendChild(row); }); animateBars(container); } chips.forEach(function (chip) { chip.addEventListener('click', function () { sortKey = chip.dataset.sort; chips.forEach(function (c) { c.classList.toggle('active', c === chip); }); draw(); }); }); chips[0].classList.add('active'); draw(); }()); // ---- missed opportunities (rtk discover) ---- (function renderOpportunities() { var supported = (DATA.discover.supported || []).slice().sort(function (a, b) { return b.estimated_savings_tokens - a.estimated_savings_tokens; }); var note = document.getElementById('opportunityNote'); note.textContent = supported.length === 0 ? 'Nothing found — everything scannable already goes through rtk.' : 'Commands from your last ' + DATA.discover.since_days + ' days that have an rtk equivalent you\'re not using yet.'; var seenCats = []; supported.forEach(function (d) { if (seenCats.indexOf(d.category) === -1) seenCats.push(d.category); }); var legend = document.getElementById('categoryLegend'); seenCats.forEach(function (cat) { var item = document.createElement('div'); item.className = 'legend-item'; var sw = document.createElement('span'); sw.className = 'legend-swatch'; sw.style.background = categoryColor(cat); var name = document.createElement('span'); name.textContent = cat; item.appendChild(sw); item.appendChild(name); legend.appendChild(item); }); var container = document.getElementById('opportunityChart'); var maxVal = Math.max.apply(null, supported.map(function (d) { return d.estimated_savings_tokens; }).concat([1])); supported.forEach(function (d) { var row = document.createElement('div'); row.className = 'bar-row'; var label = document.createElement('div'); label.className = 'bar-label'; var dot = document.createElement('span'); dot.className = 'bar-cat-dot'; dot.style.background = categoryColor(d.category); label.appendChild(dot); label.appendChild(document.createTextNode(d.command + ' → rtk ' + d.rtk_equivalent.replace(/^rtk\s*/, ''))); row.appendChild(label); var track = document.createElement('div'); track.className = 'bar-track'; var fill = document.createElement('div'); fill.className = 'bar-fill'; // a lighter tint carries magnitude; the dot + legend carry category // identity — keeps the bar area calm instead of eight saturated hues // competing for attention. fill.style.background = 'color-mix(in srgb, ' + categoryColor(d.category) + ' 55%, transparent)'; var w = Math.max((d.estimated_savings_tokens / maxVal) * 100, 2) + '%'; fill.dataset.targetWidth = w; fill.style.width = REDUCED ? w : '0%'; fill.tabIndex = 0; track.appendChild(fill); row.appendChild(track); var value = document.createElement('div'); value.className = 'bar-value'; value.textContent = compact(d.estimated_savings_tokens); row.appendChild(value); var show = function () { var r = fill.getBoundingClientRect(); showTooltip(r.left + r.width / 2 + window.scrollX, r.top + window.scrollY - 8, '~' + compact(d.estimated_savings_tokens) + ' tokens', d.command + ' ×' + d.count + ' — ' + d.category); }; fill.addEventListener('pointerenter', show); fill.addEventListener('pointermove', show); fill.addEventListener('focus', show); fill.addEventListener('pointerleave', hideTooltip); fill.addEventListener('blur', hideTooltip); container.appendChild(row); }); animateBars(container); }()); // ---- failures ---- (function renderFailures() { var f = DATA.failures; var row = document.getElementById('failuresRow'); var recoveryColor = f.recovery_pct >= 95 ? tok('--good-text') : f.recovery_pct >= 80 ? tok('--warning') : tok('--critical'); row.innerHTML = ''; var s1 = document.createElement('span'); s1.className = 'failures-stat'; s1.appendChild(document.createTextNode('Total failures: ')); var b1 = document.createElement('b'); b1.textContent = f.total; s1.appendChild(b1); var s2 = document.createElement('span'); s2.className = 'failures-stat'; s2.appendChild(document.createTextNode('Recovery rate: ')); var b2 = document.createElement('b'); b2.textContent = f.recovery_pct.toFixed(1) + '%'; b2.style.color = recoveryColor; s2.appendChild(b2); row.appendChild(s1); row.appendChild(s2); var list = document.getElementById('failuresList'); (f.top || []).forEach(function (item) { var chip = document.createElement('span'); chip.className = 'failure-chip'; chip.textContent = item.count + '× ' + item.command; list.appendChild(chip); }); }()); document.getElementById('footerNote').textContent = 'Command breakdown and failures are parsed from rtk’s text output (JSON mode doesn’t include them); ' + 'summary and daily trend come straight from rtk gain --format json; missed opportunities from rtk discover --format json.'; }());