2-3-memoria-contesto

--- title: "Managing Memory and Context: Getting Claude to Work Best on Long Tasks" description: "Claude's context window is huge but not infinite. Learn to manage long conversations, large documents, and extended work sessions without losing coherence." slug: "2-3-memoria-contesto" enslug: "2-3-memory-and-context" accesslevel: registered status: published visible: true featured: false priority: 23 date: 2026-04-22 updated: 2026-04-22 author: "Dario Santocanale" reading_time: "7 min" prerequisites: - Having completed the Projects tutorial tags: [claude, context, memory, tokens, workflow, advanced] ---

Have you ever noticed Claude seeming to "forget" the first instructions in a very long conversation? That's not a bug — it's how the context window works. Here's how to manage it.

5 min

---

How context works

Every time you send Claude a message, it "sees" the entire conversation from the beginning. This includes:

  • Your system prompt / initial instructions
  • All your messages
  • All of Claude's responses
  • Files you've uploaded

This "working memory" is called the context window and is measured in tokens (each word is about 1-2 tokens).

Claude has about 200,000 tokens of context — equivalent to about 150,000 words, or a 500-page novel.
Visual diagram showing how context grows in a conversation
Context grows with every message — 200K token context window

What happens when context fills up

As you approach the limit:

  • Claude might "forget" the first instructions
  • Responses might become less coherent with what was discussed at the start
  • In some cases Claude will warn you the context is full

In practice, with 200K tokens you rarely hit the limit in a single normal session. The more common problem is quality degradation — after very many exchanges, Claude loses track of early details.

---

Technique 1: The initial context block

Always start important conversations with a structured context block. This gets "weighted more heavily" because it's at the beginning of the conversation.

Template:
## CONTEXT
[Who you are, what you're doing, final objective]

## CONSTRAINTS
[What Claude should not do, limits to respect]

## EXPECTED OUTPUT
[Format, length, style of responses]

## TASK
[The first specific request]
Concrete example:
## CONTEXT
I'm a management consultant. I'm preparing a proposal for
a manufacturing sector client (150 employees).
Goal: reduce production times by 20% in 6 months.

## CONSTRAINTS  
- Budget: $50,000
- No IT consulting (already covered internally)
- Language: formal but not academic

## EXPECTED OUTPUT
Structured responses in short paragraphs, max 300 words
per response unless otherwise indicated.

## TASK
Help me structure a preliminary analysis of the production
process. Start with the 5 most important questions to ask
the client in the first meeting.

---

Technique 2: The strategic summary

Every 20-30 messages in a long session, ask Claude to summarize the work done so far. This "compresses" important information, reducing context load.

Prompt:
Before continuing, make a structured summary of everything
we've established so far: decisions made, defined structure,
points still open.

Then you can:

  1. Copy the summary
  2. Open a new chat
  3. Paste the summary as the first message
  4. Continue from there with a "fresh" context

---

Technique 3: The sliding window for large documents

If you're working on a long document (e.g., editing a book, analyzing a contract), don't paste everything at once. Use a sliding window:

  1. Initial setup: paste the first X pages + the editing instructions
  2. Process the first chunk
  3. Slide: paste the next chunk with a brief transition:
Let's continue. You've already seen chapters 1-3. 
Now analyze chapter 4 following the same approach:
[Chapter 4...]
  1. At the end: ask for an overall synthesis

---

Technique 4: The stateful work session

For projects that develop over time (days, weeks), maintain a status document external to Claude.

Status document structure:
# Project: [Name]
**Last updated:** [Date]

## Decisions made
- [Decision 1]
- [Decision 2]

## Work in progress
- [Current task and status]

## To do
- [Next steps]

## Claude already knows
[Context you've built that you can paste directly]

At the start of each new session, paste the "Claude already knows" section and resume from there.

---

When to open a new chat

SituationSame chatNew chat
Continuing the same task
Moving to a completely different task
Conversation > 50 exchanges✅ (with summary)
Claude starts contradicting itself
Want a neutral "fresh start"
Related but independent task

---

Projects as the permanent solution

The most elegant way to manage context for recurring projects is to use Projects (see previous tutorial). Project instructions are injected at the start of every conversation without "consuming" the chat's context.

With Projects:

  • Instructions are outside the context window (managed separately)
  • Reference files are available without pasting them every time
  • Each conversation starts "fresh" but with the project context already present

---

Token counter: how to estimate your usage

There's no visible counter in claude.ai for regular users. You can roughly estimate:

  • 1 A4 page of text ≈ 500-700 tokens
  • 1 average blog post ≈ 1,000-2,000 tokens
  • 1 50-page PDF ≈ 25,000-35,000 tokens
  • 100 chat messages ≈ 5,000-15,000 tokens (depends on length)

With 200K tokens you have a lot of space. The practical limit is quality, not quantity.

---

Up next →2-4-file-upload