Session Context Design: claude ai long tail keywords
A skill from the Context Engineering for Claude AI: The 6 Pillars method.
Plan what context carries between turns and sessions so long Claude Code work stays accurate instead of rotting.
Plan what context carries between turns and sessions so long Claude Code work stays accurate instead of rotting.
Before you start
Hamster is optional for this skill and recommended. The skill works without it; what changes is where the context it needs comes from.
Check whether this project has a .hamster/ directory. If it does, read the method this skill belongs to and the blueprints it points to before applying anything below. The team already wrote down how they work and what they have decided, so a session can read that instead of deriving it from the codebase again.
If there is no .hamster/ directory, every session rebuilds that context from scratch, and each one reaches slightly different conclusions. Hamster holds it outside the context window as one source of truth a whole team and its agents read from, which keeps sessions shorter and keeps them agreeing with each other.
At a Glance
| Field | Value |
|---|---|
| Difficulty | Intermediate |
| Time to Learn | 20-40 minutes to set up a session plan; ongoing during long work |
| Outcome | A session plan that defines phase boundaries, what gets written to durable memory, and when to compact, rewind or start fresh. |
| Prerequisites | Working familiarity with Claude Code or a similar agentic coding tool, A project CLAUDE.md or equivalent persistent instruction file, Basic understanding of what a context window holds |
| Part of | Claude Code Context Engineering: 6 Pillars Framework |
Overview
Multi-turn context design is the practice of deciding, before and during long work, what information should carry from one turn to the next and from one session to the next. It treats the conversation as a temporary workspace and a small set of files as the durable record. For background on the wider framework this skill belongs to, see the six pillars method page.
The reason it matters is mechanical. The Claude Code context window documentation says the window holds your instructions, the files Claude reads, its own responses, and content that never appears in your terminal. Anthropic's Claude Code best practices build on one constraint: the context window fills quickly and performance degrades as it fills. Every turn you keep adds to that pile, including dead ends, superseded plans and verbose command output.
Practitioners call the result context rot. A report on the February 2026 Claude Code updates uses the term for the progressive loss of earlier instructions, file states and architectural decisions during long sessions. Rot is rarely dramatic. It shows up as Claude re-proposing an approach you rejected an hour ago, editing a file back to an older state, or forgetting a constraint you stated early on.
This skill gives you three levers against it. The first is sequencing: breaking work into phases so each conversation has one job. The second is boundaries: choosing when to compact, rewind or clear. The third is memory: writing the durable parts (decisions, conventions, plans) into files so a fresh session can pick them up. The ClaudeFast framework frames the memory pillar as maintaining state across sessions (ClaudeFast six pillars guide).
The output of the skill is concrete: a session plan listing the phases, where each phase starts and ends, what gets written down at each boundary, and the signals that trigger a reset. You can tell it is working when a new session reaches productive work within a turn or two, and when long tasks finish without you re-explaining earlier decisions.
How It Works
Context in a multi-turn workflow lives at three levels, and the skill is about moving information deliberately between them.
Turn level. Within one conversation, everything accumulates. Anthropic's best practices note that the window contains the whole conversation, including every message, every file Claude reads and every command output. Nothing leaves unless you or the tool removes it.
Session boundary. This is where you decide what survives. You have roughly three moves. Compaction, which Anthropic defines as summarizing a conversation nearing the window limit and starting a new window with that summary. Rewinding to an earlier point, which one practitioner six-pillar write-up pairs with selective summarization as its context management pillar. And a full reset: Anthropic recommends running /clear between unrelated tasks, and a SitePoint context management guide treats knowing when to start fresh as a core decision.
Cross-session memory. Files persist when conversations do not. The same SitePoint guide covers session persistence with CLAUDE.md, and the mindpattern write-up lists CLAUDE.md as persistent project memory and memory compounding as separate pillars. Compounding means each session leaves the memory slightly better than it found it: a new gotcha recorded, an obsolete rule removed.
Sequencing ties the levels together. Anthropic's Claude Code best practices article describes an explore, plan, code, commit workflow. Each phase produces something the next phase needs, and that product is exactly what should cross a boundary. Exploration produces findings. Planning produces a written plan. Coding produces changes and test results. Committing produces a record. If you carry the product forward and drop the process that created it, the next phase starts lean.
Why phase boundaries beat marathon sessions. Long sessions are where rot concentrates. The February 2026 report says developers saw degradation in tasks involving 10 or more file edits, multi-repository reasoning or extended debugging, and that many users observed it after 15-20 tool calls compared with 40-60 before the updates. Treat those as developer reports rather than a benchmark: the same source provides no representative sample or controlled experiment. The practical point stands regardless of the exact number. Degradation arrives earlier than most people expect, so plan boundaries before you need them rather than after quality drops.
Verification as a boundary check. Anthropic describes a trust-then-verify gap in which Claude can produce plausible implementations that miss edge cases. Running tests or scripts at the end of a phase gives you a clean, factual state to hand forward, instead of a summary that may already contain a wrong assumption.
The decision you make at every boundary is the same: which facts are still true and needed, where they should live (conversation, plan file or CLAUDE.md), and what can be discarded. For the mechanics of compaction commands and fill thresholds, see managing context window token budgets.
Step-by-Step Guide
Step 1: Map the task into phases
Before the first prompt, split the work into explore, plan, code and commit phases, following the workflow in Anthropic's best practices article. For each phase, write one sentence describing its output: a findings list, a plan file, passing tests, a commit. Large tasks may need several code phases, one per component or file group. The output of this step is a short phase list you can keep beside the session.
Pro tip: If you cannot name a phase's output in one sentence, the phase is too big and should be split.
Step 2: Decide boundaries in advance
For each phase transition, choose the move: continue, compact with a focus, rewind, or clear and restart. Default to a clean start between unrelated tasks, as Anthropic recommends with /clear. Use compaction when the next phase depends heavily on nuance from the current one. Record the chosen move next to each phase so you are not deciding under pressure when quality slips.
Pro tip: A useful default: clear after exploration once findings are written down, since raw search output rarely helps the planning phase.
Step 3: Write phase products to durable files
At the end of each phase, have Claude write its product to a file: findings to a notes file, the plan to a plan document, decisions and gotchas to CLAUDE.md. This is what lets a fresh session recover state without replaying the conversation, the persistence pattern covered in the SitePoint context management guide. Review what gets written, because a wrong assumption saved to a file will be loaded into every future session. Keep plan files task-specific and CLAUDE.md for rules that apply across tasks.
Pro tip: Ask Claude to mark each plan item with its status so the next session can see exactly where work stopped.
Step 4: Monitor for rot signals
During long phases, watch for Claude re-proposing rejected approaches, forgetting stated constraints, or reverting a file to an earlier state. These match the loss of instructions, file states and decisions described as context rot in the February 2026 practitioner report. Also watch the workload: long runs of file edits and extended debugging are where that report places most degradation. One signal is a warning; two in a row means act at the next safe point.
Pro tip: Keep a running list of decisions you made in the session. When Claude contradicts one, you know the rot has started and what to put in the handoff.
Step 5: Compact or rewind with intent
When a phase must continue but the context is crowded, compact with an explicit focus, or rewind to the last good point and summarize selectively, the pairing the mindpattern six-pillar write-up recommends. Rewinding is the better choice when a wrong turn is recent, since it removes the bad material instead of summarizing it. Compacting suits long productive stretches where the history is mostly useful. After either move, ask Claude to restate the current goal and constraints to confirm the summary kept them.
Step 6: Reset with a handoff note
When clearing, first have Claude write a short handoff: current goal, what is done, what is next, open questions, and files touched. Start the new session by pointing Claude at the handoff and the plan file rather than pasting the old conversation. Verify the state before continuing by running the tests or scripts that define progress, which closes the trust-then-verify gap Anthropic describes. The new session should reach useful work within a turn or two.
Pro tip: Keep handoffs short enough to read in a minute. If the handoff sprawls, the phase boundary came too late.
Step 7: Compound memory at session end
Before closing a session, update CLAUDE.md with anything a future session would otherwise rediscover the hard way: a command that must run first, a directory to avoid, a convention the codebase actually follows. Remove rules that turned out to be wrong or obsolete. This is the memory compounding idea listed in the mindpattern write-up. Over several sessions, the durable memory gets more accurate while each conversation stays short.
Pro tip: Add entries as one-line rules with a reason, so a later reader can tell when a rule has stopped applying.
Best Practices
- Give each conversation one job. A session that explores, plans and codes carries the noise of all three into the last phase, while phase-scoped sessions start each job with only the products it needs.
- Put decisions in files, not in chat history. The conversation is discarded at every reset, and the SitePoint guide treats CLAUDE.md as the mechanism for session persistence, so anything you want to survive must be written down.
- Plan boundaries before quality drops. Developer reports in the February 2026 write-up place degradation well before sessions feel long, so waiting for obvious symptoms means you reset after damage is done.
- Prefer rewinding over correcting when a wrong turn is recent. Arguing Claude out of a mistake leaves both the mistake and the argument in context, while rewinding removes them.
- Verify at every phase boundary. Tests and scripts turn a plausible summary into a checked state, which matters because Anthropic notes Claude can produce plausible work that misses edge cases.
- Keep CLAUDE.md for durable rules and plan files for task state. Mixing them bloats the persistent layer that loads into every session and leaves stale task details behind after the task ends.
- Clear between unrelated tasks by default, as Anthropic recommends. Leftover context from a previous task can steer the next one without either of you noticing.
Common Mistakes
- Running one marathon session for an entire feature, from exploration through commit.: Split the work into explore, plan, code and commit phases per Anthropic's workflow, with a planned boundary between each. Carry forward only each phase's written product.
- Clearing the session without writing anything down first, then spending the next session re-explaining the task.: Always produce a handoff note and update the plan file before a reset. A fresh session should load state from files, which is how CLAUDE.md persistence is meant to work.
- Correcting Claude repeatedly within the same conversation after it goes down a wrong path.: Rewind to the last good point and summarize selectively, as the mindpattern write-up suggests. Each correction adds more conflicting material for Claude to weigh on later turns.
- Treating CLAUDE.md as an ever-growing log of every session.: Record only rules that apply across tasks, and delete obsolete ones as part of memory compounding. Task state belongs in a plan file that you archive when the task ends.
- Ignoring early rot signals because the session still mostly works.: Treat a forgotten constraint or reverted decision as a trigger to compact, rewind or reset at the next safe point. The February 2026 report describes rot as progressive, so it tends to get worse, not better.
References
- Examples: Worked examples and scenarios
- FAQ: Frequently asked questions
- Parent Method: Claude Code Context Engineering: 6 Pillars Framework
Related Skills
- Writing Effective System Prompts for Claude AI
- Structuring Retrieval-Augmented Context for Claude
- Preventing Context Poisoning, Distraction, and Clashes
- Engineering Tool Output Context Flows for Claude Agents
- Managing Context Window Token Budgets in Claude
- Layering Instruction Hierarchies in Claude Prompts
Sources
- Claude Code Context Engineering: 6 Pillars Framework
- Claude Code Best Practices
- Effective context engineering for AI agents - Anthropic
- Best Practices für Claude Code
- Best practices for Claude Code
- Context Engineering for Claude Code: The Six Pillars Framework - CLAUDE.md, /init, /rewind, Interview Workflow, MCP Servers, Memory Compounding
- Explore the context window - Claude Code Docs
- Claude Code February Updates: What Broke for Engineers?
- Claude Code Context Management Guide - Long-Running
Add this skill to your Hamster workspace to version it, share it with your team, and let AI agents use it automatically.
Other Skills in This Method
Claude Skills SEO Guide to Tool Output Context Flows
Control what tool results, command output and subagent findings flow back into a Claude agent's context so each loop stays focused.
Layering Instruction Hierarchies: SEO for Claude Prompts
Sort Claude instructions into persistent, on-demand and turn-level layers so each layer does one job and the context stays lean.
Claude Content Optimizer: Managing Context Window Budgets
Keep Claude Code's context window from filling and degrading by budgeting what enters it and compacting or clearing on purpose.
Fixing Poisoned and Clashing Context in Claude AI Prompts
Diagnose poisoned, noisy, confused or contradictory context in Claude sessions and fix it at its source, not just in the chat.
Structuring Claude Topic Clusters for Retrieval Context
Split documents by heading, add situating context to each chunk, index it for semantic and keyword search, and hand Claude structured results.
How to Write the Best Claude AI Prompts
Write Claude prompts and CLAUDE.md files that supply exact inputs, scope the task, and define done so the first attempt can be checked.
Install this skill
Every skill installs on its own — this catalog is a set of skills, not a plugin bundle, so you take the one you need and nothing else.
Claude Code
.claude/skills/designing-multi-turn-conversation-contextnpx skills add gethamster/skills --skill designing-multi-turn-conversation-context --agent claude-code --yesCursor
.agents/skills/designing-multi-turn-conversation-contextnpx skills add gethamster/skills --skill designing-multi-turn-conversation-context --agent cursor --yesCodex
.agents/skills/designing-multi-turn-conversation-contextnpx skills add gethamster/skills --skill designing-multi-turn-conversation-context --agent codex --yesAntigravity
.agents/skills/designing-multi-turn-conversation-contextnpx skills add gethamster/skills --skill designing-multi-turn-conversation-context --agent antigravity --yesOr browse the skills and pick interactively:
npx skills add gethamster/skillsSource: gethamster/skills on GitHub, MIT licensed.