<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Go on ICE-ICE-BEAR-BLOG</title><link>https://ice-ice-bear.github.io/tags/go/</link><description>Recent content in Go on ICE-ICE-BEAR-BLOG</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Wed, 15 Apr 2026 00:00:00 +0900</lastBuildDate><atom:link href="https://ice-ice-bear.github.io/tags/go/index.xml" rel="self" type="application/rss+xml"/><item><title>agentsview — One Local Binary for Every AI Agent's Sessions and Costs</title><link>https://ice-ice-bear.github.io/posts/2026-04-15-agentsview/</link><pubDate>Wed, 15 Apr 2026 00:00:00 +0900</pubDate><guid>https://ice-ice-bear.github.io/posts/2026-04-15-agentsview/</guid><description>&lt;img src="https://ice-ice-bear.github.io/" alt="Featured image of post agentsview — One Local Binary for Every AI Agent's Sessions and Costs" /&gt;&lt;h2 id="overview"&gt;Overview
&lt;/h2&gt;&lt;p&gt;Wes McKinney shipped &lt;a class="link" href="https://github.com/wesm/agentsview" target="_blank" rel="noopener"
 &gt;agentsview&lt;/a&gt; — a single-binary, local-first tool that pulls every coding-agent session on your machine (Claude Code, Codex, OpenCode, and more) into a SQLite database and serves a web UI plus a CLI. It doubles as a drop-in, 100x faster replacement for &lt;code&gt;ccusage&lt;/code&gt;. 758 stars, mostly Go with a Svelte/TypeScript UI.&lt;/p&gt;
&lt;pre class="mermaid" style="visibility:hidden"&gt;graph TD
 A["Local agent session files"] --&gt; B[agentsview sync]
 B --&gt; C["SQLite index (local)"]
 C --&gt; D[Web UI localhost:8080]
 C --&gt; E[CLI: agentsview usage]
 C --&gt; F[Statusline one-liner]&lt;/pre&gt;&lt;h2 id="what-it-actually-does"&gt;What it actually does
&lt;/h2&gt;&lt;p&gt;Point one: discovery. On first run, agentsview scans your machine for sessions from every supported agent and ingests them. No accounts, no upload, no daemon you have to install first — &lt;code&gt;curl install.sh | bash&lt;/code&gt; and you&amp;rsquo;re done. The web UI opens at &lt;code&gt;127.0.0.1:8080&lt;/code&gt; and exposes a dashboard with cost over time, cost attribution by project, and a session browser with full transcript search.&lt;/p&gt;
&lt;p&gt;Point two: the SQLite trick. &lt;code&gt;ccusage&lt;/code&gt; re-parses raw JSONL session files every time you run it. At scale that&amp;rsquo;s slow — minutes on a heavily-used Max plan. agentsview indexes once, then every &lt;code&gt;agentsview usage daily&lt;/code&gt; query is a SQL aggregate. The README claims over 100x speedup and in practice it feels instant even on months of history.&lt;/p&gt;
&lt;p&gt;Point three: pricing. Costs are computed from LiteLLM rates with an offline fallback table, cache-aware (prompt caching creation vs. read tokens priced differently), and filterable by agent, model, date, and timezone. The recent commit &lt;code&gt;3758c37&lt;/code&gt; (fix Opus 4.6 fallback pricing to $5/$25) shows they&amp;rsquo;re keeping pace with current Anthropic list prices.&lt;/p&gt;
&lt;h2 id="cli-surface"&gt;CLI surface
&lt;/h2&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agentsview &lt;span class="c1"&gt;# start server, open web UI&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agentsview usage daily &lt;span class="c1"&gt;# per-day cost summary (last 30d)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agentsview usage daily --breakdown --agent claude --since 2026-04-01
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agentsview usage statusline &lt;span class="c1"&gt;# one-liner for shell prompts&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agentsview usage daily --all --json
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;statusline&lt;/code&gt; output is the piece I immediately want — a compact cost string you can pipe into a shell prompt or tmux status bar so you see today&amp;rsquo;s burn rate while you work. JSON output makes it scriptable for cron-based alerting when daily spend crosses a threshold.&lt;/p&gt;
&lt;h2 id="the-cobra-migration"&gt;The Cobra migration
&lt;/h2&gt;&lt;p&gt;Recent PR #324 migrated the CLI dispatch from a hand-rolled &lt;code&gt;os.Args&lt;/code&gt; switch to &lt;a class="link" href="https://github.com/spf13/cobra" target="_blank" rel="noopener"
 &gt;spf13/cobra&lt;/a&gt;. For a tool that started as a weekend hack this is a meaningful inflection — it signals subcommand stability and makes adding &lt;code&gt;usage weekly&lt;/code&gt;, &lt;code&gt;usage monthly&lt;/code&gt;, or &lt;code&gt;export&lt;/code&gt; trivial. The Go codebase is 2.7MB, which is already non-trivial; Cobra&amp;rsquo;s auto-generated help and completions remove a whole class of maintenance burden.&lt;/p&gt;
&lt;h2 id="why-this-matters-now"&gt;Why this matters now
&lt;/h2&gt;&lt;p&gt;The market has three pieces: (1) ccusage — just Claude, slow, but the pattern-setter. (2) Various per-agent tools that each track their own format. (3) The agent vendors&amp;rsquo; own dashboards, which are centralized and delayed. agentsview collapses 1 and 2 into one binary and sidesteps 3 by staying local. The same binary serves a data scientist auditing an agent fleet and a solo dev checking whether they&amp;rsquo;re about to blow past the $200 line on Claude Max.&lt;/p&gt;
&lt;p&gt;The combination of &amp;ldquo;local-first + SQLite + one binary + Go&amp;rdquo; keeps surfacing across 2026 developer tools (see also: &lt;a class="link" href="https://github.com/simonw/sqlite-utils" target="_blank" rel="noopener"
 &gt;sqlite-utils&lt;/a&gt;, &lt;a class="link" href="https://github.com/bootandy/dust" target="_blank" rel="noopener"
 &gt;dust&lt;/a&gt;, &lt;a class="link" href="https://github.com/sharkdp/fd" target="_blank" rel="noopener"
 &gt;fd&lt;/a&gt;). The thesis: when the data is already on disk and fits in SQLite, server-based SaaS is overkill. agentsview is a clean expression of that thesis applied to AI-agent observability.&lt;/p&gt;
&lt;h2 id="insights"&gt;Insights
&lt;/h2&gt;&lt;p&gt;Three things stand out. First, the 100x speedup isn&amp;rsquo;t a micro-optimization — it&amp;rsquo;s the difference between &amp;ldquo;I run it once a week&amp;rdquo; and &amp;ldquo;it&amp;rsquo;s always in my statusline,&amp;rdquo; which changes whether the data actually shapes behavior. Second, a unified cost view across Claude, Codex, and OpenCode matters because heavy users route different tasks to different agents; per-vendor dashboards fragment the picture. Third, the repo&amp;rsquo;s own usage observability (LiteLLM pricing, prompt-caching-aware math, cache-creation vs. cache-read) is a surprisingly good checklist for anyone building their own Anthropic-SDK app — it&amp;rsquo;s basically the production pricing model distilled into a few hundred lines of Go.&lt;/p&gt;</description></item></channel></rss>