[FEATURE] Env-var / settings.json equivalent for --exclude-dynamic-system-prompt-sections (managed-config deployable)

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 17, 2026

Follow-up to #70385 (closed by stale-bot, not_planned, no maintainer response) — filing fresh with source-level evidence the gap is real and still worth a decision.

Problem

--exclude-dynamic-system-prompt-sections moves cwd/env/memory-paths/git-status out of the system prompt into the first user message, improving cross-user prompt-cache reuse. It has zero equivalent in settings.json or env vars, so it can't ship via a managed/MDM config — only per-invocation CLI flag or SDK initConfig.

Verified against the compiled CLI (v2.1.226):

  • Option defined with a hardcoded .default(!1) (false) — no config lookup, no env fallback.
  • Camel-cased internal name excludeDynamicSections appears at exactly one read site, fed only from commander CLI options into runHeadless(...).
  • Confirmed interactive REPL sessions do not read this flag at all — it only takes effect in claude -p/headless and SDK sessions.

Impact

This makes it unusable for organization-wide rollout via managed config — exactly the case in #70385 (fleet-wide prompt-cache cost savings), and the case that most needs it: interactive sessions are where the bulk of spend happens, not headless.

Proposed solution

  • Add excludeDynamicSystemPromptSections: boolean to settings.json schema (readable from managed/user/project tiers per normal precedence).
  • Corresponding env var (e.g. CLAUDE_CODE_EXCLUDE_DYNAMIC_SYSTEM_PROMPT_SECTIONS) for MDM/plist-based managed delivery, consistent with other boolean toggles already exposed that way (CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, etc).
  • Extend the flag's effect to interactive/REPL sessions, not just headless — currently the cache-reuse win only exists where it's least needed.

Alternative considered

Shell alias / wrapper forcing -p/flag — not deployable as managed config, and moot anyway since interactive sessions ignore the flag regardless of how it's invoked.

View original on GitHub ↗