@@ -79,6 +79,7 @@ const Tui = struct {
7979 phase: agent.Phase = .idle,
8080 detail: ?[]const u8 = null,
8181 writing_tool: ?[]const u8 = null,
82+ writing_bytes: usize = 0,
8283 active: bool = false,
8384 paused: bool = false,
8485 pause_requested: std.atomic.Value(bool) = std.atomic.Value(bool).init(false),
@@ -209,7 +210,11 @@ const Tui = struct {
209210 const label = switch (self.phase) {
210211 .preparing => "preparing",
211212 .waiting_model => "waiting for provider",
212- .streaming => if (self.writing_tool) |w| std.fmt.allocPrint(self.s, "writing {s}", .{w}) catch "streaming" else "streaming",
213+ .streaming => if (self.writing_tool) |w| blk: {
214+ if (self.writing_bytes == 0) break :blk std.fmt.allocPrint(self.s, "writing {s}", .{w}) catch "streaming";
215+ const tokenest = (self.writing_bytes + 3) / 4;
216+ break :blk std.fmt.allocPrint(self.s, "writing {s} · ~{s} tok", .{ w, usage_mod.formatTokens(self.s, tokenest) }) catch "streaming";
217+ } else "streaming",
213218 .running_tool => std.fmt.allocPrint(self.s, "running {s}", .{self.detail orelse "tool"}) catch "running tool",
214219 else => "idle",
215220 };
@@ -320,7 +325,11 @@ const Tui = struct {
320325 .summary = tool_view.callSummary(self.a, tc.name, tc.arguments),
321326 }) catch {};
322327 },
323- .tool_call_start => |name| self.keepName(&self.writing_tool, name),
328+ .tool_call_start => |name| {
329+ self.keepName(&self.writing_tool, name);
330+ self.writing_bytes = 0;
331+ },
332+ .tool_args => |n| self.writing_bytes = n,
324333 .tool_output => |chunk| self.activity.feed(chunk),
325334 .message => |am| self.commitMessage(am),
326335 .tool_result => |tr| {