Agent Skillssbusso/claudeclaw › use-local-whisper

use-local-whisper

GitHub

将语音转录从 OpenAI API 切换至本地 whisper.cpp,实现离线、零成本转录。适用于 macOS Apple Silicon 环境下的 WhatsApp 频道,需预装依赖并配置模型。

skills/use-local-whisper/SKILL.md sbusso/claudeclaw

Trigger Scenarios

用户希望使用本地语音转录而非 OpenAI API 需要在无网络环境下进行语音转文字

Install

npx skills add sbusso/claudeclaw --skill use-local-whisper -g -y
More Options

Use without installing

npx skills use sbusso/claudeclaw@use-local-whisper

指定 Agent (Claude Code)

npx skills add sbusso/claudeclaw --skill use-local-whisper -a claude-code -g -y

安装 repo 全部 skill

npx skills add sbusso/claudeclaw --all -g -y

预览 repo 内 skill

npx skills add sbusso/claudeclaw --list

SKILL.md

Frontmatter
{
    "name": "use-local-whisper",
    "description": "Use when the user wants local voice transcription instead of OpenAI Whisper API. Switches to whisper.cpp running on Apple Silicon. WhatsApp only for now. Requires voice-transcription skill to be applied first."
}

Use Local Whisper

Switches voice transcription from OpenAI's Whisper API to local whisper.cpp. Runs entirely on-device — no API key, no network, no cost.

Channel support: Currently WhatsApp only. The transcription module (src/transcription.ts) uses Baileys types for audio download. Other channels (Telegram, Discord, etc.) would need their own audio-download logic before this skill can serve them.

Note: The Homebrew package is whisper-cpp, but the CLI binary it installs is whisper-cli.

Prerequisites

  • voice-transcription skill must be applied first (WhatsApp channel)
  • macOS with Apple Silicon (M1+) recommended
  • whisper-cpp installed: brew install whisper-cpp (provides the whisper-cli binary)
  • ffmpeg installed: brew install ffmpeg
  • A GGML model file downloaded to data/models/

Phase 1: Pre-flight

Check if already applied

Check if src/transcription.ts already uses whisper-cli:

grep 'whisper-cli' src/transcription.ts && echo "Already applied" || echo "Not applied"

If already applied, skip to Phase 3 (Verify).

Check dependencies are installed

whisper-cli --help >/dev/null 2>&1 && echo "WHISPER_OK" || echo "WHISPER_MISSING"
ffmpeg -version >/dev/null 2>&1 && echo "FFMPEG_OK" || echo "FFMPEG_MISSING"

If missing, install via Homebrew:

brew install whisper-cpp ffmpeg

Check for model file

ls data/models/ggml-*.bin 2>/dev/null || echo "NO_MODEL"

If no model exists, download the base model (148MB, good balance of speed and accuracy):

mkdir -p data/models
curl -L -o data/models/ggml-base.bin "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.bin"

For better accuracy at the cost of speed, use ggml-small.bin (466MB) or ggml-medium.bin (1.5GB).

Phase 2: Apply Code Changes

Ensure WhatsApp fork remote

git remote -v

If whatsapp is missing, add it:

git remote add whatsapp https://github.com/qwibitai/claudeclaw-whatsapp.git

Merge the skill branch

git fetch whatsapp skill/local-whisper
git merge whatsapp/skill/local-whisper || {
  git checkout --theirs package-lock.json
  git add package-lock.json
  git merge --continue
}

This modifies src/transcription.ts to use the whisper-cli binary instead of the OpenAI API.

Validate

npm run build

Phase 3: Verify

Ensure launchd PATH includes Homebrew

The ClaudeClaw launchd service runs with a restricted PATH. whisper-cli and ffmpeg are in /opt/homebrew/bin/ (Apple Silicon) or /usr/local/bin/ (Intel), which may not be in the plist's PATH.

Service name: Derived from the directory name: com.claudeclaw.<dirname> (macOS) / claudeclaw-<dirname> (Linux). For example, if cwd is my-assistant, the service is com.claudeclaw.my-assistant. Determine the correct service name before running service commands below.

Check the current PATH:

grep -A1 'PATH' ~/Library/LaunchAgents/com.claudeclaw.plist

If /opt/homebrew/bin is missing, add it to the <string> value inside the PATH key in the plist. Then reload:

launchctl unload ~/Library/LaunchAgents/com.claudeclaw.plist
launchctl load ~/Library/LaunchAgents/com.claudeclaw.plist

Build and restart

npm run build
launchctl kickstart -k gui/$(id -u)/com.claudeclaw

Test

Send a voice note in any registered group. The agent should receive it as [Voice: <transcript>].

Check logs

tail -f logs/claudeclaw.log | grep -i -E "voice|transcri|whisper"

Look for:

  • Transcribed voice message — successful transcription
  • whisper.cpp transcription failed — check model path, ffmpeg, or PATH

Configuration

Environment variables (optional, set in .env):

Variable Default Description
WHISPER_BIN whisper-cli Path to whisper.cpp binary
WHISPER_MODEL data/models/ggml-base.bin Path to GGML model file

Troubleshooting

"whisper.cpp transcription failed": Ensure both whisper-cli and ffmpeg are in PATH. The launchd service uses a restricted PATH — see Phase 3 above. Test manually:

ffmpeg -f lavfi -i anullsrc=r=16000:cl=mono -t 1 -f wav /tmp/test.wav -y
whisper-cli -m data/models/ggml-base.bin -f /tmp/test.wav --no-timestamps -nt

Transcription works in dev but not as service: The launchd plist PATH likely doesn't include /opt/homebrew/bin. See "Ensure launchd PATH includes Homebrew" in Phase 3.

Slow transcription: The base model processes ~30s of audio in <1s on M1+. If slower, check CPU usage — another process may be competing.

Wrong language: whisper.cpp auto-detects language. To force a language, you can set WHISPER_LANG and modify src/transcription.ts to pass -l $WHISPER_LANG.

Version History

  • 1395af4 Current 2026-07-25 07:03

Same Skill Collection

agent/skills/agent-browser/SKILL.md
skills/add-compact/SKILL.md
skills/add-discord/SKILL.md
skills/add-gmail/SKILL.md
skills/add-image-vision/SKILL.md
skills/add-ollama-tool/SKILL.md
skills/add-pdf-reader/SKILL.md
skills/add-qmd/SKILL.md
skills/add-reactions/SKILL.md
skills/add-telegram-swarm/SKILL.md
skills/add-telegram/SKILL.md
skills/add-voice-transcription/SKILL.md
skills/add-whatsapp/SKILL.md
skills/convert-to-apple-container/SKILL.md
skills/customize/SKILL.md
skills/debug/SKILL.md
skills/get-qodo-rules/SKILL.md
skills/install-extension/SKILL.md
skills/qodo-pr-resolver/SKILL.md
skills/setup/SKILL.md
skills/uninstall/SKILL.md
skills/update-claudeclaw/SKILL.md
skills/update-skills/SKILL.md
skills/x-integration/SKILL.md
skills/uninstall-extension/SKILL.md

Metadata

Files
0
Version
1395af4
Hash
cebfd528
Indexed
2026-07-25 07:03

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 07:32
浙ICP备14020137号-1 $mapa de visitantes$