Skip to content

[FEATURE]: Language preference for model reasoning & output — English-only built-in prompts degrade Chinese writing quality #49889

Open

Description

@627-hub

Feature hasn't been suggested before.

What I'm requesting

A first-class way to pin the model's reasoning and output language. This is not about UI i18n — the UI already has Language settings; the model side has nothing.

Today the built-in system prompt, tool descriptions, and agent scaffolding are English-only. Even when I work entirely in Chinese, the model's internal reasoning comes out English or heavily mixed (EN / 中文 interleaved). This is not cosmetic: when the model reasons in English and then writes Chinese, the prose carries translationese — stiff syntax, weakened rhythm, lost voice.

I write Chinese fiction with opencode (chapter by chapter, with custom agents and skills). English reasoning noticeably degrades the quality of the Chinese prose, and this is currently the biggest bottleneck for this use case.

Why current workarounds are not enough

  • The commonly suggested workaround (global AGENTS.md, e.g. "always think and answer in Chinese") only partially helps. The English built-in scaffolding still dominates, and reasoning remains mixed. Another user reported the same outcome in How to globally set the language for model thinking and answering #9610: "it works, sort of… there is a price to pay for mixing languages."
  • Custom agent prompts carrying the same instruction: same partial effect.
  • There is no config that reliably anchors the reasoning language.

Proposed solution

  1. Add a model-side language preference in the config, e.g.:

    // opencode.json
    "language": "zh-CN"   // and/or per-agent `language`

    When set, opencode injects a strong anchoring instruction into the system prompt for every agent/model, e.g.:

    Think and answer in Chinese. Keep your internal reasoning in Chinese; do not switch to English.

    Placement matters — as its own top-level section, so it reliably out-prioritizes the rest of the prompt.

  2. Extend the existing Desktop Language setting so it also anchors the model side by default — one place to manage UI + model language.

  3. Longer term: localized variants of the core system prompts (the app-side i18n infrastructure already exists).

Related

Environment / symptoms

  • Model: opencode-go/deepseek-v4.1-flash (the behavior generalizes to other models)
  • Symptom: reasoning blocks are EN / 中文 mixed; the resulting Chinese text reads like a back-translation of the English thoughts.
  • Affects both TUI and Desktop.

Activity

  1. xvcezrqpbxtpzblrt commented on Oct 4, 2026

    @xvcezrqpbxtpzblrt

    Adding audit data to this request rather than restating it. All findings below were read from tag v2.0.22, not from the dev branch.

    1. The directive exists in 1 of the 6 built-in model prompts. Auditing packages/core/src/plugin/system-prompt/ at v2.0.22:

    file lines "use the SAME language as the user"
    kimi.txt 95 yes — line 19
    trinity.txt 97 no
    meta.txt 55 no
    gpt-astra.txt 45 no
    gpt.txt 39 no
    anthropic.txt 2 no

    So "English-only built-in prompts" is slightly off for V2: the directive was written for one model family and never propagated to the others. kimi.txt:19 — "When responding to the user, you MUST use the SAME language as the user, unless explicitly instructed to do otherwise." — is the wording to reuse.

    This also predicts a symptom that is hard to explain without this data point: output language is model-dependent, so the same user can get Chinese from one model and English from another with no config change in between. That reads as flakiness until you look at which prompt file was loaded.

    2. #12609's root cause is already gone in V2, so what remains is purely the missing directive. The ASCII-only instruction lived in packages/opencode/src/session/prompt/*.txt. At tag v2.0.22 that whole packages/opencode/ tree has 0 entries; V2 prompts live under packages/core/src/plugin/system-prompt/, and none of the six mention ASCII. The remaining work is therefore not "stop forcing ASCII" — that is done — it is "add the language directive everywhere".

    3. The pattern already exists in the codebase. packages/core/src/plugin/agent.ts:40 — you MUST use the same language as the user message you are summarizing — is already used for session titles and compaction. Same wording, already accepted, applied to the auxiliary prompts but not to the main one.

    4. The subagent half is currently unowned. packages/core/src/tool/plugin/subagent.ts carries no language directive and does not receive the parent session's language. #33084 was closed not_planned in June, so nothing currently tracks that path.

    5. The config surface is empty (verified against the V2 config reference). No documented field relates to model output language. agents.<name>.system and AGENTS.md are the only levers — which is exactly why the recurring community answer is "write it in your global AGENTS.md", the workaround this request wants to retire. Point 2 of the proposal (folding the existing Desktop Language setting into the model side) would give it a single home; a top-level "language": "zh-CN" in opencode.json would also make it testable per session.

    Applying an existing line to six files is a much smaller change than adding a new config concept, and would stop the model-dependence in (1) immediately.

  2. Dante-dan commented on Oct 4, 2026

    @Dante-dan
    Contributor

    I propose an opt-in response-language preference in config, with a per-agent override, rather than tying model output to the Desktop UI locale.

    The prompt audit above points to a broader integration issue: the provider prompt plugins can replace the base system prompt. Adding a directive only to the base prompt would therefore miss several model paths.

    The suggested same-language line is useful for following the user’s current message, but a persisted preference would also support a Chinese writing session whose task instructions or source material happen to be English. A bounded first version could work as follows:

    • A top-level response-language setting supplies the default; an agent setting overrides it. Leaving both unset preserves current behavior. The exact field name can follow the config conventions maintainers prefer.
    • If child-session behavior belongs in the approved scope, a new subagent inherits the parent's resolved preference unless its own agent has an explicit setting. Carry the resolved value as session context, so inheritance does not depend on repeating language instructions in every delegated task.
    • Apply one shared language instruction after built-in provider prompt selection, covering both replacement and append paths. Define its interaction with custom agent prompts and plugin hooks explicitly, so a provider prompt replacement cannot silently discard the preference.
    • Treat it as a preference for explanations and user-facing prose: explicit task requests can choose another language, while code, identifiers, paths and quoted material remain intact.

    I would keep UI-locale synchronization and translated copies of all system prompts out of this first change. After approval, validation would cover config precedence, unchanged prompts when unset, parent/child inheritance and child overrides, and assembled prompts across provider overrides, append mode and custom prompts. Model adherence, including the reported mixed-language reasoning blocks, would still need separate behavioral checks; this setting could express the preference but could not guarantee a provider’s hidden reasoning language.

    Could the core team approve the config and per-agent preference scope? Since #33084 was closed, should this design also carry the resolved preference into child sessions as above, or keep inheritance outside this change?

  3. xvcezrqpbxtpzblrt commented on Oct 5, 2026

    @xvcezrqpbxtpzblrt

    Consolidating here rather than leaving a second open thread on the same topic. I opened #53274 for the prompt-file audit, then found this issue already covers the ask; the count in that thread's first comment was wrong and is corrected at the bottom of this comment.

    Exhaustive prompt enumeration at v2.0.22 (commit 527f0b93)

    Enumerated by walking the full git tree (git/trees/v2.0.22?recursive=1), not by eyeballing the directory, then scanning every prompt/instruction file for same language:

    Carries the rule — 2 of 15

    File Line Wording
    packages/core/src/plugin/system-prompt/kimi.txt 19 "you MUST use the SAME language as the user"
    packages/core/src/plugin/agent.ts 40 title/summary agents — "you MUST use the same language as the user message you are summarizing"

    Lacks the rule — 13 of 15

    File Lines Kind
    plugin/command/review.txt 100 /review command prompt
    plugin/command/initialize.txt 65 /init command prompt
    plugin/system-prompt/trinity.txt 97 model-family base prompt
    plugin/skill/report.md 124 shipped skill prompt
    plugin/skill/opencode.md 264 shipped skill prompt
    plugin/system-prompt/meta.txt 55 model-family base prompt
    plugin/system-prompt/gpt-astra.txt 45 model-family base prompt
    plugin/system-prompt/gpt.txt 39 model-family base prompt
    tool/patch.txt 33 patch tool instruction template
    session/runner/prompt/system.txt 15 runner base prompt
    plugin/system-prompt/anthropic.txt 2 model-family base prompt
    PROMPT_EXPLORE (inside plugin/agent.ts) — explore subagent prompt

    The two that carry it are the two a user never sees: one model family, and the hidden title/summary maintenance agents. That is why a session title can come out in the user's language while the body of the same session comes out in English.

    Two mechanisms worth separating

    /review fights AGENTS.md instead of merely missing it. append() in packages/core/src/plugin/command.ts:

    function append(template: string, input: string) {
      const value = input.trim()
      if (template.includes("$ARGUMENTS")) return template.replaceAll("$ARGUMENTS", () => value)
      return [template, value].filter(Boolean).join("\n\n")
    }

    The 100 lines of review.txt become the start of the user message, not part of the system prompt where AGENTS.md rules live. So the documented workaround from #2594 — a global AGENTS.md saying "always respond in Chinese" — is competing with 100 lines of English-only instructions sitting in the highest-salience position of the request. AGENTS.md works in an ordinary conversation (#2594's reporter confirmed it) and does not reliably win that position.

    The general subagent has no prompt of its own at all. In packages/core/src/plugin/agent.ts it gets name, description, mode and permissions — no item.system. There is no place for a language instruction to live. explore does get PROMPT_EXPLORE, and that one is English-only too.

    What I am still asking for here, separated out

    Two different fixes, and the cheap one does not need this issue:

    1. No new surface: hoist the sentence that already exists in kimi.txt:19 into one shared fragment and compose it into the 13 prompts listed above, PROMPT_EXPLORE and the built-in subagents included. This is a consistency fix inside files that already ship, and it changes nothing for anyone who writes in English.
    2. Still open in this issue: a way to pin a language when the model will not infer it from the conversation — which the shared-fragment fix does not address. A user whose language the model defaults to English on still has no way to force it without a global rule that every session pays for.

    I am not claiming the two are urgent. #2594 already showed the global-AGENTS.md route works, and I would rather state that plainly than pretend the user is stuck.

    Correction

    #53274's first comment says "12 prompt files scanned" and its body says "2 of the 12". Both are wrong — that was the row count of a table I had drawn by hand from a partial directory scan, not an enumeration. The correct denominator is 14 files / 15 prompts, 2 carrying the rule. The conclusion does not change and the gap is slightly larger than I first reported. Full enumeration method is above so it can be re-run.

  4. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed write-up and the concrete use case. You're asking for a model-side language preference (in config, per agent, and/or linked to the Desktop Language setting) that reliably keeps the model's reasoning and output in Chinese, because the English-only built-in prompts lead to mixed reasoning and stiff, translated-sounding prose. The maintainers will consider it.

    Related issues (all closed as not planned):

    In the meantime, a small plugin can do the main part of what you describe. It adds a language instruction as the first section of the system prompt on every request, ahead of the built-in English prompt. The context hook it uses runs on every agent request, so it should also apply to subagents. I wrote it against the v2 plugin API and it type-checks, but I haven't tested it in a running OpenCode:

    // ~/.config/opencode/plugins/model-language.ts  (global)
    // or <project>/.opencode/plugins/model-language.ts  (one project)
    import { Plugin } from "@opencode/plugin"
    
    const INSTRUCTION =
      "Language: Think and answer in Simplified Chinese (zh-CN). Keep all of your reasoning in Chinese; do not switch to English. " +
      "Code, identifiers, file paths and commands stay as they are."
    
    export default Plugin.define({
      id: "model-language",
      setup: async (ctx) => {
        const add = (event: { system: Array<{ type: "text"; text: string }> }) => {
          if (event.system.some((part) => part.text === INSTRUCTION)) return
          event.system.unshift({ type: "text", text: INSTRUCTION })
        }
        await ctx.session.hook("context", add) // every agent / subagent request
        await ctx.session.hook("compaction", add) // so summaries stay in Chinese too
      },
    })

    Save it in one of those plugins/ folders and restart OpenCode. You can write INSTRUCTION itself in Chinese (for example 请始终用简体中文思考和回答,推理过程也保持中文,不要切换到英文。), which may anchor the model even more strongly.

    Limits: this can't translate the built-in prompts or tool descriptions, and it can't read the Desktop Language setting. It also can't guarantee what a model does inside its reasoning, so results will still vary by model.

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

Metadata

Metadata

Assignees

No one assigned

    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