heymegabyte/agent-skills / 07-quality-and-verification
quality-and-verification
Unverified5-level verification pyramid: static→unit→Playwright E2E (homepage-first, 6bp)→AI visual→post-deploy. 8-check quality gate. Multi-agent testing (functional/security/a11y/performance). Playwright v1.56+ AI agents (Planner/Generator/Healer, v1.63 current). WCAG 2.2 AA via axe-core v4.13. Percy+Chromatic visual regression. ADA Title II 2027/2028 deadlines.
audio-video-sync.md
View on GitHub---
name: "Audio-Video Sync for Form Evidence"
description: "Merge real-time phone call audio with Playwright form submission recordings via ffmpeg. Creates synchronized evidence videos proving what was submitted during live calls."
updated: "2026-04-23"
---
# Audio-Video Sync Pattern
## Architecture
- `activeCallAudio` Map keyed by `echoId` stores live mulaw audio chunks from Twilio WebSocket
- `registerCallAudio(echoId, chunks)` called when profile with applications detected
- `unregisterCallAudio(echoId)` on stream stop
- Form automation checks map before R2 upload
## Merge Pipeline
1. Collect mulaw base64 chunks from `activeCallAudio.get(echoId)`
2. Decode base64 → Buffer, concatenate
3. Convert mulaw 8kHz → PCM 16-bit signed LE
4. Write WAV header (44 bytes: RIFF, fmt chunk, data chunk) with 8000Hz / 16-bit / mono params
5. Write WAV to temp file
6. `ffmpeg -i video.webm -i audio.wav -c:v copy -c:a libopus -shortest synced.webm`
7. Replace original video with synced version
8. Cleanup temp WAV
## Mulaw Decode
- Mulaw → PCM lookup: flip bits, extract sign/exponent/mantissa
- Compute `((mantissa << (exponent + 3)) + bias[exponent]) * (sign ? -1 : 1)`
- Bias table: `[33, 66, 132, 264, 528, 1056, 2112, 4224]`
## Error Recovery
- ffmpeg missing or fails → return original video (graceful degradation)
- WAV write fails → skip merge
- All errors logged but never block form submission
- Temp files cleaned in `finally` block
## Integration Points
- `app.js` WebSocket — push `msg.media.payload` to chunks array on every media event
- `form-automation-service.js` — call `mergeAudioWithVideo(videoPath, echoId)` after Playwright recording stops, before R2 upload
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |