agentvibes 5.1.4 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/.agentvibes/config.json +23 -13
  2. package/.claude/commands/agent-vibes/verbosity.md +98 -89
  3. package/.claude/config/audio-effects.cfg +4 -1
  4. package/.claude/hooks/audio-cache-utils.sh +246 -246
  5. package/.claude/hooks/background-music-manager.sh +404 -404
  6. package/.claude/hooks/bmad-speak-enhanced.sh +165 -165
  7. package/.claude/hooks/bmad-speak.sh +290 -290
  8. package/.claude/hooks/bmad-tts-injector.sh +568 -568
  9. package/.claude/hooks/bmad-voice-manager.sh +928 -928
  10. package/.claude/hooks/clawdbot-receiver-SECURE.sh +129 -129
  11. package/.claude/hooks/clawdbot-receiver.sh +107 -107
  12. package/.claude/hooks/clean-audio-cache.sh +22 -22
  13. package/.claude/hooks/cleanup-cache.sh +106 -106
  14. package/.claude/hooks/configure-rdp-mode.sh +137 -137
  15. package/.claude/hooks/download-extra-voices.sh +244 -244
  16. package/.claude/hooks/effects-manager.sh +268 -268
  17. package/.claude/hooks/github-star-reminder.sh +154 -154
  18. package/.claude/hooks/language-manager.sh +362 -362
  19. package/.claude/hooks/learn-manager.sh +492 -492
  20. package/.claude/hooks/macos-voice-manager.sh +205 -205
  21. package/.claude/hooks/migrate-background-music.sh +125 -125
  22. package/.claude/hooks/migrate-to-agentvibes.sh +161 -161
  23. package/.claude/hooks/optimize-background-music.sh +87 -87
  24. package/.claude/hooks/path-resolver.sh +60 -60
  25. package/.claude/hooks/personality-manager.sh +448 -448
  26. package/.claude/hooks/piper-download-voices.sh +233 -225
  27. package/.claude/hooks/piper-installer.sh +292 -292
  28. package/.claude/hooks/piper-multispeaker-registry.sh +171 -171
  29. package/.claude/hooks/piper-voice-manager.sh +125 -0
  30. package/.claude/hooks/play-tts-agentvibes-receiver-for-voiceless-connections.sh +97 -90
  31. package/.claude/hooks/play-tts-enhanced.sh +105 -105
  32. package/.claude/hooks/play-tts-piper.sh +16 -5
  33. package/.claude/hooks/play-tts-ssh-remote.sh +168 -167
  34. package/.claude/hooks/play-tts-termux-ssh.sh +169 -169
  35. package/.claude/hooks/play-tts.sh +35 -14
  36. package/.claude/hooks/prepare-release.sh +54 -54
  37. package/.claude/hooks/provider-commands.sh +617 -617
  38. package/.claude/hooks/provider-manager.sh +399 -399
  39. package/.claude/hooks/replay-target-audio.sh +95 -95
  40. package/.claude/hooks/sentiment-manager.sh +201 -201
  41. package/.claude/hooks/session-start-tts.sh +4 -1
  42. package/.claude/hooks/speed-manager.sh +291 -291
  43. package/.claude/hooks/stop-tts.sh +84 -84
  44. package/.claude/hooks/termux-installer.sh +261 -261
  45. package/.claude/hooks/translate-manager.sh +341 -341
  46. package/.claude/hooks/tts-queue-worker.sh +145 -145
  47. package/.claude/hooks/tts-queue.sh +165 -165
  48. package/.claude/hooks/verbosity-manager.sh +185 -178
  49. package/.claude/hooks/voice-manager.sh +552 -548
  50. package/.claude/hooks-windows/download-extra-voices.ps1 +243 -185
  51. package/.claude/hooks-windows/play-tts-piper.ps1 +7 -2
  52. package/.claude/hooks-windows/play-tts.ps1 +9 -3
  53. package/.claude/hooks-windows/session-start-tts.ps1 +2 -1
  54. package/.claude/hooks-windows/verbosity-manager.ps1 +126 -119
  55. package/README.md +19 -2
  56. package/RELEASE_NOTES.md +74 -0
  57. package/bin/agentvibes-voice-browser.js +1939 -1840
  58. package/bin/mcp-server.sh +206 -206
  59. package/mcp-server/server.py +87 -15
  60. package/package.json +1 -1
  61. package/src/console/tabs/receiver-tab.js +1527 -1483
  62. package/src/console/tabs/settings-tab.js +2 -2
  63. package/src/console/tabs/setup-tab.js +112 -31
  64. package/src/console/tabs/voices-tab.js +130 -13
  65. package/src/i18n/en.js +202 -202
  66. package/src/installer.js +79 -213
  67. package/src/services/llm-provider-service.js +126 -75
  68. package/src/services/verbosity-service.js +159 -157
  69. package/templates/agentvibes-receiver.sh +3 -2
package/bin/mcp-server.sh CHANGED
@@ -1,206 +1,206 @@
1
- #!/usr/bin/env bash
2
- #
3
- # AgentVibes MCP Server Wrapper with Auto-Install
4
- #
5
- # This script is called by Claude Desktop via npx:
6
- # npx -y agentvibes mcp-server
7
- #
8
- # It auto-installs dependencies when possible and provides helpful errors when not.
9
- #
10
-
11
- set -e
12
-
13
- # Find the directory where this script lives
14
- SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
15
-
16
- # Package root is one level up from bin/
17
- PACKAGE_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"
18
-
19
- # Path to the Python MCP server
20
- MCP_SERVER="$PACKAGE_ROOT/mcp-server/server.py"
21
-
22
- # Detect OS for platform-specific instructions
23
- OS="$(uname -s)"
24
-
25
- # Ensure the server file exists
26
- if [ ! -f "$MCP_SERVER" ]; then
27
- echo "❌ Error: MCP server not found at $MCP_SERVER" >&2
28
- exit 1
29
- fi
30
-
31
- # Function to print section headers
32
- print_section() {
33
- echo "" >&2
34
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" >&2
35
- echo "$1" >&2
36
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" >&2
37
- }
38
-
39
- # Check Python
40
- if ! command -v python3 &> /dev/null; then
41
- print_section "❌ Python 3 Not Found"
42
- echo "AgentVibes MCP server requires Python 3.10 or newer." >&2
43
- echo "" >&2
44
- echo "📖 Install Python:" >&2
45
-
46
- case "$OS" in
47
- Linux*)
48
- echo " sudo apt install python3 # Ubuntu/Debian" >&2
49
- echo " sudo yum install python3 # RedHat/CentOS" >&2
50
- ;;
51
- Darwin*)
52
- echo " brew install python3 # macOS (requires Homebrew)" >&2
53
- echo " Or download from: https://python.org" >&2
54
- ;;
55
- *)
56
- echo " Download from: https://python.org" >&2
57
- ;;
58
- esac
59
-
60
- echo "" >&2
61
- echo "💡 After installing Python, restart Claude Desktop" >&2
62
- echo "" >&2
63
- exit 1
64
- fi
65
-
66
- # Check Python version
67
- PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
68
- echo "🐍 Python $PYTHON_VERSION detected" >&2
69
-
70
- # Auto-install Python mcp package
71
- if ! python3 -c "import mcp" 2>/dev/null; then
72
- print_section "📦 Installing Python MCP Package"
73
- echo "Installing 'mcp' package to enable Claude Desktop integration..." >&2
74
-
75
- if python3 -m pip install --user mcp --quiet 2>&1; then
76
- echo "✅ Python MCP package installed successfully!" >&2
77
- else
78
- echo "❌ Failed to auto-install MCP package" >&2
79
- echo "" >&2
80
- echo "💡 Try manually:" >&2
81
- echo " python3 -m pip install --user mcp" >&2
82
- echo "" >&2
83
- exit 1
84
- fi
85
- else
86
- echo "✅ Python MCP package already installed" >&2
87
- fi
88
-
89
- # Check provider (Piper vs ElevenLabs)
90
- PROVIDER_FILE="$PACKAGE_ROOT/.claude/tts-provider.txt"
91
- PROVIDER="elevenlabs" # Default
92
-
93
- if [ -f "$PROVIDER_FILE" ]; then
94
- PROVIDER=$(cat "$PROVIDER_FILE" | tr -d '[:space:]')
95
- fi
96
-
97
- # If using Piper, ensure it's installed
98
- if [ "$PROVIDER" = "piper" ]; then
99
- if ! command -v piper &> /dev/null; then
100
- # Piper not found, try to auto-install
101
-
102
- # First check if pipx is available
103
- if ! command -v pipx &> /dev/null; then
104
- print_section "📦 Installing pipx"
105
- echo "pipx is needed to install Piper TTS..." >&2
106
-
107
- if python3 -m pip install --user pipx --quiet 2>&1; then
108
- # Add pipx to PATH for this session
109
- export PATH="$HOME/.local/bin:$PATH"
110
-
111
- # Ensure pipx is set up
112
- python3 -m pipx ensurepath >/dev/null 2>&1 || true
113
-
114
- echo "✅ pipx installed successfully!" >&2
115
- else
116
- echo "⚠️ Could not auto-install pipx" >&2
117
- echo "" >&2
118
- echo "📖 Install pipx manually:" >&2
119
- case "$OS" in
120
- Linux*)
121
- echo " sudo apt install pipx # Ubuntu/Debian" >&2
122
- ;;
123
- Darwin*)
124
- echo " brew install pipx # macOS" >&2
125
- ;;
126
- *)
127
- echo " python3 -m pip install --user pipx" >&2
128
- ;;
129
- esac
130
- echo "" >&2
131
- echo "⚠️ Continuing without Piper (TTS will not work)" >&2
132
- fi
133
- fi
134
-
135
- # Now try to install Piper with pipx
136
- if command -v pipx &> /dev/null; then
137
- print_section "📦 Installing Piper TTS"
138
- echo "Installing Piper TTS (free, offline voice synthesis)..." >&2
139
-
140
- if pipx install piper-tts --quiet 2>&1; then
141
- echo "✅ Piper TTS installed successfully!" >&2
142
-
143
- # Add pipx bin to PATH
144
- export PATH="$HOME/.local/bin:$PATH"
145
- else
146
- echo "⚠️ Could not auto-install Piper TTS" >&2
147
- echo "" >&2
148
- echo "💡 Try manually:" >&2
149
- echo " pipx install piper-tts" >&2
150
- echo "" >&2
151
- echo "⚠️ Continuing without Piper (TTS will not work)" >&2
152
- fi
153
- fi
154
- else
155
- echo "✅ Piper TTS already installed" >&2
156
- fi
157
-
158
- # Auto-download default voice if needed
159
- if command -v piper &> /dev/null; then
160
- # Source the voice manager for download functions
161
- if [ -f "$PACKAGE_ROOT/.claude/hooks/piper-voice-manager.sh" ]; then
162
- source "$PACKAGE_ROOT/.claude/hooks/piper-voice-manager.sh"
163
-
164
- # Default voice for Piper
165
- DEFAULT_VOICE="en_US-lessac-medium"
166
-
167
- # Check if default voice is downloaded
168
- if ! verify_voice "$DEFAULT_VOICE" 2>/dev/null; then
169
- print_section "📥 Downloading Default Voice"
170
- echo "Downloading voice model: $DEFAULT_VOICE (~25MB)..." >&2
171
- echo "Source: HuggingFace (rhasspy/piper-voices)" >&2
172
-
173
- if download_voice "$DEFAULT_VOICE" 2>&1 | grep -v "^📥" | grep -v "Source:" | grep -v "Size:" >&2; then
174
- echo "✅ Default voice downloaded successfully!" >&2
175
- else
176
- echo "⚠️ Could not download default voice" >&2
177
- echo " Voice will download on first TTS request" >&2
178
- fi
179
- else
180
- echo "✅ Default Piper voice ready" >&2
181
- fi
182
- fi
183
- fi
184
- elif [ "$PROVIDER" = "elevenlabs" ]; then
185
- # Check for ElevenLabs API key
186
- if [ -z "$ELEVENLABS_API_KEY" ]; then
187
- echo "⚠️ ElevenLabs selected but ELEVENLABS_API_KEY not set" >&2
188
- echo "" >&2
189
- echo "📖 Set your API key:" >&2
190
- echo " export ELEVENLABS_API_KEY='your-key-here'" >&2
191
- echo "" >&2
192
- echo "💡 Or switch to Piper TTS (free):" >&2
193
- echo " echo 'piper' > $PACKAGE_ROOT/.claude/tts-provider.txt" >&2
194
- echo "" >&2
195
- else
196
- echo "✅ ElevenLabs API key configured" >&2
197
- fi
198
- fi
199
-
200
- # All checks passed, run the MCP server
201
- echo "" >&2
202
- echo "🚀 Starting AgentVibes MCP Server..." >&2
203
- echo "" >&2
204
-
205
- # Run the Python MCP server
206
- exec python3 "$MCP_SERVER"
1
+ #!/usr/bin/env bash
2
+ #
3
+ # AgentVibes MCP Server Wrapper with Auto-Install
4
+ #
5
+ # This script is called by Claude Desktop via npx:
6
+ # npx -y agentvibes mcp-server
7
+ #
8
+ # It auto-installs dependencies when possible and provides helpful errors when not.
9
+ #
10
+
11
+ set -e
12
+
13
+ # Find the directory where this script lives
14
+ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
15
+
16
+ # Package root is one level up from bin/
17
+ PACKAGE_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"
18
+
19
+ # Path to the Python MCP server
20
+ MCP_SERVER="$PACKAGE_ROOT/mcp-server/server.py"
21
+
22
+ # Detect OS for platform-specific instructions
23
+ OS="$(uname -s)"
24
+
25
+ # Ensure the server file exists
26
+ if [ ! -f "$MCP_SERVER" ]; then
27
+ echo "❌ Error: MCP server not found at $MCP_SERVER" >&2
28
+ exit 1
29
+ fi
30
+
31
+ # Function to print section headers
32
+ print_section() {
33
+ echo "" >&2
34
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" >&2
35
+ echo "$1" >&2
36
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" >&2
37
+ }
38
+
39
+ # Check Python
40
+ if ! command -v python3 &> /dev/null; then
41
+ print_section "❌ Python 3 Not Found"
42
+ echo "AgentVibes MCP server requires Python 3.10 or newer." >&2
43
+ echo "" >&2
44
+ echo "📖 Install Python:" >&2
45
+
46
+ case "$OS" in
47
+ Linux*)
48
+ echo " sudo apt install python3 # Ubuntu/Debian" >&2
49
+ echo " sudo yum install python3 # RedHat/CentOS" >&2
50
+ ;;
51
+ Darwin*)
52
+ echo " brew install python3 # macOS (requires Homebrew)" >&2
53
+ echo " Or download from: https://python.org" >&2
54
+ ;;
55
+ *)
56
+ echo " Download from: https://python.org" >&2
57
+ ;;
58
+ esac
59
+
60
+ echo "" >&2
61
+ echo "💡 After installing Python, restart Claude Desktop" >&2
62
+ echo "" >&2
63
+ exit 1
64
+ fi
65
+
66
+ # Check Python version
67
+ PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
68
+ echo "🐍 Python $PYTHON_VERSION detected" >&2
69
+
70
+ # Auto-install Python mcp package
71
+ if ! python3 -c "import mcp" 2>/dev/null; then
72
+ print_section "📦 Installing Python MCP Package"
73
+ echo "Installing 'mcp' package to enable Claude Desktop integration..." >&2
74
+
75
+ if python3 -m pip install --user mcp --quiet 2>&1; then
76
+ echo "✅ Python MCP package installed successfully!" >&2
77
+ else
78
+ echo "❌ Failed to auto-install MCP package" >&2
79
+ echo "" >&2
80
+ echo "💡 Try manually:" >&2
81
+ echo " python3 -m pip install --user mcp" >&2
82
+ echo "" >&2
83
+ exit 1
84
+ fi
85
+ else
86
+ echo "✅ Python MCP package already installed" >&2
87
+ fi
88
+
89
+ # Check provider (Piper vs ElevenLabs)
90
+ PROVIDER_FILE="$PACKAGE_ROOT/.claude/tts-provider.txt"
91
+ PROVIDER="elevenlabs" # Default
92
+
93
+ if [ -f "$PROVIDER_FILE" ]; then
94
+ PROVIDER=$(cat "$PROVIDER_FILE" | tr -d '[:space:]')
95
+ fi
96
+
97
+ # If using Piper, ensure it's installed
98
+ if [ "$PROVIDER" = "piper" ]; then
99
+ if ! command -v piper &> /dev/null; then
100
+ # Piper not found, try to auto-install
101
+
102
+ # First check if pipx is available
103
+ if ! command -v pipx &> /dev/null; then
104
+ print_section "📦 Installing pipx"
105
+ echo "pipx is needed to install Piper TTS..." >&2
106
+
107
+ if python3 -m pip install --user pipx --quiet 2>&1; then
108
+ # Add pipx to PATH for this session
109
+ export PATH="$HOME/.local/bin:$PATH"
110
+
111
+ # Ensure pipx is set up
112
+ python3 -m pipx ensurepath >/dev/null 2>&1 || true
113
+
114
+ echo "✅ pipx installed successfully!" >&2
115
+ else
116
+ echo "⚠️ Could not auto-install pipx" >&2
117
+ echo "" >&2
118
+ echo "📖 Install pipx manually:" >&2
119
+ case "$OS" in
120
+ Linux*)
121
+ echo " sudo apt install pipx # Ubuntu/Debian" >&2
122
+ ;;
123
+ Darwin*)
124
+ echo " brew install pipx # macOS" >&2
125
+ ;;
126
+ *)
127
+ echo " python3 -m pip install --user pipx" >&2
128
+ ;;
129
+ esac
130
+ echo "" >&2
131
+ echo "⚠️ Continuing without Piper (TTS will not work)" >&2
132
+ fi
133
+ fi
134
+
135
+ # Now try to install Piper with pipx
136
+ if command -v pipx &> /dev/null; then
137
+ print_section "📦 Installing Piper TTS"
138
+ echo "Installing Piper TTS (free, offline voice synthesis)..." >&2
139
+
140
+ if pipx install piper-tts --quiet 2>&1; then
141
+ echo "✅ Piper TTS installed successfully!" >&2
142
+
143
+ # Add pipx bin to PATH
144
+ export PATH="$HOME/.local/bin:$PATH"
145
+ else
146
+ echo "⚠️ Could not auto-install Piper TTS" >&2
147
+ echo "" >&2
148
+ echo "💡 Try manually:" >&2
149
+ echo " pipx install piper-tts" >&2
150
+ echo "" >&2
151
+ echo "⚠️ Continuing without Piper (TTS will not work)" >&2
152
+ fi
153
+ fi
154
+ else
155
+ echo "✅ Piper TTS already installed" >&2
156
+ fi
157
+
158
+ # Auto-download default voice if needed
159
+ if command -v piper &> /dev/null; then
160
+ # Source the voice manager for download functions
161
+ if [ -f "$PACKAGE_ROOT/.claude/hooks/piper-voice-manager.sh" ]; then
162
+ source "$PACKAGE_ROOT/.claude/hooks/piper-voice-manager.sh"
163
+
164
+ # Default voice for Piper
165
+ DEFAULT_VOICE="en_US-lessac-medium"
166
+
167
+ # Check if default voice is downloaded
168
+ if ! verify_voice "$DEFAULT_VOICE" 2>/dev/null; then
169
+ print_section "📥 Downloading Default Voice"
170
+ echo "Downloading voice model: $DEFAULT_VOICE (~25MB)..." >&2
171
+ echo "Source: HuggingFace (rhasspy/piper-voices)" >&2
172
+
173
+ if download_voice "$DEFAULT_VOICE" 2>&1 | grep -v "^📥" | grep -v "Source:" | grep -v "Size:" >&2; then
174
+ echo "✅ Default voice downloaded successfully!" >&2
175
+ else
176
+ echo "⚠️ Could not download default voice" >&2
177
+ echo " Voice will download on first TTS request" >&2
178
+ fi
179
+ else
180
+ echo "✅ Default Piper voice ready" >&2
181
+ fi
182
+ fi
183
+ fi
184
+ elif [ "$PROVIDER" = "elevenlabs" ]; then
185
+ # Check for ElevenLabs API key
186
+ if [ -z "$ELEVENLABS_API_KEY" ]; then
187
+ echo "⚠️ ElevenLabs selected but ELEVENLABS_API_KEY not set" >&2
188
+ echo "" >&2
189
+ echo "📖 Set your API key:" >&2
190
+ echo " export ELEVENLABS_API_KEY='your-key-here'" >&2
191
+ echo "" >&2
192
+ echo "💡 Or switch to Piper TTS (free):" >&2
193
+ echo " echo 'piper' > $PACKAGE_ROOT/.claude/tts-provider.txt" >&2
194
+ echo "" >&2
195
+ else
196
+ echo "✅ ElevenLabs API key configured" >&2
197
+ fi
198
+ fi
199
+
200
+ # All checks passed, run the MCP server
201
+ echo "" >&2
202
+ echo "🚀 Starting AgentVibes MCP Server..." >&2
203
+ echo "" >&2
204
+
205
+ # Run the Python MCP server
206
+ exec python3 "$MCP_SERVER"
@@ -148,7 +148,7 @@ class AgentVibesServer:
148
148
  break
149
149
 
150
150
  # SECURITY: Validate resolved ID matches safe pattern
151
- if resolved_id and re.match(r'^[a-zA-Z0-9_-]+$', resolved_id):
151
+ if resolved_id and re.match(r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$', resolved_id):
152
152
  return resolved_id
153
153
 
154
154
  except (json.JSONDecodeError, KeyError, IOError, TypeError):
@@ -214,18 +214,31 @@ class AgentVibesServer:
214
214
  # poisoning the audio-effects.cfg lookup or child-shell args.
215
215
  import re as _re
216
216
  llm_key = os.environ.get("AGENTVIBES_LLM", "").strip()
217
- if llm_key and not _re.match(r"^[a-zA-Z0-9_-]+$", llm_key):
217
+ if llm_key and not _re.match(r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", llm_key):
218
218
  print(
219
219
  f"[AgentVibes] WARN: Ignoring invalid AGENTVIBES_LLM='{llm_key}' "
220
- "(must match ^[a-zA-Z0-9_-]+$); falling back to auto-detect",
220
+ "(must match ^[a-zA-Z0-9][a-zA-Z0-9_-]*$); falling back to auto-detect",
221
221
  file=__import__('sys').stderr,
222
222
  )
223
223
  llm_key = ""
224
224
  # Claude Code sets CLAUDECODE=1 when it spawns subprocesses.
225
- # Use that as a fallback identifier when no explicit env var
226
- # was provided. Copilot CLI and Codex do NOT set this.
225
+ #
226
+ # KNOWN LIMITATION: CLAUDECODE=1 can leak from a parent terminal.
227
+ # If the user launches VS Code from a Claude-Code-started shell,
228
+ # Copilot inherits CLAUDECODE=1 and its MCP server will be
229
+ # identified as "claude-code" instead of "copilot". Workaround:
230
+ # `unset CLAUDECODE` before launching VS Code.
227
231
  if not llm_key and os.environ.get("CLAUDECODE", "").strip() == "1":
228
232
  llm_key = "claude-code"
233
+ # AGENTVIBES_MCP_FALLBACK is set in .mcp.json. It's the fallback
234
+ # identity for non-Claude-Code tools that read .mcp.json (e.g.
235
+ # VS Code Copilot, which reads .mcp.json with precedence over
236
+ # its own .vscode/mcp.json). Claude Code hits the CLAUDECODE
237
+ # check above first so it's not affected.
238
+ if not llm_key:
239
+ fallback = os.environ.get("AGENTVIBES_MCP_FALLBACK", "").strip()
240
+ if fallback and _re.match(r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", fallback):
241
+ llm_key = fallback
229
242
  tts_script = "play-tts.ps1" if self.is_windows else "play-tts.sh"
230
243
  play_tts = self.hooks_dir / tts_script
231
244
  if self.is_windows:
@@ -401,15 +414,31 @@ class AgentVibesServer:
401
414
  Get current AgentVibes configuration.
402
415
 
403
416
  Returns:
404
- Current voice, personality, language, and provider settings
417
+ Current voice, personality, language, provider, and LLM settings
405
418
  """
419
+ import re as _re
406
420
  voice = await self._get_current_voice()
407
421
  personality = await self._get_personality()
408
422
  language = await self._get_language()
409
423
  provider = await self._get_provider()
410
424
 
425
+ # Resolve the LLM key using the same priority as text_to_speech:
426
+ # 1. AGENTVIBES_LLM 2. CLAUDECODE=1 3. AGENTVIBES_MCP_FALLBACK 4. "default"
427
+ llm_key = os.environ.get("AGENTVIBES_LLM", "").strip()
428
+ if llm_key and not _re.match(r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", llm_key):
429
+ llm_key = ""
430
+ if not llm_key and os.environ.get("CLAUDECODE", "").strip() == "1":
431
+ llm_key = "claude-code"
432
+ if not llm_key:
433
+ fallback = os.environ.get("AGENTVIBES_MCP_FALLBACK", "").strip()
434
+ if fallback and _re.match(r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", fallback):
435
+ llm_key = fallback
436
+ if not llm_key:
437
+ llm_key = "default"
438
+
411
439
  output = "🎤 Current AgentVibes Configuration\n"
412
440
  output += f"{self.SEPARATOR}\n"
441
+ output += f"LLM: {llm_key}\n"
413
442
  output += f"Provider: {provider}\n"
414
443
  output += f"Voice: {voice}\n"
415
444
  output += f"Personality: {personality}\n"
@@ -912,17 +941,58 @@ class AgentVibesServer:
912
941
  return "✅ TTS banner: **enabled**\n\nSay: \"Turn off banner\" to disable"
913
942
 
914
943
  # Helper methods
944
+ def _resolve_project_dir(self) -> Optional[Path]:
945
+ # Returns the nearest directory containing .claude/, or None.
946
+ # Checked in order: explicit CLAUDE_PROJECT_DIR, npm's INIT_CWD,
947
+ # shell PWD, os.getcwd() and its parents. Required because MCP
948
+ # clients (VS Code Copilot, Codex, Warp, etc.) don't agree on
949
+ # what cwd to spawn the server from, so relying on os.getcwd()
950
+ # alone silently falls back to package config — which breaks
951
+ # project-local per-LLM routing in audio-effects.cfg.
952
+ candidates: list[Path] = []
953
+ for var in ("CLAUDE_PROJECT_DIR", "INIT_CWD", "PWD"):
954
+ val = os.environ.get(var, "").strip()
955
+ if val:
956
+ try:
957
+ candidates.append(Path(val).resolve())
958
+ except (OSError, ValueError):
959
+ pass
960
+ try:
961
+ cwd = Path.cwd().resolve()
962
+ candidates.append(cwd)
963
+ candidates.extend(cwd.parents)
964
+ except (OSError, ValueError):
965
+ pass
966
+
967
+ try:
968
+ agentvibes_root = self.agentvibes_root.resolve()
969
+ except (OSError, ValueError):
970
+ agentvibes_root = self.agentvibes_root
971
+
972
+ seen: set[Path] = set()
973
+ for candidate in candidates:
974
+ if candidate in seen:
975
+ continue
976
+ seen.add(candidate)
977
+ if candidate == agentvibes_root:
978
+ continue
979
+ try:
980
+ if (candidate / ".claude").is_dir():
981
+ return candidate
982
+ except OSError:
983
+ continue
984
+ return None
985
+
915
986
  def _build_script_env(self) -> dict:
916
987
  """Build environment dict for script execution (shared by all script runners)"""
917
988
  env = os.environ.copy()
918
989
 
919
- # Determine where to save settings based on context:
920
- # 1. If cwd has .claude/ → Use cwd (real Claude Code project)
921
- # 2. Otherwise Use global ~/.claude/ (Claude Desktop, Warp, etc.)
922
- # Note: Hooks are ALWAYS from package .claude/ (self.claude_dir)
923
- cwd = Path.cwd()
924
- if (cwd / ".claude").is_dir() and cwd != self.agentvibes_root:
925
- env["CLAUDE_PROJECT_DIR"] = str(cwd)
990
+ # Export CLAUDE_PROJECT_DIR so play-tts.{ps1,sh} reads the
991
+ # project's .claude/config/audio-effects.cfg (per-LLM routing,
992
+ # pretext, effects) instead of the package's bundled copy.
993
+ project_dir = self._resolve_project_dir()
994
+ if project_dir is not None:
995
+ env["CLAUDE_PROJECT_DIR"] = str(project_dir)
926
996
 
927
997
  # Add common locations for piper to PATH (Unix only)
928
998
  if not self.is_windows:
@@ -1237,7 +1307,7 @@ Examples:
1237
1307
  ),
1238
1308
  Tool(
1239
1309
  name="get_verbosity",
1240
- description="Get current AgentVibes verbosity level (low/medium/high). Verbosity controls how much Claude speaks while working - from minimal (acknowledgments only) to maximum transparency (all reasoning spoken).",
1310
+ description="Get current AgentVibes verbosity level (low/medium/high/caveman). Verbosity controls how much Claude speaks while working - from minimal (acknowledgments only) to maximum transparency (all reasoning spoken) to caveman (ultra-terse fragments, max token savings).",
1241
1311
  inputSchema={"type": "object", "properties": {}},
1242
1312
  ),
1243
1313
  Tool(
@@ -1248,11 +1318,13 @@ Verbosity Levels:
1248
1318
  - LOW: Only acknowledgments (start) and completions (end). Minimal interruption.
1249
1319
  - MEDIUM: + Major decisions and key findings. Balanced transparency.
1250
1320
  - HIGH: All reasoning, decisions, and findings. Maximum transparency.
1321
+ - CAVEMAN: Ultra-terse fragments. Drops articles, filler, hedging. Abbreviates heavily. 65-75% fewer output tokens.
1251
1322
 
1252
1323
  Perfect for:
1253
1324
  - LOW: Quiet work sessions, minimal distraction
1254
1325
  - MEDIUM: Understanding major decisions without full narration
1255
1326
  - HIGH: Full transparency, learning mode, debugging complex tasks
1327
+ - CAVEMAN: Maximum token savings, minimal prose
1256
1328
 
1257
1329
  Note: Changes take effect on next Claude Code session restart.""",
1258
1330
  inputSchema={
@@ -1261,7 +1333,7 @@ Note: Changes take effect on next Claude Code session restart.""",
1261
1333
  "level": {
1262
1334
  "type": "string",
1263
1335
  "description": "Verbosity level to set",
1264
- "enum": ["low", "medium", "high"]
1336
+ "enum": ["low", "medium", "high", "caveman"]
1265
1337
  }
1266
1338
  },
1267
1339
  "required": ["level"],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "agentvibes",
4
- "version": "5.1.4",
4
+ "version": "5.2.1",
5
5
  "description": "Now your AI Agents can finally talk back! Professional TTS voice for Claude Code, Claude Desktop (via MCP), and Clawdbot with multi-provider support.",
6
6
  "homepage": "https://agentvibes.org",
7
7
  "keywords": [