BMAD-METHOD/tools/cli/lib
Claude Code 4fdabfca0d feat: Add provider-agnostic TTS integration via injection point system
Implements comprehensive Text-to-Speech integration for BMAD agents using a generic
TTS_INJECTION marker system. When AgentVibes (or any compatible TTS provider) is
installed, all BMAD agents can speak their responses with unique AI voices.

## Key Features

**Provider-Agnostic Architecture**
- Uses generic `TTS_INJECTION` markers instead of vendor-specific naming
- Future-proof for multiple TTS providers beyond AgentVibes
- Clean separation - BMAD stays TTS-agnostic, providers handle injection

**Installation Flow**
- BMAD → AgentVibes: TTS instructions injected when AgentVibes detects existing BMAD installation
- AgentVibes → BMAD: TTS instructions injected during BMAD installation when AgentVibes detected
- User must manually create voice assignment file when AgentVibes installs first (documented limitation)

**Party Mode Voice Support**
- Each agent speaks with unique assigned voice in multi-agent discussions
- PM, Architect, Developer, Analyst, UX Designer, etc. - all with distinct voices

**Zero Breaking Changes**
- Fully backward compatible - works without any TTS provider
- `TTS_INJECTION` markers are benign HTML comments if not processed
- No changes to existing agent behavior or non-TTS workflows

## Implementation Details

**Files Modified:**
- `tools/cli/installers/lib/core/installer.js` - TTS injection processing logic
- `tools/cli/lib/ui.js` - AgentVibes detection and installation prompts
- `tools/cli/commands/install.js` - Post-install guidance for AgentVibes setup
- `src/utility/models/fragments/activation-rules.xml` - TTS_INJECTION marker for agents
- `src/core/workflows/party-mode/instructions.md` - TTS_INJECTION marker for party mode

**Injection Point System:**
```xml
<rules>
  - ALWAYS communicate in {communication_language}
  <!-- TTS_INJECTION:agent-tts -->
  - Stay in character until exit selected
</rules>
```

When AgentVibes is detected, the installer replaces this marker with:
```
- When responding to user messages, speak your responses using TTS:
  Call: `.claude/hooks/bmad-speak.sh '{agent-id}' '{response-text}'` after each response
  IMPORTANT: Use single quotes - do NOT escape special characters like ! or $
```

**Special Character Handling:**
- Explicit guidance to use single quotes without escaping
- Prevents "backslash exclamation" artifacts in speech

**User Experience:**
```
User: "How should we architect this feature?"
Architect: [Text response] + 🔊 [Professional voice explains architecture]
```

Party Mode:
```
PM (John): "I'll focus on user value..." 🔊 [Male professional voice]
UX Designer (Sara): "From a user perspective..." 🔊 [Female voice]
Architect (Marcus): "The technical approach..." 🔊 [Male technical voice]
```

## Testing

**Unit Tests:**  62/62 passing
- 49/49 schema validation tests
- 13/13 installation component tests

**Integration Testing:**
-  BMAD → AgentVibes (automatic injection)
-  AgentVibes → BMAD (automatic injection)
-  No TTS provider (markers remain as comments)

## Documentation

Comprehensive testing guide created with:
- Both installation scenario walkthroughs
- Verification commands and expected outputs
- Troubleshooting guidance

## Known Limitations

**AgentVibes → BMAD Installation Order:**
When AgentVibes installs first, voice assignment file must be created manually:
```bash
mkdir -p .bmad/_cfg
cat > .bmad/_cfg/agent-voice-map.csv << 'EOF'
agent_id,voice_name
pm,en_US-ryan-high
architect,en_US-danny-low
dev,en_US-joe-medium
EOF
```

This limitation exists to prevent false legacy v4 detection warnings from BMAD installer.

**Recommended:** Install BMAD first, then AgentVibes for automatic voice assignment.

## Related Work

**Companion Implementation:**
- Repository: paulpreibisch/AgentVibes
- Commits: 6 commits implementing injection processing and voice routing
- Features: Retroactive injection, file path extraction, escape stripping

**GitHub Issues:**
- paulpreibisch/AgentVibes#36 - BMAD agent ID support

## Breaking Changes

None. Feature is opt-in and requires separate TTS provider installation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 23:57:45 -07:00
..
activation-builder.js minor dev agent updates 2025-10-11 19:45:25 -05:00
agent-analyzer.js agent updates 2025-10-02 21:45:59 -05:00
agent-party-generator.js installer for bmm includes option to include game assets or not when adding to a project. 2025-10-27 22:38:34 -05:00
cli-utils.js Major Enhancements: 2025-11-09 17:39:05 -06:00
config.js fix: ensure POSIX-compliant newlines in generated files (#856) 2025-11-04 20:18:12 -06:00
file-ops.js feat: v6.0.0-alpha.0 - the future is now 2025-09-28 23:17:07 -05:00
platform-codes.js feat: v6.0.0-alpha.0 - the future is now 2025-09-28 23:17:07 -05:00
project-root.js feat: v6.0.0-alpha.0 - the future is now 2025-09-28 23:17:07 -05:00
replace-project-root.js feat: v6.0.0-alpha.0 - the future is now 2025-09-28 23:17:07 -05:00
ui.js feat: Add provider-agnostic TTS integration via injection point system 2025-11-17 23:57:45 -07:00
xml-handler.js feat: Add ide-only and web-only menu item filtering for platform-specific commands 2025-11-15 19:39:53 -06:00
xml-to-markdown.js feat: v6.0.0-alpha.0 - the future is now 2025-09-28 23:17:07 -05:00
yaml-format.js fix: ensure POSIX-compliant newlines in generated files (#856) 2025-11-04 20:18:12 -06:00
yaml-xml-builder.js Fix: Add prompts and memories merging from customize.yaml (#889) 2025-11-16 00:36:32 -06:00