Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Using Context and Tokens Effectively | Section
Introduction to Claude Code

Using Context and Tokens Effectively

Pyyhkäise näyttääksesi valikon

Context is the information Claude can access when deciding how to respond. It can include conversation messages, project instructions, skills, tools, memory files, and other resources. Managing this context helps Claude stay focused and produce more reliable results.

Claude Desktop displays context usage through an indicator in the bottom-right corner. As the conversation grows, the indicator changes colour to show that more of the available context window is being used.

A large context window does not always produce better results. Long conversations give Claude more information to process, which can make it harder to identify what is currently important. For focused tasks, shorter sessions often lead to clearer and more accurate output.

When a conversation becomes too long, use the /compact command. It summarizes the existing session while preserving essential project information so you can continue working with a smaller context. You can also give the command a specific focus, such as:

/compact Focus on the API changes.

Instructions mentioned only in the conversation may be lost during compaction, so important long-term requirements should be stored in project files such as CLAUDE.md.

The /clear command removes the current conversation context completely. However, starting a new session is often more useful because it preserves the original conversation in case you need to return to it later.

Context management is also connected to token usage. Clear prompts can prevent Claude from completing unnecessary work or moving in the wrong direction. This is especially important when starting a project or assigning a large task, where a small misunderstanding could waste significant time and usage.

You do not need to make every prompt perfect. Focus on being especially specific when a prompt will influence a large amount of work. Monitor context usage, compact long conversations when necessary, and begin new sessions for unrelated tasks.

question mark

What does the /compact command do?

Valitse oikea vastaus

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 8

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Osio 1. Luku 8
some-alt