Skip to content

Context Window

Manage the context window and conversation length.

TurboDev tracks token usage in real-time and displays it in the status bar. When the context window fills up, auto-compaction keeps the conversation going.

Token Usage

The status bar shows a token indicator like 1.24K/128K:

  • Left value — Estimated tokens used (including system prompt, conversation history, and tool results)
  • Right value — Maximum context length for the current model
  • Progress bar — Visual ████░░░░░░ indicator showing usage at a glance
  • Percentage — Numeric percentage (e.g. 12%)

Example: ████░░░░░░ 1.24K/128K 12%

Color Coding

ColorUsageBehavior
GreenBelow 50%Normal operation
Yellow50%–75%Warning — consider compacting
RedAbove 75%Auto-compaction triggers at 85%

Auto-Compaction

When token usage reaches 75%, TurboDev notifies you. At 85%, the conversation is automatically compacted:

  1. The full conversation is sent to the LLM
  2. The LLM generates a concise summary
  3. The conversation is replaced with the summary
  4. You can continue chatting normally

The summary preserves key decisions, code changes, and context needed for the ongoing task.

Manual Compaction

Use /compact at any time to manually trigger compaction:

/compact

This is useful when:

  • You want to free up context before a complex task
  • The conversation has drifted and you want a clean slate
  • You're approaching the context limit and want to compact on your terms

How Tokens Are Counted

TurboDev estimates tokens at approximately 4 characters per token. This is a close approximation for most LLM models. The count includes:

  • System prompt — Agent instructions, tool definitions, AGENTS.md content
  • Conversation history — All user and assistant messages
  • Tool results — Output from file reads, bash commands, etc.

The token count is displayed immediately on startup (system prompt only) and updated after every message exchange.

Cost Tracking

TurboDev fetches per-token pricing from OpenRouter and calculates the real-time cost:

  • Input tokens — Tokens sent to the model (system prompt + history + new message)
  • Output tokens — Tokens generated by the model (response)
  • Cost formula(inputTokens × promptPrice) + (outputTokens × completionPrice)

The cumulative cost is shown in the status bar (e.g., $0.0023) and persisted with the session.

Back to Usage