# Language Settings: Making Claude Code and Codex Reply in Your Language

There is **no language switch on the gateway side**: your `cr_` key only decides which models you
reach, not what language the answers come back in. The language is set by **what you tell the tool
to do**, and the two mainstream agents each have a documented place to write that down.

> This page is about *language*. For the general structure of the instruction files themselves see
> [CLAUDE.md Configuration Guide](/docs/usage/claude-md) and
> [AGENTS.md Configuration Guide](/docs/usage/agents-md).

## 1. Ask inside the session

The fastest option is to say it: write your prompt in your own language, or add an explicit
instruction — *"answer in Portuguese"*. It works immediately and needs no configuration, but it
lives only in that conversation. Anything you want to keep across sessions belongs in the files
below.

## 2. Make it stick with CLAUDE.md (Claude Code)

The official wording: *"CLAUDE.md files are markdown files that give Claude persistent instructions
for a project, your personal workflow, or your entire organization."* A language rule is exactly
that kind of instruction.

| Scope | File |
|---|---|
| Enterprise | macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md` · Linux and WSL: `/etc/claude-code/CLAUDE.md` · Windows: `C:\Program Files\ClaudeCode/CLAUDE.md` |
| User | `~/.claude/CLAUDE.md` |
| Project | `./CLAUDE.md` or `./.claude/CLAUDE.md` |
| Local | `./CLAUDE.local.md` |

Put the rule in one block and keep it short:

```markdown
## Response language
- Reply in the language of my message unless I say otherwise.
- If I name a language explicitly (for example: "reply in 日本語"), use it for the whole session.
- Keep code, identifiers, file paths, shell commands and log output exactly as they are.
- Do not translate English comments, commit messages or API names inside files.
```

Three helpers, in the official wording:

- *"Run /init to generate a starting CLAUDE.md automatically."* — it writes what it can discover;
  the language rule is yours to add.
- *"The /memory command lists your CLAUDE.md, CLAUDE.local.md, and other memory file locations
  across user and project scopes"* — use it to confirm the file you edited is the one that loads.
- *"CLAUDE.md files can import additional files using @path/to/import syntax."* — handy when the
  language rules live in a separate file shared by several repos.

Claude Code can also read `AGENTS.md`: *"Claude Code can read AGENTS.md as project instructions,
allowing compatibility with other coding agents without adding CLAUDE.md."*, and *"CLAUDE.md takes
precedence over AGENTS.md by default."* So if one repo serves both tools, write the rule once in
`AGENTS.md` and only add a `CLAUDE.md` when Claude Code needs something extra.

## 3. Make it stick with AGENTS.md (Codex)

*"Codex reads AGENTS.md files before doing any work."* Codex builds an instruction chain at
startup, and the discovery order matters for a language rule:

1. **Global scope** — in your Codex home (defaults to `~/.codex`, unless you set `CODEX_HOME`),
   *"Codex reads `AGENTS.override.md` if it exists. Otherwise, Codex reads `AGENTS.md`."* Only the
   first non-empty file at this level is used.
2. **Project scope** — *"Starting at the project root (typically the Git root), Codex walks down to
   your current working directory."* Each directory contributes at most one file:
   `AGENTS.override.md`, then `AGENTS.md`, then any name in `project_doc_fallback_filenames`.
3. **Merge order** — *"Codex concatenates files from the root down […] Files closer to your current
   directory override earlier guidance because they appear later in the combined prompt."*

```markdown
## Response language
- Reply in the language of my message unless I say otherwise.
- Keep code, identifiers, file paths, shell commands and log output exactly as they are.
- Refer to files by their real names, including non-ASCII characters.
```

One caveat with a hard number behind it: *"Codex skips empty files and stops adding files once the
combined size reaches the limit defined by `project_doc_max_bytes` (32 KiB by default)."* A language
rule is two lines — put it high in the file so it survives the cut-off, not at the end of a long
monorepo chain.

Our own team guidance, from [AGENTS.md Configuration Guide](/docs/usage/agents-md): the file can be
written in your own language or in English; for a personal project use whichever you are comfortable
with, for a shared repo English is recommended because it stays consistent with the code. A language
*rule* written in English that demands replies in another language is the usual combination.

## 4. Which file to edit

| Goal | Write it here |
|---|---|
| Every project on your own machine | `~/.claude/CLAUDE.md` **and** `~/.codex/AGENTS.md` |
| One project, shared with teammates | `./AGENTS.md` committed to the repo (both tools read it) |
| One project, only for you | `./CLAUDE.local.md` for Claude Code; a deeper `AGENTS.md` in your own subdirectory for Codex |

## 5. Non-English prompts: what to expect

- **Prompts cost tokens.** A prompt in your own language is billed like any other; for Chinese
  *"1 character typically corresponds to 1-2 tokens"* (see
  [Billing Description](/docs/reference/billing)), so a chatty rule written once in a memory file is
  cheaper than repeating it in every message.
- **Ask for the answer language, not the code language.** Translating identifiers, CLI flags, error
  strings or file paths makes answers unusable; that is why the example blocks above keep code in
  its original form.
- **If replies drift back to English**, the rule is probably being read late or being overridden —
  confirm the loaded files with `/memory` or `/context`, and check whether a deeper `AGENTS.md` or
  `AGENTS.override.md` is winning (see the merge order in section 3).

## 6. File encoding, accents and non-ASCII paths

Language settings are also a byte-level problem. Three rules that hold everywhere:

**Keep the files UTF-8.** *"UTF-8 is the universal code page for internationalization and is able to
encode the entire Unicode character set. It is used extensively on the web and is the default
encoding for both XML and \*nix-based platforms."* Save `CLAUDE.md` / `AGENTS.md` as UTF-8 from your
editor; a mojibake memory file is read as mojibake.

**Windows has a console code page in front of the terminal.** *"Changes the active console code page.
If used without parameters, chcp displays the number of the active console code page."* — and the
list includes `936` for Chinese. If non-ASCII output looks wrong in a console, check that page first;
Microsoft's own recommendation for running UTF-8 processes is the `activeCodePage` property
(*"As of Windows Version 1903 (May 2019 Update), you can specify the activeCodePage property…"*), or
the system-wide *"Beta: Use Unicode UTF-8 for worldwide language support"* option.

```powershell
chcp
chcp 936
```

**Accented and CJK names can be equal-but-different bytes.** The Unicode Standard defines
*"canonical equivalence"* as an equivalence between *"characters or sequences of characters which
represent the same abstract character […] when correctly displayed should always have the same
visual appearance and behavior."* Two file names that look identical on screen can therefore differ
in bytes, so:

- let the agent **copy** the path from a listing rather than retype it (the example rules say
  *"Refer to files by their real names, including non-ASCII characters"*);
- quote paths that contain spaces or CJK characters in any shell command;
- turn off Git's escaping so `git status` and `git diff` print your names as-is: *"When this
  configuration option is set to false, git will not quote pathnames in the output of commands like
  `git status` and `git diff` […] The default value is `true`."*

```bash
git config --global core.quotepath false
```

## 7. Checklist

- [ ] The rule is in a file the tool actually loads (`/memory`, `/context`, or an early section of the Codex chain).
- [ ] It names the reply language **and** forbids translating code, paths and commands.
- [ ] The file is saved as UTF-8.
- [ ] Non-ASCII paths are copied from tool output, not retyped.
- [ ] If both tools are used on one repo, the rule lives in `AGENTS.md` (or is duplicated deliberately).

## Related Pages

- [CLAUDE.md Configuration Guide](/docs/usage/claude-md)
- [AGENTS.md Configuration Guide](/docs/usage/agents-md)
- [Claude Code Complete Tutorial](/docs/getting-started/claude-code-tutorial)
- [Codex Complete Tutorial](/docs/ide/codex)
- [Output formats: json / text / stream-json](/docs/usage/output-formats)
- [CLI Tips](/docs/usage/cli-tips)
- [QCode for Users Outside Mainland China](/docs/getting-started/international-users)