---
phase: 34-e2e-pipeline-verification
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
  - .planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md
autonomous: true
requirements:
  - E2E-01
  - E2E-02
  - E2E-03

must_haves:
  truths:
    - "E2E-01 verified: NotificationWatcher detects session-end files, triggers SummaryEngine, dispatches TTS via Python server, drives karaoke subtitles, and delivers Telegram message"
    - "E2E-02 verified: TTSEngine delegates to Python /v1/audio/speech-with-timestamps and SubtitleSyncDriver consumes native MToken word onsets for karaoke highlighting"
    - "E2E-03 verified: tts_kokoro.sh CLI script exists at ~/.local/bin/tts_kokoro.sh and calls the Swift companion HTTP API to synthesize and play audio"
  artifacts:
    - path: ".planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md"
      provides: "Pass/fail evidence for E2E-01, E2E-02, E2E-03"
      contains: "E2E-01"
  key_links: []
---

<objective>
Verify that the full session-end-to-Telegram pipeline (completed in Phase 31 outside GSD) satisfies requirements E2E-01, E2E-02, E2E-03. Produce a VERIFICATION.md with pass/fail evidence for each requirement. No new code is written.

Purpose: Gap closure -- Phase 31 was completed outside GSD and lacks verification artifacts.
Output: `.planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md`
</objective>

<execution_context>
@$HOME/.claude/get-shit-done/workflows/execute-plan.md
@$HOME/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/REQUIREMENTS.md
@.planning/phases/34-e2e-pipeline-verification/34-CONTEXT.md
</context>

<tasks>

<task type="auto">
  <name>Task 1: Inspect codebase for E2E-01/02/03 evidence and produce VERIFICATION.md</name>
  <files>.planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md</files>
  <read_first>
    - plugins/claude-tts-companion/Sources/CompanionCore/NotificationWatcher.swift
    - plugins/claude-tts-companion/Sources/CompanionCore/TTSPipelineCoordinator.swift
    - plugins/claude-tts-companion/Sources/CompanionCore/TTSEngine.swift
    - plugins/claude-tts-companion/Sources/CompanionCore/SubtitleSyncDriver.swift
    - plugins/claude-tts-companion/Sources/CompanionCore/TelegramBot.swift
    - plugins/claude-tts-companion/Sources/CompanionCore/TelegramBotNotifications.swift
    - plugins/claude-tts-companion/Sources/CompanionCore/SummaryEngine.swift
    - plugins/claude-tts-companion/Sources/CompanionCore/CompanionApp.swift
    - ~/.local/bin/tts_kokoro.sh
  </read_first>
  <action>
Inspect the codebase for evidence of each E2E requirement. For each requirement, grep/read the relevant files and record pass/fail with specific evidence (line numbers, code snippets, grep output).

**E2E-01 — Full chain: session ends -> notification -> summary -> TTS via Python -> karaoke subtitles -> Telegram message:**

Trace the full pipeline through these files in order:

1. Read NotificationWatcher.swift — confirm it detects new .json files in the notification directory and triggers a callback/delegate when a session ends
2. Read CompanionApp.swift — confirm the notification callback triggers SummaryEngine (Arc Summary + Tail Brief generation) and then dispatches to TelegramBot
3. Read SummaryEngine.swift — confirm it generates Arc Summary and Tail Brief via MiniMax API
4. Read TelegramBotNotifications.swift — confirm it sends Arc Summary + Tail Brief to Telegram AND dispatches TTS for the Tail Brief text
5. Read TTSPipelineCoordinator.swift — confirm it orchestrates the TTS pipeline (synthesis -> playback -> subtitle sync)
6. Read TTSEngine.swift — confirm it delegates to the Python server at /v1/audio/speech-with-timestamps (not local MLX)
7. Confirm the chain is fully wired: notification detection -> summary -> Telegram delivery + TTS dispatch -> karaoke subtitles

**E2E-02 — TTS audio with native word-level karaoke (Python MToken onsets):**

1. Read TTSEngine.swift — find the HTTP call to the Python server's /v1/audio/speech-with-timestamps endpoint
2. Confirm the response parsing extracts word-level onset/duration arrays (not character-weighted fallback)
3. Read SubtitleSyncDriver.swift — confirm it receives word onsets from TTSEngine and drives karaoke highlighting (gold word advance)
4. Confirm the word onsets flow from Python response -> TTSEngine -> SubtitleSyncDriver (no character-weighted approximation in the path)

**E2E-03 — tts_kokoro.sh CLI regression check:**

1. Read ~/.local/bin/tts_kokoro.sh — confirm the script exists
2. Confirm it calls the Swift companion HTTP API (POST /tts or similar endpoint) to synthesize and play audio
3. Confirm it accepts text as an argument and plays audio end-to-end
4. Check the script is executable (ls -la)

Write `.planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md` with this structure:

```
# E2E Pipeline Verification

**Phase:** 34-e2e-pipeline-verification
**Date:** {today}
**Requirements:** E2E-01, E2E-02, E2E-03

## E2E-01: Full Session-End-to-Telegram Chain
**Status:** PASS | FAIL
**Evidence:**
- {specific file:line references tracing the full chain}

## E2E-02: Native Word-Level Karaoke (Python MToken Onsets)
**Status:** PASS | FAIL
**Evidence:**
- {specific file:line references showing Python onset flow into SubtitleSyncDriver}

## E2E-03: tts_kokoro.sh CLI Regression
**Status:** PASS | FAIL
**Evidence:**
- {script path, key lines, executable status}

## Summary
| Requirement | Status | Key Evidence |
|-------------|--------|--------------|
| E2E-01 | ... | ... |
| E2E-02 | ... | ... |
| E2E-03 | ... | ... |
```

Each evidence section must include at minimum: the file path, the relevant function/property name, and a brief code snippet or grep match proving the requirement is met (or explaining the gap if not).
</action>
<verify>
<automated>test -f .planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md && grep -q "E2E-01" .planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md && grep -q "E2E-02" .planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md && grep -q "E2E-03" .planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md && grep -c "Status:" .planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md | grep -q "3" && echo "PASS" || echo "FAIL"</automated>
</verify>
<acceptance_criteria>- 34-VERIFICATION.md exists with all three E2E requirement sections - Each section has a PASS or FAIL status with file:line evidence - Summary table covers all three requirements - No new source code files created or modified</acceptance_criteria>
<done>VERIFICATION.md exists with pass/fail status and code-level evidence for E2E-01, E2E-02, E2E-03</done>
</task>

</tasks>

<verification>
- `cat .planning/phases/34-e2e-pipeline-verification/34-VERIFICATION.md` shows all three requirements verified
- Each requirement has PASS/FAIL with specific file references
- No source files in plugins/ were modified (verification only)
</verification>

<success_criteria>

- VERIFICATION.md contains evidence-backed pass/fail for E2E-01, E2E-02, E2E-03
- All evidence references actual source files with function names or line numbers
- Zero source code changes in the repository
  </success_criteria>

<output>
After completion, create `.planning/phases/34-e2e-pipeline-verification/34-01-SUMMARY.md`
</output>
