[FEATURE]: Add visibility flags for merged config and system prompt
Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
I'm working with instruction files and having difficulty understanding what's actually being loaded and processed. While the documentation mentions the merge strategy for configuration files, there's no way to verify the final merged state that the system is using.
There's some challenge in the black box of sending in inputs and observing outputs, even in a deterministic world. Worse with a non-deterministic model processing inputs. I've spent considerable time (see #2225) trying to understand why certain instructions aren't being acted upon, but without visibility into the system prompt or final configuration, it's difficult to reason about the cause.
I put on my functional programming thinking cap (data flowing through a pipeline taking on different forms) to propose these two additions:
--configflag - Display the final merged configuration object as JSON. This would help verify that all configuration sources (global, project-local, etc.) are being combined correctly. Not correctly you, but correctly me.--system-promptflag - Show the fully-merged system prompt being passed to the model for a new session. This way I don't have to interrogate it. I know what it will be told.
Having these debugging tools would make it much easier to set up instruction files reliably and understand why the system behaves the way it does. Currently, the lack of visibility makes it difficult to distinguish between configuration issues and model behavior.
Would this be feasible to add?
This appears to be a feature request about debugging and visibility for OpenCode's configuration and system prompts. Searching the repository for related issues...
Searching repository for related feature requests and issues...
This issue might be a duplicate of existing issues. Please check:
- #4861: [FEATURE]: on debug mode displaying which system message prompt used - Requests the ability to see which system message prompt is being used in debug mode
- #3195: Dynamic system prompts for custom agents - Related feature request about dynamically configuring system prompts for agents
Feel free to ignore if none of these address your specific case.
Yeah have a config debug command (opencode debug config), rn it just shows your modifications if you have opencode.json files.
I think we should adjust it to fully resolve all the different configs so youy have full visibility into everything
The --system-prompt flag is really just knowing what you're actually communicating to the model. You have a /thinking toggle in the TUI. Alternately, a /prompting toggle would provide an unfiltered display of what you're actually saying to the model.
@rekram1-node I've implemented source attribution for debug config - it shows where each value comes from in a _sources object.
The merge process doesn't track sources, so I retraced config loading to avoid touching core code (~200 LOC). But it might be cleaner to add source tracking directly to the merge logic (~80 LOC).
Do you think the sources should be displayed by default or behind a --sources flag?