Skip to content

[FEATURE]: Include system prompt in export #39033

Open

Description

@jack5github

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

The system prompt provided to an AI model as part of a conversation is an important piece of context for understanding how it works behind the scenes, and to figure out approximately how many tokens were used and what can be done to reduce said usage.

Activity

  1. github-actions commented on Jul 27, 2026

    @github-actions
    Contributor

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

    Please review these issues and let us know if your request is distinct or if it should be linked to one of them.

  2. Rexarrior commented on Jul 31, 2026

    @Rexarrior

    I opened a narrower PR that may help with part of this use case: #39905

    It does not persist system prompts into session exports and does not change transcript storage. Instead, it adds a lightweight local CLI debug command:

    opencode debug prompt

    The command prints the resolved effective system prompt for the current project/agent/model, including the model base prompt, environment block, instruction files, MCP instructions, available skills, and experimental.chat.system.transform plugin modifications.

    This is intended as a smaller debugging primitive for verifying what prompt layers are active, without adding DB persistence or a full context/request dump.

  3. jack5github commented on Sep 29, 2026

    @jack5github
    Author

    This issue is not yet resolved. Even after switching to OpenCode v2 and using the export functionality provided in both the CLI and Desktop application, full visibility of what is being sent to AI models remains a problem. Users have no way of knowing what exactly is being sent to models other than the messages that are visible to them in the TUI (which are all that is included in exports).

  4. opencodejr commented on Oct 28, 2026

    @opencodejr

    Thanks for the suggestion, @jack5github! You're asking for session exports to include the system prompt the model was actually given, so it's easier to see what context the model had and roughly how many tokens it used.

    Right now opencode session export only writes out the saved session messages. The system prompt is built separately for each request and isn't saved, so it can't appear in the export. Maintainers will consider this.

    Related issues you may want to follow:

  5. Rexarrior commented on Oct 29, 2026

    @Rexarrior

    For reference, I already implemented a narrower debugging tool in #39905: opencode debug prompt prints the resolved system prompt for the current project, agent, and model. It does not persist per-request prompts or include them in session exports, but may be useful as a starting point. The PR was closed by automated age/reaction cleanup, not after a technical rejection.

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