OmniscioGuidesClaude Code glossarySystem prompt
The Claude Code system prompt, explained
The system prompt is the layer Claude Code writes for you before any of your own words. Knowing what is in it, and what arrives some other way, explains why an instruction in CLAUDE.md behaves differently from the same sentence passed on the command line.
What the system prompt is
Anthropic's definition is short: the instructions Claude Code sends ahead of your conversation on every request, covering how Claude uses tools, behaves safely and formats its responses.
It is also the first layer of the prompt cache, which is why a change to it is more expensive than a change anywhere else. What it does not contain is your own instructions: CLAUDE.md files and output style instructions reach Claude in the conversation as system reminders.
In the Agent SDK the same text has a name, the claude_code preset, and its job is stated plainly: system prompts define Claude's behavior, capabilities, and response style.
How to change it
The command line offers five flags. Four set text; the fifth decides whether a conversation keeps the text it started with.
| Flag | Behavior |
|---|---|
--system-prompt | Replaces the entire default prompt |
--system-prompt-file | Replaces it with the contents of a file |
--append-system-prompt | Appends to the default prompt |
--append-system-prompt-file | Appends the contents of a file to the default prompt |
--system-prompt-snapshot off | Rebuilds the prompt on every request instead of reusing a recorded one |
The choice is about what survives. Appending preserves the default tool guidance, safety instructions and coding conventions, so you only supply what differs. Replacing drops all of the default prompt, including the safety instructions, and you take responsibility for whatever the task still needs.
The prompt is recorded once
On Claude Code v2.1.265 and later, the prompt is built on a conversation's first request, recorded in the session, and reused until the conversation is compacted. Different flag text on a later --resume takes effect after that compaction, or in a new conversation. Before v2.1.265, passing any of these flags turned recording off unless you also passed --system-prompt-snapshot on.
Where CLAUDE.md actually goes
CLAUDE.md is injected into the conversation rather than the system prompt, so it works whatever the system prompt is, and Claude Code prefixes it with a line telling Claude that these instructions override default behavior. Claude Code reads these files at session start and holds them in memory, which is why an edit you make mid-session leaves the cached prefix intact: the edit reaches Claude after the next /clear or /compact, not before.
A small example
One non-interactive run that keeps the default prompt and adds a house rule:
claude -p --append-system-prompt "Always reply in French" "Summarize README.md"Claude receives the default system prompt followed by your sentence. Swap --append-system-prompt for --system-prompt and the defaults are gone, tool guidance included, which is only what you want for an agent that is no longer meant to behave like Claude Code.
Related terms
- CLAUDE.md: the persistent instructions you usually want.
- Prompt cache: the system prompt is its first layer.
- Session: what a recorded prompt belongs to.
- Back to the glossary.
The full guide to shaping these instructions is Claude Code output styles: a saved set of instructions delivered beside the system prompt, which you can switch between without rewriting it.
One place for every session's rules
The features page lists what Omniscio does with several Claude Code sessions at once, which is where a house rule stops being something you retype at every launch.