Harness Engineering 6 months ahead, in a few hours.

Module 00 — AI basics for developers Free

Updated

In this module

This first module explains how an LLM produces text, and what tokens and the context window are. You also meet the harness, the configuration that guides an agent like Claude Code.

0.1 — What is an LLM?

A Large Language Model (LLM) is a neural network trained on huge amounts of text to predict the next token. When you type "The capital of France is", the model computes a probability for every possible continuation. "Paris" gets the highest one. The model looks nothing up in a database or a search engine to answer.

The autocomplete analogy

Your IDE's autocomplete looks at the local context (imports, types, variables) to suggest what comes next. An LLM applies the same principle at a much larger scale. It draws on what it saw during training: documentation, open source code, books, articles.

How it learns

Training happens in several stages.

1. Pre-training. The model reads terabytes of text and learns the regularities of language and code.

2. Fine-tuning. It is refined on more targeted data, then humans rate its answers to make it useful in conversation.

3. Reinforcement learning. Recent models also train on tasks with a checkable result, such as tests that pass. That is where they learn to reason step by step before answering.

The core mechanism is called attention (Transformer architecture, Google, 2017). It lets the model connect every part of the input text to every other part. A return type defined on line 3 is still usable on line 200.

Key takeaways

• An LLM predicts the next token from all the tokens before it.

• It looks nothing up in a database, its answers come from what it learned.

• Even when it reasons step by step, it is predicting tokens. The result is often right, with no guarantee.


0.2 — Tokens: the basic unit

A token is a fragment of text: a whole word (function), a piece of a word, or a single character. A long or rare word like deserialization is split into several tokens. A tokenizer does this splitting, and each model family has its own.

Why tokens matter for a developer

  • Cost. You pay for every token you send (input) and every token generated (output).
  • The context window. Its size is measured in tokens, and one million tokens is fewer than one million words.
  • Code. Braces, indentation and long names often produce more tokens than prose of the same length.

Counting your tokens

With the tokenizer of current Claude models, one million tokens is about 555,000 English words. Older Claude models fit about 750,000. Other languages, such as French or Spanish, usually take more tokens than English for the same content.

In Claude Code, the /context command shows what fills your window. The Claude API also has an endpoint that counts the tokens of a request. Measure your context files first, because they are reloaded in every session.

Key takeaways

• A token is a fragment of text, often shorter than a word.

• Each model family has its own tokenizer, and it can change from one generation to the next.

• Code usually takes more tokens than plain prose.

• You pay for input tokens and for output tokens.


0.3 — The context window

The context window is the maximum number of tokens an LLM can process in a single request. It is the model's working memory. Your conversation, your code and your instructions all have to fit in it. Current Claude models have a one-million-token window.

If a request goes over the limit, the API rejects it. Claude Code avoids this by summarizing the conversation when the window gets close to the limit. This operation is called compaction.

What fills the window

The window holds much more than your prompt.

Element Description
System prompt The base instructions supplied by the tool
History All previous questions and answers
Loaded context Files read, documentation, command results
Response in progress The tokens the model is generating

When Claude Code reads 15 files from your project, those 15 files sit in the window. So does the history of your last 30 exchanges. A large codebase can exceed one million tokens on its own.

More context does not mean a better answer

LLMs retain the beginning and the end of the context better than the middle. This is known as "lost in the middle". Anthropic also talks about context rot: as the token count grows, accuracy and recall drop. So choose what you give the model, and keep your conversations short.

Key takeaways

• The context window is the model's working memory, measured in tokens.

• It holds the system prompt, the history, the files read and the response in progress.

• An overloaded context lowers the quality of the answers.

• A long conversation fills the window, so start a fresh session between two tasks.


0.4 — Prompt vs context

The prompt is the question or instruction you send. The context is all the information that comes with it. Many developers polish the prompt and neglect the context. Yet a simple prompt with rich context often gives a better result than a polished prompt with poor context.

The context layers

Context stacks up in four layers.

1. System prompt. The base instructions supplied by the tool.

2. Persistent context. Files like CLAUDE.md, which describe your project and its conventions.

3. Session context. Files read, command results and history.

4. Prompt. Your question or instruction.

The first three layers weigh on every answer. A well-written CLAUDE.md therefore serves all your sessions, while a prompt serves once.

The consultant analogy

The prompt is the question you ask a consultant. The context is the file you send before the meeting: documentation, existing code, constraints, past decisions. Without it, you get a generic answer. With a complete file, the same question gets an answer that fits your project.

Key takeaways

• The prompt is your question, the context is everything that comes with it.

• Context often matters more than the wording of the prompt.

• Persistent context, such as CLAUDE.md, serves every session of the project.


0.5 — The limits of LLMs

An LLM has known blind spots: it can make up facts, go wrong in a long chain of reasoning, and miss anything recent. Knowing them lets you work around them.

Hallucinations

An LLM can state something false with confidence. It sometimes invents an API, a parameter or a function that does not exist. The risk grows on topics that are rare in its data: recent libraries, internal APIs, proprietary code.

Fallible reasoning

Current models reason step by step before answering. They first generate reasoning tokens, then the answer. The most capable ones can carry long tasks from start to finish this way. This reasoning is still token prediction, though, and a mistake early in a long chain carries through to the end.

Other limits

  • Memory. Every conversation starts from scratch. In Claude Code, CLAUDE.md and auto memory keep information from one session to the next.
  • Cutoff date. The model does not know what was published after its training.
  • Data bias. Widely used languages and frameworks are handled better than the others.
  • Execution. On its own, a model can neither compile nor test its code. The next section shows how an agent fills this gap.

Key takeaways

• Check the APIs and signatures the model gives you, because it can invent them.

• Break complex problems down and check the result of each step.

• Without configuration, the model remembers nothing from one session to the next.


0.6 — Inline completion vs agent: AI tools for developers

A coding agent is an LLM that can use tools: read files, run commands, edit code. Inline completion only suggests the continuation of what you are typing. This difference changes what you can delegate.

How a model that predicts tokens can act

The model runs nothing itself. When it needs an action, it writes a structured request, for example "read this file". That is a tool call. Claude Code runs the action on your machine, then sends the result back to the model. The model reads the result and picks the next step, another tool call or the final answer.

This cycle is called the agentic loop. It lets the model run the tests, read the error and fix it. Module 2 covers it in section 2.3.

Inline completion

You type code and the AI suggests the continuation in real time. You accept with Tab or keep typing. The design stays in your hands, and the AI works at the scale of a line or a block.

Agentic mode

You describe the result you want:

Implement a repository for retail offers
following the same pattern as the existing repository
for partnerships.

The agent explores your codebase, creates the files, writes the code, runs the tests and fixes the errors. You hand over a whole task, then you check the result.

Inline completion Agent
What you provide The start of the code A task described in plain language
Scale A line or a block Several files
Your job Sorting the suggestions Scoping the task and checking the result
Risk Low, one line at a time Higher, because a mistake touches several files

The more autonomous the agent, the more a misunderstanding costs. Configuring the agent limits that risk, and section 0.10 is about exactly that.

The main tools

Most tools now come in several forms. GitHub Copilot and Cursor are known for autocomplete in the editor, and they also offer an agent mode. Claude Code and Codex CLI are agents that started in the terminal. Claude Code also runs in VS Code, in JetBrains, in the desktop app and on the web. Other agents exist, such as Cline and OpenCode.

The tool and the model are two separate choices. Cursor and Copilot give access to models from several providers. Claude Code uses Claude models. This course focuses on Claude Code and on agentic mode.

Key takeaways

• An agent acts through tool calls: Claude Code runs them and sends the result back to the model.

• Inline completion finishes your line, while an agent takes on a whole task.

• The more you delegate, the more configuration and verification matter.


0.7 — Choosing your model

Choosing your model means trading off capability, speed and cost for each task. The most capable model is also the most expensive. At Anthropic, the Claude lineup has four families.

Family Profile When to use it
Fable The most capable, for demanding reasoning and long autonomous tasks The hardest problems, when Opus is not enough
Opus Long coding tasks, architecture, deep bugs The starting point Anthropic recommends
Sonnet Fast, a good balance of speed and intelligence Well-scoped everyday tasks
Haiku The fastest and the cheapest Simple tasks and high volume

In November 2026, the current versions are Fable 5.2, Opus 5.5, Sonnet 5.5 and Haiku 5.5. Opus 5.5 is the default model in Claude Code at that date. Depending on your plan, Fable can be billed to usage credits, on top of your subscription.

Switching models in Claude Code

Claude Code
/model            # Opens the picker
/model sonnet     # Switches to Sonnet
/model opus       # Switches to Opus
/model default    # Back to your account's default model

/model saves your choice for later sessions. To change only the current session, open the picker and press s.

Effort level

The effort level sets how much thinking the model puts into each answer. You change it with /effort. There are five levels, from low to max.

Level Usage
low Quick exchanges where you review each result, renames
medium Everyday development with a clear scope
high A bug in existing code, edge cases
xhigh Deeper reasoning, at the price of more tokens
max Hard problems Claude has to solve alone, sometimes for a small gain

The Claude models of November 2026 start at medium in Claude Code. Go up one level when a task needs more checking, then come back down. High effort uses more tokens and answers more slowly.

Elsewhere you will come across settings such as temperature or top_p, which tune randomness in token selection. Recent Claude models no longer accept them, and the API for Opus 5.5 returns a 400 error if you send them. In Claude Code, your setting is therefore the effort level.

Key takeaways

• Opus is the starting point, Sonnet is faster and cheaper, Haiku handles volume and Fable the hardest tasks.

• /model switches models and /effort sets the depth of thinking.

• The right model depends on the task, and you can switch mid-session.


0.8 — The cost of AI

The cost of an LLM is counted in tokens: you pay for what you send and for what the model generates. With Claude Code, you pay through a subscription or by usage, with an API key.

Subscriptions

A subscription includes Claude Code, with usage limits. These are the prices as of late November 2026.

Plan Price Usage
Pro $20/month The baseline
Max $100/month 5 times Pro usage
Ultra $200/month 10 times Pro's weekly usage

For regular use, a subscription can cost less than paying by usage.

Price per token

With an API key, you pay for every token. These are the API prices as of late November 2026, per million tokens.

Model Input Output
Claude Haiku 5.5 $0.10 $0.50
Claude Sonnet 5.5 $2 $10
Claude Opus 5.5 $4 $20
Claude Fable 5.2 $8 $40

Output tokens cost five times more than input tokens. Haiku 5.5 costs more when the prompt goes over 100,000 tokens. Claude Code caches the start of the conversation, and tokens read back from that cache cost a fraction of the input price.

Cost in practice

According to the Claude Code docs, the average cost in enterprise deployments is around $13 per developer per active day. It stays under $30 for 90% of users. Compare that amount with the time the same tasks would take you by hand.

Lowering the bill

1. Match the model and the effort to the task. Sonnet costs half as much as Opus and is enough for simple tasks.

2. Keep conversations short. Every message resends the whole history, so a long session costs more and more.

3. Take care of your persistent context. A good CLAUDE.md saves you from re-explaining your project in every session.

Key takeaways

• You pay through a subscription or per token, and output tokens cost five times more than input tokens.

• In enterprise deployments, Claude Code costs about $13 per developer per active day on average.

• Model choice, effort and conversation length all move the bill.


0.9 — Security and privacy

When you use a hosted LLM, your code leaves your machine. So you need to know what is sent, where, and what the provider does with it.

What is transmitted

Claude Code sends Anthropic your prompt, the files the agent reads, the command results and the history. Under commercial terms, Anthropic does not use this data to train its models. That covers the Team and Enterprise plans, the API, and cloud platforms such as Amazon Bedrock.

On the Free, Pro, Max and Ultra plans, it is a setting. If it is on, your sessions can be used for training and are kept for 5 years, versus 30 days otherwise. You check it at claude.ai/settings/data-privacy-controls.

The three risks

1. Secrets. A .env file, a hardcoded token, a database password. If the agent reads them, they are transmitted.

2. Personal data. Test fixtures with real emails or real addresses raise a GDPR problem.

3. Intellectual property. Your code and your business algorithms go to a third party.

Blocking access to sensitive files

Claude Code has no .claudeignore file, and such a file has no effect. To forbid reading sensitive files, add deny rules to .claude/settings.json:

{
  "permissions": {
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./credentials/**)",
      "Read(./secrets/**)",
      "Read(**/fixtures/production/**)"
    ]
  }
}

These rules block Claude's file-reading tools and commands like cat or head. They do not block a script that opens the file itself. For OS-level blocking, enable the sandbox, introduced in module 3 and covered in depth in module 11.

Three habits complete these rules. Keep your secrets in a secrets manager. Anonymize your test fixtures. Agree with your team on a rule for using AI tools.

For sensitive projects, you can go through Amazon Bedrock, Google Cloud or Microsoft Foundry to stay in your own cloud. Eligible Enterprise accounts can also ask for Zero Data Retention.

Key takeaways

• Every exchange sends your prompt, the files read and the command results to the provider.

• deny rules on Read(...) protect your sensitive files, while a .claudeignore has no effect.

• On a consumer plan, check the training setting in your privacy settings.


0.10 — Harness Engineering

The harness is everything you put around a coding agent to guide it: instructions, permissions, tools, automatic checks. Harness Engineering is the work of designing and adjusting that set. The word comes from the harness that directs the strength of a draft horse.

The concept is described in an article by Birgitta Böckeler published on Martin Fowler's site.

Why configure instead of rephrasing

A prompt serves once. A configuration is written once, then Claude Code reloads it in every session of the project. Time spent on the harness therefore benefits all your later tasks. It also benefits your team when the configuration is versioned with the code.

The building blocks of the harness and the modules that cover them

The breakdown below is this course's own. Birgitta Böckeler's article proposes a different one.

Harness building block What it brings Module
CLAUDE.md and rules Persistent context: architecture, conventions, project commands Module 2
Permissions and sandbox What the agent can read, edit and run Module 3
Skills and commands Reusable procedures, loaded on demand Module 4
Hooks Automatic checks on every action, such as lint or tests Module 5
MCP Access to external tools: database, tickets, GitHub Module 6
Subagents Delegated or parallel tasks, each in a fresh context Module 7

AGENTS.md plays the same role as CLAUDE.md for other coding agents. Claude Code reads it when the project has no CLAUDE.md.

Your turn: ten minutes with Claude Code

You need a Pro plan or higher, or an API key.

1. Install Claude Code. On macOS, Linux and WSL, run curl -fsSL https://claude.ai/install.sh | bash. For other setups, follow the official docs.

2. Open a terminal in one of your projects, run claude, then type /context. Look at what already fills the window before your first message.

3. Type /model and note the active model.

4. Ask for a read-only task: "Explain the architecture of this project and list the build and test commands."

5. Watch the tool calls scroll by: files read, searches, commands. This is the agentic loop from section 0.6.

6. Run /context again and compare. The files read have filled part of the window.

7. Finish with /init, which generates a first CLAUDE.md. It is the first building block of your harness.

Key takeaways

• The harness gathers the instructions, permissions, tools and checks that surround the agent.

• A configuration written once serves every session, while a prompt serves once.

• The following modules build this harness block by block, starting with CLAUDE.md.

Quiz — Check your learnings

Question 1 / 6
01.

Why does time spent configuring the harness pay off more than time spent polishing a prompt?

Go further