Skip to content

feat: add ModelIntelligence and ContextWindowSize widgets#248

Open
rdeknijf wants to merge 1 commit intosirmalloc:mainfrom
rdeknijf:feat/model-intelligence-context-window-widgets
Open

feat: add ModelIntelligence and ContextWindowSize widgets#248
rdeknijf wants to merge 1 commit intosirmalloc:mainfrom
rdeknijf:feat/model-intelligence-context-window-widgets

Conversation

@rdeknijf
Copy link
Copy Markdown

Summary

  • ContextWindowSize widget: Displays the total context window size (e.g. 200k, 1.0M) based on the active model. Uses existing model-context and context-window utilities.
  • ModelIntelligence widget: Shows a Model Intelligence (MI) score from 1.000 to 0.000 reflecting estimated model quality as the context fills. Formula: MI = max(0, 1 - u^β) with per-model β (Opus=1.8, Sonnet=1.5, Haiku=1.2), calibrated against Anthropic's MRCR v2 retrieval benchmark.

Both widgets support raw-value mode and color customization, and follow the existing widget patterns.

Credit

The MI concept and formula originate from cc-context-stats by @luongnv89.

Test plan

  • Verify context-window-size renders correctly with piped input for different models (with/without [1m] suffix)
  • Verify model-intelligence renders correct MI scores at various context fill levels
  • Verify both widgets appear in the TUI widget picker under the "Context" category
  • Verify raw-value mode works for both widgets
  • Run bun run lint and bun test — no regressions

🤖 Generated with Claude Code

Add two new context-awareness widgets:

- **ContextWindowSize**: Displays the total context window size
  (e.g. "200k", "1.0M") based on the active model, using the
  existing model-context and context-window utilities.

- **ModelIntelligence**: Shows a Model Intelligence (MI) score
  from 1.000 to 0.000 that reflects estimated model quality as
  the context window fills. Uses the formula MI = max(0, 1 - u^β)
  with per-model β values (Opus=1.8, Sonnet=1.5, Haiku=1.2),
  calibrated against Anthropic's MRCR v2 retrieval benchmark.

  MI concept and formula credit: luongnv89/cc-context-stats
  https://github.com/luongnv89/cc-context-stats

Both widgets support raw-value mode and color customization.
@rdeknijf rdeknijf marked this pull request as draft March 18, 2026 20:29
@rdeknijf rdeknijf marked this pull request as ready for review March 18, 2026 20:46
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.

2 participants