feat(agent-core): strengthen the language-matching rule in the default system prompt - #1338
Merged
Conversation
🦋 Changeset detectedLatest commit: ee89b42 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Related Issue
No linked issue — the problem is explained below.
Problem
The default system prompt's language-matching rule (reply and think in the user's language) was a single paragraph buried at the end of the "Prompt and Tool Use" section. Mid-prompt instructions carry the least weight, and in practice the model tends to drift back to English in exactly one scenario the rule never named: returning to address the user after a long stretch of English tool output. The rule also lacked a boundary for repository artifacts, so strengthening it naively would risk Chinese commit messages and code comments in English repos.
What changed
All changes are in
packages/agent-core/src/profile/default/system.md:# Languagesection near the top of the prompt (right after the identity/role block). It pins the language to the user's most recent messages, follows mid-session switches, applies to replies / reasoning / progress notes / questions, and explicitly names the "after long English tool output" drift scenario.# Ultimate Reminders, using the head/tail positions of the prompt where instructions carry the most weight.Verified with the full
agent-coretest suite (215 files, 3429 passed; 3 pre-existing expected failures).prompt-placeholders.test.tsguards template syntax only and is unaffected by this prose change.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.