# Skill: Manage token usage and context window to control cost and prevent model memory loss > Lets an AI coding/design agent explain context-window limits, diagnose "model forgets things" complaints, and apply practical context hygiene to keep API costs and response quality under control; applies whenever designing prompts, managing long conversations, or auditing API spend. Source: sodigi·learn — models/kontekst-i-tokeny · https://sodigi.io/learn/models/kontekst-i-tokeny ## When to use - A user reports the model "forgot" something said earlier in a long conversation. - Debugging why a chat-based tool gets progressively worse or more expensive over time. - Designing a prompt that attaches large documents or long conversation history. - Estimating API cost before wiring up a chat or document-processing feature. ## Core rules - A token is a sub-word chunk (~4 characters or ~3/4 of a word in English). It is NOT a word and NOT a letter. - Non-English text uses noticeably more tokens than English for the same meaning -- budget accordingly. - The context window is the model's entire working memory: your question + conversation history + system prompt + the model's upcoming reply. Everything must fit. - When the window fills up, the oldest content silently falls off the edge -- the model does not warn you; it simply cannot see it. - You pay per token in two buckets: input (everything sent) and output (everything generated). Output tokens are usually priced higher than input. - Chat history is re-sent as input on every turn. A 100-message chat means you pay for the full history on message 101. - Requesting a long answer costs more than sending a long question, because output is priced higher. ## Procedure 1. Estimate token count before sending: word_count * 1.3 for English; multiply more generously for other languages. 2. Before attaching a document or history, ask: does the model actually need all of this for the current question? Remove what is not needed. 3. When a long conversation has accumulated, ask the model to summarize the agreed decisions, open a fresh chat, and paste only the summary. 4. To reduce output cost, ask explicitly for a shorter format ("bullet points only," "under 100 words") when detail is not required. 5. For recurring large inputs (a fixed system prompt, a knowledge base), check whether the provider supports prompt caching -- repeated input costs much less with caching enabled. 6. When a user complains the model "forgot" earlier context: diagnose whether the conversation simply exceeded the window; the fix is a fresh session with a carried-over summary, not re-prompting. 7. If writing in a language other than English and cost matters: the same request in English takes fewer tokens. ## Ready-to-use prompt ``` You are helping me manage a long conversation context. Please do the following: 1. Summarize the key decisions and facts established so far in this conversation in 5-10 bullet points. 2. Flag anything that is likely no longer relevant and can be dropped. 3. Produce a compact "context handoff" block I can paste into a fresh chat to continue working without losing what matters. Keep the handoff under 200 words. ``` ## Pitfalls - Assuming the model remembers everything from a previous session -- the context window is per-session; nothing carries over by default. - Treating one token as one word -- it is a chunk, often smaller; non-English text is especially token-heavy. - Pasting in large files or long history "just to be safe" -- every extra token costs money, slows responses, and increases the chance the model loses important information buried in the middle. - Forgetting that output costs more than input -- asking for a detailed wall-of-text answer when a concise reply would do is the fastest way to inflate the bill. - Staying in one chat for a full day or week -- the window eventually overflows and the model degrades; start a fresh chat for each new topic. - Assuming a bigger context window means better comprehension of long documents -- models are weakest at retrieving information from the middle of a large context; relevant material should be near the edges.