Zurück zu PodcastsClaude
Claude Code 101
Kontextverwaltung in Claude Code
is Claw's working memory.
ist das Arbeitsgedächtnis von Claude.
Every file it reads, every command it runs, every message you send, it all takes up space in the context window.
Jede Datei, die es liest, jeder Befehl, den es ausführt, jede Nachricht, die Sie senden - all das beansprucht Platz im context window.
Think of the context window as the amount of space that Claude could hold in his memory.
Stellen Sie sich das context window als die Menge an Platz vor, die Claude in seinem Gedächtnis halten kann.
Whenever you enter a prompt, Claude reads a file, runs a tool call, gets a tool call result.
Jedes Mal, wenn Sie einen Prompt eingeben, liest Claude eine Datei, führt einen Tool-Aufruf aus, erhält ein Tool-Aufruf-Ergebnis.
This is added on to the context window.
Dies wird zum context window hinzugefügt.
And since there's only a finite amount you can put in the context window, it becomes extremely important to optimize this as much as possible.
Und da es nur eine endliche Menge gibt, die Sie in das context window einsetzen können, wird es extrem wichtig, dies so weit wie möglich zu optimieren.
Now, when you approach this limit, the context window is automatically compacted.
Wenn Sie sich diesem Limit nähern, wird das context window automatisch compact.
Compaction will summarize important details and remove the unnecessary tool call results and free up a lot of space in your context window.
Compact fasst wichtige Details zusammen und entfernt die unnötigen Tool-Aufruf-Ergebnisse und gibt viel Platz in Ihrem context window frei.
Do note though that this could potentially lose details in your previous conversation.
Beachten Sie jedoch, dass dies möglicherweise Details aus Ihrem vorherigen Gespräch verlieren könnte.
You can run the compaction manually as well with the /compact command.
Sie können die Kompaktierung auch manuell mit dem /compact-Befehl ausführen.
This will compact everything that you've done up to that point, which could be handy if you want to clear up context space, but also have a memory of what you previously worked on.
Dadurch wird alles, was Sie bis zu diesem Punkt getan haben, kompaktiert, was praktisch sein kann, wenn Sie Kontext-Speicherplatz freigeben möchten, aber auch eine Erinnerung an das haben möchten, woran Sie zuvor gearbeitet haben.
If you want to completely start from scratch without memory of what was previously worked on, you can also run /cle and that will remove everything starting from scratch.
Wenn Sie völlig von vorne beginnen möchten, ohne Erinnerung an das, woran zuvor gearbeitet wurde, können Sie auch /clear ausführen, was alles entfernt und von vorne beginnt.
To check the state of your context, run the /context command.
Um den Zustand Ihres Kontexts zu überprüfen, führen Sie den /context-Befehl aus.
Here you'll get a big picture of how large your context size is, the different categories that are taking up the most context, and a graphic showing you all of this.
Hier erhalten Sie ein Gesamtbild davon, wie groß Ihr Kontext ist, die verschiedenen Kategorien, die den meisten Kontext beanspruchen, und eine Grafik, die Ihnen all dies zeigt.
A general rule of thumb is when you're working on a specific feature and are going over the context window, but need to continue, then compact.
Eine allgemeine Faustregel ist, dass Sie compact verwenden sollten, wenn Sie an einer bestimmten Funktion arbeiten und das context window überschreiten werden, aber fortfahren müssen.
Keeping the context relevant for this feature is important when continuing development.
Den Kontext für diese Funktion während der weiteren Entwicklung relevant zu halten, ist wichtig.
If you have finished the plan and want to start on a new feature, then clear.
Wenn Sie den Plan abgeschlossen haben und mit einer neuen Funktion beginnen möchten, verwenden Sie clear.
You don't want the previous conversation to present bias in anything new that you want to create.
Sie möchten nicht, dass das vorherige Gespräch in allem, was Sie neu erstellen möchten, eine Verzerrung erzeugt.
For things that you do want Claude to remember in other sessions, put it in the claw.md file.
Für Dinge, die Claude in anderen Sitzungen erinnern soll, fügen Sie diese in die claude.md-Datei ein.
That way, it doesn't have to rediscover things from scratch all over again.
Auf diese Weise muss es die Dinge nicht jedes Mal von Grund auf neu entdecken.
Be specific.
Seien Sie spezifisch.
The irony behind writing a smaller prompt is that it in the long run, it will take up more context.
Die Ironie beim Schreiben eines kürzeren Prompts ist, dass es langfristig mehr Kontext beansprucht.
Without being explicit, Claude is forced to look around your codebase more and do its own thinking, which takes up a lot more context.
Ohne explizit zu sein, ist Claude gezwungen, in Ihrer Codebase herumzusuchen und eigenes Denken anzuwenden, was viel mehr Kontext in Anspruch nimmt.
window space than if you were just a little bit more clear with a sentence or two.
Fensterfläche als wenn Sie mit einem oder zwei Sätzen etwas klarer gewesen wären.
MCP servers load all of the tools available into context by default.
MCP-Server laden standardmäßig alle verfügbaren Tools in den Kontext.
So, if you have a lot of MCP servers for things that are unrelated to the project, it might be worth turning them off.
Wenn Sie also viele MCP-Server für Dinge haben, die nichts mit dem Projekt zu tun haben, könnte es sich lohnen, diese abzuschalten.
You can also try out skills, which works similarly to MCP servers, but doesn't put the entire thing into context, saving you space.
Sie können auch skills ausprobieren, die ähnlich wie MCP-Server funktionieren, aber nicht alles in den Kontext laden, was Ihnen Platz spart.
Sub agents run in parallel with your main agent but has a complete separate context window.
Sub agents laufen parallel zu Ihrem Haupt-Agent, haben aber ein vollständig separates context window.
So for tasks that require an answer without the journey like where is the authentication endpoints located, you can have the sub agent do the work and return just a summary to your main agent.
Für Aufgaben, die eine Antwort ohne den Prozess erfordern, wie zum Beispiel wo sich die Authentifizierungs-Endpoints befinden, können Sie den sub agent die Arbeit erledigen lassen und nur eine Zusammenfassung an Ihren Haupt-Agent zurückgeben.
Managing context within cloud code is crucial.
Das Verwalten von Kontext in Claude Code ist entscheidend.
Use slash compact to summarize long sessions and slashclear to start fresh.
Verwenden Sie /compact, um lange Sitzungen zusammenzufassen, und /clear, um neu zu beginnen.
To use your context window effectively, be specific with what you want.
Um Ihr context window effektiv zu nutzen, seien Sie spezifisch mit dem, was Sie möchten.
Check what's using your current context window and use sub agents to delegate tasks you only need the answer for.
Überprüfen Sie, was Ihr aktuelles context window verwendet, und verwenden Sie sub agents, um Aufgaben zu delegieren, für die Sie nur die Antwort benötigen.