You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
add optional system prompt environment injection #1894
Agents can have their custom system prompt. Environment system prompt gets added regardless.
Making this optional would reduce tokens and increase prompt adherence if this info is not needed for the agent to fulfill its task.
if (process.env.OPENCODE_NO_ENV_PROMPT !== 'true') {
system.push(...(await SystemPrompt.environment()))
}
Or even better: per agent in config, as system prompts can be defined there anyways:
The environent information is injected AFTER a custom Agent prompt
Still getting my bearings, but shouldn't any system prompt be added separately:
constresult=awaitgenerateObject({model: openai('gpt-4o'),system: `You are a SQL (postgres) ...`,// SYSTEM PROMPT AS ABOVE - OMITTED FOR BREVITYprompt: `Generate the query necessary to retrieve the data the user wants: ${input}`,schema: z.object({query: z.string(),}),});
Also rather than optionally inject a hardcoded system prompt wouldn't it be better to allow users to define a SYSTEM.md per agent, say for the hypothetical IDE agent:
The environent information is injected AFTER a custom Agent prompt
Still getting my bearings, but shouldn't any system prompt be added separately:
const result = await generateObject({
model: openai('gpt-4o'),
system: `You are a SQL (postgres) ...`, // SYSTEM PROMPT AS ABOVE - OMITTED FOR BREVITY
prompt: `Generate the query necessary to retrieve the data the user wants: ${input}`,
schema: z.object({
query: z.string(),
}),
});
Also rather than optionally inject a hardcoded system prompt wouldn't it be better to allow users to define a SYSTEM.md per agent, say for the hypothetical IDE agent:
agent/ide.md
agent/ide/SYSTEM.md
agent/ide/create-ticket.md
...
This suggests there are three prompt types: Primary, System and Sub-Agents
AFAIK, the system prompt for an agent can be defined already and is used as it. The issue is how it's merged with environment specific stuff, which you have no control over.
AFAIK, the system prompt for an agent can be defined already and is used as it.
Thanks. I see that Modes is now deprecated in favor of an agent option mode, and a mode did have a prompt option (which was the system prompt). However, agent docs say that mode has one option:
+1 on this. My use case is a research-only agent (web search, no local tools) where the environment block is pure noise. A per-agent config field like context: false would be ideal — simple and backwards-compatible.
Reacted by Konstantinos Kalyfommatos and scientificworld
Activity
calvinalkan commentedon Oct 1, 2025
Yes, this is very important to keep a clean context window.
The environent information is injected AFTER a custom Agent prompt, which puts limits on how you can end it.
I think, what makes much more send is having a placerholder in the prompt that gets replaced if it's present. Similar to arguments with / commands.
rekram1-node commentedon Oct 1, 2025
that's an interesting idea, kinda like it
taqtiqa-mark commentedon Oct 14, 2025
Still getting my bearings, but shouldn't any system prompt be added separately:
Also rather than optionally inject a hardcoded system prompt wouldn't it be better to allow users to define a
SYSTEM.mdper agent, say for the hypothetical IDE agent:This suggests there are three prompt types: Primary, System and Sub-Agents
calvinalkan commentedon Oct 14, 2025
AFAIK, the system prompt for an agent can be defined already and is used as it. The issue is how it's merged with environment specific stuff, which you have no control over.
taqtiqa-mark commentedon Oct 14, 2025
Thanks. I see that Modes is now deprecated in favor of an agent option
mode, and a mode did have a prompt option (which was the system prompt). However, agent docs say that mode has one option:https://opencode.ai/docs/agents#mode:
So no more
mode#prompt?hmblair commentedon Mar 2, 2026
+1 on this. My use case is a research-only agent (web search, no local tools) where the environment block is pure noise. A per-agent config field like
context: falsewould be ideal — simple and backwards-compatible.docs: add empty system prompt to codex command for speed (#1300)
konstantinoskalyfommatos commentedon Apr 4, 2026
Hi, any updates regarding this request? Would be super helpful.
github-actions commentedon Jun 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.