piper-plus: Command for Claude Code

.claude/commands/add-language.md

add-language is a command for Claude Code from ayutaz/piper-plus. It costs 0 tokens per session (2,774 once invoked), scanned A, original, MIT.

A step-by-step guide for adding a new spoken language to piper-plus, including its pronunciation rules and text-to-speech processing. You provide a language code such as de, it, or da.

In plain words
What is it for?
Use it to add phoneme definitions, pronunciation processing, prosody support, tests, and matching implementations for a new language in piper-plus.
Why use it?
It gives developers a defined path through the many files and language-specific rules involved in supporting a new language. It also helps keep the Python implementation and its copies in other programming languages aligned.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: mentions CLAUDE.md.

This is ayutaz/piper-plus's own configuration. It tells Claude Code how to work on piper-plus itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything piper-plus configures →

Reuse

Borrowing it

Nothing to install: this file belongs to ayutaz/piper-plus. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ayutaz/piper-plus/dev/.claude/commands/add-language.md
Clone the repo
git clone --depth 1 https://github.com/ayutaz/piper-plus

Made for: Claude Code.

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 add-language

README.md
[![agentmods](https://agentmods.dev/badge/commands/ayutaz/piper-plus/add-language/github.svg)](https://agentmods.dev/commands/ayutaz/piper-plus/add-language)
Your own site
<a href="https://agentmods.dev/commands/ayutaz/piper-plus/add-language"><img src="https://agentmods.dev/badge/commands/ayutaz/piper-plus/add-language/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 add-language

Your own site · 80×15
<a href="https://agentmods.dev/commands/ayutaz/piper-plus/add-language"><img src="https://agentmods.dev/badge/commands/ayutaz/piper-plus/add-language.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,774 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.02774
Opus 5.5 $0.00000 $0.01110
Sonnet 5.5 $0.00000 $0.00555
Haiku 4.5 $0.00000 $0.00277

Measured 3d ago against content hash 48889d423550, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

add-language 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 3d 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.

.claude/commands/add-language.md · 232 lines

How it starts

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

新言語追加ガイド

新しい言語を piper-plus に追加するためのガイドです。引数 $ARGUMENTS に言語コード (例: de, it, da) を指定してください。

前提条件

  • Python テストは uv run python -m pytest で実行
  • 各タスク完了ごとにコミット
  • Python が参照実装、他言語は 1:1 ミラー
  • eSpeak-ng 不使用 (MIT ライセンス維持)

Phase 1: Python 音素定義 + G2P エンジン

1.1 音素インベントリ + PUA 割り当て

新規作成: src/python/g2p/piper_plus_g2p/$ARGUMENTS.py

from .base import Phonemizer
# Implement the phonemizer class here. Register it in `registry.py`; the
# shared ID map is maintained in `encode/id_maps.py` and PUA data in
# `encode/pua.py` / `data/pua.json`.

修正: src/python/g2p/piper_plus_g2p/encode/pua.py と data/pua.json

  • FIXED_PUA_MAPPING に PUA エントリ追加
  • 現在の最終固定 PUA: PT = 0xE064 (ɔɪ=0xE062、œ̃=0xE063、ɐ̃=0xE064)、動的割り当て開始 = 0xE065
  • 新言語は 0xE065 以降 に割り当て
  • _PUA_START を新言語の最終 PUA + 3 に更新 (将来拡張用)

衝突チェック:

JA: 0xE000-0xE01C (29), ZH: 0xE020-0xE04A (43), KO: 0xE04B-0xE052 (8)
ES/PT: 0xE054-0xE055 (2), FR: 0xE056-0xE058 (3), SV: 0xE059-0xE061 (9)

1.2 G2P エンジン作成

新規作成: src/python/g2p/piper_plus_g2p/$ARGUMENTS.py

必須クラス:

class [Lang]Phonemizer(Phonemizer):
    def phonemize(self, text: str) -> list[str]: ...
    def phonemize_with_prosody(self, text: str) -> tuple[list[str], list[ProsodyInfo | None]]: ...
    def get_phoneme_id_map(self) -> dict[str, list[int]] | None:
        return None  # multilingual id_map を使用

G2P パイプライン (言語に応じて調整):

  1. テキスト正規化 (NFC + lowercase)
  2. トークン化 (単語/句読点分離)
  3. 辞書ルックアップ (オプション)
  4. 借用語ルール (接尾辞検出)
  5. ネイティブ音素変換 (子音 + 母音)
  6. 後処理 (同化、ストレスマーカー)

Prosody: a1=0, a2=stress(0/1/2), a3=word_phoneme_count

1.3 レジストリ + 多言語統合

修正: src/python/g2p/piper_plus_g2p/registry.py

try:
    from .$ARGUMENTS import [Lang]Phonemizer
    register_language("$ARGUMENTS", [Lang]Phonemizer())
except ImportError:
    pass
  • ラテン文字言語なら latin_langs にも追加

修正: src/python/g2p/piper_plus_g2p/encode/id_maps.py

# Add the language inventory to the shared map and update
# `get_phoneme_id_map()` in encode/id_maps.py.

Read the full file on GitHub · 232 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. 3d ago Changed · -1 lines 48889d423550
  2. 14d ago Changed · -6 lines 142f48747478
  3. 2mo ago First seen · 239 lines · 0 tokens per session scan A 75485312e402

Subscribe to this mod's changes

add-language is a command published in the GitHub repository ayutaz/piper-plus (239 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,774 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.