Skip to content

[FEATURE]: System prompt environment information plug-in API #31158

Closed as not planned

Description

@WywySenarios

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I would like to contribute a core feature to OpenCode and would like to ask a contributor if it is OK.

I ask if it is possible to expose an API to modify system prompt environment information (this will benefit plugin authors).

Currently, the system prompt has a shape that is something like:

{agent prompt}\n{environment information}\n{instruction files}\n{skills}\n{system reminders/overrides}

(I am writing this from memory, it is probably in another order).

A non-source-code aware user can natively modify the system prompt by:

  • changing the agent prompt
  • creating, modifying, linking, and/or deleting instruction files
  • creating new skills, removing old skills
    The user cannot:
  • modify environment information
  • disabled or modify system reminders

I am aware that plugins can directly modify the raw system prompt. Feel free to close this if the effort is not worth it (I can still create a fork regardless!).

Extra context: I wish to create a plugin that injects some stateful information into the system prompt and expose a tool for the LLM to modify this stateful information. It's useful for long coding pipelines where the current agent needs to know what stage they're currently at. This plugin can also be implemented without this feature by modifying the raw system prompt or dynamically modifying the agent prompt. I also wish to make this contribution to better understand OpenCode :)

I will comment on this thread (if it is not manually closed) when the PR is ready.

Activity

  1. github-actions commented on Jun 6, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your request is distinct (e.g. specifically targeting the environment information block rather than general system prompt injection), it may be worth clarifying how it differs from the above.

  2. WywySenarios commented on Jun 6, 2026

    @WywySenarios
    Author

    clarification: a good naive approach would be to inject a bunch of plugin-generated text on the line before the closed <env> tag and set up a watcher for whenever the environment information or system prompt are regenerated.

  3. github-actions commented on Aug 6, 2026

    @github-actions
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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