language-injection-conventions

language-injection-conventions is a cursor rule for Cursor from microsoft/data-formulator. It costs 0 tokens per session (537 once invoked), scanned A, original, MIT.

A set of rules for choosing a user's language in prompts sent to a language model and in fixed messages shown by a Python application. It defines where language instructions belong and how new languages are added.

In plain words
What is it for?
Use it when building multilingual AI agents, code-generation endpoints, API routes, or Python-generated UI messages.
Why use it?
It prevents inconsistent translations, duplicate instructions, and accidental language changes in internal calls that users never see.

Cursor rule for Cursor ✓ vendor

Written for Cursor: installed under .cursor/.

Good fit Use it when building multilingual AI agents, code-generation endpoints, API routes, or Python-generated UI messages.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/microsoft/data-formulator/language-injection-conventions
About the project

Data Formulator is an interactive workspace where AI agents connect to data sources, answer questions, and create visualizations. It is used to explore and analyze data while branching into related questions without losing the context of each investigative path.

microsoft/data-formulator · 17,610 stars · on GitHub · data-formulator.ai

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/microsoft/data-formulator

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for language-injection-conventions

README.md
[![agentmods](https://agentmods.dev/badge/rules/microsoft/data-formulator/language-injection-conventions/github.svg)](https://agentmods.dev/rules/microsoft/data-formulator/language-injection-conventions)
Your own site
<a href="https://agentmods.dev/rules/microsoft/data-formulator/language-injection-conventions"><img src="https://agentmods.dev/badge/rules/microsoft/data-formulator/language-injection-conventions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for language-injection-conventions

Your own site · 80×15
<a href="https://agentmods.dev/rules/microsoft/data-formulator/language-injection-conventions"><img src="https://agentmods.dev/badge/rules/microsoft/data-formulator/language-injection-conventions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 537 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00537
Opus 5.5 $0.00000 $0.00215
Sonnet 5.5 $0.00000 $0.00107
Haiku 4.5 $0.00000 $0.00054

Measured 1mo ago against content hash 11e79d25ce18, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

language-injection-conventions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/language-injection-conventions.mdc · 44 lines

How it starts

The opening of the file, as written. The whole thing — 44 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Language Injection Conventions

Language flows per-request: Frontend i18n → Accept-Language header → get_language_instruction() → system prompt.

LLM Prompt Language Injection

  1. User-facing LLM output MUST inject language via get_language_instruction(mode=...) in the route handler.
  2. Mode selection: "full" for text-heavy agents, "compact" for code-generation agents and short-text endpoints.
  3. Inject into system prompt only — use inject_language_instruction() from agent_language.py. Never inject into user messages.
  4. Do NOT inject for non-user-facing calls (health checks, internal tool calls).
  5. Do NOT duplicate — if upstream messages already contain language instruction, skip.
  6. Do NOT use env vars, global interceptors, or hardcoded language strings (e.g. "回答请使用中文") — route handlers should use get_language_instruction(mode=...).
  7. New language? Add to LANGUAGE_DISPLAY_NAMES in agents/agent_language.py and add locale files in src/i18n/locales/<lang>/.

Python-Side User-Visible Messages (message_code pattern)

For fixed strings in Python that are shown in the UI (error messages, clarify options, completion summaries), do NOT translate in Python. Instead:

  1. Keep the English string as the default value.
  2. Add a message_code (or content_code, error_code, summary_code) field with a key like "agent.someKey".
  3. Optionally add message_params for interpolation.
  4. The frontend translates using translateBackend(fallback, code, params) from src/app/utils.tsx.
  5. Add the translation key to src/i18n/locales/{en,zh}/messages.json under the agent section.
# ✅ GOOD — backend returns code, frontend translates
yield {
    "type": "error",
    "message": "Output DataFrame is empty (0 rows).",
    "message_code": "agent.emptyDataframe",
}

# ❌ BAD — backend-side translation dict
yield {"message": translate_in_python("empty_df", lang)}

For detailed architecture and anti-pattern explanations, see docs/dev-guides/6-i18n-language-injection.md.

Read the full file on GitHub · 44 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 44 lines · 0 tokens per session scan A 11e79d25ce18

Subscribe to this mod's changes

language-injection-conventions is a cursor rule published in the GitHub repository microsoft/data-formulator (17,610 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 537 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.