| 1 | # Reasoning Language |
| 2 | |
| 3 | <a href="./GUIDE.md">Guide</a> |
| 4 | · |
| 5 | <a href="./REASONING_LANGUAGE.zh-CN.md">简体中文</a> |
| 6 | |
| 7 | `agent.reasoning_language` controls the preferred language of visible |
| 8 | reasoning or thinking text when a provider exposes it. |
| 9 | |
| 10 | It does not set the final answer language, rewrite code, translate identifiers, |
| 11 | or change hidden model reasoning. The user's explicit language request in a turn |
| 12 | still wins for the final answer. |
| 13 | |
| 14 | ## Why It Exists |
| 15 | |
| 16 | Some users read visible reasoning more comfortably in Chinese or English even |
| 17 | when the task itself mixes languages. This setting makes that preference |
| 18 | explicit without changing the stable system prompt or tool definitions. |
| 19 | |
| 20 | The setting is intentionally small: |
| 21 | |
| 22 | - `auto` anchors visible reasoning to Chinese when the raw user prompt is |
| 23 | clearly Chinese, ignoring injected reference context such as `@file` contents; |
| 24 | English and ambiguous turns add no extra instruction. |
| 25 | - `zh` asks visible reasoning to prefer Simplified Chinese. |
| 26 | - `en` asks visible reasoning to prefer English. |
| 27 | |
| 28 | ## Desktop |
| 29 | |
| 30 | Open: |
| 31 | |
| 32 | ```text |
| 33 | Settings -> Models -> Usage -> Agent runtime -> Thinking language |
| 34 | ``` |
| 35 | |
| 36 | The desktop setting writes the user-level default. A project can still override |
| 37 | it with `./reasonix.toml`. |
| 38 | |
| 39 | ## CLI And TUI |
| 40 | |
| 41 | For shell scripts or one-off configuration: |
| 42 | |
| 43 | ```bash |
| 44 | reasonix config reasoning-language auto |
| 45 | reasonix config reasoning-language zh |
| 46 | reasonix config reasoning-language en |
| 47 | ``` |
| 48 | |
| 49 | By default this writes the user config. To write a project-local override: |
| 50 | |
| 51 | ```bash |
| 52 | reasonix config reasoning-language --local zh |
| 53 | ``` |
| 54 | |
| 55 | Inside `reasonix`, use the slash command: |
| 56 | |
| 57 | ```text |
| 58 | /reasoning-language auto |
| 59 | /reasoning-language zh |
| 60 | /reasoning-language en |
| 61 | ``` |
| 62 | |
| 63 | The slash command writes the user-level setting and updates the current chat |
| 64 | controller for subsequent turns. It does not rewrite the current project's |
| 65 | `reasonix.toml`; use the shell command with `--local` for that. |
| 66 | |
| 67 | Headless runs also use the same setting: |
| 68 | |
| 69 | ```bash |
| 70 | reasonix run "explain this module" |
| 71 | ``` |
| 72 | |
| 73 | ## Config File |
| 74 | |
| 75 | User or project config: |
| 76 | |
| 77 | ```toml |
| 78 | [agent] |
| 79 | reasoning_language = "auto" # auto|zh|en |
| 80 | ``` |
| 81 | |
| 82 | Resolution order for this setting: |
| 83 | |
| 84 | ```text |
| 85 | ./reasonix.toml > user config.toml > built-in defaults |
| 86 | ``` |
| 87 | |
| 88 | There is currently no command-line flag for this setting. Prefer config because |
| 89 | the value is a user or project preference rather than a per-invocation task |
| 90 | argument. |
| 91 | |
| 92 | ## Cache Behavior |
| 93 | |
| 94 | `auto` is still cache-friendly. When the raw user prompt clearly looks Chinese, |
| 95 | Reasonix adds the same small transient `<reasoning-language>` block for that |
| 96 | turn; English and ambiguous turns inject nothing and rely on the existing stable |
| 97 | language policy. Injected reference context such as `@file` contents is ignored |
| 98 | for this auto decision. |
| 99 | |
| 100 | When set to `zh` or `en`, Reasonix always adds a small transient |
| 101 | `<reasoning-language>` block to the user turn. In all modes, this does not |
| 102 | change: |
| 103 | |
| 104 | - the system prompt |
| 105 | - tool schema bytes or ordering |
| 106 | - the stable provider-visible prefix |
| 107 | |
| 108 | This keeps high prompt-cache hit rate intact while still letting an explicit |
| 109 | preference affect the next model call. |
| 110 | |
| 111 | ## Boundaries |
| 112 | |
| 113 | - The setting only matters when visible reasoning text exists. |
| 114 | - It is a preference, not a hard translation layer. |
| 115 | - Code, identifiers, file paths, shell commands, and untranslated technical |
| 116 | terms should remain in their original form. |
| 117 | - If a user asks for a final answer in a specific language, that request remains |
| 118 | authoritative for the final answer. |
| 119 | - The visible-reasoning language is anchored mainly by two signals: the language |
| 120 | of the turn's first reasoning segment, and the language of earlier reasoning |
| 121 | segments that providers receive back during tool-call loops. The injected |
| 122 | language block works by landing the first segment in the preferred language; |
| 123 | once the first segment holds, later segments usually sustain it. |
| 124 | - In long agent turns dominated by another language (for example large English |
| 125 | build logs, code, or tool output), a later reasoning segment can still drift; |
| 126 | once it drifts, the rest of the turn usually stays in the drifted language, |
| 127 | and restating the preference mid-turn recovers it only partially. This is a |
| 128 | model-behavior boundary; the setting stays best-effort by design. |
| 129 |