Skip to content

feat(compaction): add a metric selector for composable sub-values#457

Open
zachthedev wants to merge 1 commit into
sirmalloc:mainfrom
zachthedev:feat-compaction-metric-selector
Open

feat(compaction): add a metric selector for composable sub-values#457
zachthedev wants to merge 1 commit into
sirmalloc:mainfrom
zachthedev:feat-compaction-metric-selector

Conversation

@zachthedev

Copy link
Copy Markdown
Contributor

Closes #450

compaction-counter only emitted the full composite line (↻ N (a auto, b manual) ↓X). This adds a metric selector so a single instance can emit one raw value:

  • count (default): unchanged composite display.
  • auto / manual / unknown: that trigger's count as a bare integer.
  • reclaimed: reclaimed tokens via formatTokens.

Several instances then compose with custom-symbol separators/glyphs into a custom layout instead of the built-in format, e.g. 2 · 1a 1m · ↓2M. This follows the existing metadata-mode precedent (skills mode, context-bar display) rather than adding separate widget types, which keeps the niche per-trigger values out of the widget picker. Cycled with (m) in the editor; in metric mode the format/glyph/trigger binds collapse to metric + hide-zero, and hideZero applies to the selected value (so a 0 auto widget can hide). Default behavior is unchanged (backward compatible).

Coordination with #430 (unified hideable states): both PRs touch this widget's hide-zero handling, so whichever lands second needs a small reconciliation. This PR adds per-metric hide-zero via the current hideZero flag; #430 migrates that flag to the unified hideable system. If #430 merges first, the metric hide-zero here should move to its isHidden() API; if this merges first, #430's CompactionCounter conversion should cover the new metric mode and its per-metric hide-zero. (Cleanly hiding a zero sub-value without orphaning its separator ultimately depends on #430.)

Tests: added metric render/preview/hide-zero/editor/keybind/cycle cases and updated the count-mode keybind assertions for the new (m) bind. bun run lint clean; bun test green (1563/1563).

compaction-counter only emitted the full composite line. A new `metric` metadata selector (count|auto|manual|unknown|reclaimed) makes one instance emit a single raw value, so several can be composed with custom separators/symbols, following the existing skills `mode` / context-bar `display` metadata-mode precedent. Default `count` keeps the composite display unchanged; sub-metrics render a bare number (reclaimed via formatTokens) and respect hideZero on the selected value.

Closes sirmalloc#450

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compaction-counter: expose count/auto/manual/unknown/reclaimed as selectable raw values for composition

1 participant