Advanced (Aktualisiert: 1.6.2026)

Kontextmanagement in Claude Code: /context, /compact, CLAUDE.md und Obsidian

Praktische Anleitung für fokussierte Claude-Code-Sitzungen mit /context, /compact, Memory und Notizen.

Kontextmanagement in Claude Code: /context, /compact, CLAUDE.md und Obsidian

Viele Claude-Code-Probleme entstehen nicht durch das Modell, sondern durch überfüllten Kontext. Kontextmanagement trennt aktuelle Arbeitsinformationen von dauerhaften Regeln und externen Notizen.

/context zeigt die Nutzung, /compact fasst zusammen, /clear startet neu und /memory prüft geladene Memory-Dateien.

Ziel ist eine fokussierte Hauptsitzung, während lange Recherche, rohe Notizen und alte Logs außerhalb des aktiven Fensters bleiben.

Think of the context window as the working desk

Das Kontextfenster enthält Verlauf, gelesene Dateien, Tool-Ausgaben, CLAUDE.md, auto memory, rules und skills. Wenn es voll wird, konkurrieren wichtige Regeln mit alter Ausgabe.

What enters contextWhy it gets heavyPractical response
ConversationLong discussion and side questsCut by task boundary
FilesReading huge files wholeSearch first, then read narrow ranges
Tool outputLong logs and repeated failuresSummarize into a note
MemoryOversized CLAUDE.mdMove details to rules or docs

Use /context, /compact, /clear, and /memory differently

/context zeigt Nutzung. /compact fasst zusammen und setzt fort. /clear passt bei echter Aufgabengrenze. /memory zeigt CLAUDE.md und auto memory.

/context all
/compact focus on files changed, failing tests, and next command
/clear
/memory

Set a context budget before the task

Vor dem Start: Ziel, Scope, Nicht-Scope, Done-Kriterien und Prüfkommandos nennen. Nicht das ganze Repo lesen lassen, wenn rg und wenige Dateien reichen.

# narrow discovery before asking Claude to read files
rg -n "getUserById|User not found|auth middleware" src tests
git diff --stat
npm test -- --runInBand

Copy-paste runbook for long work

Dieses Runbook hilft bei Refactor, Security Fix, langem Artikel und Conversion Experiment. Es hält die Sitzung klein und hinterlässt einen Beleg.

## Task brief
- Objective:
- In scope:
- Out of scope:
- Files likely involved:
- Done when:
- Verification commands:

## Handoff receipt
- Changed files:
- Commands run:
- Result:
- Remaining risk:
- Next best action:

What survives compaction

Nach /compact kommen Root-CLAUDE.md und auto memory zurück. Verschachtelte Dateien und Pfadregeln kommen erst nach passendem File-Read zurück.

# CLAUDE.md

## Compact Instructions
- Keep the current business objective and monetization hypothesis.
- Keep changed files, verification commands, deploy state, and blockers.
- Drop raw logs unless a line explains the root cause.
- If article work is in progress, preserve slug, locale list, and quality gaps.

Three use cases: code, content, conversion

  1. Bei großem Refactor breite Recherche an Subagent oder separate Sitzung geben.
  2. Beim Publishing: Rohrecherche in Obsidian, Redaktionsregeln in CLAUDE.md, finales MDX im Repo.
  3. Bei Conversion: Metrik, Hypothese, Änderung und Ergebnis als kleines Ticket speichern.

Common failures and fixes

  1. /compact ist kein vollständiges Backup, sondern eine Zusammenfassung. Dauerhafte Regeln gehören in Dateien.
  2. Nach großer Discovery zuerst in eine kurze Notiz komprimieren, dann implementieren.
  3. Auto memory ist keine Teamdokumentation. Gemeinsame Regeln gehören in versioniertes CLAUDE.md.

How Obsidian fits in

This workflow works with CLAUDE.md best practices, token optimization, prompt engineering, and Obsidian workflow. Team setup can start from consultation page.

PlaceBest information
CLAUDE.mdShort rules needed every session
ObsidianLong research, hypotheses, article ideas
MDX / docsPublished content, specs, handoff notes
Auto memoryLocal preferences and repeated learnings

What was verified

Der Artikel wurde anhand offizieller context window, commands und memory Dokumente aktualisiert. Official references: context window, commands, memory, and common workflows.

#claude-code #Kontextverwaltung #Token-Optimierung #Produktivität
Kostenlos

Kostenloses PDF: Claude-Code-Cheatsheet

E-Mail eintragen und eine Seite mit Befehlen, Review-Gewohnheiten und sicheren Workflows herunterladen.

Wir schützen Ihre Daten und senden keinen Spam.

Masa

Über den Autor

Masa

Engineer für praktische Claude-Code-Workflows und Team-Einführung.