afara
by oumarbarry
README.md
# afara
Talk to your coding agent in your own language.
afara ("bridge" in Yoruba) is a small language layer for coding agents. One command downloads a translation model that runs on your laptop, plugs it into Claude Code (and Codex, OpenCode) as an MCP tool, and adds a skill that tells the agent when to use it. You write to the agent in Swahili. It reads a reliable English version, does the work, and answers back in Swahili. Code blocks and inline code are never translated.
Inspired by [semble](https://github.com/MinishLab/semble), which installs a code search model into your agents the same way.
## Install
```bash
uv tool install git+https://github.com/oumarbarry/afara
afara install # downloads NLLB-200 600M (2.46 GB, public, no account), registers the MCP server, writes the skill
afara uninstall # removes everything install added
```
`afara install` detects which agents are on the machine:
| Agent | What it gets |
|---|---|
| Claude Code | MCP server (`claude mcp add -s user`) and skill in `~/.claude/skills/afara/` |
| Codex | MCP server (`codex mcp add`) and skill in `~/.agents/skills/afara/` |
| OpenCode | skill in `~/.agents/skills/afara/`, which calls the `afara` CLI |
## Use
In Claude Code, write in Swahili (or Hausa, Yoruba, isiZulu...), or type `/afara`.
From the shell:
```bash
afara translate "Kwa nini msimbo wangu unashindwa wakati orodha ni tupu?" --from swh_Latn --to eng_Latn
afara compare "Habari ya asubuhi" --from swh_Latn --to eng_Latn # every engine side by side
```
Language codes are FLORES-200 (`swh_Latn`, `hau_Latn`, `yor_Latn`, `zul_Latn`, `eng_Latn`...), the same scheme NLLB and Lelapa's Vulavula API use.
## Engines
| Engine | Runs | Status |
|---|---|---|
| `nllb` (default) | locally, `facebook/nllb-200-distilled-600M` on Apple MPS or CPU | tested |
| `vulavula` | Lelapa's Translate API, key in `VULAVULA_TOKEN` (100 free calls a month; South African languages and Swahili) | written from the docs, not tested yet |
| `inkubalm` | locally, InkubaLM-0.4B GGUF through `llama-server` (`AFARA_LLAMA_URL`, default `http://127.0.0.1:8080`) | experimental, see numbers below |
## Measured
50 sentences per direction from Lelapa's own Zindi dev set, Apple M3 Pro, 01/12/2026. Scripts and raw results in `bench/`.
| Direction | InkubaLM 0.4B Q8_0 (BLEU / chrF) | NLLB-200 600M (BLEU / chrF) |
|---|---|---|
| Hausa to English | 0.49 / 11.2 | 16.4 / 38.2 |
| English to Hausa | 0.39 / 12.3 | 14.7 / 36.4 |
| Swahili to English | 0.38 / 9.6 | 21.6 / 39.6 |
| English to Swahili | 0.14 / 11.8 | 12.6 / 36.9 |
InkubaLM: best of a few-shot and a zero-shot prompt, about 175 tokens/s, but it loops and repeats the prompt. It is a base model, not trained to translate, and this is a third-party GGUF conversion. Its paper reports zero-shot BLEU around 7 to 8 on translation, so the conclusion holds.
NLLB: 0.3 to 0.4 s per sentence. The references in this set are noisy, so the scores likely underestimate it.
Through the MCP server (`demo/mcp_check.py`): first call about 6 s while the model loads, then 0.3 to 0.4 s per sentence. The CLI reloads the model on each run (about 15 s).
## What it gets wrong
Real outputs from testing:
- `Habari ya asubuhi` (good morning) became "Morning news".
- "It fails when the list is empty." became Swahili that means "it works when the list is empty".
- `majaribio` (tests, or experiments) became "experimentation".
That is why the agent always shows both versions, and why better models for these languages matter more than the plumbing.
## Limits
- The code is MIT (see LICENSE). The models are not: NLLB and InkubaLM are CC BY-NC 4.0, so this is a research prototype only.
- Text only. Voice (dictation) is the next step.
- No automatic language detection: the agent picks the code, or asks.
- A line with inline code is translated in pieces around the code, which costs some grammar.
## Tests
```bash
uv run --group dev pytest -q # 13 tests, offline
```
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues