The System Prompt
The system prompt is the text that Claude Code sends to the model before your first message. It tells the model how to behave and what the session looks like. You can add to it, replace it, or switch to a shorter version. This page explains how the prompt is built. The exact captured texts are on the Captured System Prompts page.
Ways to Change It
Sources: CLI Reference, Output Styles, and Environment Variables.
| Item | Status | What it does |
|---|---|---|
-- | Documented: An official docs page names this item. | Replaces the whole default prompt. |
-- | Documented: An official docs page names this item. | Replaces the prompt with the text of a file. Hidden in claude --. |
-- | Documented: An official docs page names this item. | Adds text to the end of the prompt. |
-- | Documented: An official docs page names this item. | Adds the text of a file to the end. Hidden in claude --. |
--, -- | Documented: An official docs page names this item. | Add text to every subagent prompt, in print mode only. Hidden in claude --. |
-- | Documented: An official docs page names this item. | on records the prompt on the first request and reuses it. off rebuilds it for every request. Needs v2.1.257 or later. |
-- | Documented: An official docs page names this item. | Moves the working folder, the environment, the memory paths, and the git status into the first user message. |
__ | Documented: An official docs page names this item. | A line in replacement text. Text above it stays cached. Text below it can change. Needs v2.1.275 or later. |
CLAUDE_ | Documented: An official docs page names this item. | 0 chooses the full prompt. 1 chooses the short prompt. See Short or Full Prompt. |
CLAUDE_ and -- | Documented: An official docs page names this item. | Use a minimal prompt. See Bare Mode. |
| Output style | Documented: An official docs page names this item. | Adds style text. The frontmatter key keep- keeps the coding section. |
prompt. and prompt. | Documented: An official docs page names this item. Differs: The official docs and the program disagree. The row says how. prompt.section does not fire for shared sections such as lean_body | Mod events that rewrite one section or the whole list. See the Mod API pages in Extend. |
How Claude Code Builds It
Claude Code makes a list of sections.
Each section has a name and a text, or no text when its condition is false.
A shared section is the same for every user of a model.
A session section can change with the session.
Claude Code sends the shared sections first, so that the shared part can stay in the cache.
The request has three system blocks:
the attribution line, the identity line, and the body.
See Request and Cache for the cache markers.
Short or Full Prompt
A model gets the short prompt (one lean_body section, about 5.7k characters) or the full prompt (six longer sections, about 26.9k characters).
The official docs and the real request captures agree here. Only the old wiki was wrong.
Captures of 2.1.311 show the following. See Captured System Prompts for the texts.
| Case | Result | Status |
|---|---|---|
| Opus 5.5, Sonnet 5.5 by default | The short prompt. | Documented: An official docs page names this item. |
| Haiku 5.5 by default | The short prompt plus 5 extra paragraphs (about 2.8k characters). | Undocumented: Only the program shows this item. It can change without notice. |
CLAUDE_ | The full prompt. This is the only way to get it on these models. | Documented: An official docs page names this item. |
CLAUDE_ | The short prompt. On the three 5.5 models it changes nothing, because they already get it. | Documented: An official docs page names this item. |
Names That Claude Code Does Not Recognize
Since 2.1.312, a model name that Claude Code does not recognize gets the short prompt, and CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=0 keeps the full prompt.
This covers custom deployment names and inference profile ARNs. The test in the program has no check for the provider.
The program decides in this order:
CLAUDE_CODE_SIMPLE_SYSTEM_PROMPTset to a true value gives the short prompt. A false value, such as0, gives the full prompt.- If the variable is unset, an unknown name gives the short prompt. A known name has
claude-3-orhaikuorsonnetin it, or isclaude-opus-4-0,-4-1,-4-5,-4-6, or-4-7. A server-side catalog flaglean_promptfor the model comes first. - For a known name, the gate
tengu_velvet_tidegives the short prompt when on. Otherwise the server settingsimple_system_promptfor the model decides.
The program now canonicalizes the name for this test with the option deterministic. The option skips the lookup that turns an application-inference-profile ARN into the model behind it. So an ARN no longer counts as the Sonnet or Haiku model that it fronts, unless modelOverrides maps it.
Source: the program (chunk-9wgj206m.js lines 334 to 363, chunk-3xe0k172.js lines 24698 to 24717, and chunk-rww18cjm.js of 2.1.311, where the same test used no deterministic option).
Prompt by Model
We ran the default prompt for every model in the program's catalog, plus names that end in -eap and an unknown name (see Probes). The stub accepted every name. The real API may refuse retired models.
The models with the catalog flag lean_prompt get the short prompt: Haiku 5.5, Sonnet 5.5, Opus 4.8, Opus 5, Opus 5.5, Fable 5, Fable 5.1, and Mythos 5.1. claude-mythos-5 has no such flag. A name rule gives it the short prompt. The same rule applies to a name that ends in -eap and to an unknown name. Older models, and claude-sonnet-5, get the full prompt. Some models add sections to the short prompt. These sections follow the flags opus_5_prompt_bundle, opus_5_5_prompt_bundle, fable_5_mitigations, and fable_5_1_prompt_bundle.
| Model | Prompt | System Characters |
|---|---|---|
claude-, claude-, and their - names | Short | 5,699 |
claude- | Short plus 5 paragraphs on effort and turns | 8,491 |
claude- | Short, with one different bullet in a system reminder | 5,641 |
claude- | Short plus "Delivering work" and "Corrections" sections and a line to not use agents or workflows unless asked | 9,079 |
claude- | Short plus "Communicating with the user", a comment rule, an identity paragraph, and an autonomy block | 9,992 |
claude- | Short plus "Delivering work", "Writing for the user", an identity paragraph, and an autonomy block | 11,771 |
claude- | Short plus "Communicating with the user" and an autonomy block | 9,414 |
claude- | Like Fable 5.1 | 11,084 |
| Unknown name | Short, without the total_ line | 5,648 |
claude- | Full, with one different Task bullet | 26,944 |
claude-, claude-, claude-, claude-, claude-, claude-, claude-, claude-, claude-, claude- | Full | 27,046 |
claude-, claude- | Claude Code silently changes the request model to claude-, so they get the short prompt | 5,699 |
The 3.5 and 3.7 Haiku and Sonnet models also get 25 tools and not 12, because they have no tool search. In 2.1.309 it was 24, before Monitor joined the tool list (probe print.models.matrix). The captures cover only Opus 5.5, Sonnet 5.5, Haiku 5.5, and the full prompt. The other models have no capture page.
The official docs say that Haiku 4.5, Sonnet 5, Opus 4.7, and earlier models get the full prompt, and newer models get the short one. The captures match this for Sonnet 5.5, Opus 5.5, and Haiku 5.5. The old wiki said Sonnet gets the full prompt. That is wrong.
Captured texts: lean prompt, Sonnet 5.5, Haiku 5.5, and the full prompt.
Where Each Part Goes in the Request
Not everything the model reads as instructions is in system.
The captures show this split.
| Part | Where it goes | Status |
|---|---|---|
| Billing header line | system[0] | Undocumented: Only the program shows this item. It can change without notice. |
| Identity line | system[1] | Undocumented: Only the program shows this item. It can change without notice. |
| Rules, memory section, appended text | system[2] (the body) | Undocumented: Only the program shows this item. It can change without notice. |
| Environment details, skills list, agent types, output style text, the date | A system-role entry in messages[] | Undocumented: Only the program shows this item. It can change without notice. |
Git status, CLAUDE. files, the git attribution reminder | The first user message | Undocumented: Only the program shows this item. It can change without notice. |
The identity line is You are a Claude agent, built on Anthropic's Claude Agent SDK. in print mode.
With --append-system-prompt, print mode sends You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK.
The interactive line is You are Claude Code, Anthropic's official CLI for Claude. The program picks it when the session is interactive. It also picks it for Google Cloud Agent Platform (Vertex) sessions.
What Each Flag Does in the Captures
| Flag or setting | Captured effect | Status |
|---|---|---|
--, --, -- | Replace only the body (system[2]). The identity line stays. | Documented: An official docs page names this item. |
-- | Adds text to the end of the body and changes the identity line. | Documented: An official docs page names this item. |
-- | Moves Memory into the first user message. Drops Session-specific guidance and the fast-mode sentence. | Documented: An official docs page names this item. |
Output style with keep- | Removes "Doing tasks" from the full prompt only. It does nothing to the short prompt. | Documented: An official docs page names this item. |
-- | Adds about 4.8k characters to the environment message. | Documented: An official docs page names this item. |
--, dont, -- | Do not change the text. | Undocumented: Only the program shows this item. It can change without notice. |
Sections
No official docs page lists the sections, so every row below is
prompt.compose hook sees all of them. A prompt.section hook sees only the session sections.
Shared Sections
These come first. Claude Code uses either the short row or the full rows.
From 2.1.302 to 2.1.307, no shared section (lean_body, intro, tone, doing_tasks, memory_static, and the others) fires prompt.section, so a prompt.section hook does not see them.
Only a prompt.compose hook sees them.
| Section | Status | When | Content |
|---|---|---|---|
lean_ | Undocumented: Only the program shows this item. It can change without notice. | Short prompt | A list of harness rules: markdown output, permission modes, hooks as user feedback, and dedicated tools first. |
intro | Undocumented: Only the program shows this item. It can change without notice. | Full prompt | Who the agent is and whom it works for. |
system | Undocumented: Only the program shows this item. It can change without notice. | Full prompt | Output is shown to the user, tool results can hold prompt injection, and old messages get compressed. |
doing_ | Undocumented: Only the program shows this item. It can change without notice. | Full prompt, and the output style is none or has keep- | Do only what the task needs, add no extra features, and write few comments. |
actions | Undocumented: Only the program shows this item. It can change without notice. | Full prompt | Confirm actions that are hard to undo. |
tools | Undocumented: Only the program shows this item. It can change without notice. | Full prompt | Use dedicated tools before Bash, and call independent tools in parallel. |
tone | Undocumented: Only the program shows this item. It can change without notice. | Full prompt | No emojis, short answers, and file_ references. |
memory_ | Undocumented: Only the program shows this item. It can change without notice. | Only with -- | The memory text, moved to the shared part. |
Session Sections
They follow in this order. Claude Code omits a section that has no text. Session sections, such as memory, do fire prompt.section.
| Section | Status | When | Content |
|---|---|---|---|
communication | Undocumented: Only the program shows this item. It can change without notice. | Always | How to write for the user, with text that depends on the model. |
pronouns | Undocumented: Only the program shows this item. It can change without notice. | Always | Use they/ when pronouns are not stated. |
action_ | Undocumented: Only the program shows this item. It can change without notice. | Short prompt | Confirm actions that reach outside the session or are hard to undo. |
fable_ | Undocumented: Only the program shows this item. It can change without notice. | A Fable model, or the model in ANTHROPIC_ | A paragraph about Fable 5.1 or Fable 5 and Mythos. |
tool_ | Gated: Works only behind a flag or a server gate. An experiment, or a tool strictness setting | An experiment, or a tool strictness setting | One sentence: object and array values are one JSON value. |
session_ | Undocumented: Only the program shows this item. It can change without notice. | When any of its items applies | The ! <command> tip, the Agent tool and forks, skills by /, and ultrareview. |
memory | Undocumented: Only the program shows this item. It can change without notice. | Not with -- | Instructions for auto memory. |
surface:, system_ | Gated: Works only behind a flag or a server gate. An experiment form of the prompt | An experiment form of the prompt | Where Claude Code runs, such as desktop, vscode, web, or terminal. |
env_ | Undocumented: Only the program shows this item. It can change without notice. | Normally | The latest model IDs, where Claude Code runs, and a note about /. |
env_ | Undocumented: Only the program shows this item. It can change without notice. | With -- | The same text, without data of the machine. |
bg- | Gated: Works only behind a flag or a server gate. CLAUDE_CODE_SESSION_KIND=bg and CLAUDE_JOB_DIR set | CLAUDE_ and CLAUDE_ set | Rules for background jobs: use $CLAUDE_, use Enter, and end with a report. |
context_ | Undocumented: Only the program shows this item. It can change without notice. | Always | Old context gets summarized, so do not finish early. |
brief | Undocumented: Only the program shows this item. It can change without notice. | --, or the Send tool | Rules for that tool. |
focus_ | Undocumented: Only the program shows this item. It can change without notice. | The view mode is focus | The user sees only the final message. |
act_ | Gated: Works only behind a flag or a server gate. CLAUDE_CODE_ACT_DONT_REDERIVE, or an experiment that is on by default | CLAUDE_, or an experiment that is on by default | Act when you have enough information. |
delivering_ | Gated: Works only behind a flag or a server gate. CLAUDE_CODE_BISON_CAIRN, or an experiment for some models | CLAUDE_, or an experiment for some models | Do the full scope of the work. |
overcorrection | Gated: Works only behind a flag or a server gate. CLAUDE_CODE_LARCH_CISTERN, or an experiment | CLAUDE_, or an experiment | Correct yourself only when it matters. |
subagent_ | Gated: Works only behind a flag or a server gate. The Agent tool exists and an experiment arm is on | The Agent tool exists and an experiment arm is on | Steers when to delegate. |
opus5_ | Gated: Works only behind a flag or a server gate. Opus 5 prompt bundle, with an experiment that is on by default | Opus 5 prompt bundle, with an experiment that is on by default | Do not use the Agent tool, workflows, or deep research unless asked. |
heron_, brook_ | Gated: Works only behind a flag or a server gate. An experiment, or Haiku 5.5 early-stopping guidance | An experiment, or Haiku 5.5 early-stopping guidance | Text that the server sets. |
willow_ | Gated: Works only behind a flag or a server gate. CLAUDE_CODE_WILLOW_TERN, or an experiment | CLAUDE_, or an experiment | Rules for writing to the user. |
autonomy_ | Gated: Works only behind a flag or a server gate. Mythos 5, a Fable 5 mitigation model, or CLAUDE_CODE_AMBER_ASTROLABE | Mythos 5, a Fable 5 mitigation model, or CLAUDE_ | Work without asking in the middle of a task. |
endconv_ | Gated: Works only behind a flag or a server gate. The EndConversation tool exists | The End tool exists | A hint for that tool. |
total_ | Gated: Works only behind a flag or a server gate. Mode comes from CLAUDE_CODE_TOTAL_TOKENS_REMINDER | Not with CLAUDE_ or CLAUDE_, and the mode comes from CLAUDE_ | A reminder of the token budget. |
user_ | Gated: Works only behind a flag or a server gate. An experiment that is off by default | An experiment that is off by default | The user pays for each token. |
Experiments come from GrowthBook, a flag service that Anthropic runs. You cannot set an experiment. But the env vars in the table switch some of the sections.
Bare Mode
--bare and CLAUDE_CODE_SIMPLE=1 give the same result: a two-line body (CWD: <path> and Date: <date>), 3 tools, and an empty environment message.
Source: Run Claude Code Programmatically: Start Faster with Bare Mode for the flag. The body comes from the captures (
Subagent Prompt
A subagent gets its own agent text plus short notes.
The default agent text starts with You are an agent for Claude Code, Anthropic's official CLI for Claude.
The notes say to share absolute paths, to avoid emojis, to avoid a colon before tool calls, and not to write report files.
Source: the program (
Example
You want the model to follow one more rule. You also want a mod to remove the memory section.
claude --append-system-prompt "Always use TypeScript"
Claude Code adds the text to the end of the default prompt.
A mod can hook prompt.section with { name: "memory" } and return { text: null } to drop the memory section.
Related Pages
- Captured System Prompts
- Request and Cache
- Models
- Output Styles and Mod API pages in Configure and Extend.