01Why long sessions go wrong
A new session does not automatically carry the previous conversation (only CLAUDE.md and memory do), but inside one session every request sends the whole conversation again: your prompts, every file it opened, every command output. That history is the context window, and it is finite. As it fills, answers get slower and less accurate, and each request carries more tokens. (What those tokens cost is a separate question: prompt caching can make repeated material cheaper to bill, but it does not shrink the window. Day 12 covers the cost side.) Claude starts forgetting early instructions and repeating itself.
The second half of this article is the other side of control: permissions. Claude Code asks before it edits files or runs commands. Set that up well and you stop clicking "yes" on the same prompt fifty times, without handing over the keys.
02What fills the context
01Files it read
Every file Claude opens stays in the chat. A big file read once keeps costing space until you clear.
02Command output
A test run or build log can dump thousands of lines into the chat. Ask for only the failures.
03Dead ends
Every wrong turn and abandoned approach is still in there, nudging the next answer.
04Always-on extras
Your CLAUDE file, MCP servers and skills load at the start of every session. Keep the CLAUDE file short (under about 200 lines).
03See it, then manage it
In the terminal, run /context to see what is using the space. /usage shows your token use and plan limits. In VS Code, the prompt box has a context indicator that shows how full the window is, so you can glance at it as you work. Claude compacts automatically when it gets close to full, but do not wait for that: by then quality has already dropped.
/context what is using the window right now /compact summarize the chat and keep going /compact focus on the failing tests and the auth plan /clear new conversation, empty context /rename login-bug name this session so you can find it later /resume pick an earlier session back up
You want to keep the thread: decisions, plan, what is left
Add instructions on what to keep
Claude keeps repeating a wrong idea
You finished and committed
Costs nothing, and your CLAUDE file loads again
In VS Code, /compact and /clear work in the prompt box the same way. To start fresh, open a new conversation (the plus button in the panel, or a new editor tab). Click Session history to resume an earlier one. Name sessions before you leave them so you can find them tomorrow.
04Habits that keep it sharp for hours
/clear./compact with instructions at a natural break, not at 95%.You can also tell Claude what to keep when it compacts by adding a "Compact instructions" section to your CLAUDE file, for example "when compacting, keep test output and code changes". Subagents get their own deep dive later in the series.
05Permissions: asked, allowed, denied
By default Claude Code is in Manual mode. It can read files in your project freely, but it asks before it edits a file, runs most shell commands or fetches from the web. That is the right starting point. Permissions are not a nuisance, they are the reason you can let it near a real codebase.
Six modes decide how much it asks. Switch with Shift+Tab in the terminal (it cycles through the common ones) or the mode indicator at the bottom of the VS Code prompt box.
Manual (default) asks before edits and most commands acceptEdits edits files in your project without asking plan reads and proposes, no edits (Day 4) auto a background checker reviews actions for you dontAsk denies anything not already allowed bypassPermissions skips prompts. Only in a container or VM
Start a session in a mode with claude --permission-mode acceptEdits. Use acceptEdits once you trust the plan and review the result with /diff. The names in VS Code differ slightly (for example "Edit automatically"), so pick from the indicator. Stay away from bypassPermissions on your own machine: it can write even to protected folders like .git.
06Stop approving the same command
When a prompt appears you can choose "Yes, and don't ask again". For a command, that saves a rule for the repository. You can also write rules yourself with /permissions, or in a settings file:
{
"permissions": {
"allow": [ "Bash(npm run *)", "Bash(git commit *)" ],
"deny": [ "Bash(git push *)", "Read(./.env)" ]
}
}
Three things to know. Deny beats ask beats allow, so a deny rule always wins. Put the * after the subcommand: Bash(git log *) allows only git log, while Bash(git *) allows every git command, including push. And rules live in three places: your own project file (.claude/settings.local.json, not committed), the shared project file (.claude/settings.json, committed, so the team gets it) and your user file (~/.claude/settings.json, every project).
Remember: rules are enforced by Claude Code itself. Writing "never touch the .env file" in a CLAUDE file shapes what Claude tries, but only a deny rule actually blocks it.
07A safe setup to copy
git status, git diff.git push, secrets such as .env, anything that deletes./rewind and git undo the rest.08Try this today
/context (or glance at the VS Code indicator) in a session that has run a while./compact with one line on what to keep, then ask a follow-up and see it still knows./permissions and allow your test command so it stops asking.git push.Next up: git with Claude Code. Commits, reviews and pull requests, and how to let it do the boring parts without losing track of what changed.