Conversation
The Claude Code preset replaced OpenCode's system prompt wholesale, which also dropped user configuration: custom agent prompts, instructions files / AGENTS.md, MCP server instructions and the skills list. Append those to the preset, skipping OpenCode's stock base prompt and <env> block. OPENCODE_CLAUDE_FORWARD_SYSTEM_CONTEXT=0 restores the old behaviour. Fixes openchamber#6
JosueGalRe
added a commit
to JosueGalRe/opencode-claude
that referenced
this pull request
Sep 22, 2026
On by default; OPENCODE_CLAUDE_FORWARD_SYSTEM_CONTEXT=0 opts out. Upstream: openchamber#25 (fixes openchamber#6)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6.
Today every
claude-code/*request replaces OpenCode's system prompt with the Claude Code preset. That's the right call for OpenCode's own boilerplate, but the same system prompt also carries user configuration that nothing else delivers:instructionsfiles and AGENTS.mdWe noticed because a
criticsubagent ran with the right model, variant and permissions but none of its persona, and our instruction files never applied.Fix:
openCodeSystemContext()(src/system-context.ts) splits the OpenCode system text around its<env>block:You are OpenCode…), which is skipped.Both parts are appended to the
claude_codepreset (systemPrompt.append), so the preset stays the base. Meta requests (title/summary) are unchanged.It's on by default because the current behaviour silently breaks custom agents.
OPENCODE_CLAUDE_FORWARD_SYSTEM_CONTEXT=0turns it off (documented in the README). Happy to flip the default to opt-in if you'd rather keep the current behaviour for everyone.Caveat: the split relies on OpenCode's current wording ("You are powered by the model named…" before
<env>, "You are OpenCode" for the stock prompt). If OpenCode rewords these, the effect is that more text gets forwarded (the stock prompt would come through too), not that user config is lost.We've run this locally for a day with custom subagents, instruction files and skills, and they all take effect.
Test:
test/system-context-regression.tscovers the stock-agent case (base prompt and env dropped, instructions and skills kept) and the custom-agent case (persona forwarded), then goes through the proxy to check the presetappendwith forwarding on and with=0. Onmainthe persona is missing and the test fails.bun test/smoke.tsandtsc --noEmitpass.