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

GUIDESEPISODES

EP 17 · CRIBAster × Claude

Claude Code long sessions: cache, TASKS.md, /btw

You typed one word after lunch and your usage bar jumped. Nothing broke: the prompt cache expired while you were away, so Claude reread the whole chat at full price. Claude gives you a night tour of his castle, one room per tip, each checked against Anthropic’s own docs.

  • 13 min read
  • Beginner
  • Oct 21, 2026
Voxel episode cover tagged EP. 17 on a deep plum night background with faint blurred code: the headline reads CLAUDE’S in cream and CRIB. in lime; in the candle-lit hall of a gothic castle with a moonlit arched window, Aster, in a black t-shirt with the lime lock logo and his closed silver laptop at his side, looks around amazed, while Claude, a terracotta-orange clay block with two black eye slits, two small white fangs, a red medallion and a black vampire cape with a crimson lining, stands in an open doorway welcoming him in.

01ROOM 1 · THE COFFIN

Why one word after a break costs so much

Why it mattersThe cost of a break isn’t the break. It’s the first word after it.

Here’s the story. You worked with Claude all morning, went to lunch, came back and typed “ok”. Your usage bar jumped like you’d sent a novel.

Illustration: in a candle-lit castle bedroom with a moonlit arched window, Claude, a terracotta-orange clay block with two closed eye slits, two small white fangs, a red medallion and a black vampire cape, naps inside an open black coffin lined with crimson velvet; on a side table a brass hourglass has almost run out next to a card that reads 1 HR; Aster, in a black t-shirt with the lime lock logo, leans in shocked with one hand raised, his closed silver laptop at his side.
The cache naps too. Wake it after the timer and you pay for the whole chat again.
Open the full chapterIncludes a table, a note, code

That’s the cache. Every time you send a message, Claude Code sends the whole conversation again: the system prompt, your project context, every earlier message and tool result. Prompt caching lets it reuse the part it already processed. It bills that re-read at the cached token rate and fully processes only what changed.

The cache doesn’t wait forever. The docs: “Cached prefixes expire after a period of inactivity. Each request that hits the cache resets the timer.” After a long enough gap, “the next request recomputes the full input.”

How long the cache lasts

RequestClaude subscription, within plan usageUsage credits, API key, or cloud provider
Your main conversationOne hourFive minutes
Everything else (subagents, workflows, compaction, session titles)Five minutes, except a few helper requests Anthropic controls, which get one hourFive minutes

So on a Pro or Max plan, a coffee break is fine and a long lunch isn’t. With an API key, five minutes away is enough.

Choosing the lifetime yourself

With an API key or a cloud provider, you can ask for the one-hour lifetime with the promptCacheTtl setting. It takes 5m or 1h and needs Claude Code v2.1.242 or later.

~/.claude/settings.json
{
  "promptCacheTtl": "1h"
}

The one-hour lifetime charges a higher rate for cache writes. It pays off when you leave a session idle and come back, not on short bursts of work.

02WAKING UP

Back from a break: /clear, /compact, or keep going

Why it mattersA fresh page is free. Rereading the whole book isn’t.

You’re back and the cache is probably cold. What you do next decides the bill.

Illustration: in a moonlit castle library, Claude, the orange clay block in a vampire cape with two small fangs, climbs out of an open black coffin with a big stretch; next to him Aster smiles and turns a giant guest book on a wooden lectern to a fresh blank page that reads /clear, the old pages tied with a red ribbon; Aster’s silver laptop sits on a small table nearby.
New task after a long nap? Start a fresh page. The old one is saved.
Open the full chapterIncludes a table, code, a note
You’re back and…Do thisWhy
Starting something new/clear <name>The docs: “When you want a fresh start instead of continuity, /clear costs nothing.” The name labels the old chat in the /resume picker
Continuing the same task, back within the lifetimeKeep goingThe cache is still warm, so the history is read at the cached rate
Continuing after a long break, in a huge chatThink before /compact/compact reads the whole conversation it summarizes. After the cache expires, that is a large uncached request
Abandoning a path you went down/rewind to an earlier turnRewinding goes back to a prefix that is already cached, instead of building a new one
Claude Code
/clear login-bug     # new chat; the old one is labelled "login-bug" in /resume
/resume              # pick it up again later
/usage               # plan usage, the Prompt cache (main) line, and what's eating your plan

/clear also has the aliases /reset and /new.

See what’s eating your plan

/usage shows your session, plan usage limits and activity. On a Pro, Max, Team or Enterprise plan it also breaks down what counts against your limits. It recommends a change for behaviors behind 10% or more of your recent usage, such as long context or cache misses. Press d or w to switch between the last 24 hours and the last 7 days.

03ROOM 2 · THE FRIDGE

Keep the to-do list in TASKS.md

Why it mattersWhat’s in the chat can be summarized. What’s in a file is still there tomorrow.

Long runs fill the context window. When it fills, Claude Code summarizes older turns to make room. A plan you typed two hours ago can come back as one line of summary.

Illustration: in a gothic castle kitchen with hanging copper pans, a rounded retro mint-green fridge holds a cream note on its door titled TASKS.md with three ticked lines; Aster gives a thumbs up beside it, his closed silver laptop at his side, while Claude, the orange clay block in a vampire cape with two small fangs, presents the fridge like a home-tour host.
Claude’s to-do list lives on the fridge, not in his head.
Open the full chapterIncludes code, a note

Anthropic’s advice for long runs on Opus 5.5 is simple: keep the task list in a file. “A list in a file survives that.” Ask for it in plain words:

prompt
Keep a checklist in TASKS.md. Tick each item when it's done, and add anything new you find.

Anthropic’s own wording. Then read the file, not the scrollback, to see where the run is.

Put the house rule on line one

A checklist file is also a good place for the one rule that must never slip. Line one is the first thing anyone reads, Claude included:

TASKS.md
Never commit .env. Keys stay on the server.

## Tasks
- [x] Add the signup form
- [x] Validate the email field
- [ ] Send the welcome email from the server route
- [ ] Add a test for a duplicate email
- [ ] (found) The reset link page has no loading state

Tick items as they’re done. New things Claude finds go at the bottom as new items.

TASKS.md isn’t a special Claude Code feature. It’s a plain file you ask for, which is why it works with any agent that can read and write files.

04HOUSEKEEPING

What compaction keeps, re-reads and drops

Why it mattersRules that live in files come back. Rules that live in the chat get summarized.

Compaction replaces your message history with a summary. Some things come back on their own and some don’t. This is the docs’ list, shortened:

Illustration: in the castle kitchen at night, Claude, the orange clay block in a vampire cape with two small fangs, sweeps a pile of crumpled old paper scrolls toward a glowing stone fireplace with a broom, while the mint-green fridge behind him keeps its ticked checklist note pinned to the door; Aster points at the note and grins, his closed silver laptop at his side.
Old turns get swept up. The note on the fridge stays.
Open the full chapterIncludes a table, code, a note
WhatAfter compaction
System prompt and output styleBoth still apply
Project-root CLAUDE.md and unscoped rulesRe-injected from disk
Auto memoryRe-injected from disk
The plan Claude wrote in plan modeRe-injected from disk
Files Claude read or editedUp to five re-read, most recently modified first
Invoked skill bodiesRe-injected, capped at 5,000 tokens per skill and 25,000 in total
Rules with paths: and nested CLAUDE.md filesReloaded on demand, when Claude touches a matching file again
Everything you said in the chatSummarized with the rest of the conversation

That last row is the one that bites. A rule you only typed in the chat is now a line in a summary, if it survived at all.

Tell the summary what to keep

Run /compact with a focus before a big new task, like /compact focus on the auth bug fix. Or put standing instructions in your project’s CLAUDE.md:

CLAUDE.md
# Compact instructions

When you compact, keep the full list of files you changed,
the test command, and any rule from TASKS.md line one.

The docs show a # Compact instructions section like this one. Keep it short; CLAUDE.md loads every session.

05ROOM 3 · THE BUTLER

/btw: ask on the side, keep the chat clean

Why it mattersSide questions are fine. Side questions that live in your chat forever aren’t.

Mid-task, you wonder what an error means or what a file was called. Ask in the chat and the question and answer stay in your context for the rest of the session. Ask the butler instead:

Illustration: in a grand candle-lit castle hall, a cute voxel bat butler in a red bow tie holds out a silver tray with a white card that reads /btw; Aster, seated at a long table with his open silver laptop, points toward it, while Claude, the orange clay block in a vampire cape with two small fangs, stands behind the table presenting his butler.
He answers, bows, and leaves nothing on the table.
Open the full chapterIncludes code, a note
Claude Code
/btw what was the name of that config file again?

The example from the docs. The answer appears in an overlay you can dismiss.

The best practices page: “For questions that don’t need to stay in context, use /btw. The answer never enters conversation history, so you can check a detail without growing context.”

What the butler can and can’t do

  • Sees the whole session: your messages, Claude’s replies and the tool results so far, plus your earlier side questions.
  • Has no tools: it can’t read files, run commands or search. It answers only from what’s already in context.
  • Answers once: to continue, ask another /btw. Press f to hand the question to a forked subagent with full tools.
  • Works while Claude is busy: it runs alongside the main turn without interrupting it.
  • Costs little while the cache is warm: the docs say a side question then “costs little beyond the answer itself.”

Run /btw with no question to reopen your most recent answer. In the overlay, c copies the answer as Markdown and x clears the earlier side questions.

06ROOM 4 · THE GRANDFATHER CLOCK

/autocompact 500k: tidy up before it’s full

Why it mattersA tidy half-full window beats a crowded full one.

Why tidy up early? Anthropic’s best practices answer it: “LLM performance degrades as context fills. When the context window is getting full, Claude may start ‘forgetting’ earlier instructions or making more mistakes.”

Illustration: in a tall castle hallway, Claude, the orange clay block in a vampire cape with two small fangs, stands on a wooden stool and turns a brass winding key in a dark grandfather clock whose cream face has a lime marker labelled 500K; Aster stands beside the clock with one finger raised, nodding, his closed silver laptop at his side.
Set the clock to tidy up at half, not at midnight.
Open the full chapterIncludes code, a table, a note

Models with a native 1M window include Opus 4.7 and later, Sonnet 5 and later, Haiku 5.5 and the Fable models. By default they compact before the window fills, “at about 967K tokens.” /autocompact moves that point.

Claude Code
/autocompact 500k     # this model compacts at 500,000 tokens from now on
/autocompact          # opens a dialog that shows the current window
/autocompact auto     # back to the window tuned for your model

Needs Claude Code v2.1.221 or later. Sizes from 100K to 1M: 200000, 500k, 1M, or a bare 200 for 200,000.

The value is saved to your user settings under the current model, from v2.1.288, and applies to the session right away. Claude Code caps it at the model’s context window.

Who wins when there’s more than one setting

Where it’s setScopeWhat beats it
CLAUDE_CODE_AUTO_COMPACT_WINDOW environment variableScripts and cloud environmentsNothing here. It wins over the command, the flag and the setting
claude --autocompact 500k flagOne launch, without changing your saved valueThe environment variable
/autocompact 500kThe current model, saved in user settingsThe variable, the flag, and a window set by a higher scope such as managed settings
autoCompactWindow in settings.jsonEvery modelAll of the above, including a per-model value saved in the same file
~/.claude/settings.json
{
  "autoCompactWindow": 500000
}

One window for every model. A window saved with /autocompact for a model takes precedence over this key in the same file.

07THE WHOLE TOUR

The crib on one page

Why it mattersNap, list, ask, tidy. Then ship.

Keep this next to your editor.

Illustration: at dawn in a castle room with a tall arched window over a balcony, Claude, the orange clay block in a vampire cape with two small fangs, waves goodnight from inside an open black coffin; Aster waves back from the other side with his closed silver laptop at his side; on a round table between them stand four tiny props in a row: a mini coffin, a mini mint-green fridge, a small silver tray and a mini grandfather clock.
Sun’s coming up. Four rooms, one long session.
Open the full chapterIncludes a table, a note
RoomDo thisWhat it saves you
The coffin/clear <name> after a long break when you start something new; /usage to see cache missesPaying full price to reread a chat you’re done with
The fridgeAsk for a checklist in TASKS.md, house rule on line oneA plan that shrinks to one line of summary
The butler/btw <question>Side questions that stay in your context
The clock/autocompact 500kA window so full Claude starts forgetting instructions

Look inside the window with /context

/context shows what’s filling your window right now, as a colored grid by category. It adds suggestions for context-heavy tools, memory bloat and capacity. Run /context all to expand the breakdown. It’s the fastest way to see whether a long session needs the clock, the fridge or a fresh page.

Then paste the prompt at the top of this page into Claude Code. It writes TASKS.md with the house rule on line one, checks your .gitignore, and waits for your OK.

THE QUICK READ

What to take away.
In one minute.

  1. 01

    Claude Code sends your whole conversation with every message. The prompt cache lets it reuse what it already processed, at the cached token rate.

  2. 02

    The cache expires after a break. On a Claude subscription within plan usage, the main conversation gets one hour. On usage credits, an API key or a cloud provider, five minutes.

  3. 03

    Your first message after a longer break misses the cache and reprocesses your full context.

  4. 04

    Want a fresh start instead? /clear costs nothing.

  5. 05

    /compact after a long break is itself a large request: there is no cache left to read.

  6. 06

    For a long run, ask Claude to keep its checklist in TASKS.md. When older turns get summarized, a list in a file survives that. Put the .env rule on line one.

  7. 07

    /btw answers a side question from what Claude already knows. The answer never enters the conversation history.

  8. 08

    /autocompact 500k makes Claude Code compact earlier. Anthropic’s docs: performance degrades as context fills.

THE TAKEAWAY, IN ONE PASTE

Paste this once. Move into the crib.

Paste this into Claude Code at the start of a long job. It writes one file, TASKS.md, and may propose one .gitignore line. It shows you both before saving, never opens your .env files, and waits for your OK.

agent-prompt.md
Set this project up for a long Claude Code session. Never open or read .env files, and never print a key.
1) Create TASKS.md in the project root. Put this house rule on line one, exactly: "Never commit .env. Keys stay on the server."
2) Under it, add a "## Tasks" checklist with one "- [ ]" line for each step of the job I describe next. One short line per item.
3) While you work, tick each item in TASKS.md as soon as it's done, and add anything new you find as a new item. Keep the file short. After any compaction, and before you tell me the job is finished, read TASKS.md again.
4) Check that .gitignore lists .env and .env*.local. If a line is missing, show me the exact line you would add.
5) Remind me of three commands: /btw <question> for side questions that should stay out of this chat, /autocompact 500k to compact before the window is nearly full, and /clear <name> when I'm back from a long break and starting something new.
Show me TASKS.md and any .gitignore change before you save them. Wait for my OK.

Paste it into the agent you already build with

  • Claude
  • ChatGPT
  • Gemini
  • Cursor
  • Copilot

QUESTIONS PEOPLE ASK

Good questions.
Short answers.

How long does Claude Code’s prompt cache last?

For your main conversation, one hour on a Claude subscription within plan usage, and five minutes on usage credits, an API key or a cloud provider. Each request that hits the cache resets the timer. Subagents and other side requests get five minutes by default.

Why did my Claude Code usage jump after a break?

Your first message after a break longer than the cache lifetime misses the cache and reprocesses your full context. In a long chat, that one message can cost as much as rereading the whole conversation.

Does /clear cost anything?

No. Anthropic’s docs say /clear costs nothing when you want a fresh start. Use /clear <name> to label the old conversation, then find it again in /resume.

Should I run /compact after a long break?

Only if you need the history. /compact reads the conversation it summarizes, and after the cache expires that is a large uncached request. If you’re starting something new, /clear is the cheaper move.

What is TASKS.md in Claude Code?

It isn’t a built-in feature. It’s a plain checklist file you ask Claude to keep, as Anthropic suggests for long runs: “Keep a checklist in TASKS.md. Tick each item when it’s done, and add anything new you find.” A list in a file survives when older turns get summarized.

What does /btw do in Claude Code?

It asks a side question about the current session. Claude answers from what’s already in context, without tools, and the question and answer never enter the conversation history. Run /btw alone to see your last answer again.

How do I make Claude Code compact earlier?

Run /autocompact 500k (v2.1.221 or later). It saves the window for the current model in your user settings. /autocompact auto returns to the default; on models with a native 1M window, that is about 967K tokens.

Does Aster check my Claude Code usage or cache?

No. Aster reads your GitHub repository and flags keys committed in your code, committed .env files and a missing .gitignore. Your cache, usage and Claude Code settings are yours to manage with this guide.

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.