Commit Graph
3 Commits
Author SHA1 Message Date
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
ZacharyZhang-NY 5547c29491 update 2026-04-17 14:03:56 -04:00
ZacharyZhang-NY cf92e0c646 refactor(prompt-builder): locale-dispatch every section for zh/en parity
Split each prompt section into parallel .en.md/.zh.md bundles (sops, api-docs,
ceo-modes, department-guidelines) and mirrored messages/{operating,system}-{en,zh}.ts
modules for the inline identity/culture/rules text that had stayed as hard-coded
English template literals. Every loader now resolves a locale via a single
shared helper so CEO and IC prompts come out fully Chinese when locale=zh and
fully English otherwise, removing the need for the trailing "请记住:全程使用中文"
language reminder.
2026-04-17 00:01:34 -04:00