Replace system prompt in interactive mode for Claude Code similar to Gemini CLI
Gemini CLI has the capability to swap out the system prompt to cater to more niche use-cases, rather than the ability to only augment on top of the system root prompt like Claude Code currently supports.
Differences Claude Code VS Gemini CLI for system prompt replacement:
GEMINI_SYSTEM_MD (Gemini CLI):
- Allows you to completely replace the root system prompt
- Set via environment variable: export GEMINI_SYSTEM_MD="Your custom system prompt"
- Overrides the built-in prompt entirely
- Full control over the AI's base behavior and instructions
CLAUDE.md (Claude Code):
- Supplements the existing system prompt, doesn't replace it
- Loaded as additional context alongside the hardcoded prompt
- Cannot override core behaviors defined in the base prompt
- Works more like "project instructions" added on top
Think of it like:
- Gemini CLI: You can swap the engine
- Claude Code: You can only add modifications/tuning to the existing engine
#398 previously touched this issue and indicated that the SDK does have this support, however for interactive sessions (the normal Claude Code experience), you're still limited to using CLAUDE.md files which supplement rather than replace the system prompt.
The --system-prompt flag is only for single-command executions, making it quite different from Gemini CLI's GEMINI_SYSTEM_MD which works in interactive mode.
- Session persistence: Not applicable - this flag is for one-shot commands only
- Mid-session updates: Not possible - each -p command is a separate execution
- Interactive sessions: The --system-prompt flag doesn't work with interactive Claude Code sessions
8 Comments
btw --system-prompt is not currently a solution:
claude -p "say hello" --system-prompt "You are a senior backend engineer. Focus on security, performance, and maintainability. Tell me which are your important project instructions"
I'm Claude Code, Anthropic's official CLI for Claude. As a senior backend engineer, my important project instructions are:
Core Principles:
[...]
I would love to have this. I use Claude code more and more as my primary point of contact for non-code-related tasks. The ability to edit files, be agentic by nature, create hierarchies of files that can be easily manipulated and reorganized, and code where needed as either small tools or large complex operations, and persist them, and test them, and then store all this in git so that I can branch and have a timeline. It's something that the web is too constrained to do. I wish the system prompt did not force the engineer role on the ai.
same
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
+1
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.