GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add optional system prompt environment injection · Issue #1894 · anomalyco/opencode

add optional system prompt environment injection #1894

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
add optional system prompt environment injection#1894
Copy link
Assignees
thdxr

Description

@Jacubeit
Jacubeit
opened on Aug 13, 2025
Issue body actions

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:

 "agent": {
    "build": {
      "mode": "primary",
      "model": "anthropic/claude-sonnet-4-20250514",
      "prompt": "{file:./prompts/build.txt}",
      "envinfo": false
      ...
   }
}
Reacted by Arsham Shirvani, Yoav Farhi, Federico Simonetta, Calvin Alkan, Hamish M. Blair, Konstantinos Kalyfommatos, Vitaliy Stoliarov, Cogni AI and nguyendown

Activity

  1. linear
    assigned
    thdxr
    on Aug 14, 2025
  2. calvinalkan commented on Oct 1, 2025

    @calvinalkan
    calvinalkan
    on Oct 1, 2025
    More actions

    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.

  3. rekram1-node commented on Oct 1, 2025

    @rekram1-node
    rekram1-node
    on Oct 1, 2025
    Member
    More actions

    that's an interesting idea, kinda like it

    Reacted by Calvin Alkan
  4. taqtiqa-mark commented on Oct 14, 2025

    @taqtiqa-mark
    taqtiqa-mark
    on Oct 14, 2025
    More actions

    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

  5. calvinalkan commented on Oct 14, 2025

    @calvinalkan
    calvinalkan
    on Oct 14, 2025
    More actions

    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.

    Reacted by Konstantinos Kalyfommatos
  6. taqtiqa-mark commented on Oct 14, 2025

    @taqtiqa-mark
    taqtiqa-mark
    on Oct 14, 2025
    More actions

    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:

    https://opencode.ai/docs/agents#mode:

    The mode option can be set to primary, subagent, or all. If no mode is specified, it defaults to all.

    So no more mode#prompt?

  7. hmblair commented on Mar 2, 2026

    @hmblair
    hmblair
    on Mar 2, 2026
    More actions

    +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
  8. max-sixty
    added a commit that references this issue on Mar 6, 2026

    docs: add empty system prompt to codex command for speed (#1300)

    e596a07
  9. konstantinoskalyfommatos commented on Apr 4, 2026

    @konstantinoskalyfommatos
    konstantinoskalyfommatos
    on Apr 4, 2026
    More actions

    Hi, any updates regarding this request? Would be super helpful.

  10. github-actions commented on Jun 4, 2026

    @github-actions
    github-actionsBot
    on Jun 4, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  11. github-actions
    closed this as not plannedon Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @thdxr
    thdxr

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.