# thariq-claude-code-session-management-1m-context-2026-04-14

## Veille

Claude Code Session Management: 1M Token Context Window, Compaction, Rewind, Subagents, and Context Rot

## Titre Article

Using Claude Code: Session Management & 1M Context

## Date

2026-04-14

## URL

https://x.com/trq212/status/2044548257058328723

## Keywords

Claude Code, session management, context window, 1 million tokens, compaction, rewind, subagents, context rot, context rot, context pollution, best practices, coding agent productivity

## Authors

Thariq (@trq212)

## Ton

**Profile**: Anthropic engineer's perspective, practical technical register, intermediate level. Thariq writes as a practitioner sharing lessons drawn from conversations with users.

**Description**: The tone is that of a conversational, direct, and accessible practical guide. The author draws on field experience ("in my recent calls with Claude Code users") to structure concrete advice. The style is didactic without being condescending, alternating between concept explanations (context rot, compaction) and actionable recommendations (when to use rewind vs compact vs clear). The examples are concrete and drawn from real use cases (debugging, documentation, auth refactoring). The target audience consists of Claude Code users who want to optimize their daily workflow. The tone remains nuanced, acknowledging gray areas and trade-offs rather than imposing rigid rules.

## Pense-betes

- **1M-token context window**: everything the model can "see" at once (system prompt, conversation, tool calls, outputs, files read). Double-edged sword: more autonomy but risk of context pollution
- **Context rot**: performance degradation as context grows, attention dilutes across too many tokens. For the 1M model, starts appearing around ~300-400k tokens, but depends heavily on the task
- **Compaction**: automatic summarization of the conversation when approaching the end of the window. Can be triggered manually. Lossy by nature (the model is trusted to decide what to keep)
- **5 options at each turn**: Continue, /rewind (esc esc), /clear, /compact, subagents. The most natural is to continue, but the other 4 exist to manage context
- **Golden rule**: new task = new session. Gray area for related tasks (e.g., documenting a feature just implemented)
- **Rewind = the best habit**: "If I had to pick one habit that signals good context management, it's rewind." Double-tap Esc to go back to a previous message and re-prompt with what was learned, rather than correcting by accumulating context
- **"Summarize from here"**: have Claude summarize its learnings as a handoff message from its future self to its past self
- **Compact vs Clear**: /compact = automatic summary (lossy but exhaustive), /clear = manual summary (more work but exactly the context you want). Compact can be guided: "/compact focus on the auth refactor, drop the test debugging"
- **Poor compactions**: occur when the model cannot predict the direction of the work. Particularly problematic since the model is at its least intelligent point (context rot) at the moment of compacting. With 1M tokens, there is more time to /compact proactively
- **Subagents = context management**: delegate a block of work to an agent with its own clean context. Mental test: "will I need this intermediate result, or just the conclusion?" Examples: verifying a result, reading another codebase, writing documentation
- **Claude Code will automatically call subagents**, but it can be explicitly asked to do so for specific cases

## RésuméDe400mots

Thariq, an engineer at Anthropic, shares a practical guide to session management in Claude Code with the one-million-token context window. His observations come from recent conversations with Claude Code users.

The **context window** is everything the model can see simultaneously: system prompt, conversation, tool calls, and files read. **Context rot** refers to the performance degradation that occurs as context grows, with attention diluting across too many tokens. For the 1M model, this degradation typically begins around 300-400k tokens, depending on the task. **Compaction** is the summarization mechanism that replaces history with a synthesis when approaching the limit.

At the end of each turn, the user has five options: continue in the same session, **rewind** (return to a previous message), **/clear** (clean session), **/compact** (summarize and continue), or **subagents** (delegate with a clean context). The general rule is to start a new session for each new task, with a gray area for related tasks.

**Rewind** is identified as the best context-management habit. Rather than correcting by accumulating noise ("that didn't work, try X"), it is better to go back to the point right after the file reads and re-prompt with the lessons learned: "Don't use approach A, the foo module doesn't expose it — go straight to B." The "summarize from here" function makes it possible to create a handoff message, like a message from Claude's future self to its past self.

The difference between **/compact** and **/clear** is significant. Compact is automatic and potentially more exhaustive but lossy — the model is trusted to decide what to keep. Clear requires the user to articulate what matters and starts fresh. Compact can be guided with specific instructions. Poor compactions occur when the model cannot anticipate the direction of the work, which is particularly problematic since it is at its least intelligent point at the moment of compacting.

**Subagents** are a context-management tool for work blocks that generate a lot of intermediate output. The mental test: "will I need this output, or just the conclusion?" Claude can be explicitly asked to delegate to a subagent to verify a result, read another codebase, or write documentation. The author concludes that these mechanisms will eventually be handled automatically by Claude, but for now session management remains a key user skill.

## GrapheDeConnaissance

- Thariq —publie→ Guide gestion sessions Claude Code 1M (DOCUMENT, 0.99)
- Thariq —travaille_chez→ Anthropic (ORGANISATION, 0.9)
- Claude Code —utilise→ Fenêtre de contexte de 1 million de tokens (CONCEPT, 0.98)
- Context rot —réduit→ Performance du modèle (CONCEPT, 0.95)
- Thariq —mesure→ Apparition du context rot vers 300-400k tokens sur le modèle 1M (MESURE, 0.85)
- Compaction —réduit→ Historique de conversation (CONCEPT, 0.95)
- Thariq —recommande→ Rewind (CONCEPT, 0.92)
- Subagents —permet→ Contexte propre isolé (CONCEPT, 0.93)
- Compact —s_oppose_à→ Clear (CONCEPT, 0.88)
- Thariq —affirme_que→ Les mauvaises compactions surviennent quand le modèle ne peut pas prédire la direction du travail (AFFIRMATION, 0.85)

---
Canonical: https://www.thekb.eu/en/fiches/thariq-claude-code-session-management-1m-context-2026-04-14/
