Skip to content

fix: keep distilled sentences in the source language - #74

Merged
hmbanan666 merged 1 commit into
mainfrom
fix/distill-language
Nov 21, 2026
Merged

hmbanan666 merged 1 commit into
mainfrom
fix/distill-language

Conversation

@hmbanan666

Copy link
Copy Markdown
Owner

The distilled fact and the project context journal for 2026-W46 came out in German because the model was never told to keep English, and nothing checked the reply.

The distill prompt only said “a Russian source yields a Russian sentence.” The OpenAI and Codex wrappers only said “Return only JSON.” Codex ignores local user config, but a ChatGPT account language is not local config, so a German account language still applies. The weekly journal does not call a model. It copies the distilled sentences, so the week paragraph was German too. memory:process uses the extractor in src/llm.ts; that prompt also had no language line. src/processor.ts stores whatever the extractor returns.

This change:

  • Distill, journal, and both model wrappers say to write in the language of the source. An English source stays English. A Russian source stays Russian.
  • A journal uses the majority language of the cited items, counted by item. A tie goes to Russian. The journal is still not a model call: a wrong paragraph is rebuilt once from the items already in that language, and otherwise left unwritten.
  • CONTEXT_DISTILL_LANGUAGE (ru, en, de, fr, or es) overrides both. Anything else is ignored. Compose forwards it. Documented in the README env list, docs/llm-providers.md, and the deployment notes.
  • After a reply, a script check (Cyrillic vs Latin) plus a small German/French/Spanish/English stopword list runs. A mismatch is sent back once. If it is still wrong, the source stays pending and is not stored. Stderr gets one line with the expected and detected language and no source text.

pnpm exec vp check --fix passed. pnpm run check passed: lint, typecheck, and 302 tests, including a fake model that returns German for English and Russian input.

A source that already has a distilled sentence is not rewritten. The existing German fact and journal stay until that item is removed and tidy runs again.

Friction

  • The task named fix/distill-language. The cloud agent branch template is cursor/<name>-816a. This PR uses the named branch.
  • vp is not on PATH. pnpm exec vp works.
  • The context MCP server failed tool discovery, so the live 2026-W46 row was not opened. The cause is in the prompts above.
Open in Web Open in Cursor 

The distill prompt only said a Russian source stays Russian, and nothing checked the reply. A German default was stored and copied into the weekly journal. Name the source language, honor CONTEXT_DISTILL_LANGUAGE, and retry a mismatch once before leaving the source pending.

Co-authored-by: Nick Kosarev <nick@kosarev.space>
@hmbanan666
hmbanan666 merged commit 3a8c485 into main Nov 21, 2026
2 checks passed
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.

2 participants