Skip to content

[Bug]: compact command drastically increases token count (56.9k to 1.1M) instead of reducing it #3064

@kwanLeeFrmVi

Description

@kwanLeeFrmVi

Bug Description

Description:

When running the /compact command to reduce the context size, the operation reports a successful reduction in messages, but the token counter in the status bar incorrectly spikes to an unexpectedly high number.

In my session, the token count went from 56.9k before compaction to 1.1M immediately after, despite the logs stating that the token context was reduced by 0.0%.

Steps to Reproduce:

Start a session and build up a moderate amount of context (e.g., ~56.9k tokens).

Run the /compact command in the prompt.

Observe the console output and the updated status bar.

Expected Behavior:

The token count in the status bar should either decrease or remain relatively stable, accurately reflecting the remaining context after older messages are compacted.

Actual Behavior:

The CLI outputs: [09:54:08] Context size reduced by 0.0% (tokens), 92.4% (messages)
However, the status bar indicator jumps from FORGE 56.9k to FORGE 1.1M, showing a massive and incorrect increase in the token count.

Image

Forge Version

2.11.3

Operating System & Version

macOs

AI Provider

z.ai

Model

glm-5.1

Installation Method

npm install -g forgecode

Configuration

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions