[GH-ISSUE #8583] [Feature]: Show estimated tokens per preset section and total in Sections header #8410

Closed
opened 2026-11-07 16:42:47 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @psych0genesis on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8583

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

The Preset Editor already shows estimated tokens inside an expanded section text editor, but its collapsed section rows do not display per-section counts, and the Sections panel has no aggregate total. With a modular preset containing many sections, users must expand each one and add estimates manually to understand its static prompt cost.

Proposed behavior

  1. Show approximate token counts on each section row, whether collapsed or expanded (e.g. ~420 tokens), without requiring the user to open the editor.
  2. Show an always-visible total at the top of the Sections panel, near Add Section and Groups, updating as sections change.
  3. Count enabled static section content in the primary total. Still show disabled sections' own estimates, with excluded/inactive styling.
  4. Clearly distinguish dynamic marker sections (World Info, Persona, Character Info, Chat Examples, Chat History, agents, etc.) from zero-token static sections. Their counts depend on the current chat and cannot be reliably inferred from the preset alone. Label these Dynamic or Varies by chat, and label the aggregate Enabled static preset: ~N tokens rather than claiming it represents the entire assembled prompt.
  5. Recalculate after edits, enabling/disabling, duplication, deletion, and reordering as appropriate, without refresh.
  6. Reuse Marinara's existing shared lightweight token estimator. No model calls or new tokenizer dependencies required. Mark estimates as approximate.
  7. Keep counts legible in responsive layouts, including narrow screens.

Illustrative layout

[+ Add Section] [Groups (0)]                Enabled static preset: ~2,830 tokens

Hyacinthe Core System                        ~590
World Info                                   Dynamic
Persona                                      Dynamic
Character Info                               Dynamic
Chat History                                 Dynamic
Hyacinthe Knowledge & Continuity Gate        ~710
Hyacinthe Companion                          ~390
Hyacinthe Response Style                     ~110
...

Acceptance criteria

  • Every text-containing non-marker section has a count visible while collapsed.
  • Enabled-static-section subtotal remains visible at the top.
  • Disabled sections are excluded from subtotal; their individual counts remain visible.
  • Dynamic markers are not treated as known zeroes or falsely included as resolved prompt totals.
  • All values update when content or enablement changes.
  • Estimates are labelled; the layout works on desktop and mobile.
  • Prompt assembly and generation behavior are unchanged.
  • #6161 standardized token estimates across prompt/context fields. The expanded section editor already uses MacroTextarea showTokenCount; this request specifically covers collapsed rows and aggregation.
  • #3840 concerns Peek Prompt inspection. This request concerns at-a-glance token budgeting in the preset editor, without opening the assembled-prompt viewer.
Originally created by @psych0genesis on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8583 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? The Preset Editor already shows estimated tokens inside an **expanded** section text editor, but its **collapsed section rows** do not display per-section counts, and the Sections panel has no aggregate total. With a modular preset containing many sections, users must expand each one and add estimates manually to understand its static prompt cost. ## Proposed behavior 1. Show approximate token counts on **each section row**, whether collapsed or expanded (e.g. `~420 tokens`), without requiring the user to open the editor. 2. Show an **always-visible total at the top** of the Sections panel, near **Add Section** and **Groups**, updating as sections change. 3. Count **enabled static section content** in the primary total. Still show disabled sections' own estimates, with excluded/inactive styling. 4. Clearly distinguish **dynamic marker sections** (World Info, Persona, Character Info, Chat Examples, Chat History, agents, etc.) from zero-token static sections. Their counts depend on the current chat and cannot be reliably inferred from the preset alone. Label these `Dynamic` or `Varies by chat`, and label the aggregate `Enabled static preset: ~N tokens` rather than claiming it represents the entire assembled prompt. 5. Recalculate after edits, enabling/disabling, duplication, deletion, and reordering as appropriate, without refresh. 6. Reuse Marinara's existing shared lightweight token estimator. No model calls or new tokenizer dependencies required. Mark estimates as approximate. 7. Keep counts legible in responsive layouts, including narrow screens. ## Illustrative layout ```text [+ Add Section] [Groups (0)] Enabled static preset: ~2,830 tokens Hyacinthe Core System ~590 World Info Dynamic Persona Dynamic Character Info Dynamic Chat History Dynamic Hyacinthe Knowledge & Continuity Gate ~710 Hyacinthe Companion ~390 Hyacinthe Response Style ~110 ... ``` ## Acceptance criteria - Every text-containing non-marker section has a count visible while collapsed. - Enabled-static-section subtotal remains visible at the top. - Disabled sections are excluded from subtotal; their individual counts remain visible. - Dynamic markers are not treated as known zeroes or falsely included as resolved prompt totals. - All values update when content or enablement changes. - Estimates are labelled; the layout works on desktop and mobile. - Prompt assembly and generation behavior are unchanged. ## Related issues - #6161 standardized token estimates across prompt/context fields. The expanded section editor already uses `MacroTextarea showTokenCount`; this request specifically covers **collapsed rows and aggregation**. - #3840 concerns Peek Prompt inspection. This request concerns **at-a-glance token budgeting in the preset editor**, without opening the assembled-prompt viewer.
bsakaguchi 2026-11-07 16:42:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8410
No description provided.