CLAUDE_CODE_MID_CONVERSATION_SYSTEM
Updated by Alex Sorokoletov
CLAUDE_CODE_MID_CONVERSATION_SYSTEM is a Claude Code environment variable: Inject a system message mid-conversation. Your harness can update Claude's constraints, inject new context, or shift behavioral guidelines without ending the session. Removed between v2.1.143 and v2.1.212, so current releases ignore it. It is not in the official reference.
| Status | Removed between v2.1.143 and v2.1.212 |
|---|---|
| Added | Added between v2.1.128 and v2.1.138 |
| Category | Other |
| Official docs | Not listed |
How to set it
For one session, export it in the shell that starts Claude Code:
export CLAUDE_CODE_MID_CONVERSATION_SYSTEM=<value>
claudeTo apply it to every session, add it to the env object of a settings file:
// ~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_MID_CONVERSATION_SYSTEM": "<value>"
}
}Release notes that mention it
Related variables
CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT: Switches to a reduced system prompt, stripping out the non-essential guidance sections that bulk up the default prompt.CLAUDE_CODE_SYSTEM_PROMPT_GB_FEATURE: Names a GrowthBook feature flag whose value overrides the system prompt — but only when CLAUDE_CODE_REMOTE is set.ANTHROPIC_BETAS: Comma-separated beta feature headers.ANTHROPIC_CUSTOM_HEADERS: Custom HTTP headers (newline-separated Key: Value).ANTHROPIC_FEDERATION_RULE_IDANTHROPIC_ORGANIZATION_IDANTHROPIC_WORKSPACE_IDBETA_TRACING_ENDPOINT: Custom endpoint for beta tracing.
Frequently asked questions
What does CLAUDE_CODE_MID_CONVERSATION_SYSTEM do?
Inject a system message mid-conversation. Your harness can update Claude's constraints, inject new context, or shift behavioral guidelines without ending the session.
Which Claude Code version has CLAUDE_CODE_MID_CONVERSATION_SYSTEM?
Removed between v2.1.143 and v2.1.212, so current releases ignore it.
How do I set CLAUDE_CODE_MID_CONVERSATION_SYSTEM?
Export it before starting Claude Code (export CLAUDE_CODE_MID_CONVERSATION_SYSTEM=value), or add it to the "env" object in ~/.claude/settings.json to apply it to every session.
All variables, searchable: Claude Code environment variables.