How Claude Code Works
The agentic loop, context window, tools, and permission modes. An interactive explainer from Anthropic.
Claude Code operates on an agentic loop—a repeating 4-step cycle that turns your prompts into working code. Understanding this loop unlocks the tool's full power.
Interactive Guide
Click through the sections below to learn how Claude Code works.
Key Concepts
The Agentic Loop
A 4-step cycle: Prompt (you describe what you want) → Gather Context (Claude Code reads your project) → Take Action (edit files, run commands) → Verify (check if goal is met, then loop or stop).
Context Window
Claude Code's working memory. When you start, it's mostly empty. As it reads files and runs commands, the window fills up. Hit the limit? It auto-compacts—summarizing and dropping details to keep the conversation going.
Tools
Claude Code accesses tools like file reading, editing, command execution, and code search. Every tool call is transparent—you see what it did and approve before it affects your project.
Permission Modes
Three modes control how much Claude Code can do: Default (asks before every change), Auto-Accept Edits (skips file edit prompts), and Plan Mode (read-only, drafts a plan first).
Frequently Asked Questions
When Claude Code hits the context limit, what happens?
It compacts the conversation—automatically summarizing and dropping what it can to free up room—so the conversation can keep going without losing critical state.
How do you make Claude Code plan an approach before it edits anything?
Use plan mode. It uses read-only tools to compile a plan of action before starting, so you can review the approach with no risk of a premature change. Toggle to it with Shift+Tab.
Does Claude Code ask before changing files?
By default, yes. Claude Code asks explicit permission before editing a file or running a shell command. You can change this with permission modes using Shift+Tab.
How does Claude Code decide which tool to use?
It uses semantic search to determine when to call a tool—such as a read-file tool or a search-web tool—and to use the output of that tool effectively.
Can I use Claude Code offline?
No. Claude Code calls the Claude API, so you need an internet connection and an API key or subscription.
Ready to Get Started?
Open Claude Code and try it out. Start with a small task and build from there.
Read the Complete Claude Code Guide