Skip to content

[BUG] Remove misleading Token Composition from analysis exports #45

Open

Description

@Wikijito7

Describe the bug
Analysis exports contain a Token Composition section that only reports tool-definition and synthetic-content tokens. It is not a complete composition of the estimated total, but its placement and wording make it appear to be a full breakdown.

Observed output:

## Token Composition

Tool definitions: 12,559 tokens
Synthetic content: 0 tokens

The same export reports:

Estimated total: 136,228 tokens

| Category | Tokens | % |
| --- | ---: | ---: |
| TOOLS | 112,383 | 82.5% |
| TOOL DEFS | 12,559 | 9.2% |
| SYSTEM - server | 6,088 | 4.5% |
| REASONING | 4,184 | 3.1% |
| ASSISTANT | 643 | 0.5% |
| USER | 371 | 0.3% |

The category rows sum to the estimated total, while Token Composition does not.

To Reproduce

  1. Open a session with /analyze.
  2. Export the analysis as Markdown or plain text.
  3. Find the Token Composition section before the raw system prompt and raw tool definitions.
  4. Compare its values with Estimated total and the category table.

Expected behavior
The export should not present a partial metadata summary as a complete token composition. Remove the redundant Token Composition section and keep the authoritative category breakdown, which already includes TOOL DEFS and SYNTHETICS when applicable. Raw system and raw tool-definition sections should remain unchanged.

If the section is retained instead, it must be clearly renamed as metadata and must not imply that its values sum to the estimated total.

Media

Additional context
The serializer currently emits toolDefsTokens and syntheticTokens only. It omits tools, system, reasoning, assistant, and user categories. Add regression coverage ensuring exported category totals equal estimatedTotal.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions