How Claude Code Actually Works
You have seen what Claude can do. Now it is worth spending five minutes understanding how it actually works — not the engineering, just the mental model. Get this right and everything clicks. Skip it and you will spend weeks wondering why Claude sometimes misses the mark.
How Claude reads, thinks, and takes action
When you type something to Claude, it does not just read your message. It reads everything: your message, the entire conversation so far, any files you have shared, and the contents of files in your project folder. All of it goes in at once. Claude looks at the whole picture, figures out what to do, and then acts.
That last word matters. Claude does not just reply. It can do things.
- Read files — any document, spreadsheet, PDF, or code file you point it at
- Write and edit files — create new ones, rewrite existing ones, make targeted changes
- Run commands — execute code, install things, convert files, start servers
- Open apps and browsers — show you the result in real time
- Use tools — search the web, connect to external services, call APIs
The combination is what makes it powerful. Most AI tools can only talk. Claude can talk and then actually do the thing it just described.
What this means in practice
You do not need to do the work yourself and then ask Claude to check it. You can hand the whole thing to Claude and come back when it is done.
Say you have a folder of Excel files from different departments and you need a combined summary. You do not open them one by one, copy-paste, and stitch it together. You say: "I have a folder called reports on my Desktop. Each file has a monthly sales table. Combine them into a single summary with totals by region and create a bar chart." Claude opens every file, reads the data, writes the code to process it, runs the code, and saves the output.
That is not a demo trick. That is what it actually does.
How Claude's memory works
This is the part most people get wrong, and it causes real frustration.
Claude does not remember between sessions. Every time you start Claude fresh, it starts with a blank slate. It has no idea what you worked on yesterday, what your name is, or what project you are building. You start over.
Within a session, Claude remembers everything. Every message, every file, every change. The longer a session runs, the more context Claude has — which generally means better results.
There are two ways to give Claude memory that persists:
- CLAUDE.md — a plain text file you put in your project folder. Claude reads it automatically every time it starts. Put anything you want it to always know: your name, the project structure, preferences, key decisions. Chapter 9 covers this in detail.
- Paste it in — if you need Claude to know something from a previous session, paste the relevant notes or output into the new conversation. Clunky, but it works.
CLAUDE.md is the single best habit to build. A two-paragraph file explaining your project and preferences will make every future session dramatically better. You do this once and it compounds forever.
What tokens are and why they matter
Every time Claude reads or writes anything — your message, a file, its response — it measures the work in tokens. Your plan includes a certain number of tokens before you hit a limit, so it is worth knowing what they actually are.
A token is not a word. It is more like a chunk of text. Short common words like "the" or "and" are usually one token each. Longer or unusual words get split into two or three. Numbers, punctuation, and spaces all count too. As a rough rule of thumb: 100 tokens ≈ 75 words, or about half a page of normal text.
The easiest way to see this in action: go to platform.openai.com/tokenizer, paste in any paragraph, and watch it colour-code each token. It takes about thirty seconds and makes the whole concept click immediately.
Why does this matter? Because Claude reads everything in the conversation every time it responds. Your first message, every reply, every file — all of it. The longer the session runs, the more tokens each response costs, because Claude is re-reading the growing history each time.
For most normal use — asking questions, building small things, editing documents — you will never notice any of this. Your Pro plan is generous. But if you are working on something large, it is good to know the levers.
Staying in control of memory and cost
Claude Code has four commands worth knowing. You type them at the > prompt, same as anything else.
-
/clear— wipes the entire conversation and starts fresh. Claude forgets everything from the session. Use this when you finish one task and move on to something unrelated. It keeps sessions lean and stops old context from interfering with new work. -
/compact— compresses the conversation instead of wiping it. Claude summarises everything that has happened so far into a shorter version, then continues from there. Use this when a session has gone long but you still need Claude to remember what you have been working on. -
/memory— opens the memory file for your project (the CLAUDE.md file described above). You can read what Claude currently knows about your project and add or edit anything. Changes here persist across all future sessions. -
/init— runs when you start working in a new project folder for the first time. Claude looks through your files and writes a CLAUDE.md automatically, with a summary of what it found: what kind of project it is, what the main files do, any patterns it noticed. A good starting point you can then edit and build on.
The habit that saves you the most friction: run /init when you start any new project, then use /clear between tasks. Two commands. Every session starts clean and Claude always knows the basics of your project without you having to re-explain.
If you ever hit a usage limit, Claude will tell you plainly. You wait a short while and it resets. It is not a crisis. Just a nudge to take a break.