Repository navigation
Request Build
This page answers four questions about the request of Claude Code 2.1.296:
- What does one request contain?
- In what order does the system prompt put its sections?
- How does an output style change the prompt?
- Where are the cache breakpoints, and where does dotclaude change the request?
The page also covers the plugin hooks modules. Read it if you change the prompt, the cache, or the hooks of dotclaude.
The labels are official (Anthropic docs), binary (the Claude Code bundle, read only), capture (a live request, recorded through a proxy).
The label measured marks a run on this machine.
An inference is marked (inferred).
- The section and tool texts come from an extract of the
2.1.296bundle. The extract has two live sessions with an empty configuration. So each text has a capture where it shows. The method and the byte sizes are in the extract report of the change folderevidence/extract.md. - The request captures are from 2026-10-11.
They are three requests in the
vanillafolder, four requests in thesnippetfolder, and one request in thesnippet-appliedfolder. They are read only. The sizes below are UTF-8 byte counts of the text. - The docs are the Claude Code page on output styles and the platform page on prompt caching. Both were read on 2026-10-13.
- This page gives no bundle code and no verbatim prompt text. It names the sections and the files, and it gives the size of each text.
A request has three parts.
The prompt cache reads them in the same order (official).
| Part | What it holds | Size in the captures (capture) |
|---|---|---|
tools |
The tool definitions, with the deferred tools as names only. | 12 definitions, 28546 bytes of JSON, in the sonnet capture. 9 definitions, 14474 bytes, in the opus capture. |
system |
Three blocks: the billing header, the identity line, and the body. | 74, 62, and 5880 bytes in the sonnet lean capture. 62 and 7762 bytes in the opus capture. |
messages |
The first user message with the <system-reminder> blocks, then the user prompt. A second message with role system holds the environment block. |
First message 4794 bytes of reminders. Environment block 9755 bytes in the sonnet capture, and 5389 bytes in the opus capture. |
The byte counts of the tools part are the UTF-8 bytes of the tools value, as compact JSON with no spaces.
The method uses json.dumps with the separators , and : and ensure_ascii=False.
A run on the tools value of external/capture/vanilla/request-2026-10-11T03-06-47-464Z-1.json and -2.json applies it.
The files are pretty-printed.
Their raw text is larger: 33,619 and 17,825 bytes with the indentation.
The billing header has no cache marker. The identity line and the body have the marker in each capture that sends them.
The engine builds the body from sections, and each section has an id.
The bundle chooses the set by a gate.
The gate is the trait lean (binary, 2.1.296).
The extract report gives the gate in full.
-
Lean body.
The sonnet capture has the trait
lean. So its body islean_body, with the other sections of the lean form. The body holds, in this order: the opening text (intro, 853 bytes, andlean_body, 1607 bytes),communication(94 bytes), andpronouns(361 bytes). The body then holdsaction_caution(520 bytes),session_guidance(664 bytes),env_info_simple(581 bytes), andcontext_management(282 bytes). The order is the offset order in the capture (capture). The capture has 918 bytes that this page does not map to a file. -
Full body.
Without the trait
lean, the shared scope has the sectionsintro,system,doing_tasks,actions,tools, andtone. The full session of the extract confirms them, with sizes 853, 1939, 3319, 3587, 650, and 555 bytes. The opus capture of 2026-10-11 has a different body. It starts with the text ofdoing_tasks. Then it hascommunication,pronouns,action_caution,session_guidance, andenv_info_simple. It has nocontext_managementtext. The page does not map its other bytes (capture).
The lists below summarize each section in the words of this page. The text of each file is in the extract, and this page does not copy it.
Sections of the full body and of the shared scope:
-
introsays that the agent works with the user toward the user's goals, with its own judgment and the tools. -
systemsays how the output reaches the user, and how to read a tool result. A tool result can hold data from outside sources. Feedback from a hook comes from the user. A call that a hook blocks needs a change of action, or a question to the user. -
doing_taskssays how to do a software task, and how to confirm the work. -
actionssays how to treat an action that is hard to reverse. -
toolssays to use the dedicated tools before a shell command, and to run independent tool calls in parallel. -
tonesays to use no emojis unless the user asks, to keep the replies short, and to refer to code asfile_path:line_number.
Sections of the lean form:
-
lean_bodyopens the lean body. It also holds the rules of the harness, such as the markdown output, the permission modes, and the text in pasted content. It limits the security work to authorized and defensive tasks. -
communicationsays to write code that matches the code around it, in the comment density, the naming, and the idiom. -
pronounssays to usetheyandthemfor a person whose pronouns are not stated. -
action_cautionsays to confirm first before an action that is hard to reverse or that faces outside, unless the user gave a standing approval. -
session_guidancesays to call a skill with theSkilltool when the user types a skill name, and to use only the skills that are listed. -
env_info_simpleholds notes on the model families, on the Claude Code surfaces, and on the fast mode. -
context_managementsays that a long context is summarized into the next context window, so the work goes on.
Long forms and other sections of the extract:
-
communication.fullholds the long text-output rules, such as a one-sentence plan before the first tool call. -
session_guidance.fullholds the long session guidance, such as when to use theAgenttool with a specialized agent. -
memoryandmemory.fullhold the instructions of a persistent file-based memory, in a short form and a long form. -
total_tokensis a one-line tag with the token budget left. The page does not map its gate. -
env_infoholds the long environment notes, with the fast mode and the Claude Code surfaces.
Gated sections that the extract did not confirm in a capture:
-
autonomy_appendsays to work without questions in the middle of a task, when the user is not watching. -
bg-sessionsays how to work in a background session. It says to commit before the end, and to push when the repository has a remote. -
brook_heronandwillow_ternare functions that return a text. This page does not summarize the text. -
delivering_work_maxsays to do the requested work, and not to narrow or widen its scope. -
opus5_reduced_delegationsays not to use the workflow or deep-research tools unless the user, aCLAUDE.mdfile, or a skill asks for them. -
overcorrectionsays to correct an earlier statement only when the error changes the user's code, conclusions, or decisions. -
task_continuitysays that an agreed task is approved from end to end. An irreversible action still needs a confirm. -
user_payssays that the user pays per token, so the work should be no larger than it needs to be.
An output style is a set of instructions that Claude Code sends with each request (official).
It sets the role, the tone, and the format of the replies for a session.
The change takes effect from the next message (official).
The field keep-coding-instructions decides whether the software engineering section stays (official).
Its default is false.
When it is false, the full prompt leaves out the coding section.
The shorter prompt has no such section, so the field has no effect there (official).
The engine uses the lean form when CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT is 1.
It uses the full form when it is 0 (binary, 2.1.296).
The env var CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT=0 selects the full prompt on each model (official).
When the style has no coding instructions, the section doing_tasks is null (binary, inferred from the same gate).
The shipped style is described under dotclaude changes below.
An example of a built-in style is Concise.
It has 265 bytes in one capture of 2.1.296 (capture).
Output styles add input tokens.
The cache reduces this cost after the first request (official).
The captures show no attachment event.
The capture plugin does not record prompt.attachment (capture, evidence/extract.md).
So this page does not say which attachment types exist in 2.1.296.
The captures show the text in the first user message:
- A block with the project instructions, 4794 bytes, that starts with a
<system-reminder>tag. - A block with a note about how to answer questions, 555 bytes.
- A block with the attribution rule for commits and pull requests, 585 bytes.
- In a dotclaude session, a block with the drift note of the settings snippet, 873 bytes.
The
session.starthook of the core plugin adds it (capture, see Architecture).
The bundle has the text of a plan mode reminder and of a TodoWrite reminder.
Their types are plan_mode and todo_reminder (binary).
The mapping from each text to its type is not confirmed (binary).
The prompt slice of dotclaude sets CLAUDE_CODE_TODO_REMINDER_MODE to off (source, src/plugins/dotclaude/slices/prompt/slice.ts).
This page does not measure the effect on the reminder.
The docs say that a cache hit needs the same prefix, up to the breakpoint (official).
The order of the prefix is tools, system, and messages.
- A change in
toolsclears all three levels. - A change in
systemclearssystemandmessages. - A change in the images or in
tool_choiceclearsmessagesonly. - A change in the thinking settings always clears
messages. On some models, it also clearstoolsandsystem(official). - The docs do not list a model change.
So a switch of model is likely a miss (
inferred).
The default time to live is 5 minutes.
A request can ask for 1 hour with "ttl": "1h" (official).
The captures show these markers (capture):
- Sonnet lean capture: the identity line and the body have
ttl1h, and the environment block hasttl1h. - Snippet capture: the same three markers with
ttl1h. - Opus capture: the identity line and the environment block have no
ttl, so the default of 5 minutes applies.
This page does not measure the cache hits.
The changes are in the sources of the plugin and in its settings snippet.
- The
stylesslice ships the styleConcise(src/plugins/dotclaude/slices/styles/slice.ts). Its source issrc/plugins/dotclaude/slices/styles/styles/Concise.md. The built file isplugins/dotclaude/output-styles/Concise.md. The style haskeep-coding-instructions: true, so the coding section stays. The style sets noforce-for-plugin, so the user'soutputStylesetting still decides. - The settings snippet selects
dotclaude:Concisethrough the keyoutputStyle. - The
promptslice has three hooks (source,src/plugins/dotclaude/slices/prompt/slice.ts).-
prompt.composeapplies the section transforms. It adds the model variant block once per session. The variant is chosen at the first call of the session and kept, so a model switch does not change the prompt. -
agent.spawnadds a block to the end of the task prompt of a subagent. -
prompt.sectionanswers the sectioncontext_managementwith other text, whenDISABLE_COMPACTis set. The text is the same on each call, so the cache stays.
-
- The settings of the
promptslice set these env vars:CLAUDE_CODE_SIMPLE_SYSTEM_PROMPTto1,DISABLE_COMPACTto1, andCLAUDE_CODE_TODO_REMINDER_MODEtooff. They do not setCLAUDE_CODE_ATTRIBUTION_HEADER, so the billing block stays at the start of the system prompt. WithCLAUDE_CODE_ATTRIBUTION_HEADERset to0, a captured request has no billing block (capture). Then a model call from a hook on a subscription gets HTTP 429, because it has no billing block and no identity block of Claude Code. See You Should Know. - The
surfaceslice shortens the tool texts, or defers a tool. The tests confirm that each transform finds its text in the extract (tests/dotclaude/surface/extract.test.ts). See Prompt Surface for the sizes of the tool texts.
The prompt.section hook does not run when the built-in guard sec-default loads (see below).
The facts of the plugin hooks modules are in this section.
They describe Claude Code 2.1.287 and later.
- A plugin can have one module, named in
hooks/hooks.json(official). The module exportsregister. Each hook has the form($, e, next)(official). - The module is an ESM file in one of the module extensions.
It runs without the DOM and without Node (
official). It uses$.fsand$.process.runfor file and process work (official). - The gate is the GrowthBook flag
tengu_plugin_hooks_modules, and its default istrue(binary,2.1.287). An organization can refuse modules withallowManagedModsOnly(official). - The API is early access.
It may change between releases (
official). - The chain order is the managed settings hooks, then the modules, then the other settings hooks (
official). - The module has no
.catchin dotclaude. So a failure gives no ask, and the verdict of the engine stands. An action that throws is skipped. Its error is not logged (binary). - The module has no permission mode.
No field of
tool.callortool.checkhas one (official). - In auto mode, the classifier decides an
askoftool.check, and it can allow the call (measured,2.1.292). A classicPreToolUsehook with anaskstops the call in auto mode (measured,2.1.292). - A section has an
id, atext, and ascopeofsharedorsession(official). - The module does not see the sections of
prompt.composein one call. So the core plugin usesprompt.sectionfor one section.
The events that dotclaude uses are on Architecture.
Claude Code has six built-in mods, and sec-default is one of them (official).
The guard loads for Team and Enterprise users, and on a machine with managed settings (official).
A user cannot turn it off (official).
The rules that matter here are these (official).
- A user's mod cannot change the system prompt, the managed hooks, or the managed instructions.
- A user's mod can deny a call.
It can approve a call that an
askrule would stop. - A plugin that comes from a marketplace counts as a user's plugin.
On a machine with managed settings and sec-default loaded (measured, 2.1.292):
- The debug log said that the
prompt.sectionhook of dotclaude was bypassed. So the replacement ofcontext_managementdid not reach the prompt. - The
tool.checkhook still ran, and itsaskreached the user. - The classic
PreToolUsecommand hook of the plugin still ran.
A managed drop-in that sets prependPlugins without the guard let the prompt.section hook run (measured, 2.1.293).
dotclaude ships no managed settings file.
So the guard decides on a machine that has its own managed settings.
- Prompt Surface has the sizes of the tools and the tool transforms.
- Prompt Variants has the system prompt variants of the core plugin.
- Architecture describes what the hooks module does.
-
Compaction and Context has the
context_managementsection. - Tools and Deferral has the deferred tools.
- Claude Code Internals has the scope and the version of the facts.
- Start
- How dotclaude Works
- Add-On Plugins
- How Claude Code Works
- Reference
- Rationale
- Evidence
- Development
- Archive