FREE1 free audit every month. No card, every finding included.

GUIDESEPISODES

EP 11 · FRESHAster × Claude

Claude Code cheat sheet: clean context, smarter Claude

Six hours into one chat, Claude still remembers the logo you argued about at lunch, and it just forgot your rule about keys. Its memory is full. Here is how to see what fills it, clear it, shrink it, and keep the rules that matter, in plain words, checked against Anthropic’s own docs.

  • 11 min read
  • Beginner
  • Oct 9, 2026
Voxel episode cover tagged EP. 11 on a dark green background with faint code: the headline reads CLEAN CONTEXT. in cream and SMARTER CLAUDE. in lime; inside a self-storage unit at night under a raised mustard-yellow roll-up door and fluorescent tubes, Aster stands holding a push broom like a show host, his closed silver laptop at his side and the lime lock on his black shirt visible, while Claude, a terracotta-orange clay block with two black eye slits, peeks out from between stacked cardboard boxes, three of them marked LOGO.

01THE STORY

Six hours in, Claude’s memory is a storage unit

Why it mattersA full context window is a slower, pricier and more forgetful Claude.

You opened Claude Code at breakfast to tweak the logo. By lunch you were fixing login in the same chat. By dinner Claude kept bringing up the logo, ignored the rule you gave it about keys, and fixed the same bug three different wrong ways.

Illustration: the before shot of a hoarding show: a self-storage unit at night under a raised mustard-yellow roll-up door and fluorescent tubes, packed floor to ceiling with leaning cardboard boxes, six at the front marked LOGO in black marker; Claude, a terracotta-orange clay block with two black eye slits, is buried up to his eyes in the middle; Aster stands in the doorway with a hand on his head, shocked, his closed silver laptop at his side and the lime lock on his black shirt visible.
Six boxes of logo debate. One login bug. Guess which one Claude can still find.
Open the full chapterIncludes a note

Nothing is broken. Claude’s memory is full of boxes you will never open again.

What “memory” means here

Claude Code’s context window holds your whole conversation: every message, every file Claude reads and every command output. In Anthropic’s words, “performance degrades as it fills”, and “Claude may start ‘forgetting’ earlier instructions or making more mistakes.”

So the job is a declutter. See what is in there and throw out what you don’t need. Shrink what you keep, and put the rules where they can’t get lost.

02TIP 1

Take inventory: /context shows what fills the unit

Why it mattersYou can’t clean a unit you haven’t looked inside.

Type /context. Claude Code draws a coloured grid of what is using the window right now, with suggestions for context-heavy tools, memory bloat and capacity warnings.

Illustration: inside the storage unit, one corrugated wall has become a glowing grid of square tiles in grey, blue, purple, gold and lime, many still dark and empty, like a colour-coded inventory chart; Claude, the orange clay block, points at it with a side nub like a host; Aster studies it with his silver laptop open on a cardboard box marked LOGO, the lime lock on his shirt visible.
Before you blame the model, read the inventory.
Open the full chapterIncludes code, a table, a note
Claude Code
/context        a coloured grid of what fills Claude's memory right now,
                with suggestions for what to trim

What is already in there before you type

Loaded at startWhat it is
System promptClaude Code’s own instructions. You never see it.
Your CLAUDE.md filesProject and personal instructions, loaded every session.
Auto memoryClaude’s own notes from past sessions: the first 200 lines or 25KB of MEMORY.md.
MCP tool namesJust the names by default. Full tool details load when a task needs them.
Skill descriptionsOne line per skill. The full skill loads only when it is used.

Then the conversation adds up. The docs are blunt about what costs the most: “File reads dominate context usage.” A specific prompt like “fix the bug in auth.ts” means Claude reads fewer files.

03TIP 2

Corrected twice? Stop arguing. Clear the unit

Why it mattersThree wrong fixes in the chat teach Claude three wrong fixes.

This is the tip people skip. Corrected Claude more than twice on the same issue? Then, in Anthropic’s words, “the context is cluttered with failed approaches.” Start over with a better first message, not a fourth correction.

Illustration: the storage unit is empty and swept clean, the concrete floor gleaming under fluorescent tubes, a push broom leaning on the wall and a row of mustard roll-up doors outside at night; Aster hands Claude, the orange clay block, a single blank white index card, his closed silver laptop at his side and the lime lock on his shirt visible; Claude looks relieved.
One clean unit. One better instruction card.
Open the full chapterIncludes code, a note
Claude Code
/rename login-fix-try-1     name this session so you can find it again
/clear                      start a new conversation with empty context
/resume login-fix-try-1     bring the old session back later

/clear also answers to /new and /reset. It keeps your project memory (CLAUDE.md); only the conversation goes.

Write the one better first message

Put in what you learned from the failed tries. Name the place to look, what “fixed” looks like, and what not to touch.

✕ Don’tthe first message, before
fix the login bug

Claude has to guess where, what and when to stop.

✓ Dothe first message, after
Users get logged out when their session times out.
Look at src/auth/, especially the token refresh.
Fixed means: a test that reproduces it fails first, then passes.
Don't touch the signup page or the database schema.

Where to look, what done means, what to leave alone.

04TIP 3

Can’t start over? Compact, and say what to keep

Why it mattersA summary you steer keeps the login fix. One you don’t might keep the logo.

Sometimes you are deep in one problem and the history is worth keeping. Then shrink it on purpose. /compact replaces the conversation with a summary. Add what matters, or the automatic pass decides for you.

Illustration: in the middle of the storage unit stands one sturdy cardboard box marked LOGIN FIX in black marker, glowing lime at the seams, with flattened empty boxes on the floor around it; Claude, the orange clay block, sits on top of it proudly; Aster stands beside it with a thumbs up, his closed silver laptop at his side and the lime lock on his shirt visible.
Every box squashed into the one that matters.
Open the full chapterIncludes code, a table, a note
Claude Code
/compact focus on the login fix and the files we changed

/rewind     (or Esc twice on an empty prompt)
            pick a message → Summarize from here

The docs: with a focus, “the summary keeps what you choose instead of what the automatic pass guesses is important.”

Shrink only part of the chat

Press Esc twice on an empty prompt (or type /rewind) and pick one of your earlier messages. Then choose an action.

OptionWhat it does
Restore code and conversationBoth go back to that point.
Restore conversationThe chat goes back; your code stays as it is.
Restore codeFile changes go back; the chat stays.
Summarize from hereSquashes everything after that message into a summary.
Summarize up to hereSquashes everything before it; recent messages stay in full.

To steer a summary, highlight a Summarize option and type your instructions where the row says add context (optional). Summarizing doesn’t change any file on disk.

05TIP 4

Rules you typed in chat get lost. Put them in CLAUDE.md

Why it mattersClaude forgets your chat. It re-reads a file every time.

Here is the trap behind “it forgot my rule”. When a chat is compacted, a rule you only typed in the conversation is summarized with everything else. The memory docs say it directly: if an instruction disappeared after compaction, “it was given only in conversation”.

Illustration: on the back wall of the storage unit hangs a dark green framed sign reading CLAUDE.md with three white lines under it, lit by its own small lamp; on the left a pile of boxes shrinks in a lime glow; Claude, the orange clay block, stands in front of the sign, reassured; Aster gives a thumbs up on the right, his closed silver laptop at his side and the lime lock on his shirt visible.
The boxes get squashed. The sign on the wall stays.
Open the full chapterIncludes a table, code, a note

What survives a compaction

Where the instruction livesAfter compaction
Typed in the chatSummarized with the rest. Can be lost.
Project-root CLAUDE.mdRe-read from disk and put back.
Auto memoryRe-read from disk and put back.
CLAUDE.md in a subfolder, path-scoped rulesLoad again when Claude touches a matching file.
Files Claude read or editedUp to five of the most recently changed are re-read.
✓ DoCLAUDE.md
# Commands
- npm run dev: start the app
- npm test: run the tests before you say you're done

# Rules
- Secrets live in .env files. Never read them, never paste a key into code, never commit a .env file.

# Compact instructions
When you compact, keep the list of files we changed and the test commands.

Short is the point. The # Compact instructions heading is the docs’ own trick for telling every compaction what to keep.

  • No file yet? Type /init. Claude reads your codebase and writes a starter CLAUDE.md. If one exists, it suggests improvements instead of overwriting it.
  • Keep it under 200 lines. The docs: longer files “consume more context and reduce adherence.”
  • Check it loaded: run /context and look under Memory files.
  • Already have an AGENTS.md for other tools? Recent versions of Claude Code read it when there is no CLAUDE.md. To use both, start CLAUDE.md with the line @AGENTS.md.

06TIP 5

Padlock the .env: a deny rule Claude can’t talk its way past

Why it mattersA polite instruction can be summarized away. A deny rule can’t.

A key Claude never reads can’t end up pasted into code, a commit or a log. Tell Claude Code which files it may never open. Type /permissions and add deny rules, or put them in .claude/settings.json so your whole team gets them:

Illustration: in a corner of the storage unit sits a small cardboard box marked .env in black marker, wrapped in a heavy lime chain with a chunky lime padlock; Aster holds up an open hand in a firm stop gesture, his closed silver laptop at his side and the lime lock on his shirt visible; Claude, the orange clay block, stands on the other side of the box keeping his distance.
The one box nobody opens.
Open the full chapterIncludes code, a note
✓ Do.claude/settings.json
{
  "permissions": {
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)"
    ]
  }
}

Read(./.env) is the docs’ own example. A bare Read(.env) (or Read(**/.env)) matches a .env in any folder of the project.

Why a rule beats a request

  • Deny wins. Rules are checked in order: deny, then ask, then allow. An allow rule can’t carve an exception out of a deny.
  • Every mode. The docs: “Deny rules block in every mode, including bypassPermissions.” That matters. By default, auto mode allows “Reading .env and sending credentials to their matching API”.
  • Reading includes editing. A Read deny rule also stops Claude’s Edit and Write tools on the same path.

Then make sure the file never reaches git:

✓ Do.gitignore
.env
.env.*
!.env.example

The last line keeps a .env.example with fake values in the repo. If a real .env is already tracked, git rm --cached .env stops tracking it without deleting your copy; then rotate any key that was in it.

07THE SHELF

The rest of the cheat sheet: cost, effort and handovers

Why it mattersOld context isn’t free. You pay to resend it with every message.

A few more habits keep long sessions cheaper and calmer.

Open the full chapterIncludes a table, code
Type thisWhen
/usageSee where your usage goes. On paid plans it flags habits like long context or cache misses.
/btw <question>A side question whose answer never enters the conversation.
/effortTurn reasoning down (low) for small edits, up for tricky bugs. Thinking is billed as output.
/initA starter CLAUDE.md from your codebase.
“use a subagent to investigate X”The file reads happen in the subagent’s own window; only its summary comes back.
/autocompact 500kCompact earlier than the default (newer versions).

Why a chat left open all day costs more

Claude Code sends your full conversation with every request and leans on a cache to make that cheap. The cache lifetime is an hour on a subscription and five minutes by default on an API key. Your first message after a longer break reprocesses everything. On Pro and Max, Claude Code offers to resume a big session from a summary instead.

Hand over, then start fresh

Finished a task, or stuck in a loop? Ask for a handover note, clear, and start the next task from the note. It works in any agent.

Claude Code
Write a handover note: what we built, what is left, which files matter
and how to run the tests. Save it as HANDOVER.md.

# then, in a fresh session:
Read HANDOVER.md, then do this next task: ...

Anthropic’s guide does the same with specs: write the plan to a file, then “start a fresh session to execute it.”

08THE REVEAL

The after shot: a five-step routine

Why it mattersFive habits, about a minute a task. That is the whole declutter.

Every new task, every time:

Illustration: the after shot of a declutter show: the storage unit is tidy with three neat boxes on a metal shelf and a bright clean floor, lime and orange confetti falling; Aster and Claude, the orange clay block, high-five in the middle, both happy, Aster’s closed silver laptop at his side and the lime lock on his shirt visible.
Same unit. Same Claude. Room to think.
Open the full chapterIncludes steps, a note
  1. One task, one session. /rename it, /clear when you switch to something else.
  2. Look with /context when Claude feels slow or forgetful.
  3. Two strikes, start over. /clear, then one better first message.
  4. Long but valuable? /compact and name what to keep.
  5. Rules live on disk: habits in CLAUDE.md, hard limits in permissions.deny.

Copy the prompt at the top of this page into Claude Code once. It writes your CLAUDE.md rule, adds the .env deny rules and checks your .gitignore, showing you each change first.

THE QUICK READ

What to take away.
In one minute.

  1. 01

    Claude’s memory is its context window: every message, every file it read, every command output. The docs say performance drops as it fills, and Claude may start forgetting earlier instructions.

  2. 02

    /context shows what fills it as a coloured grid, with suggestions. A lot loads before you type: the system prompt, your CLAUDE.md, memory, MCP tool names and skill descriptions.

  3. 03

    Corrected Claude more than twice on the same thing? The docs’ advice: /clear and start fresh with a more specific prompt. /rename the session first so /resume can bring it back.

  4. 04

    Can’t start over? /compact plus what to keep. Or press Esc twice, pick a message and choose Summarize from here.

  5. 05

    A rule you only typed in chat can be lost in a summary. The project-root CLAUDE.md is re-read from disk after compaction. Keep it under 200 lines.

  6. 06

    Instructions shape what Claude tries; permission rules decide what it can do. A deny rule like Read(./.env) blocks in every mode. A .claudeignore file has no effect.

THE TAKEAWAY, IN ONE PASTE

Paste this once. Keep a clean memory.

Paste this into Claude Code. It writes to two files, CLAUDE.md and .claude/settings.json, and shows you each change before it saves. It never deletes a file and it won’t open your .env.

agent-prompt.md
Clean up how you work in this project so you keep a clear memory and never read my secrets. Do these in order and show me each change before you save it:
1. Create or update CLAUDE.md (keep it under 200 lines): the build and test commands, my code conventions, and this rule word for word: "Secrets live in .env files. Never read them, never paste a key into code, never commit a .env file."
2. In .claude/settings.json, add these to permissions.deny (keep anything already there): "Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)".
3. Check .gitignore lists .env and .env.* . If a .env file is already tracked in git, tell me; do not delete it.
4. Finish with three short lines I can keep: when to type /context, when to type /compact plus what to keep, and when to type /clear and start over with one better message.

Paste it into the agent you already build with

  • Claude
  • ChatGPT
  • Gemini
  • Cursor
  • Copilot

QUESTIONS PEOPLE ASK

Good questions.
Short answers.

What does /context show in Claude Code?

A coloured grid of what is using the context window right now, by category, with suggestions for context-heavy tools, memory bloat and capacity warnings. It also shows which CLAUDE.md and memory files loaded. Run it when Claude feels slow or forgetful.

When should I use /clear instead of /compact?

Use /clear when you switch to unrelated work, or after you have corrected Claude more than twice on the same thing. Use /compact with a focus when you are deep in one problem and the history still matters. /clear costs nothing. Compacting a large chat is itself a large request.

Will I lose my old conversation if I type /clear?

No. Name it first with /rename, then bring it back with /resume and its name. /clear also keeps your project memory, including CLAUDE.md.

Why did Claude forget a rule I gave it earlier?

Probably because the rule lived only in the chat. When a conversation is compacted, chat messages are summarized and details can drop out. The project-root CLAUDE.md is re-read from disk after compaction, so put rules there.

How long should CLAUDE.md be?

Under 200 lines, per Anthropic’s docs: longer files use more context and reduce adherence. Keep build and test commands, conventions and “always / never” rules. Type /init to generate a starter file.

How do I stop Claude Code from reading my .env file?

Add deny rules: type /permissions, or put "Read(./.env)", "Read(./.env.*)" and "Read(./secrets/**)" under permissions.deny in .claude/settings.json. Deny rules block in every permission mode. A .claudeignore file has no effect.

Does a deny rule stop every way of reading the file?

No. It covers Claude’s file tools, shell commands Claude Code recognizes like cat and head, and redirects. A script that opens files itself, or grep -r across a folder, isn’t covered. For an OS-level wall, turn on /sandbox.

Does Aster check any of this?

No. Context, compaction and permission settings live in Claude Code on your machine, and Aster’s audit doesn’t look at them. Aster reads your repository: it does flag leaked keys and committed .env files, which is exactly what tip 5 helps you avoid.

Done with the guide?
Let Aster check the rest.

1 free audit every month. Aster reads your code, env files, database rules and packages. You get each finding in plain English, with the file and line.

Aster

CHECKING

YOUR GUIDE TO ASTER

Hi, I’m Aster.
Ask me what Aster checks.

I can’t see your code from here. Please don’t paste secrets or private code.

Prepared answers are always available.