Skip to content
Courses/Claude Code, from zero to pro/Control Context and Costs

Control Context and Costs

The two most common complaints from beginners: "every session starts from scratch and I have to re-explain everything" and "I burn through my plan limits right away." Both have the same root—context—and both have a fix. This lesson is your savings manual.

  • Understand what the context window is and what fills it (and costs you money).
  • Make Claude Code "remember" your project between sessions with CLAUDE.md.
  • Use /clear, /compact, and subagents to stretch your limits.
  • Decide which tasks to send to a cheap model or your local AI.

What Context Is (and Why It Gets Spent)

What fills context the most, in order:

  • Large files read in full (or pasted by you into the chat).
  • Long command output (logs, tests, listings).
  • Endless conversations that mix different tasks.

Your Three Savings Buttons

Terminal
/clear    # clears the conversation and starts fresh (end of task)
/compact  # summarizes the conversation and frees space (mid-task)
/cost     # check how much you've used in the session

/compact is the middle ground: it compresses what you've discussed into a summary and lets you continue where you left off. Use it when the task is long but you don't want to lose the thread. And don't fear /clear: it doesn't delete your code or files, only the conversation.

The Cure for "Starting from Scratch": CLAUDE.md

The frustration of re-explaining your project every session has an official fix: a CLAUDE.md file in the project root. Claude Code reads it automatically on startup. Ask for it like this:

Terminal
Create a CLAUDE.md for this project: what it is, how to start it,
what structure it has, my conventions, and what you must NOT touch.
Keep it brief and useful so it serves as memory between sessions.

Subagents: Explore Without Cluttering

When Claude needs to dig through a large repository, every file it reads stays in your context… unless it delegates. Subagents explore in their own memory and return only the conclusion. Ask for it explicitly:

Terminal
Use a subagent to investigate where login is handled
in this project, and bring me only the summary with the key files.

Each Task Deserves the Model It Needs

Not every task needs the most powerful model:

  • Mechanical tasks (renaming, formatting, summarizing): a fast/cheap model is enough—switch with /model.
  • Designing, hard debugging, refactoring: the powerful model—that's what it's for.
  • Volume and private data (processing a hundred PDFs, chatting with documents): no cloud, no limits—your local AI. How to connect it is covered in the lesson "Connect Claude Code with Your Local AI" in the Local AI course.
  • CLAUDE.md when starting each project (and updated when you make an important decision).
  • /clear when switching tasks; /compact on long tasks.
  • Subagents for exploring; limit which files it should read.
  • Fast model for mechanical work; local AI for volume and private data.

Challenge to Practice

Take your most active project and write its CLAUDE.md today (with help from Claude Code). Tomorrow, time how long it takes to pick the work back up. That minute that used to be ten is the best metric for this lesson.

Complete Aulafy mapSee how this lesson fits without leaving your path.

Complete Aulafy map

How all courses connect

This is not a checklist. Start with the foundation, choose an outcome, and go deeper only when your project needs more control.

  1. 1Understand
  2. 2Apply or build
  3. 3Operate with confidence
01

Choose an application

Turn the foundation into a visible outcome: a website, a business improvement, media, or an interactive experience.

Continue into the technical branch when you need to maintain code, data, or infrastructure.

02

Build with code

Prepare your environment, work with coding agents, and run models while keeping control of your projects.

This branch prepares you to design and operate reliable AI systems.

03

Take systems to production

Combine retrieval, agents, evaluation, security, deployment, and model adaptation when the problem requires it.

You do not need every course: choose the component your system needs and return as it grows.

View full catalogue