Under the Hood: How Claude Desktop and Claude Code Actually Work
Purpose: Minimum necessary understanding for a researcher to use these tools confidently and without confusion. Not a technical deep-dive — a mental model that explains the behaviour you observe.
1. Claude is a text-in, text-out machine
At its core, Claude is a large language model (LLM). It takes text as input and produces text as output. "Text" here is broad — it includes the content of PDFs, spreadsheets, images (Claude can read images), and code. But fundamentally: everything goes in as text, everything comes out as text.
Claude does not browse the internet on its own, does not remember yesterday's conversation, does not have opinions about you, and does not learn from your conversations. It is a very powerful text transformation engine.
2. The context window: Claude's working memory
The single most important concept to understand is the context window.
The context window is everything Claude can "see" at once in a conversation — your messages, its own responses, any files you attached, any instructions given at the start. It is Claude's entire working memory for that session.
Think of it like a very large sheet of paper. Everything written on that sheet is what Claude knows. When the sheet is full, older content falls off. When the conversation ends, the sheet is thrown away.
Practical implications:
-
Claude does not remember previous conversations. Each new conversation is a blank sheet.
-
Very long documents or many files can fill the context — Claude may start to "forget" the beginning.
-
If you want Claude to always know something (your role, your project background), you must put it on the sheet at the start, every time. Or use a tool that does this automatically.
Typical context window sizes (2025): Claude can hold roughly 200,000 tokens — approximately 150,000 words, or a short novel. This sounds large. In practice, a folder of 20 dense PDFs will fill it.
3. Claude Desktop: you and Claude, alone
Claude Desktop is a graphical chat interface to Claude. The architecture is simple:
You → [type message, attach files] → Claude → [response in chat]
What goes into the context:
-
Your messages
-
Claude's responses
-
Files you manually attach (converted to text internally)
-
A system prompt (Anthropic's default instructions, plus any custom instructions you set)
What does NOT happen:
-
Claude cannot reach out to your filesystem
-
Claude cannot call external services (unless you install a Plugin/MCP server)
-
Claude cannot write files to your disk
-
Nothing persists to the next conversation unless you re-add it
Claude Desktop Projects add one layer: you can attach files and custom instructions to a Project, and they are prepended to every conversation in that Project. This partially solves the persistence problem, but files are still copies uploaded to Anthropic's servers, not live access to your disk.
4. Claude Code: Claude with tools
Claude Code is a different architecture. Claude is still the same model — but now it has tools it can use.
You → [type message in terminal] → Claude thinks → uses a tool → sees result → thinks → responds
Tools available by default in Claude Code:
-
Read file — read any file from your disk by path
-
Write file — write or edit any file on your disk
-
Run command — execute a terminal command (run a script, call a program)
-
Search files — search content across your filesystem
-
Web fetch — retrieve a webpage
-
Web search — search the internet
This is the key difference. Claude Code's Claude is not just talking to you — it is an agent that can act on your computer. It can read your files without you uploading them. It can write results directly to disk. It can run a Python script to process 1000 rows of data.
The agent loop
When you give Claude Code a task, it does not just respond once. It runs a loop:
- Think — what is the task? what do I need?
- Act — use a tool (read a file, run a command, search the web...)
- Observe — see the tool's output
- Think again — what did I learn? what next?
- Repeat until the task is done, then respond to you
You can watch this happen in real time in the terminal — Claude Code shows you each tool use as it happens. This transparency is useful: you can see what it is doing and why.
Diagram: the agentic loop. Source: How Claude Code works — official Claude Code documentation (Anthropic).
What stays local, what travels
The agent loop diagram above shows the logical flow but not the data boundary. Here is what actually crosses the network:
Diagram: local execution vs. Anthropic servers. The key point: files are read locally by tools, but their contents are assembled into the context payload and sent to Anthropic's API on every loop turn. "Local" means the files are not uploaded as files — it does not mean the content is private. → See A.issue.privacy-security for GDPR implications, training data policies, and the personal data decision flowchart.
5. MCP: plugging in external tools
MCP (Model Context Protocol) is a standard that lets you connect Claude to external services and tools beyond the defaults.
Think of MCP servers as plugins for Claude Code (and increasingly for Claude Desktop too). Examples:
-
Zotero MCP — Claude can search your Zotero library, retrieve citations, read abstracts
-
Filesystem MCP — extends file access to specific directories you authorise
-
Web search MCP — more powerful or specific web search
-
Database MCP — Claude can query a local or remote database
MCP servers are small programs that run on your computer and expose their functionality to Claude. You configure which ones Claude has access to. Claude then decides when to use them.
This is how the Zotero integration works: a running MCP server translates Claude's requests ("search for papers on X") into Zotero API calls, and returns the results to Claude's context.
6. The system prompt: invisible instructions
Every Claude conversation begins with a system prompt — a block of instructions that sets Claude's behaviour, role, and constraints. You usually do not see it, but it is always there.
In Claude Desktop, the system prompt includes Anthropic's default safety and behaviour instructions, plus any custom instructions you set in settings or in a Project.
In Claude Code, the system prompt includes Anthropic's defaults plus the contents of a special file: CLAUDE.md — a markdown file you place in your project folder. If this file exists, Claude Code reads it at the start of every session. This is how you give Claude persistent context about your project, your preferences, and your workflow — without re-typing it every time.
Example CLAUDE.md contents for a researcher:
# Project: Inquisition Sources 1230–1320
I am a historian working on inquisition records from Languedoc.
Key concepts: perfecti, credentes, deposition testimony, notarial formula.
Output language: English unless I specify otherwise.
When extracting data, output as CSV unless I say otherwise.
My Zotero library covers this period — use it when I ask for sources.
7. What this means practically
| Question | Desktop | Code |
|---|---|---|
| Can Claude see my files without uploading? | No | Yes |
| Does Claude remember last session? | No | No (but CLAUDE.md persists) |
| Can Claude write to my disk? | No | Yes |
| Can Claude process a whole folder? | No | Yes |
| Can Claude connect to Zotero? | With plugin | With MCP server |
| Do I need to code to use it? | No | No (mostly) |
| What happens when context fills up? | Older messages drop off | Same |
8. What you do NOT need to understand
For the purposes of this workshop, you do not need to know:
-
How the model was trained
-
What transformer architecture means
-
How tokenisation works in detail
-
How MCP servers are built
-
How to write code to use the API
The mental model above — context window, agent loop, tools, CLAUDE.md — is sufficient to use Claude Code effectively and to understand why it behaves as it does.
Related
-
A1.desktop-vs-code — practical consequences of these differences
-
A.concept.agents — deeper dive into what "agent" means and how to supervise it
-
A9.markdown-project-memory — how CLAUDE.md works in practice
-
A.issue.upload-dance — why Desktop's architecture creates file friction
-
A.skills-ecosystem — the full skills and MCP ecosystem for researchers: what to install, how to configure MCP servers, when to use which
-
A.setup.zotero-mcp — the Zotero MCP server in practice: step-by-step setup for Windows and WSL
-
A.concept.global-vs-local — where MCP configuration lives (global vs project-level settings.json)