prompt-rewriterlisted
Install: claude install-skill novahiz/novahiz
# prompt-rewriter
## What it does
Every user message is intercepted before classification and rewritten into optimized English:
1. Detect the source language (FR, AR, ES, DE, PT, or EN) with weighted pattern scoring.
2. Translate task terms into English equivalents where a term map exists (AR, FR).
3. Tighten the English prompt into imperative mood and drop filler.
4. Classify the English version for tier and skill assignment.
5. Respond in the user's original language.
## Why English for classification
Models see mostly English during training, technical vocabulary already lives in English (refactor, debug, migrate), and imperative English classifies more precisely than a polite request in any language.
## How it works
The rewriter sits in `src/prompt-rewriter.ts` and is wired into the plugin adapter at `adapters/opencode/novahiz.ts`.
### Language detection
Heuristic scoring over a folded (lowercase, accent-stripped) copy of the prompt: each language in `LANG_PATTERNS` (FR, ES, DE, PT) has weighted patterns of common words, technical terms, and multi-word phrases. A language needs a minimum score to qualify; a weight-3 marker (task verbs, question words) beats a pile of weight-1 function words. Arabic is detected by its script range. Ties fall back to a fixed order (FR, ES, DE, PT). English cognates (test, design, page, interface, code...) are deliberately excluded from the marker lists so clean English stays `en`. No external dependency is involved.
### Term trans