Skip to content

feat(agent-core): strengthen the language-matching rule in the default system prompt - #1338

Merged
RealKai42 merged 2 commits into
mainfrom
kaiyi/addis-ababa
Jul 3, 2026
Merged

feat(agent-core): strengthen the language-matching rule in the default system prompt#1338
RealKai42 merged 2 commits into
mainfrom
kaiyi/addis-ababa

Conversation

@RealKai42

Copy link
Copy Markdown
Collaborator

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:

  • Added a dedicated # Language section 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.
  • Added a carve-out in the same section: artifacts that go into the repository (code comments, commit messages, PR descriptions, documentation) follow the project's existing conventions, not the conversation language.
  • Removed the old language paragraph from "Prompt and Tool Use" and dropped the duplicated "in the same language as the user" clause from the pre-tool-call narration sentence, so the rule lives in one place.
  • Added a matching bullet to # Ultimate Reminders, using the head/tail positions of the prompt where instructions carry the most weight.

Verified with the full agent-core test suite (215 files, 3429 passed; 3 pre-existing expected failures). prompt-placeholders.test.ts guards template syntax only and is unaffected by this prose change.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ee89b42

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 3, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@38a9b14
npx https://pkg.pr.new/@moonshot-ai/kimi-code@38a9b14

commit: 38a9b14

@RealKai42
RealKai42 merged commit 276407d into main Jul 3, 2026
8 checks passed
@RealKai42
RealKai42 deleted the kaiyi/addis-ababa branch July 3, 2026 03:58
@github-actions github-actions Bot mentioned this pull request Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant