From c4d8662de858a6f8b9c80757f653cafbd9f45736 Mon Sep 17 00:00:00 2001 From: Arnold Wender Date: Sun, 12 Apr 2026 01:16:34 +0200 Subject: [PATCH] fix: correct token count estimate in compress summary (#609) --- mempalace/cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mempalace/cli.py b/mempalace/cli.py index d6b1e0a..1b59f0b 100644 --- a/mempalace/cli.py +++ b/mempalace/cli.py @@ -386,8 +386,9 @@ def cmd_compress(args): # Summary ratio = total_original / max(total_compressed, 1) - orig_tokens = Dialect.count_tokens("x" * total_original) - comp_tokens = Dialect.count_tokens("x" * total_compressed) + # Estimate tokens from char count (~3.8 chars/token for English text) + orig_tokens = max(1, int(total_original / 3.8)) + comp_tokens = max(1, int(total_compressed / 3.8)) print(f" Total: {orig_tokens:,}t -> {comp_tokens:,}t ({ratio:.1f}x compression)") if args.dry_run: print(" (dry run -- nothing stored)")