惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
月光博客
月光博客
AI
AI
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
CXSECURITY Database RSS Feed - CXSecurity.com
WordPress大学
WordPress大学
GbyAI
GbyAI
L
Lohrmann on Cybersecurity
O
OpenAI News
Schneier on Security
Schneier on Security
P
Palo Alto Networks Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
W
WeLiveSecurity
L
LINUX DO - 最新话题
人人都是产品经理
人人都是产品经理
S
Security Affairs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
Arctic Wolf
Recorded Future
Recorded Future
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
G
GRAHAM CLULEY
N
Netflix TechBlog - Medium
TaoSecurity Blog
TaoSecurity Blog
C
Check Point Blog
Scott Helme
Scott Helme
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Apple Machine Learning Research
Apple Machine Learning Research
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Vercel News
Vercel News
The Hacker News
The Hacker News
Y
Y Combinator Blog
Latest news
Latest news
SecWiki News
SecWiki News
Hugging Face - Blog
Hugging Face - Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cisco Blogs
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
宝玉的分享
宝玉的分享
L
LINUX DO - 热门话题

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
I built a Rust replacement for ccusage — 1,742x faster, near-zero overhead
korjwl1 · 2026-05-08 · via DEV Community

TL;DR: I built Toki — a Rust daemon that replaces ccusage for Claude Code / Codex token tracking. ~1,742× faster on warm queries, near-zero overhead. Two optional layers sit on top: toki-monitor (macOS menu bar app) and toki-sync (self-hostable sync server). FSL-1.1-Apache-2.0, solo project.

The problem: ccusage was making my laptop crawl

I'm a Korean dev who burns a lot of tokens in Claude Code and Codex. At my workplace we'd been keeping a half-joking ccusage leaderboard of who was burning the most that week. It was fun — until we wired it into a hook to auto-run on every session, and our laptops started visibly slowing down.

Looking at ccusage's design, the cause was clear. Every invocation re-walks ~/.claude and ~/.codex and re-parses every JSONL session file from scratch, single-threaded. The Zig multi-threaded fork that tries to fix this still re-reads every byte and scales memory linearly with input.

OpenTelemetry would be cleaner architecturally, but it needs a central collector, can't see anything from before you set it up, and is overkill for "I just want to see my own tokens."

Toki — the daemon that replaces ccusage

Toki CLI demo showing daemon start and report commands in a<br>
  terminal

The name "Toki" is short for Token Inspector, and it's also the Korean word for rabbit (토끼) — hence the project mascot.

Toki is a direct, drop-in replacement for ccusage. It's a Rust daemon that indexes your sessions incrementally and serves reports from an embedded LSM store (fjall, used as a TSDB). Docker-style architecture: one daemon ingests, multiple clients read.

toki daemon start    # ingests via FSEvents/inotify
toki report          # instant TSDB query
toki trace           # live event stream (stdout / UDS / HTTP)
toki query 'sum by (model)(toki_tokens_total[1d])'   # PromQL-ish

Enter fullscreen mode Exit fullscreen mode

Toki is the only piece that replaces ccusage. The two other repos in this post (toki-monitor, toki-sync) are optional layers built on top of Toki, not separate competitors to anything.

Benchmarks

On a 2GB session dataset (M1 MacBook Air, sudo purge between runs):

Cold-start benchmark
Report query benchmark

Metric Toki ccusage zzusage
Cold-start 1.54 s 21.5 s 1.41 s
Report query (warm) ~12 ms 21.5 s
Idle RAM 5 MB (no idle state) (no idle state)
Idle CPU 0%
DB on disk ~3% of source

Translation: the daemon stays out of the way. Your laptop fan won't spin from this; you only feel it when you actually run a query, and queries come back fast enough that you barely notice the round trip.

The report query is constant-time regardless of dataset size — it hits the TSDB index, not the source files. So 1,742× on 2 GB of sessions, and the speedup keeps growing as your history grows.

How it works

The JSONL pipeline is where most of the engineering went.

1. Cold-start: parallel mmap'd parsing

Cold-start uses mmap + Rayon to walk session files in parallel. Lines without token-usage fields get skipped before serde ever touches them — most JSONL lines (thinking blocks, plain text content) don't carry usage, so this single filter is a meaningful win.

2. Selective serde on token-bearing lines

For the lines that do contain usage, the serde decoder is configured to skip every string field except the token counts. Prompts, responses, and thinking blocks are never even allocated.

Privacy comes from the parser, not from policy — and it's a real speed win on big files.

3. xxHash3 fingerprint + reverse-from-EOF resume

For incremental resume, the daemon stores an xxHash3 fingerprint of the last line it read. On the next run it scans backward from EOF and matches by hash, so even if a session file got compacted from the front, the right resume point is found in O(1) hash compares. No re-scanning everything just to figure out where we left off.

Architecture details — writer thread topology, trace fan-out, query parser — are documented in DESIGN.md. The short version: one writer thread per provider, separate UDS read path, so reports never block ingestion.


On top of Toki: toki-monitor (macOS menu bar GUI)

The CLI isn't for everyone, so I built toki-monitor — a macOS menu bar app that runs on top of the Toki daemon.

toki-monitor menu bar modes

The starting idea was something like RunCat but for token usage: a pixel rabbit in your menu bar that runs faster the more tokens you burn. As I built it, I kept finding things that make sense for AI tools but wouldn't for RunCat.

The rabbit sleeps when you stop using AI for a while (zZ animation), because "0 tokens" is a meaningful state for an AI tool while "0 CPU" never really is.

Rabbit sleeping when idle

An HP bar above the character shows how much of your Claude or Codex window is left, and depletes green → red as your weekly window burns down.

Optional warning system: a hit animation when your $/min crosses a threshold you set, and a poison effect when usage spikes anomalously vs your 24h baseline.

Hit effect when threshold crossed

You can render Claude and Codex as two separate characters in different colors, or merge them into one. Numeric and sparkline modes per provider if the mascot isn't your thing.

There's also a dashboard panel system (still beta) with PromQL-style queries, time-series charts, project breakdowns, and Liquid Glass styling for macOS Tahoe.

toki-monitor dashboard

The dashboard is functional but rough at the edges, and the menu bar animations aren't as polished as I'd like — solo dev, sprite art is genuinely not my strength. Contributions on the visual side would be amazing — new menu bar characters, animation refinements, dashboard polish, anything visual. The theme system is modular, so adding a new character is mostly drag-and-drop PNGs plus a small theme.json.


On top of Toki: toki-sync (self-hostable sync server, beta)

There's also toki-sync for multi-device users, team analytics, or running a "who's burning the most tokens this week" leaderboard with friends.

Custom binary TCP protocol (bincode + zstd + ACK flow control + delta-sync on reconnect), runs on AWS free-tier EC2 with fjall, ClickHouse backend for bigger deployments. Built-in auth + RBAC + REST API on top, so you can build your own dashboard. Still beta and the README is rough.


Try it

brew tap korjwl1/tap
brew install toki                  # CLI daemon (the ccusage replacement)
brew install --cask toki-monitor   # optional macOS GUI on top
toki daemon start && toki report

Enter fullscreen mode Exit fullscreen mode

Linux + macOS for the daemon (toki-monitor is macOS-only). Claude Code + Codex CLI supported today, Gemini CLI is next.

Status & contributions

Solo project, FSL-1.1-Apache-2.0 — full source, free for personal and commercial use, converts to Apache 2.0 after two years.

Contributions of any kind very welcome:

  • Code — issues / PRs across all three repos
  • Sprite art — new menu bar characters for toki-monitor (theme system is documented and modular)
  • Animation — refinements and polish
  • Translations — currently EN / KO, more languages welcome

If you try it and run into anything weird, please file an issue. Happy to answer questions in the comments 🐇


Repos: