Repository navigation
Releases
Releases · darialan/toklens
v0.3.1 — Bundled Agent Skills (toklens-audit & toklens-budget) + H3 TTL/Switch Attribution
What's New
- Two decoupled bundled Agent Skills shipped inside the repo and npm package:
skills/toklens-audit/: periodic AI usage audits, longitudinal KPI board (~/.config/toklens/audit-ledger.md), hypothesis verification/falsification, and usage hygiene rule iteration.skills/toklens-budget/: monthly AI coding budget & plan advisor comparing pay-as-you-go official APIs, flat-rate Coding Plans / Token Plans, and hybrid peak/off-peak splits using realtoklenscache hit rates and 5h burst percentiles.
- Auto-install on global npm install:
npm install -g toklensautomatically installs both skills to~/.agents/skills/(and updates existing~/.claude/skills,~/.gemini/config/skills,~/.codex/skills; opt out withTOKLENS_SKIP_SKILL_INSTALL=1). Also addedtoklens install-skillfor manual/npx installation. - Improved
toklens auditRule 4 (high-uncached-spike): Measures>= 30Kuncached spikes on high-cost models by same-session model alternation (e.g. Plan Mode), idle>= 4.5 minTTL expiry, other cache eviction/callbacks, vs genuine large net-new pastes.
Install / Upgrade
npm install -g toklens
# or install skills via npx
npx toklens install-skillv0.3.0 — Local Waste Attribution (toklens audit), --for-ai Export & Configurable --budget
What's New
toklens audit(100% local deterministic rules engine, zero API keys):- Automatically flags mid-session model switching that busts Prompt Cache (
cache-bust),>= 200Kcontext snowballing (context-bloat, configurable via--context-limit), high-cost models fed raw bulk inputs with short outputs (expensive-raw-input), legacy model overpayment (legacy-model), weekday peak-hour surcharges (peak-mismatch), and channel sprawl (channel-sprawl). - Outputs masked offending session tables (8-char session ID prefixes, zero prompt text) and concrete recommendations in
table,md, orjson.
- Automatically flags mid-session model switching that busts Prompt Cache (
toklens audit --for-ai: Exports a privacy-safe, ready-to-paste diagnostic prompt + structured JSON bundle (zero chat text, zero local paths) for your own AI assistant (Claude Code / Codex / ChatGPT).- Configurable budget (
--budget <cny>&defaultBudgetCnyinpricing.json): Replaces the previous hardcoded ¥100 budget in--simulate.
Install / Upgrade
npx toklens@latest --last 7d
npx toklens@latest audit --last 30dv0.2.1 — WorkBuddy / WorkBuddy AI Adapter
What's New
- Added dedicated
workbuddyadapter (14 adapters total) for Tencent WorkBuddy / WorkBuddy AI (~/.workbuddy-ai/projects/**/*.jsonl&~/.workbuddy/projects/**/*.jsonl,$WORKBUDDY_CONFIG_DIR). - Parses per-call token usage (
providerData.rawUsage,providerData.usage,message.usage) on bothfunction_calland assistantmessagerecords, accurately separating cache hits/misses and deduplicating bymessageId. - Added built-in
WorkBuddy-Autorule for WorkBuddy'sauto/fast-modelrouting while keeping concrete model IDs matched to official CNY/USD pricing.
Install / Upgrade
npx toklens@latest --last 7dv0.2.0 — 13 Mainstream Domestic & Overseas Adapters + Windows CI
What's new in v0.2.0
Expanded local adapter coverage from 5 to 13 mainstream AI coding tools:
- VS Code / Cursor / Windsurf: Cline, Roo Code, Kilo Code (
vscode-cline) - Domestic Chinese CLIs & Agents: Tencent CodeBuddy (
codebuddy), DeepSeek Harness (deepseek-harness/dsh, multi-frame.jsonl.zstd), Kimi Code CLI (kimi-code), Alibaba Qwen Code (qwen-code), OpenClaw (openclaw) - Overseas CLIs: Pi Coding Agent (
pi), Google Gemini CLI (gemini-cli) - New
toklens adapterscommand to inspect detected local tools - Added
windows-latestto GitHub Actions CI matrix + Windows OpenCode path support
Try it
npx toklens@latest adapters
npx toklens@latest --last 7dv0.1.1 — Clean npx bin entry
Fix package.json bin path normalization (dist/cli.js) for clean npx toklens execution.
v0.1.0 — Initial Public Release
What's in v0.1.0
- Multi-agent local log adapters: Claude Code, Codex (
.jsonl+.jsonl.zst), OpenCode, MiniMax Mavis, and Antigravity - Built-in CNY/USD official API pricing (including DeepSeek Beijing-time peak/off-peak 50% discount) + user override via
~/.config/toklens/pricing.json - Zero-native-dependency incremental SQLite cache (
node:sqlite, ~0.3s warm runs) - Multi-dimension views (
--by family|tool|channel|day), migration budget simulator (--simulate), and 5-hour rolling window burst stats (--burst) - Table, Markdown, JSON, and CSV output formats
Quick Try
npx toklens --last 7d