From 31302961e25e242edc783b5943291fea8398fee7 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 2 Apr 2026 23:07:42 -0400 Subject: [PATCH] estimate prompt tokens on restore so status bar isn't 0K After restore_from_log + compact, set last_prompt_tokens from the budget's used() count instead of waiting for the first API call. Co-Authored-By: Proof of Concept --- src/agent/runner.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/agent/runner.rs b/src/agent/runner.rs index d9cece5..c584657 100644 --- a/src/agent/runner.rs +++ b/src/agent/runner.rs @@ -1003,6 +1003,9 @@ impl Agent { all.len(), mem_count, conv_count); self.context.entries = all; self.compact(); + // Estimate prompt tokens from budget so status bar isn't 0 on startup + let b = self.budget(); + self.last_prompt_tokens = b.used() as u32; true }