Skip to content

feat: make context window size model-aware#151

Open
tylergraydev wants to merge 1 commit into
mainfrom
tylergraydev/model-aware-context-window
Open

feat: make context window size model-aware#151
tylergraydev wants to merge 1 commit into
mainfrom
tylergraydev/model-aware-context-window

Conversation

@tylergraydev

Copy link
Copy Markdown
Owner

Summary

  • Adds src/lib/models.ts with model context window lookup (opus → 1M, sonnet → 200k, etc.)
  • ContextUsageIndicator now accepts a model prop and computes the correct context window dynamically
  • ContextBreakdownPopover receives contextWindowTokens as a prop instead of importing a hardcoded constant
  • Composer passes the selected model through so the ring updates reactively when switching models
  • Also includes the prior contextId rename (was workspaceId) so the popover works for repos too

Test plan

  • npx vitest run src/lib/models.test.ts — new tests pass
  • npx vitest run src/components/chat/ContextBreakdownPopover.test.tsx — updated tests pass
  • npx vitest run src/components/chat/Composer.test.tsx — existing tests pass (140/140)
  • Manual: select Opus → ring shows usage out of 1M; switch to Sonnet → shows /200k

🤖 Generated with Claude Code

The context usage ring and breakdown popover now dynamically adjust
based on the selected model. Opus shows usage out of 1M tokens,
Sonnet/Haiku out of 200k, etc. Previously hardcoded to 200k for all
models.

Co-Authored-By: Claude Opus 4.6 (1M context) <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.

1 participant