# Language Adaptation — Multilingual Output, Triggers & Memory

## Description
Defines how Crow adapts to each user's preferred language. All user-facing output is delivered in the user's language. Skill files remain in English (canonical source) — Claude translates on the fly. Memory content is stored in the user's language with bilingual tags for cross-language searchability.

## When to Activate
- **Every session**: Check for stored language preference at session start
- **First interaction with new user**: Detect language, confirm, and store preference
- User explicitly says "speak to me in...", "háblame en...", "change language to..."
- User switches languages mid-session consistently (2+ messages in a different language)

---

## Language Preference Storage

### Storing the Preference
```
crow_store_memory({
  content: "User language preference: <language>. Locale: <locale-code>. Set on: <date>.",
  category: "preference",
  tags: "language, locale, i18n, idioma",
  importance: 10
})
```

### Detecting the Preference
At session start (integrated with session-summary.md):
1. `crow_recall_by_context("language preference locale i18n")`
2. If found → apply for all session output
3. If not found → detect from user's first message language
4. Confirm with user: "I notice you're writing in [language]. Would you like me to respond in [language]?" (ask in the detected language)
5. On confirmation → store preference

### Updating the Preference
- If the user says "switch to English" / "cambia a español" / equivalent → update the stored memory
- If the user writes 2+ consecutive messages in a different language than stored → ask: "I notice you're using [language]. Want me to switch?" (in the new language)

---

## Output Rules

### User-Facing Text → User's Language
Everything the user reads must be in their preferred language:
- Proposals, reflections, summaries, confirmations, questions
- Error messages and status updates
- Skill descriptions and workflow explanations
- Consent questions for skill-writing

### Technical Identifiers → English
These stay in English regardless of user language (they're system identifiers):
- Tool names: `crow_store_memory`, `crow_recall_by_context`, `crow_search_memories`
- Tag names (the English canonical version): `skill-gap`, `reflection`, `skill-metrics`
- File paths: `skills/reflection.md`, `CLAUDE.md`
- Category names: `general`, `project`, `preference`, `learning`
- Code blocks and API syntax

### Bilingual Structural Markers
When presenting structured workflows (e.g., reflection phases), use bilingual headers:
- "Phase 1: Session Summary / Fase 1: Resumen de Sesión"
- "Step 2: Propose Changes / Paso 2: Proponer Cambios"

This helps users connect the translated output to the canonical English skill documentation if they ever need to reference it.

---

## Memory Storage Rules

### Content
- Store memory content in the **user's preferred language**
- This ensures `crow_search_memories` and `crow_recall_by_context` return results the user can immediately read
- Exception: If storing a direct quote from an English source, store the original with a translated note

### Tags — Bilingual Format
Tags use both the English canonical form and the localized form:
```
tags: "english-tag, localized-tag, english-tag-2, localized-tag-2"
```

**Examples by language:**

| English Tag | Spanish (ES) | French (FR) | Portuguese (PT) |
|---|---|---|---|
| `reflection` | `reflexión` | `réflexion` | `reflexão` |
| `session-summary` | `resumen-de-sesión` | `résumé-de-session` | `resumo-de-sessão` |
| `skill-gap` | `brecha-de-habilidad` | `lacune-de-compétence` | `lacuna-de-habilidade` |
| `skill-friction` | `fricción-de-habilidad` | `friction-de-compétence` | `fricção-de-habilidade` |
| `skill-metrics` | `métricas-de-habilidad` | `métriques-de-compétence` | `métricas-de-habilidade` |
| `skill-watch` | `vigilancia-de-habilidad` | `surveillance-de-compétence` | `vigilância-de-habilidade` |
| `skill-writing-queue` | `cola-de-escritura` | `file-d'écriture` | `fila-de-escrita` |
| `project` | `proyecto` | `projet` | `projeto` |
| `deadline` | `fecha-límite` | `date-limite` | `prazo` |
| `decision` | `decisión` | `décision` | `decisão` |
| `learning` | `aprendizaje` | `apprentissage` | `aprendizado` |

For languages not listed above, generate the localized tag on the fly using Claude's language knowledge.

### Category
- **Always English** — categories are system-level identifiers: `general`, `project`, `preference`, `person`, `process`, `decision`, `learning`, `goal`

### Context Field
- Write in user's preferred language

---

## Trigger Matching Protocol

### How It Works
Claude matches user intent semantically, not via keyword regex. The trigger tables in `superpowers.md` provide examples in English and Spanish, but Claude should match equivalent intent in **any language**.

### Examples Across Languages
| Intent | English | Spanish | French | Portuguese | Japanese |
|---|---|---|---|---|---|
| Create a skill | "make a skill for..." | "crear una habilidad para..." | "créer une compétence pour..." | "criar uma habilidade para..." | "スキルを作って..." |
| Run reflection | "let's reflect" | "reflexionemos" | "réfléchissons" | "vamos refletir" | "振り返りましょう" |
| Remember this | "remember that..." | "recuerda que..." | "retiens que..." | "lembre que..." | "覚えておいて..." |
| Research a topic | "research X" | "investigar X" | "rechercher X" | "pesquisar X" | "Xを調べて" |
| Check calendar | "what's on my calendar" | "qué hay en mi calendario" | "qu'est-ce qu'il y a sur mon calendrier" | "o que tem no meu calendário" | "カレンダーに何がある" |

### Key Principle
**Never fail to activate a skill because the user spoke in a language other than English.** If the intent matches, activate the skill regardless of language.

---

## Skill File Content Translation

### Canonical Source
All skill files (`skills/*.md`) are written and maintained in English. This is the single source of truth.

### On-the-Fly Translation
When the AI needs to reference or explain a skill's workflow to the user:
1. Read the English skill file
2. Translate the relevant portions into the user's preferred language
3. Present with bilingual structural markers (Phase 1 / Fase 1)

### New Skill Creation
When skill-writing creates a new skill file:
- The file is written in English (canonical)
- The "When to Activate" section includes trigger phrases in English + user's preferred language + any other languages the user has used
- The proposal shown to the user is in their preferred language

---

## Supported Languages

### Fully Tested
- **English (en)** — Default, canonical language for all skill files
- **Spanish (es)** — Full trigger phrase coverage, bilingual tag table

### Supported (via Claude's native capabilities)
Claude understands 100+ languages. The system works with any language Claude supports, including but not limited to:
- French (fr), Portuguese (pt), German (de), Italian (it)
- Japanese (ja), Korean (ko), Chinese (zh)
- Arabic (ar), Hindi (hi), Russian (ru)
- Dutch (nl), Polish (pl), Turkish (tr), Swedish (sv)

For languages beyond English and Spanish, localized tags are generated on the fly by Claude rather than looked up from a table.

---

## Integration Points

### With Reflection Skill
- All reflection output in user's language
- Friction catalogs, root cause analyses, and proposals translated
- Skill gap entries stored with bilingual tags
- Phase names bilingual: "Phase 4: Root Cause Analysis / Fase 4: Análisis de Causa Raíz"

### With Skill-Writing Skill
- Proposals presented in user's language
- Consent questions in user's language
- Auto-fix notifications in user's language
- New skill trigger phrases include user's language
- Skill files remain in English

### With Session Context
- Language check is step 1.5 of session start (after context load, before greeting)
- Greeting in user's preferred language

### With Memory Management
- Content in user's language
- Tags bilingual
- Search works in either language

### With crow.md (Cross-Platform Context)
- crow.md is the authoritative source for cross-platform behavioral instructions
- When crow.md contains language-related rules (in the identity or transparency sections), those take precedence for non-Claude platforms
- The `crow_get_context` tool returns crow.md content — present it in English (it's a system document), but user-facing summaries about what crow.md contains should be in user's language

---

## Tips
- **Don't over-translate**: Tool names, file paths, and code stay in English
- **Don't assume**: Always confirm language preference on first detection
- **Be consistent**: Once a language is set, use it for everything user-facing
- **Bilingual tags are cheap**: The extra tag words have negligible storage cost but dramatically improve cross-language search
- **Graceful degradation**: If you're unsure of a translation, use the English term with a parenthetical explanation in the user's language
