Commit 26dd384ce923

Vincent Demeester <vincent@sbr.pm>
2026-02-19 11:43:28
feat(pi): remove token stats from custom footer
Removed R/W/cost display from footer as it's redundant with other available usage tracking mechanisms.
1 parent e664f4b
Changed files (1)
dots
pi
agent
dots/pi/agent/extensions/custom-footer.ts
@@ -6,15 +6,14 @@
  * - Abbreviated folder path (~/s/home for ~/src/home)
  * - Git branch (with dirty indicator)
  * - Model name
- * - Token stats (input/output/cost)
+ * - Context usage
  * - Current time
  *
- * Format: 🖥️ kyushu  ~/s/home  main  sonnet-4  ↑5.2k ↓2.1k $0.15  16:10
+ * Format: ️ kyushu  ~/s/home  main  sonnet-4  76.2%/200k  16:10
  */
 
-import type { AssistantMessage } from "@mariozechner/pi-ai";
 import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
-import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
+import { truncateToWidth } from "@mariozechner/pi-tui";
 import { hostname } from "node:os";
 import { execSync } from "node:child_process";
 import path from "node:path";
@@ -158,7 +157,7 @@ function getShortModelName(modelId: string): string {
 }
 
 // =============================================================================
-// Token Stats (Total Read/Written across session)
+// Formatting Helpers
 // =============================================================================
 
 function formatNumber(n: number): string {
@@ -168,27 +167,6 @@ function formatNumber(n: number): string {
 	return `${(n / 1000000).toFixed(1)}M`;
 }
 
-function getTokenStats(ctx: any): { 
-	totalRead: number; 
-	totalWritten: number; 
-	cost: number 
-} {
-	let totalRead = 0;   // R = total input tokens (read by model)
-	let totalWritten = 0; // W = total output tokens (written by model)
-	let cost = 0;
-
-	for (const e of ctx.sessionManager.getBranch()) {
-		if (e.type === "message" && e.message.role === "assistant") {
-			const m = e.message as AssistantMessage;
-			totalRead += m.usage.input;
-			totalWritten += m.usage.output;
-			cost += m.usage.cost.total;
-		}
-	}
-
-	return { totalRead, totalWritten, cost };
-}
-
 // =============================================================================
 // Provider Info
 // =============================================================================
@@ -320,7 +298,6 @@ export default function (pi: ExtensionAPI) {
 					const modelId = ctx.model?.id || "no-model";
 					const provider = getProviderName(ctx.model);
 					const modelName = getShortModelName(modelId);
-					const stats = getTokenStats(ctx);
 					const thinking = getThinkingInfo(pi);
 					const contextInfo = getContextInfo(ctx, autoCompactEnabled);
 
@@ -342,12 +319,6 @@ export default function (pi: ExtensionAPI) {
 						? theme.fg("accent", `${thinking.emoji} ${thinking.level}`)
 						: "";
 					
-					// Token stats: R11M W313k $5.289
-					const tokenStats = theme.fg(
-						"dim",
-						`R${formatNumber(stats.totalRead)} W${formatNumber(stats.totalWritten)} $${stats.cost.toFixed(3)}`
-					);
-					
 					// Context usage: 76.2%/200k (auto)
 					const contextText = contextInfo ? theme.fg("dim", contextInfo) : "";
 					
@@ -366,7 +337,7 @@ export default function (pi: ExtensionAPI) {
 						.map(([, val]: [string, string]) => val);
 
 					// Combine components with separators
-					// Format: 16:10  🖥️ kyushu  ~/s/home  main  google-vertex/sonnet-4.5  🧠 ext  R11M W313k $5.289  76.2%/200k (auto)  [extension statuses]
+					// Format: 16:10  🖥️ kyushu  ~/s/home  main  google-vertex/sonnet-4.5  🧠 ext  76.2%/200k (auto)  [extension statuses]
 					const components = [
 						timeText,
 						`${hostIcon} ${hostText}`,
@@ -375,7 +346,6 @@ export default function (pi: ExtensionAPI) {
 						modeText,
 						providerModel,
 						thinkingText,
-						tokenStats,
 						contextText,
 						...statusTexts, // Add extension statuses at the end
 					].filter(Boolean); // Remove empty strings
@@ -420,7 +390,6 @@ export default function (pi: ExtensionAPI) {
 					const modelId = ctx.model?.id || "no-model";
 					const provider = getProviderName(ctx.model);
 					const modelName = getShortModelName(modelId);
-					const stats = getTokenStats(ctx);
 					const thinking = getThinkingInfo(pi);
 					const contextInfo = getContextInfo(ctx, autoCompactEnabled);
 
@@ -442,12 +411,6 @@ export default function (pi: ExtensionAPI) {
 						? theme.fg("accent", `${thinking.emoji} ${thinking.level}`)
 						: "";
 					
-					// Token stats: R11M W313k $5.289
-					const tokenStats = theme.fg(
-						"dim",
-						`R${formatNumber(stats.totalRead)} W${formatNumber(stats.totalWritten)} $${stats.cost.toFixed(3)}`
-					);
-					
 					// Context usage: 76.2%/200k (auto)
 					const contextText = contextInfo ? theme.fg("dim", contextInfo) : "";
 
@@ -460,7 +423,7 @@ export default function (pi: ExtensionAPI) {
 						.filter(([key, val]: [string, string]) => key !== "mode" && key !== "mode-color" && Boolean(val))
 						.map(([, val]: [string, string]) => val);
 					// Combine components with separators
-					// Format: 16:10  🖥️ kyushu  ~/s/home  main  google-vertex/sonnet-4.5  🧠 ext  R11M W313k $5.289  76.2%/200k (auto)
+					// Format: 16:10  🖥️ kyushu  ~/s/home  main  google-vertex/sonnet-4.5  🧠 ext  76.2%/200k (auto)
 					const components = [
 						timeText,
 						`${hostIcon} ${hostText}`,
@@ -469,7 +432,6 @@ export default function (pi: ExtensionAPI) {
 						modeText,
 						providerModel,
 						thinkingText,
-						tokenStats,
 						contextText,
 						...statusTexts,
 					].filter(Boolean);