google-gemini / google-gemini/gemini-cli
Feature request: append to system prompt at launch (--append-system-prompt / GEMINI_APPEND_SYSTEM_MD) — GEMINI_SYSTEM_MD only replaces
- Dominant language
- TypeScript
- Stars
- 107k
- Forks
- 14.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 45
Description
### What would you like to be added?
A way to **append** text to the system prompt at launch, without replacing it:
```shell
gemini --append-system-prompt ""
gemini --append-system-prompt-file
```
or an env-var equivalent (which composes especially well with wrappers that construct the process environment):
```shell
GEMINI_APPEND_SYSTEM_MD= gemini
```
This was previously requested in #6601, which was closed by the backlog-cleanup bot for inactivity with an invitation to open a fresh issue with updated details — this is that issue.
### Why is this needed?
`GEMINI_SYSTEM_MD` exists but **replaces** the entire system prompt, which makes it unusable for the common case of "keep stock behavior, add a little context":
- To merely *add* instructions, you have to dump the built-in prompt with `GEMINI_WRITE_SYSTEM_MD`, concatenate your text, and point `GEMINI_SYSTEM_MD` at the result. The dumped prompt is version-specific, so this pre-bake breaks silently on every CLI upgrade.
- `GEMINI.md` context files are per-user/per-project state on disk — they don't work for *launch-scoped* injection, where the extra context should exist only for this invocation.
The concrete use case: terminal wrappers and session managers (SSH session tools, terminal multiplexers/mirrors, CI harnesses, IDE terminals) that want any agent launched inside them to know about environment-specific capabilities — "this session is remote/mirrored, these extra commands are available". The wrapper controls argv and the environment of the child process, so an append flag or env var is the natural integration point, with no user files touched and automatic cleanup when the session ends.
Most comparable agent CLIs already expose exactly this surface:
| CLI | Append mechanism |
|---|---|
| Claude Code | `--append-system-prompt`, `--append-system-prompt-file` |
| Factory `droid` | `--append-system-prompt`, `--append-system-prompt-file` |
| Grok Build | `--rules` (alias `--append-system-prompt`) |
| pi | `--append-system-prompt` |
| Codex CLI | `-c developer_instructions="..."` |
Gemini CLI is the notable exception with a replace-only mechanism, and its downstream forks (e.g. Qwen Code) inherit the same gap — so an upstream fix propagates widely.
### Additional context
Implementation-wise this seems small: the plumbing for a custom prompt file already exists for `GEMINI_SYSTEM_MD`; append would concatenate after the built-in prompt (and after `${...}` substitutions) instead of substituting for it. Happy to provide more detail on the wrapper use case if useful.
Contributor guide
Research direction
Start at the existing GEMINI_SYSTEM_MD custom prompt plumbing and the launch argument/environment-variable entry points. Trace how the built-in prompt and ${...} substitutions are assembled; done means supporting the requested append flag, file option, and GEMINI_APPEND_SYSTEM_MD without replacing the built-in prompt.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100