Glossary
- `usage`
- The object in every Messages API response that counts the tokens of that request, split by kind. Anthropic bills each request from these counts.
- Cost and latency
- Adaptive thinking
- The mode set by
thinking: {"type": "adaptive"}: the model decides on each request whether to think and how much. - Letting the model think
- Agent
- Anthropic's definition: a system where models "dynamically direct their own processes and tool usage". In code, a model calling tools in a loop until a stop condition holds.
- The agent loop
- Agent file
- A Markdown file with YAML frontmatter that defines a subagent. The body after the closing
---is its system prompt. Onlynameanddescriptionare required. - Subagents in Claude Code
- Agreement rate
- The share of cases where two graders give the same verdict. You compute it between the judge and humans, and between two humans.
- Grading with a model
- Automation mode
- How
claude-code-actionruns when the workflow passes apromptinput: Claude starts at once, without waiting for an@claudecomment. - Claude Code in scripts and CI
- Bare mode
- The
--bareflag: Claude Code skips hooks, skills, plugins, MCP servers, auto memory and CLAUDE.md that it would otherwise find on the machine. It needsANTHROPIC_API_KEY, because it never reads your subscription login. - Claude Code in scripts and CI
- BM25
- A ranking function based on TF-IDF that scores chunks by exact word matches. It finds a string like "TS-999" that an embedding search can miss.
- Retrieval-augmented generation
- BPE
- Byte pair encoding: start from the 256 byte values, then repeatedly give the most frequent pair of neighbouring ids a new id.
- Tokens
- budget_tokens
- The older fixed thinking budget,
thinking: {"type": "enabled", "budget_tokens": N}, at least 1,024. Claude 4.7 and later models reject it with a 400 error. - Letting the model think
- Cache breakpoint
- A
cache_control: {"type": "ephemeral"}marker on a content block, or once at the top level of the request. The cached prefix ends at that block, and a request can have up to 4 of them. - Prompt caching
- Cache write
- The first request with a new prefix stores it, shown as
cache_creation_input_tokens. Later requests with the same prefix get a cache read, shown ascache_read_input_tokens. - Prompt caching
- Checkpoint
- A snapshot of a file that Claude Code takes before Claude edits it. Pressing
Esctwice rewinds to an earlier state. - Claude Code in one session
- Chunk
- A piece of a document, usually no more than a few hundred tokens, that is indexed and retrieved on its own.
- Retrieval-augmented generation
- Chunking
- Cutting a long text into pieces and sending each piece in its own request. The cookbook cuts every 2,000 characters.
- Working with long documents
- Citation
- A pointer from a sentence of the answer to the passage of a provided document that supports it. The Claude API returns it as
cited_textplus a location. - Confident and wrong
- Citations
- An API feature turned on with
citations.enabled=trueon each document block. Each claim in the answer comes back with the passage it rests on. - Working with long documents
- CLAUDE.local.md
- A personal
CLAUDE.mdat the project root that you add to.gitignore. It loads after the projectCLAUDE.mdin the same directory. - CLAUDE.md
- CLAUDE.md
- A Markdown file of instructions you write. Claude Code reads the ones in your working directory and the directories above it at the start of every session.
- Memory across sessions
- CLAUDE.md
- A Markdown file of instructions that Claude Code reads at the start of every session. The project one lives at
./CLAUDE.mdor./.claude/CLAUDE.mdand is committed with the code. - CLAUDE.md
- Code-based grading
- A program checks each answer, for example
output == golden_answerorkey_phrase in output, and returns the same verdict for the same answer every time. - Testing a prompt
- Constitutional AI
- Anthropic’s method where a model critiques and revises its own answers, and labels which answer is less harmful, using a written list of principles.
- How a model is trained
- Constrained decoding
- The API compiles the schema into a grammar and, at each step, lets the model pick only tokens that keep the output valid against it.
- Getting JSON back
- Content block
- One item of a
contentarray, with atypesuch astext,image,tool_useorthinking. A plain string ascontentis shorthand for onetextblock. - The Messages API
- Content block index
- The
indexon every block event. It is the position the block will have in thecontentarray of the final message, so index 1 is the second block. - Streaming
- Context
- What the model cannot guess: who reads the result, why a rule exists, what the result is used for.
- Clear instructions
- Context isolation
- Each subagent has its own context window. Its searches and page reads stay there; only its final result enters the orchestrator's context.
- Splitting work across agents
- Context rot
- Anthropic’s name for the drop in accuracy and recall as the number of tokens in the context grows.
- The context window
- Context rot
- The drop in accuracy and recall as the number of tokens in the context grows, named in the context windows docs.
- Working with long documents
- Context window
- The maximum number of tokens one request can hold: everything the model reads plus everything it writes back in that turn.
- The context window
- Contextual Retrieval
- Before indexing, a model writes 50 to 100 tokens that place each chunk in its document, and that text is prepended to the chunk for both the embeddings and the BM25 index.
- Retrieval-augmented generation
- Cosine similarity
- The cosine of the angle between two vectors: 1 when they point the same way, 0 when they are at right angles, -1 when they are opposite.
- Embeddings
- Cost per completed task
- What you paid in tokens divided by the number of tasks the model got right, retries included.
- Choosing a model
- Custom command
- A Markdown file in
.claude/commands/that you run by its file name:deploy.mdruns as/deploy. The docs merged commands into skills, and both formats keep working. - Slash commands and plugins
- custom_id
- The name you give each request in the batch, 1 to 64 letters, digits, hyphens or underscores. It is the only way to match a result to its request.
- Batch processing
- Delegation message
- The task prompt Claude writes when it hands work to a subagent. The subagent reads this message instead of your conversation history (a fork, started with
/subtask, is the exception). - Subagents in Claude Code
- Delta
- The content of one
content_block_deltaevent: atext_deltawith a few characters of text, or aninput_json_deltawith a piece of a tool input as a string. - Streaming
- Description
- The
descriptionfield of the frontmatter. Claude reads it at startup and uses it to decide when to load the skill. - Skills
- Deterministic
- Same input, same output, every run. You can replay a past decision and get the same answer, and a test can check it with
==. - When not to use a model
- disable-model-invocation
- The frontmatter field that decides whether Claude may start the skill. With
true, only you can start the skill by typing/name, and its description stays out of the context. - Skills
- Dynamic context injection
- A line like `
!git status` in a command or skill. Claude Code runs the command before Claude reads the file and puts its output in place of the line. - Slash commands and plugins
- Effort
- An API parameter that sets how much thinking, tool calling and checking a model does on one request. Lower effort costs less on the same model.
- Choosing a model
- Effort
- The
output_config.effortsetting, fromlowtomax. It tells the model how many tokens to spend on the whole response, thinking included. - Letting the model think
- Embedding
- A fixed-length list of numbers (a vector) that a model computes from a text.
all-MiniLM-L6-v2returns 384 numbers per text. - Embeddings
- Eval
- A fixed set of test inputs, the expected answer for each, and a grader that turns the model's answers into a score you can compare between prompt versions.
- Testing a prompt
- Eval set
- A list of real inputs from your task with the expected output for each, used to score a model before you ship it.
- Choosing a model
- Eval set
- A fixed list of past cases with a known right outcome, run again after every change to the prompt, the tools or the model (day 23).
- Capstone: a small coding agent
- Exit code 2
- The exit code that makes Claude Code block the action. For
PreToolUse, the hook's stderr goes to Claude as the reason. - Hooks
- Fallback
- The path an input takes when no rule matches. In a hybrid system, the model is the fallback.
- When not to use a model
- Few-shot prompting
- Putting a few solved examples of the task in the prompt, each an input with its expected output. Anthropic’s docs also call it multishot prompting.
- Showing examples
- Golden answer
- The expected output for one test input, written by a person before the run, such as the label
Billing Disputesfor one ticket. - Testing a prompt
- Golden rule
- Anthropic’s test for a prompt: give it to a colleague who knows little about the task and ask them to follow it. If they would be confused, the guide says Claude will be confused too.
- Clear instructions
- Grounding
- Putting the source text in the context and asking the model to answer only from it, with quotes.
- Confident and wrong
- Hallucination
- Text that is "factually incorrect or inconsistent with the given context", in the words of Anthropic’s guide.
- Confident and wrong
- Harness
- The program between you and the model (a chat app, aider, Claude Code) that builds each request and decides what history to send.
- The context window
- Harness
- The program around the model, such as Claude Code or your own script. It builds each request, runs the tools the model asks for, and decides what to save to disk.
- Memory across sessions
- Hollow test
- A test that still passes when the code it should check is broken or removed.
- Reviewing code an AI wrote
- Hook
- A command, URL, prompt or agent that Claude Code runs when an event fires. It is declared under
hooksin a settings file, a plugin or a skill. - Hooks
- Host
- The application the user works in, such as Claude Code. The spec calls hosts "LLM applications that initiate connections", and a host creates one MCP client for each MCP server.
- Model Context Protocol
- Import
- A line like
@docs/git-instructions.mdinside aCLAUDE.md. Claude Code expands the named file into the context at launch, up to four hops deep. - CLAUDE.md
- Indirect prompt injection
- The case where your user is honest and the attack sits in content the model reads for them: a web page, an email, a PDF, an issue, a tool result.
- Prompt injection
- Input tokens
- Every token you send in a request: system prompt, earlier turns, documents, tool definitions and the question.
- Cost and latency
- Instruction
- The sentence in a prompt that names the action you want, with a verb: change, list, summarize, label.
- Clear instructions
- Invented API
- A call to a function, parameter, flag or package that does not exist in the version you use. The code reads well and fails when it runs.
- Reviewing code an AI wrote
- JSON schema
- A JSON document that describes the shape you expect: the type of each field, which fields are required, which values are allowed.
- Getting JSON back
- Lethal trifecta
- Willison's name for an agent that has three things at once: access to private data, exposure to untrusted content, and a way to send data out.
- Prompt injection
- LLM-as-a-judge
- A model call whose only job is to grade another model's output: pick the better of two answers, give a score, or say correct or incorrect.
- Grading with a model
- LLM-based grading
- A second model call reads the answer and a rubric and returns a verdict such as "correct" or "incorrect". It handles free text that code cannot check.
- Testing a prompt
- Logits
- The raw scores the model outputs for the next position, one number per token in the vocabulary. A higher score gives that token a higher probability.
- Predicting the next token
- Majority label bias
- A model’s tendency to answer with the label that appears most often in the prompt’s examples.
- Showing examples
- Managed settings
- A settings file an administrator deploys on each machine. User and project settings cannot override it, apart from a few listed keys.
- Keeping an agent safe
- Managed settings
- A
managed-settings.jsonfile or MDM policy that an organization deploys to each machine. No user, project or command line setting can override a key it sets. - Permission modes
- Marketplace
- A repository or directory with a
.claude-plugin/marketplace.jsonfile listing plugins and where to fetch each one. You install from it with/plugin install name@marketplace. - Slash commands and plugins
- Matcher
- The string that picks which tool calls a hook sees.
Bashmatches only the Bash tool, andEdit|Writematches either of those two tools. - Hooks
- max_tokens
- The most tokens the model may generate for this response. The model can stop earlier, and it stops here at the latest.
- The Messages API
- MCP client
- The connector inside the host that talks to one server. It sends JSON-RPC requests such as
tools/listandtools/call. - Model Context Protocol
- MCP server
- A program that offers tools, resources or prompts over MCP. The spec: "Services that provide context and capabilities".
- Model Context Protocol
- Memory tool
- An API tool,
memory_20250818, that lets the model ask for file operations under/memories. Your code runs each operation on storage you choose. - Memory across sessions
- Message
- An object with a
role, eitheruserorassistant, and acontent. Themessagesarray of a request holds the conversation so far, oldest first. - The Messages API
- Message Batch
- One object that holds up to 100,000 Messages API requests (or 256 MB), processed asynchronously. Each request is handled independently of the others.
- Batch processing
- Mid-conversation system message
- A
{"role": "system"}entry appended insidemessagesat the turn where a new instruction starts to apply. - System prompts and roles
- Model tier
- One model in a vendor’s lineup, ordered by capability and price. Anthropic’s current tiers, from lowest to highest cost, are Haiku 5.5, Sonnet 5.5, Opus 5.5 and Fable 5.1.
- Choosing a model
- Nesting
- Tags inside tags: each
<example>inside one<examples>block, or each<document index="n">inside<documents>. - Structuring a prompt with XML tags
- Normalize
- Divide a vector by its length so its new length is 1. After that, the dot product of two vectors equals their cosine similarity.
- Embeddings
- Observation
- What the environment returns after an action: a tool result, a command's output, an error. The model reads it before it picks the next action.
- The agent loop
- Orchestrator
- The lead agent: it plans the task, starts subagents with a written task description each, and writes the final answer from what they return.
- Splitting work across agents
- Output tag
- A tag you ask the model to put its answer in, so your code can find the answer by searching for that tag.
- Structuring a prompt with XML tags
- Output tokens
- Every token the model generates in its reply, thinking included. On every current Claude model, an output token costs 5 times an input token.
- Cost and latency
- Package hallucination
- Generated code that imports or recommends a package that does not exist in the registry.
- Confident and wrong
- Path-scoped rule
- A Markdown file in
.claude/rules/with apaths:list in its frontmatter. It loads only when Claude reads or edits a file that matches one of the globs. - CLAUDE.md
- Permission mode
- The baseline that decides which tool calls need your approval. The CLI cycles through
default(shown as Manual),acceptEditsandplanwithShift+Tab. - Permission modes
- Permission prompt
- The question Claude Code shows before a tool call that needs approval, with the exact command and options such as Yes, "Yes, and don't ask again" and No.
- Keeping an agent safe
- Permission rule
- An
allow,askordenyentry in a settings file, such asBash(git push *). Claude Code checks deny rules first, then ask, then allow, and the first match decides. - Keeping an agent safe
- Permission rule
- A string like
Bash(npm run *)orRead(./.env)in theallow,askordenylist of a settings file. It names a tool and, in parentheses, which uses of it match. - Permission modes
- Plugin
- A directory with a manifest at
.claude-plugin/plugin.jsonthat holds skills, commands, agents, hooks or MCP servers. Claude Code installs and loads it as one unit. - Slash commands and plugins
- Position bias
- A judge that prefers an answer because of where it sits in the prompt (first or second), whatever its content.
- Grading with a model
- Prefix
- The part of a request from its first token up to a cache breakpoint, in the order
tools, thensystem, thenmessages. - Prompt caching
- PreToolUse
- The event that fires before a tool call runs. A hook on it can block the call before Claude Code runs it.
PostToolUsefires after a tool call succeeds and cannot undo it. - Hooks
- Pretraining
- Training a model to predict the next token on a large amount of raw text. The result is a base model that continues text.
- How a model is trained
- Print mode
- Claude Code run with
-p(or--print): one prompt in, the result on stdout, then exit. There is no chat window and nobody to answer a permission prompt. - Claude Code in scripts and CI
- processing_status
- The batch field you poll:
in_progresswhile requests run,cancelingafter a cancel,endedwhen every request has a result. - Batch processing
- Progressive disclosure
- Loading a skill in three levels: name and description at startup, the
SKILL.mdbody when the skill is used, other files in the folder only when Claude opens them. - Skills
- Prompt injection
- An attack where text written by someone other than you reaches the model's context and the model treats it as an instruction. Simon Willison named it in 2022, after SQL injection.
- Prompt injection
- Quote extraction
- Asking the model to copy the passages that matter into
<quotes>tags first, then to answer from those quotes. - Working with long documents
- RAG
- Anthropic's definition: a method that "retrieves relevant information from a knowledge base and appends it to the user's prompt", so the model answers from the text of your own documents.
- Retrieval-augmented generation
- Recency bias
- A model’s tendency to repeat the answers of the examples placed last in the prompt.
- Showing examples
- Result type
- Each request ends as one of four:
succeeded,errored,canceledorexpired. Onlysucceededis billed. - Batch processing
- Retrieved examples
- Examples chosen for each input at request time, by searching a labeled set for the entries closest to that input.
- Showing examples
- RLHF
- Reinforcement learning from human feedback: people rank model answers, a reward model learns to predict those rankings, and the model is trained to get a high reward.
- How a model is trained
- Role
- A sentence in the system prompt that says who the model acts as, like "You are a helpful coding assistant specializing in Python."
- System prompts and roles
- Rubric
- The written rules the judge applies, such as: an answer that misses a critical fact of the reference answer is incorrect. The judge sees it in every grading call.
- Grading with a model
- Rule
- Code that maps an input to an answer without a model: a regex, a SQL query, a lookup table, a compiler check.
- When not to use a model
- Sampling
- Picking the next token at random, with each token’s chance equal to its probability.
- Predicting the next token
- Sandbox
- A boundary the operating system enforces around the shell commands Claude runs: Seatbelt on macOS, bubblewrap on Linux and WSL2. It limits which files they write and which hosts they reach.
- Keeping an agent safe
- Scope creep
- Changes in a diff that the task did not ask for: reformatted files, new helpers, extra configuration.
- Reviewing code an AI wrote
- Server-sent events (SSE)
- An HTTP response that stays open and carries a sequence of events. Each event has a line
event: <name>and a linedata: <json>, and the JSON repeats the name in itstypefield. - Streaming
- Session
- One Claude Code conversation, tied to the directory you started it in. Claude Code saves it locally as JSONL, so
claude --continueorclaude --resumereopens it under the same session ID. - Claude Code in one session
- SFT
- Supervised fine-tuning: more training of the base model on prompts paired with answers that people wrote.
- How a model is trained
- Skill
- A folder such as
.claude/skills/release/holding aSKILL.mdfile: YAML frontmatter, then Markdown instructions. You run this one by typing/release. - Skills
- Snapshot
- In the Python SDK stream helpers, the text or tool input accumulated so far, returned with each
textorinput_jsonevent next to the new delta. - Streaming
- Softmax
- The function that turns logits into probabilities between 0 and 1 that add up to 1.
- Predicting the next token
- Stateless
- The API keeps no conversation between calls. Each request carries the whole history the model should see, and nothing else reaches the model.
- Memory across sessions
- Stop condition
- A check outside the model that ends the loop: the task is marked done, an iteration cap or a cost budget is reached, or a repeat pattern is detected.
- The agent loop
- Stop condition
- A rule that ends the loop: a
stop_reasonother thantool_use, or a limit you set, such as a maximum number of iterations (day 18). - Capstone: a small coding agent
- stop_reason
- The field that says why the model stopped writing.
tool_usemeans it waits for tool results;end_turnmeans it has finished its answer. - Tool use
- stop_reason
- The field of every successful response that says why the model stopped:
end_turn,max_tokens,tool_useand four other values. - The Messages API
- Strict tool use
strict: trueon a tool definition. The same constraint applied to the tool name and the tool input.- Getting JSON back
- Structured output
- The JSON object a run returns when you pass
--output-format jsonand--json-schema. It matches your schema and arrives in thestructured_outputfield. - Claude Code in scripts and CI
- Structured outputs
- A request with
output_config.formatset to{"type": "json_schema", "schema": ...}. The reply text is JSON that matches that schema. - Getting JSON back
- Stuck pattern
- A sequence in the history that shows no progress, such as the same action with the same observation 4 times in a row (OpenHands' default).
- The agent loop
- Subagent
- A worker agent started by the orchestrator for one subtask. It runs its own tool loop and returns a short result.
- Splitting work across agents
- Subagent
- A separate Claude instance that Claude Code starts with the
Agenttool. It has its own context window, system prompt and tools, and it returns one report to the conversation that started it. - Subagents in Claude Code
- System prompt
- The text in the top-level
systemfield of a Messages API request. It sits ahead of every message in the conversation. - System prompts and roles
- Temperature
- A number the logits are divided by before softmax. Below 1 it sharpens the probabilities toward the top token, above 1 it flattens them.
- Predicting the next token
- Thinking block
- A
thinkingcontent block that arrives before thetextblocks. It holds a summary of the reasoning, or an empty string, plus an encryptedsignature. - Letting the model think
- Token
- One unit of text the model reads or writes, stored as an integer id. A token can be one byte, a few letters, or a whole word with its leading space.
- Tokens
- Tokenizer
- The program that turns text into a list of token ids before the model sees it, and turns ids back into text after.
- Tokens
- Tool
- A name, a description and an input schema that the model sees, plus the code that you run when the model asks for it (day 17).
- Capstone: a small coding agent
- Tool call
- A request from the model to run one built-in tool, such as
Read,EditorBash, with its input. Claude Code runs it and sends the result back to the model. - Claude Code in one session
- Tool definition
- An entry in the request's
toolsarray: aname, adescriptionand aninput_schema(a JSON schema for the arguments). The model reads it to decide when to call the tool. - Tool use
- tool_result block
- A content block you send back in a
usermessage, with thetool_use_idit answers, the result ascontent, andis_error: trueif the tool failed. - Tool use
- tool_use block
- A content block in the model's reply with an
id, the toolnameand aninputobject. It is a request for your code to run that tool. - Tool use
- Transport
- How the JSON-RPC messages travel: stdio (one message per line on a subprocess's stdin and stdout) or Streamable HTTP (each message is a POST to one endpoint).
- Model Context Protocol
- TTFT
- Time to first token: the time from sending the request to receiving the first token of the reply. Your code can measure it only on a streamed response.
- Cost and latency
- TTL
- How long a cache entry lives: 5 minutes by default, or 1 hour at a higher write price. Each read refreshes the entry at no extra cost.
- Prompt caching
- Turn
- One round trip: the model asks for tool calls, the tools run, and the results go back. The loop ends when the model answers with text and no tool call.
- Claude Code in one session
- Untrusted content
- Any text that a person outside your system can write or change. A public issue, an inbound email and a fetched web page are all untrusted content.
- Prompt injection
- User turn
- A message with
role: "user"in themessagesarray: a question, a pasted file, a list of tool results. - System prompts and roles
- Vocabulary
- The full table of token ids a tokenizer knows. In minbpe its size is 256 plus the number of merges.
- Tokens
- XML tag
- A name in angle brackets placed around a block of text, like
<ticket>and</ticket>. The model reads the name as a label for the block. - Structuring a prompt with XML tags