Setting your editor's display language does nothing for the language your agents write into the repository. Here is what six weeks of unattended runs actually produced, how to pin output language per audience, and a gate that catches the drift mechanically.
I finished the Japanese UI setup in early June. Language pack installed, a line in my agent instructions asking for Japanese replies, the whole interface and the conversation in Japanese. I was pleased with myself for about two weeks.
Then I ran git log --oneline -30 to review what my unattended agents had been up to, and the screen filled with a striped mess of two languages. A Japanese commit message, then three lines down, fix: resolve race condition in the scheduler. Same agent. Same settings. Same week.
Nothing was misconfigured. The UI was Japanese. Responses came back in Japanese. Only the things left behind in the repository were drifting.
The UI language and the artifact language are decided in different places
It took me a while to see why. There are three layers, and they are independent of one another.
Layer
What decides it
Who reads it
Self-correcting?
UI language
Language pack, editor settings
You, at the screen
Fixed once configured
Response language
Rule files (GEMINI.md, AGENTS.md) and the prompt at hand
You, in the conversation
Yes — you notice and correct it
Artifact language
Whatever context the model is in at that instant
Future you, collaborators, users
No — nobody is watching
The first layer is an editor setting; the second is decided by rule files and the prompt. Both live in front of you, so when the conversation itself drifts, a single correction in the chat pulls it back.
The third layer is not a setting at all. When an agent writes a commit message, its input is the diff and the recent conversation — nothing else. If the diff is full of English tokens (function, return, variable names), the model concludes it is operating in an English context. If the diff touched Japanese prose, it writes Japanese. The artifact language follows the diff, not your configuration.
With a human at the keyboard, that drift gets fixed the moment it appears on screen. Unattended, it doesn't. The next run starts, nobody reads the output, and the mixture accumulates. That is exactly why I went two weeks without noticing.
There is no "response language" setting in the official settings reference
Let me record a misunderstanding I carried for a long time. Localization guides sometimes describe a settings key — something like responseLanguage — that pins the language the agent replies in. I spent a while hunting for it in the settings pane.
When I reread the official documentation in November 2026 (the Settings page and the Extension settings table for the VS Code extension), no such key was listed. The extension settings cover things like antigravity.enableInlineDiff and antigravity.serverPort — diff display and the background server, nothing about language. As far as I could verify, the documented way to set the agent's language persistently is rules.
Common assumption
What the official docs say (as of Nov 2026)
What I do
The response language is a toggle in Settings
No such key documented. Persistent instructions go in rules (AGENTS.md, GEMINI.md, .agents/rules/*.md)
Both the reply language and the output contract live in rules
A closer rule file overrides a farther one
Rules are cumulative: everything found is combined, not replaced
Language rules are written in exactly one place
Subfolders inside .agents/rules/ get picked up
Only immediate .md children are scanned; nested files are ignored unless registered in .agents/rules.json
Keep the directory flat
Translating the screen is the language pack's job. Everything past the screen is decided by text, not by a setting. Settings shape the screen; rules shape the words. Once that distinction landed, I stopped digging through the settings pane.
✦
Thank you for reading this far.
Continue Reading
What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.
WHAT YOU'LL LEARN
✦UI language, response language, and artifact language are three independent layers. In unattended runs, only the third one goes unread and unfixed
✦How to pin commit messages, code comments, log strings, and generated docs by audience rather than by preference, and how to encode that in AGENTS.md
✦A 120-line lang_gate.py that catches violations mechanically, plus six weeks of measurements: violation rates, false-positive rate, and three things it still misses
Secure payment via Stripe · Cancel anytime
✦
Unlock This Article
Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.
Six weeks of measurements, before changing anything
Once I noticed, I resisted the urge to fix it and measured first. I scanned everything the scheduled runs had left behind over six weeks, bucketed by artifact type, and counted what contained Japanese characters and what didn't.
Artifact type
Total
Japanese
English
Mixed within one
Non-conforming
Commit messages
312
198
114
7
36.5%
Code comments (added lines)
1,046
402
644
—
38.4%
Generated docs (.md)
44
39
2
3
11.4%
Log output strings
188
51
137
—
27.1%
A few things clicked into place.
Generated docs drift least because "this is Japanese prose" is obvious from the diff itself. Code comments drift most because every identifier around them is English. The mixing rate tracked almost linearly with how many English tokens surrounded the artifact.
The seven "mixed within one" cases were the nastiest. Things like Fix: スケジューラの競合状態を解消 and update tests — the language switches mid-line. Bucket counts can't see those. Only the gate below caught them.
And the number of times I manually corrected an artifact's language during those six weeks: zero. Obvious, since I didn't know it was happening — but it captures the nature of unattended work rather precisely.
Decide by audience, not by preference
My first instinct was to force everything to Japanese. The UI is Japanese, so why not.
I talked myself out of it. As an indie developer I ship my websites and my app store listings in both Japanese and English, and if the comments in published sample code are written in Japanese, an English-speaking developer who copies that snippet gets a block they can't read. That isn't hospitable.
So I went back to a simpler principle: language is decided by who reads the text. Writing that out produced this.
Artifact
Audience
Language
Reason
Commit message (prefix)
Tools, grep, me
English, fixed set (Add:Fix:Update:)
Machines read this. Drift breaks search
Commit message (body)
Future me
Japanese
Intent belongs in the language I write it most precisely in
Code comments (published code)
Users of the published code, in both languages
English
Must stay readable for anyone who copies it
Code comments (private ops scripts)
Only me
Japanese
When you're the only reader, there is nothing to debate
Log output strings
Me, monitoring tools
English
grep, aggregation, future tooling
Generated docs (.md)
Depends where the file lives
Follows the directory
ja/ is Japanese, en/ is English
What surprised me was that the answer came out neither "all Japanese" nor "all English." I had assumed localizing meant translating the interface. What it actually required was deciding which parts stay in which language, and then writing that decision down somewhere a machine can read it. The UI setting is a small piece of that.
I call this table an output language contract. "Contract" because it is both a promise the agent is asked to keep and something written in a shape that lets me detect a broken promise.
Encoding the contract in AGENTS.md
A contract nowhere near the agent is decoration. In Antigravity, AGENTS.md is where it goes. Per the official Rules documentation, Antigravity loads AGENTS.md, GEMINI.md, and .agents/rules/*.md from the workspace folder and every parent folder up to the repository root. Anything you want across all projects can sit in a global rule such as ~/.gemini/GEMINI.md.
My first attempt:
## Output language- Write commit messages in Japanese- Write code comments in English
This barely worked. Two more weeks of runs moved the English rate for comments from 61.6% to 78.4%. Better, but one in five still broke it.
What worked was removing the room to decide.
## Output language contract (applies without exception)Language is decided by who reads the text. It is unrelated to the UI settingor the language of the conversation.### Commit messages- Prefix is English, from this fixed set: `Add:` `Fix:` `Update:` `Refactor:` `Remove:`- Everything after the prefix is Japanese- Never mix languages within one message (the prefix aside)- Follow this: `Fix: スケジューラの競合状態を解消`- Not this: `Fix: resolve race condition in the scheduler`- Not this: `Fix: スケジューラの競合状態を解消 and update tests`### Code comments- Under `src/` and `content/` = published code -> English only- Under `scripts/` and `_ops/` = private ops scripts -> Japanese only- When unsure, choose English (assume it will be published)### Log output strings- The first argument to `print`, `console.log`, `logger.*` is English only- Interpolated values (filenames, image titles) are exempt
Three things came out of that rewrite.
"One of the following" beats "please do X." Enumerate the options and the model picks from the enumeration. Leave free-form space and it follows whatever context it happens to be in.
Counter-examples change the behavior. Compared to a version with only positive examples, residual mixing dropped visibly. The mid-line mixing case in particular never improved until I wrote a counter-example for it.
Branching on paths stabilizes the judgment. "Published code is English" is obvious to a human but is a fresh decision for the model on every run. Write under src/ and there is no decision left to make.
Hand the path branching to glob-triggered rules
Writing "English under src/, Japanese under scripts/" into AGENTS.md worked, but as the contract grew I started to mind that the whole thing was injected on every turn. Per the official docs, AGENTS.md and GEMINI.md take no frontmatter and are always on, while each file in .agents/rules/ declares a trigger: always_on, model_decision, glob, or manual.
A rule that depends on which file is being touched — comment language, for instance — is a natural fit for glob. It activates only when the agent interacts with files matching globs. Rewritten along the documented mechanism, it looks like this.
Before (everything in AGENTS.md):
### Code comments- Under `src/` and `content/` = published code -> English only- Under `scripts/` and `_ops/` = private ops scripts -> Japanese only
After (loaded only when those files are touched):
---trigger: globglobs: "scripts/**, _ops/**"description: "Comment language for private ops scripts: Japanese"---# Ops script language- Added code comments are Japanese only- Short boilerplate such as `# TODO` or `# noqa` may stay English
Save that as .agents/rules/lang-ops-scripts.md and split the src/ side into .agents/rules/lang-public-code.md the same way. globs is comma-separated, and patterns starting with * need quotes so YAML doesn't read them as aliases — that caution comes straight from the docs. I haven't fully confirmed on my machine that every pattern matches as intended, so check that the rule appears in the Rules list under Customizations before relying on it.
The commit-message rules stayed in AGENTS.md. A commit message isn't a file, so a glob condition never fires for it. Words attached to files go in glob rules; words attached to nothing go in always-on rules. Split along that line, there was almost nothing left to agonize over.
Two traps when you split. If a .md under .agents/rules/ has no frontmatter, or spells the trigger in camelCase (alwaysOn, modelDecision), the docs say the rule is silently discarded. And each rule file is truncated at 24,000 bytes, with a shared 20,000-token budget for all always-on rules. The shorter the contract, the more reliably it arrives.
If you nest AGENTS.md files, note that rules accumulate rather than override, and rules in subfolders below the workspace folder are not loaded even when the agent reads files there (official docs, Customization discovery). I keep the language contract in the single root file and never restate it in children. How I think about splitting rule files is in what actually shrinks when you split rules with @ includes. Cross-cutting rules like language will always diverge if you distribute them.
Assume the rules get broken, and detect it mechanically
Even with the tightened contract, one in twenty comments still broke it. I've come to read that less as a writing failure than as a property: natural-language instructions are only ever probabilistically obeyed. So the detection layer sits separately from the rules.
lang_gate.py scans the staged diff and the commit message and reports violations. It's about 120 lines.
#!/usr/bin/env python3"""Gate for the output language contract: checks staged diffs and commit messages."""import reimport subprocessimport sysfrom pathlib import Path# CJK ideographs, hiragana, katakana. Deliberately excludes full-width punctuationCJK = re.compile(r"[-ゟ゠-ヿ一-鿿]")COMMIT_PREFIX = re.compile(r"^(Add|Fix|Update|Refactor|Remove|Docs|Test):\s")# Proper nouns that may appear inside English comments without counting as violationsALLOWLIST = {"Antigravity", "Gemini", "Next.js", "Cloudflare", "Stripe"}# path -> expected languageRULES = [ (re.compile(r"^(src|content)/"), "en"), (re.compile(r"^(scripts|_ops)/"), "ja"),]COMMENT_PATTERNS = [ re.compile(r"^\+\s*//\s?(.*)$"), # ts/js/go re.compile(r"^\+\s*#\s?(.*)$"), # python/bash re.compile(r"^\+\s*\*\s?(.*)$"), # jsdoc continuation]def has_cjk(text: str) -> bool: return bool(CJK.search(text))def strip_allowlist(text: str) -> str: for word in ALLOWLIST: text = text.replace(word, "") return textdef expected_lang(path: str) -> str | None: for pattern, lang in RULES: if pattern.match(path): return lang return Nonedef check_commit_message(msg: str) -> list[str]: """English prefix, Japanese body, no mixing within a line.""" violations = [] first = msg.strip().splitlines()[0] if msg.strip() else "" if not COMMIT_PREFIX.match(first): violations.append(f"commit: prefix outside the contract -> {first[:60]!r}") return violations body = COMMIT_PREFIX.sub("", first) if not has_cjk(body): violations.append(f"commit: body is not Japanese -> {body[:60]!r}") else: # Mixed within a line: contains CJK and two or more English words of 3+ chars words = re.findall(r"[A-Za-z]{3,}", strip_allowlist(body)) if len(words) >= 2: violations.append(f"commit: languages mixed within one line -> {body[:60]!r}") return violationsdef iter_added_comments(path: str) -> list[str]: """Pull just the added comment bodies out of this file's diff.""" diff = subprocess.run( ["git", "diff", "--cached", "-U0", "--", path], capture_output=True, text=True, check=True, ).stdout out = [] in_code_block = False for line in diff.splitlines(): # In .md diffs, skip fenced code blocks if path.endswith(".md") and line.lstrip("+-").strip().startswith("```"): in_code_block = not in_code_block continue if in_code_block or not line.startswith("+"): continue for pattern in COMMENT_PATTERNS: m = pattern.match(line) if m and m.group(1).strip(): out.append(m.group(1).strip()) break return outdef main() -> int: violations: list[str] = [] msg_path = Path(sys.argv[1]) if len(sys.argv) > 1 else None if msg_path and msg_path.exists(): violations += check_commit_message(msg_path.read_text(encoding="utf-8")) staged = subprocess.run( ["git", "diff", "--cached", "--name-only", "-z"], capture_output=True, text=True, check=True, ).stdout # Without -z, non-ASCII filenames come back octal-escaped and you scan the wrong files for path in filter(None, staged.split("\0")): want = expected_lang(path) if want is None: continue for comment in iter_added_comments(path): cjk = has_cjk(strip_allowlist(comment)) if want == "en" and cjk: violations.append(f"{path}: Japanese in a published-code comment -> {comment[:50]!r}") elif want == "ja" and not cjk and len(comment) > 12: violations.append(f"{path}: English in an ops-script comment -> {comment[:50]!r}") if violations: print("Output language contract violations:") for v in violations: print(f" - {v}") return 1 print("Output language contract OK") return 0if __name__ == "__main__": sys.exit(main())
A few judgment calls are worth explaining.
The CJK range is deliberately narrow. My first version counted full-width punctuation as CJK, which meant a single full-width bracket inside an English comment tripped the gate. Far too noisy. Restricting it to hiragana, katakana, and ideographs cut false positives sharply.
--name-only gets -z. Without it, filenames containing non-ASCII come back octal-escaped and the scan silently skips them. I'd been bitten by a close cousin of this before, with files containing Japanese text (three byte-level checks before letting an agent edit non-ASCII files), so this time the flag went in from the start. One of the rare occasions a past mistake paid off.
The Japanese-expected side has a length floor. Flagging # TODO and # noqa under scripts/ as violations makes the gate unusable. Only comments longer than 12 characters are checked. That threshold has no theory behind it; I picked it while staring at real diffs.
Hook or CI?
I went back and forth on placement. The answer turned out to be both, with split responsibilities.
commit-msg hook
CI (post-push)
Catches
Local commits
Every commit
Works unattended?
Yes, same machine as the run
Yes, but after the fact
Cost of a false positive
The run dies (expensive)
A notification (cheap)
What I check there
Commit messages only
Comments and logs too
The split exists because false-positive cost is asymmetric. Commit-message checking is simple enough that six weeks produced zero false positives, so blocking on it is safe. Comment checking occasionally grabs a string literal or a doc fragment, and killing an unattended run on that means the job dies at an hour when nobody is around to restart it.
I've made that mistake before: a strict gate on the unattended path fired a false positive at 2am and nothing had moved by morning. In unattended systems, the authority to block should be proportional to how rarely the check is wrong. That's what I took away.
The hook itself is a few lines. The shebang (#!/bin/sh) must be the very first line — my first version had the descriptive comment on line one, and the hook didn't start the way I expected.
#!/bin/sh# .git/hooks/commit-msg (remember: chmod +x .git/hooks/commit-msg)# lang_gate.py uses `str | None` type hints, so it needs Python 3.10+python3 scripts/lang_gate.py "$1" || exit 1
When the contract doesn't take effect
"I wrote the contract and nothing changed" happened to me more than once. Here are the cases in the order I hit them.
Symptom
Likely cause
How to check
Fix
The contract has no effect at all
A .md in .agents/rules/ lacks frontmatter, or trigger is misspelled
Does the file appear in the Rules list under Customizations?
Use snake_case, e.g. trigger: always_on
Only the rule in a subfolder is ignored
Folders below the workspace, and nested folders inside .agents/rules/, aren't loaded
Is the file in the workspace folder or a parent?
Move it to the repo root or directly under .agents/rules/
The second half of a long contract is ignored
24,000-byte per-file truncation, or the 20,000-token always-on budget is exceeded
wc -c AGENTS.md plus your global rules
Keep the examples, cut the prose, move file-bound rules to glob
Only commit messages drift
Commit rules were moved into a glob rule (no file ever matches)
Which file holds the commit rules?
Put commit rules back in AGENTS.md
Violations pass despite the hook
Shebang not on line one, no execute bit, or --no-verify
head -1 .git/hooks/commit-msg and ls -l
Shebang first, chmod +x, and run the same check in CI
Every row is about asking "did the rule arrive?" before asking "is the rule right?" Rewriting a rule that never reaches the agent changes nothing.
Three things this still doesn't solve
Existing comments are untouched. The gate only sees added lines, so of the 644 English comments accumulated over six weeks, the ones under scripts/ are still English. I considered a bulk rewrite and backed off — mechanical replacement has mangled meaning for me before. The current policy is to fix them as I happen to touch them.
I gave up on log strings. Parsing logger.info(f"published {slug}") correctly needs an AST walk, not a regex. I started, decided the effort wasn't worth it, and stopped. That 27.1% is still 27.1%.
The model still drifts. Even with the contract and counter-examples, the English rate for comments plateaued at 94.2%. The gate catches the remaining 5.8%. So: rules get you to 94, the gate covers the rest. I keep the gate because the rules are never going to reach 100.
Where you'll likely get stuck next: the CLI, and feeding corrections back into rules
Once the contract worked on the desktop, the CLI was my next snag. The official docs say workspace AGENTS.md, GEMINI.md, and .agents/, plus your global ~/.gemini/ configuration, are read by both the Antigravity App and the CLI. But a trigger: manual rule loads only when you @-mention it, and the CLI doesn't support rule mentions. Make the output contract manual and an unattended run launched from the CLI will never read it. always_on or glob is the safer choice.
The other question is how corrections made in conversation get back into the rules. There's an official /learn command that turns session corrections into rules and skills. It's handy, but accepting its proposals as-is tends to scatter near-duplicate rules across files. I read the proposal and fold it in by editing one existing line of the contract instead. My process for turning judgment into text an agent can follow is in turning gut-feel decisions into rules agents follow.
Six weeks later
Metric
Before
After
Commit message violation rate
36.5%
0% (unreachable via the hook)
Code comment conformance
61.6%
100% (94.2% rules + 5.8% gate)
Gate false positives
—
0 commits / 4 comments (0.33% of 1,203 scans)
Scan time per run
—
~90–140 ms for a ~30-file diff
Log string mixing
27.1%
27.1% (unaddressed)
The shift in how I think about it mattered more than the numbers. I'd assumed localization meant picking a language in a settings pane. What it actually meant was deciding which parts stay in which language, and recording that decision somewhere a machine can enforce it. The UI setting is the doorway. The more work you hand to unattended agents, the more the parts you never decided will quietly drift.
If you've just finished localizing your editor, run git log --oneline -30 once. There's a layer there that the settings pane never shows you. That's where I started.
I'm still working this out — I haven't decided what to do about that 27.1% in the logs. This is one small repository kept by one person, but if you're stuck at the same place, I hope some of it is useful.
Share
Thank You for Reading
Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.