Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
ADR 0173: Plugin-owned token usage dashboard
- Status: Accepted
- Date: 2026-09-07
- Related: D002, D103, D331, D335, ADR 0171
Context
ADR 0171 added host-owned completed-turn token history and a Settings → Usage
destination, but the marketplace plugin pi.token-insights already ships a local
dashboard across PI-Desktop, Claude Code, Codex, and OpenCode, so keeping both
duplicated a weaker PI-Desktop-only matrix inside Preferences.
Decision
- Settings has no Usage destination: Preferences is General, AI, and Shortcuts, and search does not index a usage tab.
pi.token-insightsis the user-facing dashboard, and command palette keywords (usage,tokens,用量) open that plugin.- Host persistence stays: Electron still sums parent
message_endusages plusturn_end.subagentUsageintosession.endTurn.usage, andstats.getTokenUsageHistoryremains an additive host RPC / IPC for local rollups, not a Settings page. - The plugin may fold host completed-turn remainders into its fact cube where they
exceed transcript assistant
meta.usage, so subagent spend is visible without double-counting; it never rewritesmessage.usage.
Consequences
- Users who want a heatmap install or open Token Insights.
- Historical turns may still be zero in the host RPC; the plugin's JSONL scan backfills those days.
Alternatives
- Keep Settings → Usage beside the plugin: duplicates the IA.
- Delete host turn persistence: loses D331 accounting.