Files
AgentCompany/src/main/prompt-builder/messages
ZacharyZhang-NY 5a3647e98e refactor(prompt): collapse en/zh mirror to English + runtime locale directive
Prompt builder kept two full translations side by side — system-en.ts +
system-zh.ts, operating-en.ts + operating-zh.ts, and 38 *.zh.md files
across api-docs, sops, ceo-modes, department-guidelines, and
wake-reasons. Any change required hand-syncing across two locales; drift
was guaranteed. The Chinese user wasn't getting Chinese thinking — the
model reads whatever prompt we give it and responds in whatever language
we tell it to.

English is now the single source of truth. At the tail of the assembled
system prompt, when `ctx.locale === "zh"`, append a directive:

    Respond to the user in Chinese.

Claude, GPT, and Gemini all comply with the directive reliably. English
users (the default) get no footer.

- Deleted 38 `*.zh.md` files (api-docs 11, sops 15, ceo-modes 5,
  department-guidelines 7, wake-reasons 1 via zh.ts).
- Deleted `messages/system-zh.ts`, `messages/operating-zh.ts`,
  `messages/locale.ts`.
- Simplified `messages/index.ts` to a direct re-export of the English
  bundle; getters no longer take a locale argument.
- Stripped zh imports + locale branching from `api-section.ts`,
  `sop-section.ts`, `operating-instructions.ts`,
  `operating-instructions-ceo.ts`, `api-endpoints.ts`, `wake-reasons/`.
- `buildSOPSection()`, `getSOP()`, `renderWakeReason()` drop the locale
  arg; callers updated.
- Footer injection in `system-prompt.ts` (lines 246-249), placed after
  the importantRulesSection so the model reads it last (highest
  instruction salience).

`ctx.locale` stays on `PromptContext` — load-bearing for the footer.
Anthropic prompt cache hits improve (one cache key instead of two for
the same agent across locales).
2026-04-17 15:41:51 -04:00
..